PluginProbe
Parse.ly / 3.3.2
Parse.ly v3.3.2
3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 All 105 releases
wp-parsely / wp-parsely.php

wp-parsely.php in Parse.ly 3.3.2, at wp-parsely.php

193 lines 6.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Parse.ly
4 *
5 * @package 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 and metadata to your WordPress blog.
14 * Version: 3.3.2
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\Endpoints\Related_API_Proxy;
30 use Parsely\Endpoints\GraphQL_Metadata;
31 use Parsely\Endpoints\Rest_Metadata;
32 use Parsely\Integrations\Amp;
33 use Parsely\Integrations\Facebook_Instant_Articles;
34 use Parsely\Integrations\Google_Web_Stories;
35 use Parsely\Integrations\Integrations;
36 use Parsely\RemoteAPI\Cached_Proxy;
37 use Parsely\RemoteAPI\Related_Proxy;
38 use Parsely\RemoteAPI\WordPress_Cache;
39 use Parsely\UI\Admin_Bar;
40 use Parsely\UI\Admin_Warning;
41 use Parsely\UI\Metadata_Renderer;
42 use Parsely\UI\Plugins_Actions;
43 use Parsely\UI\Network_Admin_Sites_List;
44 use Parsely\UI\Recommended_Widget;
45 use Parsely\UI\Row_Actions;
46 use Parsely\UI\Settings_Page;
47
48 if ( class_exists( Parsely::class ) ) {
49 return;
50 }
51
52 const PARSELY_VERSION = '3.3.2';
53 const PARSELY_FILE = __FILE__;
54
55 require __DIR__ . '/src/class-parsely.php';
56 require __DIR__ . '/src/class-scripts.php';
57 require __DIR__ . '/src/class-metadata.php';
58 require __DIR__ . '/src/class-dashboard-link.php';
59 require __DIR__ . '/src/UI/class-admin-bar.php';
60 require __DIR__ . '/src/UI/class-metadata-renderer.php';
61 require __DIR__ . '/src/Endpoints/class-metadata-endpoint.php';
62 require __DIR__ . '/src/Endpoints/class-graphql-metadata.php';
63
64 add_action( 'plugins_loaded', __NAMESPACE__ . '\\parsely_initialize_plugin' );
65 /**
66 * Registers the basic classes to initialize the plugin.
67 */
68 function parsely_initialize_plugin(): void {
69 $GLOBALS['parsely'] = new Parsely();
70 $GLOBALS['parsely']->run();
71
72 if ( class_exists( 'WPGraphQL' ) ) {
73 $graphql = new GraphQL_Metadata( $GLOBALS['parsely'] );
74 $graphql->run();
75 }
76
77 $scripts = new Scripts( $GLOBALS['parsely'] );
78 $scripts->run();
79
80 $admin_bar = new Admin_Bar( $GLOBALS['parsely'] );
81 $admin_bar->run();
82
83 $metadata_renderer = new Metadata_Renderer( $GLOBALS['parsely'] );
84 $metadata_renderer->run();
85 }
86
87 require __DIR__ . '/src/UI/class-admin-warning.php';
88 require __DIR__ . '/src/UI/class-plugins-actions.php';
89 require __DIR__ . '/src/UI/class-row-actions.php';
90
91 add_action( 'admin_init', __NAMESPACE__ . '\\parsely_admin_init_register' );
92 /**
93 * Registers the Parse.ly wp-admin warnings, plugin actions and row actions.
94 */
95 function parsely_admin_init_register(): void {
96 $admin_warning = new Admin_Warning( $GLOBALS['parsely'] );
97 $admin_warning->run();
98
99 $plugins_actions = new Plugins_Actions();
100 $plugins_actions->run();
101
102 $row_actions = new Row_Actions( $GLOBALS['parsely'] );
103 $row_actions->run();
104 }
105
106 require __DIR__ . '/src/UI/class-settings-page.php';
107 require __DIR__ . '/src/UI/class-network-admin-sites-list.php';
108
109 add_action( 'init', __NAMESPACE__ . '\\parsely_wp_admin_early_register' );
110 /**
111 * Registers the additions the Parse.ly wp-admin settings page and Multisite
112 * Network Admin Sites List table.
113 */
114 function parsely_wp_admin_early_register(): void {
115 $settings_page = new Settings_Page( $GLOBALS['parsely'] );
116 $settings_page->run();
117
118 $network_admin_sites_list = new Network_Admin_Sites_List( $GLOBALS['parsely'] );
119 $network_admin_sites_list->run();
120 }
121
122 require __DIR__ . '/src/RemoteAPI/interface-cache.php';
123 require __DIR__ . '/src/RemoteAPI/interface-proxy.php';
124 require __DIR__ . '/src/RemoteAPI/class-base-proxy.php';
125 require __DIR__ . '/src/RemoteAPI/class-cached-proxy.php';
126 require __DIR__ . '/src/RemoteAPI/class-related-proxy.php';
127 require __DIR__ . '/src/RemoteAPI/class-wordpress-cache.php';
128 require __DIR__ . '/src/Endpoints/class-related-api-proxy.php';
129 require __DIR__ . '/src/Endpoints/class-rest-metadata.php';
130
131 add_action( 'rest_api_init', __NAMESPACE__ . '\\parsely_rest_api_init' );
132 /**
133 * Registers REST Endpoints that act as a proxy to the Parse.ly API.
134 * This is needed to get around a CORS issues with Firefox.
135 *
136 * @since 3.2.0
137 */
138 function parsely_rest_api_init(): void {
139 $rest = new Rest_Metadata( $GLOBALS['parsely'] );
140 $rest->run();
141
142 $proxy = new Related_Proxy( $GLOBALS['parsely'] );
143 $cached_proxy = new Cached_Proxy( $proxy, new WordPress_Cache() );
144 $endpoint = new Related_API_Proxy( $GLOBALS['parsely'], $cached_proxy );
145 $endpoint->run();
146 }
147
148 require __DIR__ . '/src/blocks/recommendations/class-recommendations-block.php';
149
150 add_action( 'init', __NAMESPACE__ . '\\init_recommendations_block' );
151 /**
152 * Registers the Recommendations Block.
153 */
154 function init_recommendations_block(): void {
155 $recommendations_block = new Recommendations_Block();
156 $recommendations_block->run();
157 }
158
159 require __DIR__ . '/src/UI/class-recommended-widget.php';
160
161 add_action( 'widgets_init', __NAMESPACE__ . '\\parsely_recommended_widget_register' );
162 /**
163 * Registers the Parse.ly Recommended widget.
164 */
165 function parsely_recommended_widget_register(): void {
166 register_widget( Recommended_Widget::class );
167 }
168
169 require __DIR__ . '/src/Integrations/class-integration.php';
170 require __DIR__ . '/src/Integrations/class-integrations.php';
171 require __DIR__ . '/src/Integrations/class-amp.php';
172 require __DIR__ . '/src/Integrations/class-facebook-instant-articles.php';
173 require __DIR__ . '/src/Integrations/class-google-web-stories.php';
174
175 add_action( 'init', __NAMESPACE__ . '\\parsely_integrations' );
176 /**
177 * Instantiates Integrations collection and registers built-in integrations.
178 *
179 * @since 2.6.0
180 *
181 * @return Integrations
182 */
183 function parsely_integrations(): Integrations {
184 $parsely_integrations = new Integrations();
185 $parsely_integrations->register( 'amp', Amp::class );
186 $parsely_integrations->register( 'fbia', Facebook_Instant_Articles::class );
187 $parsely_integrations->register( 'webstories', Google_Web_Stories::class );
188 $parsely_integrations = apply_filters( 'wp_parsely_add_integration', $parsely_integrations );
189 $parsely_integrations->integrate();
190
191 return $parsely_integrations;
192 }
193