@@ -9,14 +9,14 @@ |
||
9 | 9 | /* |
10 | 10 | * If uninstall was not called from WordPress, then exit |
11 | 11 | */ |
12 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
12 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | -define( 'ALGOWOO_DB_OPTION', '_algolia_woo_indexer' ); |
|
16 | +define('ALGOWOO_DB_OPTION', '_algolia_woo_indexer'); |
|
17 | 17 | |
18 | -delete_option( ALGOWOO_DB_OPTION . '_application_id' ); |
|
19 | -delete_option( ALGOWOO_DB_OPTION . '_admin_api_key' ); |
|
20 | -delete_option( ALGOWOO_DB_OPTION . '_index_name' ); |
|
21 | -delete_option( ALGOWOO_DB_OPTION . '_index_in_stock' ); |
|
22 | -delete_option( ALGOWOO_DB_OPTION . '_automatically_send_new_products' ); |
|
18 | +delete_option(ALGOWOO_DB_OPTION . '_application_id'); |
|
19 | +delete_option(ALGOWOO_DB_OPTION . '_admin_api_key'); |
|
20 | +delete_option(ALGOWOO_DB_OPTION . '_index_name'); |
|
21 | +delete_option(ALGOWOO_DB_OPTION . '_index_in_stock'); |
|
22 | +delete_option(ALGOWOO_DB_OPTION . '_automatically_send_new_products'); |
@@ -18,31 +18,31 @@ |
||
18 | 18 | /** |
19 | 19 | * Abort if this file is called directly |
20 | 20 | */ |
21 | -if ( ! defined( 'ABSPATH' ) ) { |
|
21 | +if ( ! defined('ABSPATH')) { |
|
22 | 22 | exit; |
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Main class file |
27 | 27 | */ |
28 | -require_once plugin_dir_path( __FILE__ ) . '/classes/class-algolia-woo-indexer.php'; |
|
28 | +require_once plugin_dir_path(__FILE__) . '/classes/class-algolia-woo-indexer.php'; |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Class for checking plugin requirements |
32 | 32 | */ |
33 | -require_once plugin_dir_path( __FILE__ ) . '/classes/class-check-requirements.php'; |
|
33 | +require_once plugin_dir_path(__FILE__) . '/classes/class-check-requirements.php'; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Class for verifying nonces |
37 | 37 | */ |
38 | -require_once plugin_dir_path( __FILE__ ) . '/classes/class-verify-nonces.php'; |
|
38 | +require_once plugin_dir_path(__FILE__) . '/classes/class-verify-nonces.php'; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Class for sending products |
42 | 42 | */ |
43 | -require_once plugin_dir_path( __FILE__ ) . '/classes/class-send-products.php'; |
|
43 | +require_once plugin_dir_path(__FILE__) . '/classes/class-send-products.php'; |
|
44 | 44 | |
45 | 45 | $algowooindexer = \Algowoo\Algolia_Woo_Indexer::get_instance(); |
46 | 46 | |
47 | -register_activation_hook( __FILE__, array( $algowooindexer, 'activate_plugin' ) ); |
|
48 | -register_deactivation_hook( __FILE__, array( $algowooindexer, 'deactivate_plugin' ) ); |
|
47 | +register_activation_hook(__FILE__, array($algowooindexer, 'activate_plugin')); |
|
48 | +register_deactivation_hook(__FILE__, array($algowooindexer, 'deactivate_plugin')); |
@@ -16,18 +16,18 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * Abort if this file is called directly |
18 | 18 | */ |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Include plugin file if function is_plugin_active does not exist |
25 | 25 | */ |
26 | -if ( ! function_exists( 'is_plugin_active' ) ) { |
|
26 | +if ( ! function_exists('is_plugin_active')) { |
|
27 | 27 | require_once ABSPATH . '/wp-admin/includes/plugin.php'; |
28 | 28 | } |
29 | 29 | |
30 | -if ( ! class_exists( 'Algolia_Woo_Indexer' ) ) { |
|
30 | +if ( ! class_exists('Algolia_Woo_Indexer')) { |
|
31 | 31 | /** |
32 | 32 | * Algolia WooIndexer main class |
33 | 33 | */ |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @see https://developer.wordpress.org/reference/functions/register_setting/ |
73 | 73 | */ |
74 | - if ( is_admin() ) { |
|
74 | + if (is_admin()) { |
|
75 | 75 | $arguments = array( |
76 | 76 | 'type' => 'string', |
77 | 77 | 'sanitize_callback' => 'settings_fields_validate_options', |
78 | 78 | 'default' => null, |
79 | 79 | ); |
80 | - register_setting( 'algolia_woo_options', 'algolia_woo_options', $arguments ); |
|
80 | + register_setting('algolia_woo_options', 'algolia_woo_options', $arguments); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Make sure we reference the instance of the current class by using self::get_instance() |
@@ -90,35 +90,35 @@ discard block |
||
90 | 90 | */ |
91 | 91 | add_settings_section( |
92 | 92 | 'algolia_woo_indexer_main', |
93 | - esc_html__( 'Algolia Woo Plugin Settings', 'algolia-woo-indexer' ), |
|
94 | - array( $algowooindexer, 'algolia_woo_indexer_section_text' ), |
|
93 | + esc_html__('Algolia Woo Plugin Settings', 'algolia-woo-indexer'), |
|
94 | + array($algowooindexer, 'algolia_woo_indexer_section_text'), |
|
95 | 95 | 'algolia_woo_indexer' |
96 | 96 | ); |
97 | 97 | add_settings_field( |
98 | 98 | 'algolia_woo_indexer_application_id', |
99 | - esc_html__( 'Application ID', 'algolia-woo-indexer' ), |
|
100 | - array( $algowooindexer, 'algolia_woo_indexer_application_id_output' ), |
|
99 | + esc_html__('Application ID', 'algolia-woo-indexer'), |
|
100 | + array($algowooindexer, 'algolia_woo_indexer_application_id_output'), |
|
101 | 101 | 'algolia_woo_indexer', |
102 | 102 | 'algolia_woo_indexer_main' |
103 | 103 | ); |
104 | 104 | add_settings_field( |
105 | 105 | 'algolia_woo_indexer_admin_api_key', |
106 | - esc_html__( 'Admin API Key', 'algolia-woo-indexer' ), |
|
107 | - array( $algowooindexer, 'algolia_woo_indexer_admin_api_key_output' ), |
|
106 | + esc_html__('Admin API Key', 'algolia-woo-indexer'), |
|
107 | + array($algowooindexer, 'algolia_woo_indexer_admin_api_key_output'), |
|
108 | 108 | 'algolia_woo_indexer', |
109 | 109 | 'algolia_woo_indexer_main' |
110 | 110 | ); |
111 | 111 | add_settings_field( |
112 | 112 | 'algolia_woo_indexer_index_name', |
113 | - esc_html__( 'Index name (will be created if not existing)', 'algolia-woo-indexer' ), |
|
114 | - array( $algowooindexer, 'algolia_woo_indexer_index_name_output' ), |
|
113 | + esc_html__('Index name (will be created if not existing)', 'algolia-woo-indexer'), |
|
114 | + array($algowooindexer, 'algolia_woo_indexer_index_name_output'), |
|
115 | 115 | 'algolia_woo_indexer', |
116 | 116 | 'algolia_woo_indexer_main' |
117 | 117 | ); |
118 | 118 | add_settings_field( |
119 | 119 | 'algolia_woo_indexer_automatically_send_new_products', |
120 | - esc_html__( 'Automatically index new products', 'algolia-woo-indexer' ), |
|
121 | - array( $algowooindexer, 'algolia_woo_indexer_automatically_send_new_products_output' ), |
|
120 | + esc_html__('Automatically index new products', 'algolia-woo-indexer'), |
|
121 | + array($algowooindexer, 'algolia_woo_indexer_automatically_send_new_products_output'), |
|
122 | 122 | 'algolia_woo_indexer', |
123 | 123 | 'algolia_woo_indexer_main' |
124 | 124 | ); |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | * @return void |
134 | 134 | */ |
135 | 135 | public static function algolia_woo_indexer_admin_api_key_output() { |
136 | - $api_key = get_option( ALGOWOO_DB_OPTION . ALGOLIA_API_KEY ); |
|
137 | - $api_key = is_string( $api_key ) ? $api_key : CHANGE_ME; |
|
136 | + $api_key = get_option(ALGOWOO_DB_OPTION . ALGOLIA_API_KEY); |
|
137 | + $api_key = is_string($api_key) ? $api_key : CHANGE_ME; |
|
138 | 138 | |
139 | - wp_nonce_field( 'algolia_woo_indexer_admin_api_nonce_action', 'algolia_woo_indexer_admin_api_nonce_name' ); |
|
139 | + wp_nonce_field('algolia_woo_indexer_admin_api_nonce_action', 'algolia_woo_indexer_admin_api_nonce_name'); |
|
140 | 140 | |
141 | 141 | echo "<input id='algolia_woo_indexer_admin_api_key' name='algolia_woo_indexer_admin_api_key[key]' |
142 | - type='text' value='" . esc_attr( $api_key ) . "' />"; |
|
142 | + type='text' value='" . esc_attr($api_key) . "' />"; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | * @return void |
149 | 149 | */ |
150 | 150 | public static function algolia_woo_indexer_application_id_output() { |
151 | - $application_id = get_option( ALGOWOO_DB_OPTION . ALGOLIA_APP_ID ); |
|
152 | - $application_id = is_string( $application_id ) ? $application_id : CHANGE_ME; |
|
151 | + $application_id = get_option(ALGOWOO_DB_OPTION . ALGOLIA_APP_ID); |
|
152 | + $application_id = is_string($application_id) ? $application_id : CHANGE_ME; |
|
153 | 153 | |
154 | 154 | echo "<input id='algolia_woo_indexer_application_id' name='algolia_woo_indexer_application_id[id]' |
155 | - type='text' value='" . esc_attr( $application_id ) . "' />"; |
|
155 | + type='text' value='" . esc_attr($application_id) . "' />"; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | * @return void |
162 | 162 | */ |
163 | 163 | public static function algolia_woo_indexer_index_name_output() { |
164 | - $index_name = get_option( ALGOWOO_DB_OPTION . INDEX_NAME ); |
|
165 | - $index_name = is_string( $index_name ) ? $index_name : CHANGE_ME; |
|
164 | + $index_name = get_option(ALGOWOO_DB_OPTION . INDEX_NAME); |
|
165 | + $index_name = is_string($index_name) ? $index_name : CHANGE_ME; |
|
166 | 166 | |
167 | 167 | echo "<input id='algolia_woo_indexer_index_name' name='algolia_woo_indexer_index_name[name]' |
168 | - type='text' value='" . esc_attr( $index_name ) . "' />"; |
|
168 | + type='text' value='" . esc_attr($index_name) . "' />"; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | * Sanitization is not really needed as the variable is not directly echoed |
179 | 179 | * But I have still done it to be 100% safe |
180 | 180 | */ |
181 | - $auto_send = get_option( ALGOWOO_DB_OPTION . AUTOMATICALLY_SEND_NEW_PRODUCTS ); |
|
182 | - $auto_send = ( ! empty( $auto_send ) ) ? 1 : 0; ?> |
|
183 | - <input id="algolia_woo_indexer_automatically_send_new_products" name="algolia_woo_indexer_automatically_send_new_products[checked]" type="checkbox" <?php checked( 1, $auto_send ); ?> /> |
|
181 | + $auto_send = get_option(ALGOWOO_DB_OPTION . AUTOMATICALLY_SEND_NEW_PRODUCTS); |
|
182 | + $auto_send = ( ! empty($auto_send)) ? 1 : 0; ?> |
|
183 | + <input id="algolia_woo_indexer_automatically_send_new_products" name="algolia_woo_indexer_automatically_send_new_products[checked]" type="checkbox" <?php checked(1, $auto_send); ?> /> |
|
184 | 184 | <?php |
185 | 185 | } |
186 | 186 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return void |
191 | 191 | */ |
192 | 192 | public static function algolia_woo_indexer_section_text() { |
193 | - echo esc_html__( 'Enter your settings here', 'algolia-woo-indexer' ); |
|
193 | + echo esc_html__('Enter your settings here', 'algolia-woo-indexer'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @return void |
200 | 200 | */ |
201 | 201 | public static function maybe_send_products() { |
202 | - if ( true === Algolia_Verify_Nonces::verify_send_products_nonce() ) { |
|
202 | + if (true === Algolia_Verify_Nonces::verify_send_products_nonce()) { |
|
203 | 203 | Algolia_Send_Products::send_products_to_algolia(); |
204 | 204 | } |
205 | 205 | } |
@@ -214,19 +214,19 @@ discard block |
||
214 | 214 | /** |
215 | 215 | * Fetch the option to see if we are going to automatically send new products |
216 | 216 | */ |
217 | - $auto_send = get_option( ALGOWOO_DB_OPTION . AUTOMATICALLY_SEND_NEW_PRODUCTS ); |
|
217 | + $auto_send = get_option(ALGOWOO_DB_OPTION . AUTOMATICALLY_SEND_NEW_PRODUCTS); |
|
218 | 218 | |
219 | 219 | /** |
220 | 220 | * Check that we have the minimum versions required and all of the required PHP extensions |
221 | 221 | */ |
222 | 222 | Algolia_Check_Requirements::check_unmet_requirements(); |
223 | 223 | |
224 | - if ( ! Algolia_Check_Requirements::algolia_wp_version_check() || ! Algolia_Check_Requirements::algolia_php_version_check() ) { |
|
224 | + if ( ! Algolia_Check_Requirements::algolia_wp_version_check() || ! Algolia_Check_Requirements::algolia_php_version_check()) { |
|
225 | 225 | add_action( |
226 | 226 | 'admin_notices', |
227 | - function () { |
|
227 | + function() { |
|
228 | 228 | echo '<div class="error notice"> |
229 | - <p>' . esc_html__( 'Please check the server requirements for Algolia Woo Indexer. <br/> It requires minimum PHP version 7.2 and WordPress version 5.0', 'algolia-woo-indexer' ) . '</p> |
|
229 | + <p>' . esc_html__('Please check the server requirements for Algolia Woo Indexer. <br/> It requires minimum PHP version 7.2 and WordPress version 5.0', 'algolia-woo-indexer') . '</p> |
|
230 | 230 | </div>'; |
231 | 231 | } |
232 | 232 | ); |
@@ -237,33 +237,33 @@ discard block |
||
237 | 237 | /** |
238 | 238 | * Setup translations |
239 | 239 | */ |
240 | - add_action( 'plugins_loaded', array( $ob_class, 'load_textdomain' ) ); |
|
240 | + add_action('plugins_loaded', array($ob_class, 'load_textdomain')); |
|
241 | 241 | |
242 | 242 | /** |
243 | 243 | * Add actions to setup admin menu |
244 | 244 | */ |
245 | - if ( is_admin() ) { |
|
246 | - add_action( 'admin_menu', array( $ob_class, 'admin_menu' ) ); |
|
247 | - add_action( 'admin_init', array( $ob_class, 'setup_settings_sections' ) ); |
|
248 | - add_action( 'admin_init', array( $ob_class, 'update_settings_options' ) ); |
|
249 | - add_action( 'admin_init', array( $ob_class, 'maybe_send_products' ) ); |
|
245 | + if (is_admin()) { |
|
246 | + add_action('admin_menu', array($ob_class, 'admin_menu')); |
|
247 | + add_action('admin_init', array($ob_class, 'setup_settings_sections')); |
|
248 | + add_action('admin_init', array($ob_class, 'update_settings_options')); |
|
249 | + add_action('admin_init', array($ob_class, 'maybe_send_products')); |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * Register hook to automatically send new products if the option is set |
253 | 253 | */ |
254 | 254 | |
255 | - if ( '1' === $auto_send ) { |
|
256 | - add_action( 'save_post', array( $ob_class, 'send_new_product_to_algolia' ), 10, 3 ); |
|
255 | + if ('1' === $auto_send) { |
|
256 | + add_action('save_post', array($ob_class, 'send_new_product_to_algolia'), 10, 3); |
|
257 | 257 | } |
258 | 258 | |
259 | - self::$plugin_url = admin_url( 'options-general.php?page=algolia-woo-indexer-settings' ); |
|
259 | + self::$plugin_url = admin_url('options-general.php?page=algolia-woo-indexer-settings'); |
|
260 | 260 | |
261 | - if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) { |
|
261 | + if ( ! is_plugin_active('woocommerce/woocommerce.php')) { |
|
262 | 262 | add_action( |
263 | 263 | 'admin_notices', |
264 | - function () { |
|
264 | + function() { |
|
265 | 265 | echo '<div class="error notice"> |
266 | - <p>' . esc_html__( 'WooCommerce plugin must be enabled for Algolia Woo Indexer to work.', 'algolia-woo-indexer' ) . '</p> |
|
266 | + <p>' . esc_html__('WooCommerce plugin must be enabled for Algolia Woo Indexer to work.', 'algolia-woo-indexer') . '</p> |
|
267 | 267 | </div>'; |
268 | 268 | } |
269 | 269 | ); |
@@ -279,11 +279,11 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @return void |
281 | 281 | */ |
282 | - public static function send_new_product_to_algolia( $post_id, $post ) { |
|
283 | - if ( 'publish' !== $post->post_status || 'product' !== $post->post_type ) { |
|
282 | + public static function send_new_product_to_algolia($post_id, $post) { |
|
283 | + if ('publish' !== $post->post_status || 'product' !== $post->post_type) { |
|
284 | 284 | return; |
285 | 285 | } |
286 | - Algolia_Send_Products::send_products_to_algolia( $post_id ); |
|
286 | + Algolia_Send_Products::send_products_to_algolia($post_id); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -295,19 +295,19 @@ discard block |
||
295 | 295 | public static function update_settings_options() { |
296 | 296 | Algolia_Verify_Nonces::verify_settings_nonce(); |
297 | 297 | |
298 | - if ( Algolia_Verify_Nonces::verify_send_products_nonce() ) { |
|
298 | + if (Algolia_Verify_Nonces::verify_send_products_nonce()) { |
|
299 | 299 | return; |
300 | 300 | } |
301 | 301 | |
302 | - $application_id = filter_input( INPUT_POST, 'algolia_woo_indexer_application_id', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
|
303 | - $api_key = filter_input( INPUT_POST, 'algolia_woo_indexer_admin_api_key', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
|
304 | - $index_name = filter_input( INPUT_POST, 'algolia_woo_indexer_index_name', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
|
305 | - $auto_send = filter_input( INPUT_POST, 'algolia_woo_indexer_automatically_send_new_products', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
|
302 | + $application_id = filter_input(INPUT_POST, 'algolia_woo_indexer_application_id', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); |
|
303 | + $api_key = filter_input(INPUT_POST, 'algolia_woo_indexer_admin_api_key', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); |
|
304 | + $index_name = filter_input(INPUT_POST, 'algolia_woo_indexer_index_name', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); |
|
305 | + $auto_send = filter_input(INPUT_POST, 'algolia_woo_indexer_automatically_send_new_products', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); |
|
306 | 306 | |
307 | - $sanitized_app_id = sanitize_text_field( $application_id['id'] ); |
|
308 | - $sanitized_api_key = sanitize_text_field( $api_key['key'] ); |
|
309 | - $sanitized_index_name = sanitize_text_field( $index_name['name'] ); |
|
310 | - $sanitized_auto_send = ( ! empty( $auto_send ) ) ? 1 : 0; |
|
307 | + $sanitized_app_id = sanitize_text_field($application_id['id']); |
|
308 | + $sanitized_api_key = sanitize_text_field($api_key['key']); |
|
309 | + $sanitized_index_name = sanitize_text_field($index_name['name']); |
|
310 | + $sanitized_auto_send = ( ! empty($auto_send)) ? 1 : 0; |
|
311 | 311 | |
312 | 312 | $options = array( |
313 | 313 | ALGOWOO_DB_OPTION . ALGOLIA_APP_ID => $sanitized_app_id, |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | ALGOWOO_DB_OPTION . AUTOMATICALLY_SEND_NEW_PRODUCTS => $sanitized_auto_send, |
317 | 317 | ); |
318 | 318 | |
319 | - foreach ( $options as $option_key => $option_value ) { |
|
320 | - if ( isset( $option_value ) && ( ! empty( $option_value ) ) ) { |
|
321 | - update_option( $option_key, $option_value ); |
|
319 | + foreach ($options as $option_key => $option_value) { |
|
320 | + if (isset($option_value) && ( ! empty($option_value))) { |
|
321 | + update_option($option_key, $option_value); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param string $input Settings text data |
333 | 333 | * @return array |
334 | 334 | */ |
335 | - public static function settings_fields_validate_options( $input ) { |
|
335 | + public static function settings_fields_validate_options($input) { |
|
336 | 336 | $valid = array(); |
337 | 337 | $valid['name'] = preg_replace( |
338 | 338 | '/[^a-zA-Z\s]/', |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @return void |
349 | 349 | */ |
350 | 350 | public static function load_textdomain() { |
351 | - load_plugin_textdomain( 'algolia-woo-indexer', false, basename( __DIR__ ) . '/languages/' ); |
|
351 | + load_plugin_textdomain('algolia-woo-indexer', false, basename(__DIR__) . '/languages/'); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | public static function admin_menu() { |
360 | 360 | add_submenu_page( |
361 | 361 | 'options-general.php', |
362 | - esc_html__( 'Algolia Woo Indexer Settings', 'algolia-woo-indexer' ), |
|
363 | - esc_html__( 'Algolia Woo Indexer Settings', 'algolia-woo-indexer' ), |
|
362 | + esc_html__('Algolia Woo Indexer Settings', 'algolia-woo-indexer'), |
|
363 | + esc_html__('Algolia Woo Indexer Settings', 'algolia-woo-indexer'), |
|
364 | 364 | 'manage_options', |
365 | 365 | 'algolia-woo-indexer-settings', |
366 | - array( get_called_class(), 'algolia_woo_indexer_settings' ) |
|
366 | + array(get_called_class(), 'algolia_woo_indexer_settings') |
|
367 | 367 | ); |
368 | 368 | } |
369 | 369 | |
@@ -376,23 +376,23 @@ discard block |
||
376 | 376 | /** |
377 | 377 | * Verify that the user can access the settings page |
378 | 378 | */ |
379 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
380 | - wp_die( esc_html__( 'Action not allowed.', 'algolia_woo_indexer_settings' ) ); |
|
379 | + if ( ! current_user_can('manage_options')) { |
|
380 | + wp_die(esc_html__('Action not allowed.', 'algolia_woo_indexer_settings')); |
|
381 | 381 | } |
382 | 382 | ?> |
383 | 383 | <div class="wrap"> |
384 | - <h1><?php esc_html__( 'Algolia Woo Indexer Settings', 'algolia-woo-indexer' ); ?></h1> |
|
385 | - <form action="<?php echo esc_url( self::$plugin_url ); ?>" method="POST"> |
|
384 | + <h1><?php esc_html__('Algolia Woo Indexer Settings', 'algolia-woo-indexer'); ?></h1> |
|
385 | + <form action="<?php echo esc_url(self::$plugin_url); ?>" method="POST"> |
|
386 | 386 | <?php |
387 | - settings_fields( 'algolia_woo_options' ); |
|
388 | - do_settings_sections( 'algolia_woo_indexer' ); |
|
389 | - submit_button( '', 'primary wide' ); |
|
387 | + settings_fields('algolia_woo_options'); |
|
388 | + do_settings_sections('algolia_woo_indexer'); |
|
389 | + submit_button('', 'primary wide'); |
|
390 | 390 | ?> |
391 | 391 | </form> |
392 | - <form action="<?php echo esc_url( self::$plugin_url ); ?>" method="POST"> |
|
393 | - <?php wp_nonce_field( 'send_products_to_algolia_nonce_action', 'send_products_to_algolia_nonce_name' ); ?> |
|
392 | + <form action="<?php echo esc_url(self::$plugin_url); ?>" method="POST"> |
|
393 | + <?php wp_nonce_field('send_products_to_algolia_nonce_action', 'send_products_to_algolia_nonce_name'); ?> |
|
394 | 394 | <input type="hidden" name="send_products_to_algolia" id="send_products_to_algolia" value="true" /> |
395 | - <?php submit_button( esc_html__( 'Send products to Algolia', 'algolia_woo_indexer_settings' ), 'primary wide', '', false ); ?> |
|
395 | + <?php submit_button(esc_html__('Send products to Algolia', 'algolia_woo_indexer_settings'), 'primary wide', '', false); ?> |
|
396 | 396 | </form> |
397 | 397 | </div> |
398 | 398 | <?php |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @return object |
405 | 405 | */ |
406 | 406 | public static function get_instance() { |
407 | - if ( ! self::$instance ) { |
|
407 | + if ( ! self::$instance) { |
|
408 | 408 | self::$instance = new Algolia_Woo_Indexer(); |
409 | 409 | } |
410 | 410 | return self::$instance; |
@@ -420,39 +420,39 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * Set default values for options if not already set |
422 | 422 | */ |
423 | - $auto_send = get_option( ALGOWOO_DB_OPTION . AUTOMATICALLY_SEND_NEW_PRODUCTS ); |
|
424 | - $algolia_application_id = get_option( ALGOWOO_DB_OPTION . ALGOLIA_APP_ID ); |
|
425 | - $algolia_api_key = get_option( ALGOWOO_DB_OPTION . ALGOLIA_API_KEY ); |
|
426 | - $algolia_index_name = get_option( ALGOWOO_DB_OPTION . INDEX_NAME ); |
|
423 | + $auto_send = get_option(ALGOWOO_DB_OPTION . AUTOMATICALLY_SEND_NEW_PRODUCTS); |
|
424 | + $algolia_application_id = get_option(ALGOWOO_DB_OPTION . ALGOLIA_APP_ID); |
|
425 | + $algolia_api_key = get_option(ALGOWOO_DB_OPTION . ALGOLIA_API_KEY); |
|
426 | + $algolia_index_name = get_option(ALGOWOO_DB_OPTION . INDEX_NAME); |
|
427 | 427 | |
428 | - if ( empty( $auto_send ) ) { |
|
428 | + if (empty($auto_send)) { |
|
429 | 429 | add_option( |
430 | 430 | ALGOWOO_DB_OPTION . AUTOMATICALLY_SEND_NEW_PRODUCTS, |
431 | 431 | '0' |
432 | 432 | ); |
433 | 433 | } |
434 | 434 | |
435 | - if ( empty( $algolia_application_id ) ) { |
|
435 | + if (empty($algolia_application_id)) { |
|
436 | 436 | add_option( |
437 | 437 | ALGOWOO_DB_OPTION . ALGOLIA_APP_ID, |
438 | 438 | 'Change me' |
439 | 439 | ); |
440 | 440 | } |
441 | 441 | |
442 | - if ( empty( $algolia_api_key ) ) { |
|
442 | + if (empty($algolia_api_key)) { |
|
443 | 443 | add_option( |
444 | 444 | ALGOWOO_DB_OPTION . ALGOLIA_API_KEY, |
445 | 445 | 'Change me' |
446 | 446 | ); |
447 | 447 | } |
448 | 448 | |
449 | - if ( empty( $algolia_index_name ) ) { |
|
449 | + if (empty($algolia_index_name)) { |
|
450 | 450 | add_option( |
451 | 451 | ALGOWOO_DB_OPTION . INDEX_NAME, |
452 | 452 | 'Change me' |
453 | 453 | ); |
454 | 454 | } |
455 | - set_transient( self::PLUGIN_TRANSIENT, true ); |
|
455 | + set_transient(self::PLUGIN_TRANSIENT, true); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @return void |
462 | 462 | */ |
463 | 463 | public static function deactivate_plugin() { |
464 | - delete_transient( self::PLUGIN_TRANSIENT ); |
|
464 | + delete_transient(self::PLUGIN_TRANSIENT); |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | } |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * Abort if this file is called directly |
13 | 13 | */ |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Algolia_Verify_Nonces' ) ) { |
|
18 | +if ( ! class_exists('Algolia_Verify_Nonces')) { |
|
19 | 19 | /** |
20 | 20 | * Verify submitted nonces |
21 | 21 | */ |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Filter incoming nonces and values |
31 | 31 | */ |
32 | - $settings_nonce = filter_input( INPUT_POST, 'algolia_woo_indexer_admin_api_nonce_name', FILTER_DEFAULT ); |
|
32 | + $settings_nonce = filter_input(INPUT_POST, 'algolia_woo_indexer_admin_api_nonce_name', FILTER_DEFAULT); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Return boolean depending on if the nonce has been set |
36 | 36 | */ |
37 | - if ( ! isset( $settings_nonce ) ) { |
|
37 | + if ( ! isset($settings_nonce)) { |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | } |
@@ -48,22 +48,22 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Filter incoming nonces and values |
50 | 50 | */ |
51 | - $send_products_nonce = filter_input( INPUT_POST, 'send_products_to_algolia_nonce_name', FILTER_DEFAULT ); |
|
52 | - $send_products_to_algolia = filter_input( INPUT_POST, 'send_products_to_algolia', FILTER_DEFAULT ); |
|
51 | + $send_products_nonce = filter_input(INPUT_POST, 'send_products_to_algolia_nonce_name', FILTER_DEFAULT); |
|
52 | + $send_products_to_algolia = filter_input(INPUT_POST, 'send_products_to_algolia', FILTER_DEFAULT); |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Display error and die if nonce is not verified and does not pass security check |
56 | 56 | * Also check if the hidden value field send_products_to_algolia is set |
57 | 57 | */ |
58 | 58 | |
59 | - if ( ! wp_verify_nonce( $send_products_nonce, 'send_products_to_algolia_nonce_action' ) && isset( $send_products_to_algolia ) ) { |
|
60 | - wp_die( esc_html__( 'Action is not allowed.', 'algolia-woo-indexer' ), esc_html__( 'Error!', 'algolia-woo-indexer' ) ); |
|
59 | + if ( ! wp_verify_nonce($send_products_nonce, 'send_products_to_algolia_nonce_action') && isset($send_products_to_algolia)) { |
|
60 | + wp_die(esc_html__('Action is not allowed.', 'algolia-woo-indexer'), esc_html__('Error!', 'algolia-woo-indexer')); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | 64 | * If we have verified the send_products_nonce and the send_products hidden field is set, return true |
65 | 65 | */ |
66 | - if ( wp_verify_nonce( $send_products_nonce, 'send_products_to_algolia_nonce_action' ) && isset( $send_products_to_algolia ) ) { |
|
66 | + if (wp_verify_nonce($send_products_nonce, 'send_products_to_algolia_nonce_action') && isset($send_products_to_algolia)) { |
|
67 | 67 | return true; |
68 | 68 | } |
69 | 69 | } |
@@ -14,37 +14,37 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * Abort if this file is called directly |
16 | 16 | */ |
17 | -if ( ! defined( 'ABSPATH' ) ) { |
|
17 | +if ( ! defined('ABSPATH')) { |
|
18 | 18 | exit; |
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Include plugin file if function is_plugin_active does not exist |
23 | 23 | */ |
24 | -if ( ! function_exists( 'is_plugin_active' ) ) { |
|
24 | +if ( ! function_exists('is_plugin_active')) { |
|
25 | 25 | require_once ABSPATH . '/wp-admin/includes/plugin.php'; |
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Define the plugin version and the database table name |
30 | 30 | */ |
31 | -define( 'ALGOWOO_DB_OPTION', '_algolia_woo_indexer' ); |
|
32 | -define( 'ALGOWOO_CURRENT_DB_VERSION', '0.3' ); |
|
31 | +define('ALGOWOO_DB_OPTION', '_algolia_woo_indexer'); |
|
32 | +define('ALGOWOO_CURRENT_DB_VERSION', '0.3'); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Define application constants |
36 | 36 | */ |
37 | -define( 'CHANGE_ME', 'change me' ); |
|
37 | +define('CHANGE_ME', 'change me'); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Database table names |
41 | 41 | */ |
42 | -define( 'INDEX_NAME', '_index_name' ); |
|
43 | -define( 'AUTOMATICALLY_SEND_NEW_PRODUCTS', '_automatically_send_new_products' ); |
|
44 | -define( 'ALGOLIA_APP_ID', '_application_id' ); |
|
45 | -define( 'ALGOLIA_API_KEY', '_admin_api_key' ); |
|
42 | +define('INDEX_NAME', '_index_name'); |
|
43 | +define('AUTOMATICALLY_SEND_NEW_PRODUCTS', '_automatically_send_new_products'); |
|
44 | +define('ALGOLIA_APP_ID', '_application_id'); |
|
45 | +define('ALGOLIA_API_KEY', '_admin_api_key'); |
|
46 | 46 | |
47 | -if ( ! class_exists( 'Algolia_Send_Products' ) ) { |
|
47 | +if ( ! class_exists('Algolia_Send_Products')) { |
|
48 | 48 | /** |
49 | 49 | * Algolia WooIndexer main class |
50 | 50 | */ |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | public static function can_connect_to_algolia() { |
69 | 69 | try { |
70 | 70 | self::$algolia->listApiKeys(); |
71 | - } catch ( \Algolia\AlgoliaSearch\Exceptions\UnreachableException $error ) { |
|
71 | + } catch (\Algolia\AlgoliaSearch\Exceptions\UnreachableException $error) { |
|
72 | 72 | add_action( |
73 | 73 | 'admin_notices', |
74 | - function () { |
|
74 | + function() { |
|
75 | 75 | echo '<div class="error notice"> |
76 | - <p>' . esc_html__( 'An error has been encountered. Please check your application ID and API key. ', 'algolia-woo-indexer' ) . '</p> |
|
76 | + <p>' . esc_html__('An error has been encountered. Please check your application ID and API key. ', 'algolia-woo-indexer') . '</p> |
|
77 | 77 | </div>'; |
78 | 78 | } |
79 | 79 | ); |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | * @param mixed $product Product to check |
88 | 88 | * @return array ['sale_price' => $sale_price,'regular_price' => $regular_price] Array with regular price and sale price |
89 | 89 | */ |
90 | - public static function get_product_type_price( $product ) { |
|
90 | + public static function get_product_type_price($product) { |
|
91 | 91 | $sale_price = 0; |
92 | 92 | $regular_price = 0; |
93 | - if ( $product->is_type( 'simple' ) ) { |
|
93 | + if ($product->is_type('simple')) { |
|
94 | 94 | $sale_price = $product->get_sale_price(); |
95 | 95 | $regular_price = $product->get_regular_price(); |
96 | - } elseif ( $product->is_type( 'variable' ) ) { |
|
97 | - $sale_price = $product->get_variation_sale_price( 'min', true ); |
|
98 | - $regular_price = $product->get_variation_regular_price( 'max', true ); |
|
96 | + } elseif ($product->is_type('variable')) { |
|
97 | + $sale_price = $product->get_variation_sale_price('min', true); |
|
98 | + $regular_price = $product->get_variation_regular_price('max', true); |
|
99 | 99 | } |
100 | 100 | return array( |
101 | 101 | 'sale_price' => $sale_price, |
@@ -109,37 +109,37 @@ discard block |
||
109 | 109 | * @param Int $id Product to send to Algolia if we send only a single product |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - public static function send_products_to_algolia( $id = '' ) { |
|
112 | + public static function send_products_to_algolia($id = '') { |
|
113 | 113 | /** |
114 | 114 | * Remove classes from plugin URL and autoload Algolia with Composer |
115 | 115 | */ |
116 | 116 | |
117 | - $base_plugin_directory = str_replace( 'classes', '', __DIR__ ); |
|
117 | + $base_plugin_directory = str_replace('classes', '', __DIR__); |
|
118 | 118 | require_once $base_plugin_directory . '/vendor/autoload.php'; |
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Fetch the required variables from the Settings API |
122 | 122 | */ |
123 | 123 | |
124 | - $algolia_application_id = get_option( ALGOWOO_DB_OPTION . ALGOLIA_APP_ID ); |
|
125 | - $algolia_application_id = is_string( $algolia_application_id ) ? $algolia_application_id : CHANGE_ME; |
|
124 | + $algolia_application_id = get_option(ALGOWOO_DB_OPTION . ALGOLIA_APP_ID); |
|
125 | + $algolia_application_id = is_string($algolia_application_id) ? $algolia_application_id : CHANGE_ME; |
|
126 | 126 | |
127 | - $algolia_api_key = get_option( ALGOWOO_DB_OPTION . ALGOLIA_API_KEY ); |
|
128 | - $algolia_api_key = is_string( $algolia_api_key ) ? $algolia_api_key : CHANGE_ME; |
|
127 | + $algolia_api_key = get_option(ALGOWOO_DB_OPTION . ALGOLIA_API_KEY); |
|
128 | + $algolia_api_key = is_string($algolia_api_key) ? $algolia_api_key : CHANGE_ME; |
|
129 | 129 | |
130 | - $algolia_index_name = get_option( ALGOWOO_DB_OPTION . INDEX_NAME ); |
|
131 | - $algolia_index_name = is_string( $algolia_index_name ) ? $algolia_index_name : CHANGE_ME; |
|
130 | + $algolia_index_name = get_option(ALGOWOO_DB_OPTION . INDEX_NAME); |
|
131 | + $algolia_index_name = is_string($algolia_index_name) ? $algolia_index_name : CHANGE_ME; |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Display admin notice and return if not all values have been set |
135 | 135 | */ |
136 | 136 | |
137 | - Algolia_Check_Requirements::check_algolia_input_values( $algolia_application_id, $algolia_api_key, $algolia_index_name ); |
|
137 | + Algolia_Check_Requirements::check_algolia_input_values($algolia_application_id, $algolia_api_key, $algolia_index_name); |
|
138 | 138 | |
139 | 139 | /** |
140 | 140 | * Initiate the Algolia client |
141 | 141 | */ |
142 | - self::$algolia = \Algolia\AlgoliaSearch\SearchClient::create( $algolia_application_id, $algolia_api_key ); |
|
142 | + self::$algolia = \Algolia\AlgoliaSearch\SearchClient::create($algolia_application_id, $algolia_api_key); |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Check if we can connect, if not, handle the exception, display an error and then return |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | /** |
150 | 150 | * Initialize the search index and set the name to the option from the database |
151 | 151 | */ |
152 | - $index = self::$algolia->initIndex( $algolia_index_name ); |
|
152 | + $index = self::$algolia->initIndex($algolia_index_name); |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Setup arguments for sending all products to Algolia |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | /** |
166 | 166 | * Setup arguments for sending only a single product |
167 | 167 | */ |
168 | - if ( isset( $id ) && '' !== $id ) { |
|
168 | + if (isset($id) && '' !== $id) { |
|
169 | 169 | $arguments = array( |
170 | 170 | 'status' => 'publish', |
171 | - 'include' => array( $id ), |
|
171 | + 'include' => array($id), |
|
172 | 172 | 'paginate' => false, |
173 | 173 | ); |
174 | 174 | } |
@@ -180,27 +180,27 @@ discard block |
||
180 | 180 | */ |
181 | 181 | $products = |
182 | 182 | /** @scrutinizer ignore-call */ |
183 | - wc_get_products( $arguments ); |
|
183 | + wc_get_products($arguments); |
|
184 | 184 | |
185 | - if ( empty( $products ) ) { |
|
185 | + if (empty($products)) { |
|
186 | 186 | return; |
187 | 187 | } |
188 | 188 | $records = array(); |
189 | 189 | $record = array(); |
190 | 190 | |
191 | - foreach ( $products as $product ) { |
|
191 | + foreach ($products as $product) { |
|
192 | 192 | /** |
193 | 193 | * Set sale price or regular price based on product type |
194 | 194 | */ |
195 | - $product_type_price = self::get_product_type_price( $product ); |
|
195 | + $product_type_price = self::get_product_type_price($product); |
|
196 | 196 | $sale_price = $product_type_price['sale_price']; |
197 | 197 | $regular_price = $product_type_price['regular_price']; |
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Extract image from $product->get_image() |
201 | 201 | */ |
202 | - preg_match( '/<img(.*)src(.*)=(.*)"(.*)"/U', $product->get_image(), $result ); |
|
203 | - $product_image = array_pop( $result ); |
|
202 | + preg_match('/<img(.*)src(.*)=(.*)"(.*)"/U', $product->get_image(), $result); |
|
203 | + $product_image = array_pop($result); |
|
204 | 204 | /** |
205 | 205 | * Build the record array using the information from the WooCommerce product |
206 | 206 | */ |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | * Send the information to Algolia and save the result |
220 | 220 | * If result is NullResponse, print an error message |
221 | 221 | */ |
222 | - $result = $index->saveObjects( $records ); |
|
222 | + $result = $index->saveObjects($records); |
|
223 | 223 | |
224 | - if ( 'Algolia\AlgoliaSearch\Response\NullResponse' === get_class( $result ) ) { |
|
225 | - wp_die( esc_html__( 'No response from the server. Please check your settings and try again', 'algolia_woo_indexer_settings' ) ); |
|
224 | + if ('Algolia\AlgoliaSearch\Response\NullResponse' === get_class($result)) { |
|
225 | + wp_die(esc_html__('No response from the server. Please check your settings and try again', 'algolia_woo_indexer_settings')); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
229 | 229 | * Display success message |
230 | 230 | */ |
231 | 231 | echo '<div class="notice notice-success is-dismissible"> |
232 | - <p>' . esc_html__( 'Product(s) sent to Algolia.', 'algolia-woo-indexer' ) . '</p> |
|
232 | + <p>' . esc_html__('Product(s) sent to Algolia.', 'algolia-woo-indexer') . '</p> |
|
233 | 233 | </div>'; |
234 | 234 | } |
235 | 235 | } |
@@ -11,17 +11,17 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * Define minimum required versions of PHP and WordPress |
13 | 13 | */ |
14 | -define( 'ALGOLIA_MIN_PHP_VERSION', '8.1' ); |
|
15 | -define( 'ALGOLIA_MIN_WP_VERSION', '6.1' ); |
|
14 | +define('ALGOLIA_MIN_PHP_VERSION', '8.1'); |
|
15 | +define('ALGOLIA_MIN_WP_VERSION', '6.1'); |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Abort if this file is called directly |
19 | 19 | */ |
20 | -if ( ! defined( 'ABSPATH' ) ) { |
|
20 | +if ( ! defined('ABSPATH')) { |
|
21 | 21 | exit; |
22 | 22 | } |
23 | 23 | |
24 | -if ( ! class_exists( 'Algolia_Check_Requirements' ) ) { |
|
24 | +if ( ! class_exists('Algolia_Check_Requirements')) { |
|
25 | 25 | /** |
26 | 26 | * Check requirements for Algolia plugin |
27 | 27 | */ |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return bool |
35 | 35 | */ |
36 | 36 | public static function algolia_php_version_check() { |
37 | - if ( version_compare( PHP_VERSION, ALGOLIA_MIN_PHP_VERSION, '<' ) ) { |
|
37 | + if (version_compare(PHP_VERSION, ALGOLIA_MIN_PHP_VERSION, '<')) { |
|
38 | 38 | return false; |
39 | 39 | } |
40 | 40 | return true; |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | * @param string $algolia_api_key Algolia API key. |
48 | 48 | * @param string $algolia_index_name Algolia index name. |
49 | 49 | */ |
50 | - public static function check_algolia_input_values( $algolia_application_id, $algolia_api_key, $algolia_index_name ) { |
|
51 | - if ( empty( $algolia_application_id ) || empty( $algolia_api_key || empty( $algolia_index_name ) ) ) { |
|
50 | + public static function check_algolia_input_values($algolia_application_id, $algolia_api_key, $algolia_index_name) { |
|
51 | + if (empty($algolia_application_id) || empty($algolia_api_key || empty($algolia_index_name))) { |
|
52 | 52 | add_action( |
53 | 53 | 'admin_notices', |
54 | - function () { |
|
54 | + function() { |
|
55 | 55 | echo '<div class="error notice"> |
56 | - <p>' . esc_html__( 'All settings need to be set for the plugin to work.', 'algolia-woo-indexer' ) . '</p> |
|
56 | + <p>' . esc_html__('All settings need to be set for the plugin to work.', 'algolia-woo-indexer') . '</p> |
|
57 | 57 | </div>'; |
58 | 58 | } |
59 | 59 | ); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return bool |
67 | 67 | */ |
68 | 68 | public static function algolia_wp_version_check() { |
69 | - if ( version_compare( $GLOBALS['wp_version'], ALGOLIA_MIN_WP_VERSION, '<' ) ) { |
|
69 | + if (version_compare($GLOBALS['wp_version'], ALGOLIA_MIN_WP_VERSION, '<')) { |
|
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | return true; |
@@ -78,18 +78,18 @@ discard block |
||
78 | 78 | * @return void |
79 | 79 | */ |
80 | 80 | public static function check_unmet_requirements() { |
81 | - if ( ! extension_loaded( 'mbstring' ) ) { |
|
81 | + if ( ! extension_loaded('mbstring')) { |
|
82 | 82 | echo '<div class="error notice"> |
83 | - <p>' . esc_html__( 'Algolia Woo Indexer requires the "mbstring" PHP extension to be enabled. Please contact your hosting provider.', 'algolia-woo-indexer' ) . '</p> |
|
83 | + <p>' . esc_html__('Algolia Woo Indexer requires the "mbstring" PHP extension to be enabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
|
84 | 84 | </div>'; |
85 | - } elseif ( ! function_exists( 'mb_ereg_replace' ) ) { |
|
85 | + } elseif ( ! function_exists('mb_ereg_replace')) { |
|
86 | 86 | echo '<div class="error notice"> |
87 | - <p>' . esc_html__( 'Algolia Woo Indexer needs "mbregex" NOT to be disabled. Please contact your hosting provider.', 'algolia-woo-indexer' ) . '</p> |
|
87 | + <p>' . esc_html__('Algolia Woo Indexer needs "mbregex" NOT to be disabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
|
88 | 88 | </div>'; |
89 | 89 | } |
90 | - if ( ! extension_loaded( 'curl' ) ) { |
|
90 | + if ( ! extension_loaded('curl')) { |
|
91 | 91 | echo '<div class="error notice"> |
92 | - <p>' . esc_html__( 'Algolia Woo Indexer requires the "cURL" PHP extension to be enabled. Please contact your hosting provider.', 'algolia-woo-indexer' ) . '</p> |
|
92 | + <p>' . esc_html__('Algolia Woo Indexer requires the "cURL" PHP extension to be enabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
|
93 | 93 | </div>'; |
94 | 94 | return; |
95 | 95 | } |