@@ -16,33 +16,33 @@ discard block |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | protected function get_dataset_uri() { |
| 19 | - return trailingslashit( Wordlift_Configuration_Service::get_instance()->get_dataset_uri() ); |
|
| 19 | + return trailingslashit(Wordlift_Configuration_Service::get_instance()->get_dataset_uri()); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - protected function is_absolute( $uri ) { |
|
| 23 | - return 1 === preg_match( '@^https?://@', $uri ); |
|
| 22 | + protected function is_absolute($uri) { |
|
| 23 | + return 1 === preg_match('@^https?://@', $uri); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - protected function is_internal( $uri ) { |
|
| 26 | + protected function is_internal($uri) { |
|
| 27 | 27 | $dataset_uri = $this->get_dataset_uri(); |
| 28 | 28 | |
| 29 | - return ! empty( $dataset_uri ) && 0 === strpos( $uri, $dataset_uri ); |
|
| 29 | + return ! empty($dataset_uri) && 0 === strpos($uri, $dataset_uri); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - protected function make_absolute( $uri ) { |
|
| 33 | - Assertions::not_empty( $this->get_dataset_uri(), '`dataset_uri` cannot be empty.' ); |
|
| 32 | + protected function make_absolute($uri) { |
|
| 33 | + Assertions::not_empty($this->get_dataset_uri(), '`dataset_uri` cannot be empty.'); |
|
| 34 | 34 | |
| 35 | - if ( 1 !== preg_match( '@^https?://@', $uri ) ) { |
|
| 36 | - return $this->get_dataset_uri() . $uri; |
|
| 35 | + if (1 !== preg_match('@^https?://@', $uri)) { |
|
| 36 | + return $this->get_dataset_uri().$uri; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | return $uri; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - protected function make_relative( $uri ) { |
|
| 42 | + protected function make_relative($uri) { |
|
| 43 | 43 | $dataset_uri = $this->get_dataset_uri(); |
| 44 | - if ( 0 === strpos( $uri, $dataset_uri ) ) { |
|
| 45 | - return substr( $uri, strlen( $dataset_uri ) ); |
|
| 44 | + if (0 === strpos($uri, $dataset_uri)) { |
|
| 45 | + return substr($uri, strlen($dataset_uri)); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | return $uri; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return string|null |
| 55 | 55 | */ |
| 56 | - public function get_about_jsonld( $content_id ) { |
|
| 56 | + public function get_about_jsonld($content_id) { |
|
| 57 | 57 | global $wpdb; |
| 58 | 58 | |
| 59 | 59 | return $wpdb->get_var( |
@@ -74,18 +74,18 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @throws Exception If the 'match_name' column does not exist in the database table. |
| 76 | 76 | */ |
| 77 | - public function set_about_jsonld( $content_id, $value ) { |
|
| 77 | + public function set_about_jsonld($content_id, $value) { |
|
| 78 | 78 | global $wpdb; |
| 79 | 79 | |
| 80 | 80 | // Cleanup value. |
| 81 | - $value = ( is_string( $value ) && strlen( $value ) > 2 ) ? $value : null; |
|
| 81 | + $value = (is_string($value) && strlen($value) > 2) ? $value : null; |
|
| 82 | 82 | $match_name = "NULL"; |
| 83 | 83 | |
| 84 | - if ( $value ) { |
|
| 84 | + if ($value) { |
|
| 85 | 85 | // Check if the 'match_name' column exists in the database table |
| 86 | - $columns = $wpdb->get_col_info( 'name', 0 ); |
|
| 87 | - if ( in_array( 'match_name', $columns ) ) { |
|
| 88 | - $match_name = $this->get_match_name( $value ); |
|
| 86 | + $columns = $wpdb->get_col_info('name', 0); |
|
| 87 | + if (in_array('match_name', $columns)) { |
|
| 88 | + $match_name = $this->get_match_name($value); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
@@ -93,15 +93,15 @@ discard block |
||
| 93 | 93 | // should revise how this works really. |
| 94 | 94 | // |
| 95 | 95 | // This is currently needed because rel_uri is required in the table. |
| 96 | - switch ( $content_id->get_type() ) { |
|
| 96 | + switch ($content_id->get_type()) { |
|
| 97 | 97 | case Object_Type_Enum::POST: |
| 98 | - Wordpress_Dataset_Content_Service_Hooks::insert_post( $content_id->get_id() ); |
|
| 98 | + Wordpress_Dataset_Content_Service_Hooks::insert_post($content_id->get_id()); |
|
| 99 | 99 | break; |
| 100 | 100 | case Object_Type_Enum::TERM: |
| 101 | - Wordpress_Dataset_Content_Service_Hooks::created_term( $content_id->get_id() ); |
|
| 101 | + Wordpress_Dataset_Content_Service_Hooks::created_term($content_id->get_id()); |
|
| 102 | 102 | break; |
| 103 | 103 | case Object_Type_Enum::USER: |
| 104 | - Wordpress_Dataset_Content_Service_Hooks::user_register( $content_id->get_id() ); |
|
| 104 | + Wordpress_Dataset_Content_Service_Hooks::user_register($content_id->get_id()); |
|
| 105 | 105 | break; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * as `null` if we directly pass it to the prepare function(). So its necessary |
| 112 | 112 | * to make the query conditional based on the $value |
| 113 | 113 | */ |
| 114 | - if ( null === $value ) { |
|
| 114 | + if (null === $value) { |
|
| 115 | 115 | return $wpdb->query( |
| 116 | 116 | $wpdb->prepare( |
| 117 | 117 | "UPDATE {$wpdb->prefix}wl_entities |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @return mixed|null |
| 144 | 144 | */ |
| 145 | - public function get_match_name( $jsonld ) { |
|
| 146 | - $data = json_decode( $jsonld, true ); |
|
| 147 | - if ( ! $data || ! array_key_exists( 'name', $data ) ) { |
|
| 145 | + public function get_match_name($jsonld) { |
|
| 146 | + $data = json_decode($jsonld, true); |
|
| 147 | + if ( ! $data || ! array_key_exists('name', $data)) { |
|
| 148 | 148 | return "NULL"; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -31,26 +31,26 @@ discard block |
||
| 31 | 31 | use Wordlift\Features\Features_Registry; |
| 32 | 32 | use Wordlift\Post\Post_Adapter; |
| 33 | 33 | |
| 34 | -define( 'WORDLIFT_PLUGIN_FILE', __FILE__ ); |
|
| 35 | -define( 'WORDLIFT_VERSION', '3.50.1-0' ); |
|
| 34 | +define('WORDLIFT_PLUGIN_FILE', __FILE__); |
|
| 35 | +define('WORDLIFT_VERSION', '3.50.1-0'); |
|
| 36 | 36 | |
| 37 | 37 | // ## DO NOT REMOVE THIS LINE: WHITELABEL PLACEHOLDER ## |
| 38 | 38 | |
| 39 | -require_once plugin_dir_path( __FILE__ ) . '/libraries/action-scheduler/action-scheduler.php'; |
|
| 40 | -require_once __DIR__ . '/modules/common/load.php'; |
|
| 41 | -require_once __DIR__ . '/modules/app/load.php'; |
|
| 42 | -require_once __DIR__ . '/modules/include-exclude/load.php'; |
|
| 39 | +require_once plugin_dir_path(__FILE__).'/libraries/action-scheduler/action-scheduler.php'; |
|
| 40 | +require_once __DIR__.'/modules/common/load.php'; |
|
| 41 | +require_once __DIR__.'/modules/app/load.php'; |
|
| 42 | +require_once __DIR__.'/modules/include-exclude/load.php'; |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Filter to disable WLP on any request, defaults to true. |
| 46 | 46 | * |
| 47 | 47 | * @since 3.33.6 |
| 48 | 48 | */ |
| 49 | -if ( ! apply_filters( 'wl_is_enabled', true ) ) { |
|
| 49 | +if ( ! apply_filters('wl_is_enabled', true)) { |
|
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
|
| 53 | +require_once plugin_dir_path(__FILE__).'vendor/autoload.php'; |
|
| 54 | 54 | |
| 55 | 55 | /* |
| 56 | 56 | * We introduce the WordLift autoloader, since we start using classes in namespaces, i.e. Wordlift\Http. |
@@ -60,15 +60,15 @@ discard block |
||
| 60 | 60 | wordlift_plugin_autoload_register(); |
| 61 | 61 | |
| 62 | 62 | // Include WordLift constants. |
| 63 | -require_once plugin_dir_path( __FILE__ ) . 'wordlift-constants.php'; |
|
| 63 | +require_once plugin_dir_path(__FILE__).'wordlift-constants.php'; |
|
| 64 | 64 | |
| 65 | 65 | // Load modules. |
| 66 | -require_once plugin_dir_path( __FILE__ ) . 'modules/core/wordlift-core.php'; |
|
| 66 | +require_once plugin_dir_path(__FILE__).'modules/core/wordlift-core.php'; |
|
| 67 | 67 | |
| 68 | -require_once plugin_dir_path( __FILE__ ) . 'deprecations.php'; |
|
| 68 | +require_once plugin_dir_path(__FILE__).'deprecations.php'; |
|
| 69 | 69 | |
| 70 | 70 | // Load early to enable/disable features. |
| 71 | -require_once plugin_dir_path( __FILE__ ) . 'classes/features/index.php'; |
|
| 71 | +require_once plugin_dir_path(__FILE__).'classes/features/index.php'; |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * The code that runs during plugin activation. |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | function activate_wordlift() { |
| 78 | 78 | |
| 79 | - $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
| 79 | + $log = Wordlift_Log_Service::get_logger('activate_wordlift'); |
|
| 80 | 80 | |
| 81 | - $log->info( 'Activating WordLift...' ); |
|
| 81 | + $log->info('Activating WordLift...'); |
|
| 82 | 82 | |
| 83 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 83 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php'; |
|
| 84 | 84 | Wordlift_Activator::activate(); |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | Top_Entities::activate(); |
| 102 | 102 | |
| 103 | - if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
| 104 | - wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
| 103 | + if ( ! wp_next_scheduled('wl_daily_cron')) { |
|
| 104 | + wp_schedule_event(time(), 'daily', 'wl_daily_cron'); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | function deactivate_wordlift() { |
| 114 | 114 | |
| 115 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 115 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php'; |
|
| 116 | 116 | Wordlift_Deactivator::deactivate(); |
| 117 | 117 | Wordlift_Http_Api::deactivate(); |
| 118 | 118 | Ttl_Cache_Cleaner::deactivate(); |
@@ -128,18 +128,18 @@ discard block |
||
| 128 | 128 | Key_Validation_Notice::remove_notification_flag(); |
| 129 | 129 | flush_rewrite_rules(); |
| 130 | 130 | |
| 131 | - wp_clear_scheduled_hook( 'wl_daily_cron' ); |
|
| 131 | + wp_clear_scheduled_hook('wl_daily_cron'); |
|
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | -register_activation_hook( __FILE__, 'activate_wordlift' ); |
|
| 136 | -register_deactivation_hook( __FILE__, 'deactivate_wordlift' ); |
|
| 135 | +register_activation_hook(__FILE__, 'activate_wordlift'); |
|
| 136 | +register_deactivation_hook(__FILE__, 'deactivate_wordlift'); |
|
| 137 | 137 | |
| 138 | 138 | /** |
| 139 | 139 | * The core plugin class that is used to define internationalization, |
| 140 | 140 | * admin-specific hooks, and public-facing site hooks. |
| 141 | 141 | */ |
| 142 | -require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php'; |
|
| 142 | +require plugin_dir_path(__FILE__).'includes/class-wordlift.php'; |
|
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * Begins execution of the plugin. |
@@ -159,12 +159,12 @@ discard block |
||
| 159 | 159 | * @return bool |
| 160 | 160 | * @since 3.27.6 |
| 161 | 161 | */ |
| 162 | - if ( apply_filters( 'wl_feature__enable__widgets', true ) ) { |
|
| 163 | - add_action( 'widgets_init', 'wl_register_chord_widget' ); |
|
| 164 | - add_action( 'widgets_init', 'wl_register_geo_widget' ); |
|
| 165 | - add_action( 'widgets_init', 'wl_register_timeline_widget' ); |
|
| 162 | + if (apply_filters('wl_feature__enable__widgets', true)) { |
|
| 163 | + add_action('widgets_init', 'wl_register_chord_widget'); |
|
| 164 | + add_action('widgets_init', 'wl_register_geo_widget'); |
|
| 165 | + add_action('widgets_init', 'wl_register_timeline_widget'); |
|
| 166 | 166 | } |
| 167 | - add_filter( 'widget_text', 'do_shortcode' ); |
|
| 167 | + add_filter('widget_text', 'do_shortcode'); |
|
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * Filter: wl_feature__enable__analysis |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | * @return bool |
| 175 | 175 | * @since 3.27.6 |
| 176 | 176 | */ |
| 177 | - if ( apply_filters( 'wl_feature__enable__analysis', true ) ) { |
|
| 178 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' ); |
|
| 177 | + if (apply_filters('wl_feature__enable__analysis', true)) { |
|
| 178 | + add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_action'); |
|
| 179 | 179 | } else { |
| 180 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' ); |
|
| 180 | + add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action'); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $plugin = new Wordlift(); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | add_action( |
| 196 | 196 | 'plugins_loaded', |
| 197 | - function () { |
|
| 197 | + function() { |
|
| 198 | 198 | // All features from registry should be initialized here. |
| 199 | 199 | $features_registry = Features_Registry::get_instance(); |
| 200 | 200 | $features_registry->initialize_all_features(); |
@@ -205,27 +205,27 @@ discard block |
||
| 205 | 205 | add_action( |
| 206 | 206 | 'plugins_loaded', |
| 207 | 207 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 208 | - function () use ( $plugin ) { |
|
| 208 | + function() use ($plugin) { |
|
| 209 | 209 | |
| 210 | 210 | new Wordlift_Products_Navigator_Shortcode_REST(); |
| 211 | 211 | |
| 212 | 212 | // Register the Dataset module, requires `$api_service`. |
| 213 | - require_once plugin_dir_path( __FILE__ ) . 'classes/dataset/index.php'; |
|
| 214 | - require_once plugin_dir_path( __FILE__ ) . 'classes/shipping-data/index.php'; |
|
| 213 | + require_once plugin_dir_path(__FILE__).'classes/dataset/index.php'; |
|
| 214 | + require_once plugin_dir_path(__FILE__).'classes/shipping-data/index.php'; |
|
| 215 | 215 | |
| 216 | 216 | /* |
| 217 | 217 | * Require the Entity annotation cleanup module. |
| 218 | 218 | * |
| 219 | 219 | * @since 3.34.6 |
| 220 | 220 | */ |
| 221 | - require_once plugin_dir_path( __FILE__ ) . 'classes/cleanup/index.php'; |
|
| 221 | + require_once plugin_dir_path(__FILE__).'classes/cleanup/index.php'; |
|
| 222 | 222 | |
| 223 | 223 | /* |
| 224 | 224 | * Import LOD entities. |
| 225 | 225 | * |
| 226 | 226 | * @since 3.35.0 |
| 227 | 227 | */ |
| 228 | - require_once plugin_dir_path( __FILE__ ) . 'classes/lod-import/index.php'; |
|
| 228 | + require_once plugin_dir_path(__FILE__).'classes/lod-import/index.php'; |
|
| 229 | 229 | |
| 230 | 230 | } |
| 231 | 231 | ); |
@@ -243,31 +243,31 @@ discard block |
||
| 243 | 243 | function wordlift_plugin_autoload_register() { |
| 244 | 244 | |
| 245 | 245 | spl_autoload_register( |
| 246 | - function ( $class_name ) { |
|
| 246 | + function($class_name) { |
|
| 247 | 247 | |
| 248 | 248 | // Bail out if these are not our classes. |
| 249 | - if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) { |
|
| 249 | + if (0 !== strpos($class_name, 'Wordlift\\')) { |
|
| 250 | 250 | return false; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
| 253 | + $class_name_lc = strtolower(str_replace('_', '-', $class_name)); |
|
| 254 | 254 | |
| 255 | - preg_match( '|^wordlift\\\\(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
| 255 | + preg_match('|^wordlift\\\\(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches); |
|
| 256 | 256 | |
| 257 | - $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
| 258 | - $file = 'class-' . $matches[2] . '.php'; |
|
| 257 | + $path = str_replace('\\', DIRECTORY_SEPARATOR, $matches[1]); |
|
| 258 | + $file = 'class-'.$matches[2].'.php'; |
|
| 259 | 259 | |
| 260 | - $full_path = plugin_dir_path( __FILE__ ) . 'classes' . DIRECTORY_SEPARATOR . $path . DIRECTORY_SEPARATOR . $file; |
|
| 260 | + $full_path = plugin_dir_path(__FILE__).'classes'.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$file; |
|
| 261 | 261 | |
| 262 | - if ( ! file_exists( $full_path ) ) { |
|
| 262 | + if ( ! file_exists($full_path)) { |
|
| 263 | 263 | return false; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | try { |
| 267 | 267 | require_once $full_path; |
| 268 | - } catch ( Exception $e ) { |
|
| 268 | + } catch (Exception $e) { |
|
| 269 | 269 | // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log |
| 270 | - error_log( "[WordLift] $full_path not found, cannot include." ); |
|
| 270 | + error_log("[WordLift] $full_path not found, cannot include."); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | return true; |
@@ -276,13 +276,13 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | -function wl_block_categories( $categories ) { |
|
| 279 | +function wl_block_categories($categories) { |
|
| 280 | 280 | return array_merge( |
| 281 | 281 | $categories, |
| 282 | 282 | array( |
| 283 | 283 | array( |
| 284 | 284 | 'slug' => 'wordlift', |
| 285 | - 'title' => __( 'WordLift', 'wordlift' ), |
|
| 285 | + 'title' => __('WordLift', 'wordlift'), |
|
| 286 | 286 | ), |
| 287 | 287 | ) |
| 288 | 288 | ); |
@@ -292,49 +292,49 @@ discard block |
||
| 292 | 292 | * This function is created temporarily to handle the legacy library, |
| 293 | 293 | * this has to be removed when removing the legacy fields from the ui. |
| 294 | 294 | */ |
| 295 | -function wl_enqueue_leaflet( $in_footer = false ) { |
|
| 295 | +function wl_enqueue_leaflet($in_footer = false) { |
|
| 296 | 296 | // Leaflet. |
| 297 | - wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' ); |
|
| 298 | - wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer ); |
|
| 297 | + wp_enqueue_style('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.css', array(), '1.6.0'); |
|
| 298 | + wp_enqueue_script('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | -add_filter( 'block_categories', 'wl_block_categories', 10 ); |
|
| 301 | +add_filter('block_categories', 'wl_block_categories', 10); |
|
| 302 | 302 | |
| 303 | 303 | // Temporary fix for a typo in WooCommerce Extension. |
| 304 | 304 | add_filter( |
| 305 | 305 | 'wl_feature__enable__dataset', |
| 306 | - function ( $value ) { |
|
| 307 | - return apply_filters( 'wl_features__enable__dataset', $value ); |
|
| 306 | + function($value) { |
|
| 307 | + return apply_filters('wl_features__enable__dataset', $value); |
|
| 308 | 308 | } |
| 309 | 309 | ); |
| 310 | 310 | |
| 311 | -require_once __DIR__ . '/modules/food-kg/load.php'; |
|
| 312 | -require_once __DIR__ . '/modules/gardening-kg/load.php'; |
|
| 313 | -require_once __DIR__ . '/modules/acf4so/load.php'; |
|
| 314 | -require_once __DIR__ . '/modules/dashboard/load.php'; |
|
| 315 | -require_once __DIR__ . '/modules/pods/load.php'; |
|
| 316 | -require_once __DIR__ . '/modules/include-exclude-push-config/load.php'; |
|
| 317 | -require_once __DIR__ . '/modules/super-resolution/load.php'; |
|
| 318 | -require_once __DIR__ . '/modules/redeem-code/load.php'; |
|
| 319 | -require_once __DIR__ . '/modules/raptive-setup/load.php'; |
|
| 320 | -require_once __DIR__ . '/modules/events/load.php'; |
|
| 321 | - |
|
| 322 | -function _wl_update_plugins_raptive_domain( $update, $plugin_data, $plugin_file ) { |
|
| 311 | +require_once __DIR__.'/modules/food-kg/load.php'; |
|
| 312 | +require_once __DIR__.'/modules/gardening-kg/load.php'; |
|
| 313 | +require_once __DIR__.'/modules/acf4so/load.php'; |
|
| 314 | +require_once __DIR__.'/modules/dashboard/load.php'; |
|
| 315 | +require_once __DIR__.'/modules/pods/load.php'; |
|
| 316 | +require_once __DIR__.'/modules/include-exclude-push-config/load.php'; |
|
| 317 | +require_once __DIR__.'/modules/super-resolution/load.php'; |
|
| 318 | +require_once __DIR__.'/modules/redeem-code/load.php'; |
|
| 319 | +require_once __DIR__.'/modules/raptive-setup/load.php'; |
|
| 320 | +require_once __DIR__.'/modules/events/load.php'; |
|
| 321 | + |
|
| 322 | +function _wl_update_plugins_raptive_domain($update, $plugin_data, $plugin_file) { |
|
| 323 | 323 | // Bail out if it's not our plugin. |
| 324 | 324 | $update_uri = $plugin_data['UpdateURI']; |
| 325 | - if ( 'wordlift/wordlift.php' !== $plugin_file || ! isset( $update_uri ) ) { |
|
| 325 | + if ('wordlift/wordlift.php' !== $plugin_file || ! isset($update_uri)) { |
|
| 326 | 326 | return $update; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - $response = wp_remote_get( "$update_uri?nocache=" . time() ); |
|
| 329 | + $response = wp_remote_get("$update_uri?nocache=".time()); |
|
| 330 | 330 | |
| 331 | - if ( is_wp_error( $response ) ) { |
|
| 331 | + if (is_wp_error($response)) { |
|
| 332 | 332 | return $update; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | try { |
| 336 | - return json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 337 | - } catch ( Exception $e ) { |
|
| 336 | + return json_decode(wp_remote_retrieve_body($response)); |
|
| 337 | + } catch (Exception $e) { |
|
| 338 | 338 | return $update; |
| 339 | 339 | } |
| 340 | 340 | } |
@@ -49,38 +49,38 @@ discard block |
||
| 49 | 49 | public function __construct() { |
| 50 | 50 | |
| 51 | 51 | /** Installs. */ |
| 52 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install.php'; |
|
| 53 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-1-0-0.php'; |
|
| 54 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-10-0.php'; |
|
| 55 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-12-0.php'; |
|
| 56 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-14-0.php'; |
|
| 57 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-15-0.php'; |
|
| 58 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-0.php'; |
|
| 59 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-3.php'; |
|
| 60 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-19-5.php'; |
|
| 61 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-20-0.php'; |
|
| 62 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-23-4.php'; |
|
| 63 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-24-2.php'; |
|
| 64 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-all-entity-types.php'; |
|
| 65 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-package-type.php'; |
|
| 66 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-25-0.php'; |
|
| 67 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-0.php'; |
|
| 68 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-1.php'; |
|
| 69 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-28-0.php'; |
|
| 70 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-32-0.php'; |
|
| 71 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-33-9.php'; |
|
| 72 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-36-0.php'; |
|
| 73 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-38-5.php'; |
|
| 74 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-39-1.php'; |
|
| 75 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-40-1.php'; |
|
| 76 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-40-2.php'; |
|
| 77 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-41-0.php'; |
|
| 78 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-42-0.php'; |
|
| 79 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-44-1.php'; |
|
| 80 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-44-4.php'; |
|
| 81 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-45-0.php'; |
|
| 82 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-45-1.php'; |
|
| 83 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-50-1.php'; |
|
| 52 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install.php'; |
|
| 53 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-1-0-0.php'; |
|
| 54 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-10-0.php'; |
|
| 55 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-12-0.php'; |
|
| 56 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-14-0.php'; |
|
| 57 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-15-0.php'; |
|
| 58 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-18-0.php'; |
|
| 59 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-18-3.php'; |
|
| 60 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-19-5.php'; |
|
| 61 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-20-0.php'; |
|
| 62 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-23-4.php'; |
|
| 63 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-24-2.php'; |
|
| 64 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-all-entity-types.php'; |
|
| 65 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-package-type.php'; |
|
| 66 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-25-0.php'; |
|
| 67 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-27-0.php'; |
|
| 68 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-27-1.php'; |
|
| 69 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-28-0.php'; |
|
| 70 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-32-0.php'; |
|
| 71 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-33-9.php'; |
|
| 72 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-36-0.php'; |
|
| 73 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-38-5.php'; |
|
| 74 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-39-1.php'; |
|
| 75 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-40-1.php'; |
|
| 76 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-40-2.php'; |
|
| 77 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-41-0.php'; |
|
| 78 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-42-0.php'; |
|
| 79 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-44-1.php'; |
|
| 80 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-44-4.php'; |
|
| 81 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-45-0.php'; |
|
| 82 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-45-1.php'; |
|
| 83 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-50-1.php'; |
|
| 84 | 84 | |
| 85 | 85 | // Get the install services. |
| 86 | 86 | $this->installs = array( |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | ); |
| 134 | 134 | self::$instance = $this; |
| 135 | 135 | |
| 136 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 136 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
| 137 | 137 | |
| 138 | - add_action( 'init', array( $this, 'install' ) ); |
|
| 138 | + add_action('init', array($this, 'install')); |
|
| 139 | 139 | |
| 140 | 140 | } |
| 141 | 141 | |
@@ -161,30 +161,30 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | $version = null; |
| 163 | 163 | |
| 164 | - if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
| 165 | - set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
| 164 | + if ($this->install_required() && false === get_transient('_wl_installing')) { |
|
| 165 | + set_transient('_wl_installing', true, 5 * MINUTE_IN_SECONDS); |
|
| 166 | 166 | /** @var Wordlift_Install $install */ |
| 167 | - foreach ( $this->installs as $install ) { |
|
| 167 | + foreach ($this->installs as $install) { |
|
| 168 | 168 | // Get the install version. |
| 169 | 169 | $version = $install->get_version(); |
| 170 | 170 | |
| 171 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 172 | - || $install->must_install() ) { |
|
| 173 | - $class_name = get_class( $install ); |
|
| 171 | + if (version_compare($version, $this->get_current_version(), '>') |
|
| 172 | + || $install->must_install()) { |
|
| 173 | + $class_name = get_class($install); |
|
| 174 | 174 | |
| 175 | - $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
| 175 | + $this->log->info("Current version is {$this->get_current_version()}, installing $class_name..."); |
|
| 176 | 176 | // Install version. |
| 177 | 177 | $install->install(); |
| 178 | 178 | |
| 179 | - $this->log->info( "$class_name installed." ); |
|
| 179 | + $this->log->info("$class_name installed."); |
|
| 180 | 180 | |
| 181 | 181 | // Bump the version. |
| 182 | - update_option( 'wl_db_version', $version ); |
|
| 182 | + update_option('wl_db_version', $version); |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
| 187 | - @delete_transient( '_wl_installing' ); |
|
| 187 | + @delete_transient('_wl_installing'); |
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | private function install_required() { |
| 194 | 194 | |
| 195 | 195 | /** @var Wordlift_Install $install */ |
| 196 | - foreach ( $this->installs as $install ) { |
|
| 196 | + foreach ($this->installs as $install) { |
|
| 197 | 197 | // Get the install version. |
| 198 | 198 | $version = $install->get_version(); |
| 199 | 199 | |
| 200 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 201 | - || $install->must_install() ) { |
|
| 200 | + if (version_compare($version, $this->get_current_version(), '>') |
|
| 201 | + || $install->must_install()) { |
|
| 202 | 202 | return true; |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @return type |
| 213 | 213 | */ |
| 214 | 214 | private function get_current_version() { |
| 215 | - return get_option( 'wl_db_version', '0.0.0' ); |
|
| 215 | + return get_option('wl_db_version', '0.0.0'); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param WP_REST_Request $request |
| 40 | 40 | * @param Cursor $cursor |
| 41 | 41 | */ |
| 42 | - public function __construct( $request, $cursor, $cursor_sort, $limit ) { |
|
| 42 | + public function __construct($request, $cursor, $cursor_sort, $limit) { |
|
| 43 | 43 | global $wpdb; |
| 44 | 44 | |
| 45 | 45 | $this->request = $request; |
@@ -81,35 +81,35 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | // The `sql` is prepared in each delegated function in this class. |
| 83 | 83 | // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
| 84 | - $items = $wpdb->get_results( $this->sql ); |
|
| 84 | + $items = $wpdb->get_results($this->sql); |
|
| 85 | 85 | |
| 86 | - $sort = ( $this->sort === 'ASC' ? SORT_ASC : SORT_DESC ); |
|
| 87 | - array_multisort( array_column( $items, $this->cursor_sort->get_sort_property() ), $sort, $items ); |
|
| 86 | + $sort = ($this->sort === 'ASC' ? SORT_ASC : SORT_DESC); |
|
| 87 | + array_multisort(array_column($items, $this->cursor_sort->get_sort_property()), $sort, $items); |
|
| 88 | 88 | |
| 89 | 89 | return $items; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | private function post_types() { |
| 93 | - $post_types = $this->request->has_param( 'post_types' ) |
|
| 94 | - ? (array) $this->request->get_param( 'post_types' ) |
|
| 95 | - : array( 'post', 'page' ); |
|
| 96 | - $value = array_map( 'esc_sql', $post_types ); |
|
| 97 | - $this->sql .= " AND p.post_type IN ( '" . implode( "', '", $value ) . "' )"; |
|
| 93 | + $post_types = $this->request->has_param('post_types') |
|
| 94 | + ? (array) $this->request->get_param('post_types') |
|
| 95 | + : array('post', 'page'); |
|
| 96 | + $value = array_map('esc_sql', $post_types); |
|
| 97 | + $this->sql .= " AND p.post_type IN ( '".implode("', '", $value)."' )"; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | private function limit() { |
| 101 | - $value = is_numeric( $this->limit ) ? $this->limit : 10; |
|
| 102 | - $this->sql .= ' LIMIT ' . esc_sql( $value ); |
|
| 101 | + $value = is_numeric($this->limit) ? $this->limit : 10; |
|
| 102 | + $this->sql .= ' LIMIT '.esc_sql($value); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | private function has_match() { |
| 106 | - if ( ! $this->request->has_param( 'has_match' ) ) { |
|
| 106 | + if ( ! $this->request->has_param('has_match')) { |
|
| 107 | 107 | return; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $value = (bool) $this->request->get_param( 'has_match' ); |
|
| 110 | + $value = (bool) $this->request->get_param('has_match'); |
|
| 111 | 111 | |
| 112 | - if ( $value ) { |
|
| 112 | + if ($value) { |
|
| 113 | 113 | $this->sql .= ' AND e.about_jsonld IS NOT NULL'; |
| 114 | 114 | } else { |
| 115 | 115 | $this->sql .= ' AND e.about_jsonld IS NULL'; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | private function sort() { |
| 120 | - switch ( $this->direction . '$' . $this->sort ) { |
|
| 120 | + switch ($this->direction.'$'.$this->sort) { |
|
| 121 | 121 | case 'ASCENDING$ASC': |
| 122 | 122 | case 'DESCENDING$DESC': |
| 123 | 123 | $sort = 'ASC'; |
@@ -128,15 +128,15 @@ discard block |
||
| 128 | 128 | break; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $this->sql .= ' ORDER BY t.' . $this->sortby . ' ' . $sort; |
|
| 131 | + $this->sql .= ' ORDER BY t.'.$this->sortby.' '.$sort; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | private function cursor() { |
| 135 | - if ( ! isset( $this->position ) ) { |
|
| 135 | + if ( ! isset($this->position)) { |
|
| 136 | 136 | return; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - switch ( $this->direction . '$' . $this->sort ) { |
|
| 139 | + switch ($this->direction.'$'.$this->sort) { |
|
| 140 | 140 | case 'ASCENDING$ASC': |
| 141 | 141 | case 'DESCENDING$DESC': |
| 142 | 142 | $condition = '>'; |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | break; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $condition .= ( $this->element === 'INCLUDED' ? '=' : '' ); |
|
| 150 | + $condition .= ($this->element === 'INCLUDED' ? '=' : ''); |
|
| 151 | 151 | global $wpdb; |
| 152 | 152 | // We control the vars in this method. |
| 153 | 153 | // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
| 154 | - $this->sql .= $wpdb->prepare( ' AND t.' . esc_sql( $this->sortby ) . ' ' . $condition . ' %s', $this->position ); |
|
| 154 | + $this->sql .= $wpdb->prepare(' AND t.'.esc_sql($this->sortby).' '.$condition.' %s', $this->position); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | private function set_sort() { |
@@ -162,30 +162,30 @@ discard block |
||
| 162 | 162 | 'occurrences' => 'occurrences_count', |
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | - $value = $this->request->has_param( 'sort' ) |
|
| 166 | - ? $this->request->get_param( 'sort' ) |
|
| 165 | + $value = $this->request->has_param('sort') |
|
| 166 | + ? $this->request->get_param('sort') |
|
| 167 | 167 | : '+term_name'; |
| 168 | 168 | |
| 169 | - $sortby = substr( $value, 1 ); |
|
| 170 | - $this->sortby = isset( $sortby_to_col[ $sortby ] ) ? $sortby_to_col[ $sortby ] : $sortby; |
|
| 171 | - $this->sort = substr( $value, 0, 1 ) === '+' ? 'ASC' : 'DESC'; |
|
| 169 | + $sortby = substr($value, 1); |
|
| 170 | + $this->sortby = isset($sortby_to_col[$sortby]) ? $sortby_to_col[$sortby] : $sortby; |
|
| 171 | + $this->sort = substr($value, 0, 1) === '+' ? 'ASC' : 'DESC'; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | private function term_contains() { |
| 175 | - if ( ! $this->request->has_param( 'term_contains' ) ) { |
|
| 175 | + if ( ! $this->request->has_param('term_contains')) { |
|
| 176 | 176 | return; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | global $wpdb; |
| 180 | - $value = $this->request->get_param( 'term_contains' ); |
|
| 181 | - $this->sql .= $wpdb->prepare( ' and t.name LIKE %s', '%' . esc_sql( $value ) . '%' ); |
|
| 180 | + $value = $this->request->get_param('term_contains'); |
|
| 181 | + $this->sql .= $wpdb->prepare(' and t.name LIKE %s', '%'.esc_sql($value).'%'); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | private function taxonomies() { |
| 185 | - $taxonomies = $this->request->has_param( 'taxonomies' ) |
|
| 186 | - ? (array) $this->request->get_param( 'taxonomies' ) |
|
| 187 | - : array( 'post_tag', 'category' ); |
|
| 188 | - $value = array_map( 'esc_sql', $taxonomies ); |
|
| 189 | - $this->sql .= " AND tt.taxonomy IN ( '" . implode( "', '", $value ) . "' )"; |
|
| 185 | + $taxonomies = $this->request->has_param('taxonomies') |
|
| 186 | + ? (array) $this->request->get_param('taxonomies') |
|
| 187 | + : array('post_tag', 'category'); |
|
| 188 | + $value = array_map('esc_sql', $taxonomies); |
|
| 189 | + $this->sql .= " AND tt.taxonomy IN ( '".implode("', '", $value)."' )"; |
|
| 190 | 190 | } |
| 191 | 191 | } |