@@ -4,39 +4,39 @@ |
||
4 | 4 | |
5 | 5 | class Preconditions { |
6 | 6 | |
7 | - /** |
|
8 | - * @var Notices |
|
9 | - */ |
|
10 | - private $notices; |
|
11 | - |
|
12 | - public function __construct( Notices $notices ) { |
|
13 | - $this->notices = $notices; |
|
14 | - } |
|
15 | - |
|
16 | - public function pass() { |
|
17 | - return $this->has_prerequisites() && $this->check_version(); |
|
18 | - } |
|
19 | - |
|
20 | - private function has_prerequisites() { |
|
21 | - return defined( 'WPRM_VERSION' ) |
|
22 | - && class_exists( 'WP_Recipe_Maker' ) |
|
23 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
24 | - && apply_filters( 'wl_feature__enable__food-kg', false ); |
|
25 | - } |
|
26 | - |
|
27 | - private function check_version() { |
|
28 | - $check = version_compare( WPRM_VERSION, '8.1.0', '>=' ) |
|
29 | - && version_compare( WPRM_VERSION, '8.9.3', '<' ); |
|
30 | - |
|
31 | - if ( ! $check ) { |
|
32 | - $this->notices->queue( |
|
33 | - 'warning', |
|
34 | - /* translators: 1: minimum supported WPRM version, 2: maximum supported WPRM version, 3: Detected WP Recipe Maker version. */ |
|
35 | - sprintf( __( 'WordLift Food KG support requires WP Recipe Maker %1$s-%2$s, %3$s found.', 'wordlift' ), '8.1', '8.7', WPRM_VERSION ) |
|
36 | - ); |
|
37 | - } |
|
38 | - |
|
39 | - return $check; |
|
40 | - } |
|
7 | + /** |
|
8 | + * @var Notices |
|
9 | + */ |
|
10 | + private $notices; |
|
11 | + |
|
12 | + public function __construct( Notices $notices ) { |
|
13 | + $this->notices = $notices; |
|
14 | + } |
|
15 | + |
|
16 | + public function pass() { |
|
17 | + return $this->has_prerequisites() && $this->check_version(); |
|
18 | + } |
|
19 | + |
|
20 | + private function has_prerequisites() { |
|
21 | + return defined( 'WPRM_VERSION' ) |
|
22 | + && class_exists( 'WP_Recipe_Maker' ) |
|
23 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
24 | + && apply_filters( 'wl_feature__enable__food-kg', false ); |
|
25 | + } |
|
26 | + |
|
27 | + private function check_version() { |
|
28 | + $check = version_compare( WPRM_VERSION, '8.1.0', '>=' ) |
|
29 | + && version_compare( WPRM_VERSION, '8.9.3', '<' ); |
|
30 | + |
|
31 | + if ( ! $check ) { |
|
32 | + $this->notices->queue( |
|
33 | + 'warning', |
|
34 | + /* translators: 1: minimum supported WPRM version, 2: maximum supported WPRM version, 3: Detected WP Recipe Maker version. */ |
|
35 | + sprintf( __( 'WordLift Food KG support requires WP Recipe Maker %1$s-%2$s, %3$s found.', 'wordlift' ), '8.1', '8.7', WPRM_VERSION ) |
|
36 | + ); |
|
37 | + } |
|
38 | + |
|
39 | + return $check; |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | private $notices; |
11 | 11 | |
12 | - public function __construct( Notices $notices ) { |
|
12 | + public function __construct(Notices $notices) { |
|
13 | 13 | $this->notices = $notices; |
14 | 14 | } |
15 | 15 | |
@@ -18,21 +18,21 @@ discard block |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | private function has_prerequisites() { |
21 | - return defined( 'WPRM_VERSION' ) |
|
22 | - && class_exists( 'WP_Recipe_Maker' ) |
|
21 | + return defined('WPRM_VERSION') |
|
22 | + && class_exists('WP_Recipe_Maker') |
|
23 | 23 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
24 | - && apply_filters( 'wl_feature__enable__food-kg', false ); |
|
24 | + && apply_filters('wl_feature__enable__food-kg', false); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | private function check_version() { |
28 | - $check = version_compare( WPRM_VERSION, '8.1.0', '>=' ) |
|
29 | - && version_compare( WPRM_VERSION, '8.9.3', '<' ); |
|
28 | + $check = version_compare(WPRM_VERSION, '8.1.0', '>=') |
|
29 | + && version_compare(WPRM_VERSION, '8.9.3', '<'); |
|
30 | 30 | |
31 | - if ( ! $check ) { |
|
31 | + if ( ! $check) { |
|
32 | 32 | $this->notices->queue( |
33 | 33 | 'warning', |
34 | 34 | /* translators: 1: minimum supported WPRM version, 2: maximum supported WPRM version, 3: Detected WP Recipe Maker version. */ |
35 | - sprintf( __( 'WordLift Food KG support requires WP Recipe Maker %1$s-%2$s, %3$s found.', 'wordlift' ), '8.1', '8.7', WPRM_VERSION ) |
|
35 | + sprintf(__('WordLift Food KG support requires WP Recipe Maker %1$s-%2$s, %3$s found.', 'wordlift'), '8.1', '8.7', WPRM_VERSION) |
|
36 | 36 | ); |
37 | 37 | } |
38 | 38 |
@@ -20,86 +20,86 @@ |
||
20 | 20 | */ |
21 | 21 | class Post_Id_To_Entity_Transform_Function implements Mappings_Transform_Function { |
22 | 22 | |
23 | - public function __construct() { |
|
23 | + public function __construct() { |
|
24 | 24 | |
25 | - add_filter( 'wl_mappings_transformation_functions', array( $this, 'wl_mappings_transformation_functions' ) ); |
|
25 | + add_filter( 'wl_mappings_transformation_functions', array( $this, 'wl_mappings_transformation_functions' ) ); |
|
26 | 26 | |
27 | - } |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Hook to add ourselves to the list of available transform functions. |
|
31 | - * |
|
32 | - * @param Mappings_Transform_Function[] $value An array of {@link Mappings_Transform_Function}s. |
|
33 | - * |
|
34 | - * @return Mappings_Transform_Function[] An updated array with ourselves too. |
|
35 | - */ |
|
36 | - public function wl_mappings_transformation_functions( $value ) { |
|
29 | + /** |
|
30 | + * Hook to add ourselves to the list of available transform functions. |
|
31 | + * |
|
32 | + * @param Mappings_Transform_Function[] $value An array of {@link Mappings_Transform_Function}s. |
|
33 | + * |
|
34 | + * @return Mappings_Transform_Function[] An updated array with ourselves too. |
|
35 | + */ |
|
36 | + public function wl_mappings_transformation_functions( $value ) { |
|
37 | 37 | |
38 | - $value[] = $this; |
|
38 | + $value[] = $this; |
|
39 | 39 | |
40 | - return $value; |
|
41 | - } |
|
40 | + return $value; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @inheritDoc |
|
45 | - */ |
|
46 | - public function get_name() { |
|
43 | + /** |
|
44 | + * @inheritDoc |
|
45 | + */ |
|
46 | + public function get_name() { |
|
47 | 47 | |
48 | - return 'post_id_to_entity'; |
|
49 | - } |
|
48 | + return 'post_id_to_entity'; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @inheritDoc |
|
53 | - */ |
|
54 | - public function get_label() { |
|
51 | + /** |
|
52 | + * @inheritDoc |
|
53 | + */ |
|
54 | + public function get_label() { |
|
55 | 55 | |
56 | - return __( 'Post ID to Entity', 'wordlift' ); |
|
57 | - } |
|
56 | + return __( 'Post ID to Entity', 'wordlift' ); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * @inheritDoc |
|
61 | - */ |
|
62 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
63 | - public function transform_data( $data, $jsonld, &$references, $post_id ) { |
|
59 | + /** |
|
60 | + * @inheritDoc |
|
61 | + */ |
|
62 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
63 | + public function transform_data( $data, $jsonld, &$references, $post_id ) { |
|
64 | 64 | |
65 | - $ret_val = array(); |
|
66 | - foreach ( (array) $data as $target_post_id ) { |
|
65 | + $ret_val = array(); |
|
66 | + foreach ( (array) $data as $target_post_id ) { |
|
67 | 67 | |
68 | - // We may receive a `WP_Post` here, in which case we want the ID. |
|
69 | - if ( is_a( $target_post_id, '\WP_Post' ) ) { |
|
70 | - $target_post_id = $target_post_id->ID; |
|
71 | - } |
|
68 | + // We may receive a `WP_Post` here, in which case we want the ID. |
|
69 | + if ( is_a( $target_post_id, '\WP_Post' ) ) { |
|
70 | + $target_post_id = $target_post_id->ID; |
|
71 | + } |
|
72 | 72 | |
73 | - // We need a numeric post ID. |
|
74 | - if ( ! is_numeric( $target_post_id ) ) { |
|
73 | + // We need a numeric post ID. |
|
74 | + if ( ! is_numeric( $target_post_id ) ) { |
|
75 | 75 | |
76 | - $class_name = is_object( $target_post_id ) ? get_class( $target_post_id ) : 'unknown, maybe a string'; |
|
76 | + $class_name = is_object( $target_post_id ) ? get_class( $target_post_id ) : 'unknown, maybe a string'; |
|
77 | 77 | |
78 | - // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
79 | - @header( "X-Post-Id-To-Entity-Transform-Function: $class_name is not numeric." ); |
|
78 | + // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
79 | + @header( "X-Post-Id-To-Entity-Transform-Function: $class_name is not numeric." ); |
|
80 | 80 | |
81 | - continue; |
|
82 | - } |
|
81 | + continue; |
|
82 | + } |
|
83 | 83 | |
84 | - // Get the entity by URI. |
|
85 | - $entity_url = Wordpress_Content_Service::get_instance() |
|
86 | - ->get_entity_id( Wordpress_Content_Id::create_post( $target_post_id ) ); |
|
84 | + // Get the entity by URI. |
|
85 | + $entity_url = Wordpress_Content_Service::get_instance() |
|
86 | + ->get_entity_id( Wordpress_Content_Id::create_post( $target_post_id ) ); |
|
87 | 87 | |
88 | - // No entity URL. |
|
89 | - if ( empty( $entity_url ) ) { |
|
90 | - // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
91 | - @header( "X-Post-Id-To-Entity-Transform-Function: entity url for $data not found." ); |
|
88 | + // No entity URL. |
|
89 | + if ( empty( $entity_url ) ) { |
|
90 | + // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
91 | + @header( "X-Post-Id-To-Entity-Transform-Function: entity url for $data not found." ); |
|
92 | 92 | |
93 | - continue; |
|
94 | - } |
|
93 | + continue; |
|
94 | + } |
|
95 | 95 | |
96 | - // Add the entity among the references using the post ID. |
|
97 | - $references[] = (int) $target_post_id; |
|
96 | + // Add the entity among the references using the post ID. |
|
97 | + $references[] = (int) $target_post_id; |
|
98 | 98 | |
99 | - $ret_val[] = array( '@id' => $entity_url ); |
|
100 | - } |
|
99 | + $ret_val[] = array( '@id' => $entity_url ); |
|
100 | + } |
|
101 | 101 | |
102 | - return $ret_val; |
|
103 | - } |
|
102 | + return $ret_val; |
|
103 | + } |
|
104 | 104 | |
105 | 105 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct() { |
24 | 24 | |
25 | - add_filter( 'wl_mappings_transformation_functions', array( $this, 'wl_mappings_transformation_functions' ) ); |
|
25 | + add_filter('wl_mappings_transformation_functions', array($this, 'wl_mappings_transformation_functions')); |
|
26 | 26 | |
27 | 27 | } |
28 | 28 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return Mappings_Transform_Function[] An updated array with ourselves too. |
35 | 35 | */ |
36 | - public function wl_mappings_transformation_functions( $value ) { |
|
36 | + public function wl_mappings_transformation_functions($value) { |
|
37 | 37 | |
38 | 38 | $value[] = $this; |
39 | 39 | |
@@ -53,42 +53,42 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function get_label() { |
55 | 55 | |
56 | - return __( 'Post ID to Entity', 'wordlift' ); |
|
56 | + return __('Post ID to Entity', 'wordlift'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @inheritDoc |
61 | 61 | */ |
62 | 62 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
63 | - public function transform_data( $data, $jsonld, &$references, $post_id ) { |
|
63 | + public function transform_data($data, $jsonld, &$references, $post_id) { |
|
64 | 64 | |
65 | 65 | $ret_val = array(); |
66 | - foreach ( (array) $data as $target_post_id ) { |
|
66 | + foreach ((array) $data as $target_post_id) { |
|
67 | 67 | |
68 | 68 | // We may receive a `WP_Post` here, in which case we want the ID. |
69 | - if ( is_a( $target_post_id, '\WP_Post' ) ) { |
|
69 | + if (is_a($target_post_id, '\WP_Post')) { |
|
70 | 70 | $target_post_id = $target_post_id->ID; |
71 | 71 | } |
72 | 72 | |
73 | 73 | // We need a numeric post ID. |
74 | - if ( ! is_numeric( $target_post_id ) ) { |
|
74 | + if ( ! is_numeric($target_post_id)) { |
|
75 | 75 | |
76 | - $class_name = is_object( $target_post_id ) ? get_class( $target_post_id ) : 'unknown, maybe a string'; |
|
76 | + $class_name = is_object($target_post_id) ? get_class($target_post_id) : 'unknown, maybe a string'; |
|
77 | 77 | |
78 | 78 | // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
79 | - @header( "X-Post-Id-To-Entity-Transform-Function: $class_name is not numeric." ); |
|
79 | + @header("X-Post-Id-To-Entity-Transform-Function: $class_name is not numeric."); |
|
80 | 80 | |
81 | 81 | continue; |
82 | 82 | } |
83 | 83 | |
84 | 84 | // Get the entity by URI. |
85 | 85 | $entity_url = Wordpress_Content_Service::get_instance() |
86 | - ->get_entity_id( Wordpress_Content_Id::create_post( $target_post_id ) ); |
|
86 | + ->get_entity_id(Wordpress_Content_Id::create_post($target_post_id)); |
|
87 | 87 | |
88 | 88 | // No entity URL. |
89 | - if ( empty( $entity_url ) ) { |
|
89 | + if (empty($entity_url)) { |
|
90 | 90 | // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
91 | - @header( "X-Post-Id-To-Entity-Transform-Function: entity url for $data not found." ); |
|
91 | + @header("X-Post-Id-To-Entity-Transform-Function: entity url for $data not found."); |
|
92 | 92 | |
93 | 93 | continue; |
94 | 94 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // Add the entity among the references using the post ID. |
97 | 97 | $references[] = (int) $target_post_id; |
98 | 98 | |
99 | - $ret_val[] = array( '@id' => $entity_url ); |
|
99 | + $ret_val[] = array('@id' => $entity_url); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | return $ret_val; |
@@ -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.46.0-0' ); |
|
34 | +define('WORDLIFT_PLUGIN_FILE', __FILE__); |
|
35 | +define('WORDLIFT_VERSION', '3.46.0-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__ ) . 'wordlift/features/index.php'; |
|
71 | +require_once plugin_dir_path(__FILE__).'wordlift/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__ ) . 'wordlift/dataset/index.php'; |
|
214 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php'; |
|
213 | + require_once plugin_dir_path(__FILE__).'wordlift/dataset/index.php'; |
|
214 | + require_once plugin_dir_path(__FILE__).'wordlift/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__ ) . 'wordlift/cleanup/index.php'; |
|
221 | + require_once plugin_dir_path(__FILE__).'wordlift/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__ ) . 'wordlift/lod-import/index.php'; |
|
228 | + require_once plugin_dir_path(__FILE__).'wordlift/lod-import/index.php'; |
|
229 | 229 | |
230 | 230 | } |
231 | 231 | ); |
@@ -243,23 +243,23 @@ 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( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
255 | + preg_match('|^(?:(.*)\\\\)?(.+?)$|', $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__ ) . $path . DIRECTORY_SEPARATOR . $file; |
|
260 | + $full_path = plugin_dir_path(__FILE__).$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 | |
@@ -271,13 +271,13 @@ discard block |
||
271 | 271 | |
272 | 272 | } |
273 | 273 | |
274 | -function wl_block_categories( $categories ) { |
|
274 | +function wl_block_categories($categories) { |
|
275 | 275 | return array_merge( |
276 | 276 | $categories, |
277 | 277 | array( |
278 | 278 | array( |
279 | 279 | 'slug' => 'wordlift', |
280 | - 'title' => __( 'WordLift', 'wordlift' ), |
|
280 | + 'title' => __('WordLift', 'wordlift'), |
|
281 | 281 | ), |
282 | 282 | ) |
283 | 283 | ); |
@@ -287,48 +287,48 @@ discard block |
||
287 | 287 | * This function is created temporarily to handle the legacy library, |
288 | 288 | * this has to be removed when removing the legacy fields from the ui. |
289 | 289 | */ |
290 | -function wl_enqueue_leaflet( $in_footer = false ) { |
|
290 | +function wl_enqueue_leaflet($in_footer = false) { |
|
291 | 291 | // Leaflet. |
292 | - wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' ); |
|
293 | - wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer ); |
|
292 | + wp_enqueue_style('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.css', array(), '1.6.0'); |
|
293 | + wp_enqueue_script('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer); |
|
294 | 294 | } |
295 | 295 | |
296 | -add_filter( 'block_categories', 'wl_block_categories', 10 ); |
|
296 | +add_filter('block_categories', 'wl_block_categories', 10); |
|
297 | 297 | |
298 | 298 | // Temporary fix for a typo in WooCommerce Extension. |
299 | 299 | add_filter( |
300 | 300 | 'wl_feature__enable__dataset', |
301 | - function ( $value ) { |
|
302 | - return apply_filters( 'wl_features__enable__dataset', $value ); |
|
301 | + function($value) { |
|
302 | + return apply_filters('wl_features__enable__dataset', $value); |
|
303 | 303 | } |
304 | 304 | ); |
305 | 305 | |
306 | -require_once __DIR__ . '/modules/food-kg/load.php'; |
|
307 | -require_once __DIR__ . '/modules/gardening-kg/load.php'; |
|
308 | -require_once __DIR__ . '/modules/acf4so/load.php'; |
|
309 | -require_once __DIR__ . '/modules/dashboard/load.php'; |
|
310 | -require_once __DIR__ . '/modules/pods/load.php'; |
|
311 | -require_once __DIR__ . '/modules/include-exclude-push-config/load.php'; |
|
312 | -require_once __DIR__ . '/modules/super-resolution/load.php'; |
|
313 | -require_once __DIR__ . '/modules/redeem-code/load.php'; |
|
314 | -require_once __DIR__ . '/modules/raptive-setup/load.php'; |
|
315 | - |
|
316 | -function _wl_update_plugins_raptive_domain( $update, $plugin_data, $plugin_file ) { |
|
306 | +require_once __DIR__.'/modules/food-kg/load.php'; |
|
307 | +require_once __DIR__.'/modules/gardening-kg/load.php'; |
|
308 | +require_once __DIR__.'/modules/acf4so/load.php'; |
|
309 | +require_once __DIR__.'/modules/dashboard/load.php'; |
|
310 | +require_once __DIR__.'/modules/pods/load.php'; |
|
311 | +require_once __DIR__.'/modules/include-exclude-push-config/load.php'; |
|
312 | +require_once __DIR__.'/modules/super-resolution/load.php'; |
|
313 | +require_once __DIR__.'/modules/redeem-code/load.php'; |
|
314 | +require_once __DIR__.'/modules/raptive-setup/load.php'; |
|
315 | + |
|
316 | +function _wl_update_plugins_raptive_domain($update, $plugin_data, $plugin_file) { |
|
317 | 317 | // Bail out if it's not our plugin. |
318 | 318 | $update_uri = $plugin_data['UpdateURI']; |
319 | - if ( 'wordlift/wordlift.php' !== $plugin_file || ! isset( $update_uri ) ) { |
|
319 | + if ('wordlift/wordlift.php' !== $plugin_file || ! isset($update_uri)) { |
|
320 | 320 | return $update; |
321 | 321 | } |
322 | 322 | |
323 | - $response = wp_remote_get( "$update_uri?nocache=" . time() ); |
|
323 | + $response = wp_remote_get("$update_uri?nocache=".time()); |
|
324 | 324 | |
325 | - if ( is_wp_error( $response ) ) { |
|
325 | + if (is_wp_error($response)) { |
|
326 | 326 | return $update; |
327 | 327 | } |
328 | 328 | |
329 | 329 | try { |
330 | - return json_decode( wp_remote_retrieve_body( $response ) ); |
|
331 | - } catch ( Exception $e ) { |
|
330 | + return json_decode(wp_remote_retrieve_body($response)); |
|
331 | + } catch (Exception $e) { |
|
332 | 332 | return $update; |
333 | 333 | } |
334 | 334 | } |