generated from alleyinteractive/create-wordpress-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.php
68 lines (60 loc) · 1.66 KB
/
plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* Plugin Name: Feed Consumer
* Plugin URI: https://github.com/alleyinteractive/feed-consumer
* Description: Ingest external feeds and other data sources into WordPress
* Version: 1.0.1
* Author: Sean Fisher
* Author URI: https://github.com/alleyinteractive/feed-consumer
* Requires at least: 5.9
* Tested up to: 6.4.3
*
* Text Domain: feed-consumer
* Domain Path: /languages/
*
* @package feed-consumer
*/
namespace Feed_Consumer;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/*
* Check whether Composer is installed in this plugin. If it's not, check for an existing Composer
* autoloader in case the plugin is loaded as a Composer dependency within a larger project.
*/
if ( file_exists( __DIR__ . '/vendor/wordpress-autoload.php' ) ) {
require_once __DIR__ . '/vendor/wordpress-autoload.php';
} elseif ( ! class_exists( \Composer\InstalledVersions::class ) ) {
\add_action(
'admin_notices',
function () {
?>
<div class="notice notice-error">
<p><?php esc_html_e( 'Composer is not installed and feed-consumer cannot load. Try using a `*-built` branch if the plugin is being loaded as a submodule.', 'plugin_domain' ); ?></p>
</div>
<?php
}
);
return;
}
/**
* Instantiate the plugin.
*/
function main() {
require_once __DIR__ . '/src/helpers.php';
Processors::instance();
Settings::instance();
Scheduler::instance();
Runner::register_cron_hook();
if ( defined( 'WP_CLI' ) && WP_CLI ) {
\WP_CLI::add_command( 'feed-consumer', CLI::class );
}
}
main();
/**
* Boot the available integrations.
*/
function boot_integrations() {
new Integrations\Byline_Manager();
}
add_action( 'plugins_loaded', __NAMESPACE__ . '\boot_integrations' );