@@ -30,396 +30,396 @@ |
||
30 | 30 | */ |
31 | 31 | class Wordlift_Admin { |
32 | 32 | |
33 | - /** |
|
34 | - * The singleton instance. |
|
35 | - * |
|
36 | - * @since 3.19.4 |
|
37 | - * @access private |
|
38 | - * @var Wordlift_Admin $instance The singleton instance. |
|
39 | - */ |
|
40 | - private static $instance; |
|
41 | - /** |
|
42 | - * The ID of this plugin. |
|
43 | - * |
|
44 | - * @since 1.0.0 |
|
45 | - * @access private |
|
46 | - * @var string $plugin_name The ID of this plugin. |
|
47 | - */ |
|
48 | - private $plugin_name; |
|
49 | - /** |
|
50 | - * The version of this plugin. |
|
51 | - * |
|
52 | - * @since 1.0.0 |
|
53 | - * @access private |
|
54 | - * @var string $version The current version of this plugin. |
|
55 | - */ |
|
56 | - private $version; |
|
57 | - /** |
|
58 | - * The {@link Wordlift_User_Service} instance. |
|
59 | - * |
|
60 | - * @since 3.14.0 |
|
61 | - * @access private |
|
62 | - * @var Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
63 | - */ |
|
64 | - private $user_service; |
|
65 | - /** |
|
66 | - * The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
67 | - * |
|
68 | - * @since 3.20.0 |
|
69 | - * @access private |
|
70 | - * @var Wordlift_Batch_Operation_Ajax_Adapter $sync_batch_operation_ajax_adapter The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
71 | - */ |
|
72 | - private $sync_batch_operation_ajax_adapter; |
|
73 | - |
|
74 | - /** |
|
75 | - * Initialize the class and set its properties. |
|
76 | - * |
|
77 | - * @param string $plugin_name The name of this plugin. |
|
78 | - * @param string $version The version of this plugin. |
|
79 | - * @param Wordlift_Notice_Service $notice_service The notice service. |
|
80 | - * @param Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
81 | - * |
|
82 | - * @since 1.0.0 |
|
83 | - */ |
|
84 | - public function __construct( $plugin_name, $version, $notice_service, $user_service ) { |
|
85 | - |
|
86 | - $this->plugin_name = $plugin_name; |
|
87 | - $this->version = $version; |
|
88 | - |
|
89 | - $this->user_service = $user_service; |
|
90 | - |
|
91 | - $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
92 | - $dataset_uri = $configuration_service->get_dataset_uri(); |
|
93 | - $key = $configuration_service->get_key(); |
|
94 | - $features_registry = Features_Registry::get_instance(); |
|
95 | - if ( empty( $dataset_uri ) ) { |
|
96 | - $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
97 | - if ( empty( $key ) ) { |
|
98 | - /* translators: %s: The link to the settings page. */ |
|
99 | - $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
100 | - } else { |
|
101 | - /* translators: %s: The link to the settings page. */ |
|
102 | - $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
103 | - } |
|
104 | - $notice_service->add_error( $error ); |
|
105 | - } |
|
106 | - |
|
107 | - // Load additional code if we're in the admin UI. |
|
108 | - if ( is_admin() ) { |
|
109 | - |
|
110 | - // Require the PHP files for the next code fragment. |
|
111 | - self::require_files(); |
|
112 | - |
|
113 | - /* |
|
33 | + /** |
|
34 | + * The singleton instance. |
|
35 | + * |
|
36 | + * @since 3.19.4 |
|
37 | + * @access private |
|
38 | + * @var Wordlift_Admin $instance The singleton instance. |
|
39 | + */ |
|
40 | + private static $instance; |
|
41 | + /** |
|
42 | + * The ID of this plugin. |
|
43 | + * |
|
44 | + * @since 1.0.0 |
|
45 | + * @access private |
|
46 | + * @var string $plugin_name The ID of this plugin. |
|
47 | + */ |
|
48 | + private $plugin_name; |
|
49 | + /** |
|
50 | + * The version of this plugin. |
|
51 | + * |
|
52 | + * @since 1.0.0 |
|
53 | + * @access private |
|
54 | + * @var string $version The current version of this plugin. |
|
55 | + */ |
|
56 | + private $version; |
|
57 | + /** |
|
58 | + * The {@link Wordlift_User_Service} instance. |
|
59 | + * |
|
60 | + * @since 3.14.0 |
|
61 | + * @access private |
|
62 | + * @var Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
63 | + */ |
|
64 | + private $user_service; |
|
65 | + /** |
|
66 | + * The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
67 | + * |
|
68 | + * @since 3.20.0 |
|
69 | + * @access private |
|
70 | + * @var Wordlift_Batch_Operation_Ajax_Adapter $sync_batch_operation_ajax_adapter The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
71 | + */ |
|
72 | + private $sync_batch_operation_ajax_adapter; |
|
73 | + |
|
74 | + /** |
|
75 | + * Initialize the class and set its properties. |
|
76 | + * |
|
77 | + * @param string $plugin_name The name of this plugin. |
|
78 | + * @param string $version The version of this plugin. |
|
79 | + * @param Wordlift_Notice_Service $notice_service The notice service. |
|
80 | + * @param Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
81 | + * |
|
82 | + * @since 1.0.0 |
|
83 | + */ |
|
84 | + public function __construct( $plugin_name, $version, $notice_service, $user_service ) { |
|
85 | + |
|
86 | + $this->plugin_name = $plugin_name; |
|
87 | + $this->version = $version; |
|
88 | + |
|
89 | + $this->user_service = $user_service; |
|
90 | + |
|
91 | + $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
92 | + $dataset_uri = $configuration_service->get_dataset_uri(); |
|
93 | + $key = $configuration_service->get_key(); |
|
94 | + $features_registry = Features_Registry::get_instance(); |
|
95 | + if ( empty( $dataset_uri ) ) { |
|
96 | + $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
97 | + if ( empty( $key ) ) { |
|
98 | + /* translators: %s: The link to the settings page. */ |
|
99 | + $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
100 | + } else { |
|
101 | + /* translators: %s: The link to the settings page. */ |
|
102 | + $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
103 | + } |
|
104 | + $notice_service->add_error( $error ); |
|
105 | + } |
|
106 | + |
|
107 | + // Load additional code if we're in the admin UI. |
|
108 | + if ( is_admin() ) { |
|
109 | + |
|
110 | + // Require the PHP files for the next code fragment. |
|
111 | + self::require_files(); |
|
112 | + |
|
113 | + /* |
|
114 | 114 | * @since 3.24.2 This function isn't called anymore because it was causing the Block Category to |
115 | 115 | * multiply in Block Editor. |
116 | 116 | * |
117 | 117 | * @see https://github.com/insideout10/wordlift-plugin/issues/1004 |
118 | 118 | */ |
119 | - // Add Wordlift custom block category. |
|
120 | - // self::add_block_category(); |
|
119 | + // Add Wordlift custom block category. |
|
120 | + // self::add_block_category(); |
|
121 | 121 | |
122 | - new Wordlift_Dashboard_Latest_News(); |
|
122 | + new Wordlift_Dashboard_Latest_News(); |
|
123 | 123 | |
124 | - /* |
|
124 | + /* |
|
125 | 125 | * Add support for `All Entity Types`. |
126 | 126 | * |
127 | 127 | * @since 3.20.0 |
128 | 128 | * |
129 | 129 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
130 | 130 | */ |
131 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
132 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
131 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
132 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
133 | 133 | |
134 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
135 | - /* |
|
134 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
135 | + /* |
|
136 | 136 | * The `Mappings` admin page. |
137 | 137 | */ |
138 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
138 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
139 | 139 | |
140 | - new Wordlift_Admin_Mappings_Page(); |
|
140 | + new Wordlift_Admin_Mappings_Page(); |
|
141 | 141 | |
142 | - /* |
|
142 | + /* |
|
143 | 143 | * Allow sync'ing the schema.org taxonomy with the schema.org json file. |
144 | 144 | * |
145 | 145 | * @since 3.20.0 |
146 | 146 | */ |
147 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
147 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
148 | 148 | |
149 | - $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
149 | + $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
150 | 150 | |
151 | - } |
|
151 | + } |
|
152 | 152 | |
153 | - /* |
|
153 | + /* |
|
154 | 154 | * Add the {@link Wordlift_Admin_Term_Adapter}. |
155 | 155 | * |
156 | 156 | * @since 3.20.0 |
157 | 157 | */ |
158 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
159 | - new Wordlift_Admin_Term_Adapter(); |
|
158 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
159 | + new Wordlift_Admin_Term_Adapter(); |
|
160 | 160 | |
161 | - /* |
|
161 | + /* |
|
162 | 162 | * The new dashboard. |
163 | 163 | * |
164 | 164 | * @since 3.20.0 |
165 | 165 | * |
166 | 166 | * @see https://github.com/insideout10/wordlift-plugin/issues/879 |
167 | 167 | */ |
168 | - new Wordlift_Admin_Dashboard_V2( |
|
169 | - Wordlift_Entity_Service::get_instance() |
|
170 | - ); |
|
171 | - new Wordlift_Admin_Not_Enriched_Filter(); |
|
172 | - |
|
173 | - } |
|
174 | - |
|
175 | - // @@todo only load this class if ACF is available. |
|
176 | - // Add support for ACF mappings, so that the admin edit mappings page can pick up ACF support when ACF is available. |
|
177 | - new Acf_Mappings(); |
|
178 | - |
|
179 | - // Add the Mappings' REST Controller. |
|
180 | - new Mappings_REST_Controller(); |
|
181 | - |
|
182 | - $features_registry->register_feature_from_slug( |
|
183 | - 'mappings', |
|
184 | - ( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ), |
|
185 | - array( $this, 'init_mappings' ) |
|
186 | - ); |
|
187 | - |
|
188 | - // Set the singleton instance. |
|
189 | - self::$instance = $this; |
|
190 | - |
|
191 | - } |
|
192 | - |
|
193 | - /** |
|
194 | - * Require files needed for the Admin UI. |
|
195 | - * |
|
196 | - * @since 3.20.0 |
|
197 | - */ |
|
198 | - private static function require_files() { |
|
199 | - |
|
200 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-latest-news.php'; |
|
201 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
202 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
203 | - |
|
204 | - } |
|
205 | - |
|
206 | - /** |
|
207 | - * Get the singleton instance. |
|
208 | - * |
|
209 | - * @return Wordlift_Admin The singleton instance. |
|
210 | - * @since 3.19.4 |
|
211 | - */ |
|
212 | - public static function get_instance() { |
|
213 | - |
|
214 | - return self::$instance; |
|
215 | - } |
|
216 | - |
|
217 | - public static function is_gutenberg() { |
|
218 | - if ( function_exists( 'is_gutenberg_page' ) && |
|
219 | - is_gutenberg_page() |
|
220 | - ) { |
|
221 | - // The Gutenberg plugin is on. |
|
222 | - return true; |
|
223 | - } |
|
224 | - $current_screen = get_current_screen(); |
|
225 | - if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
226 | - $current_screen->is_block_editor() |
|
227 | - ) { |
|
228 | - // Gutenberg page on 5+. |
|
229 | - return true; |
|
230 | - } |
|
231 | - |
|
232 | - return false; |
|
233 | - } |
|
234 | - |
|
235 | - /** |
|
236 | - * Register the stylesheets for the admin area. |
|
237 | - * |
|
238 | - * @since 1.0.0 |
|
239 | - */ |
|
240 | - public function enqueue_styles() { |
|
241 | - |
|
242 | - /** |
|
243 | - * This function is provided for demonstration purposes only. |
|
244 | - * |
|
245 | - * An instance of this class should be passed to the run() function |
|
246 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
247 | - * in that particular class. |
|
248 | - * |
|
249 | - * The Wordlift_Loader will then create the relationship |
|
250 | - * between the defined hooks and the functions defined in this |
|
251 | - * class. |
|
252 | - */ |
|
253 | - |
|
254 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
255 | - |
|
256 | - } |
|
257 | - |
|
258 | - /** |
|
259 | - * Register the JavaScript for the admin area. |
|
260 | - * |
|
261 | - * @since 1.0.0 |
|
262 | - */ |
|
263 | - public function enqueue_scripts() { |
|
264 | - |
|
265 | - /* |
|
168 | + new Wordlift_Admin_Dashboard_V2( |
|
169 | + Wordlift_Entity_Service::get_instance() |
|
170 | + ); |
|
171 | + new Wordlift_Admin_Not_Enriched_Filter(); |
|
172 | + |
|
173 | + } |
|
174 | + |
|
175 | + // @@todo only load this class if ACF is available. |
|
176 | + // Add support for ACF mappings, so that the admin edit mappings page can pick up ACF support when ACF is available. |
|
177 | + new Acf_Mappings(); |
|
178 | + |
|
179 | + // Add the Mappings' REST Controller. |
|
180 | + new Mappings_REST_Controller(); |
|
181 | + |
|
182 | + $features_registry->register_feature_from_slug( |
|
183 | + 'mappings', |
|
184 | + ( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ), |
|
185 | + array( $this, 'init_mappings' ) |
|
186 | + ); |
|
187 | + |
|
188 | + // Set the singleton instance. |
|
189 | + self::$instance = $this; |
|
190 | + |
|
191 | + } |
|
192 | + |
|
193 | + /** |
|
194 | + * Require files needed for the Admin UI. |
|
195 | + * |
|
196 | + * @since 3.20.0 |
|
197 | + */ |
|
198 | + private static function require_files() { |
|
199 | + |
|
200 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-latest-news.php'; |
|
201 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
202 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
203 | + |
|
204 | + } |
|
205 | + |
|
206 | + /** |
|
207 | + * Get the singleton instance. |
|
208 | + * |
|
209 | + * @return Wordlift_Admin The singleton instance. |
|
210 | + * @since 3.19.4 |
|
211 | + */ |
|
212 | + public static function get_instance() { |
|
213 | + |
|
214 | + return self::$instance; |
|
215 | + } |
|
216 | + |
|
217 | + public static function is_gutenberg() { |
|
218 | + if ( function_exists( 'is_gutenberg_page' ) && |
|
219 | + is_gutenberg_page() |
|
220 | + ) { |
|
221 | + // The Gutenberg plugin is on. |
|
222 | + return true; |
|
223 | + } |
|
224 | + $current_screen = get_current_screen(); |
|
225 | + if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
226 | + $current_screen->is_block_editor() |
|
227 | + ) { |
|
228 | + // Gutenberg page on 5+. |
|
229 | + return true; |
|
230 | + } |
|
231 | + |
|
232 | + return false; |
|
233 | + } |
|
234 | + |
|
235 | + /** |
|
236 | + * Register the stylesheets for the admin area. |
|
237 | + * |
|
238 | + * @since 1.0.0 |
|
239 | + */ |
|
240 | + public function enqueue_styles() { |
|
241 | + |
|
242 | + /** |
|
243 | + * This function is provided for demonstration purposes only. |
|
244 | + * |
|
245 | + * An instance of this class should be passed to the run() function |
|
246 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
247 | + * in that particular class. |
|
248 | + * |
|
249 | + * The Wordlift_Loader will then create the relationship |
|
250 | + * between the defined hooks and the functions defined in this |
|
251 | + * class. |
|
252 | + */ |
|
253 | + |
|
254 | + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
255 | + |
|
256 | + } |
|
257 | + |
|
258 | + /** |
|
259 | + * Register the JavaScript for the admin area. |
|
260 | + * |
|
261 | + * @since 1.0.0 |
|
262 | + */ |
|
263 | + public function enqueue_scripts() { |
|
264 | + |
|
265 | + /* |
|
266 | 266 | * Do not load our scripts on the Filter Urls plugin admin pages. |
267 | 267 | * |
268 | 268 | * @see https://github.com/insideout10/wordlift-plugin/issues/901 |
269 | 269 | * @since 3.20.0 |
270 | 270 | */ |
271 | - $screen = get_current_screen(); |
|
272 | - if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
273 | - return; |
|
274 | - } |
|
275 | - |
|
276 | - // Enqueue the admin scripts. |
|
277 | - wp_enqueue_script( |
|
278 | - $this->plugin_name, |
|
279 | - plugin_dir_url( __FILE__ ) . 'js/1/admin.js', |
|
280 | - array( |
|
281 | - 'jquery', |
|
282 | - 'underscore', |
|
283 | - 'backbone', |
|
284 | - ), |
|
285 | - $this->version, |
|
286 | - false |
|
287 | - ); |
|
288 | - |
|
289 | - $params = $this->get_params(); |
|
290 | - |
|
291 | - // Finally output the params as `wlSettings` for JavaScript code. |
|
292 | - wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
293 | - |
|
294 | - } |
|
295 | - |
|
296 | - /** |
|
297 | - * Return the settings array by applying filters. |
|
298 | - * |
|
299 | - * @return array |
|
300 | - */ |
|
301 | - public function get_params() { |
|
302 | - $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
303 | - /* |
|
271 | + $screen = get_current_screen(); |
|
272 | + if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
273 | + return; |
|
274 | + } |
|
275 | + |
|
276 | + // Enqueue the admin scripts. |
|
277 | + wp_enqueue_script( |
|
278 | + $this->plugin_name, |
|
279 | + plugin_dir_url( __FILE__ ) . 'js/1/admin.js', |
|
280 | + array( |
|
281 | + 'jquery', |
|
282 | + 'underscore', |
|
283 | + 'backbone', |
|
284 | + ), |
|
285 | + $this->version, |
|
286 | + false |
|
287 | + ); |
|
288 | + |
|
289 | + $params = $this->get_params(); |
|
290 | + |
|
291 | + // Finally output the params as `wlSettings` for JavaScript code. |
|
292 | + wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
293 | + |
|
294 | + } |
|
295 | + |
|
296 | + /** |
|
297 | + * Return the settings array by applying filters. |
|
298 | + * |
|
299 | + * @return array |
|
300 | + */ |
|
301 | + public function get_params() { |
|
302 | + $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
303 | + /* |
|
304 | 304 | * People that can create entities will see the scope set in the wp-config.php file (by default `cloud`). People |
305 | 305 | * that cannot edit create entities will always see the local entities. |
306 | 306 | * |
307 | 307 | * @see https://github.com/insideout10/wordlift-plugin/issues/839 |
308 | 308 | */ |
309 | - $autocomplete_scope = $can_edit_wordlift_entities ? WL_AUTOCOMPLETE_SCOPE : 'local'; |
|
310 | - |
|
311 | - // Set the basic params. |
|
312 | - $params = array( |
|
313 | - // @todo scripts in admin should use wp.post. |
|
314 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
315 | - // @todo remove specific actions from settings. |
|
316 | - 'action' => 'entity_by_title', |
|
317 | - 'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(), |
|
318 | - 'language' => Wordlift_Configuration_Service::get_instance()->get_language_code(), |
|
319 | - 'link_by_default' => Wordlift_Configuration_Service::get_instance()->is_link_by_default(), |
|
320 | - // Whether the current user is allowed to create new entities. |
|
321 | - // |
|
322 | - // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
|
323 | - // @see https://github.com/insideout10/wordlift-plugin/issues/1267 |
|
324 | - 'can_create_entities' => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no', |
|
325 | - 'l10n' => array( |
|
326 | - 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
327 | - 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
328 | - 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
329 | - 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
330 | - 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
331 | - 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
332 | - 'Please wait while we look for ingredients in the linked data cloud...' => _x( 'Please wait while we look for ingredients in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
333 | - 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
334 | - ), |
|
335 | - 'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ), |
|
336 | - 'autocomplete_scope' => $autocomplete_scope, |
|
337 | - 'wl_video_api_nonce' => wp_create_nonce( 'wl_video_api_nonce' ), |
|
338 | - |
|
339 | - /** |
|
340 | - * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
|
341 | - * or change the TinyMCE id. |
|
342 | - * |
|
343 | - * The editor id is currently referenced by `src/coffee/editpost-widget/app.services.EditorAdapter.coffee`. |
|
344 | - * |
|
345 | - * @param string $editor The default editor id, by default `content`. |
|
346 | - * |
|
347 | - * @see https://github.com/insideout10/wordlift-plugin/issues/848 |
|
348 | - * |
|
349 | - * @since 3.19.4 |
|
350 | - */ |
|
351 | - 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
352 | - |
|
353 | - 'analysis' => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ), |
|
354 | - /** |
|
355 | - * Faceted search default limit |
|
356 | - * |
|
357 | - * @since 3.26.1 |
|
358 | - */ |
|
359 | - 'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ), |
|
360 | - /** |
|
361 | - * WL Root path, to access in JS |
|
362 | - * |
|
363 | - * @since 3.27.3 |
|
364 | - */ |
|
365 | - 'wl_root' => plugin_dir_url( __DIR__ ), |
|
366 | - /** |
|
367 | - * Enable synonyms, to access in JS |
|
368 | - * Show classification sidebar, to access in JS |
|
369 | - * |
|
370 | - * @since 3.30.0 |
|
371 | - */ |
|
372 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
373 | - 'can_add_synonyms' => apply_filters( 'wl_feature__enable__add-synonyms', true ), |
|
374 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
375 | - 'show_classification_sidebar' => apply_filters( 'wl_feature__enable__classification-sidebar', true ), |
|
376 | - // By default the videoobject should not show. |
|
377 | - 'show_videoobject' => apply_filters( 'wl_feature__enable__videoobject', false ), |
|
378 | - ); |
|
379 | - |
|
380 | - // Set post-related values if there's a current post. |
|
381 | - $entity_being_edited = get_post(); |
|
382 | - $post = $entity_being_edited; |
|
383 | - if ( null !== $post ) { |
|
384 | - |
|
385 | - $params['post_id'] = $entity_being_edited->ID; |
|
386 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
387 | - $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
388 | - // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
|
389 | - // from the results, since we don't want the current entity to be discovered by the analysis. |
|
390 | - // |
|
391 | - // See https://github.com/insideout10/wordlift-plugin/issues/345 |
|
392 | - $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
393 | - $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
394 | - |
|
395 | - /* |
|
309 | + $autocomplete_scope = $can_edit_wordlift_entities ? WL_AUTOCOMPLETE_SCOPE : 'local'; |
|
310 | + |
|
311 | + // Set the basic params. |
|
312 | + $params = array( |
|
313 | + // @todo scripts in admin should use wp.post. |
|
314 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
315 | + // @todo remove specific actions from settings. |
|
316 | + 'action' => 'entity_by_title', |
|
317 | + 'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(), |
|
318 | + 'language' => Wordlift_Configuration_Service::get_instance()->get_language_code(), |
|
319 | + 'link_by_default' => Wordlift_Configuration_Service::get_instance()->is_link_by_default(), |
|
320 | + // Whether the current user is allowed to create new entities. |
|
321 | + // |
|
322 | + // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
|
323 | + // @see https://github.com/insideout10/wordlift-plugin/issues/1267 |
|
324 | + 'can_create_entities' => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no', |
|
325 | + 'l10n' => array( |
|
326 | + 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
327 | + 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
328 | + 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
329 | + 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
330 | + 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
331 | + 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
332 | + 'Please wait while we look for ingredients in the linked data cloud...' => _x( 'Please wait while we look for ingredients in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
333 | + 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
334 | + ), |
|
335 | + 'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ), |
|
336 | + 'autocomplete_scope' => $autocomplete_scope, |
|
337 | + 'wl_video_api_nonce' => wp_create_nonce( 'wl_video_api_nonce' ), |
|
338 | + |
|
339 | + /** |
|
340 | + * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
|
341 | + * or change the TinyMCE id. |
|
342 | + * |
|
343 | + * The editor id is currently referenced by `src/coffee/editpost-widget/app.services.EditorAdapter.coffee`. |
|
344 | + * |
|
345 | + * @param string $editor The default editor id, by default `content`. |
|
346 | + * |
|
347 | + * @see https://github.com/insideout10/wordlift-plugin/issues/848 |
|
348 | + * |
|
349 | + * @since 3.19.4 |
|
350 | + */ |
|
351 | + 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
352 | + |
|
353 | + 'analysis' => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ), |
|
354 | + /** |
|
355 | + * Faceted search default limit |
|
356 | + * |
|
357 | + * @since 3.26.1 |
|
358 | + */ |
|
359 | + 'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ), |
|
360 | + /** |
|
361 | + * WL Root path, to access in JS |
|
362 | + * |
|
363 | + * @since 3.27.3 |
|
364 | + */ |
|
365 | + 'wl_root' => plugin_dir_url( __DIR__ ), |
|
366 | + /** |
|
367 | + * Enable synonyms, to access in JS |
|
368 | + * Show classification sidebar, to access in JS |
|
369 | + * |
|
370 | + * @since 3.30.0 |
|
371 | + */ |
|
372 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
373 | + 'can_add_synonyms' => apply_filters( 'wl_feature__enable__add-synonyms', true ), |
|
374 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
375 | + 'show_classification_sidebar' => apply_filters( 'wl_feature__enable__classification-sidebar', true ), |
|
376 | + // By default the videoobject should not show. |
|
377 | + 'show_videoobject' => apply_filters( 'wl_feature__enable__videoobject', false ), |
|
378 | + ); |
|
379 | + |
|
380 | + // Set post-related values if there's a current post. |
|
381 | + $entity_being_edited = get_post(); |
|
382 | + $post = $entity_being_edited; |
|
383 | + if ( null !== $post ) { |
|
384 | + |
|
385 | + $params['post_id'] = $entity_being_edited->ID; |
|
386 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
387 | + $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
388 | + // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
|
389 | + // from the results, since we don't want the current entity to be discovered by the analysis. |
|
390 | + // |
|
391 | + // See https://github.com/insideout10/wordlift-plugin/issues/345 |
|
392 | + $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
393 | + $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
394 | + |
|
395 | + /* |
|
396 | 396 | * Add the `properties` if `WL_ALL_ENTITY_TYPES` is enabled. |
397 | 397 | * |
398 | 398 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
399 | 399 | */ |
400 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
401 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
402 | - $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
403 | - } |
|
404 | - } |
|
405 | - |
|
406 | - return $params; |
|
407 | - } |
|
408 | - |
|
409 | - /** |
|
410 | - * Initialize the mappings. |
|
411 | - * |
|
412 | - * @return void |
|
413 | - */ |
|
414 | - public function init_mappings() { |
|
415 | - new Admin_Mappings_Page(); |
|
416 | - /** |
|
417 | - * @since 3.27.0 |
|
418 | - * Hooks in to ui of edit mapping screen, add taxonomy as a option. |
|
419 | - */ |
|
420 | - $taxonomy_option = new Taxonomy_Option(); |
|
421 | - $taxonomy_option->add_taxonomy_option(); |
|
422 | - new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() ); |
|
423 | - } |
|
400 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
401 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
402 | + $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
403 | + } |
|
404 | + } |
|
405 | + |
|
406 | + return $params; |
|
407 | + } |
|
408 | + |
|
409 | + /** |
|
410 | + * Initialize the mappings. |
|
411 | + * |
|
412 | + * @return void |
|
413 | + */ |
|
414 | + public function init_mappings() { |
|
415 | + new Admin_Mappings_Page(); |
|
416 | + /** |
|
417 | + * @since 3.27.0 |
|
418 | + * Hooks in to ui of edit mapping screen, add taxonomy as a option. |
|
419 | + */ |
|
420 | + $taxonomy_option = new Taxonomy_Option(); |
|
421 | + $taxonomy_option->add_taxonomy_option(); |
|
422 | + new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() ); |
|
423 | + } |
|
424 | 424 | |
425 | 425 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @since 1.0.0 |
83 | 83 | */ |
84 | - public function __construct( $plugin_name, $version, $notice_service, $user_service ) { |
|
84 | + public function __construct($plugin_name, $version, $notice_service, $user_service) { |
|
85 | 85 | |
86 | 86 | $this->plugin_name = $plugin_name; |
87 | 87 | $this->version = $version; |
@@ -92,20 +92,20 @@ discard block |
||
92 | 92 | $dataset_uri = $configuration_service->get_dataset_uri(); |
93 | 93 | $key = $configuration_service->get_key(); |
94 | 94 | $features_registry = Features_Registry::get_instance(); |
95 | - if ( empty( $dataset_uri ) ) { |
|
95 | + if (empty($dataset_uri)) { |
|
96 | 96 | $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
97 | - if ( empty( $key ) ) { |
|
97 | + if (empty($key)) { |
|
98 | 98 | /* translators: %s: The link to the settings page. */ |
99 | - $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
99 | + $error = sprintf(esc_html__("WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>'); |
|
100 | 100 | } else { |
101 | 101 | /* translators: %s: The link to the settings page. */ |
102 | - $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
102 | + $error = sprintf(esc_html__("WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>'); |
|
103 | 103 | } |
104 | - $notice_service->add_error( $error ); |
|
104 | + $notice_service->add_error($error); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // Load additional code if we're in the admin UI. |
108 | - if ( is_admin() ) { |
|
108 | + if (is_admin()) { |
|
109 | 109 | |
110 | 110 | // Require the PHP files for the next code fragment. |
111 | 111 | self::require_files(); |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
130 | 130 | */ |
131 | 131 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
132 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
132 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
133 | 133 | |
134 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
134 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
135 | 135 | /* |
136 | 136 | * The `Mappings` admin page. |
137 | 137 | */ |
138 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
138 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-mappings-page.php'; |
|
139 | 139 | |
140 | 140 | new Wordlift_Admin_Mappings_Page(); |
141 | 141 | |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @since 3.20.0 |
146 | 146 | */ |
147 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
147 | + require_once plugin_dir_path(__DIR__).'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
148 | 148 | |
149 | - $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
149 | + $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter(new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync'); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @since 3.20.0 |
157 | 157 | */ |
158 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
158 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-term-adapter.php'; |
|
159 | 159 | new Wordlift_Admin_Term_Adapter(); |
160 | 160 | |
161 | 161 | /* |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | |
182 | 182 | $features_registry->register_feature_from_slug( |
183 | 183 | 'mappings', |
184 | - ( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ), |
|
185 | - array( $this, 'init_mappings' ) |
|
184 | + (defined('WL_ENABLE_MAPPINGS') && WL_ENABLE_MAPPINGS), |
|
185 | + array($this, 'init_mappings') |
|
186 | 186 | ); |
187 | 187 | |
188 | 188 | // Set the singleton instance. |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | */ |
198 | 198 | private static function require_files() { |
199 | 199 | |
200 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-latest-news.php'; |
|
201 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
202 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
200 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-dashboard-latest-news.php'; |
|
201 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-dashboard-v2.php'; |
|
202 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
203 | 203 | |
204 | 204 | } |
205 | 205 | |
@@ -215,14 +215,14 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | public static function is_gutenberg() { |
218 | - if ( function_exists( 'is_gutenberg_page' ) && |
|
218 | + if (function_exists('is_gutenberg_page') && |
|
219 | 219 | is_gutenberg_page() |
220 | 220 | ) { |
221 | 221 | // The Gutenberg plugin is on. |
222 | 222 | return true; |
223 | 223 | } |
224 | 224 | $current_screen = get_current_screen(); |
225 | - if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
225 | + if (method_exists($current_screen, 'is_block_editor') && |
|
226 | 226 | $current_screen->is_block_editor() |
227 | 227 | ) { |
228 | 228 | // Gutenberg page on 5+. |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * class. |
252 | 252 | */ |
253 | 253 | |
254 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
254 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-admin.css', array(), $this->version, 'all'); |
|
255 | 255 | |
256 | 256 | } |
257 | 257 | |
@@ -269,14 +269,14 @@ discard block |
||
269 | 269 | * @since 3.20.0 |
270 | 270 | */ |
271 | 271 | $screen = get_current_screen(); |
272 | - if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
272 | + if (is_a($screen, 'WP_Screen') && 'filter-urls_page_filter_urls_form' === $screen->id) { |
|
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | 276 | // Enqueue the admin scripts. |
277 | 277 | wp_enqueue_script( |
278 | 278 | $this->plugin_name, |
279 | - plugin_dir_url( __FILE__ ) . 'js/1/admin.js', |
|
279 | + plugin_dir_url(__FILE__).'js/1/admin.js', |
|
280 | 280 | array( |
281 | 281 | 'jquery', |
282 | 282 | 'underscore', |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $params = $this->get_params(); |
290 | 290 | |
291 | 291 | // Finally output the params as `wlSettings` for JavaScript code. |
292 | - wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
292 | + wp_localize_script($this->plugin_name, 'wlSettings', apply_filters('wl_admin_settings', $params)); |
|
293 | 293 | |
294 | 294 | } |
295 | 295 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @return array |
300 | 300 | */ |
301 | 301 | public function get_params() { |
302 | - $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
302 | + $can_edit_wordlift_entities = current_user_can('edit_wordlift_entities'); |
|
303 | 303 | /* |
304 | 304 | * People that can create entities will see the scope set in the wp-config.php file (by default `cloud`). People |
305 | 305 | * that cannot edit create entities will always see the local entities. |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | // Set the basic params. |
312 | 312 | $params = array( |
313 | 313 | // @todo scripts in admin should use wp.post. |
314 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
314 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
315 | 315 | // @todo remove specific actions from settings. |
316 | 316 | 'action' => 'entity_by_title', |
317 | 317 | 'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(), |
@@ -321,20 +321,20 @@ discard block |
||
321 | 321 | // |
322 | 322 | // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
323 | 323 | // @see https://github.com/insideout10/wordlift-plugin/issues/1267 |
324 | - 'can_create_entities' => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no', |
|
324 | + 'can_create_entities' => apply_filters('wl_feature__enable__dataset', true) ? ($can_edit_wordlift_entities ? 'yes' : 'no') : 'no', |
|
325 | 325 | 'l10n' => array( |
326 | - 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
327 | - 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
328 | - 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
329 | - 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
330 | - 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
331 | - 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
332 | - 'Please wait while we look for ingredients in the linked data cloud...' => _x( 'Please wait while we look for ingredients in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
333 | - 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
326 | + 'You already published an entity with the same name' => __('You already published an entity with the same name: ', 'wordlift'), |
|
327 | + 'logo_selection_title' => __('WordLift Choose Logo', 'wordlift'), |
|
328 | + 'logo_selection_button' => array('text' => __('Choose Logo', 'wordlift')), |
|
329 | + 'Type at least 3 characters to search...' => _x('Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift'), |
|
330 | + 'No results found for your search.' => _x('No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift'), |
|
331 | + 'Please wait while we look for entities in the linked data cloud...' => _x('Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift'), |
|
332 | + 'Please wait while we look for ingredients in the linked data cloud...' => _x('Please wait while we look for ingredients in the linked data cloud...', 'Autocomplete Select', 'wordlift'), |
|
333 | + 'Add keywords to track' => __('Add Keywords to track', 'wordlift'), |
|
334 | 334 | ), |
335 | - 'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ), |
|
335 | + 'wl_autocomplete_nonce' => wp_create_nonce('wl_autocomplete'), |
|
336 | 336 | 'autocomplete_scope' => $autocomplete_scope, |
337 | - 'wl_video_api_nonce' => wp_create_nonce( 'wl_video_api_nonce' ), |
|
337 | + 'wl_video_api_nonce' => wp_create_nonce('wl_video_api_nonce'), |
|
338 | 338 | |
339 | 339 | /** |
340 | 340 | * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
@@ -348,21 +348,21 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @since 3.19.4 |
350 | 350 | */ |
351 | - 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
351 | + 'default_editor_id' => apply_filters('wl_default_editor_id', 'content'), |
|
352 | 352 | |
353 | - 'analysis' => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ), |
|
353 | + 'analysis' => array('_wpnonce' => wp_create_nonce('wl_analyze')), |
|
354 | 354 | /** |
355 | 355 | * Faceted search default limit |
356 | 356 | * |
357 | 357 | * @since 3.26.1 |
358 | 358 | */ |
359 | - 'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ), |
|
359 | + 'faceted_search_default_limit' => apply_filters('wl_faceted_search_default_limit', 10), |
|
360 | 360 | /** |
361 | 361 | * WL Root path, to access in JS |
362 | 362 | * |
363 | 363 | * @since 3.27.3 |
364 | 364 | */ |
365 | - 'wl_root' => plugin_dir_url( __DIR__ ), |
|
365 | + 'wl_root' => plugin_dir_url(__DIR__), |
|
366 | 366 | /** |
367 | 367 | * Enable synonyms, to access in JS |
368 | 368 | * Show classification sidebar, to access in JS |
@@ -370,27 +370,27 @@ discard block |
||
370 | 370 | * @since 3.30.0 |
371 | 371 | */ |
372 | 372 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
373 | - 'can_add_synonyms' => apply_filters( 'wl_feature__enable__add-synonyms', true ), |
|
373 | + 'can_add_synonyms' => apply_filters('wl_feature__enable__add-synonyms', true), |
|
374 | 374 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
375 | - 'show_classification_sidebar' => apply_filters( 'wl_feature__enable__classification-sidebar', true ), |
|
375 | + 'show_classification_sidebar' => apply_filters('wl_feature__enable__classification-sidebar', true), |
|
376 | 376 | // By default the videoobject should not show. |
377 | - 'show_videoobject' => apply_filters( 'wl_feature__enable__videoobject', false ), |
|
377 | + 'show_videoobject' => apply_filters('wl_feature__enable__videoobject', false), |
|
378 | 378 | ); |
379 | 379 | |
380 | 380 | // Set post-related values if there's a current post. |
381 | 381 | $entity_being_edited = get_post(); |
382 | 382 | $post = $entity_being_edited; |
383 | - if ( null !== $post ) { |
|
383 | + if (null !== $post) { |
|
384 | 384 | |
385 | 385 | $params['post_id'] = $entity_being_edited->ID; |
386 | 386 | $entity_service = Wordlift_Entity_Service::get_instance(); |
387 | - $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
387 | + $params['entityBeingEdited'] = isset($entity_being_edited->post_type) && $entity_service->is_entity($post->ID) && is_numeric(get_the_ID()); |
|
388 | 388 | // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
389 | 389 | // from the results, since we don't want the current entity to be discovered by the analysis. |
390 | 390 | // |
391 | 391 | // See https://github.com/insideout10/wordlift-plugin/issues/345 |
392 | - $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
393 | - $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
392 | + $params['itemId'] = $entity_service->get_uri($entity_being_edited->ID); |
|
393 | + $params['wl_schemaorg_property_nonce'] = wp_create_nonce('wl_schemaorg_property'); |
|
394 | 394 | |
395 | 395 | /* |
396 | 396 | * Add the `properties` if `WL_ALL_ENTITY_TYPES` is enabled. |
@@ -398,8 +398,8 @@ discard block |
||
398 | 398 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
399 | 399 | */ |
400 | 400 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
401 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
402 | - $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
401 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
402 | + $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all($post->ID); |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | */ |
420 | 420 | $taxonomy_option = new Taxonomy_Option(); |
421 | 421 | $taxonomy_option->add_taxonomy_option(); |
422 | - new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() ); |
|
422 | + new Edit_Mappings_Page(new Mappings_Transform_Functions_Registry()); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | } |
@@ -83,1810 +83,1810 @@ |
||
83 | 83 | */ |
84 | 84 | class Wordlift { |
85 | 85 | |
86 | - /** |
|
87 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
88 | - * the plugin. |
|
89 | - * |
|
90 | - * @since 1.0.0 |
|
91 | - * @access protected |
|
92 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
93 | - */ |
|
94 | - protected $loader; |
|
95 | - |
|
96 | - /** |
|
97 | - * The unique identifier of this plugin. |
|
98 | - * |
|
99 | - * @since 1.0.0 |
|
100 | - * @access protected |
|
101 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
102 | - */ |
|
103 | - protected $plugin_name; |
|
104 | - |
|
105 | - /** |
|
106 | - * The current version of the plugin. |
|
107 | - * |
|
108 | - * @since 1.0.0 |
|
109 | - * @access protected |
|
110 | - * @var string $version The current version of the plugin. |
|
111 | - */ |
|
112 | - protected $version; |
|
113 | - |
|
114 | - /** |
|
115 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
116 | - * |
|
117 | - * @since 3.12.0 |
|
118 | - * @access protected |
|
119 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
120 | - */ |
|
121 | - protected $tinymce_adapter; |
|
122 | - |
|
123 | - /** |
|
124 | - * The Schema service. |
|
125 | - * |
|
126 | - * @since 3.3.0 |
|
127 | - * @access protected |
|
128 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
129 | - */ |
|
130 | - protected $schema_service; |
|
131 | - |
|
132 | - /** |
|
133 | - * The Topic Taxonomy service. |
|
134 | - * |
|
135 | - * @since 3.5.0 |
|
136 | - * @access private |
|
137 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
138 | - */ |
|
139 | - private $topic_taxonomy_service; |
|
140 | - |
|
141 | - /** |
|
142 | - * The Entity Types Taxonomy service. |
|
143 | - * |
|
144 | - * @since 3.18.0 |
|
145 | - * @access private |
|
146 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
147 | - */ |
|
148 | - private $entity_types_taxonomy_service; |
|
149 | - |
|
150 | - /** |
|
151 | - * The User service. |
|
152 | - * |
|
153 | - * @since 3.1.7 |
|
154 | - * @access protected |
|
155 | - * @var \Wordlift_User_Service $user_service The User service. |
|
156 | - */ |
|
157 | - protected $user_service; |
|
158 | - |
|
159 | - /** |
|
160 | - * The Timeline service. |
|
161 | - * |
|
162 | - * @since 3.1.0 |
|
163 | - * @access private |
|
164 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
165 | - */ |
|
166 | - private $timeline_service; |
|
167 | - |
|
168 | - /** |
|
169 | - * The Redirect service. |
|
170 | - * |
|
171 | - * @since 3.2.0 |
|
172 | - * @access private |
|
173 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
174 | - */ |
|
175 | - private $redirect_service; |
|
176 | - |
|
177 | - /** |
|
178 | - * The Notice service. |
|
179 | - * |
|
180 | - * @since 3.3.0 |
|
181 | - * @access private |
|
182 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
183 | - */ |
|
184 | - private $notice_service; |
|
185 | - |
|
186 | - /** |
|
187 | - * The Entity list customization. |
|
188 | - * |
|
189 | - * @since 3.3.0 |
|
190 | - * @access protected |
|
191 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
192 | - */ |
|
193 | - protected $entity_list_service; |
|
194 | - |
|
195 | - /** |
|
196 | - * The Entity Types Taxonomy Walker. |
|
197 | - * |
|
198 | - * @since 3.1.0 |
|
199 | - * @access private |
|
200 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
201 | - */ |
|
202 | - private $entity_types_taxonomy_walker; |
|
203 | - |
|
204 | - /** |
|
205 | - * The ShareThis service. |
|
206 | - * |
|
207 | - * @since 3.2.0 |
|
208 | - * @access private |
|
209 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
210 | - */ |
|
211 | - private $sharethis_service; |
|
212 | - |
|
213 | - /** |
|
214 | - * The PrimaShop adapter. |
|
215 | - * |
|
216 | - * @since 3.2.3 |
|
217 | - * @access private |
|
218 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
219 | - */ |
|
220 | - private $primashop_adapter; |
|
221 | - |
|
222 | - /** |
|
223 | - * The entity type service. |
|
224 | - * |
|
225 | - * @since 3.6.0 |
|
226 | - * @access private |
|
227 | - * @var \Wordlift_Entity_Post_Type_Service |
|
228 | - */ |
|
229 | - private $entity_post_type_service; |
|
230 | - |
|
231 | - /** |
|
232 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
233 | - * |
|
234 | - * @since 3.6.0 |
|
235 | - * @access private |
|
236 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
237 | - */ |
|
238 | - private $entity_link_service; |
|
239 | - |
|
240 | - /** |
|
241 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
242 | - * |
|
243 | - * @since 3.7.0 |
|
244 | - * @access protected |
|
245 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
246 | - */ |
|
247 | - protected $jsonld_service; |
|
248 | - |
|
249 | - /** |
|
250 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
251 | - * |
|
252 | - * @since 3.14.0 |
|
253 | - * @access protected |
|
254 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
255 | - */ |
|
256 | - protected $jsonld_website_converter; |
|
257 | - |
|
258 | - /** |
|
259 | - * A {@link Wordlift_Property_Factory} instance. |
|
260 | - * |
|
261 | - * @since 3.7.0 |
|
262 | - * @access private |
|
263 | - * @var \Wordlift_Property_Factory $property_factory |
|
264 | - */ |
|
265 | - private $property_factory; |
|
266 | - |
|
267 | - /** |
|
268 | - * The 'Download Your Data' page. |
|
269 | - * |
|
270 | - * @since 3.6.0 |
|
271 | - * @access private |
|
272 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
273 | - */ |
|
274 | - private $download_your_data_page; |
|
275 | - |
|
276 | - /** |
|
277 | - * The 'WordLift Settings' page. |
|
278 | - * |
|
279 | - * @since 3.11.0 |
|
280 | - * @access protected |
|
281 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
282 | - */ |
|
283 | - protected $settings_page; |
|
284 | - |
|
285 | - /** |
|
286 | - * The install wizard page. |
|
287 | - * |
|
288 | - * @since 3.9.0 |
|
289 | - * @access private |
|
290 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
291 | - */ |
|
292 | - public $admin_setup; |
|
293 | - |
|
294 | - /** |
|
295 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
296 | - * linking of entities to their pages. |
|
297 | - * |
|
298 | - * @since 3.8.0 |
|
299 | - * @access private |
|
300 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
301 | - */ |
|
302 | - private $content_filter_service; |
|
303 | - |
|
304 | - /** |
|
305 | - * The Faq Content filter service |
|
306 | - * |
|
307 | - * @since 3.26.0 |
|
308 | - * @access private |
|
309 | - * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
310 | - */ |
|
311 | - private $faq_content_filter_service; |
|
312 | - |
|
313 | - /** |
|
314 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
315 | - * |
|
316 | - * @since 3.9.0 |
|
317 | - * @access private |
|
318 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
319 | - */ |
|
320 | - private $key_validation_service; |
|
321 | - |
|
322 | - /** |
|
323 | - * A {@link Wordlift_Rating_Service} instance. |
|
324 | - * |
|
325 | - * @since 3.10.0 |
|
326 | - * @access private |
|
327 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
328 | - */ |
|
329 | - private $rating_service; |
|
330 | - |
|
331 | - /** |
|
332 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
333 | - * |
|
334 | - * @since 3.10.0 |
|
335 | - * @access protected |
|
336 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
337 | - */ |
|
338 | - protected $post_to_jsonld_converter; |
|
339 | - |
|
340 | - /** |
|
341 | - * A {@link Wordlift_Install_Service} instance. |
|
342 | - * |
|
343 | - * @since 3.18.0 |
|
344 | - * @access protected |
|
345 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
346 | - */ |
|
347 | - protected $install_service; |
|
348 | - |
|
349 | - /** |
|
350 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
351 | - * |
|
352 | - * @since 3.10.0 |
|
353 | - * @access protected |
|
354 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
355 | - */ |
|
356 | - protected $entity_post_to_jsonld_converter; |
|
357 | - |
|
358 | - /** |
|
359 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
360 | - * |
|
361 | - * @since 3.10.0 |
|
362 | - * @access protected |
|
363 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
364 | - */ |
|
365 | - protected $postid_to_jsonld_converter; |
|
366 | - |
|
367 | - /** |
|
368 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
369 | - * |
|
370 | - * @since 3.11.0 |
|
371 | - * @access protected |
|
372 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
373 | - */ |
|
374 | - protected $category_taxonomy_service; |
|
375 | - |
|
376 | - /** |
|
377 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
378 | - * |
|
379 | - * @since 3.11.0 |
|
380 | - * @access protected |
|
381 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
382 | - */ |
|
383 | - protected $entity_page_service; |
|
384 | - |
|
385 | - /** |
|
386 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
387 | - * |
|
388 | - * @since 3.11.0 |
|
389 | - * @access protected |
|
390 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
391 | - */ |
|
392 | - protected $settings_page_action_link; |
|
393 | - |
|
394 | - /** |
|
395 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
396 | - * |
|
397 | - * @since 3.11.0 |
|
398 | - * @access protected |
|
399 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
400 | - */ |
|
401 | - protected $analytics_settings_page_action_link; |
|
402 | - |
|
403 | - /** |
|
404 | - * The {@link Wordlift_Analytics_Connect} class. |
|
405 | - * |
|
406 | - * @since 3.11.0 |
|
407 | - * @access protected |
|
408 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
409 | - */ |
|
410 | - protected $analytics_connect; |
|
411 | - |
|
412 | - /** |
|
413 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
414 | - * |
|
415 | - * @since 3.11.0 |
|
416 | - * @access protected |
|
417 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
418 | - */ |
|
419 | - protected $publisher_ajax_adapter; |
|
420 | - |
|
421 | - /** |
|
422 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
423 | - * |
|
424 | - * @since 3.11.0 |
|
425 | - * @access protected |
|
426 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
427 | - */ |
|
428 | - protected $input_element; |
|
429 | - |
|
430 | - /** |
|
431 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
432 | - * |
|
433 | - * @since 3.13.0 |
|
434 | - * @access protected |
|
435 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
436 | - */ |
|
437 | - protected $radio_input_element; |
|
438 | - |
|
439 | - /** |
|
440 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
441 | - * |
|
442 | - * @since 3.11.0 |
|
443 | - * @access protected |
|
444 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
445 | - */ |
|
446 | - protected $language_select_element; |
|
447 | - |
|
448 | - /** |
|
449 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
450 | - * |
|
451 | - * @since 3.18.0 |
|
452 | - * @access protected |
|
453 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
454 | - */ |
|
455 | - protected $country_select_element; |
|
456 | - |
|
457 | - /** |
|
458 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
459 | - * |
|
460 | - * @since 3.11.0 |
|
461 | - * @access protected |
|
462 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
463 | - */ |
|
464 | - protected $publisher_element; |
|
465 | - |
|
466 | - /** |
|
467 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
468 | - * |
|
469 | - * @since 3.11.0 |
|
470 | - * @access protected |
|
471 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
472 | - */ |
|
473 | - protected $select2_element; |
|
474 | - |
|
475 | - /** |
|
476 | - * The controller for the entity type list admin page |
|
477 | - * |
|
478 | - * @since 3.11.0 |
|
479 | - * @access private |
|
480 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
481 | - */ |
|
482 | - private $entity_type_admin_page; |
|
483 | - |
|
484 | - /** |
|
485 | - * The controller for the entity type settings admin page |
|
486 | - * |
|
487 | - * @since 3.11.0 |
|
488 | - * @access private |
|
489 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
490 | - */ |
|
491 | - private $entity_type_settings_admin_page; |
|
492 | - |
|
493 | - /** |
|
494 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
495 | - * |
|
496 | - * @since 3.11.0 |
|
497 | - * @access protected |
|
498 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
499 | - */ |
|
500 | - protected $related_entities_cloud_widget; |
|
501 | - |
|
502 | - /** |
|
503 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
504 | - * |
|
505 | - * @since 3.14.0 |
|
506 | - * @access protected |
|
507 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
508 | - */ |
|
509 | - protected $author_element; |
|
510 | - |
|
511 | - /** |
|
512 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
513 | - * |
|
514 | - * @since 3.12.0 |
|
515 | - * @access protected |
|
516 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
517 | - */ |
|
518 | - protected $sample_data_service; |
|
519 | - |
|
520 | - /** |
|
521 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
522 | - * |
|
523 | - * @since 3.12.0 |
|
524 | - * @access protected |
|
525 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
526 | - */ |
|
527 | - protected $sample_data_ajax_adapter; |
|
528 | - |
|
529 | - /** |
|
530 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
531 | - * |
|
532 | - * @since 3.16.0 |
|
533 | - * @access protected |
|
534 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
535 | - */ |
|
536 | - protected $google_analytics_export_service; |
|
537 | - |
|
538 | - /** |
|
539 | - * {@link Wordlift}'s singleton instance. |
|
540 | - * |
|
541 | - * @since 3.15.0 |
|
542 | - * @access protected |
|
543 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
544 | - */ |
|
545 | - protected $entity_type_adapter; |
|
546 | - |
|
547 | - /** |
|
548 | - * The {@link Wordlift_Storage_Factory} instance. |
|
549 | - * |
|
550 | - * @since 3.15.0 |
|
551 | - * @access protected |
|
552 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
553 | - */ |
|
554 | - protected $storage_factory; |
|
555 | - |
|
556 | - /** |
|
557 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
558 | - * |
|
559 | - * @since 3.15.0 |
|
560 | - * @access private |
|
561 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
562 | - */ |
|
563 | - private $autocomplete_adapter; |
|
564 | - |
|
565 | - /** |
|
566 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
567 | - * |
|
568 | - * @since 3.16.0 |
|
569 | - * @access protected |
|
570 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
571 | - */ |
|
572 | - protected $cached_postid_to_jsonld_converter; |
|
573 | - |
|
574 | - /** |
|
575 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
576 | - * |
|
577 | - * @since 3.16.3 |
|
578 | - * @access protected |
|
579 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
580 | - */ |
|
581 | - protected $entity_uri_service; |
|
582 | - |
|
583 | - /** |
|
584 | - * The {@link Wordlift_Publisher_Service} instance. |
|
585 | - * |
|
586 | - * @since 3.19.0 |
|
587 | - * @access protected |
|
588 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
589 | - */ |
|
590 | - protected $publisher_service; |
|
591 | - |
|
592 | - /** |
|
593 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
594 | - * |
|
595 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
596 | - */ |
|
597 | - protected $context_cards_service; |
|
598 | - |
|
599 | - /** |
|
600 | - * {@link Wordlift}'s singleton instance. |
|
601 | - * |
|
602 | - * @since 3.11.2 |
|
603 | - * @access private |
|
604 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
605 | - */ |
|
606 | - private static $instance; |
|
607 | - |
|
608 | - /** |
|
609 | - * A singleton instance of features registry. |
|
610 | - * |
|
611 | - * @since 3.30.0 |
|
612 | - * @var Features_Registry |
|
613 | - */ |
|
614 | - private $features_registry; |
|
615 | - |
|
616 | - private $analytics_settings_page; |
|
617 | - |
|
618 | - private $webhook_loader; |
|
619 | - |
|
620 | - /** |
|
621 | - * Define the core functionality of the plugin. |
|
622 | - * |
|
623 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
624 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
625 | - * the public-facing side of the site. |
|
626 | - * |
|
627 | - * @since 1.0.0 |
|
628 | - */ |
|
629 | - public function __construct() { |
|
630 | - |
|
631 | - self::$instance = $this; |
|
632 | - |
|
633 | - $this->plugin_name = 'wordlift'; |
|
634 | - $this->version = '3.40.1'; |
|
635 | - $this->load_dependencies(); |
|
636 | - $this->set_locale(); |
|
637 | - |
|
638 | - $that = $this; |
|
639 | - add_action( |
|
640 | - 'plugins_loaded', |
|
641 | - function () use ( $that ) { |
|
642 | - $that->define_admin_hooks( $that ); |
|
643 | - $that->define_public_hooks( $that ); |
|
644 | - }, |
|
645 | - 4 |
|
646 | - ); |
|
647 | - |
|
648 | - // If we're in `WP_CLI` load the related files. |
|
649 | - if ( class_exists( 'WP_CLI' ) ) { |
|
650 | - $this->load_cli_dependencies(); |
|
651 | - } |
|
652 | - |
|
653 | - } |
|
654 | - |
|
655 | - /** |
|
656 | - * Get the singleton instance. |
|
657 | - * |
|
658 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
659 | - * @since 3.11.2 |
|
660 | - */ |
|
661 | - public static function get_instance() { |
|
662 | - |
|
663 | - return self::$instance; |
|
664 | - } |
|
665 | - |
|
666 | - /** |
|
667 | - * Load the required dependencies for this plugin. |
|
668 | - * |
|
669 | - * Include the following files that make up the plugin: |
|
670 | - * |
|
671 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
672 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
673 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
674 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
675 | - * |
|
676 | - * Create an instance of the loader which will be used to register the hooks |
|
677 | - * with WordPress. |
|
678 | - * |
|
679 | - * @throws Exception when an error occurs. |
|
680 | - * @since 1.0.0 |
|
681 | - * @access private |
|
682 | - */ |
|
683 | - private function load_dependencies() { |
|
684 | - |
|
685 | - /** |
|
686 | - * The class responsible for orchestrating the actions and filters of the |
|
687 | - * core plugin. |
|
688 | - */ |
|
689 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-loader.php'; |
|
690 | - |
|
691 | - // The class responsible for plugin uninstall. |
|
692 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
693 | - |
|
694 | - /** |
|
695 | - * The class responsible for defining internationalization functionality |
|
696 | - * of the plugin. |
|
697 | - */ |
|
698 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-i18n.php'; |
|
699 | - |
|
700 | - /** |
|
701 | - * WordLift's supported languages. |
|
702 | - */ |
|
703 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-languages.php'; |
|
704 | - |
|
705 | - /** |
|
706 | - * WordLift's supported countries. |
|
707 | - */ |
|
708 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-countries.php'; |
|
709 | - |
|
710 | - /** |
|
711 | - * Provide support functions to sanitize data. |
|
712 | - */ |
|
713 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sanitizer.php'; |
|
714 | - |
|
715 | - /** Services. */ |
|
716 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-log-service.php'; |
|
717 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-http-api.php'; |
|
718 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-redirect-service.php'; |
|
719 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-configuration-service.php'; |
|
720 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
721 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-service.php'; |
|
722 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-link-service.php'; |
|
723 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-relation-service.php'; |
|
724 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-image-service.php'; |
|
725 | - |
|
726 | - /** |
|
727 | - * The Schema service. |
|
728 | - */ |
|
729 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-service.php'; |
|
730 | - |
|
731 | - /** |
|
732 | - * The schema:url property service. |
|
733 | - */ |
|
734 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-service.php'; |
|
735 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
736 | - |
|
737 | - /** |
|
738 | - * The UI service. |
|
739 | - */ |
|
740 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-ui-service.php'; |
|
741 | - |
|
742 | - /** |
|
743 | - * The Entity Types Taxonomy service. |
|
744 | - */ |
|
745 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
746 | - |
|
747 | - /** |
|
748 | - * The Entity service. |
|
749 | - */ |
|
750 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
751 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-service.php'; |
|
752 | - |
|
753 | - // Add the entity rating service. |
|
754 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-rating-service.php'; |
|
755 | - |
|
756 | - /** |
|
757 | - * The User service. |
|
758 | - */ |
|
759 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-user-service.php'; |
|
760 | - |
|
761 | - /** |
|
762 | - * The Timeline service. |
|
763 | - */ |
|
764 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-timeline-service.php'; |
|
765 | - |
|
766 | - /** |
|
767 | - * The Topic Taxonomy service. |
|
768 | - */ |
|
769 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
770 | - |
|
771 | - /** |
|
772 | - * The WordLift URI service. |
|
773 | - */ |
|
774 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-uri-service.php'; |
|
775 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-factory.php'; |
|
776 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-service.php'; |
|
777 | - |
|
778 | - require_once plugin_dir_path( __DIR__ ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
779 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-attachment-service.php'; |
|
780 | - |
|
781 | - /** |
|
782 | - * Load the converters. |
|
783 | - */ |
|
784 | - require_once plugin_dir_path( __DIR__ ) . 'includes/intf-wordlift-post-converter.php'; |
|
785 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
786 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
787 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
788 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
789 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-website-jsonld-converter.php'; |
|
790 | - |
|
791 | - /** |
|
792 | - * Load cache-related files. |
|
793 | - */ |
|
794 | - require_once plugin_dir_path( __DIR__ ) . 'includes/cache/require.php'; |
|
795 | - |
|
796 | - /** |
|
797 | - * Load the content filter. |
|
798 | - */ |
|
799 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-content-filter-service.php'; |
|
800 | - |
|
801 | - /* |
|
86 | + /** |
|
87 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
88 | + * the plugin. |
|
89 | + * |
|
90 | + * @since 1.0.0 |
|
91 | + * @access protected |
|
92 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
93 | + */ |
|
94 | + protected $loader; |
|
95 | + |
|
96 | + /** |
|
97 | + * The unique identifier of this plugin. |
|
98 | + * |
|
99 | + * @since 1.0.0 |
|
100 | + * @access protected |
|
101 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
102 | + */ |
|
103 | + protected $plugin_name; |
|
104 | + |
|
105 | + /** |
|
106 | + * The current version of the plugin. |
|
107 | + * |
|
108 | + * @since 1.0.0 |
|
109 | + * @access protected |
|
110 | + * @var string $version The current version of the plugin. |
|
111 | + */ |
|
112 | + protected $version; |
|
113 | + |
|
114 | + /** |
|
115 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
116 | + * |
|
117 | + * @since 3.12.0 |
|
118 | + * @access protected |
|
119 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
120 | + */ |
|
121 | + protected $tinymce_adapter; |
|
122 | + |
|
123 | + /** |
|
124 | + * The Schema service. |
|
125 | + * |
|
126 | + * @since 3.3.0 |
|
127 | + * @access protected |
|
128 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
129 | + */ |
|
130 | + protected $schema_service; |
|
131 | + |
|
132 | + /** |
|
133 | + * The Topic Taxonomy service. |
|
134 | + * |
|
135 | + * @since 3.5.0 |
|
136 | + * @access private |
|
137 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
138 | + */ |
|
139 | + private $topic_taxonomy_service; |
|
140 | + |
|
141 | + /** |
|
142 | + * The Entity Types Taxonomy service. |
|
143 | + * |
|
144 | + * @since 3.18.0 |
|
145 | + * @access private |
|
146 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
147 | + */ |
|
148 | + private $entity_types_taxonomy_service; |
|
149 | + |
|
150 | + /** |
|
151 | + * The User service. |
|
152 | + * |
|
153 | + * @since 3.1.7 |
|
154 | + * @access protected |
|
155 | + * @var \Wordlift_User_Service $user_service The User service. |
|
156 | + */ |
|
157 | + protected $user_service; |
|
158 | + |
|
159 | + /** |
|
160 | + * The Timeline service. |
|
161 | + * |
|
162 | + * @since 3.1.0 |
|
163 | + * @access private |
|
164 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
165 | + */ |
|
166 | + private $timeline_service; |
|
167 | + |
|
168 | + /** |
|
169 | + * The Redirect service. |
|
170 | + * |
|
171 | + * @since 3.2.0 |
|
172 | + * @access private |
|
173 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
174 | + */ |
|
175 | + private $redirect_service; |
|
176 | + |
|
177 | + /** |
|
178 | + * The Notice service. |
|
179 | + * |
|
180 | + * @since 3.3.0 |
|
181 | + * @access private |
|
182 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
183 | + */ |
|
184 | + private $notice_service; |
|
185 | + |
|
186 | + /** |
|
187 | + * The Entity list customization. |
|
188 | + * |
|
189 | + * @since 3.3.0 |
|
190 | + * @access protected |
|
191 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
192 | + */ |
|
193 | + protected $entity_list_service; |
|
194 | + |
|
195 | + /** |
|
196 | + * The Entity Types Taxonomy Walker. |
|
197 | + * |
|
198 | + * @since 3.1.0 |
|
199 | + * @access private |
|
200 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
201 | + */ |
|
202 | + private $entity_types_taxonomy_walker; |
|
203 | + |
|
204 | + /** |
|
205 | + * The ShareThis service. |
|
206 | + * |
|
207 | + * @since 3.2.0 |
|
208 | + * @access private |
|
209 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
210 | + */ |
|
211 | + private $sharethis_service; |
|
212 | + |
|
213 | + /** |
|
214 | + * The PrimaShop adapter. |
|
215 | + * |
|
216 | + * @since 3.2.3 |
|
217 | + * @access private |
|
218 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
219 | + */ |
|
220 | + private $primashop_adapter; |
|
221 | + |
|
222 | + /** |
|
223 | + * The entity type service. |
|
224 | + * |
|
225 | + * @since 3.6.0 |
|
226 | + * @access private |
|
227 | + * @var \Wordlift_Entity_Post_Type_Service |
|
228 | + */ |
|
229 | + private $entity_post_type_service; |
|
230 | + |
|
231 | + /** |
|
232 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
233 | + * |
|
234 | + * @since 3.6.0 |
|
235 | + * @access private |
|
236 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
237 | + */ |
|
238 | + private $entity_link_service; |
|
239 | + |
|
240 | + /** |
|
241 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
242 | + * |
|
243 | + * @since 3.7.0 |
|
244 | + * @access protected |
|
245 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
246 | + */ |
|
247 | + protected $jsonld_service; |
|
248 | + |
|
249 | + /** |
|
250 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
251 | + * |
|
252 | + * @since 3.14.0 |
|
253 | + * @access protected |
|
254 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
255 | + */ |
|
256 | + protected $jsonld_website_converter; |
|
257 | + |
|
258 | + /** |
|
259 | + * A {@link Wordlift_Property_Factory} instance. |
|
260 | + * |
|
261 | + * @since 3.7.0 |
|
262 | + * @access private |
|
263 | + * @var \Wordlift_Property_Factory $property_factory |
|
264 | + */ |
|
265 | + private $property_factory; |
|
266 | + |
|
267 | + /** |
|
268 | + * The 'Download Your Data' page. |
|
269 | + * |
|
270 | + * @since 3.6.0 |
|
271 | + * @access private |
|
272 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
273 | + */ |
|
274 | + private $download_your_data_page; |
|
275 | + |
|
276 | + /** |
|
277 | + * The 'WordLift Settings' page. |
|
278 | + * |
|
279 | + * @since 3.11.0 |
|
280 | + * @access protected |
|
281 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
282 | + */ |
|
283 | + protected $settings_page; |
|
284 | + |
|
285 | + /** |
|
286 | + * The install wizard page. |
|
287 | + * |
|
288 | + * @since 3.9.0 |
|
289 | + * @access private |
|
290 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
291 | + */ |
|
292 | + public $admin_setup; |
|
293 | + |
|
294 | + /** |
|
295 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
296 | + * linking of entities to their pages. |
|
297 | + * |
|
298 | + * @since 3.8.0 |
|
299 | + * @access private |
|
300 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
301 | + */ |
|
302 | + private $content_filter_service; |
|
303 | + |
|
304 | + /** |
|
305 | + * The Faq Content filter service |
|
306 | + * |
|
307 | + * @since 3.26.0 |
|
308 | + * @access private |
|
309 | + * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
310 | + */ |
|
311 | + private $faq_content_filter_service; |
|
312 | + |
|
313 | + /** |
|
314 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
315 | + * |
|
316 | + * @since 3.9.0 |
|
317 | + * @access private |
|
318 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
319 | + */ |
|
320 | + private $key_validation_service; |
|
321 | + |
|
322 | + /** |
|
323 | + * A {@link Wordlift_Rating_Service} instance. |
|
324 | + * |
|
325 | + * @since 3.10.0 |
|
326 | + * @access private |
|
327 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
328 | + */ |
|
329 | + private $rating_service; |
|
330 | + |
|
331 | + /** |
|
332 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
333 | + * |
|
334 | + * @since 3.10.0 |
|
335 | + * @access protected |
|
336 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
337 | + */ |
|
338 | + protected $post_to_jsonld_converter; |
|
339 | + |
|
340 | + /** |
|
341 | + * A {@link Wordlift_Install_Service} instance. |
|
342 | + * |
|
343 | + * @since 3.18.0 |
|
344 | + * @access protected |
|
345 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
346 | + */ |
|
347 | + protected $install_service; |
|
348 | + |
|
349 | + /** |
|
350 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
351 | + * |
|
352 | + * @since 3.10.0 |
|
353 | + * @access protected |
|
354 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
355 | + */ |
|
356 | + protected $entity_post_to_jsonld_converter; |
|
357 | + |
|
358 | + /** |
|
359 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
360 | + * |
|
361 | + * @since 3.10.0 |
|
362 | + * @access protected |
|
363 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
364 | + */ |
|
365 | + protected $postid_to_jsonld_converter; |
|
366 | + |
|
367 | + /** |
|
368 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
369 | + * |
|
370 | + * @since 3.11.0 |
|
371 | + * @access protected |
|
372 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
373 | + */ |
|
374 | + protected $category_taxonomy_service; |
|
375 | + |
|
376 | + /** |
|
377 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
378 | + * |
|
379 | + * @since 3.11.0 |
|
380 | + * @access protected |
|
381 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
382 | + */ |
|
383 | + protected $entity_page_service; |
|
384 | + |
|
385 | + /** |
|
386 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
387 | + * |
|
388 | + * @since 3.11.0 |
|
389 | + * @access protected |
|
390 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
391 | + */ |
|
392 | + protected $settings_page_action_link; |
|
393 | + |
|
394 | + /** |
|
395 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
396 | + * |
|
397 | + * @since 3.11.0 |
|
398 | + * @access protected |
|
399 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
400 | + */ |
|
401 | + protected $analytics_settings_page_action_link; |
|
402 | + |
|
403 | + /** |
|
404 | + * The {@link Wordlift_Analytics_Connect} class. |
|
405 | + * |
|
406 | + * @since 3.11.0 |
|
407 | + * @access protected |
|
408 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
409 | + */ |
|
410 | + protected $analytics_connect; |
|
411 | + |
|
412 | + /** |
|
413 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
414 | + * |
|
415 | + * @since 3.11.0 |
|
416 | + * @access protected |
|
417 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
418 | + */ |
|
419 | + protected $publisher_ajax_adapter; |
|
420 | + |
|
421 | + /** |
|
422 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
423 | + * |
|
424 | + * @since 3.11.0 |
|
425 | + * @access protected |
|
426 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
427 | + */ |
|
428 | + protected $input_element; |
|
429 | + |
|
430 | + /** |
|
431 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
432 | + * |
|
433 | + * @since 3.13.0 |
|
434 | + * @access protected |
|
435 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
436 | + */ |
|
437 | + protected $radio_input_element; |
|
438 | + |
|
439 | + /** |
|
440 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
441 | + * |
|
442 | + * @since 3.11.0 |
|
443 | + * @access protected |
|
444 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
445 | + */ |
|
446 | + protected $language_select_element; |
|
447 | + |
|
448 | + /** |
|
449 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
450 | + * |
|
451 | + * @since 3.18.0 |
|
452 | + * @access protected |
|
453 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
454 | + */ |
|
455 | + protected $country_select_element; |
|
456 | + |
|
457 | + /** |
|
458 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
459 | + * |
|
460 | + * @since 3.11.0 |
|
461 | + * @access protected |
|
462 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
463 | + */ |
|
464 | + protected $publisher_element; |
|
465 | + |
|
466 | + /** |
|
467 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
468 | + * |
|
469 | + * @since 3.11.0 |
|
470 | + * @access protected |
|
471 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
472 | + */ |
|
473 | + protected $select2_element; |
|
474 | + |
|
475 | + /** |
|
476 | + * The controller for the entity type list admin page |
|
477 | + * |
|
478 | + * @since 3.11.0 |
|
479 | + * @access private |
|
480 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
481 | + */ |
|
482 | + private $entity_type_admin_page; |
|
483 | + |
|
484 | + /** |
|
485 | + * The controller for the entity type settings admin page |
|
486 | + * |
|
487 | + * @since 3.11.0 |
|
488 | + * @access private |
|
489 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
490 | + */ |
|
491 | + private $entity_type_settings_admin_page; |
|
492 | + |
|
493 | + /** |
|
494 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
495 | + * |
|
496 | + * @since 3.11.0 |
|
497 | + * @access protected |
|
498 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
499 | + */ |
|
500 | + protected $related_entities_cloud_widget; |
|
501 | + |
|
502 | + /** |
|
503 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
504 | + * |
|
505 | + * @since 3.14.0 |
|
506 | + * @access protected |
|
507 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
508 | + */ |
|
509 | + protected $author_element; |
|
510 | + |
|
511 | + /** |
|
512 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
513 | + * |
|
514 | + * @since 3.12.0 |
|
515 | + * @access protected |
|
516 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
517 | + */ |
|
518 | + protected $sample_data_service; |
|
519 | + |
|
520 | + /** |
|
521 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
522 | + * |
|
523 | + * @since 3.12.0 |
|
524 | + * @access protected |
|
525 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
526 | + */ |
|
527 | + protected $sample_data_ajax_adapter; |
|
528 | + |
|
529 | + /** |
|
530 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
531 | + * |
|
532 | + * @since 3.16.0 |
|
533 | + * @access protected |
|
534 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
535 | + */ |
|
536 | + protected $google_analytics_export_service; |
|
537 | + |
|
538 | + /** |
|
539 | + * {@link Wordlift}'s singleton instance. |
|
540 | + * |
|
541 | + * @since 3.15.0 |
|
542 | + * @access protected |
|
543 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
544 | + */ |
|
545 | + protected $entity_type_adapter; |
|
546 | + |
|
547 | + /** |
|
548 | + * The {@link Wordlift_Storage_Factory} instance. |
|
549 | + * |
|
550 | + * @since 3.15.0 |
|
551 | + * @access protected |
|
552 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
553 | + */ |
|
554 | + protected $storage_factory; |
|
555 | + |
|
556 | + /** |
|
557 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
558 | + * |
|
559 | + * @since 3.15.0 |
|
560 | + * @access private |
|
561 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
562 | + */ |
|
563 | + private $autocomplete_adapter; |
|
564 | + |
|
565 | + /** |
|
566 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
567 | + * |
|
568 | + * @since 3.16.0 |
|
569 | + * @access protected |
|
570 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
571 | + */ |
|
572 | + protected $cached_postid_to_jsonld_converter; |
|
573 | + |
|
574 | + /** |
|
575 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
576 | + * |
|
577 | + * @since 3.16.3 |
|
578 | + * @access protected |
|
579 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
580 | + */ |
|
581 | + protected $entity_uri_service; |
|
582 | + |
|
583 | + /** |
|
584 | + * The {@link Wordlift_Publisher_Service} instance. |
|
585 | + * |
|
586 | + * @since 3.19.0 |
|
587 | + * @access protected |
|
588 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
589 | + */ |
|
590 | + protected $publisher_service; |
|
591 | + |
|
592 | + /** |
|
593 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
594 | + * |
|
595 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
596 | + */ |
|
597 | + protected $context_cards_service; |
|
598 | + |
|
599 | + /** |
|
600 | + * {@link Wordlift}'s singleton instance. |
|
601 | + * |
|
602 | + * @since 3.11.2 |
|
603 | + * @access private |
|
604 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
605 | + */ |
|
606 | + private static $instance; |
|
607 | + |
|
608 | + /** |
|
609 | + * A singleton instance of features registry. |
|
610 | + * |
|
611 | + * @since 3.30.0 |
|
612 | + * @var Features_Registry |
|
613 | + */ |
|
614 | + private $features_registry; |
|
615 | + |
|
616 | + private $analytics_settings_page; |
|
617 | + |
|
618 | + private $webhook_loader; |
|
619 | + |
|
620 | + /** |
|
621 | + * Define the core functionality of the plugin. |
|
622 | + * |
|
623 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
624 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
625 | + * the public-facing side of the site. |
|
626 | + * |
|
627 | + * @since 1.0.0 |
|
628 | + */ |
|
629 | + public function __construct() { |
|
630 | + |
|
631 | + self::$instance = $this; |
|
632 | + |
|
633 | + $this->plugin_name = 'wordlift'; |
|
634 | + $this->version = '3.40.1'; |
|
635 | + $this->load_dependencies(); |
|
636 | + $this->set_locale(); |
|
637 | + |
|
638 | + $that = $this; |
|
639 | + add_action( |
|
640 | + 'plugins_loaded', |
|
641 | + function () use ( $that ) { |
|
642 | + $that->define_admin_hooks( $that ); |
|
643 | + $that->define_public_hooks( $that ); |
|
644 | + }, |
|
645 | + 4 |
|
646 | + ); |
|
647 | + |
|
648 | + // If we're in `WP_CLI` load the related files. |
|
649 | + if ( class_exists( 'WP_CLI' ) ) { |
|
650 | + $this->load_cli_dependencies(); |
|
651 | + } |
|
652 | + |
|
653 | + } |
|
654 | + |
|
655 | + /** |
|
656 | + * Get the singleton instance. |
|
657 | + * |
|
658 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
659 | + * @since 3.11.2 |
|
660 | + */ |
|
661 | + public static function get_instance() { |
|
662 | + |
|
663 | + return self::$instance; |
|
664 | + } |
|
665 | + |
|
666 | + /** |
|
667 | + * Load the required dependencies for this plugin. |
|
668 | + * |
|
669 | + * Include the following files that make up the plugin: |
|
670 | + * |
|
671 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
672 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
673 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
674 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
675 | + * |
|
676 | + * Create an instance of the loader which will be used to register the hooks |
|
677 | + * with WordPress. |
|
678 | + * |
|
679 | + * @throws Exception when an error occurs. |
|
680 | + * @since 1.0.0 |
|
681 | + * @access private |
|
682 | + */ |
|
683 | + private function load_dependencies() { |
|
684 | + |
|
685 | + /** |
|
686 | + * The class responsible for orchestrating the actions and filters of the |
|
687 | + * core plugin. |
|
688 | + */ |
|
689 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-loader.php'; |
|
690 | + |
|
691 | + // The class responsible for plugin uninstall. |
|
692 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
693 | + |
|
694 | + /** |
|
695 | + * The class responsible for defining internationalization functionality |
|
696 | + * of the plugin. |
|
697 | + */ |
|
698 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-i18n.php'; |
|
699 | + |
|
700 | + /** |
|
701 | + * WordLift's supported languages. |
|
702 | + */ |
|
703 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-languages.php'; |
|
704 | + |
|
705 | + /** |
|
706 | + * WordLift's supported countries. |
|
707 | + */ |
|
708 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-countries.php'; |
|
709 | + |
|
710 | + /** |
|
711 | + * Provide support functions to sanitize data. |
|
712 | + */ |
|
713 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sanitizer.php'; |
|
714 | + |
|
715 | + /** Services. */ |
|
716 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-log-service.php'; |
|
717 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-http-api.php'; |
|
718 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-redirect-service.php'; |
|
719 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-configuration-service.php'; |
|
720 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
721 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-service.php'; |
|
722 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-link-service.php'; |
|
723 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-relation-service.php'; |
|
724 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-image-service.php'; |
|
725 | + |
|
726 | + /** |
|
727 | + * The Schema service. |
|
728 | + */ |
|
729 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-service.php'; |
|
730 | + |
|
731 | + /** |
|
732 | + * The schema:url property service. |
|
733 | + */ |
|
734 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-service.php'; |
|
735 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
736 | + |
|
737 | + /** |
|
738 | + * The UI service. |
|
739 | + */ |
|
740 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-ui-service.php'; |
|
741 | + |
|
742 | + /** |
|
743 | + * The Entity Types Taxonomy service. |
|
744 | + */ |
|
745 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
746 | + |
|
747 | + /** |
|
748 | + * The Entity service. |
|
749 | + */ |
|
750 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
751 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-service.php'; |
|
752 | + |
|
753 | + // Add the entity rating service. |
|
754 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-rating-service.php'; |
|
755 | + |
|
756 | + /** |
|
757 | + * The User service. |
|
758 | + */ |
|
759 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-user-service.php'; |
|
760 | + |
|
761 | + /** |
|
762 | + * The Timeline service. |
|
763 | + */ |
|
764 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-timeline-service.php'; |
|
765 | + |
|
766 | + /** |
|
767 | + * The Topic Taxonomy service. |
|
768 | + */ |
|
769 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
770 | + |
|
771 | + /** |
|
772 | + * The WordLift URI service. |
|
773 | + */ |
|
774 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-uri-service.php'; |
|
775 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-factory.php'; |
|
776 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-service.php'; |
|
777 | + |
|
778 | + require_once plugin_dir_path( __DIR__ ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
779 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-attachment-service.php'; |
|
780 | + |
|
781 | + /** |
|
782 | + * Load the converters. |
|
783 | + */ |
|
784 | + require_once plugin_dir_path( __DIR__ ) . 'includes/intf-wordlift-post-converter.php'; |
|
785 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
786 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
787 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
788 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
789 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-website-jsonld-converter.php'; |
|
790 | + |
|
791 | + /** |
|
792 | + * Load cache-related files. |
|
793 | + */ |
|
794 | + require_once plugin_dir_path( __DIR__ ) . 'includes/cache/require.php'; |
|
795 | + |
|
796 | + /** |
|
797 | + * Load the content filter. |
|
798 | + */ |
|
799 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-content-filter-service.php'; |
|
800 | + |
|
801 | + /* |
|
802 | 802 | * Load the excerpt helper. |
803 | 803 | */ |
804 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
805 | - |
|
806 | - /** |
|
807 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
808 | - * |
|
809 | - * @since 3.8.0 |
|
810 | - */ |
|
811 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-jsonld-service.php'; |
|
812 | - |
|
813 | - // The Publisher Service and the AJAX adapter. |
|
814 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-service.php'; |
|
815 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
816 | - |
|
817 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-adapter.php'; |
|
818 | - |
|
819 | - /** |
|
820 | - * Load the WordLift key validation service. |
|
821 | - */ |
|
822 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-key-validation-service.php'; |
|
823 | - |
|
824 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
825 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
826 | - |
|
827 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
828 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-page-service.php'; |
|
829 | - |
|
830 | - /** Linked Data. */ |
|
831 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
832 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
833 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
834 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
835 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
836 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
837 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
838 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
839 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
840 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
841 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
842 | - |
|
843 | - /** Services. */ |
|
844 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
845 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-api-service.php'; |
|
846 | - |
|
847 | - /** Adapters. */ |
|
848 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
849 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
850 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
851 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
852 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
853 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-nitropack-adapter.php'; |
|
854 | - |
|
855 | - /** Autocomplete. */ |
|
856 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
857 | - |
|
858 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-remote-image-service.php'; |
|
859 | - |
|
860 | - /** Analytics */ |
|
861 | - require_once plugin_dir_path( __DIR__ ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
862 | - |
|
863 | - /** |
|
864 | - * The class responsible for defining all actions that occur in the admin area. |
|
865 | - */ |
|
866 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin.php'; |
|
867 | - |
|
868 | - /** |
|
869 | - * The class to customize the entity list admin page. |
|
870 | - */ |
|
871 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-list-service.php'; |
|
872 | - |
|
873 | - /** |
|
874 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
875 | - */ |
|
876 | - global $wp_version; |
|
877 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
878 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
879 | - } else { |
|
880 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
881 | - } |
|
882 | - |
|
883 | - /** |
|
884 | - * The Notice service. |
|
885 | - */ |
|
886 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-notice-service.php'; |
|
887 | - |
|
888 | - /** |
|
889 | - * The PrimaShop adapter. |
|
890 | - */ |
|
891 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
892 | - |
|
893 | - /** |
|
894 | - * The WordLift Dashboard service. |
|
895 | - */ |
|
896 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-service.php'; |
|
897 | - |
|
898 | - /** |
|
899 | - * The admin 'Install wizard' page. |
|
900 | - */ |
|
901 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-setup.php'; |
|
902 | - |
|
903 | - /** |
|
904 | - * The WordLift entity type list admin page controller. |
|
905 | - */ |
|
906 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
907 | - |
|
908 | - /** |
|
909 | - * The WordLift entity type settings admin page controller. |
|
910 | - */ |
|
911 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-type-settings.php'; |
|
912 | - |
|
913 | - /** |
|
914 | - * The admin 'Download Your Data' page. |
|
915 | - */ |
|
916 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-download-your-data-page.php'; |
|
917 | - |
|
918 | - /** |
|
919 | - * The admin 'WordLift Settings' page. |
|
920 | - */ |
|
921 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
922 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
923 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
924 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
925 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
926 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
927 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
928 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
929 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
930 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
931 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-page.php'; |
|
932 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
933 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
934 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
935 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
936 | - |
|
937 | - /** Admin Pages */ |
|
938 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
939 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
940 | - |
|
941 | - /** |
|
942 | - * The class responsible for defining all actions that occur in the public-facing |
|
943 | - * side of the site. |
|
944 | - */ |
|
945 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-public.php'; |
|
946 | - |
|
947 | - /** |
|
948 | - * The shortcode abstract class. |
|
949 | - */ |
|
950 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-shortcode.php'; |
|
951 | - |
|
952 | - /** |
|
953 | - * The Timeline shortcode. |
|
954 | - */ |
|
955 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
956 | - |
|
957 | - /** |
|
958 | - * The Navigator shortcode. |
|
959 | - */ |
|
960 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
961 | - |
|
962 | - /** |
|
963 | - * The Products Navigator shortcode. |
|
964 | - */ |
|
965 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
966 | - |
|
967 | - /** |
|
968 | - * The chord shortcode. |
|
969 | - */ |
|
970 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-chord-shortcode.php'; |
|
971 | - |
|
972 | - /** |
|
973 | - * The geomap shortcode. |
|
974 | - */ |
|
975 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
976 | - |
|
977 | - /** |
|
978 | - * The entity cloud shortcode. |
|
979 | - */ |
|
980 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
981 | - |
|
982 | - /** |
|
983 | - * The entity glossary shortcode. |
|
984 | - */ |
|
985 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-alphabet-service.php'; |
|
986 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
987 | - |
|
988 | - /** |
|
989 | - * Faceted Search shortcode. |
|
990 | - */ |
|
991 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
992 | - |
|
993 | - /** |
|
994 | - * The ShareThis service. |
|
995 | - */ |
|
996 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-sharethis-service.php'; |
|
997 | - |
|
998 | - /** |
|
999 | - * The SEO service. |
|
1000 | - */ |
|
1001 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-seo-service.php'; |
|
1002 | - |
|
1003 | - /** |
|
1004 | - * The AMP service. |
|
1005 | - */ |
|
1006 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-amp-service.php'; |
|
1007 | - |
|
1008 | - /** Widgets */ |
|
1009 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-widget.php'; |
|
1010 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1011 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-context-cards-service.php'; |
|
1012 | - |
|
1013 | - /* |
|
804 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
805 | + |
|
806 | + /** |
|
807 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
808 | + * |
|
809 | + * @since 3.8.0 |
|
810 | + */ |
|
811 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-jsonld-service.php'; |
|
812 | + |
|
813 | + // The Publisher Service and the AJAX adapter. |
|
814 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-service.php'; |
|
815 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
816 | + |
|
817 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-adapter.php'; |
|
818 | + |
|
819 | + /** |
|
820 | + * Load the WordLift key validation service. |
|
821 | + */ |
|
822 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-key-validation-service.php'; |
|
823 | + |
|
824 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
825 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
826 | + |
|
827 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
828 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-page-service.php'; |
|
829 | + |
|
830 | + /** Linked Data. */ |
|
831 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
832 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
833 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
834 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
835 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
836 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
837 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
838 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
839 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
840 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
841 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
842 | + |
|
843 | + /** Services. */ |
|
844 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
845 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-api-service.php'; |
|
846 | + |
|
847 | + /** Adapters. */ |
|
848 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
849 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
850 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
851 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
852 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
853 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-nitropack-adapter.php'; |
|
854 | + |
|
855 | + /** Autocomplete. */ |
|
856 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
857 | + |
|
858 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-remote-image-service.php'; |
|
859 | + |
|
860 | + /** Analytics */ |
|
861 | + require_once plugin_dir_path( __DIR__ ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
862 | + |
|
863 | + /** |
|
864 | + * The class responsible for defining all actions that occur in the admin area. |
|
865 | + */ |
|
866 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin.php'; |
|
867 | + |
|
868 | + /** |
|
869 | + * The class to customize the entity list admin page. |
|
870 | + */ |
|
871 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-list-service.php'; |
|
872 | + |
|
873 | + /** |
|
874 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
875 | + */ |
|
876 | + global $wp_version; |
|
877 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
878 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
879 | + } else { |
|
880 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
881 | + } |
|
882 | + |
|
883 | + /** |
|
884 | + * The Notice service. |
|
885 | + */ |
|
886 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-notice-service.php'; |
|
887 | + |
|
888 | + /** |
|
889 | + * The PrimaShop adapter. |
|
890 | + */ |
|
891 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
892 | + |
|
893 | + /** |
|
894 | + * The WordLift Dashboard service. |
|
895 | + */ |
|
896 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-service.php'; |
|
897 | + |
|
898 | + /** |
|
899 | + * The admin 'Install wizard' page. |
|
900 | + */ |
|
901 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-setup.php'; |
|
902 | + |
|
903 | + /** |
|
904 | + * The WordLift entity type list admin page controller. |
|
905 | + */ |
|
906 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
907 | + |
|
908 | + /** |
|
909 | + * The WordLift entity type settings admin page controller. |
|
910 | + */ |
|
911 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-type-settings.php'; |
|
912 | + |
|
913 | + /** |
|
914 | + * The admin 'Download Your Data' page. |
|
915 | + */ |
|
916 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-download-your-data-page.php'; |
|
917 | + |
|
918 | + /** |
|
919 | + * The admin 'WordLift Settings' page. |
|
920 | + */ |
|
921 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
922 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
923 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
924 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
925 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
926 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
927 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
928 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
929 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
930 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
931 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-page.php'; |
|
932 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
933 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
934 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
935 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
936 | + |
|
937 | + /** Admin Pages */ |
|
938 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
939 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
940 | + |
|
941 | + /** |
|
942 | + * The class responsible for defining all actions that occur in the public-facing |
|
943 | + * side of the site. |
|
944 | + */ |
|
945 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-public.php'; |
|
946 | + |
|
947 | + /** |
|
948 | + * The shortcode abstract class. |
|
949 | + */ |
|
950 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-shortcode.php'; |
|
951 | + |
|
952 | + /** |
|
953 | + * The Timeline shortcode. |
|
954 | + */ |
|
955 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
956 | + |
|
957 | + /** |
|
958 | + * The Navigator shortcode. |
|
959 | + */ |
|
960 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
961 | + |
|
962 | + /** |
|
963 | + * The Products Navigator shortcode. |
|
964 | + */ |
|
965 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
966 | + |
|
967 | + /** |
|
968 | + * The chord shortcode. |
|
969 | + */ |
|
970 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-chord-shortcode.php'; |
|
971 | + |
|
972 | + /** |
|
973 | + * The geomap shortcode. |
|
974 | + */ |
|
975 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
976 | + |
|
977 | + /** |
|
978 | + * The entity cloud shortcode. |
|
979 | + */ |
|
980 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
981 | + |
|
982 | + /** |
|
983 | + * The entity glossary shortcode. |
|
984 | + */ |
|
985 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-alphabet-service.php'; |
|
986 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
987 | + |
|
988 | + /** |
|
989 | + * Faceted Search shortcode. |
|
990 | + */ |
|
991 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
992 | + |
|
993 | + /** |
|
994 | + * The ShareThis service. |
|
995 | + */ |
|
996 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-sharethis-service.php'; |
|
997 | + |
|
998 | + /** |
|
999 | + * The SEO service. |
|
1000 | + */ |
|
1001 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-seo-service.php'; |
|
1002 | + |
|
1003 | + /** |
|
1004 | + * The AMP service. |
|
1005 | + */ |
|
1006 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-amp-service.php'; |
|
1007 | + |
|
1008 | + /** Widgets */ |
|
1009 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-widget.php'; |
|
1010 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1011 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-context-cards-service.php'; |
|
1012 | + |
|
1013 | + /* |
|
1014 | 1014 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
1015 | 1015 | * |
1016 | 1016 | * Eventually Batch Actions will become Batch Operations. |
1017 | 1017 | * |
1018 | 1018 | * @since 3.20.0 |
1019 | 1019 | */ |
1020 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
1021 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1020 | + require_once plugin_dir_path( __DIR__ ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
1021 | + require_once plugin_dir_path( __DIR__ ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1022 | 1022 | |
1023 | - /* |
|
1023 | + /* |
|
1024 | 1024 | * Schema.org Services. |
1025 | 1025 | * |
1026 | 1026 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1027 | 1027 | */ |
1028 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1029 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
1030 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1031 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1032 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1033 | - new Wordlift_Schemaorg_Sync_Service(); |
|
1034 | - $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
|
1035 | - new Wordlift_Schemaorg_Class_Service(); |
|
1036 | - } else { |
|
1037 | - $schemaorg_property_service = null; |
|
1038 | - } |
|
1039 | - |
|
1040 | - $this->loader = new Wordlift_Loader(); |
|
1041 | - /** |
|
1042 | - * @since 3.30.0 |
|
1043 | - */ |
|
1044 | - $this->features_registry = Features_Registry::get_instance(); |
|
1045 | - |
|
1046 | - // Instantiate a global logger. |
|
1047 | - global $wl_logger; |
|
1048 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
1049 | - |
|
1050 | - // Load the `wl-api` end-point. |
|
1051 | - new Wordlift_Http_Api(); |
|
1052 | - |
|
1053 | - // Load the Install Service. |
|
1054 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-service.php'; |
|
1055 | - $this->install_service = new Wordlift_Install_Service(); |
|
1056 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
1057 | - $this->user_service = Wordlift_User_Service::get_instance(); |
|
1058 | - // create an instance of the entity type list admin page controller. |
|
1059 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
1060 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
1061 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
1062 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
1063 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( |
|
1064 | - Wordlift_Entity_Service::TYPE_NAME, |
|
1065 | - Wordlift_Configuration_Service::get_instance()->get_entity_base_path() |
|
1066 | - ); |
|
1067 | - /* WordPress Admin. */ |
|
1068 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
1069 | - // create an instance of the entity type setting admin page controller. |
|
1070 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
1071 | - |
|
1072 | - $that = $this; |
|
1073 | - add_action( |
|
1074 | - 'plugins_loaded', |
|
1075 | - // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
|
1076 | - function () use ( &$that, $schemaorg_property_service ) { |
|
1077 | - |
|
1078 | - /** Services. */ |
|
1079 | - // Create the configuration service. |
|
1080 | - new Wordlift_Api_Service(); |
|
1081 | - |
|
1082 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
1083 | - $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
1084 | - |
|
1085 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
|
1086 | - |
|
1087 | - $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
|
1088 | - |
|
1089 | - // Create a new instance of the Redirect service. |
|
1090 | - $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
1091 | - |
|
1092 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
1093 | - $that->timeline_service = new Wordlift_Timeline_Service(); |
|
1094 | - |
|
1095 | - $that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
1096 | - |
|
1097 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
1098 | - $that->sharethis_service = new Wordlift_ShareThis_Service(); |
|
1099 | - |
|
1100 | - // Create an instance of the PrimaShop adapter. |
|
1101 | - $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
1102 | - |
|
1103 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
1104 | - |
|
1105 | - // Create the entity rating service. |
|
1106 | - $that->rating_service = Wordlift_Rating_Service::get_instance(); |
|
1107 | - |
|
1108 | - // Create entity list customization (wp-admin/edit.php). |
|
1109 | - $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
1110 | - |
|
1111 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
1112 | - $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
|
1113 | - $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
1114 | - $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
1115 | - |
|
1116 | - $attachment_service = Wordlift_Attachment_Service::get_instance(); |
|
1117 | - |
|
1118 | - // Instantiate the JSON-LD service. |
|
1119 | - $property_getter = Wordlift_Property_Getter_Factory::create(); |
|
1120 | - $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1121 | - $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
1122 | - $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
1123 | - $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1124 | - |
|
1125 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
1126 | - $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
1127 | - /* |
|
1028 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1029 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
1030 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1031 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1032 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1033 | + new Wordlift_Schemaorg_Sync_Service(); |
|
1034 | + $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
|
1035 | + new Wordlift_Schemaorg_Class_Service(); |
|
1036 | + } else { |
|
1037 | + $schemaorg_property_service = null; |
|
1038 | + } |
|
1039 | + |
|
1040 | + $this->loader = new Wordlift_Loader(); |
|
1041 | + /** |
|
1042 | + * @since 3.30.0 |
|
1043 | + */ |
|
1044 | + $this->features_registry = Features_Registry::get_instance(); |
|
1045 | + |
|
1046 | + // Instantiate a global logger. |
|
1047 | + global $wl_logger; |
|
1048 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
1049 | + |
|
1050 | + // Load the `wl-api` end-point. |
|
1051 | + new Wordlift_Http_Api(); |
|
1052 | + |
|
1053 | + // Load the Install Service. |
|
1054 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-service.php'; |
|
1055 | + $this->install_service = new Wordlift_Install_Service(); |
|
1056 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
1057 | + $this->user_service = Wordlift_User_Service::get_instance(); |
|
1058 | + // create an instance of the entity type list admin page controller. |
|
1059 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
1060 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
1061 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
1062 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
1063 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( |
|
1064 | + Wordlift_Entity_Service::TYPE_NAME, |
|
1065 | + Wordlift_Configuration_Service::get_instance()->get_entity_base_path() |
|
1066 | + ); |
|
1067 | + /* WordPress Admin. */ |
|
1068 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
1069 | + // create an instance of the entity type setting admin page controller. |
|
1070 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
1071 | + |
|
1072 | + $that = $this; |
|
1073 | + add_action( |
|
1074 | + 'plugins_loaded', |
|
1075 | + // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
|
1076 | + function () use ( &$that, $schemaorg_property_service ) { |
|
1077 | + |
|
1078 | + /** Services. */ |
|
1079 | + // Create the configuration service. |
|
1080 | + new Wordlift_Api_Service(); |
|
1081 | + |
|
1082 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
1083 | + $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
1084 | + |
|
1085 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
|
1086 | + |
|
1087 | + $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
|
1088 | + |
|
1089 | + // Create a new instance of the Redirect service. |
|
1090 | + $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
1091 | + |
|
1092 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
1093 | + $that->timeline_service = new Wordlift_Timeline_Service(); |
|
1094 | + |
|
1095 | + $that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
1096 | + |
|
1097 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
1098 | + $that->sharethis_service = new Wordlift_ShareThis_Service(); |
|
1099 | + |
|
1100 | + // Create an instance of the PrimaShop adapter. |
|
1101 | + $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
1102 | + |
|
1103 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
1104 | + |
|
1105 | + // Create the entity rating service. |
|
1106 | + $that->rating_service = Wordlift_Rating_Service::get_instance(); |
|
1107 | + |
|
1108 | + // Create entity list customization (wp-admin/edit.php). |
|
1109 | + $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
1110 | + |
|
1111 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
1112 | + $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
|
1113 | + $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
1114 | + $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
1115 | + |
|
1116 | + $attachment_service = Wordlift_Attachment_Service::get_instance(); |
|
1117 | + |
|
1118 | + // Instantiate the JSON-LD service. |
|
1119 | + $property_getter = Wordlift_Property_Getter_Factory::create(); |
|
1120 | + $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1121 | + $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
1122 | + $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
1123 | + $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1124 | + |
|
1125 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
1126 | + $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
1127 | + /* |
|
1128 | 1128 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
1129 | 1129 | * |
1130 | 1130 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
1131 | 1131 | * |
1132 | 1132 | * @since 3.20.0 |
1133 | 1133 | */ |
1134 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
1135 | - |
|
1136 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
1137 | - $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
1138 | - |
|
1139 | - $jsonld_service = new Jsonld_Service( |
|
1140 | - $that->jsonld_service, |
|
1141 | - $term_jsonld_adapter, |
|
1142 | - new Jsonld_User_Service( $that->user_service ) |
|
1143 | - ); |
|
1144 | - new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
1145 | - |
|
1146 | - // Prints the JSON-LD in the head. |
|
1147 | - new Jsonld_Adapter( $that->jsonld_service ); |
|
1148 | - |
|
1149 | - new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
1150 | - |
|
1151 | - /** |
|
1152 | - * @since 3.37.1 |
|
1153 | - * Add mentions property to the entity. |
|
1154 | - */ |
|
1155 | - new Mentions(); |
|
1156 | - |
|
1157 | - $that->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
1158 | - |
|
1159 | - $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance(); |
|
1160 | - // Creating Faq Content filter service. |
|
1161 | - $that->faq_content_filter_service = new Faq_Content_Filter(); |
|
1162 | - $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
|
1163 | - $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
1164 | - |
|
1165 | - $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
1166 | - $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
1167 | - |
|
1168 | - /** |
|
1169 | - * Filter: wl_feature__enable__blocks. |
|
1170 | - * |
|
1171 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
1172 | - * |
|
1173 | - * @return bool |
|
1174 | - * @since 3.27.6 |
|
1175 | - */ |
|
1176 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1177 | - // Initialize the short-codes. |
|
1178 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
1179 | - new Wordlift_Chord_Shortcode(); |
|
1180 | - new Wordlift_Geomap_Shortcode(); |
|
1181 | - new Wordlift_Timeline_Shortcode(); |
|
1182 | - new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
1183 | - new Wordlift_Vocabulary_Shortcode(); |
|
1184 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
1185 | - } |
|
1186 | - |
|
1187 | - new Wordlift_Products_Navigator_Shortcode(); |
|
1188 | - |
|
1189 | - // Initialize the Context Cards Service |
|
1190 | - $that->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
1191 | - |
|
1192 | - // Initialize the SEO service. |
|
1193 | - new Wordlift_Seo_Service(); |
|
1194 | - |
|
1195 | - // Initialize the AMP service. |
|
1196 | - new Wordlift_AMP_Service( $that->jsonld_service ); |
|
1197 | - |
|
1198 | - /** Services. */ |
|
1199 | - $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
1200 | - new Wordlift_Image_Service(); |
|
1201 | - |
|
1202 | - /** Adapters. */ |
|
1203 | - $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
1204 | - $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
1205 | - $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
1206 | - |
|
1207 | - /* |
|
1134 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
1135 | + |
|
1136 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
1137 | + $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
1138 | + |
|
1139 | + $jsonld_service = new Jsonld_Service( |
|
1140 | + $that->jsonld_service, |
|
1141 | + $term_jsonld_adapter, |
|
1142 | + new Jsonld_User_Service( $that->user_service ) |
|
1143 | + ); |
|
1144 | + new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
1145 | + |
|
1146 | + // Prints the JSON-LD in the head. |
|
1147 | + new Jsonld_Adapter( $that->jsonld_service ); |
|
1148 | + |
|
1149 | + new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
1150 | + |
|
1151 | + /** |
|
1152 | + * @since 3.37.1 |
|
1153 | + * Add mentions property to the entity. |
|
1154 | + */ |
|
1155 | + new Mentions(); |
|
1156 | + |
|
1157 | + $that->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
1158 | + |
|
1159 | + $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance(); |
|
1160 | + // Creating Faq Content filter service. |
|
1161 | + $that->faq_content_filter_service = new Faq_Content_Filter(); |
|
1162 | + $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
|
1163 | + $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
1164 | + |
|
1165 | + $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
1166 | + $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
1167 | + |
|
1168 | + /** |
|
1169 | + * Filter: wl_feature__enable__blocks. |
|
1170 | + * |
|
1171 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
1172 | + * |
|
1173 | + * @return bool |
|
1174 | + * @since 3.27.6 |
|
1175 | + */ |
|
1176 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1177 | + // Initialize the short-codes. |
|
1178 | + new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
1179 | + new Wordlift_Chord_Shortcode(); |
|
1180 | + new Wordlift_Geomap_Shortcode(); |
|
1181 | + new Wordlift_Timeline_Shortcode(); |
|
1182 | + new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
1183 | + new Wordlift_Vocabulary_Shortcode(); |
|
1184 | + new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
1185 | + } |
|
1186 | + |
|
1187 | + new Wordlift_Products_Navigator_Shortcode(); |
|
1188 | + |
|
1189 | + // Initialize the Context Cards Service |
|
1190 | + $that->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
1191 | + |
|
1192 | + // Initialize the SEO service. |
|
1193 | + new Wordlift_Seo_Service(); |
|
1194 | + |
|
1195 | + // Initialize the AMP service. |
|
1196 | + new Wordlift_AMP_Service( $that->jsonld_service ); |
|
1197 | + |
|
1198 | + /** Services. */ |
|
1199 | + $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
1200 | + new Wordlift_Image_Service(); |
|
1201 | + |
|
1202 | + /** Adapters. */ |
|
1203 | + $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
1204 | + $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
1205 | + $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
1206 | + |
|
1207 | + /* |
|
1208 | 1208 | * Exclude our public js from WP-Rocket. |
1209 | 1209 | * |
1210 | 1210 | * @since 3.19.4 |
1211 | 1211 | * |
1212 | 1212 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
1213 | 1213 | */ |
1214 | - new Wordlift_WpRocket_Adapter(); |
|
1214 | + new Wordlift_WpRocket_Adapter(); |
|
1215 | 1215 | |
1216 | - // Add support for NitroPack compatibility. |
|
1217 | - $nitropack_adapter = new Wordlift_NitroPack_Adapter(); |
|
1218 | - $nitropack_adapter->register_hooks(); |
|
1216 | + // Add support for NitroPack compatibility. |
|
1217 | + $nitropack_adapter = new Wordlift_NitroPack_Adapter(); |
|
1218 | + $nitropack_adapter->register_hooks(); |
|
1219 | 1219 | |
1220 | - /** WordPress Admin UI. */ |
|
1220 | + /** WordPress Admin UI. */ |
|
1221 | 1221 | |
1222 | - // UI elements. |
|
1223 | - $that->input_element = new Wordlift_Admin_Input_Element(); |
|
1224 | - $that->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
1225 | - $that->select2_element = new Wordlift_Admin_Select2_Element(); |
|
1226 | - $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
1227 | - $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
1228 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
1229 | - $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
1230 | - $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
1222 | + // UI elements. |
|
1223 | + $that->input_element = new Wordlift_Admin_Input_Element(); |
|
1224 | + $that->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
1225 | + $that->select2_element = new Wordlift_Admin_Select2_Element(); |
|
1226 | + $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
1227 | + $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
1228 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
1229 | + $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
1230 | + $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
1231 | 1231 | |
1232 | - $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
1233 | - $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
1232 | + $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
1233 | + $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
1234 | 1234 | |
1235 | - $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
1236 | - $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
1237 | - $that->analytics_connect = new Wordlift_Analytics_Connect(); |
|
1235 | + $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
1236 | + $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
1237 | + $that->analytics_connect = new Wordlift_Analytics_Connect(); |
|
1238 | 1238 | |
1239 | - // Pages. |
|
1240 | - /* |
|
1239 | + // Pages. |
|
1240 | + /* |
|
1241 | 1241 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
1242 | 1242 | * |
1243 | 1243 | * @since 3.20.3 |
1244 | 1244 | * |
1245 | 1245 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
1246 | 1246 | */ |
1247 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
1248 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
1249 | - new Wordlift_Admin_Post_Edit_Page( $that ); |
|
1250 | - } |
|
1251 | - new Wordlift_Entity_Type_Admin_Service(); |
|
1247 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
1248 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
1249 | + new Wordlift_Admin_Post_Edit_Page( $that ); |
|
1250 | + } |
|
1251 | + new Wordlift_Entity_Type_Admin_Service(); |
|
1252 | 1252 | |
1253 | - /** Widgets */ |
|
1254 | - $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
1253 | + /** Widgets */ |
|
1254 | + $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
1255 | 1255 | |
1256 | - // Create an instance of the install wizard. |
|
1257 | - $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
1256 | + // Create an instance of the install wizard. |
|
1257 | + $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
1258 | 1258 | |
1259 | - $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
1259 | + $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
1260 | 1260 | |
1261 | - // User Profile. |
|
1262 | - new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
1261 | + // User Profile. |
|
1262 | + new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
1263 | 1263 | |
1264 | - $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
1264 | + $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
1265 | 1265 | |
1266 | - // Load the debug service if WP is in debug mode. |
|
1267 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
1268 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-debug-service.php'; |
|
1269 | - new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
1270 | - } |
|
1266 | + // Load the debug service if WP is in debug mode. |
|
1267 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
1268 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-debug-service.php'; |
|
1269 | + new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
1270 | + } |
|
1271 | 1271 | |
1272 | - // Remote Image Service. |
|
1273 | - new Wordlift_Remote_Image_Service(); |
|
1272 | + // Remote Image Service. |
|
1273 | + new Wordlift_Remote_Image_Service(); |
|
1274 | 1274 | |
1275 | - /* |
|
1275 | + /* |
|
1276 | 1276 | * Provides mappings between post types and entity types. |
1277 | 1277 | * |
1278 | 1278 | * @since 3.20.0 |
1279 | 1279 | * |
1280 | 1280 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
1281 | 1281 | */ |
1282 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-batch-action.php'; |
|
1283 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
1284 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1282 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-batch-action.php'; |
|
1283 | + require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
1284 | + require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1285 | 1285 | |
1286 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
1287 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
1286 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
1287 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
1288 | 1288 | |
1289 | - /* |
|
1289 | + /* |
|
1290 | 1290 | * Load the Mappings JSON-LD post processing. |
1291 | 1291 | * |
1292 | 1292 | * @since 3.25.0 |
1293 | 1293 | */ |
1294 | 1294 | |
1295 | - $mappings_dbo = new Mappings_DBO(); |
|
1296 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
1297 | - new Post_Type_Rule_Validator(); |
|
1298 | - // Taxonomy term rule validator for validating rules for term pages. |
|
1299 | - new Taxonomy_Term_Rule_Validator(); |
|
1300 | - new Post_Taxonomy_Term_Rule_Validator(); |
|
1301 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
1302 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
1303 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
1304 | - |
|
1305 | - new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
1306 | - new Taxonomy_To_Terms_Transform_Function(); |
|
1307 | - new Post_Id_To_Entity_Transform_Function(); |
|
1308 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
1309 | - |
|
1310 | - /** |
|
1311 | - * @since 3.27.1 |
|
1312 | - * Intiailize the acf group data formatter. |
|
1313 | - */ |
|
1314 | - new Acf_Group_Formatter(); |
|
1315 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
1316 | - |
|
1317 | - /** |
|
1318 | - * @since 3.26.0 |
|
1319 | - * Initialize the Faq JSON LD converter here - disabled. |
|
1320 | - */ |
|
1321 | - // new Faq_To_Jsonld_Converter(); |
|
1322 | - /* |
|
1295 | + $mappings_dbo = new Mappings_DBO(); |
|
1296 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
1297 | + new Post_Type_Rule_Validator(); |
|
1298 | + // Taxonomy term rule validator for validating rules for term pages. |
|
1299 | + new Taxonomy_Term_Rule_Validator(); |
|
1300 | + new Post_Taxonomy_Term_Rule_Validator(); |
|
1301 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
1302 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
1303 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
1304 | + |
|
1305 | + new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
1306 | + new Taxonomy_To_Terms_Transform_Function(); |
|
1307 | + new Post_Id_To_Entity_Transform_Function(); |
|
1308 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
1309 | + |
|
1310 | + /** |
|
1311 | + * @since 3.27.1 |
|
1312 | + * Intiailize the acf group data formatter. |
|
1313 | + */ |
|
1314 | + new Acf_Group_Formatter(); |
|
1315 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
1316 | + |
|
1317 | + /** |
|
1318 | + * @since 3.26.0 |
|
1319 | + * Initialize the Faq JSON LD converter here - disabled. |
|
1320 | + */ |
|
1321 | + // new Faq_To_Jsonld_Converter(); |
|
1322 | + /* |
|
1323 | 1323 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
1324 | 1324 | * end-point. |
1325 | 1325 | * |
1326 | 1326 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
1327 | 1327 | * @since 3.24.4 |
1328 | 1328 | */ |
1329 | - new Templates_Ajax_Endpoint(); |
|
1330 | - // Call this static method to register FAQ routes to rest api - disabled |
|
1331 | - // Faq_Rest_Controller::register_routes(); |
|
1332 | - |
|
1333 | - $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
1334 | - |
|
1335 | - /** WL Autocomplete. */ |
|
1336 | - $autocomplete_service = new All_Autocomplete_Service( |
|
1337 | - array( |
|
1338 | - new Local_Autocomplete_Service(), |
|
1339 | - new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
1340 | - ) |
|
1341 | - ); |
|
1342 | - $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
1343 | - |
|
1344 | - /** |
|
1345 | - * @since 3.27.2 |
|
1346 | - * Integrate the recipe maker jsonld & set recipe |
|
1347 | - * as default entity type to the wprm_recipe CPT. |
|
1348 | - */ |
|
1349 | - new Recipe_Maker_Post_Type_Hook(); |
|
1350 | - $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
1351 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
1352 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
1353 | - new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
1354 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
1355 | - |
|
1356 | - /** |
|
1357 | - * Avada Builder compatibility. |
|
1358 | - * |
|
1359 | - * @since 3.40.0 |
|
1360 | - */ |
|
1361 | - new Avada_Builder_Support(); |
|
1362 | - |
|
1363 | - new Duplicate_Markup_Remover(); |
|
1364 | - |
|
1365 | - /** |
|
1366 | - * @since 3.27.8 |
|
1367 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
1368 | - */ |
|
1369 | - new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
1370 | - /** |
|
1371 | - * @since 3.28.0 |
|
1372 | - * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
1373 | - */ |
|
1374 | - new Entity_No_Index_Flag(); |
|
1375 | - |
|
1376 | - /** |
|
1377 | - * @since 3.29.0 |
|
1378 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
1379 | - */ |
|
1380 | - new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
1381 | - |
|
1382 | - /** |
|
1383 | - * Expand author in to references. |
|
1384 | - * |
|
1385 | - * @since 3.30.0 |
|
1386 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
1387 | - */ |
|
1388 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1389 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
1390 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
1391 | - } |
|
1392 | - |
|
1393 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1394 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
1395 | - $vocabulary_loader = new Vocabulary_Loader(); |
|
1396 | - $vocabulary_loader->init_vocabulary(); |
|
1397 | - } |
|
1398 | - |
|
1399 | - /** |
|
1400 | - * Added for feature request 1496 (Webhooks) |
|
1401 | - */ |
|
1402 | - if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
1403 | - $that->webhook_loader = new Webhooks_Loader(); |
|
1404 | - $that->webhook_loader->init(); |
|
1405 | - } |
|
1406 | - |
|
1407 | - /** |
|
1408 | - * @since 3.30.0 |
|
1409 | - * Add a checkbox to user option screen for wordlift admin. |
|
1410 | - */ |
|
1411 | - $wordlift_admin_checkbox = new Admin_User_Option(); |
|
1412 | - $wordlift_admin_checkbox->connect_hook(); |
|
1413 | - |
|
1414 | - /** |
|
1415 | - * @since 3.31.0 |
|
1416 | - * Init loader class for videoobject. |
|
1417 | - */ |
|
1418 | - $videoobject_loader = new Loader(); |
|
1419 | - $videoobject_loader->init_feature(); |
|
1420 | - |
|
1421 | - /** |
|
1422 | - * @since 3.35.0 |
|
1423 | - */ |
|
1424 | - $google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader(); |
|
1425 | - $google_addon_integration_loader->init_feature(); |
|
1426 | - |
|
1427 | - /** |
|
1428 | - * @since 3.31.5 |
|
1429 | - * Create configuration endpoint for webapp to configure. |
|
1430 | - */ |
|
1431 | - new Config( $that->admin_setup, $that->key_validation_service ); |
|
1432 | - /** |
|
1433 | - * @since 3.31.7 |
|
1434 | - * Remove duplicate videoobject. |
|
1435 | - */ |
|
1436 | - new Videoobject_Duplicate_Remover(); |
|
1437 | - $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
1438 | - $synonym_loader->init_feature(); |
|
1439 | - /** |
|
1440 | - * @since 3.32.0 |
|
1441 | - * Create loader for vocabulary terms. |
|
1442 | - */ |
|
1443 | - $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
1444 | - $vocabulary_terms_loader->init_feature(); |
|
1445 | - |
|
1446 | - new Entity_Type_Change_Handler( |
|
1447 | - Wordlift_Entity_Service::get_instance(), |
|
1448 | - Wordlift_Entity_Type_Service::get_instance() |
|
1449 | - ); |
|
1450 | - |
|
1451 | - }, |
|
1452 | - 3 |
|
1453 | - ); |
|
1454 | - |
|
1455 | - new Entity_Type_Setter(); |
|
1456 | - $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader(); |
|
1457 | - $no_editor_analysis_loader->init_feature(); |
|
1458 | - } |
|
1459 | - |
|
1460 | - /** |
|
1461 | - * Define the locale for this plugin for internationalization. |
|
1462 | - * |
|
1463 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
1464 | - * with WordPress. |
|
1465 | - * |
|
1466 | - * @since 1.0.0 |
|
1467 | - * @access private |
|
1468 | - */ |
|
1469 | - private function set_locale() { |
|
1470 | - |
|
1471 | - $plugin_i18n = new Wordlift_I18n(); |
|
1472 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
1473 | - |
|
1474 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
1475 | - |
|
1476 | - } |
|
1477 | - |
|
1478 | - /** |
|
1479 | - * Register all of the hooks related to the admin area functionality |
|
1480 | - * of the plugin. |
|
1481 | - * |
|
1482 | - * @since 1.0.0 |
|
1483 | - * @access private |
|
1484 | - */ |
|
1485 | - private function define_admin_hooks( $that ) { |
|
1486 | - $plugin_admin = new Wordlift_Admin( |
|
1487 | - $that->get_plugin_name(), |
|
1488 | - $that->get_version(), |
|
1489 | - $that->notice_service, |
|
1490 | - $that->user_service |
|
1491 | - ); |
|
1492 | - |
|
1493 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
1494 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
1495 | - |
|
1496 | - // Hook the `admin_init` function to the Admin Setup. |
|
1497 | - Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
1498 | - $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
1499 | - |
|
1500 | - // Hook the admin_init to the settings page. |
|
1501 | - Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
1502 | - $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
1503 | - |
|
1504 | - // Hook the admin_init to the analytics settings page. |
|
1505 | - Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
1506 | - $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
1507 | - |
|
1508 | - // Hook the init action to taxonomy services. |
|
1509 | - $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
1510 | - $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
1511 | - |
|
1512 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
1513 | - $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1514 | - |
|
1515 | - // Register custom allowed redirect hosts. |
|
1516 | - $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
1517 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1518 | - $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
1519 | - |
|
1520 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
1521 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
1522 | - $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2 ); |
|
1523 | - $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
1524 | - |
|
1525 | - $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
1526 | - $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
1527 | - |
|
1528 | - // Entity listing customization (wp-admin/edit.php) |
|
1529 | - // Add custom columns. |
|
1530 | - $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
1531 | - // no explicit entity as it prevents handling of other post types. |
|
1532 | - $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
1533 | - // Add 4W selection. |
|
1534 | - $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
1535 | - $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
1536 | - $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
1537 | - $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
1538 | - |
|
1539 | - /* |
|
1329 | + new Templates_Ajax_Endpoint(); |
|
1330 | + // Call this static method to register FAQ routes to rest api - disabled |
|
1331 | + // Faq_Rest_Controller::register_routes(); |
|
1332 | + |
|
1333 | + $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
1334 | + |
|
1335 | + /** WL Autocomplete. */ |
|
1336 | + $autocomplete_service = new All_Autocomplete_Service( |
|
1337 | + array( |
|
1338 | + new Local_Autocomplete_Service(), |
|
1339 | + new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
1340 | + ) |
|
1341 | + ); |
|
1342 | + $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
1343 | + |
|
1344 | + /** |
|
1345 | + * @since 3.27.2 |
|
1346 | + * Integrate the recipe maker jsonld & set recipe |
|
1347 | + * as default entity type to the wprm_recipe CPT. |
|
1348 | + */ |
|
1349 | + new Recipe_Maker_Post_Type_Hook(); |
|
1350 | + $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
1351 | + new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
1352 | + new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
1353 | + new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
1354 | + new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
1355 | + |
|
1356 | + /** |
|
1357 | + * Avada Builder compatibility. |
|
1358 | + * |
|
1359 | + * @since 3.40.0 |
|
1360 | + */ |
|
1361 | + new Avada_Builder_Support(); |
|
1362 | + |
|
1363 | + new Duplicate_Markup_Remover(); |
|
1364 | + |
|
1365 | + /** |
|
1366 | + * @since 3.27.8 |
|
1367 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
1368 | + */ |
|
1369 | + new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
1370 | + /** |
|
1371 | + * @since 3.28.0 |
|
1372 | + * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
1373 | + */ |
|
1374 | + new Entity_No_Index_Flag(); |
|
1375 | + |
|
1376 | + /** |
|
1377 | + * @since 3.29.0 |
|
1378 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
1379 | + */ |
|
1380 | + new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
1381 | + |
|
1382 | + /** |
|
1383 | + * Expand author in to references. |
|
1384 | + * |
|
1385 | + * @since 3.30.0 |
|
1386 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
1387 | + */ |
|
1388 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1389 | + if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
1390 | + new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
1391 | + } |
|
1392 | + |
|
1393 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1394 | + if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
1395 | + $vocabulary_loader = new Vocabulary_Loader(); |
|
1396 | + $vocabulary_loader->init_vocabulary(); |
|
1397 | + } |
|
1398 | + |
|
1399 | + /** |
|
1400 | + * Added for feature request 1496 (Webhooks) |
|
1401 | + */ |
|
1402 | + if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
1403 | + $that->webhook_loader = new Webhooks_Loader(); |
|
1404 | + $that->webhook_loader->init(); |
|
1405 | + } |
|
1406 | + |
|
1407 | + /** |
|
1408 | + * @since 3.30.0 |
|
1409 | + * Add a checkbox to user option screen for wordlift admin. |
|
1410 | + */ |
|
1411 | + $wordlift_admin_checkbox = new Admin_User_Option(); |
|
1412 | + $wordlift_admin_checkbox->connect_hook(); |
|
1413 | + |
|
1414 | + /** |
|
1415 | + * @since 3.31.0 |
|
1416 | + * Init loader class for videoobject. |
|
1417 | + */ |
|
1418 | + $videoobject_loader = new Loader(); |
|
1419 | + $videoobject_loader->init_feature(); |
|
1420 | + |
|
1421 | + /** |
|
1422 | + * @since 3.35.0 |
|
1423 | + */ |
|
1424 | + $google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader(); |
|
1425 | + $google_addon_integration_loader->init_feature(); |
|
1426 | + |
|
1427 | + /** |
|
1428 | + * @since 3.31.5 |
|
1429 | + * Create configuration endpoint for webapp to configure. |
|
1430 | + */ |
|
1431 | + new Config( $that->admin_setup, $that->key_validation_service ); |
|
1432 | + /** |
|
1433 | + * @since 3.31.7 |
|
1434 | + * Remove duplicate videoobject. |
|
1435 | + */ |
|
1436 | + new Videoobject_Duplicate_Remover(); |
|
1437 | + $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
1438 | + $synonym_loader->init_feature(); |
|
1439 | + /** |
|
1440 | + * @since 3.32.0 |
|
1441 | + * Create loader for vocabulary terms. |
|
1442 | + */ |
|
1443 | + $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
1444 | + $vocabulary_terms_loader->init_feature(); |
|
1445 | + |
|
1446 | + new Entity_Type_Change_Handler( |
|
1447 | + Wordlift_Entity_Service::get_instance(), |
|
1448 | + Wordlift_Entity_Type_Service::get_instance() |
|
1449 | + ); |
|
1450 | + |
|
1451 | + }, |
|
1452 | + 3 |
|
1453 | + ); |
|
1454 | + |
|
1455 | + new Entity_Type_Setter(); |
|
1456 | + $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader(); |
|
1457 | + $no_editor_analysis_loader->init_feature(); |
|
1458 | + } |
|
1459 | + |
|
1460 | + /** |
|
1461 | + * Define the locale for this plugin for internationalization. |
|
1462 | + * |
|
1463 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
1464 | + * with WordPress. |
|
1465 | + * |
|
1466 | + * @since 1.0.0 |
|
1467 | + * @access private |
|
1468 | + */ |
|
1469 | + private function set_locale() { |
|
1470 | + |
|
1471 | + $plugin_i18n = new Wordlift_I18n(); |
|
1472 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
1473 | + |
|
1474 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
1475 | + |
|
1476 | + } |
|
1477 | + |
|
1478 | + /** |
|
1479 | + * Register all of the hooks related to the admin area functionality |
|
1480 | + * of the plugin. |
|
1481 | + * |
|
1482 | + * @since 1.0.0 |
|
1483 | + * @access private |
|
1484 | + */ |
|
1485 | + private function define_admin_hooks( $that ) { |
|
1486 | + $plugin_admin = new Wordlift_Admin( |
|
1487 | + $that->get_plugin_name(), |
|
1488 | + $that->get_version(), |
|
1489 | + $that->notice_service, |
|
1490 | + $that->user_service |
|
1491 | + ); |
|
1492 | + |
|
1493 | + $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
1494 | + $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
1495 | + |
|
1496 | + // Hook the `admin_init` function to the Admin Setup. |
|
1497 | + Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
1498 | + $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
1499 | + |
|
1500 | + // Hook the admin_init to the settings page. |
|
1501 | + Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
1502 | + $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
1503 | + |
|
1504 | + // Hook the admin_init to the analytics settings page. |
|
1505 | + Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
1506 | + $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
1507 | + |
|
1508 | + // Hook the init action to taxonomy services. |
|
1509 | + $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
1510 | + $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
1511 | + |
|
1512 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
1513 | + $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1514 | + |
|
1515 | + // Register custom allowed redirect hosts. |
|
1516 | + $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
1517 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1518 | + $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
1519 | + |
|
1520 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
1521 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
1522 | + $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2 ); |
|
1523 | + $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
1524 | + |
|
1525 | + $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
1526 | + $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
1527 | + |
|
1528 | + // Entity listing customization (wp-admin/edit.php) |
|
1529 | + // Add custom columns. |
|
1530 | + $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
1531 | + // no explicit entity as it prevents handling of other post types. |
|
1532 | + $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
1533 | + // Add 4W selection. |
|
1534 | + $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
1535 | + $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
1536 | + $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
1537 | + $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
1538 | + |
|
1539 | + /* |
|
1540 | 1540 | * If `All Entity Types` is disable, use the radio button Walker. |
1541 | 1541 | * |
1542 | 1542 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1543 | 1543 | */ |
1544 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1545 | - if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) |
|
1546 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1547 | - && ! apply_filters( 'wl_feature__enable__entity-types-professional', false ) |
|
1548 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1549 | - && ! apply_filters( 'wl_feature__enable__entity-types-business', false ) |
|
1550 | - ) { |
|
1551 | - $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
1552 | - } |
|
1553 | - |
|
1554 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
1555 | - // entities. |
|
1556 | - $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10 ); |
|
1557 | - |
|
1558 | - /** |
|
1559 | - * Filter: wl_feature__enable__settings-download. |
|
1560 | - * |
|
1561 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
1562 | - * |
|
1563 | - * @return bool |
|
1564 | - * @since 3.27.6 |
|
1565 | - */ |
|
1566 | - $that->features_registry->register_feature_from_slug( |
|
1567 | - 'settings-download', |
|
1568 | - true, |
|
1569 | - array( |
|
1570 | - $that, |
|
1571 | - 'register_screens', |
|
1572 | - ) |
|
1573 | - ); |
|
1574 | - |
|
1575 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
1576 | - $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
1577 | - |
|
1578 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1579 | - $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1580 | - $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1581 | - $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1582 | - |
|
1583 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
1584 | - $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
1585 | - |
|
1586 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
1587 | - $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
1588 | - |
|
1589 | - $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
1590 | - |
|
1591 | - // Hook the menu creation on the general wordlift menu creation. |
|
1592 | - /** |
|
1593 | - * Filter: wl_feature__enable__screens. |
|
1594 | - * |
|
1595 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
1596 | - * |
|
1597 | - * @return bool |
|
1598 | - * @since 3.27.6 |
|
1599 | - * |
|
1600 | - * Since 3.30.0 this feature is registered using registry. |
|
1601 | - */ |
|
1602 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1603 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
1604 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
1605 | - } |
|
1606 | - |
|
1607 | - // Hook key update. |
|
1608 | - $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
1609 | - $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
1610 | - |
|
1611 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
1612 | - $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
1613 | - |
|
1614 | - /* |
|
1544 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1545 | + if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) |
|
1546 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1547 | + && ! apply_filters( 'wl_feature__enable__entity-types-professional', false ) |
|
1548 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1549 | + && ! apply_filters( 'wl_feature__enable__entity-types-business', false ) |
|
1550 | + ) { |
|
1551 | + $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
1552 | + } |
|
1553 | + |
|
1554 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
1555 | + // entities. |
|
1556 | + $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10 ); |
|
1557 | + |
|
1558 | + /** |
|
1559 | + * Filter: wl_feature__enable__settings-download. |
|
1560 | + * |
|
1561 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
1562 | + * |
|
1563 | + * @return bool |
|
1564 | + * @since 3.27.6 |
|
1565 | + */ |
|
1566 | + $that->features_registry->register_feature_from_slug( |
|
1567 | + 'settings-download', |
|
1568 | + true, |
|
1569 | + array( |
|
1570 | + $that, |
|
1571 | + 'register_screens', |
|
1572 | + ) |
|
1573 | + ); |
|
1574 | + |
|
1575 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
1576 | + $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
1577 | + |
|
1578 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1579 | + $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1580 | + $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1581 | + $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1582 | + |
|
1583 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
1584 | + $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
1585 | + |
|
1586 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
1587 | + $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
1588 | + |
|
1589 | + $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
1590 | + |
|
1591 | + // Hook the menu creation on the general wordlift menu creation. |
|
1592 | + /** |
|
1593 | + * Filter: wl_feature__enable__screens. |
|
1594 | + * |
|
1595 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
1596 | + * |
|
1597 | + * @return bool |
|
1598 | + * @since 3.27.6 |
|
1599 | + * |
|
1600 | + * Since 3.30.0 this feature is registered using registry. |
|
1601 | + */ |
|
1602 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1603 | + if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
1604 | + add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
1605 | + } |
|
1606 | + |
|
1607 | + // Hook key update. |
|
1608 | + $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
1609 | + $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
1610 | + |
|
1611 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
1612 | + $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
1613 | + |
|
1614 | + /* |
|
1615 | 1615 | * Remove the Analytics Settings link from the plugin page. |
1616 | 1616 | * |
1617 | 1617 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
1618 | 1618 | * @since 3.21.1 |
1619 | 1619 | */ |
1620 | - // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
1621 | - |
|
1622 | - // Hook the AJAX `wl_publisher` action name. |
|
1623 | - $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
1624 | - |
|
1625 | - // Hook row actions for the entity type list admin. |
|
1626 | - $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
1627 | - |
|
1628 | - /** Ajax actions. */ |
|
1629 | - $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
1630 | - |
|
1631 | - // Hook capabilities manipulation to allow access to entity type admin |
|
1632 | - // page on WordPress versions before 4.7. |
|
1633 | - global $wp_version; |
|
1634 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
1635 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2 ); |
|
1636 | - } |
|
1637 | - |
|
1638 | - /** Adapters. */ |
|
1639 | - $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
1640 | - /** |
|
1641 | - * Disabling Faq temporarily. |
|
1642 | - * Load the tinymce editor button on the tool bar. |
|
1643 | - * |
|
1644 | - * @since 3.26.0 |
|
1645 | - */ |
|
1646 | - // $that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' ); |
|
1647 | - // $that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
1648 | - // $that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
1649 | - |
|
1650 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
1651 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
1652 | - |
|
1653 | - /** |
|
1654 | - * @since 3.26.0 |
|
1655 | - */ |
|
1656 | - $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
1657 | - $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
1658 | - // Adding Rest route for the post excerpt |
|
1659 | - Post_Excerpt_Rest_Controller::register_routes(); |
|
1660 | - |
|
1661 | - // Handle the autocomplete request. |
|
1662 | - add_action( |
|
1663 | - 'wp_ajax_wl_autocomplete', |
|
1664 | - array( |
|
1665 | - $that->autocomplete_adapter, |
|
1666 | - 'wl_autocomplete', |
|
1667 | - ) |
|
1668 | - ); |
|
1669 | - add_action( |
|
1670 | - 'wp_ajax_nopriv_wl_autocomplete', |
|
1671 | - array( |
|
1672 | - $that->autocomplete_adapter, |
|
1673 | - 'wl_autocomplete', |
|
1674 | - ) |
|
1675 | - ); |
|
1676 | - |
|
1677 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
1678 | - if ( is_multisite() ) { |
|
1679 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2 ); |
|
1680 | - } |
|
1681 | - |
|
1682 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
|
1683 | - |
|
1684 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
1685 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
1686 | - add_action( |
|
1687 | - 'wp_ajax_wl_deactivation_feedback', |
|
1688 | - array( |
|
1689 | - $deactivator_feedback, |
|
1690 | - 'wl_deactivation_feedback', |
|
1691 | - ) |
|
1692 | - ); |
|
1693 | - |
|
1694 | - /** |
|
1695 | - * Always allow the `wordlift/classification` block. |
|
1696 | - * |
|
1697 | - * @since 3.23.0 |
|
1698 | - */ |
|
1699 | - add_filter( |
|
1700 | - 'allowed_block_types', |
|
1701 | - function ( $value ) { |
|
1702 | - |
|
1703 | - if ( true === $value ) { |
|
1704 | - return $value; |
|
1705 | - } |
|
1706 | - |
|
1707 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
1708 | - }, |
|
1709 | - PHP_INT_MAX |
|
1710 | - ); |
|
1711 | - |
|
1712 | - /** |
|
1713 | - * @since 3.27.7 |
|
1714 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
1715 | - */ |
|
1716 | - new Top_Entities(); |
|
1717 | - |
|
1718 | - } |
|
1719 | - |
|
1720 | - /** |
|
1721 | - * Register all of the hooks related to the public-facing functionality |
|
1722 | - * of the plugin. |
|
1723 | - * |
|
1724 | - * @since 1.0.0 |
|
1725 | - * @access private |
|
1726 | - */ |
|
1727 | - private function define_public_hooks( $that ) { |
|
1728 | - |
|
1729 | - $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
1730 | - |
|
1731 | - // Register the entity post type. |
|
1732 | - $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
1733 | - |
|
1734 | - // Bind the link generation and handling hooks to the entity link service. |
|
1735 | - $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 2 ); |
|
1736 | - $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
1737 | - |
|
1738 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
1739 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
1740 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
1741 | - |
|
1742 | - // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
1743 | - $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
1744 | - // Hook the content filter service to add entity links. |
|
1745 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
1746 | - // We run before other filters. |
|
1747 | - $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
1748 | - } |
|
1749 | - |
|
1750 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
1751 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1752 | - |
|
1753 | - // Hook the ShareThis service. |
|
1754 | - $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
1755 | - $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
1756 | - |
|
1757 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1758 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1759 | - |
|
1760 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
1761 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
1762 | - // to categories. |
|
1763 | - $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
1764 | - |
|
1765 | - /* |
|
1620 | + // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
1621 | + |
|
1622 | + // Hook the AJAX `wl_publisher` action name. |
|
1623 | + $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
1624 | + |
|
1625 | + // Hook row actions for the entity type list admin. |
|
1626 | + $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
1627 | + |
|
1628 | + /** Ajax actions. */ |
|
1629 | + $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
1630 | + |
|
1631 | + // Hook capabilities manipulation to allow access to entity type admin |
|
1632 | + // page on WordPress versions before 4.7. |
|
1633 | + global $wp_version; |
|
1634 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
1635 | + $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2 ); |
|
1636 | + } |
|
1637 | + |
|
1638 | + /** Adapters. */ |
|
1639 | + $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
1640 | + /** |
|
1641 | + * Disabling Faq temporarily. |
|
1642 | + * Load the tinymce editor button on the tool bar. |
|
1643 | + * |
|
1644 | + * @since 3.26.0 |
|
1645 | + */ |
|
1646 | + // $that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' ); |
|
1647 | + // $that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
1648 | + // $that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
1649 | + |
|
1650 | + $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
1651 | + $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
1652 | + |
|
1653 | + /** |
|
1654 | + * @since 3.26.0 |
|
1655 | + */ |
|
1656 | + $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
1657 | + $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
1658 | + // Adding Rest route for the post excerpt |
|
1659 | + Post_Excerpt_Rest_Controller::register_routes(); |
|
1660 | + |
|
1661 | + // Handle the autocomplete request. |
|
1662 | + add_action( |
|
1663 | + 'wp_ajax_wl_autocomplete', |
|
1664 | + array( |
|
1665 | + $that->autocomplete_adapter, |
|
1666 | + 'wl_autocomplete', |
|
1667 | + ) |
|
1668 | + ); |
|
1669 | + add_action( |
|
1670 | + 'wp_ajax_nopriv_wl_autocomplete', |
|
1671 | + array( |
|
1672 | + $that->autocomplete_adapter, |
|
1673 | + 'wl_autocomplete', |
|
1674 | + ) |
|
1675 | + ); |
|
1676 | + |
|
1677 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
1678 | + if ( is_multisite() ) { |
|
1679 | + $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2 ); |
|
1680 | + } |
|
1681 | + |
|
1682 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
|
1683 | + |
|
1684 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
1685 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
1686 | + add_action( |
|
1687 | + 'wp_ajax_wl_deactivation_feedback', |
|
1688 | + array( |
|
1689 | + $deactivator_feedback, |
|
1690 | + 'wl_deactivation_feedback', |
|
1691 | + ) |
|
1692 | + ); |
|
1693 | + |
|
1694 | + /** |
|
1695 | + * Always allow the `wordlift/classification` block. |
|
1696 | + * |
|
1697 | + * @since 3.23.0 |
|
1698 | + */ |
|
1699 | + add_filter( |
|
1700 | + 'allowed_block_types', |
|
1701 | + function ( $value ) { |
|
1702 | + |
|
1703 | + if ( true === $value ) { |
|
1704 | + return $value; |
|
1705 | + } |
|
1706 | + |
|
1707 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
1708 | + }, |
|
1709 | + PHP_INT_MAX |
|
1710 | + ); |
|
1711 | + |
|
1712 | + /** |
|
1713 | + * @since 3.27.7 |
|
1714 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
1715 | + */ |
|
1716 | + new Top_Entities(); |
|
1717 | + |
|
1718 | + } |
|
1719 | + |
|
1720 | + /** |
|
1721 | + * Register all of the hooks related to the public-facing functionality |
|
1722 | + * of the plugin. |
|
1723 | + * |
|
1724 | + * @since 1.0.0 |
|
1725 | + * @access private |
|
1726 | + */ |
|
1727 | + private function define_public_hooks( $that ) { |
|
1728 | + |
|
1729 | + $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
1730 | + |
|
1731 | + // Register the entity post type. |
|
1732 | + $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
1733 | + |
|
1734 | + // Bind the link generation and handling hooks to the entity link service. |
|
1735 | + $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 2 ); |
|
1736 | + $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
1737 | + |
|
1738 | + $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
1739 | + $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
1740 | + $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
1741 | + |
|
1742 | + // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
1743 | + $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
1744 | + // Hook the content filter service to add entity links. |
|
1745 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
1746 | + // We run before other filters. |
|
1747 | + $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
1748 | + } |
|
1749 | + |
|
1750 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
1751 | + $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1752 | + |
|
1753 | + // Hook the ShareThis service. |
|
1754 | + $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
1755 | + $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
1756 | + |
|
1757 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1758 | + $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1759 | + |
|
1760 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
1761 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
1762 | + // to categories. |
|
1763 | + $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
1764 | + |
|
1765 | + /* |
|
1766 | 1766 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
1767 | 1767 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
1768 | 1768 | * order of start time. |
1769 | 1769 | */ |
1770 | - $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
1771 | - |
|
1772 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
1773 | - $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 2 ); |
|
1774 | - |
|
1775 | - // Analytics Script Frontend. |
|
1776 | - if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
1777 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
1778 | - } |
|
1779 | - |
|
1780 | - } |
|
1781 | - |
|
1782 | - /** |
|
1783 | - * Run the loader to execute all of the hooks with WordPress. |
|
1784 | - * |
|
1785 | - * @since 1.0.0 |
|
1786 | - */ |
|
1787 | - public function run() { |
|
1788 | - $this->loader->run(); |
|
1789 | - } |
|
1790 | - |
|
1791 | - /** |
|
1792 | - * The name of the plugin used to uniquely identify it within the context of |
|
1793 | - * WordPress and to define internationalization functionality. |
|
1794 | - * |
|
1795 | - * @return string The name of the plugin. |
|
1796 | - * @since 1.0.0 |
|
1797 | - */ |
|
1798 | - public function get_plugin_name() { |
|
1799 | - return $this->plugin_name; |
|
1800 | - } |
|
1801 | - |
|
1802 | - /** |
|
1803 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
1804 | - * |
|
1805 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
1806 | - * @since 1.0.0 |
|
1807 | - */ |
|
1808 | - public function get_loader() { |
|
1809 | - return $this->loader; |
|
1810 | - } |
|
1811 | - |
|
1812 | - /** |
|
1813 | - * Retrieve the version number of the plugin. |
|
1814 | - * |
|
1815 | - * @return string The version number of the plugin. |
|
1816 | - * @since 1.0.0 |
|
1817 | - */ |
|
1818 | - public function get_version() { |
|
1819 | - return $this->version; |
|
1820 | - } |
|
1821 | - |
|
1822 | - /** |
|
1823 | - * Load dependencies for WP-CLI. |
|
1824 | - * |
|
1825 | - * @throws Exception when an error occurs. |
|
1826 | - * @since 3.18.0 |
|
1827 | - */ |
|
1828 | - private function load_cli_dependencies() { |
|
1829 | - |
|
1830 | - } |
|
1831 | - |
|
1832 | - public function add_wl_enabled_blocks() { |
|
1833 | - /** |
|
1834 | - * Filter: wl_feature__enable__blocks. |
|
1835 | - * |
|
1836 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
1837 | - * |
|
1838 | - * @return bool |
|
1839 | - * @since 3.27.6 |
|
1840 | - */ |
|
1841 | - // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion |
|
1842 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
1843 | - |
|
1844 | - $enabled_blocks = array(); |
|
1845 | - |
|
1846 | - /** |
|
1847 | - * Filter name: wl_feature__enable__product-navigator |
|
1848 | - * |
|
1849 | - * @since 3.32.3 |
|
1850 | - */ |
|
1851 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1852 | - if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
1853 | - $enabled_blocks[] = 'wordlift/products-navigator'; |
|
1854 | - } |
|
1855 | - |
|
1856 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1857 | - // To intimate JS |
|
1858 | - $enabled_blocks = array_merge( |
|
1859 | - $enabled_blocks, |
|
1860 | - array( |
|
1861 | - 'wordlift/navigator', |
|
1862 | - 'wordlift/chord', |
|
1863 | - 'wordlift/geomap', |
|
1864 | - 'wordlift/timeline', |
|
1865 | - 'wordlift/cloud', |
|
1866 | - 'wordlift/vocabulary', |
|
1867 | - 'wordlift/faceted-search', |
|
1868 | - ) |
|
1869 | - ); |
|
1870 | - } |
|
1871 | - |
|
1872 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
1873 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
1874 | - } |
|
1875 | - |
|
1876 | - /** |
|
1877 | - * Register screens based on the filter. |
|
1878 | - */ |
|
1879 | - public function register_screens() { |
|
1880 | - // Hook the menu to the Download Your Data page. |
|
1881 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1882 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
1883 | - Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
1884 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
1885 | - } |
|
1886 | - |
|
1887 | - Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
1888 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
1889 | - |
|
1890 | - } |
|
1770 | + $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
1771 | + |
|
1772 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
1773 | + $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 2 ); |
|
1774 | + |
|
1775 | + // Analytics Script Frontend. |
|
1776 | + if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
1777 | + $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
1778 | + } |
|
1779 | + |
|
1780 | + } |
|
1781 | + |
|
1782 | + /** |
|
1783 | + * Run the loader to execute all of the hooks with WordPress. |
|
1784 | + * |
|
1785 | + * @since 1.0.0 |
|
1786 | + */ |
|
1787 | + public function run() { |
|
1788 | + $this->loader->run(); |
|
1789 | + } |
|
1790 | + |
|
1791 | + /** |
|
1792 | + * The name of the plugin used to uniquely identify it within the context of |
|
1793 | + * WordPress and to define internationalization functionality. |
|
1794 | + * |
|
1795 | + * @return string The name of the plugin. |
|
1796 | + * @since 1.0.0 |
|
1797 | + */ |
|
1798 | + public function get_plugin_name() { |
|
1799 | + return $this->plugin_name; |
|
1800 | + } |
|
1801 | + |
|
1802 | + /** |
|
1803 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
1804 | + * |
|
1805 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
1806 | + * @since 1.0.0 |
|
1807 | + */ |
|
1808 | + public function get_loader() { |
|
1809 | + return $this->loader; |
|
1810 | + } |
|
1811 | + |
|
1812 | + /** |
|
1813 | + * Retrieve the version number of the plugin. |
|
1814 | + * |
|
1815 | + * @return string The version number of the plugin. |
|
1816 | + * @since 1.0.0 |
|
1817 | + */ |
|
1818 | + public function get_version() { |
|
1819 | + return $this->version; |
|
1820 | + } |
|
1821 | + |
|
1822 | + /** |
|
1823 | + * Load dependencies for WP-CLI. |
|
1824 | + * |
|
1825 | + * @throws Exception when an error occurs. |
|
1826 | + * @since 3.18.0 |
|
1827 | + */ |
|
1828 | + private function load_cli_dependencies() { |
|
1829 | + |
|
1830 | + } |
|
1831 | + |
|
1832 | + public function add_wl_enabled_blocks() { |
|
1833 | + /** |
|
1834 | + * Filter: wl_feature__enable__blocks. |
|
1835 | + * |
|
1836 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
1837 | + * |
|
1838 | + * @return bool |
|
1839 | + * @since 3.27.6 |
|
1840 | + */ |
|
1841 | + // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion |
|
1842 | + wp_register_script( 'wl_enabled_blocks', false ); |
|
1843 | + |
|
1844 | + $enabled_blocks = array(); |
|
1845 | + |
|
1846 | + /** |
|
1847 | + * Filter name: wl_feature__enable__product-navigator |
|
1848 | + * |
|
1849 | + * @since 3.32.3 |
|
1850 | + */ |
|
1851 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1852 | + if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
1853 | + $enabled_blocks[] = 'wordlift/products-navigator'; |
|
1854 | + } |
|
1855 | + |
|
1856 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1857 | + // To intimate JS |
|
1858 | + $enabled_blocks = array_merge( |
|
1859 | + $enabled_blocks, |
|
1860 | + array( |
|
1861 | + 'wordlift/navigator', |
|
1862 | + 'wordlift/chord', |
|
1863 | + 'wordlift/geomap', |
|
1864 | + 'wordlift/timeline', |
|
1865 | + 'wordlift/cloud', |
|
1866 | + 'wordlift/vocabulary', |
|
1867 | + 'wordlift/faceted-search', |
|
1868 | + ) |
|
1869 | + ); |
|
1870 | + } |
|
1871 | + |
|
1872 | + wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
1873 | + wp_enqueue_script( 'wl_enabled_blocks' ); |
|
1874 | + } |
|
1875 | + |
|
1876 | + /** |
|
1877 | + * Register screens based on the filter. |
|
1878 | + */ |
|
1879 | + public function register_screens() { |
|
1880 | + // Hook the menu to the Download Your Data page. |
|
1881 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1882 | + if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
1883 | + Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
1884 | + add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
1885 | + } |
|
1886 | + |
|
1887 | + Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
1888 | + add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
1889 | + |
|
1890 | + } |
|
1891 | 1891 | |
1892 | 1892 | } |
@@ -24,60 +24,60 @@ |
||
24 | 24 | */ |
25 | 25 | class Loader extends Default_Loader { |
26 | 26 | |
27 | - public function init_all_dependencies() { |
|
28 | - $video_storage = Video_Storage_Factory::get_storage(); |
|
29 | - new Jsonld( $video_storage ); |
|
30 | - |
|
31 | - $sitemap_cache = new Ttl_Cache( 'wl_video_sitemap', 86400 ); |
|
32 | - |
|
33 | - $video_processor = new Video_Processor(); |
|
34 | - // Hook in to save_post to save the videos |
|
35 | - $post_filter = new Post_Filter( $video_processor ); |
|
36 | - $post_filter->init(); |
|
37 | - // Add entry to wordlift admin tabs |
|
38 | - $settings_tab = new Settings_Tab(); |
|
39 | - $settings_tab->init(); |
|
40 | - |
|
41 | - $video_sitemap = new Video_Sitemap( $sitemap_cache ); |
|
42 | - $video_sitemap->init(); |
|
43 | - |
|
44 | - $background_process_data_source = new Videos_Data_Source( '__wl_videoobject_import_state' ); |
|
45 | - $background_process = new Videoobject_Background_Process( $video_processor, $background_process_data_source ); |
|
46 | - |
|
47 | - $rest_controller = new Rest_Controller( $background_process ); |
|
48 | - $rest_controller->register_all_routes(); |
|
49 | - |
|
50 | - $post_edit_screen = new Post_Edit_Screen(); |
|
51 | - $post_edit_screen->init(); |
|
52 | - |
|
53 | - new Import_Videos_Page(); |
|
54 | - |
|
55 | - /** |
|
56 | - * @since 3.32.0 |
|
57 | - * Allow videoobject to capture embed shortcode. |
|
58 | - */ |
|
59 | - $embed_shortcode_capture = new Embed_Shortcode_Capture(); |
|
60 | - $embed_shortcode_capture->init(); |
|
61 | - |
|
62 | - /** |
|
63 | - * @since 3.32.0 |
|
64 | - * Get videos from jw player. |
|
65 | - */ |
|
66 | - $jw_player_capture_videos = new Jw_Player_Capture(); |
|
67 | - $jw_player_capture_videos->init(); |
|
68 | - |
|
69 | - /** |
|
70 | - * Validate API Key for Youtube, Vimeo. |
|
71 | - */ |
|
72 | - new Video_Key_Validation_Service(); |
|
73 | - |
|
74 | - } |
|
75 | - |
|
76 | - public function get_feature_slug() { |
|
77 | - return 'videoobject'; |
|
78 | - } |
|
79 | - |
|
80 | - public function get_feature_default_value() { |
|
81 | - return false; |
|
82 | - } |
|
27 | + public function init_all_dependencies() { |
|
28 | + $video_storage = Video_Storage_Factory::get_storage(); |
|
29 | + new Jsonld( $video_storage ); |
|
30 | + |
|
31 | + $sitemap_cache = new Ttl_Cache( 'wl_video_sitemap', 86400 ); |
|
32 | + |
|
33 | + $video_processor = new Video_Processor(); |
|
34 | + // Hook in to save_post to save the videos |
|
35 | + $post_filter = new Post_Filter( $video_processor ); |
|
36 | + $post_filter->init(); |
|
37 | + // Add entry to wordlift admin tabs |
|
38 | + $settings_tab = new Settings_Tab(); |
|
39 | + $settings_tab->init(); |
|
40 | + |
|
41 | + $video_sitemap = new Video_Sitemap( $sitemap_cache ); |
|
42 | + $video_sitemap->init(); |
|
43 | + |
|
44 | + $background_process_data_source = new Videos_Data_Source( '__wl_videoobject_import_state' ); |
|
45 | + $background_process = new Videoobject_Background_Process( $video_processor, $background_process_data_source ); |
|
46 | + |
|
47 | + $rest_controller = new Rest_Controller( $background_process ); |
|
48 | + $rest_controller->register_all_routes(); |
|
49 | + |
|
50 | + $post_edit_screen = new Post_Edit_Screen(); |
|
51 | + $post_edit_screen->init(); |
|
52 | + |
|
53 | + new Import_Videos_Page(); |
|
54 | + |
|
55 | + /** |
|
56 | + * @since 3.32.0 |
|
57 | + * Allow videoobject to capture embed shortcode. |
|
58 | + */ |
|
59 | + $embed_shortcode_capture = new Embed_Shortcode_Capture(); |
|
60 | + $embed_shortcode_capture->init(); |
|
61 | + |
|
62 | + /** |
|
63 | + * @since 3.32.0 |
|
64 | + * Get videos from jw player. |
|
65 | + */ |
|
66 | + $jw_player_capture_videos = new Jw_Player_Capture(); |
|
67 | + $jw_player_capture_videos->init(); |
|
68 | + |
|
69 | + /** |
|
70 | + * Validate API Key for Youtube, Vimeo. |
|
71 | + */ |
|
72 | + new Video_Key_Validation_Service(); |
|
73 | + |
|
74 | + } |
|
75 | + |
|
76 | + public function get_feature_slug() { |
|
77 | + return 'videoobject'; |
|
78 | + } |
|
79 | + |
|
80 | + public function get_feature_default_value() { |
|
81 | + return false; |
|
82 | + } |
|
83 | 83 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct() { |
24 | 24 | // create ajax request to handle youtube and vimeo api key validation. |
25 | - add_action( 'wp_ajax_wl_validate_video_api_key', array( $this, 'validate_video_api_key' ) ); |
|
25 | + add_action('wp_ajax_wl_validate_video_api_key', array($this, 'validate_video_api_key')); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function validate_video_api_key() { |
34 | 34 | // check nonce. |
35 | - check_ajax_referer( 'wl_video_api_nonce' ); |
|
35 | + check_ajax_referer('wl_video_api_nonce'); |
|
36 | 36 | |
37 | 37 | // Check if we have an API key and Type. |
38 | - if ( ! isset( $_POST['api_key'] ) || empty( $_POST['api_key'] ) || ! isset( $_POST['type'] ) ) { |
|
38 | + if ( ! isset($_POST['api_key']) || empty($_POST['api_key']) || ! isset($_POST['type'])) { |
|
39 | 39 | wp_send_json_error( |
40 | 40 | array( |
41 | 41 | 'valid' => false, |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | ); |
44 | 44 | } |
45 | 45 | |
46 | - $api_key = sanitize_text_field( wp_unslash( $_POST['api_key'] ) ); |
|
47 | - $type = sanitize_text_field( wp_unslash( $_POST['type'] ) ); |
|
46 | + $api_key = sanitize_text_field(wp_unslash($_POST['api_key'])); |
|
47 | + $type = sanitize_text_field(wp_unslash($_POST['type'])); |
|
48 | 48 | |
49 | 49 | // Check if we have a valid type. |
50 | - if ( ! in_array( $type, array( 'youtube', 'vimeo' ), true ) ) { |
|
50 | + if ( ! in_array($type, array('youtube', 'vimeo'), true)) { |
|
51 | 51 | wp_send_json_error( |
52 | 52 | array( |
53 | 53 | 'valid' => false, |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | ); |
56 | 56 | } |
57 | 57 | |
58 | - if ( 'youtube' === $type ) { |
|
59 | - $this->validate_youtube_api_key( $api_key ); |
|
58 | + if ('youtube' === $type) { |
|
59 | + $this->validate_youtube_api_key($api_key); |
|
60 | 60 | } else { |
61 | - $this->validate_vimeo_api_key( $api_key ); |
|
61 | + $this->validate_vimeo_api_key($api_key); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return void |
71 | 71 | */ |
72 | - private function validate_youtube_api_key( $api_key ) { |
|
72 | + private function validate_youtube_api_key($api_key) { |
|
73 | 73 | $url = add_query_arg( |
74 | 74 | array( |
75 | 75 | 'part' => 'snippet', |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | 'https://www.googleapis.com/youtube/v3/search' |
81 | 81 | ); |
82 | 82 | |
83 | - $response = wp_remote_get( $url ); |
|
83 | + $response = wp_remote_get($url); |
|
84 | 84 | |
85 | 85 | // Get response code. |
86 | - $response_code = wp_remote_retrieve_response_code( $response ); |
|
86 | + $response_code = wp_remote_retrieve_response_code($response); |
|
87 | 87 | |
88 | - if ( 200 === $response_code ) { |
|
88 | + if (200 === $response_code) { |
|
89 | 89 | wp_send_json_success( |
90 | 90 | array( |
91 | 91 | 'valid' => true, |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return void |
109 | 109 | */ |
110 | - private function validate_vimeo_api_key( $api_key ) { |
|
110 | + private function validate_vimeo_api_key($api_key) { |
|
111 | 111 | $url = add_query_arg( |
112 | 112 | array( |
113 | 113 | 'query' => 'wordlift', |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | $url, |
122 | 122 | array( |
123 | 123 | 'headers' => array( |
124 | - 'Authorization' => 'bearer ' . $api_key, |
|
124 | + 'Authorization' => 'bearer '.$api_key, |
|
125 | 125 | ), |
126 | 126 | ) |
127 | 127 | ); |
128 | 128 | |
129 | 129 | // Get response code. |
130 | - $response_code = wp_remote_retrieve_response_code( $response ); |
|
130 | + $response_code = wp_remote_retrieve_response_code($response); |
|
131 | 131 | |
132 | - if ( 200 === $response_code ) { |
|
132 | + if (200 === $response_code) { |
|
133 | 133 | wp_send_json_success( |
134 | 134 | array( |
135 | 135 | 'valid' => true, |
@@ -20,127 +20,127 @@ |
||
20 | 20 | */ |
21 | 21 | class Video_Key_Validation_Service { |
22 | 22 | |
23 | - public function __construct() { |
|
24 | - // create ajax request to handle youtube and vimeo api key validation. |
|
25 | - add_action( 'wp_ajax_wl_validate_video_api_key', array( $this, 'validate_video_api_key' ) ); |
|
26 | - } |
|
27 | - |
|
28 | - /** |
|
29 | - * Validate video api key. |
|
30 | - * |
|
31 | - * @since 3.40.2 |
|
32 | - */ |
|
33 | - public function validate_video_api_key() { |
|
34 | - // check nonce. |
|
35 | - check_ajax_referer( 'wl_video_api_nonce' ); |
|
36 | - |
|
37 | - // Check if we have an API key and Type. |
|
38 | - if ( ! isset( $_POST['api_key'] ) || empty( $_POST['api_key'] ) || ! isset( $_POST['type'] ) ) { |
|
39 | - wp_send_json_error( |
|
40 | - array( |
|
41 | - 'valid' => false, |
|
42 | - ) |
|
43 | - ); |
|
44 | - } |
|
45 | - |
|
46 | - $api_key = sanitize_text_field( wp_unslash( $_POST['api_key'] ) ); |
|
47 | - $type = sanitize_text_field( wp_unslash( $_POST['type'] ) ); |
|
48 | - |
|
49 | - // Check if we have a valid type. |
|
50 | - if ( ! in_array( $type, array( 'youtube', 'vimeo' ), true ) ) { |
|
51 | - wp_send_json_error( |
|
52 | - array( |
|
53 | - 'valid' => false, |
|
54 | - ) |
|
55 | - ); |
|
56 | - } |
|
57 | - |
|
58 | - if ( 'youtube' === $type ) { |
|
59 | - $this->validate_youtube_api_key( $api_key ); |
|
60 | - } else { |
|
61 | - $this->validate_vimeo_api_key( $api_key ); |
|
62 | - } |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * Validate youtube api key. |
|
67 | - * |
|
68 | - * @param string $api_key Youtube api key. |
|
69 | - * |
|
70 | - * @return void |
|
71 | - */ |
|
72 | - private function validate_youtube_api_key( $api_key ) { |
|
73 | - $url = add_query_arg( |
|
74 | - array( |
|
75 | - 'part' => 'snippet', |
|
76 | - 'q' => 'wordlift', |
|
77 | - 'type' => 'video', |
|
78 | - 'key' => $api_key, |
|
79 | - ), |
|
80 | - 'https://www.googleapis.com/youtube/v3/search' |
|
81 | - ); |
|
82 | - |
|
83 | - $response = wp_remote_get( $url ); |
|
84 | - |
|
85 | - // Get response code. |
|
86 | - $response_code = wp_remote_retrieve_response_code( $response ); |
|
87 | - |
|
88 | - if ( 200 === $response_code ) { |
|
89 | - wp_send_json_success( |
|
90 | - array( |
|
91 | - 'valid' => true, |
|
92 | - ) |
|
93 | - ); |
|
94 | - } else { |
|
95 | - wp_send_json_error( |
|
96 | - array( |
|
97 | - 'valid' => false, |
|
98 | - ) |
|
99 | - ); |
|
100 | - } |
|
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * Validate vimeo api key. |
|
105 | - * |
|
106 | - * @param string $api_key Vimeo api key. |
|
107 | - * |
|
108 | - * @return void |
|
109 | - */ |
|
110 | - private function validate_vimeo_api_key( $api_key ) { |
|
111 | - $url = add_query_arg( |
|
112 | - array( |
|
113 | - 'query' => 'wordlift', |
|
114 | - 'page' => 1, |
|
115 | - 'per_page' => 1, |
|
116 | - ), |
|
117 | - 'https://api.vimeo.com/videos' |
|
118 | - ); |
|
119 | - |
|
120 | - $response = wp_remote_get( |
|
121 | - $url, |
|
122 | - array( |
|
123 | - 'headers' => array( |
|
124 | - 'Authorization' => 'bearer ' . $api_key, |
|
125 | - ), |
|
126 | - ) |
|
127 | - ); |
|
128 | - |
|
129 | - // Get response code. |
|
130 | - $response_code = wp_remote_retrieve_response_code( $response ); |
|
131 | - |
|
132 | - if ( 200 === $response_code ) { |
|
133 | - wp_send_json_success( |
|
134 | - array( |
|
135 | - 'valid' => true, |
|
136 | - ) |
|
137 | - ); |
|
138 | - } else { |
|
139 | - wp_send_json_error( |
|
140 | - array( |
|
141 | - 'valid' => false, |
|
142 | - ) |
|
143 | - ); |
|
144 | - } |
|
145 | - } |
|
23 | + public function __construct() { |
|
24 | + // create ajax request to handle youtube and vimeo api key validation. |
|
25 | + add_action( 'wp_ajax_wl_validate_video_api_key', array( $this, 'validate_video_api_key' ) ); |
|
26 | + } |
|
27 | + |
|
28 | + /** |
|
29 | + * Validate video api key. |
|
30 | + * |
|
31 | + * @since 3.40.2 |
|
32 | + */ |
|
33 | + public function validate_video_api_key() { |
|
34 | + // check nonce. |
|
35 | + check_ajax_referer( 'wl_video_api_nonce' ); |
|
36 | + |
|
37 | + // Check if we have an API key and Type. |
|
38 | + if ( ! isset( $_POST['api_key'] ) || empty( $_POST['api_key'] ) || ! isset( $_POST['type'] ) ) { |
|
39 | + wp_send_json_error( |
|
40 | + array( |
|
41 | + 'valid' => false, |
|
42 | + ) |
|
43 | + ); |
|
44 | + } |
|
45 | + |
|
46 | + $api_key = sanitize_text_field( wp_unslash( $_POST['api_key'] ) ); |
|
47 | + $type = sanitize_text_field( wp_unslash( $_POST['type'] ) ); |
|
48 | + |
|
49 | + // Check if we have a valid type. |
|
50 | + if ( ! in_array( $type, array( 'youtube', 'vimeo' ), true ) ) { |
|
51 | + wp_send_json_error( |
|
52 | + array( |
|
53 | + 'valid' => false, |
|
54 | + ) |
|
55 | + ); |
|
56 | + } |
|
57 | + |
|
58 | + if ( 'youtube' === $type ) { |
|
59 | + $this->validate_youtube_api_key( $api_key ); |
|
60 | + } else { |
|
61 | + $this->validate_vimeo_api_key( $api_key ); |
|
62 | + } |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * Validate youtube api key. |
|
67 | + * |
|
68 | + * @param string $api_key Youtube api key. |
|
69 | + * |
|
70 | + * @return void |
|
71 | + */ |
|
72 | + private function validate_youtube_api_key( $api_key ) { |
|
73 | + $url = add_query_arg( |
|
74 | + array( |
|
75 | + 'part' => 'snippet', |
|
76 | + 'q' => 'wordlift', |
|
77 | + 'type' => 'video', |
|
78 | + 'key' => $api_key, |
|
79 | + ), |
|
80 | + 'https://www.googleapis.com/youtube/v3/search' |
|
81 | + ); |
|
82 | + |
|
83 | + $response = wp_remote_get( $url ); |
|
84 | + |
|
85 | + // Get response code. |
|
86 | + $response_code = wp_remote_retrieve_response_code( $response ); |
|
87 | + |
|
88 | + if ( 200 === $response_code ) { |
|
89 | + wp_send_json_success( |
|
90 | + array( |
|
91 | + 'valid' => true, |
|
92 | + ) |
|
93 | + ); |
|
94 | + } else { |
|
95 | + wp_send_json_error( |
|
96 | + array( |
|
97 | + 'valid' => false, |
|
98 | + ) |
|
99 | + ); |
|
100 | + } |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * Validate vimeo api key. |
|
105 | + * |
|
106 | + * @param string $api_key Vimeo api key. |
|
107 | + * |
|
108 | + * @return void |
|
109 | + */ |
|
110 | + private function validate_vimeo_api_key( $api_key ) { |
|
111 | + $url = add_query_arg( |
|
112 | + array( |
|
113 | + 'query' => 'wordlift', |
|
114 | + 'page' => 1, |
|
115 | + 'per_page' => 1, |
|
116 | + ), |
|
117 | + 'https://api.vimeo.com/videos' |
|
118 | + ); |
|
119 | + |
|
120 | + $response = wp_remote_get( |
|
121 | + $url, |
|
122 | + array( |
|
123 | + 'headers' => array( |
|
124 | + 'Authorization' => 'bearer ' . $api_key, |
|
125 | + ), |
|
126 | + ) |
|
127 | + ); |
|
128 | + |
|
129 | + // Get response code. |
|
130 | + $response_code = wp_remote_retrieve_response_code( $response ); |
|
131 | + |
|
132 | + if ( 200 === $response_code ) { |
|
133 | + wp_send_json_success( |
|
134 | + array( |
|
135 | + 'valid' => true, |
|
136 | + ) |
|
137 | + ); |
|
138 | + } else { |
|
139 | + wp_send_json_error( |
|
140 | + array( |
|
141 | + 'valid' => false, |
|
142 | + ) |
|
143 | + ); |
|
144 | + } |
|
145 | + } |
|
146 | 146 | } |
@@ -18,80 +18,80 @@ |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Admin_Input_Element implements Wordlift_Admin_Element { |
20 | 20 | |
21 | - /** |
|
22 | - * Output the HTML for an input box type settings_page |
|
23 | - * |
|
24 | - * @param array $args An array with the following keys: |
|
25 | - * Parameters controlling the result. |
|
26 | - * |
|
27 | - * @type string name The name attribute of the input element. Mandatory. |
|
28 | - * |
|
29 | - * @type string id The id attribute of the input element. Optional. |
|
30 | - * @type string id The id attribute of the input element. |
|
31 | - * Optional, randomly generated one is used if not supplied. |
|
32 | - * @type string value The value of the input element. |
|
33 | - * Optional, defaults to empty string. |
|
34 | - * @type bool readonly Indicates whether the input is read only. |
|
35 | - * Optional, defaults to read-write |
|
36 | - * @type string css_class The class attribute for the input element. |
|
37 | - * If empty string no class attribute will be added. |
|
38 | - * Optional, defaults to empty string. |
|
39 | - * @type string description The descriptio text to be displayed below the element. |
|
40 | - * Can include some HTML element. |
|
41 | - * If empty string no description will be displayed. |
|
42 | - * Optional, defaults to empty string. |
|
43 | - * @since 3.21.0 added the ability to use a $type arg. |
|
44 | - * |
|
45 | - * @return $this|Wordlift_Admin_Element |
|
46 | - */ |
|
47 | - public function render( $args ) { |
|
21 | + /** |
|
22 | + * Output the HTML for an input box type settings_page |
|
23 | + * |
|
24 | + * @param array $args An array with the following keys: |
|
25 | + * Parameters controlling the result. |
|
26 | + * |
|
27 | + * @type string name The name attribute of the input element. Mandatory. |
|
28 | + * |
|
29 | + * @type string id The id attribute of the input element. Optional. |
|
30 | + * @type string id The id attribute of the input element. |
|
31 | + * Optional, randomly generated one is used if not supplied. |
|
32 | + * @type string value The value of the input element. |
|
33 | + * Optional, defaults to empty string. |
|
34 | + * @type bool readonly Indicates whether the input is read only. |
|
35 | + * Optional, defaults to read-write |
|
36 | + * @type string css_class The class attribute for the input element. |
|
37 | + * If empty string no class attribute will be added. |
|
38 | + * Optional, defaults to empty string. |
|
39 | + * @type string description The descriptio text to be displayed below the element. |
|
40 | + * Can include some HTML element. |
|
41 | + * If empty string no description will be displayed. |
|
42 | + * Optional, defaults to empty string. |
|
43 | + * @since 3.21.0 added the ability to use a $type arg. |
|
44 | + * |
|
45 | + * @return $this|Wordlift_Admin_Element |
|
46 | + */ |
|
47 | + public function render( $args ) { |
|
48 | 48 | |
49 | - /* |
|
49 | + /* |
|
50 | 50 | * Parse the arguments and merge with default values. |
51 | 51 | * Name intentionally do not have a default as it has to be in SyncEvent |
52 | 52 | * with form handling code |
53 | 53 | */ |
54 | - $pre_params = wp_parse_args( |
|
55 | - $args, |
|
56 | - array( |
|
57 | - 'id' => uniqid( 'wl-input-' ), |
|
58 | - 'value' => '', |
|
59 | - 'readonly' => false, |
|
60 | - 'css_class' => '', |
|
61 | - 'description' => '', |
|
62 | - ) |
|
63 | - ); |
|
64 | - $params = apply_filters( 'wl_admin_input_element_params', $pre_params ); |
|
65 | - // allow different types of input - default to 'text'. |
|
66 | - $input_type = ! empty( $params['type'] ) ? $params['type'] : 'text'; |
|
67 | - ?> |
|
54 | + $pre_params = wp_parse_args( |
|
55 | + $args, |
|
56 | + array( |
|
57 | + 'id' => uniqid( 'wl-input-' ), |
|
58 | + 'value' => '', |
|
59 | + 'readonly' => false, |
|
60 | + 'css_class' => '', |
|
61 | + 'description' => '', |
|
62 | + ) |
|
63 | + ); |
|
64 | + $params = apply_filters( 'wl_admin_input_element_params', $pre_params ); |
|
65 | + // allow different types of input - default to 'text'. |
|
66 | + $input_type = ! empty( $params['type'] ) ? $params['type'] : 'text'; |
|
67 | + ?> |
|
68 | 68 | |
69 | 69 | <input type="<?php echo esc_attr( $input_type ); ?>" |
70 | 70 | id="<?php echo esc_attr( $params['id'] ); ?>" |
71 | 71 | name="<?php echo esc_attr( $params['name'] ); ?>" |
72 | 72 | value="<?php echo esc_attr( $params['value'] ); ?>" |
73 | 73 | <?php |
74 | - if ( ! empty( $params['data'] ) && is_array( $params['data'] ) ) { |
|
75 | - foreach ( $params['data'] as $key => $value ) { |
|
76 | - echo 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" '; |
|
77 | - } |
|
78 | - } |
|
79 | - if ( ! empty( $params['readonly'] ) ) { |
|
80 | - ?> |
|
74 | + if ( ! empty( $params['data'] ) && is_array( $params['data'] ) ) { |
|
75 | + foreach ( $params['data'] as $key => $value ) { |
|
76 | + echo 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" '; |
|
77 | + } |
|
78 | + } |
|
79 | + if ( ! empty( $params['readonly'] ) ) { |
|
80 | + ?> |
|
81 | 81 | readonly="readonly" <?php } ?> |
82 | 82 | <?php |
83 | - if ( ! empty( $params['css_class'] ) ) { |
|
84 | - ?> |
|
83 | + if ( ! empty( $params['css_class'] ) ) { |
|
84 | + ?> |
|
85 | 85 | class="<?php echo esc_attr( $params['css_class'] ); ?>" <?php } ?> |
86 | 86 | /> |
87 | 87 | <?php |
88 | - if ( ! empty( $params['description'] ) ) { |
|
89 | - ?> |
|
88 | + if ( ! empty( $params['description'] ) ) { |
|
89 | + ?> |
|
90 | 90 | <p><?php echo wp_kses( $params['description'], array( 'a' => array( 'href' => array() ) ) ); ?></p><?php } ?> |
91 | 91 | |
92 | 92 | <?php |
93 | 93 | |
94 | - return $this; |
|
95 | - } |
|
94 | + return $this; |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return $this|Wordlift_Admin_Element |
46 | 46 | */ |
47 | - public function render( $args ) { |
|
47 | + public function render($args) { |
|
48 | 48 | |
49 | 49 | /* |
50 | 50 | * Parse the arguments and merge with default values. |
@@ -54,40 +54,40 @@ discard block |
||
54 | 54 | $pre_params = wp_parse_args( |
55 | 55 | $args, |
56 | 56 | array( |
57 | - 'id' => uniqid( 'wl-input-' ), |
|
57 | + 'id' => uniqid('wl-input-'), |
|
58 | 58 | 'value' => '', |
59 | 59 | 'readonly' => false, |
60 | 60 | 'css_class' => '', |
61 | 61 | 'description' => '', |
62 | 62 | ) |
63 | 63 | ); |
64 | - $params = apply_filters( 'wl_admin_input_element_params', $pre_params ); |
|
64 | + $params = apply_filters('wl_admin_input_element_params', $pre_params); |
|
65 | 65 | // allow different types of input - default to 'text'. |
66 | - $input_type = ! empty( $params['type'] ) ? $params['type'] : 'text'; |
|
66 | + $input_type = ! empty($params['type']) ? $params['type'] : 'text'; |
|
67 | 67 | ?> |
68 | 68 | |
69 | - <input type="<?php echo esc_attr( $input_type ); ?>" |
|
70 | - id="<?php echo esc_attr( $params['id'] ); ?>" |
|
71 | - name="<?php echo esc_attr( $params['name'] ); ?>" |
|
72 | - value="<?php echo esc_attr( $params['value'] ); ?>" |
|
69 | + <input type="<?php echo esc_attr($input_type); ?>" |
|
70 | + id="<?php echo esc_attr($params['id']); ?>" |
|
71 | + name="<?php echo esc_attr($params['name']); ?>" |
|
72 | + value="<?php echo esc_attr($params['value']); ?>" |
|
73 | 73 | <?php |
74 | - if ( ! empty( $params['data'] ) && is_array( $params['data'] ) ) { |
|
75 | - foreach ( $params['data'] as $key => $value ) { |
|
76 | - echo 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" '; |
|
74 | + if ( ! empty($params['data']) && is_array($params['data'])) { |
|
75 | + foreach ($params['data'] as $key => $value) { |
|
76 | + echo 'data-'.esc_attr($key).'="'.esc_attr($value).'" '; |
|
77 | 77 | } |
78 | 78 | } |
79 | - if ( ! empty( $params['readonly'] ) ) { |
|
79 | + if ( ! empty($params['readonly'])) { |
|
80 | 80 | ?> |
81 | 81 | readonly="readonly" <?php } ?> |
82 | 82 | <?php |
83 | - if ( ! empty( $params['css_class'] ) ) { |
|
83 | + if ( ! empty($params['css_class'])) { |
|
84 | 84 | ?> |
85 | - class="<?php echo esc_attr( $params['css_class'] ); ?>" <?php } ?> |
|
85 | + class="<?php echo esc_attr($params['css_class']); ?>" <?php } ?> |
|
86 | 86 | /> |
87 | 87 | <?php |
88 | - if ( ! empty( $params['description'] ) ) { |
|
88 | + if ( ! empty($params['description'])) { |
|
89 | 89 | ?> |
90 | - <p><?php echo wp_kses( $params['description'], array( 'a' => array( 'href' => array() ) ) ); ?></p><?php } ?> |
|
90 | + <p><?php echo wp_kses($params['description'], array('a' => array('href' => array()))); ?></p><?php } ?> |
|
91 | 91 | |
92 | 92 | <?php |
93 | 93 |
@@ -5,32 +5,32 @@ discard block |
||
5 | 5 | |
6 | 6 | if ( isset( $_POST['wordlift_videoobject_settings_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wordlift_videoobject_settings_nonce'] ) ), 'wordlift_videoobject_settings' ) ) { |
7 | 7 | |
8 | - if ( isset( $_POST['wordlift_videoobject_youtube_api_key'] ) || isset( $_POST['wordlift_videoobject_vimeo_api_key'] ) ) { |
|
8 | + if ( isset( $_POST['wordlift_videoobject_youtube_api_key'] ) || isset( $_POST['wordlift_videoobject_vimeo_api_key'] ) ) { |
|
9 | 9 | |
10 | - /** |
|
11 | - * @todo: does this fields need to be encrypted before saving ? |
|
12 | - */ |
|
13 | - $youtube_api_key = sanitize_text_field( wp_unslash( (string) $_POST['wordlift_videoobject_youtube_api_key'] ) ); |
|
14 | - $vimeo_api_key = sanitize_text_field( wp_unslash( (string) $_POST['wordlift_videoobject_vimeo_api_key'] ) ); |
|
10 | + /** |
|
11 | + * @todo: does this fields need to be encrypted before saving ? |
|
12 | + */ |
|
13 | + $youtube_api_key = sanitize_text_field( wp_unslash( (string) $_POST['wordlift_videoobject_youtube_api_key'] ) ); |
|
14 | + $vimeo_api_key = sanitize_text_field( wp_unslash( (string) $_POST['wordlift_videoobject_vimeo_api_key'] ) ); |
|
15 | 15 | |
16 | - if ( $youtube_api_key ) { |
|
17 | - update_option( Youtube_Client::get_api_key_option_name(), $youtube_api_key ); |
|
18 | - } |
|
16 | + if ( $youtube_api_key ) { |
|
17 | + update_option( Youtube_Client::get_api_key_option_name(), $youtube_api_key ); |
|
18 | + } |
|
19 | 19 | |
20 | - if ( $vimeo_api_key ) { |
|
21 | - update_option( Vimeo_Client::get_api_key_option_name(), $vimeo_api_key ); |
|
22 | - } |
|
23 | - } |
|
20 | + if ( $vimeo_api_key ) { |
|
21 | + update_option( Vimeo_Client::get_api_key_option_name(), $vimeo_api_key ); |
|
22 | + } |
|
23 | + } |
|
24 | 24 | |
25 | - if ( isset( $_POST['wl_enable_video_sitemap'] ) ) { |
|
26 | - update_option( '_wl_video_sitemap_generation', 1 ); |
|
27 | - // flush the rewrite rules. |
|
28 | - flush_rewrite_rules(); |
|
29 | - } else { |
|
30 | - update_option( '_wl_video_sitemap_generation', 0 ); |
|
31 | - // flush the rewrite rules. |
|
32 | - flush_rewrite_rules(); |
|
33 | - } |
|
25 | + if ( isset( $_POST['wl_enable_video_sitemap'] ) ) { |
|
26 | + update_option( '_wl_video_sitemap_generation', 1 ); |
|
27 | + // flush the rewrite rules. |
|
28 | + flush_rewrite_rules(); |
|
29 | + } else { |
|
30 | + update_option( '_wl_video_sitemap_generation', 0 ); |
|
31 | + // flush the rewrite rules. |
|
32 | + flush_rewrite_rules(); |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | ?> |
36 | 36 | <h1><?php esc_html_e( 'API Settings', 'wordlift' ); ?></h1> |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | </td> |
44 | 44 | <td> |
45 | 45 | <?php |
46 | - $element = new Wordlift_Admin_Input_Element(); |
|
47 | - $element->render( |
|
48 | - array( |
|
49 | - 'id' => 'wordlift_videoobject_youtube_api_key', |
|
50 | - 'name' => 'wordlift_videoobject_youtube_api_key', |
|
51 | - 'value' => Youtube_Client::get_api_key(), |
|
52 | - 'data' => array( 'type' => 'youtube' ), |
|
53 | - ) |
|
54 | - ); |
|
55 | - ?> |
|
46 | + $element = new Wordlift_Admin_Input_Element(); |
|
47 | + $element->render( |
|
48 | + array( |
|
49 | + 'id' => 'wordlift_videoobject_youtube_api_key', |
|
50 | + 'name' => 'wordlift_videoobject_youtube_api_key', |
|
51 | + 'value' => Youtube_Client::get_api_key(), |
|
52 | + 'data' => array( 'type' => 'youtube' ), |
|
53 | + ) |
|
54 | + ); |
|
55 | + ?> |
|
56 | 56 | </td> |
57 | 57 | <td> |
58 | 58 | <a href="https://developers.google.com/youtube/registering_an_application"><?php esc_html_e( 'Click here', 'wordlift' ); ?></a> |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | </td> |
67 | 67 | <td> |
68 | 68 | <?php |
69 | - $element = new Wordlift_Admin_Input_Element(); |
|
70 | - $element->render( |
|
71 | - array( |
|
72 | - 'id' => 'wordlift_videoobject_vimeo_api_key', |
|
73 | - 'name' => 'wordlift_videoobject_vimeo_api_key', |
|
74 | - 'value' => Vimeo_Client::get_api_key(), |
|
75 | - 'data' => array( 'type' => 'vimeo' ), |
|
76 | - ) |
|
77 | - ); |
|
78 | - ?> |
|
69 | + $element = new Wordlift_Admin_Input_Element(); |
|
70 | + $element->render( |
|
71 | + array( |
|
72 | + 'id' => 'wordlift_videoobject_vimeo_api_key', |
|
73 | + 'name' => 'wordlift_videoobject_vimeo_api_key', |
|
74 | + 'value' => Vimeo_Client::get_api_key(), |
|
75 | + 'data' => array( 'type' => 'vimeo' ), |
|
76 | + ) |
|
77 | + ); |
|
78 | + ?> |
|
79 | 79 | </td> |
80 | 80 | <td> |
81 | 81 | <a href="https://developer.vimeo.com/api/guides/start"><?php esc_html_e( 'Click here', 'wordlift' ); ?></a> |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | value="1" <?php echo esc_html( $wl_is_sitemap_enabled ); ?> ></p> |
95 | 95 | <p> |
96 | 96 | <?php |
97 | - if ( $wl_is_sitemap_enabled ) { |
|
98 | - $wl_sitemap_link = esc_attr( get_home_url( null, 'wl-video-sitemap.xml' ) ); |
|
99 | - /* translators: %s: The link to the Video Sitemap. */ |
|
100 | - echo wp_kses( sprintf( __( 'Here is <a href="%s">link</a> to your Video Sitemap. Add it now, to Google Search Console.', 'wordlift' ), $wl_sitemap_link ), array( 'a' => array( 'href' => array() ) ) ); |
|
101 | - } |
|
102 | - ?> |
|
97 | + if ( $wl_is_sitemap_enabled ) { |
|
98 | + $wl_sitemap_link = esc_attr( get_home_url( null, 'wl-video-sitemap.xml' ) ); |
|
99 | + /* translators: %s: The link to the Video Sitemap. */ |
|
100 | + echo wp_kses( sprintf( __( 'Here is <a href="%s">link</a> to your Video Sitemap. Add it now, to Google Search Console.', 'wordlift' ), $wl_sitemap_link ), array( 'a' => array( 'href' => array() ) ) ); |
|
101 | + } |
|
102 | + ?> |
|
103 | 103 | </p> |
104 | 104 | <?php wp_nonce_field( 'wordlift_videoobject_settings', 'wordlift_videoobject_settings_nonce', false ); ?> |
105 | 105 | <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" |
@@ -3,43 +3,43 @@ discard block |
||
3 | 3 | use Wordlift\Videoobject\Provider\Client\Vimeo_Client; |
4 | 4 | use Wordlift\Videoobject\Provider\Client\Youtube_Client; |
5 | 5 | |
6 | -if ( isset( $_POST['wordlift_videoobject_settings_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wordlift_videoobject_settings_nonce'] ) ), 'wordlift_videoobject_settings' ) ) { |
|
6 | +if (isset($_POST['wordlift_videoobject_settings_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['wordlift_videoobject_settings_nonce'])), 'wordlift_videoobject_settings')) { |
|
7 | 7 | |
8 | - if ( isset( $_POST['wordlift_videoobject_youtube_api_key'] ) || isset( $_POST['wordlift_videoobject_vimeo_api_key'] ) ) { |
|
8 | + if (isset($_POST['wordlift_videoobject_youtube_api_key']) || isset($_POST['wordlift_videoobject_vimeo_api_key'])) { |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * @todo: does this fields need to be encrypted before saving ? |
12 | 12 | */ |
13 | - $youtube_api_key = sanitize_text_field( wp_unslash( (string) $_POST['wordlift_videoobject_youtube_api_key'] ) ); |
|
14 | - $vimeo_api_key = sanitize_text_field( wp_unslash( (string) $_POST['wordlift_videoobject_vimeo_api_key'] ) ); |
|
13 | + $youtube_api_key = sanitize_text_field(wp_unslash((string) $_POST['wordlift_videoobject_youtube_api_key'])); |
|
14 | + $vimeo_api_key = sanitize_text_field(wp_unslash((string) $_POST['wordlift_videoobject_vimeo_api_key'])); |
|
15 | 15 | |
16 | - if ( $youtube_api_key ) { |
|
17 | - update_option( Youtube_Client::get_api_key_option_name(), $youtube_api_key ); |
|
16 | + if ($youtube_api_key) { |
|
17 | + update_option(Youtube_Client::get_api_key_option_name(), $youtube_api_key); |
|
18 | 18 | } |
19 | 19 | |
20 | - if ( $vimeo_api_key ) { |
|
21 | - update_option( Vimeo_Client::get_api_key_option_name(), $vimeo_api_key ); |
|
20 | + if ($vimeo_api_key) { |
|
21 | + update_option(Vimeo_Client::get_api_key_option_name(), $vimeo_api_key); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
25 | - if ( isset( $_POST['wl_enable_video_sitemap'] ) ) { |
|
26 | - update_option( '_wl_video_sitemap_generation', 1 ); |
|
25 | + if (isset($_POST['wl_enable_video_sitemap'])) { |
|
26 | + update_option('_wl_video_sitemap_generation', 1); |
|
27 | 27 | // flush the rewrite rules. |
28 | 28 | flush_rewrite_rules(); |
29 | 29 | } else { |
30 | - update_option( '_wl_video_sitemap_generation', 0 ); |
|
30 | + update_option('_wl_video_sitemap_generation', 0); |
|
31 | 31 | // flush the rewrite rules. |
32 | 32 | flush_rewrite_rules(); |
33 | 33 | } |
34 | 34 | } |
35 | 35 | ?> |
36 | -<h1><?php esc_html_e( 'API Settings', 'wordlift' ); ?></h1> |
|
37 | -<p><?php esc_html_e( 'To let WordLift access metadata from YouTube or Vimeo you will need to add here your API Key.', 'wordlift' ); ?></p> |
|
36 | +<h1><?php esc_html_e('API Settings', 'wordlift'); ?></h1> |
|
37 | +<p><?php esc_html_e('To let WordLift access metadata from YouTube or Vimeo you will need to add here your API Key.', 'wordlift'); ?></p> |
|
38 | 38 | <form method="post"> |
39 | 39 | <table id="wl-settings-page__video-api"> |
40 | 40 | <tr> |
41 | 41 | <td> |
42 | - <?php esc_html_e( 'YouTube API Key', 'wordlift' ); ?> |
|
42 | + <?php esc_html_e('YouTube API Key', 'wordlift'); ?> |
|
43 | 43 | </td> |
44 | 44 | <td> |
45 | 45 | <?php |
@@ -49,20 +49,20 @@ discard block |
||
49 | 49 | 'id' => 'wordlift_videoobject_youtube_api_key', |
50 | 50 | 'name' => 'wordlift_videoobject_youtube_api_key', |
51 | 51 | 'value' => Youtube_Client::get_api_key(), |
52 | - 'data' => array( 'type' => 'youtube' ), |
|
52 | + 'data' => array('type' => 'youtube'), |
|
53 | 53 | ) |
54 | 54 | ); |
55 | 55 | ?> |
56 | 56 | </td> |
57 | 57 | <td> |
58 | - <a href="https://developers.google.com/youtube/registering_an_application"><?php esc_html_e( 'Click here', 'wordlift' ); ?></a> |
|
59 | - <?php esc_html_e( ' for instructions on getting your YouTube API Key', 'wordlift' ); ?> |
|
58 | + <a href="https://developers.google.com/youtube/registering_an_application"><?php esc_html_e('Click here', 'wordlift'); ?></a> |
|
59 | + <?php esc_html_e(' for instructions on getting your YouTube API Key', 'wordlift'); ?> |
|
60 | 60 | </td> |
61 | 61 | </tr> |
62 | 62 | |
63 | 63 | <tr> |
64 | 64 | <td> |
65 | - <?php esc_html_e( 'Vimeo API Key', 'wordlift' ); ?> |
|
65 | + <?php esc_html_e('Vimeo API Key', 'wordlift'); ?> |
|
66 | 66 | </td> |
67 | 67 | <td> |
68 | 68 | <?php |
@@ -72,36 +72,36 @@ discard block |
||
72 | 72 | 'id' => 'wordlift_videoobject_vimeo_api_key', |
73 | 73 | 'name' => 'wordlift_videoobject_vimeo_api_key', |
74 | 74 | 'value' => Vimeo_Client::get_api_key(), |
75 | - 'data' => array( 'type' => 'vimeo' ), |
|
75 | + 'data' => array('type' => 'vimeo'), |
|
76 | 76 | ) |
77 | 77 | ); |
78 | 78 | ?> |
79 | 79 | </td> |
80 | 80 | <td> |
81 | - <a href="https://developer.vimeo.com/api/guides/start"><?php esc_html_e( 'Click here', 'wordlift' ); ?></a> |
|
82 | - <?php esc_html_e( ' for instructions on getting your Vimeo API Key', 'wordlift' ); ?> |
|
81 | + <a href="https://developer.vimeo.com/api/guides/start"><?php esc_html_e('Click here', 'wordlift'); ?></a> |
|
82 | + <?php esc_html_e(' for instructions on getting your Vimeo API Key', 'wordlift'); ?> |
|
83 | 83 | </td> |
84 | 84 | </tr> |
85 | 85 | |
86 | 86 | </table> |
87 | - <h1><?php esc_html_e( 'Video Sitemap', 'wordlift' ); ?></h1> |
|
87 | + <h1><?php esc_html_e('Video Sitemap', 'wordlift'); ?></h1> |
|
88 | 88 | <p> |
89 | - <?php esc_html_e( 'The Video Sitemap works like any other XML Sitemap. Search engines will use it to display rich snippets in result pages.', 'wordlift' ); ?> |
|
89 | + <?php esc_html_e('The Video Sitemap works like any other XML Sitemap. Search engines will use it to display rich snippets in result pages.', 'wordlift'); ?> |
|
90 | 90 | </p> |
91 | - <?php $wl_is_sitemap_enabled = esc_attr( get_option( '_wl_video_sitemap_generation', false ) ? 'checked' : '' ); ?> |
|
92 | - <p> <?php esc_html_e( 'Enable Video Sitemap', 'wordlift' ); ?> |
|
91 | + <?php $wl_is_sitemap_enabled = esc_attr(get_option('_wl_video_sitemap_generation', false) ? 'checked' : ''); ?> |
|
92 | + <p> <?php esc_html_e('Enable Video Sitemap', 'wordlift'); ?> |
|
93 | 93 | <input type="checkbox" name="wl_enable_video_sitemap" |
94 | - value="1" <?php echo esc_html( $wl_is_sitemap_enabled ); ?> ></p> |
|
94 | + value="1" <?php echo esc_html($wl_is_sitemap_enabled); ?> ></p> |
|
95 | 95 | <p> |
96 | 96 | <?php |
97 | - if ( $wl_is_sitemap_enabled ) { |
|
98 | - $wl_sitemap_link = esc_attr( get_home_url( null, 'wl-video-sitemap.xml' ) ); |
|
97 | + if ($wl_is_sitemap_enabled) { |
|
98 | + $wl_sitemap_link = esc_attr(get_home_url(null, 'wl-video-sitemap.xml')); |
|
99 | 99 | /* translators: %s: The link to the Video Sitemap. */ |
100 | - echo wp_kses( sprintf( __( 'Here is <a href="%s">link</a> to your Video Sitemap. Add it now, to Google Search Console.', 'wordlift' ), $wl_sitemap_link ), array( 'a' => array( 'href' => array() ) ) ); |
|
100 | + echo wp_kses(sprintf(__('Here is <a href="%s">link</a> to your Video Sitemap. Add it now, to Google Search Console.', 'wordlift'), $wl_sitemap_link), array('a' => array('href' => array()))); |
|
101 | 101 | } |
102 | 102 | ?> |
103 | 103 | </p> |
104 | - <?php wp_nonce_field( 'wordlift_videoobject_settings', 'wordlift_videoobject_settings_nonce', false ); ?> |
|
104 | + <?php wp_nonce_field('wordlift_videoobject_settings', 'wordlift_videoobject_settings_nonce', false); ?> |
|
105 | 105 | <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" |
106 | 106 | value="Save Changes"> |
107 | 107 | </p> |