@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // If this file is called directly, abort. |
| 35 | 35 | if ( ! defined( 'WPINC' ) ) { |
| 36 | - die; |
|
| 36 | + die; |
|
| 37 | 37 | } |
| 38 | 38 | define( 'WORDLIFT_PLUGIN_FILE', __FILE__ ); |
| 39 | 39 | define( 'WORDLIFT_VERSION', '3.42.0-dev' ); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @since 3.33.6 |
| 49 | 49 | */ |
| 50 | 50 | if ( ! apply_filters( 'wl_is_enabled', true ) ) { |
| 51 | - return; |
|
| 51 | + return; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
@@ -77,33 +77,33 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | function activate_wordlift() { |
| 79 | 79 | |
| 80 | - $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
| 80 | + $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
| 81 | 81 | |
| 82 | - $log->info( 'Activating WordLift...' ); |
|
| 82 | + $log->info( 'Activating WordLift...' ); |
|
| 83 | 83 | |
| 84 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 85 | - Wordlift_Activator::activate(); |
|
| 84 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 85 | + Wordlift_Activator::activate(); |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks. |
|
| 89 | - * |
|
| 90 | - * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue. |
|
| 91 | - * @since 3.19.2 |
|
| 92 | - */ |
|
| 93 | - Wordlift_Http_Api::activate(); |
|
| 87 | + /** |
|
| 88 | + * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks. |
|
| 89 | + * |
|
| 90 | + * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue. |
|
| 91 | + * @since 3.19.2 |
|
| 92 | + */ |
|
| 93 | + Wordlift_Http_Api::activate(); |
|
| 94 | 94 | |
| 95 | - // Ensure the post type is registered before flushing the rewrite rules. |
|
| 96 | - Wordlift_Entity_Post_Type_Service::get_instance()->register(); |
|
| 97 | - flush_rewrite_rules(); |
|
| 98 | - /** |
|
| 99 | - * @since 3.27.7 |
|
| 100 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 101 | - */ |
|
| 102 | - Top_Entities::activate(); |
|
| 95 | + // Ensure the post type is registered before flushing the rewrite rules. |
|
| 96 | + Wordlift_Entity_Post_Type_Service::get_instance()->register(); |
|
| 97 | + flush_rewrite_rules(); |
|
| 98 | + /** |
|
| 99 | + * @since 3.27.7 |
|
| 100 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 101 | + */ |
|
| 102 | + Top_Entities::activate(); |
|
| 103 | 103 | |
| 104 | - if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
| 105 | - wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
| 106 | - } |
|
| 104 | + if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
| 105 | + wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | 108 | } |
| 109 | 109 | |
@@ -113,23 +113,23 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | function deactivate_wordlift() { |
| 115 | 115 | |
| 116 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 117 | - Wordlift_Deactivator::deactivate(); |
|
| 118 | - Wordlift_Http_Api::deactivate(); |
|
| 119 | - Ttl_Cache_Cleaner::deactivate(); |
|
| 120 | - /** |
|
| 121 | - * @since 3.27.7 |
|
| 122 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 123 | - */ |
|
| 124 | - Top_Entities::deactivate(); |
|
| 125 | - /** |
|
| 126 | - * @since 3.27.8 |
|
| 127 | - * Remove notification flag on deactivation. |
|
| 128 | - */ |
|
| 129 | - Key_Validation_Notice::remove_notification_flag(); |
|
| 130 | - flush_rewrite_rules(); |
|
| 131 | - |
|
| 132 | - wp_clear_scheduled_hook( 'wl_daily_cron' ); |
|
| 116 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 117 | + Wordlift_Deactivator::deactivate(); |
|
| 118 | + Wordlift_Http_Api::deactivate(); |
|
| 119 | + Ttl_Cache_Cleaner::deactivate(); |
|
| 120 | + /** |
|
| 121 | + * @since 3.27.7 |
|
| 122 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 123 | + */ |
|
| 124 | + Top_Entities::deactivate(); |
|
| 125 | + /** |
|
| 126 | + * @since 3.27.8 |
|
| 127 | + * Remove notification flag on deactivation. |
|
| 128 | + */ |
|
| 129 | + Key_Validation_Notice::remove_notification_flag(); |
|
| 130 | + flush_rewrite_rules(); |
|
| 131 | + |
|
| 132 | + wp_clear_scheduled_hook( 'wl_daily_cron' ); |
|
| 133 | 133 | |
| 134 | 134 | } |
| 135 | 135 | |
@@ -152,84 +152,84 @@ discard block |
||
| 152 | 152 | * @since 1.0.0 |
| 153 | 153 | */ |
| 154 | 154 | function run_wordlift() { |
| 155 | - /** |
|
| 156 | - * Filter: wl_feature__enable__widgets. |
|
| 157 | - * |
|
| 158 | - * @param bool whether the widgets needed to be registered, defaults to true. |
|
| 159 | - * |
|
| 160 | - * @return bool |
|
| 161 | - * @since 3.27.6 |
|
| 162 | - */ |
|
| 163 | - if ( apply_filters( 'wl_feature__enable__widgets', true ) ) { |
|
| 164 | - add_action( 'widgets_init', 'wl_register_chord_widget' ); |
|
| 165 | - add_action( 'widgets_init', 'wl_register_geo_widget' ); |
|
| 166 | - add_action( 'widgets_init', 'wl_register_timeline_widget' ); |
|
| 167 | - } |
|
| 168 | - add_filter( 'widget_text', 'do_shortcode' ); |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Filter: wl_feature__enable__analysis |
|
| 172 | - * |
|
| 173 | - * @param bool Whether to send api request to analysis or not |
|
| 174 | - * |
|
| 175 | - * @return bool |
|
| 176 | - * @since 3.27.6 |
|
| 177 | - */ |
|
| 178 | - if ( apply_filters( 'wl_feature__enable__analysis', true ) ) { |
|
| 179 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' ); |
|
| 180 | - } else { |
|
| 181 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' ); |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - $plugin = new Wordlift(); |
|
| 185 | - $plugin->run(); |
|
| 186 | - |
|
| 187 | - // Initialize the TTL Cache Cleaner. |
|
| 188 | - new Ttl_Cache_Cleaner(); |
|
| 189 | - |
|
| 190 | - // Load the new Post Adapter. |
|
| 191 | - new Post_Adapter(); |
|
| 192 | - |
|
| 193 | - // Load the API Data Hooks. |
|
| 194 | - new Api_Data_Hooks(); |
|
| 195 | - |
|
| 196 | - add_action( |
|
| 197 | - 'plugins_loaded', |
|
| 198 | - function () { |
|
| 199 | - // All features from registry should be initialized here. |
|
| 200 | - $features_registry = Features_Registry::get_instance(); |
|
| 201 | - $features_registry->initialize_all_features(); |
|
| 202 | - }, |
|
| 203 | - 5 |
|
| 204 | - ); |
|
| 205 | - |
|
| 206 | - add_action( |
|
| 207 | - 'plugins_loaded', |
|
| 208 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
| 209 | - function () use ( $plugin ) { |
|
| 210 | - |
|
| 211 | - new Wordlift_Products_Navigator_Shortcode_REST(); |
|
| 212 | - |
|
| 213 | - // Register the Dataset module, requires `$api_service`. |
|
| 214 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php'; |
|
| 215 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php'; |
|
| 216 | - |
|
| 217 | - /* |
|
| 155 | + /** |
|
| 156 | + * Filter: wl_feature__enable__widgets. |
|
| 157 | + * |
|
| 158 | + * @param bool whether the widgets needed to be registered, defaults to true. |
|
| 159 | + * |
|
| 160 | + * @return bool |
|
| 161 | + * @since 3.27.6 |
|
| 162 | + */ |
|
| 163 | + if ( apply_filters( 'wl_feature__enable__widgets', true ) ) { |
|
| 164 | + add_action( 'widgets_init', 'wl_register_chord_widget' ); |
|
| 165 | + add_action( 'widgets_init', 'wl_register_geo_widget' ); |
|
| 166 | + add_action( 'widgets_init', 'wl_register_timeline_widget' ); |
|
| 167 | + } |
|
| 168 | + add_filter( 'widget_text', 'do_shortcode' ); |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Filter: wl_feature__enable__analysis |
|
| 172 | + * |
|
| 173 | + * @param bool Whether to send api request to analysis or not |
|
| 174 | + * |
|
| 175 | + * @return bool |
|
| 176 | + * @since 3.27.6 |
|
| 177 | + */ |
|
| 178 | + if ( apply_filters( 'wl_feature__enable__analysis', true ) ) { |
|
| 179 | + add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' ); |
|
| 180 | + } else { |
|
| 181 | + add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' ); |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + $plugin = new Wordlift(); |
|
| 185 | + $plugin->run(); |
|
| 186 | + |
|
| 187 | + // Initialize the TTL Cache Cleaner. |
|
| 188 | + new Ttl_Cache_Cleaner(); |
|
| 189 | + |
|
| 190 | + // Load the new Post Adapter. |
|
| 191 | + new Post_Adapter(); |
|
| 192 | + |
|
| 193 | + // Load the API Data Hooks. |
|
| 194 | + new Api_Data_Hooks(); |
|
| 195 | + |
|
| 196 | + add_action( |
|
| 197 | + 'plugins_loaded', |
|
| 198 | + function () { |
|
| 199 | + // All features from registry should be initialized here. |
|
| 200 | + $features_registry = Features_Registry::get_instance(); |
|
| 201 | + $features_registry->initialize_all_features(); |
|
| 202 | + }, |
|
| 203 | + 5 |
|
| 204 | + ); |
|
| 205 | + |
|
| 206 | + add_action( |
|
| 207 | + 'plugins_loaded', |
|
| 208 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
| 209 | + function () use ( $plugin ) { |
|
| 210 | + |
|
| 211 | + new Wordlift_Products_Navigator_Shortcode_REST(); |
|
| 212 | + |
|
| 213 | + // Register the Dataset module, requires `$api_service`. |
|
| 214 | + require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php'; |
|
| 215 | + require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php'; |
|
| 216 | + |
|
| 217 | + /* |
|
| 218 | 218 | * Require the Entity annotation cleanup module. |
| 219 | 219 | * |
| 220 | 220 | * @since 3.34.6 |
| 221 | 221 | */ |
| 222 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php'; |
|
| 222 | + require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php'; |
|
| 223 | 223 | |
| 224 | - /* |
|
| 224 | + /* |
|
| 225 | 225 | * Import LOD entities. |
| 226 | 226 | * |
| 227 | 227 | * @since 3.35.0 |
| 228 | 228 | */ |
| 229 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php'; |
|
| 229 | + require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php'; |
|
| 230 | 230 | |
| 231 | - } |
|
| 232 | - ); |
|
| 231 | + } |
|
| 232 | + ); |
|
| 233 | 233 | |
| 234 | 234 | } |
| 235 | 235 | |
@@ -243,45 +243,45 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | function wordlift_plugin_autoload_register() { |
| 245 | 245 | |
| 246 | - spl_autoload_register( |
|
| 247 | - function ( $class_name ) { |
|
| 246 | + spl_autoload_register( |
|
| 247 | + function ( $class_name ) { |
|
| 248 | 248 | |
| 249 | - // Bail out if these are not our classes. |
|
| 250 | - if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) { |
|
| 251 | - return false; |
|
| 252 | - } |
|
| 249 | + // Bail out if these are not our classes. |
|
| 250 | + if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) { |
|
| 251 | + return false; |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | - $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
| 254 | + $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
| 255 | 255 | |
| 256 | - preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
| 256 | + preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
| 257 | 257 | |
| 258 | - $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
| 259 | - $file = 'class-' . $matches[2] . '.php'; |
|
| 258 | + $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
| 259 | + $file = 'class-' . $matches[2] . '.php'; |
|
| 260 | 260 | |
| 261 | - $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file; |
|
| 261 | + $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file; |
|
| 262 | 262 | |
| 263 | - if ( ! file_exists( $full_path ) ) { |
|
| 264 | - return false; |
|
| 265 | - } |
|
| 263 | + if ( ! file_exists( $full_path ) ) { |
|
| 264 | + return false; |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - require_once $full_path; |
|
| 267 | + require_once $full_path; |
|
| 268 | 268 | |
| 269 | - return true; |
|
| 270 | - } |
|
| 271 | - ); |
|
| 269 | + return true; |
|
| 270 | + } |
|
| 271 | + ); |
|
| 272 | 272 | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | function wl_block_categories( $categories ) { |
| 276 | - return array_merge( |
|
| 277 | - $categories, |
|
| 278 | - array( |
|
| 279 | - array( |
|
| 280 | - 'slug' => 'wordlift', |
|
| 281 | - 'title' => __( 'WordLift', 'wordlift' ), |
|
| 282 | - ), |
|
| 283 | - ) |
|
| 284 | - ); |
|
| 276 | + return array_merge( |
|
| 277 | + $categories, |
|
| 278 | + array( |
|
| 279 | + array( |
|
| 280 | + 'slug' => 'wordlift', |
|
| 281 | + 'title' => __( 'WordLift', 'wordlift' ), |
|
| 282 | + ), |
|
| 283 | + ) |
|
| 284 | + ); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -289,19 +289,19 @@ discard block |
||
| 289 | 289 | * this has to be removed when removing the legacy fields from the ui. |
| 290 | 290 | */ |
| 291 | 291 | function wl_enqueue_leaflet( $in_footer = false ) { |
| 292 | - // Leaflet. |
|
| 293 | - wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' ); |
|
| 294 | - wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer ); |
|
| 292 | + // Leaflet. |
|
| 293 | + wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' ); |
|
| 294 | + wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer ); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | add_filter( 'block_categories', 'wl_block_categories', 10 ); |
| 298 | 298 | |
| 299 | 299 | // Temporary fix for a typo in WooCommerce Extension. |
| 300 | 300 | add_filter( |
| 301 | - 'wl_feature__enable__dataset', |
|
| 302 | - function ( $value ) { |
|
| 303 | - return apply_filters( 'wl_features__enable__dataset', $value ); |
|
| 304 | - } |
|
| 301 | + 'wl_feature__enable__dataset', |
|
| 302 | + function ( $value ) { |
|
| 303 | + return apply_filters( 'wl_features__enable__dataset', $value ); |
|
| 304 | + } |
|
| 305 | 305 | ); |
| 306 | 306 | |
| 307 | 307 | require_once __DIR__ . '/modules/food-kg/load.php'; |
@@ -310,26 +310,26 @@ discard block |
||
| 310 | 310 | require_once __DIR__ . '/modules/include-exclude-push-config/load.php'; |
| 311 | 311 | |
| 312 | 312 | add_action( |
| 313 | - 'update_plugins_adthrive.wordlift.io', |
|
| 314 | - function ( $update, $plugin_data, $plugin_file ) { |
|
| 315 | - // Bail out if it's not our plugin. |
|
| 316 | - $update_uri = $plugin_data['UpdateURI']; |
|
| 317 | - if ( 'wordlift/wordlift.php' !== $plugin_file || ! isset( $update_uri ) ) { |
|
| 318 | - return $update; |
|
| 319 | - } |
|
| 320 | - |
|
| 321 | - $response = wp_remote_get( "$update_uri?nocache=" . time() ); |
|
| 322 | - |
|
| 323 | - if ( is_wp_error( $response ) ) { |
|
| 324 | - return $update; |
|
| 325 | - } |
|
| 326 | - |
|
| 327 | - try { |
|
| 328 | - return json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 329 | - } catch ( Exception $e ) { |
|
| 330 | - return $update; |
|
| 331 | - } |
|
| 332 | - }, |
|
| 333 | - 10, |
|
| 334 | - 3 |
|
| 313 | + 'update_plugins_adthrive.wordlift.io', |
|
| 314 | + function ( $update, $plugin_data, $plugin_file ) { |
|
| 315 | + // Bail out if it's not our plugin. |
|
| 316 | + $update_uri = $plugin_data['UpdateURI']; |
|
| 317 | + if ( 'wordlift/wordlift.php' !== $plugin_file || ! isset( $update_uri ) ) { |
|
| 318 | + return $update; |
|
| 319 | + } |
|
| 320 | + |
|
| 321 | + $response = wp_remote_get( "$update_uri?nocache=" . time() ); |
|
| 322 | + |
|
| 323 | + if ( is_wp_error( $response ) ) { |
|
| 324 | + return $update; |
|
| 325 | + } |
|
| 326 | + |
|
| 327 | + try { |
|
| 328 | + return json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 329 | + } catch ( Exception $e ) { |
|
| 330 | + return $update; |
|
| 331 | + } |
|
| 332 | + }, |
|
| 333 | + 10, |
|
| 334 | + 3 |
|
| 335 | 335 | ); |
@@ -32,26 +32,26 @@ discard block |
||
| 32 | 32 | use Wordlift\Post\Post_Adapter; |
| 33 | 33 | |
| 34 | 34 | // If this file is called directly, abort. |
| 35 | -if ( ! defined( 'WPINC' ) ) { |
|
| 35 | +if ( ! defined('WPINC')) { |
|
| 36 | 36 | die; |
| 37 | 37 | } |
| 38 | -define( 'WORDLIFT_PLUGIN_FILE', __FILE__ ); |
|
| 39 | -define( 'WORDLIFT_VERSION', '3.42.0-dev' ); |
|
| 38 | +define('WORDLIFT_PLUGIN_FILE', __FILE__); |
|
| 39 | +define('WORDLIFT_VERSION', '3.42.0-dev'); |
|
| 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/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/include-exclude/load.php'; |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Filter to disable WLP on any request, defaults to true. |
| 47 | 47 | * |
| 48 | 48 | * @since 3.33.6 |
| 49 | 49 | */ |
| 50 | -if ( ! apply_filters( 'wl_is_enabled', true ) ) { |
|
| 50 | +if ( ! apply_filters('wl_is_enabled', true)) { |
|
| 51 | 51 | return; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
|
| 54 | +require_once plugin_dir_path(__FILE__).'vendor/autoload.php'; |
|
| 55 | 55 | |
| 56 | 56 | /* |
| 57 | 57 | * We introduce the WordLift autoloader, since we start using classes in namespaces, i.e. Wordlift\Http. |
@@ -61,15 +61,15 @@ discard block |
||
| 61 | 61 | wordlift_plugin_autoload_register(); |
| 62 | 62 | |
| 63 | 63 | // Include WordLift constants. |
| 64 | -require_once plugin_dir_path( __FILE__ ) . 'wordlift-constants.php'; |
|
| 64 | +require_once plugin_dir_path(__FILE__).'wordlift-constants.php'; |
|
| 65 | 65 | |
| 66 | 66 | // Load modules. |
| 67 | -require_once plugin_dir_path( __FILE__ ) . 'modules/core/wordlift-core.php'; |
|
| 67 | +require_once plugin_dir_path(__FILE__).'modules/core/wordlift-core.php'; |
|
| 68 | 68 | |
| 69 | -require_once plugin_dir_path( __FILE__ ) . 'deprecations.php'; |
|
| 69 | +require_once plugin_dir_path(__FILE__).'deprecations.php'; |
|
| 70 | 70 | |
| 71 | 71 | // Load early to enable/disable features. |
| 72 | -require_once plugin_dir_path( __FILE__ ) . 'wordlift/features/index.php'; |
|
| 72 | +require_once plugin_dir_path(__FILE__).'wordlift/features/index.php'; |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * The code that runs during plugin activation. |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | function activate_wordlift() { |
| 79 | 79 | |
| 80 | - $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
| 80 | + $log = Wordlift_Log_Service::get_logger('activate_wordlift'); |
|
| 81 | 81 | |
| 82 | - $log->info( 'Activating WordLift...' ); |
|
| 82 | + $log->info('Activating WordLift...'); |
|
| 83 | 83 | |
| 84 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 84 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php'; |
|
| 85 | 85 | Wordlift_Activator::activate(); |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | Top_Entities::activate(); |
| 103 | 103 | |
| 104 | - if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
| 105 | - wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
| 104 | + if ( ! wp_next_scheduled('wl_daily_cron')) { |
|
| 105 | + wp_schedule_event(time(), 'daily', 'wl_daily_cron'); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | function deactivate_wordlift() { |
| 115 | 115 | |
| 116 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 116 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php'; |
|
| 117 | 117 | Wordlift_Deactivator::deactivate(); |
| 118 | 118 | Wordlift_Http_Api::deactivate(); |
| 119 | 119 | Ttl_Cache_Cleaner::deactivate(); |
@@ -129,18 +129,18 @@ discard block |
||
| 129 | 129 | Key_Validation_Notice::remove_notification_flag(); |
| 130 | 130 | flush_rewrite_rules(); |
| 131 | 131 | |
| 132 | - wp_clear_scheduled_hook( 'wl_daily_cron' ); |
|
| 132 | + wp_clear_scheduled_hook('wl_daily_cron'); |
|
| 133 | 133 | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | -register_activation_hook( __FILE__, 'activate_wordlift' ); |
|
| 137 | -register_deactivation_hook( __FILE__, 'deactivate_wordlift' ); |
|
| 136 | +register_activation_hook(__FILE__, 'activate_wordlift'); |
|
| 137 | +register_deactivation_hook(__FILE__, 'deactivate_wordlift'); |
|
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * The core plugin class that is used to define internationalization, |
| 141 | 141 | * admin-specific hooks, and public-facing site hooks. |
| 142 | 142 | */ |
| 143 | -require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php'; |
|
| 143 | +require plugin_dir_path(__FILE__).'includes/class-wordlift.php'; |
|
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * Begins execution of the plugin. |
@@ -160,12 +160,12 @@ discard block |
||
| 160 | 160 | * @return bool |
| 161 | 161 | * @since 3.27.6 |
| 162 | 162 | */ |
| 163 | - if ( apply_filters( 'wl_feature__enable__widgets', true ) ) { |
|
| 164 | - add_action( 'widgets_init', 'wl_register_chord_widget' ); |
|
| 165 | - add_action( 'widgets_init', 'wl_register_geo_widget' ); |
|
| 166 | - add_action( 'widgets_init', 'wl_register_timeline_widget' ); |
|
| 163 | + if (apply_filters('wl_feature__enable__widgets', true)) { |
|
| 164 | + add_action('widgets_init', 'wl_register_chord_widget'); |
|
| 165 | + add_action('widgets_init', 'wl_register_geo_widget'); |
|
| 166 | + add_action('widgets_init', 'wl_register_timeline_widget'); |
|
| 167 | 167 | } |
| 168 | - add_filter( 'widget_text', 'do_shortcode' ); |
|
| 168 | + add_filter('widget_text', 'do_shortcode'); |
|
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | 171 | * Filter: wl_feature__enable__analysis |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | * @return bool |
| 176 | 176 | * @since 3.27.6 |
| 177 | 177 | */ |
| 178 | - if ( apply_filters( 'wl_feature__enable__analysis', true ) ) { |
|
| 179 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' ); |
|
| 178 | + if (apply_filters('wl_feature__enable__analysis', true)) { |
|
| 179 | + add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_action'); |
|
| 180 | 180 | } else { |
| 181 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' ); |
|
| 181 | + add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action'); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $plugin = new Wordlift(); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | add_action( |
| 197 | 197 | 'plugins_loaded', |
| 198 | - function () { |
|
| 198 | + function() { |
|
| 199 | 199 | // All features from registry should be initialized here. |
| 200 | 200 | $features_registry = Features_Registry::get_instance(); |
| 201 | 201 | $features_registry->initialize_all_features(); |
@@ -206,27 +206,27 @@ discard block |
||
| 206 | 206 | add_action( |
| 207 | 207 | 'plugins_loaded', |
| 208 | 208 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 209 | - function () use ( $plugin ) { |
|
| 209 | + function() use ($plugin) { |
|
| 210 | 210 | |
| 211 | 211 | new Wordlift_Products_Navigator_Shortcode_REST(); |
| 212 | 212 | |
| 213 | 213 | // Register the Dataset module, requires `$api_service`. |
| 214 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php'; |
|
| 215 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php'; |
|
| 214 | + require_once plugin_dir_path(__FILE__).'wordlift/dataset/index.php'; |
|
| 215 | + require_once plugin_dir_path(__FILE__).'wordlift/shipping-data/index.php'; |
|
| 216 | 216 | |
| 217 | 217 | /* |
| 218 | 218 | * Require the Entity annotation cleanup module. |
| 219 | 219 | * |
| 220 | 220 | * @since 3.34.6 |
| 221 | 221 | */ |
| 222 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php'; |
|
| 222 | + require_once plugin_dir_path(__FILE__).'wordlift/cleanup/index.php'; |
|
| 223 | 223 | |
| 224 | 224 | /* |
| 225 | 225 | * Import LOD entities. |
| 226 | 226 | * |
| 227 | 227 | * @since 3.35.0 |
| 228 | 228 | */ |
| 229 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php'; |
|
| 229 | + require_once plugin_dir_path(__FILE__).'wordlift/lod-import/index.php'; |
|
| 230 | 230 | |
| 231 | 231 | } |
| 232 | 232 | ); |
@@ -244,23 +244,23 @@ discard block |
||
| 244 | 244 | function wordlift_plugin_autoload_register() { |
| 245 | 245 | |
| 246 | 246 | spl_autoload_register( |
| 247 | - function ( $class_name ) { |
|
| 247 | + function($class_name) { |
|
| 248 | 248 | |
| 249 | 249 | // Bail out if these are not our classes. |
| 250 | - if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) { |
|
| 250 | + if (0 !== strpos($class_name, 'Wordlift\\')) { |
|
| 251 | 251 | return false; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
| 254 | + $class_name_lc = strtolower(str_replace('_', '-', $class_name)); |
|
| 255 | 255 | |
| 256 | - preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
| 256 | + preg_match('|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches); |
|
| 257 | 257 | |
| 258 | - $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
| 259 | - $file = 'class-' . $matches[2] . '.php'; |
|
| 258 | + $path = str_replace('\\', DIRECTORY_SEPARATOR, $matches[1]); |
|
| 259 | + $file = 'class-'.$matches[2].'.php'; |
|
| 260 | 260 | |
| 261 | - $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file; |
|
| 261 | + $full_path = plugin_dir_path(__FILE__).$path.DIRECTORY_SEPARATOR.$file; |
|
| 262 | 262 | |
| 263 | - if ( ! file_exists( $full_path ) ) { |
|
| 263 | + if ( ! file_exists($full_path)) { |
|
| 264 | 264 | return false; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -272,13 +272,13 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | -function wl_block_categories( $categories ) { |
|
| 275 | +function wl_block_categories($categories) { |
|
| 276 | 276 | return array_merge( |
| 277 | 277 | $categories, |
| 278 | 278 | array( |
| 279 | 279 | array( |
| 280 | 280 | 'slug' => 'wordlift', |
| 281 | - 'title' => __( 'WordLift', 'wordlift' ), |
|
| 281 | + 'title' => __('WordLift', 'wordlift'), |
|
| 282 | 282 | ), |
| 283 | 283 | ) |
| 284 | 284 | ); |
@@ -288,45 +288,45 @@ discard block |
||
| 288 | 288 | * This function is created temporarily to handle the legacy library, |
| 289 | 289 | * this has to be removed when removing the legacy fields from the ui. |
| 290 | 290 | */ |
| 291 | -function wl_enqueue_leaflet( $in_footer = false ) { |
|
| 291 | +function wl_enqueue_leaflet($in_footer = false) { |
|
| 292 | 292 | // Leaflet. |
| 293 | - wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' ); |
|
| 294 | - wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer ); |
|
| 293 | + wp_enqueue_style('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.css', array(), '1.6.0'); |
|
| 294 | + wp_enqueue_script('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | -add_filter( 'block_categories', 'wl_block_categories', 10 ); |
|
| 297 | +add_filter('block_categories', 'wl_block_categories', 10); |
|
| 298 | 298 | |
| 299 | 299 | // Temporary fix for a typo in WooCommerce Extension. |
| 300 | 300 | add_filter( |
| 301 | 301 | 'wl_feature__enable__dataset', |
| 302 | - function ( $value ) { |
|
| 303 | - return apply_filters( 'wl_features__enable__dataset', $value ); |
|
| 302 | + function($value) { |
|
| 303 | + return apply_filters('wl_features__enable__dataset', $value); |
|
| 304 | 304 | } |
| 305 | 305 | ); |
| 306 | 306 | |
| 307 | -require_once __DIR__ . '/modules/food-kg/load.php'; |
|
| 308 | -require_once __DIR__ . '/modules/acf4so/load.php'; |
|
| 309 | -require_once __DIR__ . '/modules/pods/load.php'; |
|
| 310 | -require_once __DIR__ . '/modules/include-exclude-push-config/load.php'; |
|
| 307 | +require_once __DIR__.'/modules/food-kg/load.php'; |
|
| 308 | +require_once __DIR__.'/modules/acf4so/load.php'; |
|
| 309 | +require_once __DIR__.'/modules/pods/load.php'; |
|
| 310 | +require_once __DIR__.'/modules/include-exclude-push-config/load.php'; |
|
| 311 | 311 | |
| 312 | 312 | add_action( |
| 313 | 313 | 'update_plugins_adthrive.wordlift.io', |
| 314 | - function ( $update, $plugin_data, $plugin_file ) { |
|
| 314 | + function($update, $plugin_data, $plugin_file) { |
|
| 315 | 315 | // Bail out if it's not our plugin. |
| 316 | 316 | $update_uri = $plugin_data['UpdateURI']; |
| 317 | - if ( 'wordlift/wordlift.php' !== $plugin_file || ! isset( $update_uri ) ) { |
|
| 317 | + if ('wordlift/wordlift.php' !== $plugin_file || ! isset($update_uri)) { |
|
| 318 | 318 | return $update; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - $response = wp_remote_get( "$update_uri?nocache=" . time() ); |
|
| 321 | + $response = wp_remote_get("$update_uri?nocache=".time()); |
|
| 322 | 322 | |
| 323 | - if ( is_wp_error( $response ) ) { |
|
| 323 | + if (is_wp_error($response)) { |
|
| 324 | 324 | return $update; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | try { |
| 328 | - return json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 329 | - } catch ( Exception $e ) { |
|
| 328 | + return json_decode(wp_remote_retrieve_body($response)); |
|
| 329 | + } catch (Exception $e) { |
|
| 330 | 330 | return $update; |
| 331 | 331 | } |
| 332 | 332 | }, |