@@ -33,26 +33,26 @@ discard block |
||
33 | 33 | use Wordlift\Features\Features_Registry; |
34 | 34 | use Wordlift\Post\Post_Adapter; |
35 | 35 | |
36 | -define( 'WORDLIFT_PLUGIN_FILE', __FILE__ ); |
|
37 | -define( 'WORDLIFT_VERSION', '3.55.0-0' ); |
|
36 | +define('WORDLIFT_PLUGIN_FILE', __FILE__); |
|
37 | +define('WORDLIFT_VERSION', '3.55.0-0'); |
|
38 | 38 | |
39 | 39 | // ## DO NOT REMOVE THIS LINE: WHITELABEL PLACEHOLDER ## |
40 | 40 | |
41 | -require_once plugin_dir_path( __FILE__ ) . '/libraries/action-scheduler/action-scheduler.php'; |
|
42 | -require_once __DIR__ . '/modules/common/load.php'; |
|
43 | -require_once __DIR__ . '/modules/app/load.php'; |
|
44 | -require_once __DIR__ . '/modules/include-exclude/load.php'; |
|
41 | +require_once plugin_dir_path(__FILE__).'/libraries/action-scheduler/action-scheduler.php'; |
|
42 | +require_once __DIR__.'/modules/common/load.php'; |
|
43 | +require_once __DIR__.'/modules/app/load.php'; |
|
44 | +require_once __DIR__.'/modules/include-exclude/load.php'; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Filter to disable WLP on any request, defaults to true. |
48 | 48 | * |
49 | 49 | * @since 3.33.6 |
50 | 50 | */ |
51 | -if ( ! apply_filters( 'wl_is_enabled', true ) ) { |
|
51 | +if ( ! apply_filters('wl_is_enabled', true)) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | -require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
|
55 | +require_once plugin_dir_path(__FILE__).'vendor/autoload.php'; |
|
56 | 56 | |
57 | 57 | /* |
58 | 58 | * We introduce the WordLift autoloader, since we start using classes in namespaces, i.e. Wordlift\Http. |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | wordlift_plugin_autoload_register(); |
63 | 63 | |
64 | 64 | // Include WordLift constants. |
65 | -require_once plugin_dir_path( __FILE__ ) . 'wordlift-constants.php'; |
|
65 | +require_once plugin_dir_path(__FILE__).'wordlift-constants.php'; |
|
66 | 66 | |
67 | 67 | // Load modules. |
68 | -require_once plugin_dir_path( __FILE__ ) . 'modules/core/wordlift-core.php'; |
|
68 | +require_once plugin_dir_path(__FILE__).'modules/core/wordlift-core.php'; |
|
69 | 69 | |
70 | -require_once plugin_dir_path( __FILE__ ) . 'deprecations.php'; |
|
70 | +require_once plugin_dir_path(__FILE__).'deprecations.php'; |
|
71 | 71 | |
72 | 72 | // Load early to enable/disable features. |
73 | -require_once plugin_dir_path( __FILE__ ) . 'classes/features/index.php'; |
|
73 | +require_once plugin_dir_path(__FILE__).'classes/features/index.php'; |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * The code that runs during plugin activation. |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | */ |
79 | 79 | function activate_wordlift() { |
80 | 80 | |
81 | - $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
81 | + $log = Wordlift_Log_Service::get_logger('activate_wordlift'); |
|
82 | 82 | |
83 | - $log->info( 'Activating WordLift...' ); |
|
83 | + $log->info('Activating WordLift...'); |
|
84 | 84 | |
85 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
85 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php'; |
|
86 | 86 | Wordlift_Activator::activate(); |
87 | 87 | |
88 | 88 | /** |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | */ |
103 | 103 | Top_Entities::activate(); |
104 | 104 | |
105 | - if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
106 | - wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
105 | + if ( ! wp_next_scheduled('wl_daily_cron')) { |
|
106 | + wp_schedule_event(time(), 'daily', 'wl_daily_cron'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | function deactivate_wordlift() { |
116 | 116 | |
117 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
117 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php'; |
|
118 | 118 | Wordlift_Deactivator::deactivate(); |
119 | 119 | Wordlift_Http_Api::deactivate(); |
120 | 120 | Ttl_Cache_Cleaner::deactivate(); |
@@ -130,18 +130,18 @@ discard block |
||
130 | 130 | Key_Validation_Notice::remove_notification_flag(); |
131 | 131 | flush_rewrite_rules(); |
132 | 132 | |
133 | - wp_clear_scheduled_hook( 'wl_daily_cron' ); |
|
133 | + wp_clear_scheduled_hook('wl_daily_cron'); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -register_activation_hook( __FILE__, 'activate_wordlift' ); |
|
138 | -register_deactivation_hook( __FILE__, 'deactivate_wordlift' ); |
|
137 | +register_activation_hook(__FILE__, 'activate_wordlift'); |
|
138 | +register_deactivation_hook(__FILE__, 'deactivate_wordlift'); |
|
139 | 139 | |
140 | 140 | /** |
141 | 141 | * The core plugin class that is used to define internationalization, |
142 | 142 | * admin-specific hooks, and public-facing site hooks. |
143 | 143 | */ |
144 | -require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php'; |
|
144 | +require plugin_dir_path(__FILE__).'includes/class-wordlift.php'; |
|
145 | 145 | |
146 | 146 | /** |
147 | 147 | * Begins execution of the plugin. |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | * @return bool |
162 | 162 | * @since 3.27.6 |
163 | 163 | */ |
164 | - if ( apply_filters( 'wl_feature__enable__widgets', true ) ) { |
|
165 | - add_action( 'widgets_init', 'wl_register_chord_widget' ); |
|
166 | - add_action( 'widgets_init', 'wl_register_geo_widget' ); |
|
167 | - add_action( 'widgets_init', 'wl_register_timeline_widget' ); |
|
164 | + if (apply_filters('wl_feature__enable__widgets', true)) { |
|
165 | + add_action('widgets_init', 'wl_register_chord_widget'); |
|
166 | + add_action('widgets_init', 'wl_register_geo_widget'); |
|
167 | + add_action('widgets_init', 'wl_register_timeline_widget'); |
|
168 | 168 | } |
169 | - add_filter( 'widget_text', 'do_shortcode' ); |
|
169 | + add_filter('widget_text', 'do_shortcode'); |
|
170 | 170 | |
171 | 171 | /** |
172 | 172 | * Filter: wl_feature__enable__analysis |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | * @return bool |
177 | 177 | * @since 3.27.6 |
178 | 178 | */ |
179 | - if ( apply_filters( 'wl_feature__enable__analysis', true ) ) { |
|
180 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' ); |
|
179 | + if (apply_filters('wl_feature__enable__analysis', true)) { |
|
180 | + add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_action'); |
|
181 | 181 | } else { |
182 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' ); |
|
182 | + add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action'); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $plugin = new Wordlift(); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | add_action( |
198 | 198 | 'plugins_loaded', |
199 | - function () { |
|
199 | + function() { |
|
200 | 200 | // All features from registry should be initialized here. |
201 | 201 | $features_registry = Features_Registry::get_instance(); |
202 | 202 | $features_registry->initialize_all_features(); |
@@ -207,27 +207,27 @@ discard block |
||
207 | 207 | add_action( |
208 | 208 | 'plugins_loaded', |
209 | 209 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
210 | - function () use ( $plugin ) { |
|
210 | + function() use ($plugin) { |
|
211 | 211 | |
212 | 212 | new Wordlift_Products_Navigator_Shortcode_REST(); |
213 | 213 | |
214 | 214 | // Register the Dataset module, requires `$api_service`. |
215 | - require_once plugin_dir_path( __FILE__ ) . 'classes/dataset/index.php'; |
|
216 | - require_once plugin_dir_path( __FILE__ ) . 'classes/shipping-data/index.php'; |
|
215 | + require_once plugin_dir_path(__FILE__).'classes/dataset/index.php'; |
|
216 | + require_once plugin_dir_path(__FILE__).'classes/shipping-data/index.php'; |
|
217 | 217 | |
218 | 218 | /* |
219 | 219 | * Require the Entity annotation cleanup module. |
220 | 220 | * |
221 | 221 | * @since 3.34.6 |
222 | 222 | */ |
223 | - require_once plugin_dir_path( __FILE__ ) . 'classes/cleanup/index.php'; |
|
223 | + require_once plugin_dir_path(__FILE__).'classes/cleanup/index.php'; |
|
224 | 224 | |
225 | 225 | /* |
226 | 226 | * Import LOD entities. |
227 | 227 | * |
228 | 228 | * @since 3.35.0 |
229 | 229 | */ |
230 | - require_once plugin_dir_path( __FILE__ ) . 'classes/lod-import/index.php'; |
|
230 | + require_once plugin_dir_path(__FILE__).'classes/lod-import/index.php'; |
|
231 | 231 | |
232 | 232 | } |
233 | 233 | ); |
@@ -245,31 +245,31 @@ discard block |
||
245 | 245 | function wordlift_plugin_autoload_register() { |
246 | 246 | |
247 | 247 | spl_autoload_register( |
248 | - function ( $class_name ) { |
|
248 | + function($class_name) { |
|
249 | 249 | |
250 | 250 | // Bail out if these are not our classes. |
251 | - if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) { |
|
251 | + if (0 !== strpos($class_name, 'Wordlift\\')) { |
|
252 | 252 | return false; |
253 | 253 | } |
254 | 254 | |
255 | - $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
255 | + $class_name_lc = strtolower(str_replace('_', '-', $class_name)); |
|
256 | 256 | |
257 | - preg_match( '|^wordlift\\\\(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
257 | + preg_match('|^wordlift\\\\(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches); |
|
258 | 258 | |
259 | - $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
260 | - $file = 'class-' . $matches[2] . '.php'; |
|
259 | + $path = str_replace('\\', DIRECTORY_SEPARATOR, $matches[1]); |
|
260 | + $file = 'class-'.$matches[2].'.php'; |
|
261 | 261 | |
262 | - $full_path = plugin_dir_path( __FILE__ ) . 'classes' . DIRECTORY_SEPARATOR . $path . DIRECTORY_SEPARATOR . $file; |
|
262 | + $full_path = plugin_dir_path(__FILE__).'classes'.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$file; |
|
263 | 263 | |
264 | - if ( ! file_exists( $full_path ) ) { |
|
264 | + if ( ! file_exists($full_path)) { |
|
265 | 265 | return false; |
266 | 266 | } |
267 | 267 | |
268 | 268 | try { |
269 | 269 | require_once $full_path; |
270 | - } catch ( Exception $e ) { |
|
270 | + } catch (Exception $e) { |
|
271 | 271 | // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log |
272 | - error_log( "[WordLift] $full_path not found, cannot include." ); |
|
272 | + error_log("[WordLift] $full_path not found, cannot include."); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | return true; |
@@ -278,13 +278,13 @@ discard block |
||
278 | 278 | |
279 | 279 | } |
280 | 280 | |
281 | -function wl_block_categories( $categories ) { |
|
281 | +function wl_block_categories($categories) { |
|
282 | 282 | return array_merge( |
283 | 283 | $categories, |
284 | 284 | array( |
285 | 285 | array( |
286 | 286 | 'slug' => 'wordlift', |
287 | - 'title' => __( 'WordLift', 'wordlift' ), |
|
287 | + 'title' => __('WordLift', 'wordlift'), |
|
288 | 288 | ), |
289 | 289 | ) |
290 | 290 | ); |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | * This function is created temporarily to handle the legacy library, |
295 | 295 | * this has to be removed when removing the legacy fields from the ui. |
296 | 296 | */ |
297 | -function wl_enqueue_leaflet( $in_footer = false ) { |
|
297 | +function wl_enqueue_leaflet($in_footer = false) { |
|
298 | 298 | // Leaflet. |
299 | - wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' ); |
|
300 | - wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer ); |
|
299 | + wp_enqueue_style('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.css', array(), '1.6.0'); |
|
300 | + wp_enqueue_script('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | add_filter( |
304 | - version_compare( get_bloginfo( 'version' ), '5.8', '>=' ) |
|
304 | + version_compare(get_bloginfo('version'), '5.8', '>=') |
|
305 | 305 | ? 'block_categories_all' |
306 | 306 | : 'block_categories', |
307 | 307 | 'wl_block_categories', |
@@ -311,41 +311,41 @@ discard block |
||
311 | 311 | // Temporary fix for a typo in WooCommerce Extension. |
312 | 312 | add_filter( |
313 | 313 | 'wl_feature__enable__dataset', |
314 | - function ( $value ) { |
|
315 | - return apply_filters( 'wl_features__enable__dataset', $value ); |
|
314 | + function($value) { |
|
315 | + return apply_filters('wl_features__enable__dataset', $value); |
|
316 | 316 | } |
317 | 317 | ); |
318 | 318 | |
319 | -require_once __DIR__ . '/modules/food-kg/load.php'; |
|
320 | -require_once __DIR__ . '/modules/gardening-kg/load.php'; |
|
321 | -require_once __DIR__ . '/modules/acf4so/load.php'; |
|
322 | -require_once __DIR__ . '/modules/dashboard/load.php'; |
|
323 | -require_once __DIR__ . '/modules/pods/load.php'; |
|
324 | -require_once __DIR__ . '/modules/include-exclude-push-config/load.php'; |
|
325 | -require_once __DIR__ . '/modules/super-resolution/load.php'; |
|
326 | -require_once __DIR__ . '/modules/redeem-code/load.php'; |
|
327 | -require_once __DIR__ . '/modules/raptive-setup/load.php'; |
|
328 | -require_once __DIR__ . '/modules/events/load.php'; |
|
329 | -require_once __DIR__ . '/modules/plugin-diagnostics/load.php'; |
|
330 | -require_once __DIR__ . '/modules/override-url/load.php'; |
|
331 | -require_once __DIR__ . '/modules/jsonld-author-filter/load.php'; |
|
332 | - |
|
333 | -function _wl_update_plugins_raptive_domain( $update, $plugin_data, $plugin_file ) { |
|
319 | +require_once __DIR__.'/modules/food-kg/load.php'; |
|
320 | +require_once __DIR__.'/modules/gardening-kg/load.php'; |
|
321 | +require_once __DIR__.'/modules/acf4so/load.php'; |
|
322 | +require_once __DIR__.'/modules/dashboard/load.php'; |
|
323 | +require_once __DIR__.'/modules/pods/load.php'; |
|
324 | +require_once __DIR__.'/modules/include-exclude-push-config/load.php'; |
|
325 | +require_once __DIR__.'/modules/super-resolution/load.php'; |
|
326 | +require_once __DIR__.'/modules/redeem-code/load.php'; |
|
327 | +require_once __DIR__.'/modules/raptive-setup/load.php'; |
|
328 | +require_once __DIR__.'/modules/events/load.php'; |
|
329 | +require_once __DIR__.'/modules/plugin-diagnostics/load.php'; |
|
330 | +require_once __DIR__.'/modules/override-url/load.php'; |
|
331 | +require_once __DIR__.'/modules/jsonld-author-filter/load.php'; |
|
332 | + |
|
333 | +function _wl_update_plugins_raptive_domain($update, $plugin_data, $plugin_file) { |
|
334 | 334 | // Bail out if it's not our plugin. |
335 | 335 | $update_uri = $plugin_data['UpdateURI']; |
336 | - if ( 'wordlift/wordlift.php' !== $plugin_file || ! isset( $update_uri ) ) { |
|
336 | + if ('wordlift/wordlift.php' !== $plugin_file || ! isset($update_uri)) { |
|
337 | 337 | return $update; |
338 | 338 | } |
339 | 339 | |
340 | - $response = wp_remote_get( "$update_uri?nocache=" . time() ); |
|
340 | + $response = wp_remote_get("$update_uri?nocache=".time()); |
|
341 | 341 | |
342 | - if ( is_wp_error( $response ) ) { |
|
342 | + if (is_wp_error($response)) { |
|
343 | 343 | return $update; |
344 | 344 | } |
345 | 345 | |
346 | 346 | try { |
347 | - return json_decode( wp_remote_retrieve_body( $response ) ); |
|
348 | - } catch ( Exception $e ) { |
|
347 | + return json_decode(wp_remote_retrieve_body($response)); |
|
348 | + } catch (Exception $e) { |
|
349 | 349 | return $update; |
350 | 350 | } |
351 | 351 | } |