@@ -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'); |
@@ -17,11 +17,11 @@ discard block |
||
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 | */ |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | * @param string $algolia_index_name Algolia index name. |
50 | 50 | * |
51 | 51 | */ |
52 | - public static function check_algolia_input_values($algolia_application_id, $algolia_api_key, $algolia_index_name ) |
|
52 | + public static function check_algolia_input_values($algolia_application_id, $algolia_api_key, $algolia_index_name) |
|
53 | 53 | { |
54 | 54 | if (empty($algolia_application_id) || empty($algolia_api_key || empty($algolia_index_name))) { |
55 | 55 | add_action( |
56 | 56 | 'admin_notices', |
57 | - function () { |
|
57 | + function() { |
|
58 | 58 | echo '<div class="error notice"> |
59 | 59 | <p>' . esc_html__('All settings need to be set for the plugin to work.', 'algolia-woo-indexer') . '</p> |
60 | 60 | </div>'; |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function check_unmet_requirements() |
86 | 86 | { |
87 | - if (! extension_loaded('mbstring')) { |
|
87 | + if ( ! extension_loaded('mbstring')) { |
|
88 | 88 | echo '<div class="error notice"> |
89 | 89 | <p>' . esc_html__('Algolia Woo Indexer requires the "mbstring" PHP extension to be enabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
90 | 90 | </div>'; |
91 | - } elseif (! function_exists('mb_ereg_replace')) { |
|
91 | + } elseif ( ! function_exists('mb_ereg_replace')) { |
|
92 | 92 | echo '<div class="error notice"> |
93 | 93 | <p>' . esc_html__('Algolia Woo Indexer needs "mbregex" NOT to be disabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
94 | 94 | </div>'; |
95 | 95 | } |
96 | - if (! extension_loaded('curl')) { |
|
96 | + if ( ! extension_loaded('curl')) { |
|
97 | 97 | echo '<div class="error notice"> |
98 | 98 | <p>' . esc_html__('Algolia Woo Indexer requires the "cURL" PHP extension to be enabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
99 | 99 | </div>'; |
@@ -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 | - return isset( $settings_nonce ); |
|
37 | + return isset($settings_nonce); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
@@ -47,22 +47,22 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * Filter incoming nonces and values |
49 | 49 | */ |
50 | - $send_products_nonce = filter_input( INPUT_POST, 'send_products_to_algolia_nonce_name', FILTER_DEFAULT ); |
|
51 | - $send_products_to_algolia = filter_input( INPUT_POST, 'send_products_to_algolia', FILTER_DEFAULT ); |
|
50 | + $send_products_nonce = filter_input(INPUT_POST, 'send_products_to_algolia_nonce_name', FILTER_DEFAULT); |
|
51 | + $send_products_to_algolia = filter_input(INPUT_POST, 'send_products_to_algolia', FILTER_DEFAULT); |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Display error and die if nonce is not verified and does not pass security check |
55 | 55 | * Also check if the hidden value field send_products_to_algolia is set |
56 | 56 | */ |
57 | 57 | |
58 | - if ( ! wp_verify_nonce( $send_products_nonce, 'send_products_to_algolia_nonce_action' ) && isset( $send_products_to_algolia ) ) { |
|
59 | - wp_die( esc_html__( 'Action is not allowed.', 'algolia-woo-indexer' ), esc_html__( 'Error!', 'algolia-woo-indexer' ) ); |
|
58 | + if ( ! wp_verify_nonce($send_products_nonce, 'send_products_to_algolia_nonce_action') && isset($send_products_to_algolia)) { |
|
59 | + wp_die(esc_html__('Action is not allowed.', 'algolia-woo-indexer'), esc_html__('Error!', 'algolia-woo-indexer')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * If we have verified the send_products_nonce and the send_products hidden field is set, return true |
64 | 64 | */ |
65 | - if ( wp_verify_nonce( $send_products_nonce, 'send_products_to_algolia_nonce_action' ) && isset( $send_products_to_algolia ) ) { |
|
65 | + if (wp_verify_nonce($send_products_nonce, 'send_products_to_algolia_nonce_action') && isset($send_products_to_algolia)) { |
|
66 | 66 | return true; |
67 | 67 | } |
68 | 68 | } |
@@ -17,18 +17,18 @@ discard block |
||
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 | 24 | /** |
25 | 25 | * Include plugin file if function is_plugin_active does not exist |
26 | 26 | */ |
27 | -if (!function_exists('is_plugin_active')) { |
|
27 | +if ( ! function_exists('is_plugin_active')) { |
|
28 | 28 | require_once(ABSPATH . '/wp-admin/includes/plugin.php'); |
29 | 29 | } |
30 | 30 | |
31 | -if (!class_exists('Algolia_Woo_Indexer')) { |
|
31 | +if ( ! class_exists('Algolia_Woo_Indexer')) { |
|
32 | 32 | /** |
33 | 33 | * Algolia WooIndexer main class |
34 | 34 | */ |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * But I have still done it to be 100% safe |
223 | 223 | */ |
224 | 224 | $auto_send = get_option(ALGOWOO_DB_OPTION . AUTOMATICALLY_SEND_NEW_PRODUCTS); |
225 | - $auto_send = (!empty($auto_send)) ? 1 : 0; ?> |
|
225 | + $auto_send = ( ! empty($auto_send)) ? 1 : 0; ?> |
|
226 | 226 | <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); ?> /> |
227 | 227 | <?php |
228 | 228 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | public static function algolia_woo_indexer_field_output($args) |
236 | 236 | { |
237 | 237 | $value = get_option(ALGOWOO_DB_OPTION . BASIC_FIELD_PREFIX . $args["name"]); |
238 | - $isChecked = (!empty($value)) ? 1 : 0; |
|
238 | + $isChecked = ( ! empty($value)) ? 1 : 0; |
|
239 | 239 | ?> |
240 | 240 | <input id="<?php echo $args["label_for"] ?>" name="<?php echo $args["label_for"] ?>[checked]" type="checkbox" <?php checked(1, $isChecked); ?> /> |
241 | 241 | <?php |
@@ -305,10 +305,10 @@ discard block |
||
305 | 305 | */ |
306 | 306 | Algolia_Check_Requirements::check_unmet_requirements(); |
307 | 307 | |
308 | - if (!Algolia_Check_Requirements::algolia_wp_version_check() || !Algolia_Check_Requirements::algolia_php_version_check()) { |
|
308 | + if ( ! Algolia_Check_Requirements::algolia_wp_version_check() || ! Algolia_Check_Requirements::algolia_php_version_check()) { |
|
309 | 309 | add_action( |
310 | 310 | 'admin_notices', |
311 | - function () { |
|
311 | + function() { |
|
312 | 312 | echo '<div class="error notice"> |
313 | 313 | <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> |
314 | 314 | </div>'; |
@@ -342,10 +342,10 @@ discard block |
||
342 | 342 | |
343 | 343 | self::$plugin_url = admin_url('options-general.php?page=algolia-woo-indexer-settings'); |
344 | 344 | |
345 | - if (!is_plugin_active('woocommerce/woocommerce.php')) { |
|
345 | + if ( ! is_plugin_active('woocommerce/woocommerce.php')) { |
|
346 | 346 | add_action( |
347 | 347 | 'admin_notices', |
348 | - function () { |
|
348 | + function() { |
|
349 | 349 | echo '<div class="error notice"> |
350 | 350 | <p>' . esc_html__('WooCommerce plugin must be enabled for Algolia Woo Indexer to work.', 'algolia-woo-indexer') . '</p> |
351 | 351 | </div>'; |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | /** |
419 | 419 | * Sanitizing by setting the value to either 1 or 0 |
420 | 420 | */ |
421 | - $sanitized['product'] = (!empty($auto_send)) ? 1 : 0; |
|
421 | + $sanitized['product'] = ( ! empty($auto_send)) ? 1 : 0; |
|
422 | 422 | |
423 | 423 | /** |
424 | 424 | * Filter the data fields checkboxes and verify that the input is an array and assign it to an associative array |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $sanitized['fields'] = array(); |
429 | 429 | foreach (BASIC_FIELDS as $field) { |
430 | 430 | $raw_field = filter_input(INPUT_POST, 'algolia_woo_indexer_field_' . $field, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); |
431 | - $filtered_field = (!empty($raw_field)) ? 1 : 0; |
|
431 | + $filtered_field = ( ! empty($raw_field)) ? 1 : 0; |
|
432 | 432 | $sanitized['fields'][$field] = $filtered_field; |
433 | 433 | } |
434 | 434 | |
@@ -438,21 +438,21 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @see https://developer.wordpress.org/reference/functions/update_option/ |
440 | 440 | */ |
441 | - if (isset($sanitized['app_id']) && (!empty($sanitized['app_id']))) { |
|
441 | + if (isset($sanitized['app_id']) && ( ! empty($sanitized['app_id']))) { |
|
442 | 442 | update_option( |
443 | 443 | ALGOWOO_DB_OPTION . ALGOLIA_APP_ID, |
444 | 444 | $sanitized['app_id'] |
445 | 445 | ); |
446 | 446 | } |
447 | 447 | |
448 | - if (isset($sanitized['api_key']) && (!empty($sanitized['api_key']))) { |
|
448 | + if (isset($sanitized['api_key']) && ( ! empty($sanitized['api_key']))) { |
|
449 | 449 | update_option( |
450 | 450 | ALGOWOO_DB_OPTION . ALGOLIA_API_KEY, |
451 | 451 | $sanitized['api_key'] |
452 | 452 | ); |
453 | 453 | } |
454 | 454 | |
455 | - if (isset($sanitized['index_name']) && (!empty($sanitized['index_name']))) { |
|
455 | + if (isset($sanitized['index_name']) && ( ! empty($sanitized['index_name']))) { |
|
456 | 456 | update_option( |
457 | 457 | ALGOWOO_DB_OPTION . INDEX_NAME, |
458 | 458 | $sanitized['index_name'] |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | ); |
467 | 467 | } |
468 | 468 | |
469 | - if (isset($sanitized['fields']) && (!empty($sanitized['fields']))) { |
|
469 | + if (isset($sanitized['fields']) && ( ! empty($sanitized['fields']))) { |
|
470 | 470 | foreach ($sanitized['fields'] as $key => $value) { |
471 | 471 | update_option( |
472 | 472 | ALGOWOO_DB_OPTION . BASIC_FIELD_PREFIX . $key, |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | /** |
546 | 546 | * Verify that the user can access the settings page |
547 | 547 | */ |
548 | - if (!current_user_can('manage_options')) { |
|
548 | + if ( ! current_user_can('manage_options')) { |
|
549 | 549 | wp_die(esc_html__('Action not allowed.', 'algolia_woo_indexer_settings')); |
550 | 550 | } ?> |
551 | 551 | <div class="wrap"> |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | */ |
573 | 573 | public static function get_instance() |
574 | 574 | { |
575 | - if (!self::$instance) { |
|
575 | + if ( ! self::$instance) { |
|
576 | 576 | self::$instance = new Algolia_Woo_Indexer(); |
577 | 577 | } |
578 | 578 | return self::$instance; |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * Abort if this file is called directly |
17 | 17 | */ |
18 | -if (!defined('ABSPATH')) { |
|
18 | +if ( ! defined('ABSPATH')) { |
|
19 | 19 | exit; |
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Include plugin file if function is_plugin_active does not exist |
24 | 24 | */ |
25 | -if (!function_exists('is_plugin_active')) { |
|
25 | +if ( ! function_exists('is_plugin_active')) { |
|
26 | 26 | require_once(ABSPATH . '/wp-admin/includes/plugin.php'); |
27 | 27 | } |
28 | 28 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | define('CUSTOM_FIELDS', '_custom_fields'); |
68 | 68 | |
69 | 69 | |
70 | -if (!class_exists('Algolia_Send_Products')) { |
|
70 | +if ( ! class_exists('Algolia_Send_Products')) { |
|
71 | 71 | /** |
72 | 72 | * Algolia WooIndexer main class |
73 | 73 | */ |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } catch (\Algolia\AlgoliaSearch\Exceptions\UnreachableException $error) { |
95 | 95 | add_action( |
96 | 96 | 'admin_notices', |
97 | - function () { |
|
97 | + function() { |
|
98 | 98 | echo '<div class="error notice"> |
99 | 99 | <p>' . esc_html__('An error has been encountered. Please check your application ID and API key. ', 'algolia-woo-indexer') . '</p> |
100 | 100 | </div>'; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | /** |
131 | 131 | * only if enabled or validation skipped and not empty |
132 | 132 | */ |
133 | - if ((!self::is_basic_field_enabled($field) && !$skip_basic_field_validation) || empty($value)) { |
|
133 | + if (( ! self::is_basic_field_enabled($field) && ! $skip_basic_field_validation) || empty($value)) { |
|
134 | 134 | return $record; |
135 | 135 | } |
136 | 136 | |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | $sale_price = 0; |
150 | 150 | $regular_price = 0; |
151 | 151 | if ($product->is_type('simple')) { |
152 | - $sale_price = $product->get_sale_price(); |
|
153 | - $regular_price = $product->get_regular_price(); |
|
152 | + $sale_price = $product->get_sale_price(); |
|
153 | + $regular_price = $product->get_regular_price(); |
|
154 | 154 | } elseif ($product->is_type('variable')) { |
155 | - $sale_price = $product->get_variation_sale_price('min', true); |
|
156 | - $regular_price = $product->get_variation_regular_price('max', true); |
|
155 | + $sale_price = $product->get_variation_sale_price('min', true); |
|
156 | + $regular_price = $product->get_variation_regular_price('max', true); |
|
157 | 157 | } |
158 | 158 | return array( |
159 | 159 | 'sale_price' => $sale_price, |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $custom_field_with_values = array(); |
193 | 193 | foreach ($custom_fields_array as $custom_field) { |
194 | 194 | $value = get_post_meta($product->get_id(), $custom_field); |
195 | - if (!empty($value)) { |
|
195 | + if ( ! empty($value)) { |
|
196 | 196 | $custom_field_with_values[$custom_field] = $value; |
197 | 197 | } |
198 | 198 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $algolia_api_key = is_string($algolia_api_key) ? $algolia_api_key : CHANGE_ME; |
267 | 267 | |
268 | 268 | $algolia_index_name = get_option(ALGOWOO_DB_OPTION . INDEX_NAME); |
269 | - $algolia_index_name = is_string($algolia_index_name) ? $algolia_index_name : CHANGE_ME; |
|
269 | + $algolia_index_name = is_string($algolia_index_name) ? $algolia_index_name : CHANGE_ME; |
|
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Display admin notice and return if not all values have been set |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * get custom fields and merge |
367 | 367 | */ |
368 | 368 | $custom_fields = self::get_custom_fields($product); |
369 | - if (!empty($custom_fields)) { |
|
369 | + if ( ! empty($custom_fields)) { |
|
370 | 370 | $record = array_merge($record, $custom_fields); |
371 | 371 | } |
372 | 372 |
@@ -18,36 +18,36 @@ |
||
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 attributes |
42 | 42 | */ |
43 | -require_once plugin_dir_path( __FILE__ ) . '/classes/class-attributes.php'; |
|
43 | +require_once plugin_dir_path(__FILE__) . '/classes/class-attributes.php'; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Class for sending products |
47 | 47 | */ |
48 | -require_once plugin_dir_path( __FILE__ ) . '/classes/class-send-products.php'; |
|
48 | +require_once plugin_dir_path(__FILE__) . '/classes/class-send-products.php'; |
|
49 | 49 | |
50 | 50 | $algowooindexer = \Algowoo\Algolia_Woo_Indexer::get_instance(); |
51 | 51 | |
52 | -register_activation_hook( __FILE__, array( $algowooindexer, 'activate_plugin' ) ); |
|
53 | -register_deactivation_hook( __FILE__, array( $algowooindexer, 'deactivate_plugin' ) ); |
|
52 | +register_activation_hook(__FILE__, array($algowooindexer, 'activate_plugin')); |
|
53 | +register_deactivation_hook(__FILE__, array($algowooindexer, 'deactivate_plugin')); |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * Abort if this file is called directly |
44 | 44 | */ |
45 | -if (!defined('ABSPATH')) { |
|
45 | +if ( ! defined('ABSPATH')) { |
|
46 | 46 | exit; |
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | -if (!class_exists('Algolia_Attributes')) { |
|
50 | +if ( ! class_exists('Algolia_Attributes')) { |
|
51 | 51 | /** |
52 | 52 | * Algolia WooIndexer Attributes |
53 | 53 | */ |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | public static function algolia_woo_indexer_attributes_enabled_output() |
109 | 109 | { |
110 | 110 | $value = get_option(ALGOWOO_DB_OPTION . ATTRIBUTES_ENABLED); |
111 | - $isChecked = (!empty($value)) ? 1 : 0; |
|
111 | + $isChecked = ( ! empty($value)) ? 1 : 0; |
|
112 | 112 | ?> |
113 | 113 | <input id="algolia_woo_indexer_attributes_enabled" name="algolia_woo_indexer_attributes_enabled[checked]" type="checkbox" <?php checked(1, $isChecked); ?> /> |
114 | 114 | <?php |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | |
201 | 201 | $values = wc_get_attribute_taxonomies(); |
202 | - if (!$values) { |
|
202 | + if ( ! $values) { |
|
203 | 203 | echo esc_html__('You don\'t have any attributes defined yet. Go to WooCommerce and add some to use this feature.', 'algolia-woo-indexer'); |
204 | 204 | return; |
205 | 205 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @see https://developer.wordpress.org/reference/functions/sanitize_text_field/ |
263 | 263 | */ |
264 | 264 | $sanitized = array(); |
265 | - $sanitized['attributes_visibility'] = sanitize_text_field($attributes_visibility['value']); |
|
265 | + $sanitized['attributes_visibility'] = sanitize_text_field($attributes_visibility['value']); |
|
266 | 266 | |
267 | 267 | /** |
268 | 268 | * sanitize select list of id's by getting integers and them implode seperated with comma |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | /** |
297 | 297 | * Sanitizing by setting the value to either 1 or 0 |
298 | 298 | */ |
299 | - $sanitized['attributes_enabled'] = (!empty($attributes_enabled)) ? 1 : 0; |
|
299 | + $sanitized['attributes_enabled'] = ( ! empty($attributes_enabled)) ? 1 : 0; |
|
300 | 300 | |
301 | 301 | |
302 | 302 | /** |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | */ |
376 | 376 | public static function get_instance() |
377 | 377 | { |
378 | - if (!self::$instance) { |
|
378 | + if ( ! self::$instance) { |
|
379 | 379 | self::$instance = new Algolia_Attributes(); |
380 | 380 | } |
381 | 381 | return self::$instance; |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | $attribute_id = $attribute->get_id(); |
441 | 441 | |
442 | 442 | return ($attribute->get_variation() || |
443 | - !$attribute->is_taxonomy() || |
|
444 | - !in_array($attribute_id, $setting_ids) || |
|
445 | - ($setting_visibility === "visible" && $visibility === false) || |
|
446 | - ($setting_visibility === "hidden" && $visibility === true) |
|
443 | + ! $attribute->is_taxonomy() || |
|
444 | + ! in_array($attribute_id, $setting_ids) || |
|
445 | + ($setting_visibility === "visible" && $visibility === false) || |
|
446 | + ($setting_visibility === "hidden" && $visibility === true) |
|
447 | 447 | ); |
448 | 448 | } |
449 | 449 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | */ |
461 | 461 | $attributes_enabled = (int) get_option(ALGOWOO_DB_OPTION . ATTRIBUTES_ENABLED); |
462 | 462 | $rawAttributes = $product->get_attributes("edit"); |
463 | - if ($attributes_enabled !== 1 || !$rawAttributes) { |
|
463 | + if ($attributes_enabled !== 1 || ! $rawAttributes) { |
|
464 | 464 | return false; |
465 | 465 | } |
466 | 466 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | |
472 | 472 | $attributes = []; |
473 | 473 | foreach ($rawAttributes as $attribute) { |
474 | - if (!self::is_attribute_not_allowed($attribute)) { |
|
474 | + if ( ! self::is_attribute_not_allowed($attribute)) { |
|
475 | 475 | $name = $attribute->get_name(); |
476 | 476 | $terms = wp_get_post_terms($product->get_id(), $name, 'all'); |
477 | 477 | $is_interpolation = in_array($attribute->get_id(), $setting_ids_interp); |