PluginProbe
Parse.ly / 3.2.0
Parse.ly v3.2.0
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.2.0, at wp-parsely.php

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