@@ -7,14 +7,14 @@ |
||
7 | 7 | */ |
8 | 8 | class Wordlift_Install_3_40_2 extends Wordlift_Install { |
9 | 9 | |
10 | - /** |
|
11 | - * {@inheritdoc} |
|
12 | - */ |
|
13 | - protected static $version = '3.40.2'; |
|
10 | + /** |
|
11 | + * {@inheritdoc} |
|
12 | + */ |
|
13 | + protected static $version = '3.40.2'; |
|
14 | 14 | |
15 | - public function install() { |
|
16 | - if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
17 | - wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
18 | - } |
|
19 | - } |
|
15 | + public function install() { |
|
16 | + if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
17 | + wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
18 | + } |
|
19 | + } |
|
20 | 20 | } |
@@ -13,8 +13,8 @@ |
||
13 | 13 | protected static $version = '3.40.2'; |
14 | 14 | |
15 | 15 | public function install() { |
16 | - if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
17 | - wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
16 | + if ( ! wp_next_scheduled('wl_daily_cron')) { |
|
17 | + wp_schedule_event(time(), 'daily', 'wl_daily_cron'); |
|
18 | 18 | } |
19 | 19 | } |
20 | 20 | } |
@@ -18,181 +18,181 @@ |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Install_Service { |
20 | 20 | |
21 | - /** |
|
22 | - * A {@link Wordlift_Log_Service} instance. |
|
23 | - * |
|
24 | - * @since 3.18.0 |
|
25 | - * @access private |
|
26 | - * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
27 | - */ |
|
28 | - private $log; |
|
29 | - |
|
30 | - /** |
|
31 | - * The singleton instance. |
|
32 | - * |
|
33 | - * @since 3.18.0 |
|
34 | - * @access private |
|
35 | - * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance. |
|
36 | - */ |
|
37 | - private static $instance; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var array |
|
41 | - */ |
|
42 | - private $installs; |
|
43 | - |
|
44 | - /** |
|
45 | - * Wordlift_Install_Service constructor. |
|
46 | - * |
|
47 | - * @since 3.18.0 |
|
48 | - */ |
|
49 | - public function __construct() { |
|
50 | - |
|
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 | - |
|
78 | - // Get the install services. |
|
79 | - $this->installs = array( |
|
80 | - new Wordlift_Install_1_0_0(), |
|
81 | - new Wordlift_Install_3_10_0(), |
|
82 | - new Wordlift_Install_3_12_0(), |
|
83 | - new Wordlift_Install_3_14_0(), |
|
84 | - new Wordlift_Install_3_15_0(), |
|
85 | - new Wordlift_Install_3_18_0(), |
|
86 | - new Wordlift_Install_3_18_3(), |
|
87 | - new Wordlift_Install_3_19_5(), |
|
88 | - new Wordlift_Install_3_20_0(), |
|
89 | - |
|
90 | - /* |
|
21 | + /** |
|
22 | + * A {@link Wordlift_Log_Service} instance. |
|
23 | + * |
|
24 | + * @since 3.18.0 |
|
25 | + * @access private |
|
26 | + * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
27 | + */ |
|
28 | + private $log; |
|
29 | + |
|
30 | + /** |
|
31 | + * The singleton instance. |
|
32 | + * |
|
33 | + * @since 3.18.0 |
|
34 | + * @access private |
|
35 | + * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance. |
|
36 | + */ |
|
37 | + private static $instance; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var array |
|
41 | + */ |
|
42 | + private $installs; |
|
43 | + |
|
44 | + /** |
|
45 | + * Wordlift_Install_Service constructor. |
|
46 | + * |
|
47 | + * @since 3.18.0 |
|
48 | + */ |
|
49 | + public function __construct() { |
|
50 | + |
|
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 | + |
|
78 | + // Get the install services. |
|
79 | + $this->installs = array( |
|
80 | + new Wordlift_Install_1_0_0(), |
|
81 | + new Wordlift_Install_3_10_0(), |
|
82 | + new Wordlift_Install_3_12_0(), |
|
83 | + new Wordlift_Install_3_14_0(), |
|
84 | + new Wordlift_Install_3_15_0(), |
|
85 | + new Wordlift_Install_3_18_0(), |
|
86 | + new Wordlift_Install_3_18_3(), |
|
87 | + new Wordlift_Install_3_19_5(), |
|
88 | + new Wordlift_Install_3_20_0(), |
|
89 | + |
|
90 | + /* |
|
91 | 91 | * This should be enabled with #852. |
92 | 92 | */ |
93 | - new Wordlift_Install_Package_Type(), |
|
94 | - new Wordlift_Install_3_23_4(), |
|
95 | - new Wordlift_Install_3_24_2(), |
|
96 | - new Wordlift_Install_3_25_0(), |
|
97 | - new Wordlift_Install_3_27_0(), |
|
98 | - new Wordlift_Install_3_27_1(), |
|
99 | - new Wordlift_Install_3_28_0(), |
|
100 | - // Add column to represent term |
|
101 | - new Wordlift_Install_3_32_0(), |
|
102 | - // Add the entities table. |
|
103 | - new Wordlift_Install_3_33_9(), |
|
104 | - // When woocommerce extension installed, acf4so should be installed automatically. |
|
105 | - new Wordlift_Install_3_36_0(), |
|
106 | - |
|
107 | - new Wordlift_Install_3_38_5(), |
|
108 | - new Wordlift_Install_3_39_1(), |
|
109 | - |
|
110 | - // See #1621. |
|
111 | - new Wordlift_Install_3_40_1(), |
|
112 | - new Wordlift_Install_3_40_2(), |
|
113 | - ); |
|
114 | - self::$instance = $this; |
|
115 | - |
|
116 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
117 | - |
|
118 | - add_action( 'init', array( $this, 'install' ) ); |
|
119 | - |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * Get the singleton instance. |
|
124 | - * |
|
125 | - * @since 3.18.0 |
|
126 | - */ |
|
127 | - public static function get_instance() { |
|
128 | - |
|
129 | - return self::$instance; |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * Loop thought all versions and install the updates. |
|
134 | - * |
|
135 | - * @return void |
|
136 | - * @since 3.18.0 |
|
137 | - * |
|
138 | - * @since 3.20.0 use a transient to avoid concurrent installation calls. |
|
139 | - */ |
|
140 | - public function install() { |
|
141 | - |
|
142 | - $version = null; |
|
143 | - |
|
144 | - if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
145 | - set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
146 | - /** @var Wordlift_Install $install */ |
|
147 | - foreach ( $this->installs as $install ) { |
|
148 | - // Get the install version. |
|
149 | - $version = $install->get_version(); |
|
150 | - |
|
151 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
152 | - || $install->must_install() ) { |
|
153 | - $class_name = get_class( $install ); |
|
154 | - |
|
155 | - $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
156 | - // Install version. |
|
157 | - $install->install(); |
|
158 | - |
|
159 | - $this->log->info( "$class_name installed." ); |
|
160 | - |
|
161 | - // Bump the version. |
|
162 | - update_option( 'wl_db_version', $version ); |
|
163 | - } |
|
164 | - } |
|
165 | - |
|
166 | - // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
167 | - @delete_transient( '_wl_installing' ); |
|
168 | - |
|
169 | - } |
|
170 | - |
|
171 | - } |
|
172 | - |
|
173 | - private function install_required() { |
|
174 | - |
|
175 | - /** @var Wordlift_Install $install */ |
|
176 | - foreach ( $this->installs as $install ) { |
|
177 | - // Get the install version. |
|
178 | - $version = $install->get_version(); |
|
179 | - |
|
180 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
181 | - || $install->must_install() ) { |
|
182 | - return true; |
|
183 | - } |
|
184 | - } |
|
185 | - |
|
186 | - return false; |
|
187 | - } |
|
188 | - |
|
189 | - /** |
|
190 | - * Retrieve the current db version. |
|
191 | - * |
|
192 | - * @return type |
|
193 | - */ |
|
194 | - private function get_current_version() { |
|
195 | - return get_option( 'wl_db_version', '0.0.0' ); |
|
196 | - } |
|
93 | + new Wordlift_Install_Package_Type(), |
|
94 | + new Wordlift_Install_3_23_4(), |
|
95 | + new Wordlift_Install_3_24_2(), |
|
96 | + new Wordlift_Install_3_25_0(), |
|
97 | + new Wordlift_Install_3_27_0(), |
|
98 | + new Wordlift_Install_3_27_1(), |
|
99 | + new Wordlift_Install_3_28_0(), |
|
100 | + // Add column to represent term |
|
101 | + new Wordlift_Install_3_32_0(), |
|
102 | + // Add the entities table. |
|
103 | + new Wordlift_Install_3_33_9(), |
|
104 | + // When woocommerce extension installed, acf4so should be installed automatically. |
|
105 | + new Wordlift_Install_3_36_0(), |
|
106 | + |
|
107 | + new Wordlift_Install_3_38_5(), |
|
108 | + new Wordlift_Install_3_39_1(), |
|
109 | + |
|
110 | + // See #1621. |
|
111 | + new Wordlift_Install_3_40_1(), |
|
112 | + new Wordlift_Install_3_40_2(), |
|
113 | + ); |
|
114 | + self::$instance = $this; |
|
115 | + |
|
116 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
117 | + |
|
118 | + add_action( 'init', array( $this, 'install' ) ); |
|
119 | + |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * Get the singleton instance. |
|
124 | + * |
|
125 | + * @since 3.18.0 |
|
126 | + */ |
|
127 | + public static function get_instance() { |
|
128 | + |
|
129 | + return self::$instance; |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Loop thought all versions and install the updates. |
|
134 | + * |
|
135 | + * @return void |
|
136 | + * @since 3.18.0 |
|
137 | + * |
|
138 | + * @since 3.20.0 use a transient to avoid concurrent installation calls. |
|
139 | + */ |
|
140 | + public function install() { |
|
141 | + |
|
142 | + $version = null; |
|
143 | + |
|
144 | + if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
145 | + set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
146 | + /** @var Wordlift_Install $install */ |
|
147 | + foreach ( $this->installs as $install ) { |
|
148 | + // Get the install version. |
|
149 | + $version = $install->get_version(); |
|
150 | + |
|
151 | + if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
152 | + || $install->must_install() ) { |
|
153 | + $class_name = get_class( $install ); |
|
154 | + |
|
155 | + $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
156 | + // Install version. |
|
157 | + $install->install(); |
|
158 | + |
|
159 | + $this->log->info( "$class_name installed." ); |
|
160 | + |
|
161 | + // Bump the version. |
|
162 | + update_option( 'wl_db_version', $version ); |
|
163 | + } |
|
164 | + } |
|
165 | + |
|
166 | + // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
167 | + @delete_transient( '_wl_installing' ); |
|
168 | + |
|
169 | + } |
|
170 | + |
|
171 | + } |
|
172 | + |
|
173 | + private function install_required() { |
|
174 | + |
|
175 | + /** @var Wordlift_Install $install */ |
|
176 | + foreach ( $this->installs as $install ) { |
|
177 | + // Get the install version. |
|
178 | + $version = $install->get_version(); |
|
179 | + |
|
180 | + if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
181 | + || $install->must_install() ) { |
|
182 | + return true; |
|
183 | + } |
|
184 | + } |
|
185 | + |
|
186 | + return false; |
|
187 | + } |
|
188 | + |
|
189 | + /** |
|
190 | + * Retrieve the current db version. |
|
191 | + * |
|
192 | + * @return type |
|
193 | + */ |
|
194 | + private function get_current_version() { |
|
195 | + return get_option( 'wl_db_version', '0.0.0' ); |
|
196 | + } |
|
197 | 197 | |
198 | 198 | } |
@@ -49,31 +49,31 @@ 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'; |
|
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 | 77 | |
78 | 78 | // Get the install services. |
79 | 79 | $this->installs = array( |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | ); |
114 | 114 | self::$instance = $this; |
115 | 115 | |
116 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
116 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
117 | 117 | |
118 | - add_action( 'init', array( $this, 'install' ) ); |
|
118 | + add_action('init', array($this, 'install')); |
|
119 | 119 | |
120 | 120 | } |
121 | 121 | |
@@ -141,30 +141,30 @@ discard block |
||
141 | 141 | |
142 | 142 | $version = null; |
143 | 143 | |
144 | - if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
145 | - set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
144 | + if ($this->install_required() && false === get_transient('_wl_installing')) { |
|
145 | + set_transient('_wl_installing', true, 5 * MINUTE_IN_SECONDS); |
|
146 | 146 | /** @var Wordlift_Install $install */ |
147 | - foreach ( $this->installs as $install ) { |
|
147 | + foreach ($this->installs as $install) { |
|
148 | 148 | // Get the install version. |
149 | 149 | $version = $install->get_version(); |
150 | 150 | |
151 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
152 | - || $install->must_install() ) { |
|
153 | - $class_name = get_class( $install ); |
|
151 | + if (version_compare($version, $this->get_current_version(), '>') |
|
152 | + || $install->must_install()) { |
|
153 | + $class_name = get_class($install); |
|
154 | 154 | |
155 | - $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
155 | + $this->log->info("Current version is {$this->get_current_version()}, installing $class_name..."); |
|
156 | 156 | // Install version. |
157 | 157 | $install->install(); |
158 | 158 | |
159 | - $this->log->info( "$class_name installed." ); |
|
159 | + $this->log->info("$class_name installed."); |
|
160 | 160 | |
161 | 161 | // Bump the version. |
162 | - update_option( 'wl_db_version', $version ); |
|
162 | + update_option('wl_db_version', $version); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | 166 | // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
167 | - @delete_transient( '_wl_installing' ); |
|
167 | + @delete_transient('_wl_installing'); |
|
168 | 168 | |
169 | 169 | } |
170 | 170 | |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | private function install_required() { |
174 | 174 | |
175 | 175 | /** @var Wordlift_Install $install */ |
176 | - foreach ( $this->installs as $install ) { |
|
176 | + foreach ($this->installs as $install) { |
|
177 | 177 | // Get the install version. |
178 | 178 | $version = $install->get_version(); |
179 | 179 | |
180 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
181 | - || $install->must_install() ) { |
|
180 | + if (version_compare($version, $this->get_current_version(), '>') |
|
181 | + || $install->must_install()) { |
|
182 | 182 | return true; |
183 | 183 | } |
184 | 184 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @return type |
193 | 193 | */ |
194 | 194 | private function get_current_version() { |
195 | - return get_option( 'wl_db_version', '0.0.0' ); |
|
195 | + return get_option('wl_db_version', '0.0.0'); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | } |
@@ -6,22 +6,22 @@ |
||
6 | 6 | |
7 | 7 | class Include_Exclude_API { |
8 | 8 | |
9 | - /** |
|
10 | - * @var Api_Service |
|
11 | - */ |
|
12 | - private $api_service; |
|
9 | + /** |
|
10 | + * @var Api_Service |
|
11 | + */ |
|
12 | + private $api_service; |
|
13 | 13 | |
14 | - public function __construct( Api_Service $api_service ) { |
|
15 | - $this->api_service = $api_service; |
|
16 | - } |
|
14 | + public function __construct( Api_Service $api_service ) { |
|
15 | + $this->api_service = $api_service; |
|
16 | + } |
|
17 | 17 | |
18 | - public function update( $payload ) { |
|
19 | - $this->api_service->request( |
|
20 | - 'PUT', |
|
21 | - '/accounts/me/include-excludes', |
|
22 | - array( 'content-type' => 'application/json' ), |
|
23 | - $payload |
|
24 | - ); |
|
25 | - } |
|
18 | + public function update( $payload ) { |
|
19 | + $this->api_service->request( |
|
20 | + 'PUT', |
|
21 | + '/accounts/me/include-excludes', |
|
22 | + array( 'content-type' => 'application/json' ), |
|
23 | + $payload |
|
24 | + ); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | } |
@@ -11,15 +11,15 @@ |
||
11 | 11 | */ |
12 | 12 | private $api_service; |
13 | 13 | |
14 | - public function __construct( Api_Service $api_service ) { |
|
14 | + public function __construct(Api_Service $api_service) { |
|
15 | 15 | $this->api_service = $api_service; |
16 | 16 | } |
17 | 17 | |
18 | - public function update( $payload ) { |
|
18 | + public function update($payload) { |
|
19 | 19 | $this->api_service->request( |
20 | 20 | 'PUT', |
21 | 21 | '/accounts/me/include-excludes', |
22 | - array( 'content-type' => 'application/json' ), |
|
22 | + array('content-type' => 'application/json'), |
|
23 | 23 | $payload |
24 | 24 | ); |
25 | 25 | } |
@@ -6,42 +6,42 @@ |
||
6 | 6 | use Wordlift\Modules\Include_Exclude_Push_Config\Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
7 | 7 | |
8 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
9 | - exit; |
|
9 | + exit; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // Bail out if the feature isn't enabled. |
13 | 13 | if ( ! apply_filters( 'wl_feature__enable__include-exclude', false ) ) { // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
14 | - return; |
|
14 | + return; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
18 | - require_once __DIR__ . '/vendor/autoload.php'; |
|
18 | + require_once __DIR__ . '/vendor/autoload.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | function __wl_include_exclude_push_config() { |
22 | - // Get the configuration and bail out if empty. |
|
23 | - $config = get_option( 'wl_exclude_include_urls_settings', array() ); |
|
24 | - if ( ! is_array( $config ) || empty( $config ) || ! isset( $config['include_exclude'] ) || ! isset( $config['urls'] ) ) { |
|
25 | - return; |
|
26 | - } |
|
27 | - |
|
28 | - // Map the configuration to the payload. |
|
29 | - $payload = array_map( function ( $item ) use ( $config ) { |
|
30 | - return array( |
|
31 | - 'url' => $item, |
|
32 | - 'flag' => strtoupper( $config['include_exclude'] ) |
|
33 | - ); |
|
34 | - }, $config['url'] ); |
|
35 | - |
|
36 | - // Load the service. |
|
37 | - $container_builder = new ContainerBuilder(); |
|
38 | - $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
39 | - $loader->load( 'services.yml' ); |
|
40 | - $container_builder->compile(); |
|
41 | - |
|
42 | - /** @var Include_Exclude_API $api */ |
|
43 | - $api = $container_builder->get( 'Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API' ); |
|
44 | - $api->update( $payload ); |
|
22 | + // Get the configuration and bail out if empty. |
|
23 | + $config = get_option( 'wl_exclude_include_urls_settings', array() ); |
|
24 | + if ( ! is_array( $config ) || empty( $config ) || ! isset( $config['include_exclude'] ) || ! isset( $config['urls'] ) ) { |
|
25 | + return; |
|
26 | + } |
|
27 | + |
|
28 | + // Map the configuration to the payload. |
|
29 | + $payload = array_map( function ( $item ) use ( $config ) { |
|
30 | + return array( |
|
31 | + 'url' => $item, |
|
32 | + 'flag' => strtoupper( $config['include_exclude'] ) |
|
33 | + ); |
|
34 | + }, $config['url'] ); |
|
35 | + |
|
36 | + // Load the service. |
|
37 | + $container_builder = new ContainerBuilder(); |
|
38 | + $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
39 | + $loader->load( 'services.yml' ); |
|
40 | + $container_builder->compile(); |
|
41 | + |
|
42 | + /** @var Include_Exclude_API $api */ |
|
43 | + $api = $container_builder->get( 'Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API' ); |
|
44 | + $api->update( $payload ); |
|
45 | 45 | |
46 | 46 | } |
47 | 47 |
@@ -5,52 +5,52 @@ |
||
5 | 5 | use Wordlift\Modules\Include_Exclude_Push_Config\Symfony\Component\DependencyInjection\ContainerBuilder; |
6 | 6 | use Wordlift\Modules\Include_Exclude_Push_Config\Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
7 | 7 | |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if ( ! defined('ABSPATH')) { |
|
9 | 9 | exit; |
10 | 10 | } |
11 | 11 | |
12 | 12 | // Bail out if the feature isn't enabled. |
13 | -if ( ! apply_filters( 'wl_feature__enable__include-exclude', false ) ) { // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
13 | +if ( ! apply_filters('wl_feature__enable__include-exclude', false)) { // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | -if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
|
18 | - require_once __DIR__ . '/vendor/autoload.php'; |
|
17 | +if (file_exists(__DIR__.'/vendor/autoload.php')) { |
|
18 | + require_once __DIR__.'/vendor/autoload.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | function __wl_include_exclude_push_config() { |
22 | 22 | // Get the configuration and bail out if empty. |
23 | - $config = get_option( 'wl_exclude_include_urls_settings', array() ); |
|
24 | - if ( ! is_array( $config ) || empty( $config ) || ! isset( $config['include_exclude'] ) || ! isset( $config['urls'] ) ) { |
|
23 | + $config = get_option('wl_exclude_include_urls_settings', array()); |
|
24 | + if ( ! is_array($config) || empty($config) || ! isset($config['include_exclude']) || ! isset($config['urls'])) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | |
28 | 28 | // Map the configuration to the payload. |
29 | - $payload = array_map( function ( $item ) use ( $config ) { |
|
29 | + $payload = array_map(function($item) use ($config) { |
|
30 | 30 | return array( |
31 | 31 | 'url' => $item, |
32 | - 'flag' => strtoupper( $config['include_exclude'] ) |
|
32 | + 'flag' => strtoupper($config['include_exclude']) |
|
33 | 33 | ); |
34 | - }, $config['url'] ); |
|
34 | + }, $config['url']); |
|
35 | 35 | |
36 | 36 | // Load the service. |
37 | 37 | $container_builder = new ContainerBuilder(); |
38 | - $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
39 | - $loader->load( 'services.yml' ); |
|
38 | + $loader = new YamlFileLoader($container_builder, new FileLocator(__DIR__)); |
|
39 | + $loader->load('services.yml'); |
|
40 | 40 | $container_builder->compile(); |
41 | 41 | |
42 | 42 | /** @var Include_Exclude_API $api */ |
43 | - $api = $container_builder->get( 'Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API' ); |
|
44 | - $api->update( $payload ); |
|
43 | + $api = $container_builder->get('Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API'); |
|
44 | + $api->update($payload); |
|
45 | 45 | |
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Fires after the value of a specific option has been successfully updated. |
50 | 50 | */ |
51 | -add_action( 'update_option_wl_exclude_include_urls_settings', '__wl_include_exclude_push_config', 10, 0 ); |
|
51 | +add_action('update_option_wl_exclude_include_urls_settings', '__wl_include_exclude_push_config', 10, 0); |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Fires daily. |
55 | 55 | */ |
56 | -add_action( 'wl_daily_cron', '__wl_include_exclude_push_config', 10, 0 ); |
|
56 | +add_action('wl_daily_cron', '__wl_include_exclude_push_config', 10, 0); |
@@ -16,97 +16,97 @@ |
||
16 | 16 | $wp_constants = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-constants.json' ), true ); |
17 | 17 | |
18 | 18 | return array( |
19 | - // The prefix configuration. If a non null value is be used, a random prefix |
|
20 | - // will be generated instead. |
|
21 | - // |
|
22 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#prefix |
|
23 | - 'prefix' => 'Wordlift\Modules\Include_Exclude_Push_Config', |
|
19 | + // The prefix configuration. If a non null value is be used, a random prefix |
|
20 | + // will be generated instead. |
|
21 | + // |
|
22 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#prefix |
|
23 | + 'prefix' => 'Wordlift\Modules\Include_Exclude_Push_Config', |
|
24 | 24 | |
25 | - // By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working |
|
26 | - // directory. You can however define which files should be scoped by defining a collection of Finders in the |
|
27 | - // following configuration key. |
|
28 | - // |
|
29 | - // This configuration entry is completely ignored when using Box. |
|
30 | - // |
|
31 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#finders-and-paths |
|
32 | - 'finders' => array( |
|
33 | - Finder::create() |
|
34 | - ->files() |
|
35 | - ->ignoreVCS( true ) |
|
36 | - ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' ) |
|
37 | - ->exclude( |
|
38 | - array( |
|
39 | - 'doc', |
|
40 | - 'test', |
|
41 | - 'test_old', |
|
42 | - 'tests', |
|
43 | - 'Tests', |
|
44 | - 'vendor-bin', |
|
45 | - ) |
|
46 | - ) |
|
47 | - ->in( |
|
48 | - array( |
|
49 | - 'vendor/cweagans/composer-patches', |
|
50 | - 'vendor/mcaskill/composer-exclude-files', |
|
51 | - 'vendor/psr/container', |
|
52 | - 'vendor/symfony/config', |
|
53 | - 'vendor/symfony/dependency-injection', |
|
54 | - 'vendor/symfony/filesystem', |
|
55 | - 'vendor/symfony/polyfill-ctype', |
|
56 | - 'vendor/symfony/polyfill-php73', |
|
57 | - 'vendor/symfony/polyfill-php80', |
|
58 | - 'vendor/symfony/yaml', |
|
59 | - ) |
|
60 | - ), |
|
25 | + // By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working |
|
26 | + // directory. You can however define which files should be scoped by defining a collection of Finders in the |
|
27 | + // following configuration key. |
|
28 | + // |
|
29 | + // This configuration entry is completely ignored when using Box. |
|
30 | + // |
|
31 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#finders-and-paths |
|
32 | + 'finders' => array( |
|
33 | + Finder::create() |
|
34 | + ->files() |
|
35 | + ->ignoreVCS( true ) |
|
36 | + ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' ) |
|
37 | + ->exclude( |
|
38 | + array( |
|
39 | + 'doc', |
|
40 | + 'test', |
|
41 | + 'test_old', |
|
42 | + 'tests', |
|
43 | + 'Tests', |
|
44 | + 'vendor-bin', |
|
45 | + ) |
|
46 | + ) |
|
47 | + ->in( |
|
48 | + array( |
|
49 | + 'vendor/cweagans/composer-patches', |
|
50 | + 'vendor/mcaskill/composer-exclude-files', |
|
51 | + 'vendor/psr/container', |
|
52 | + 'vendor/symfony/config', |
|
53 | + 'vendor/symfony/dependency-injection', |
|
54 | + 'vendor/symfony/filesystem', |
|
55 | + 'vendor/symfony/polyfill-ctype', |
|
56 | + 'vendor/symfony/polyfill-php73', |
|
57 | + 'vendor/symfony/polyfill-php80', |
|
58 | + 'vendor/symfony/yaml', |
|
59 | + ) |
|
60 | + ), |
|
61 | 61 | |
62 | - // Symfony mbstring polyfill. |
|
63 | - Finder::create() |
|
64 | - ->files() |
|
65 | - ->ignoreVCS( true ) |
|
66 | - ->ignoreDotFiles( true ) |
|
67 | - ->name( '/\.*.php8?/' ) |
|
68 | - ->in( 'vendor/symfony/polyfill-mbstring/Resources' ) |
|
69 | - ->append( |
|
70 | - array( |
|
71 | - 'vendor/symfony/polyfill-mbstring/Mbstring.php', |
|
72 | - 'vendor/symfony/polyfill-mbstring/composer.json', |
|
73 | - ) |
|
74 | - ), |
|
62 | + // Symfony mbstring polyfill. |
|
63 | + Finder::create() |
|
64 | + ->files() |
|
65 | + ->ignoreVCS( true ) |
|
66 | + ->ignoreDotFiles( true ) |
|
67 | + ->name( '/\.*.php8?/' ) |
|
68 | + ->in( 'vendor/symfony/polyfill-mbstring/Resources' ) |
|
69 | + ->append( |
|
70 | + array( |
|
71 | + 'vendor/symfony/polyfill-mbstring/Mbstring.php', |
|
72 | + 'vendor/symfony/polyfill-mbstring/composer.json', |
|
73 | + ) |
|
74 | + ), |
|
75 | 75 | |
76 | - Finder::create()->append( |
|
77 | - array( |
|
78 | - 'composer.json', |
|
79 | - ) |
|
80 | - ), |
|
81 | - ), |
|
76 | + Finder::create()->append( |
|
77 | + array( |
|
78 | + 'composer.json', |
|
79 | + ) |
|
80 | + ), |
|
81 | + ), |
|
82 | 82 | |
83 | - // List of excluded files, i.e. files for which the content will be left untouched. |
|
84 | - // Paths are relative to the configuration file unless if they are already absolute |
|
85 | - // |
|
86 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
87 | - 'exclude-files' => array(), |
|
83 | + // List of excluded files, i.e. files for which the content will be left untouched. |
|
84 | + // Paths are relative to the configuration file unless if they are already absolute |
|
85 | + // |
|
86 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
87 | + 'exclude-files' => array(), |
|
88 | 88 | |
89 | - // When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the |
|
90 | - // original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited |
|
91 | - // support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your |
|
92 | - // heart contents. |
|
93 | - // |
|
94 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
95 | - 'patchers' => array(), |
|
89 | + // When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the |
|
90 | + // original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited |
|
91 | + // support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your |
|
92 | + // heart contents. |
|
93 | + // |
|
94 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
95 | + 'patchers' => array(), |
|
96 | 96 | |
97 | - // List of symbols to consider internal i.e. to leave untouched. |
|
98 | - // |
|
99 | - // For more information see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#excluded-symbols |
|
100 | - 'exclude-namespaces' => array( |
|
101 | - // 'Acme\Foo' // The Acme\Foo namespace (and sub-namespaces) |
|
102 | - // '~^PHPUnit\\\\Framework$~', // The whole namespace PHPUnit\Framework (but not sub-namespaces) |
|
103 | - // '~^$~', // The root namespace only |
|
104 | - // '', // Any namespace |
|
105 | - ), |
|
106 | - 'exclude-classes' => $wp_classes, |
|
97 | + // List of symbols to consider internal i.e. to leave untouched. |
|
98 | + // |
|
99 | + // For more information see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#excluded-symbols |
|
100 | + 'exclude-namespaces' => array( |
|
101 | + // 'Acme\Foo' // The Acme\Foo namespace (and sub-namespaces) |
|
102 | + // '~^PHPUnit\\\\Framework$~', // The whole namespace PHPUnit\Framework (but not sub-namespaces) |
|
103 | + // '~^$~', // The root namespace only |
|
104 | + // '', // Any namespace |
|
105 | + ), |
|
106 | + 'exclude-classes' => $wp_classes, |
|
107 | 107 | |
108 | - 'exclude-functions' => $wp_functions, |
|
108 | + 'exclude-functions' => $wp_functions, |
|
109 | 109 | |
110 | - 'exclude-constants' => $wp_constants, |
|
110 | + 'exclude-constants' => $wp_constants, |
|
111 | 111 | |
112 | 112 | ); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types=1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | use Isolated\Symfony\Component\Finder\Finder; |
6 | 6 | |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | // to auto-load any code here: it can result in a conflict or even corrupt |
12 | 12 | // the PHP-Scoper analysis. |
13 | 13 | |
14 | -$wp_classes = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-classes.json' ), true ); |
|
15 | -$wp_functions = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-functions.json' ), true ); |
|
16 | -$wp_constants = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-constants.json' ), true ); |
|
14 | +$wp_classes = json_decode(file_get_contents('vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-classes.json'), true); |
|
15 | +$wp_functions = json_decode(file_get_contents('vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-functions.json'), true); |
|
16 | +$wp_constants = json_decode(file_get_contents('vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-constants.json'), true); |
|
17 | 17 | |
18 | 18 | return array( |
19 | 19 | // The prefix configuration. If a non null value is be used, a random prefix |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | 'finders' => array( |
33 | 33 | Finder::create() |
34 | 34 | ->files() |
35 | - ->ignoreVCS( true ) |
|
36 | - ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' ) |
|
35 | + ->ignoreVCS(true) |
|
36 | + ->notName('/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/') |
|
37 | 37 | ->exclude( |
38 | 38 | array( |
39 | 39 | 'doc', |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | // Symfony mbstring polyfill. |
63 | 63 | Finder::create() |
64 | 64 | ->files() |
65 | - ->ignoreVCS( true ) |
|
66 | - ->ignoreDotFiles( true ) |
|
67 | - ->name( '/\.*.php8?/' ) |
|
68 | - ->in( 'vendor/symfony/polyfill-mbstring/Resources' ) |
|
65 | + ->ignoreVCS(true) |
|
66 | + ->ignoreDotFiles(true) |
|
67 | + ->name('/\.*.php8?/') |
|
68 | + ->in('vendor/symfony/polyfill-mbstring/Resources') |
|
69 | 69 | ->append( |
70 | 70 | array( |
71 | 71 | 'vendor/symfony/polyfill-mbstring/Mbstring.php', |
@@ -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 | |
39 | 39 | define( 'WORDLIFT_VERSION', '3.40.1' ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @since 3.33.6 |
48 | 48 | */ |
49 | 49 | if ( ! apply_filters( 'wl_is_enabled', true ) ) { |
50 | - return; |
|
50 | + return; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
@@ -76,33 +76,33 @@ 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'; |
|
84 | - Wordlift_Activator::activate(); |
|
83 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
84 | + Wordlift_Activator::activate(); |
|
85 | 85 | |
86 | - /** |
|
87 | - * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks. |
|
88 | - * |
|
89 | - * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue. |
|
90 | - * @since 3.19.2 |
|
91 | - */ |
|
92 | - Wordlift_Http_Api::activate(); |
|
93 | - |
|
94 | - // Ensure the post type is registered before flushing the rewrite rules. |
|
95 | - Wordlift_Entity_Post_Type_Service::get_instance()->register(); |
|
96 | - flush_rewrite_rules(); |
|
97 | - /** |
|
98 | - * @since 3.27.7 |
|
99 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
100 | - */ |
|
101 | - Top_Entities::activate(); |
|
86 | + /** |
|
87 | + * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks. |
|
88 | + * |
|
89 | + * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue. |
|
90 | + * @since 3.19.2 |
|
91 | + */ |
|
92 | + Wordlift_Http_Api::activate(); |
|
93 | + |
|
94 | + // Ensure the post type is registered before flushing the rewrite rules. |
|
95 | + Wordlift_Entity_Post_Type_Service::get_instance()->register(); |
|
96 | + flush_rewrite_rules(); |
|
97 | + /** |
|
98 | + * @since 3.27.7 |
|
99 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
100 | + */ |
|
101 | + Top_Entities::activate(); |
|
102 | 102 | |
103 | - if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
104 | - wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
105 | - } |
|
103 | + if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
104 | + wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
105 | + } |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | */ |
113 | 113 | function deactivate_wordlift() { |
114 | 114 | |
115 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
116 | - Wordlift_Deactivator::deactivate(); |
|
117 | - Wordlift_Http_Api::deactivate(); |
|
118 | - Ttl_Cache_Cleaner::deactivate(); |
|
119 | - /** |
|
120 | - * @since 3.27.7 |
|
121 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
122 | - */ |
|
123 | - Top_Entities::deactivate(); |
|
124 | - /** |
|
125 | - * @since 3.27.8 |
|
126 | - * Remove notification flag on deactivation. |
|
127 | - */ |
|
128 | - Key_Validation_Notice::remove_notification_flag(); |
|
129 | - flush_rewrite_rules(); |
|
130 | - |
|
131 | - wp_clear_scheduled_hook( 'wl_daily_cron' ); |
|
115 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
116 | + Wordlift_Deactivator::deactivate(); |
|
117 | + Wordlift_Http_Api::deactivate(); |
|
118 | + Ttl_Cache_Cleaner::deactivate(); |
|
119 | + /** |
|
120 | + * @since 3.27.7 |
|
121 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
122 | + */ |
|
123 | + Top_Entities::deactivate(); |
|
124 | + /** |
|
125 | + * @since 3.27.8 |
|
126 | + * Remove notification flag on deactivation. |
|
127 | + */ |
|
128 | + Key_Validation_Notice::remove_notification_flag(); |
|
129 | + flush_rewrite_rules(); |
|
130 | + |
|
131 | + wp_clear_scheduled_hook( 'wl_daily_cron' ); |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
@@ -151,84 +151,84 @@ discard block |
||
151 | 151 | * @since 1.0.0 |
152 | 152 | */ |
153 | 153 | function run_wordlift() { |
154 | - /** |
|
155 | - * Filter: wl_feature__enable__widgets. |
|
156 | - * |
|
157 | - * @param bool whether the widgets needed to be registered, defaults to true. |
|
158 | - * |
|
159 | - * @return bool |
|
160 | - * @since 3.27.6 |
|
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' ); |
|
166 | - } |
|
167 | - add_filter( 'widget_text', 'do_shortcode' ); |
|
168 | - |
|
169 | - /** |
|
170 | - * Filter: wl_feature__enable__analysis |
|
171 | - * |
|
172 | - * @param bool Whether to send api request to analysis or not |
|
173 | - * |
|
174 | - * @return bool |
|
175 | - * @since 3.27.6 |
|
176 | - */ |
|
177 | - if ( apply_filters( 'wl_feature__enable__analysis', true ) ) { |
|
178 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' ); |
|
179 | - } else { |
|
180 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' ); |
|
181 | - } |
|
182 | - |
|
183 | - $plugin = new Wordlift(); |
|
184 | - $plugin->run(); |
|
185 | - |
|
186 | - // Initialize the TTL Cache Cleaner. |
|
187 | - new Ttl_Cache_Cleaner(); |
|
188 | - |
|
189 | - // Load the new Post Adapter. |
|
190 | - new Post_Adapter(); |
|
191 | - |
|
192 | - // Load the API Data Hooks. |
|
193 | - new Api_Data_Hooks(); |
|
194 | - |
|
195 | - add_action( |
|
196 | - 'plugins_loaded', |
|
197 | - function () { |
|
198 | - // All features from registry should be initialized here. |
|
199 | - $features_registry = Features_Registry::get_instance(); |
|
200 | - $features_registry->initialize_all_features(); |
|
201 | - }, |
|
202 | - 5 |
|
203 | - ); |
|
204 | - |
|
205 | - add_action( |
|
206 | - 'plugins_loaded', |
|
207 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
208 | - function () use ( $plugin ) { |
|
209 | - |
|
210 | - new Wordlift_Products_Navigator_Shortcode_REST(); |
|
211 | - |
|
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'; |
|
215 | - |
|
216 | - /* |
|
154 | + /** |
|
155 | + * Filter: wl_feature__enable__widgets. |
|
156 | + * |
|
157 | + * @param bool whether the widgets needed to be registered, defaults to true. |
|
158 | + * |
|
159 | + * @return bool |
|
160 | + * @since 3.27.6 |
|
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' ); |
|
166 | + } |
|
167 | + add_filter( 'widget_text', 'do_shortcode' ); |
|
168 | + |
|
169 | + /** |
|
170 | + * Filter: wl_feature__enable__analysis |
|
171 | + * |
|
172 | + * @param bool Whether to send api request to analysis or not |
|
173 | + * |
|
174 | + * @return bool |
|
175 | + * @since 3.27.6 |
|
176 | + */ |
|
177 | + if ( apply_filters( 'wl_feature__enable__analysis', true ) ) { |
|
178 | + add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' ); |
|
179 | + } else { |
|
180 | + add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' ); |
|
181 | + } |
|
182 | + |
|
183 | + $plugin = new Wordlift(); |
|
184 | + $plugin->run(); |
|
185 | + |
|
186 | + // Initialize the TTL Cache Cleaner. |
|
187 | + new Ttl_Cache_Cleaner(); |
|
188 | + |
|
189 | + // Load the new Post Adapter. |
|
190 | + new Post_Adapter(); |
|
191 | + |
|
192 | + // Load the API Data Hooks. |
|
193 | + new Api_Data_Hooks(); |
|
194 | + |
|
195 | + add_action( |
|
196 | + 'plugins_loaded', |
|
197 | + function () { |
|
198 | + // All features from registry should be initialized here. |
|
199 | + $features_registry = Features_Registry::get_instance(); |
|
200 | + $features_registry->initialize_all_features(); |
|
201 | + }, |
|
202 | + 5 |
|
203 | + ); |
|
204 | + |
|
205 | + add_action( |
|
206 | + 'plugins_loaded', |
|
207 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
208 | + function () use ( $plugin ) { |
|
209 | + |
|
210 | + new Wordlift_Products_Navigator_Shortcode_REST(); |
|
211 | + |
|
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'; |
|
215 | + |
|
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 | - } |
|
231 | - ); |
|
230 | + } |
|
231 | + ); |
|
232 | 232 | |
233 | 233 | } |
234 | 234 | |
@@ -242,45 +242,45 @@ discard block |
||
242 | 242 | */ |
243 | 243 | function wordlift_plugin_autoload_register() { |
244 | 244 | |
245 | - spl_autoload_register( |
|
246 | - function ( $class_name ) { |
|
245 | + spl_autoload_register( |
|
246 | + function ( $class_name ) { |
|
247 | 247 | |
248 | - // Bail out if these are not our classes. |
|
249 | - if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) { |
|
250 | - return false; |
|
251 | - } |
|
248 | + // Bail out if these are not our classes. |
|
249 | + if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) { |
|
250 | + return false; |
|
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 ) ) { |
|
263 | - return false; |
|
264 | - } |
|
262 | + if ( ! file_exists( $full_path ) ) { |
|
263 | + return false; |
|
264 | + } |
|
265 | 265 | |
266 | - require_once $full_path; |
|
266 | + require_once $full_path; |
|
267 | 267 | |
268 | - return true; |
|
269 | - } |
|
270 | - ); |
|
268 | + return true; |
|
269 | + } |
|
270 | + ); |
|
271 | 271 | |
272 | 272 | } |
273 | 273 | |
274 | 274 | function wl_block_categories( $categories ) { |
275 | - return array_merge( |
|
276 | - $categories, |
|
277 | - array( |
|
278 | - array( |
|
279 | - 'slug' => 'wordlift', |
|
280 | - 'title' => __( 'WordLift', 'wordlift' ), |
|
281 | - ), |
|
282 | - ) |
|
283 | - ); |
|
275 | + return array_merge( |
|
276 | + $categories, |
|
277 | + array( |
|
278 | + array( |
|
279 | + 'slug' => 'wordlift', |
|
280 | + 'title' => __( 'WordLift', 'wordlift' ), |
|
281 | + ), |
|
282 | + ) |
|
283 | + ); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | * this has to be removed when removing the legacy fields from the ui. |
289 | 289 | */ |
290 | 290 | function wl_enqueue_leaflet( $in_footer = false ) { |
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 ); |
|
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 ); |
|
294 | 294 | } |
295 | 295 | |
296 | 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 | - 'wl_feature__enable__dataset', |
|
301 | - function ( $value ) { |
|
302 | - return apply_filters( 'wl_features__enable__dataset', $value ); |
|
303 | - } |
|
300 | + 'wl_feature__enable__dataset', |
|
301 | + function ( $value ) { |
|
302 | + return apply_filters( 'wl_features__enable__dataset', $value ); |
|
303 | + } |
|
304 | 304 | ); |
305 | 305 | |
306 | 306 | require_once __DIR__ . '/modules/food-kg/load.php'; |
@@ -32,25 +32,25 @@ 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.40.1' ); |
|
39 | +define('WORDLIFT_VERSION', '3.40.1'); |
|
40 | 40 | |
41 | -require_once __DIR__ . '/modules/common/load.php'; |
|
42 | -require_once __DIR__ . '/modules/include-exclude/load.php'; |
|
41 | +require_once __DIR__.'/modules/common/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,23 +287,23 @@ 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/acf4so/load.php'; |
|
308 | -require_once __DIR__ . '/modules/pods/load.php'; |
|
309 | -require_once __DIR__ . '/modules/include-exclude-push-config/load.php'; |
|
306 | +require_once __DIR__.'/modules/food-kg/load.php'; |
|
307 | +require_once __DIR__.'/modules/acf4so/load.php'; |
|
308 | +require_once __DIR__.'/modules/pods/load.php'; |
|
309 | +require_once __DIR__.'/modules/include-exclude-push-config/load.php'; |