@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * {@inheritdoc} |
| 32 | 32 | */ |
| 33 | - public function render( $atts ) { |
|
| 33 | + public function render($atts) { |
|
| 34 | 34 | |
| 35 | - return Wordlift_AMP_Service::is_amp_endpoint() ? $this->amp_shortcode( $atts ) |
|
| 36 | - : $this->web_shortcode( $atts ); |
|
| 35 | + return Wordlift_AMP_Service::is_amp_endpoint() ? $this->amp_shortcode($atts) |
|
| 36 | + : $this->web_shortcode($atts); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | private function register_block_type() { |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | add_action( |
| 44 | 44 | 'init', |
| 45 | - function () use ( $scope ) { |
|
| 46 | - if ( ! function_exists( 'register_block_type' ) ) { |
|
| 45 | + function() use ($scope) { |
|
| 46 | + if ( ! function_exists('register_block_type')) { |
|
| 47 | 47 | // Gutenberg is not active. |
| 48 | 48 | return; |
| 49 | 49 | } |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | 'wordlift/faceted-search', |
| 53 | 53 | array( |
| 54 | 54 | 'editor_script' => 'wl-block-editor', |
| 55 | - 'render_callback' => function ( $attributes ) use ( $scope ) { |
|
| 55 | + 'render_callback' => function($attributes) use ($scope) { |
|
| 56 | 56 | $attr_code = ''; |
| 57 | - foreach ( $attributes as $key => $value ) { |
|
| 58 | - $attr_code .= $key . '="' . htmlentities( $value ) . '" '; |
|
| 57 | + foreach ($attributes as $key => $value) { |
|
| 58 | + $attr_code .= $key.'="'.htmlentities($value).'" '; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - return '[' . $scope::SHORTCODE . ' ' . $attr_code . ']'; |
|
| 61 | + return '['.$scope::SHORTCODE.' '.$attr_code.']'; |
|
| 62 | 62 | }, |
| 63 | 63 | |
| 64 | 64 | 'attributes' => $scope->get_block_attributes(), |
@@ -77,16 +77,16 @@ discard block |
||
| 77 | 77 | * @return array $shortcode_atts |
| 78 | 78 | * @since 3.20.0 |
| 79 | 79 | */ |
| 80 | - private function make_shortcode_atts( $atts ) { |
|
| 80 | + private function make_shortcode_atts($atts) { |
|
| 81 | 81 | |
| 82 | 82 | // Extract attributes and set default values. |
| 83 | 83 | $shortcode_atts = shortcode_atts( |
| 84 | 84 | array( |
| 85 | - 'title' => __( 'Related articles', 'wordlift' ), |
|
| 86 | - 'limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ), |
|
| 85 | + 'title' => __('Related articles', 'wordlift'), |
|
| 86 | + 'limit' => apply_filters('wl_faceted_search_default_limit', 10), |
|
| 87 | 87 | 'post_id' => '', |
| 88 | 88 | 'template_id' => '', |
| 89 | - 'uniqid' => uniqid( 'wl-faceted-widget-' ), |
|
| 89 | + 'uniqid' => uniqid('wl-faceted-widget-'), |
|
| 90 | 90 | 'post_types' => '', |
| 91 | 91 | ), |
| 92 | 92 | $atts |
@@ -103,34 +103,34 @@ discard block |
||
| 103 | 103 | * @return string Shortcode HTML for web |
| 104 | 104 | * @since 3.20.0 |
| 105 | 105 | */ |
| 106 | - private function web_shortcode( $atts ) { |
|
| 106 | + private function web_shortcode($atts) { |
|
| 107 | 107 | |
| 108 | 108 | // attributes extraction and boolean filtering |
| 109 | - $shortcode_atts = $this->make_shortcode_atts( $atts ); |
|
| 109 | + $shortcode_atts = $this->make_shortcode_atts($atts); |
|
| 110 | 110 | |
| 111 | 111 | // avoid building the widget when no post_id is specified and there is a list of posts. |
| 112 | - if ( empty( $shortcode_atts['post_id'] ) && ! is_singular() ) { |
|
| 112 | + if (empty($shortcode_atts['post_id']) && ! is_singular()) { |
|
| 113 | 113 | return; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $post = ! empty( $shortcode_atts['post_id'] ) ? get_post( intval( sanitize_text_field( $shortcode_atts['post_id'] ) ) ) : get_post(); |
|
| 117 | - $title = esc_attr( sanitize_text_field( $shortcode_atts['title'] ) ); |
|
| 118 | - $template_id = esc_attr( sanitize_text_field( $shortcode_atts['template_id'] ) ); |
|
| 119 | - $limit = esc_attr( sanitize_text_field( $shortcode_atts['limit'] ) ); |
|
| 120 | - $faceted_id = ! empty( $shortcode_atts['uniqid'] ) ? esc_attr( sanitize_text_field( $shortcode_atts['uniqid'] ) ) : uniqid( 'wl-faceted-widget-' ); |
|
| 116 | + $post = ! empty($shortcode_atts['post_id']) ? get_post(intval(sanitize_text_field($shortcode_atts['post_id']))) : get_post(); |
|
| 117 | + $title = esc_attr(sanitize_text_field($shortcode_atts['title'])); |
|
| 118 | + $template_id = esc_attr(sanitize_text_field($shortcode_atts['template_id'])); |
|
| 119 | + $limit = esc_attr(sanitize_text_field($shortcode_atts['limit'])); |
|
| 120 | + $faceted_id = ! empty($shortcode_atts['uniqid']) ? esc_attr(sanitize_text_field($shortcode_atts['uniqid'])) : uniqid('wl-faceted-widget-'); |
|
| 121 | 121 | |
| 122 | - $permalink_structure = get_option( 'permalink_structure' ); |
|
| 123 | - $delimiter = empty( $permalink_structure ) ? '&' : '?'; |
|
| 124 | - $rest_url = $this->get_rest_url( $post, $delimiter, $limit, $shortcode_atts['post_types'] ); |
|
| 125 | - $rest_url = esc_attr( $rest_url ); |
|
| 122 | + $permalink_structure = get_option('permalink_structure'); |
|
| 123 | + $delimiter = empty($permalink_structure) ? '&' : '?'; |
|
| 124 | + $rest_url = $this->get_rest_url($post, $delimiter, $limit, $shortcode_atts['post_types']); |
|
| 125 | + $rest_url = esc_attr($rest_url); |
|
| 126 | 126 | |
| 127 | 127 | // avoid building the widget when no valid $rest_url |
| 128 | - if ( ! $rest_url ) { |
|
| 128 | + if ( ! $rest_url) { |
|
| 129 | 129 | return; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - wp_enqueue_script( 'wordlift-cloud' ); |
|
| 133 | - $template_url = get_rest_url( null, '/wordlift/v1/faceted-search/template' ); |
|
| 132 | + wp_enqueue_script('wordlift-cloud'); |
|
| 133 | + $template_url = get_rest_url(null, '/wordlift/v1/faceted-search/template'); |
|
| 134 | 134 | |
| 135 | 135 | return wp_kses( |
| 136 | 136 | sprintf( |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | data-template-id="%s" |
| 143 | 143 | data-template-url="%s"></div> |
| 144 | 144 | ', |
| 145 | - esc_attr( $faceted_id ), |
|
| 146 | - esc_attr( $rest_url ), |
|
| 147 | - esc_attr( $title ), |
|
| 148 | - esc_attr( $template_id ), |
|
| 149 | - esc_url( $template_url ) |
|
| 145 | + esc_attr($faceted_id), |
|
| 146 | + esc_attr($rest_url), |
|
| 147 | + esc_attr($title), |
|
| 148 | + esc_attr($template_id), |
|
| 149 | + esc_url($template_url) |
|
| 150 | 150 | ), |
| 151 | 151 | array( |
| 152 | 152 | 'div' => array( |
@@ -170,26 +170,26 @@ discard block |
||
| 170 | 170 | * @return string Shortcode HTML for amp |
| 171 | 171 | * @since 3.20.0 |
| 172 | 172 | */ |
| 173 | - private function amp_shortcode( $atts ) { |
|
| 173 | + private function amp_shortcode($atts) { |
|
| 174 | 174 | |
| 175 | 175 | // attributes extraction and boolean filtering |
| 176 | - $shortcode_atts = $this->make_shortcode_atts( $atts ); |
|
| 176 | + $shortcode_atts = $this->make_shortcode_atts($atts); |
|
| 177 | 177 | |
| 178 | 178 | // avoid building the widget when no post_id is specified and there is a list of posts. |
| 179 | - if ( empty( $shortcode_atts['post_id'] ) && ! is_singular() ) { |
|
| 179 | + if (empty($shortcode_atts['post_id']) && ! is_singular()) { |
|
| 180 | 180 | return; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - $post = ! empty( $shortcode_atts['post_id'] ) ? get_post( intval( sanitize_text_field( $shortcode_atts['post_id'] ) ) ) : get_post(); |
|
| 184 | - $title = esc_attr( sanitize_text_field( $shortcode_atts['title'] ) ); |
|
| 185 | - $template_id = esc_attr( sanitize_text_field( $shortcode_atts['template_id'] ) ); |
|
| 186 | - $limit = esc_attr( sanitize_text_field( $shortcode_atts['limit'] ) ); |
|
| 187 | - $faceted_id = ! empty( $shortcode_atts['uniqid'] ) ? esc_attr( sanitize_text_field( $shortcode_atts['uniqid'] ) ) : uniqid( 'wl-faceted-widget-' ); |
|
| 183 | + $post = ! empty($shortcode_atts['post_id']) ? get_post(intval(sanitize_text_field($shortcode_atts['post_id']))) : get_post(); |
|
| 184 | + $title = esc_attr(sanitize_text_field($shortcode_atts['title'])); |
|
| 185 | + $template_id = esc_attr(sanitize_text_field($shortcode_atts['template_id'])); |
|
| 186 | + $limit = esc_attr(sanitize_text_field($shortcode_atts['limit'])); |
|
| 187 | + $faceted_id = ! empty($shortcode_atts['uniqid']) ? esc_attr(sanitize_text_field($shortcode_atts['uniqid'])) : uniqid('wl-faceted-widget-'); |
|
| 188 | 188 | |
| 189 | - $permalink_structure = get_option( 'permalink_structure' ); |
|
| 190 | - $delimiter = empty( $permalink_structure ) ? '&' : '?'; |
|
| 189 | + $permalink_structure = get_option('permalink_structure'); |
|
| 190 | + $delimiter = empty($permalink_structure) ? '&' : '?'; |
|
| 191 | 191 | $rest_url = $post ? rest_url( |
| 192 | - WL_REST_ROUTE_DEFAULT_NAMESPACE . '/faceted-search' . $delimiter . build_query( |
|
| 192 | + WL_REST_ROUTE_DEFAULT_NAMESPACE.'/faceted-search'.$delimiter.build_query( |
|
| 193 | 193 | array( |
| 194 | 194 | 'amp' => 1, |
| 195 | 195 | 'post_id' => $post->ID, |
@@ -199,17 +199,17 @@ discard block |
||
| 199 | 199 | ) : false; |
| 200 | 200 | |
| 201 | 201 | // avoid building the widget when no valid $rest_url |
| 202 | - if ( ! $rest_url ) { |
|
| 202 | + if ( ! $rest_url) { |
|
| 203 | 203 | return; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | // Use a protocol-relative URL as amp-list spec says that URL's protocol must be HTTPS. |
| 207 | 207 | // This is a hackish way, but this works for http and https URLs |
| 208 | - $rest_url = str_replace( array( 'http:', 'https:' ), '', $rest_url ); |
|
| 208 | + $rest_url = str_replace(array('http:', 'https:'), '', $rest_url); |
|
| 209 | 209 | |
| 210 | - if ( empty( $template_id ) ) { |
|
| 211 | - $template_id = 'template-' . $faceted_id; |
|
| 212 | - wp_enqueue_style( 'wordlift-amp-custom', plugin_dir_url( __DIR__ ) . '/css/wordlift-amp-custom.min.css', array(), WORDLIFT_VERSION ); |
|
| 210 | + if (empty($template_id)) { |
|
| 211 | + $template_id = 'template-'.$faceted_id; |
|
| 212 | + wp_enqueue_style('wordlift-amp-custom', plugin_dir_url(__DIR__).'/css/wordlift-amp-custom.min.css', array(), WORDLIFT_VERSION); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | return <<<HTML |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | return array( |
| 285 | 285 | 'title' => array( |
| 286 | 286 | 'type' => 'string', |
| 287 | - 'default' => __( 'Related articles', 'wordlift' ), |
|
| 287 | + 'default' => __('Related articles', 'wordlift'), |
|
| 288 | 288 | ), |
| 289 | 289 | 'template_id' => array( |
| 290 | 290 | 'type' => 'string', |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | ), |
| 301 | 301 | 'limit' => array( |
| 302 | 302 | 'type' => 'number', |
| 303 | - 'default' => apply_filters( 'wl_faceted_search_default_limit', 10 ), |
|
| 303 | + 'default' => apply_filters('wl_faceted_search_default_limit', 10), |
|
| 304 | 304 | ), |
| 305 | 305 | 'preview' => array( |
| 306 | 306 | 'type' => 'boolean', |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | ), |
| 309 | 309 | 'preview_src' => array( |
| 310 | 310 | 'type' => 'string', |
| 311 | - 'default' => WP_CONTENT_URL . '/plugins/wordlift/images/block-previews/faceted-search.png', |
|
| 311 | + 'default' => WP_CONTENT_URL.'/plugins/wordlift/images/block-previews/faceted-search.png', |
|
| 312 | 312 | ), |
| 313 | 313 | 'post_types' => array( |
| 314 | 314 | 'type' => 'string', |
@@ -326,9 +326,9 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @return bool|string |
| 328 | 328 | */ |
| 329 | - public function get_rest_url( $post, $delimiter, $limit, $post_types ) { |
|
| 329 | + public function get_rest_url($post, $delimiter, $limit, $post_types) { |
|
| 330 | 330 | $rest_url = $post ? rest_url( |
| 331 | - WL_REST_ROUTE_DEFAULT_NAMESPACE . '/faceted-search' . $delimiter . build_query( |
|
| 331 | + WL_REST_ROUTE_DEFAULT_NAMESPACE.'/faceted-search'.$delimiter.build_query( |
|
| 332 | 332 | array( |
| 333 | 333 | 'post_id' => $post->ID, |
| 334 | 334 | 'limit' => $limit, |
@@ -32,22 +32,22 @@ 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 | 38 | |
| 39 | -define( 'WORDLIFT_VERSION', '3.38.1' ); |
|
| 39 | +define('WORDLIFT_VERSION', '3.38.1'); |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Filter to disable WLP on any request, defaults to true. |
| 43 | 43 | * |
| 44 | 44 | * @since 3.33.6 |
| 45 | 45 | */ |
| 46 | -if ( ! apply_filters( 'wl_is_enabled', true ) ) { |
|
| 46 | +if ( ! apply_filters('wl_is_enabled', true)) { |
|
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
|
| 50 | +require_once plugin_dir_path(__FILE__).'vendor/autoload.php'; |
|
| 51 | 51 | |
| 52 | 52 | /* |
| 53 | 53 | * We introduce the WordLift autoloader, since we start using classes in namespaces, i.e. Wordlift\Http. |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | wordlift_plugin_autoload_register(); |
| 58 | 58 | |
| 59 | 59 | // Include WordLift constants. |
| 60 | -require_once plugin_dir_path( __FILE__ ) . 'wordlift-constants.php'; |
|
| 60 | +require_once plugin_dir_path(__FILE__).'wordlift-constants.php'; |
|
| 61 | 61 | |
| 62 | 62 | // Load modules. |
| 63 | -require_once plugin_dir_path( __FILE__ ) . 'modules/core/wordlift-core.php'; |
|
| 63 | +require_once plugin_dir_path(__FILE__).'modules/core/wordlift-core.php'; |
|
| 64 | 64 | |
| 65 | -require_once plugin_dir_path( __FILE__ ) . 'deprecations.php'; |
|
| 65 | +require_once plugin_dir_path(__FILE__).'deprecations.php'; |
|
| 66 | 66 | |
| 67 | 67 | // Load early to enable/disable features. |
| 68 | -require_once plugin_dir_path( __FILE__ ) . 'wordlift/features/index.php'; |
|
| 68 | +require_once plugin_dir_path(__FILE__).'wordlift/features/index.php'; |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * The code that runs during plugin activation. |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | function activate_wordlift() { |
| 75 | 75 | |
| 76 | - $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
| 76 | + $log = Wordlift_Log_Service::get_logger('activate_wordlift'); |
|
| 77 | 77 | |
| 78 | - $log->info( 'Activating WordLift...' ); |
|
| 78 | + $log->info('Activating WordLift...'); |
|
| 79 | 79 | |
| 80 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 80 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php'; |
|
| 81 | 81 | Wordlift_Activator::activate(); |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | function deactivate_wordlift() { |
| 106 | 106 | |
| 107 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 107 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php'; |
|
| 108 | 108 | Wordlift_Deactivator::deactivate(); |
| 109 | 109 | Wordlift_Http_Api::deactivate(); |
| 110 | 110 | Ttl_Cache_Cleaner::deactivate(); |
@@ -122,14 +122,14 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -register_activation_hook( __FILE__, 'activate_wordlift' ); |
|
| 126 | -register_deactivation_hook( __FILE__, 'deactivate_wordlift' ); |
|
| 125 | +register_activation_hook(__FILE__, 'activate_wordlift'); |
|
| 126 | +register_deactivation_hook(__FILE__, 'deactivate_wordlift'); |
|
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | 129 | * The core plugin class that is used to define internationalization, |
| 130 | 130 | * admin-specific hooks, and public-facing site hooks. |
| 131 | 131 | */ |
| 132 | -require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php'; |
|
| 132 | +require plugin_dir_path(__FILE__).'includes/class-wordlift.php'; |
|
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * Begins execution of the plugin. |
@@ -149,12 +149,12 @@ discard block |
||
| 149 | 149 | * @return bool |
| 150 | 150 | * @since 3.27.6 |
| 151 | 151 | */ |
| 152 | - if ( apply_filters( 'wl_feature__enable__widgets', true ) ) { |
|
| 153 | - add_action( 'widgets_init', 'wl_register_chord_widget' ); |
|
| 154 | - add_action( 'widgets_init', 'wl_register_geo_widget' ); |
|
| 155 | - add_action( 'widgets_init', 'wl_register_timeline_widget' ); |
|
| 152 | + if (apply_filters('wl_feature__enable__widgets', true)) { |
|
| 153 | + add_action('widgets_init', 'wl_register_chord_widget'); |
|
| 154 | + add_action('widgets_init', 'wl_register_geo_widget'); |
|
| 155 | + add_action('widgets_init', 'wl_register_timeline_widget'); |
|
| 156 | 156 | } |
| 157 | - add_filter( 'widget_text', 'do_shortcode' ); |
|
| 157 | + add_filter('widget_text', 'do_shortcode'); |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * Filter: wl_feature__enable__analysis |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | * @return bool |
| 165 | 165 | * @since 3.27.6 |
| 166 | 166 | */ |
| 167 | - if ( apply_filters( 'wl_feature__enable__analysis', true ) ) { |
|
| 168 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' ); |
|
| 167 | + if (apply_filters('wl_feature__enable__analysis', true)) { |
|
| 168 | + add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_action'); |
|
| 169 | 169 | } else { |
| 170 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' ); |
|
| 170 | + add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action'); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $plugin = new Wordlift(); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | add_action( |
| 186 | 186 | 'plugins_loaded', |
| 187 | - function () { |
|
| 187 | + function() { |
|
| 188 | 188 | // All features from registry should be initialized here. |
| 189 | 189 | $features_registry = Features_Registry::get_instance(); |
| 190 | 190 | $features_registry->initialize_all_features(); |
@@ -195,27 +195,27 @@ discard block |
||
| 195 | 195 | add_action( |
| 196 | 196 | 'plugins_loaded', |
| 197 | 197 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 198 | - function () use ( $plugin ) { |
|
| 198 | + function() use ($plugin) { |
|
| 199 | 199 | |
| 200 | 200 | new Wordlift_Products_Navigator_Shortcode_REST(); |
| 201 | 201 | |
| 202 | 202 | // Register the Dataset module, requires `$api_service`. |
| 203 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php'; |
|
| 204 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php'; |
|
| 203 | + require_once plugin_dir_path(__FILE__).'wordlift/dataset/index.php'; |
|
| 204 | + require_once plugin_dir_path(__FILE__).'wordlift/shipping-data/index.php'; |
|
| 205 | 205 | |
| 206 | 206 | /* |
| 207 | 207 | * Require the Entity annotation cleanup module. |
| 208 | 208 | * |
| 209 | 209 | * @since 3.34.6 |
| 210 | 210 | */ |
| 211 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php'; |
|
| 211 | + require_once plugin_dir_path(__FILE__).'wordlift/cleanup/index.php'; |
|
| 212 | 212 | |
| 213 | 213 | /* |
| 214 | 214 | * Import LOD entities. |
| 215 | 215 | * |
| 216 | 216 | * @since 3.35.0 |
| 217 | 217 | */ |
| 218 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php'; |
|
| 218 | + require_once plugin_dir_path(__FILE__).'wordlift/lod-import/index.php'; |
|
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | ); |
@@ -233,23 +233,23 @@ discard block |
||
| 233 | 233 | function wordlift_plugin_autoload_register() { |
| 234 | 234 | |
| 235 | 235 | spl_autoload_register( |
| 236 | - function ( $class_name ) { |
|
| 236 | + function($class_name) { |
|
| 237 | 237 | |
| 238 | 238 | // Bail out if these are not our classes. |
| 239 | - if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) { |
|
| 239 | + if (0 !== strpos($class_name, 'Wordlift\\')) { |
|
| 240 | 240 | return false; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
| 243 | + $class_name_lc = strtolower(str_replace('_', '-', $class_name)); |
|
| 244 | 244 | |
| 245 | - preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
| 245 | + preg_match('|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches); |
|
| 246 | 246 | |
| 247 | - $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
| 248 | - $file = 'class-' . $matches[2] . '.php'; |
|
| 247 | + $path = str_replace('\\', DIRECTORY_SEPARATOR, $matches[1]); |
|
| 248 | + $file = 'class-'.$matches[2].'.php'; |
|
| 249 | 249 | |
| 250 | - $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file; |
|
| 250 | + $full_path = plugin_dir_path(__FILE__).$path.DIRECTORY_SEPARATOR.$file; |
|
| 251 | 251 | |
| 252 | - if ( ! file_exists( $full_path ) ) { |
|
| 252 | + if ( ! file_exists($full_path)) { |
|
| 253 | 253 | return false; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -261,13 +261,13 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | -function wl_block_categories( $categories ) { |
|
| 264 | +function wl_block_categories($categories) { |
|
| 265 | 265 | return array_merge( |
| 266 | 266 | $categories, |
| 267 | 267 | array( |
| 268 | 268 | array( |
| 269 | 269 | 'slug' => 'wordlift', |
| 270 | - 'title' => __( 'WordLift', 'wordlift' ), |
|
| 270 | + 'title' => __('WordLift', 'wordlift'), |
|
| 271 | 271 | ), |
| 272 | 272 | ) |
| 273 | 273 | ); |
@@ -277,22 +277,22 @@ discard block |
||
| 277 | 277 | * This function is created temporarily to handle the legacy library, |
| 278 | 278 | * this has to be removed when removing the legacy fields from the ui. |
| 279 | 279 | */ |
| 280 | -function wl_enqueue_leaflet( $in_footer = false ) { |
|
| 280 | +function wl_enqueue_leaflet($in_footer = false) { |
|
| 281 | 281 | // Leaflet. |
| 282 | - wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' ); |
|
| 283 | - wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer ); |
|
| 282 | + wp_enqueue_style('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.css', array(), '1.6.0'); |
|
| 283 | + wp_enqueue_script('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | -add_filter( 'block_categories', 'wl_block_categories', 10 ); |
|
| 286 | +add_filter('block_categories', 'wl_block_categories', 10); |
|
| 287 | 287 | |
| 288 | 288 | // Temporary fix for a typo in WooCommerce Extension. |
| 289 | 289 | add_filter( |
| 290 | 290 | 'wl_feature__enable__dataset', |
| 291 | - function ( $value ) { |
|
| 292 | - return apply_filters( 'wl_features__enable__dataset', $value ); |
|
| 291 | + function($value) { |
|
| 292 | + return apply_filters('wl_features__enable__dataset', $value); |
|
| 293 | 293 | } |
| 294 | 294 | ); |
| 295 | 295 | |
| 296 | -require_once __DIR__ . '/modules/food-kg/load.php'; |
|
| 297 | -require_once __DIR__ . '/modules/acf4so/load.php'; |
|
| 298 | -require_once __DIR__ . '/modules/pods/load.php'; |
|
| 296 | +require_once __DIR__.'/modules/food-kg/load.php'; |
|
| 297 | +require_once __DIR__.'/modules/acf4so/load.php'; |
|
| 298 | +require_once __DIR__.'/modules/pods/load.php'; |
|