| 1 |
<?php |
| 2 |
/** |
| 3 |
* Parse.ly |
| 4 |
* |
| 5 |
* @package Parsely\wp-parsely |
| 6 |
* @author Parse.ly |
| 7 |
* @copyright 2012 Parse.ly |
| 8 |
* @license GPL-2.0-or-later |
| 9 |
* |
| 10 |
* @wordpress-plugin |
| 11 |
* Plugin Name: Parse.ly |
| 12 |
* Plugin URI: https://www.parse.ly/help/integration/wordpress |
| 13 |
* Description: This plugin makes it a snap to add Parse.ly tracking code to your WordPress blog. |
| 14 |
* Version: 3.1.0 |
| 15 |
* Author: Parse.ly |
| 16 |
* Author URI: https://www.parse.ly |
| 17 |
* Text Domain: wp-parsely |
| 18 |
* License: GPL-2.0-or-later |
| 19 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 20 |
* GitHub Plugin URI: https://github.com/Parsely/wp-parsely |
| 21 |
* Requires PHP: 7.1 |
| 22 |
* Requires WP: 5.0.0 |
| 23 |
*/ |
| 24 |
|
| 25 |
declare(strict_types=1); |
| 26 |
|
| 27 |
namespace Parsely; |
| 28 |
|
| 29 |
use Parsely\Integrations\Amp; |
| 30 |
use Parsely\Integrations\Facebook_Instant_Articles; |
| 31 |
use Parsely\Integrations\Integrations; |
| 32 |
use Parsely\UI\Admin_Bar; |
| 33 |
use Parsely\UI\Admin_Warning; |
| 34 |
use Parsely\UI\Plugins_Actions; |
| 35 |
use Parsely\UI\Recommended_Widget; |
| 36 |
use Parsely\UI\Row_Actions; |
| 37 |
use Parsely\UI\Settings_Page; |
| 38 |
|
| 39 |
if ( class_exists( Parsely::class ) ) { |
| 40 |
return; |
| 41 |
} |
| 42 |
|
| 43 |
const PARSELY_VERSION = '3.1.0'; |
| 44 |
const PARSELY_FILE = __FILE__; |
| 45 |
|
| 46 |
require __DIR__ . '/src/class-parsely.php'; |
| 47 |
require __DIR__ . '/src/class-rest.php'; |
| 48 |
require __DIR__ . '/src/class-scripts.php'; |
| 49 |
require __DIR__ . '/src/class-dashboard-link.php'; |
| 50 |
require __DIR__ . '/src/UI/class-admin-bar.php'; |
| 51 |
|
| 52 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\\parsely_initialize_plugin' ); |
| 53 |
/** |
| 54 |
* Register the basic classes to initialize the plugin. |
| 55 |
* |
| 56 |
* @return void |
| 57 |
*/ |
| 58 |
function parsely_initialize_plugin(): void { |
| 59 |
$GLOBALS['parsely'] = new Parsely(); |
| 60 |
$GLOBALS['parsely']->run(); |
| 61 |
|
| 62 |
$rest = new Rest( $GLOBALS['parsely'] ); |
| 63 |
$rest->run(); |
| 64 |
|
| 65 |
$scripts = new Scripts( $GLOBALS['parsely'] ); |
| 66 |
$scripts->run(); |
| 67 |
|
| 68 |
$admin_bar = new Admin_Bar( $GLOBALS['parsely'] ); |
| 69 |
$admin_bar->run(); |
| 70 |
} |
| 71 |
|
| 72 |
require __DIR__ . '/src/UI/class-admin-warning.php'; |
| 73 |
require __DIR__ . '/src/UI/class-plugins-actions.php'; |
| 74 |
require __DIR__ . '/src/UI/class-row-actions.php'; |
| 75 |
|
| 76 |
add_action( 'admin_init', __NAMESPACE__ . '\\parsely_admin_init_register' ); |
| 77 |
/** |
| 78 |
* Register the Parse.ly wp-admin warnings, plugin actions and row actions. |
| 79 |
* |
| 80 |
* @return void |
| 81 |
*/ |
| 82 |
function parsely_admin_init_register(): void { |
| 83 |
$admin_warning = new Admin_Warning( $GLOBALS['parsely'] ); |
| 84 |
$admin_warning->run(); |
| 85 |
|
| 86 |
$GLOBALS['parsely_ui_plugins_actions'] = new Plugins_Actions(); |
| 87 |
$GLOBALS['parsely_ui_plugins_actions']->run(); |
| 88 |
|
| 89 |
$row_actions = new Row_Actions( $GLOBALS['parsely'] ); |
| 90 |
$row_actions->run(); |
| 91 |
} |
| 92 |
|
| 93 |
require __DIR__ . '/src/UI/class-settings-page.php'; |
| 94 |
|
| 95 |
add_action( '_admin_menu', __NAMESPACE__ . '\\parsely_admin_menu_register' ); |
| 96 |
/** |
| 97 |
* Register the Parse.ly wp-admin settings page. |
| 98 |
* |
| 99 |
* @return void |
| 100 |
*/ |
| 101 |
function parsely_admin_menu_register(): void { |
| 102 |
$settings_page = new Settings_Page( $GLOBALS['parsely'] ); |
| 103 |
$settings_page->run(); |
| 104 |
} |
| 105 |
|
| 106 |
require __DIR__ . '/src/UI/class-recommended-widget.php'; |
| 107 |
|
| 108 |
add_action( 'widgets_init', __NAMESPACE__ . '\\parsely_recommended_widget_register' ); |
| 109 |
/** |
| 110 |
* Register the Parse.ly Recommended widget. |
| 111 |
* |
| 112 |
* @return void |
| 113 |
*/ |
| 114 |
function parsely_recommended_widget_register(): void { |
| 115 |
register_widget( Recommended_Widget::class ); |
| 116 |
} |
| 117 |
|
| 118 |
require __DIR__ . '/src/Integrations/class-integration.php'; |
| 119 |
require __DIR__ . '/src/Integrations/class-integrations.php'; |
| 120 |
require __DIR__ . '/src/Integrations/class-amp.php'; |
| 121 |
require __DIR__ . '/src/Integrations/class-facebook-instant-articles.php'; |
| 122 |
|
| 123 |
add_action( 'init', __NAMESPACE__ . '\\parsely_integrations' ); |
| 124 |
/** |
| 125 |
* Instantiate Integrations collection and register built-in integrations. |
| 126 |
* |
| 127 |
* @since 2.6.0 |
| 128 |
* |
| 129 |
* @return Integrations |
| 130 |
*/ |
| 131 |
function parsely_integrations(): Integrations { |
| 132 |
$parsely_integrations = new Integrations(); |
| 133 |
$parsely_integrations->register( 'amp', Amp::class ); |
| 134 |
$parsely_integrations->register( 'fbia', Facebook_Instant_Articles::class ); |
| 135 |
$parsely_integrations = apply_filters( 'wp_parsely_add_integration', $parsely_integrations ); |
| 136 |
$parsely_integrations->integrate(); |
| 137 |
|
| 138 |
return $parsely_integrations; |
| 139 |
} |
| 140 |
|