@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * Include plugin file if function is_plugin_active does not exist |
| 23 | 23 | */ |
| 24 | 24 | if (! function_exists('is_plugin_active')) { |
| 25 | - require_once(ABSPATH . '/wp-admin/includes/plugin.php'); |
|
| 25 | + require_once(ABSPATH . '/wp-admin/includes/plugin.php'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public static function setup_settings_sections() { |
| 79 | 79 | /** |
| 80 | - * Setup arguments for settings sections and fields |
|
| 81 | - * |
|
| 82 | - * @see https://developer.wordpress.org/reference/functions/register_setting/ |
|
| 83 | - */ |
|
| 80 | + * Setup arguments for settings sections and fields |
|
| 81 | + * |
|
| 82 | + * @see https://developer.wordpress.org/reference/functions/register_setting/ |
|
| 83 | + */ |
|
| 84 | 84 | if ( is_admin() ) { |
| 85 | 85 | $arguments = array( |
| 86 | 86 | 'type' => 'string', |
@@ -486,8 +486,8 @@ discard block |
||
| 486 | 486 | ); |
| 487 | 487 | |
| 488 | 488 | /** |
| 489 | - * Setup arguments for sending only a single product |
|
| 490 | - */ |
|
| 489 | + * Setup arguments for sending only a single product |
|
| 490 | + */ |
|
| 491 | 491 | if ( isset( $id ) && '' !== $id ) { |
| 492 | 492 | $arguments = array( |
| 493 | 493 | 'status' => 'publish', |
@@ -631,8 +631,8 @@ discard block |
||
| 631 | 631 | */ |
| 632 | 632 | public static function algolia_woo_indexer_settings() { |
| 633 | 633 | /** |
| 634 | - * Verify that the user can access the settings page |
|
| 635 | - */ |
|
| 634 | + * Verify that the user can access the settings page |
|
| 635 | + */ |
|
| 636 | 636 | if ( ! current_user_can( 'manage_options' ) ) { |
| 637 | 637 | wp_die( esc_html__( 'Action not allowed.', 'algolia_woo_indexer_settings' ) ); |
| 638 | 638 | } |
@@ -14,24 +14,24 @@ 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 | -if ( ! class_exists( 'Algolia_Woo_Indexer' ) ) { |
|
| 34 | +if ( ! class_exists('Algolia_Woo_Indexer')) { |
|
| 35 | 35 | /** |
| 36 | 36 | * Algolia WooIndexer main class |
| 37 | 37 | */ |
@@ -81,13 +81,13 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @see https://developer.wordpress.org/reference/functions/register_setting/ |
| 83 | 83 | */ |
| 84 | - if ( is_admin() ) { |
|
| 84 | + if (is_admin()) { |
|
| 85 | 85 | $arguments = array( |
| 86 | 86 | 'type' => 'string', |
| 87 | 87 | 'sanitize_callback' => 'settings_fields_validate_options', |
| 88 | 88 | 'default' => null, |
| 89 | 89 | ); |
| 90 | - register_setting( 'algolia_woo_options', 'algolia_woo_options', $arguments ); |
|
| 90 | + register_setting('algolia_woo_options', 'algolia_woo_options', $arguments); |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * Make sure we reference the instance of the current class by using self::get_instance() |
@@ -100,42 +100,42 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | add_settings_section( |
| 102 | 102 | 'algolia_woo_indexer_main', |
| 103 | - esc_html__( 'Algolia Woo Plugin Settings', 'algolia-woo-indexer' ), |
|
| 104 | - array( $algowooindexer, 'algolia_woo_indexer_section_text' ), |
|
| 103 | + esc_html__('Algolia Woo Plugin Settings', 'algolia-woo-indexer'), |
|
| 104 | + array($algowooindexer, 'algolia_woo_indexer_section_text'), |
|
| 105 | 105 | 'algolia_woo_indexer' |
| 106 | 106 | ); |
| 107 | 107 | add_settings_field( |
| 108 | 108 | 'algolia_woo_indexer_application_id', |
| 109 | - esc_html__( 'Application ID', 'algolia-woo-indexer' ), |
|
| 110 | - array( $algowooindexer, 'algolia_woo_indexer_application_id_output' ), |
|
| 109 | + esc_html__('Application ID', 'algolia-woo-indexer'), |
|
| 110 | + array($algowooindexer, 'algolia_woo_indexer_application_id_output'), |
|
| 111 | 111 | 'algolia_woo_indexer', |
| 112 | 112 | 'algolia_woo_indexer_main' |
| 113 | 113 | ); |
| 114 | 114 | add_settings_field( |
| 115 | 115 | 'algolia_woo_indexer_admin_api_key', |
| 116 | - esc_html__( 'Admin API Key', 'algolia-woo-indexer' ), |
|
| 117 | - array( $algowooindexer, 'algolia_woo_indexer_admin_api_key_output' ), |
|
| 116 | + esc_html__('Admin API Key', 'algolia-woo-indexer'), |
|
| 117 | + array($algowooindexer, 'algolia_woo_indexer_admin_api_key_output'), |
|
| 118 | 118 | 'algolia_woo_indexer', |
| 119 | 119 | 'algolia_woo_indexer_main' |
| 120 | 120 | ); |
| 121 | 121 | add_settings_field( |
| 122 | 122 | 'algolia_woo_indexer_index_name', |
| 123 | - esc_html__( 'Index name (will be created if not existing)', 'algolia-woo-indexer' ), |
|
| 124 | - array( $algowooindexer, 'algolia_woo_indexer_index_name_output' ), |
|
| 123 | + esc_html__('Index name (will be created if not existing)', 'algolia-woo-indexer'), |
|
| 124 | + array($algowooindexer, 'algolia_woo_indexer_index_name_output'), |
|
| 125 | 125 | 'algolia_woo_indexer', |
| 126 | 126 | 'algolia_woo_indexer_main' |
| 127 | 127 | ); |
| 128 | 128 | add_settings_field( |
| 129 | 129 | 'algolia_woo_indexer_index_in_stock', |
| 130 | - esc_html__( 'Only index products in stock', 'algolia-woo-indexer' ), |
|
| 131 | - array( $algowooindexer, 'algolia_woo_indexer_index_in_stock_output' ), |
|
| 130 | + esc_html__('Only index products in stock', 'algolia-woo-indexer'), |
|
| 131 | + array($algowooindexer, 'algolia_woo_indexer_index_in_stock_output'), |
|
| 132 | 132 | 'algolia_woo_indexer', |
| 133 | 133 | 'algolia_woo_indexer_main' |
| 134 | 134 | ); |
| 135 | 135 | add_settings_field( |
| 136 | 136 | 'algolia_woo_indexer_automatically_send_new_products', |
| 137 | - esc_html__( 'Automatically index new products', 'algolia-woo-indexer' ), |
|
| 138 | - array( $algowooindexer, 'algolia_woo_indexer_automatically_send_new_products_output' ), |
|
| 137 | + esc_html__('Automatically index new products', 'algolia-woo-indexer'), |
|
| 138 | + array($algowooindexer, 'algolia_woo_indexer_automatically_send_new_products_output'), |
|
| 139 | 139 | 'algolia_woo_indexer', |
| 140 | 140 | 'algolia_woo_indexer_main' |
| 141 | 141 | ); |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | * @return void |
| 151 | 151 | */ |
| 152 | 152 | public static function algolia_woo_indexer_admin_api_key_output() { |
| 153 | - $api_key = get_option( ALGOWOO_DB_OPTION . '_admin_api_key' ); |
|
| 153 | + $api_key = get_option(ALGOWOO_DB_OPTION . '_admin_api_key'); |
|
| 154 | 154 | |
| 155 | - wp_nonce_field( 'algolia_woo_indexer_admin_api_nonce_action', 'algolia_woo_indexer_admin_api_nonce_name' ); |
|
| 155 | + wp_nonce_field('algolia_woo_indexer_admin_api_nonce_action', 'algolia_woo_indexer_admin_api_nonce_name'); |
|
| 156 | 156 | |
| 157 | 157 | echo "<input id='algolia_woo_indexer_admin_api_key' name='algolia_woo_indexer_admin_api_key[key]' |
| 158 | - type='text' value='" . esc_attr( $api_key ) . "' />"; |
|
| 158 | + type='text' value='" . esc_attr($api_key) . "' />"; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | * @return void |
| 165 | 165 | */ |
| 166 | 166 | public static function algolia_woo_indexer_application_id_output() { |
| 167 | - $application_id = get_option( ALGOWOO_DB_OPTION . '_application_id' ); |
|
| 167 | + $application_id = get_option(ALGOWOO_DB_OPTION . '_application_id'); |
|
| 168 | 168 | |
| 169 | 169 | echo "<input id='algolia_woo_indexer_application_id' name='algolia_woo_indexer_application_id[id]' |
| 170 | - type='text' value='" . esc_attr( $application_id ) . "' />"; |
|
| 170 | + type='text' value='" . esc_attr($application_id) . "' />"; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | * @return void |
| 177 | 177 | */ |
| 178 | 178 | public static function algolia_woo_indexer_index_name_output() { |
| 179 | - $index_name = get_option( ALGOWOO_DB_OPTION . '_index_name' ); |
|
| 179 | + $index_name = get_option(ALGOWOO_DB_OPTION . '_index_name'); |
|
| 180 | 180 | |
| 181 | 181 | echo "<input id='algolia_woo_indexer_index_name' name='algolia_woo_indexer_index_name[name]' |
| 182 | - type='text' value='" . esc_attr( $index_name ) . "' />"; |
|
| 182 | + type='text' value='" . esc_attr($index_name) . "' />"; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | * Sanitization is not really needed as the variable is not directly echoed |
| 193 | 193 | * But I have still done it to be 100% safe |
| 194 | 194 | */ |
| 195 | - $index_in_stock = get_option( ALGOWOO_DB_OPTION . '_index_in_stock' ); |
|
| 196 | - $index_in_stock = ( ! empty( $index_in_stock ) ) ? 1 : 0; |
|
| 195 | + $index_in_stock = get_option(ALGOWOO_DB_OPTION . '_index_in_stock'); |
|
| 196 | + $index_in_stock = ( ! empty($index_in_stock)) ? 1 : 0; |
|
| 197 | 197 | ?> |
| 198 | 198 | <input id="algolia_woo_indexer_index_in_stock" name="algolia_woo_indexer_index_in_stock[checked]" |
| 199 | - type="checkbox" <?php checked( 1, $index_in_stock ); ?> /> |
|
| 199 | + type="checkbox" <?php checked(1, $index_in_stock); ?> /> |
|
| 200 | 200 | <?php |
| 201 | 201 | } |
| 202 | 202 | |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | * Sanitization is not really needed as the variable is not directly echoed |
| 211 | 211 | * But I have still done it to be 100% safe |
| 212 | 212 | */ |
| 213 | - $automatically_send_new_products = get_option( ALGOWOO_DB_OPTION . '_automatically_send_new_products' ); |
|
| 214 | - $automatically_send_new_products = ( ! empty( $automatically_send_new_products ) ) ? 1 : 0; |
|
| 213 | + $automatically_send_new_products = get_option(ALGOWOO_DB_OPTION . '_automatically_send_new_products'); |
|
| 214 | + $automatically_send_new_products = ( ! empty($automatically_send_new_products)) ? 1 : 0; |
|
| 215 | 215 | ?> |
| 216 | 216 | <input id="algolia_woo_indexer_automatically_send_new_products" name="algolia_woo_indexer_automatically_send_new_products[checked]" |
| 217 | - type="checkbox" <?php checked( 1, $automatically_send_new_products ); ?> /> |
|
| 217 | + type="checkbox" <?php checked(1, $automatically_send_new_products); ?> /> |
|
| 218 | 218 | <?php |
| 219 | 219 | } |
| 220 | 220 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * @return void |
| 225 | 225 | */ |
| 226 | 226 | public static function algolia_woo_indexer_section_text() { |
| 227 | - echo esc_html__( 'Enter your settings here', 'algolia-woo-indexer' ); |
|
| 227 | + echo esc_html__('Enter your settings here', 'algolia-woo-indexer'); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | public static function maybe_send_products() { |
| 236 | 236 | |
| 237 | - if ( true === Algolia_Verify_Nonces::verify_send_products_nonce() ) { |
|
| 237 | + if (true === Algolia_Verify_Nonces::verify_send_products_nonce()) { |
|
| 238 | 238 | self::send_products_to_algolia(); |
| 239 | 239 | return; |
| 240 | 240 | } |
@@ -250,19 +250,19 @@ discard block |
||
| 250 | 250 | /** |
| 251 | 251 | * Fetch the option to see if we are going to automatically send new products |
| 252 | 252 | */ |
| 253 | - $automatically_send_new_products = get_option( ALGOWOO_DB_OPTION . '_automatically_send_new_products' ); |
|
| 253 | + $automatically_send_new_products = get_option(ALGOWOO_DB_OPTION . '_automatically_send_new_products'); |
|
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * Check that we have the minimum versions required and all of the required PHP extensions |
| 257 | 257 | */ |
| 258 | 258 | Algolia_Check_Requirements::check_unmet_requirements(); |
| 259 | 259 | |
| 260 | - if ( ! Algolia_Check_Requirements::algolia_wp_version_check() || ! Algolia_Check_Requirements::algolia_php_version_check() ) { |
|
| 260 | + if ( ! Algolia_Check_Requirements::algolia_wp_version_check() || ! Algolia_Check_Requirements::algolia_php_version_check()) { |
|
| 261 | 261 | add_action( |
| 262 | 262 | 'admin_notices', |
| 263 | - function () { |
|
| 263 | + function() { |
|
| 264 | 264 | echo '<div class="error notice"> |
| 265 | - <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> |
|
| 265 | + <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> |
|
| 266 | 266 | </div>'; |
| 267 | 267 | } |
| 268 | 268 | ); |
@@ -273,33 +273,33 @@ discard block |
||
| 273 | 273 | /** |
| 274 | 274 | * Setup translations |
| 275 | 275 | */ |
| 276 | - add_action( 'plugins_loaded', array( $ob_class, 'load_textdomain' ) ); |
|
| 276 | + add_action('plugins_loaded', array($ob_class, 'load_textdomain')); |
|
| 277 | 277 | |
| 278 | 278 | /** |
| 279 | 279 | * Add actions to setup admin menu |
| 280 | 280 | */ |
| 281 | - if ( is_admin() ) { |
|
| 282 | - add_action( 'admin_menu', array( $ob_class, 'admin_menu' ) ); |
|
| 283 | - add_action( 'admin_init', array( $ob_class, 'setup_settings_sections' ) ); |
|
| 284 | - add_action( 'admin_init', array( $ob_class, 'update_settings_options' ) ); |
|
| 285 | - add_action( 'admin_init', array( $ob_class, 'maybe_send_products' ) ); |
|
| 281 | + if (is_admin()) { |
|
| 282 | + add_action('admin_menu', array($ob_class, 'admin_menu')); |
|
| 283 | + add_action('admin_init', array($ob_class, 'setup_settings_sections')); |
|
| 284 | + add_action('admin_init', array($ob_class, 'update_settings_options')); |
|
| 285 | + add_action('admin_init', array($ob_class, 'maybe_send_products')); |
|
| 286 | 286 | |
| 287 | 287 | /** |
| 288 | 288 | * Register hook to automatically send new products if the option is set |
| 289 | 289 | */ |
| 290 | 290 | |
| 291 | - if ( '1' === $automatically_send_new_products ) { |
|
| 292 | - add_action( 'save_post', array( $ob_class, 'send_new_product_to_algolia' ), 10, 3 ); |
|
| 291 | + if ('1' === $automatically_send_new_products) { |
|
| 292 | + add_action('save_post', array($ob_class, 'send_new_product_to_algolia'), 10, 3); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - self::$plugin_url = admin_url( 'options-general.php?page=algolia-woo-indexer-settings' ); |
|
| 295 | + self::$plugin_url = admin_url('options-general.php?page=algolia-woo-indexer-settings'); |
|
| 296 | 296 | |
| 297 | - if ( ! is_plugin_active('woocommerce/woocommerce.php') ) { |
|
| 297 | + if ( ! is_plugin_active('woocommerce/woocommerce.php')) { |
|
| 298 | 298 | add_action( |
| 299 | 299 | 'admin_notices', |
| 300 | - function () { |
|
| 300 | + function() { |
|
| 301 | 301 | echo '<div class="error notice"> |
| 302 | - <p>' . esc_html__( 'WooCommerce plugin must be enabled for Algolia Woo Indexer to work.', 'algolia-woo-indexer' ) . '</p> |
|
| 302 | + <p>' . esc_html__('WooCommerce plugin must be enabled for Algolia Woo Indexer to work.', 'algolia-woo-indexer') . '</p> |
|
| 303 | 303 | </div>'; |
| 304 | 304 | } |
| 305 | 305 | ); |
@@ -315,12 +315,12 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @return void |
| 317 | 317 | */ |
| 318 | - public static function send_new_product_to_algolia( $post_id, $post ) { |
|
| 318 | + public static function send_new_product_to_algolia($post_id, $post) { |
|
| 319 | 319 | |
| 320 | - if ( 'publish' !== $post->post_status || 'product' !== $post->post_type ) { |
|
| 320 | + if ('publish' !== $post->post_status || 'product' !== $post->post_type) { |
|
| 321 | 321 | return; |
| 322 | 322 | } |
| 323 | - self::send_products_to_algolia( $post_id ); |
|
| 323 | + self::send_products_to_algolia($post_id); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | /** |
| 337 | 337 | * Do not proceed if we are going to send products |
| 338 | 338 | */ |
| 339 | - if ( true === Algolia_Verify_Nonces::verify_send_products_nonce() ) { |
|
| 339 | + if (true === Algolia_Verify_Nonces::verify_send_products_nonce()) { |
|
| 340 | 340 | return; |
| 341 | 341 | } |
| 342 | 342 | |
@@ -345,26 +345,26 @@ discard block |
||
| 345 | 345 | * |
| 346 | 346 | * @see https://www.php.net/manual/en/function.filter-input.php |
| 347 | 347 | */ |
| 348 | - $post_application_id = filter_input( INPUT_POST, 'algolia_woo_indexer_application_id', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
|
| 349 | - $post_api_key = filter_input( INPUT_POST, 'algolia_woo_indexer_admin_api_key', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
|
| 350 | - $post_index_name = filter_input( INPUT_POST, 'algolia_woo_indexer_index_name', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
|
| 351 | - $index_in_stock = filter_input( INPUT_POST, 'algolia_woo_indexer_index_in_stock', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
|
| 352 | - $automatically_send_new_products = filter_input( INPUT_POST, 'algolia_woo_indexer_automatically_send_new_products', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
|
| 348 | + $post_application_id = filter_input(INPUT_POST, 'algolia_woo_indexer_application_id', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); |
|
| 349 | + $post_api_key = filter_input(INPUT_POST, 'algolia_woo_indexer_admin_api_key', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); |
|
| 350 | + $post_index_name = filter_input(INPUT_POST, 'algolia_woo_indexer_index_name', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); |
|
| 351 | + $index_in_stock = filter_input(INPUT_POST, 'algolia_woo_indexer_index_in_stock', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); |
|
| 352 | + $automatically_send_new_products = filter_input(INPUT_POST, 'algolia_woo_indexer_automatically_send_new_products', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); |
|
| 353 | 353 | |
| 354 | 354 | /** |
| 355 | 355 | * Properly sanitize text fields before updating data |
| 356 | 356 | * |
| 357 | 357 | * @see https://developer.wordpress.org/reference/functions/sanitize_text_field/ |
| 358 | 358 | */ |
| 359 | - $filtered_application_id = sanitize_text_field( $post_application_id['id'] ); |
|
| 360 | - $filtered_api_key = sanitize_text_field( $post_api_key['key'] ); |
|
| 361 | - $filtered_index_name = sanitize_text_field( $post_index_name['name'] ); |
|
| 359 | + $filtered_application_id = sanitize_text_field($post_application_id['id']); |
|
| 360 | + $filtered_api_key = sanitize_text_field($post_api_key['key']); |
|
| 361 | + $filtered_index_name = sanitize_text_field($post_index_name['name']); |
|
| 362 | 362 | |
| 363 | 363 | /** |
| 364 | 364 | * Sanitizing by setting the value to either 1 or 0 |
| 365 | 365 | */ |
| 366 | - $filtered_index_in_stock = ( ! empty( $index_in_stock ) ) ? 1 : 0; |
|
| 367 | - $filtered_automatically_send_new_products = ( ! empty( $automatically_send_new_products ) ) ? 1 : 0; |
|
| 366 | + $filtered_index_in_stock = ( ! empty($index_in_stock)) ? 1 : 0; |
|
| 367 | + $filtered_automatically_send_new_products = ( ! empty($automatically_send_new_products)) ? 1 : 0; |
|
| 368 | 368 | |
| 369 | 369 | /** |
| 370 | 370 | * Values have been filtered and sanitized |
@@ -372,35 +372,35 @@ discard block |
||
| 372 | 372 | * |
| 373 | 373 | * @see https://developer.wordpress.org/reference/functions/update_option/ |
| 374 | 374 | */ |
| 375 | - if ( isset( $filtered_application_id ) && ( ! empty( $filtered_application_id ) ) ) { |
|
| 375 | + if (isset($filtered_application_id) && ( ! empty($filtered_application_id))) { |
|
| 376 | 376 | update_option( |
| 377 | 377 | ALGOWOO_DB_OPTION . '_application_id', |
| 378 | 378 | $filtered_application_id |
| 379 | 379 | ); |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - if ( isset( $filtered_api_key ) && ( ! empty( $filtered_api_key ) ) ) { |
|
| 382 | + if (isset($filtered_api_key) && ( ! empty($filtered_api_key))) { |
|
| 383 | 383 | update_option( |
| 384 | 384 | ALGOWOO_DB_OPTION . '_admin_api_key', |
| 385 | 385 | $filtered_api_key |
| 386 | 386 | ); |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - if ( isset( $filtered_index_name ) && ( ! empty( $filtered_index_name ) ) ) { |
|
| 389 | + if (isset($filtered_index_name) && ( ! empty($filtered_index_name))) { |
|
| 390 | 390 | update_option( |
| 391 | 391 | ALGOWOO_DB_OPTION . '_index_name', |
| 392 | 392 | $filtered_index_name |
| 393 | 393 | ); |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - if ( isset( $filtered_index_in_stock ) && ( ! empty( $filtered_index_in_stock ) ) ) { |
|
| 396 | + if (isset($filtered_index_in_stock) && ( ! empty($filtered_index_in_stock))) { |
|
| 397 | 397 | update_option( |
| 398 | 398 | ALGOWOO_DB_OPTION . '_index_in_stock', |
| 399 | 399 | $filtered_index_in_stock |
| 400 | 400 | ); |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - if ( isset( $filtered_automatically_send_new_products ) && ( ! empty( $filtered_automatically_send_new_products ) ) ) { |
|
| 403 | + if (isset($filtered_automatically_send_new_products) && ( ! empty($filtered_automatically_send_new_products))) { |
|
| 404 | 404 | update_option( |
| 405 | 405 | ALGOWOO_DB_OPTION . '_automatically_send_new_products', |
| 406 | 406 | $filtered_automatically_send_new_products |
@@ -414,33 +414,33 @@ discard block |
||
| 414 | 414 | * @param Int $id Product to send to Algolia if we send only a single product |
| 415 | 415 | * @return void |
| 416 | 416 | */ |
| 417 | - public static function send_products_to_algolia( $id = '' ) { |
|
| 417 | + public static function send_products_to_algolia($id = '') { |
|
| 418 | 418 | /** |
| 419 | 419 | * Remove classes from plugin URL and autoload Algolia with Composer |
| 420 | 420 | */ |
| 421 | 421 | |
| 422 | - $base_plugin_directory = str_replace( 'classes', '', dirname( __FILE__ ) ); |
|
| 422 | + $base_plugin_directory = str_replace('classes', '', dirname(__FILE__)); |
|
| 423 | 423 | require_once $base_plugin_directory . '/vendor/autoload.php'; |
| 424 | 424 | |
| 425 | 425 | /** |
| 426 | 426 | * Fetch the required variables from the Settings API |
| 427 | 427 | */ |
| 428 | 428 | |
| 429 | - $algolia_application_id = get_option( ALGOWOO_DB_OPTION . '_application_id' ); |
|
| 430 | - $algolia_api_key = get_option( ALGOWOO_DB_OPTION . '_admin_api_key' ); |
|
| 431 | - $algolia_index_name = get_option( ALGOWOO_DB_OPTION . '_index_name' ); |
|
| 429 | + $algolia_application_id = get_option(ALGOWOO_DB_OPTION . '_application_id'); |
|
| 430 | + $algolia_api_key = get_option(ALGOWOO_DB_OPTION . '_admin_api_key'); |
|
| 431 | + $algolia_index_name = get_option(ALGOWOO_DB_OPTION . '_index_name'); |
|
| 432 | 432 | |
| 433 | - $index_in_stock = get_option( ALGOWOO_DB_OPTION . '_index_in_stock' ); |
|
| 433 | + $index_in_stock = get_option(ALGOWOO_DB_OPTION . '_index_in_stock'); |
|
| 434 | 434 | |
| 435 | 435 | /** |
| 436 | 436 | * Display admin notice and return if not all values have been set |
| 437 | 437 | */ |
| 438 | - if ( empty( $algolia_application_id ) || empty( $algolia_api_key || empty( $algolia_index_name ) ) ) { |
|
| 438 | + if (empty($algolia_application_id) || empty($algolia_api_key || empty($algolia_index_name))) { |
|
| 439 | 439 | add_action( |
| 440 | 440 | 'admin_notices', |
| 441 | - function () { |
|
| 441 | + function() { |
|
| 442 | 442 | echo '<div class="error notice"> |
| 443 | - <p>' . esc_html__( 'All settings need to be set for the plugin to work.', 'algolia-woo-indexer' ) . '</p> |
|
| 443 | + <p>' . esc_html__('All settings need to be set for the plugin to work.', 'algolia-woo-indexer') . '</p> |
|
| 444 | 444 | </div>'; |
| 445 | 445 | } |
| 446 | 446 | ); |
@@ -450,19 +450,19 @@ discard block |
||
| 450 | 450 | /** |
| 451 | 451 | * Initiate the Algolia client |
| 452 | 452 | */ |
| 453 | - self::$algolia = \Algolia\AlgoliaSearch\SearchClient::create( $algolia_application_id, $algolia_api_key ); |
|
| 453 | + self::$algolia = \Algolia\AlgoliaSearch\SearchClient::create($algolia_application_id, $algolia_api_key); |
|
| 454 | 454 | |
| 455 | 455 | /** |
| 456 | 456 | * Check if we can connect, if not, handle the exception, display an error and then return |
| 457 | 457 | */ |
| 458 | 458 | try { |
| 459 | 459 | self::$algolia->listApiKeys(); |
| 460 | - } catch ( \Algolia\AlgoliaSearch\Exceptions\UnreachableException $error ) { |
|
| 460 | + } catch (\Algolia\AlgoliaSearch\Exceptions\UnreachableException $error) { |
|
| 461 | 461 | add_action( |
| 462 | 462 | 'admin_notices', |
| 463 | - function () { |
|
| 463 | + function() { |
|
| 464 | 464 | echo '<div class="error notice"> |
| 465 | - <p>' . esc_html__( 'An error has been encountered. Please check your application ID and API key. ', 'algolia-woo-indexer' ) . '</p> |
|
| 465 | + <p>' . esc_html__('An error has been encountered. Please check your application ID and API key. ', 'algolia-woo-indexer') . '</p> |
|
| 466 | 466 | </div>'; |
| 467 | 467 | } |
| 468 | 468 | ); |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | /** |
| 473 | 473 | * Initialize the search index and set the name to the option from the database |
| 474 | 474 | */ |
| 475 | - $index = self::$algolia->initIndex( $algolia_index_name ); |
|
| 475 | + $index = self::$algolia->initIndex($algolia_index_name); |
|
| 476 | 476 | |
| 477 | 477 | /** |
| 478 | 478 | * Setup arguments for sending all products to Algolia |
@@ -488,10 +488,10 @@ discard block |
||
| 488 | 488 | /** |
| 489 | 489 | * Setup arguments for sending only a single product |
| 490 | 490 | */ |
| 491 | - if ( isset( $id ) && '' !== $id ) { |
|
| 491 | + if (isset($id) && '' !== $id) { |
|
| 492 | 492 | $arguments = array( |
| 493 | 493 | 'status' => 'publish', |
| 494 | - 'include' => array( $id ), |
|
| 494 | + 'include' => array($id), |
|
| 495 | 495 | 'paginate' => false, |
| 496 | 496 | ); |
| 497 | 497 | } |
@@ -501,17 +501,17 @@ discard block |
||
| 501 | 501 | * |
| 502 | 502 | * @see https://docs.woocommerce.com/wc-apidocs/function-wc_get_products.html |
| 503 | 503 | */ |
| 504 | - $products = wc_get_products( $arguments ); |
|
| 504 | + $products = wc_get_products($arguments); |
|
| 505 | 505 | |
| 506 | - if ( $products ) { |
|
| 506 | + if ($products) { |
|
| 507 | 507 | $records = array(); |
| 508 | 508 | $record = array(); |
| 509 | 509 | |
| 510 | - foreach ( $products as $product ) { |
|
| 510 | + foreach ($products as $product) { |
|
| 511 | 511 | /** |
| 512 | 512 | * Check if product is in stock if $index_in_stock is set to 1 |
| 513 | 513 | */ |
| 514 | - if ( '1' === $index_in_stock && $product->is_in_stock() ) { |
|
| 514 | + if ('1' === $index_in_stock && $product->is_in_stock()) { |
|
| 515 | 515 | /** |
| 516 | 516 | * Extract image from $product->get_image() |
| 517 | 517 | */ |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | /** |
| 534 | 534 | * Do not check if product is in stock if $index_in_stock is set to 0 |
| 535 | 535 | */ |
| 536 | - if ( '0' === $index_in_stock ) { |
|
| 536 | + if ('0' === $index_in_stock) { |
|
| 537 | 537 | /** |
| 538 | 538 | * Extract image from $product->get_image() |
| 539 | 539 | */ |
@@ -561,14 +561,14 @@ discard block |
||
| 561 | 561 | * Send the information to Algolia and save the result |
| 562 | 562 | * If result is NullResponse, print an error message |
| 563 | 563 | */ |
| 564 | - $result = $index->saveObjects( $records ); |
|
| 564 | + $result = $index->saveObjects($records); |
|
| 565 | 565 | |
| 566 | - if ( 'Algolia\AlgoliaSearch\Response\NullResponse' === get_class( $result ) ) { |
|
| 566 | + if ('Algolia\AlgoliaSearch\Response\NullResponse' === get_class($result)) { |
|
| 567 | 567 | add_action( |
| 568 | 568 | 'admin_notices', |
| 569 | - function () { |
|
| 569 | + function() { |
|
| 570 | 570 | echo '<div class="error notice is-dismissible"> |
| 571 | - <p>' . esc_html__( 'No response from the server. Please check your settings and try again ', 'algolia-woo-indexer' ) . '</p> |
|
| 571 | + <p>' . esc_html__('No response from the server. Please check your settings and try again ', 'algolia-woo-indexer') . '</p> |
|
| 572 | 572 | </div>'; |
| 573 | 573 | } |
| 574 | 574 | ); |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | * Display success message |
| 580 | 580 | */ |
| 581 | 581 | echo '<div class="notice notice-success is-dismissible"> |
| 582 | - <p>' . esc_html__( 'Product(s) sent to Algolia.', 'algolia-woo-indexer' ) . '</p> |
|
| 582 | + <p>' . esc_html__('Product(s) sent to Algolia.', 'algolia-woo-indexer') . '</p> |
|
| 583 | 583 | </div>'; |
| 584 | 584 | } |
| 585 | 585 | |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | * @param string $input Settings text data |
| 590 | 590 | * @return array |
| 591 | 591 | */ |
| 592 | - public static function settings_fields_validate_options( $input ) { |
|
| 592 | + public static function settings_fields_validate_options($input) { |
|
| 593 | 593 | $valid = array(); |
| 594 | 594 | $valid['name'] = preg_replace( |
| 595 | 595 | '/[^a-zA-Z\s]/', |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | * @return void |
| 606 | 606 | */ |
| 607 | 607 | public static function load_textdomain() { |
| 608 | - load_plugin_textdomain( 'algolia-woo-indexer', false, basename( dirname( __FILE__ ) ) . '/languages/' ); |
|
| 608 | + load_plugin_textdomain('algolia-woo-indexer', false, basename(dirname(__FILE__)) . '/languages/'); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
@@ -616,11 +616,11 @@ discard block |
||
| 616 | 616 | public static function admin_menu() { |
| 617 | 617 | add_submenu_page( |
| 618 | 618 | 'options-general.php', |
| 619 | - esc_html__( 'Algolia Woo Indexer Settings', 'algolia-woo-indexer' ), |
|
| 620 | - esc_html__( 'Algolia Woo Indexer Settings', 'algolia-woo-indexer' ), |
|
| 619 | + esc_html__('Algolia Woo Indexer Settings', 'algolia-woo-indexer'), |
|
| 620 | + esc_html__('Algolia Woo Indexer Settings', 'algolia-woo-indexer'), |
|
| 621 | 621 | 'manage_options', |
| 622 | 622 | 'algolia-woo-indexer-settings', |
| 623 | - array( get_called_class(), 'algolia_woo_indexer_settings' ) |
|
| 623 | + array(get_called_class(), 'algolia_woo_indexer_settings') |
|
| 624 | 624 | ); |
| 625 | 625 | } |
| 626 | 626 | |
@@ -633,23 +633,23 @@ discard block |
||
| 633 | 633 | /** |
| 634 | 634 | * Verify that the user can access the settings page |
| 635 | 635 | */ |
| 636 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 637 | - wp_die( esc_html__( 'Action not allowed.', 'algolia_woo_indexer_settings' ) ); |
|
| 636 | + if ( ! current_user_can('manage_options')) { |
|
| 637 | + wp_die(esc_html__('Action not allowed.', 'algolia_woo_indexer_settings')); |
|
| 638 | 638 | } |
| 639 | 639 | ?> |
| 640 | 640 | <div class="wrap"> |
| 641 | - <h1><?php esc_html__( 'Algolia Woo Indexer Settings', 'algolia-woo-indexer' ); ?></h1> |
|
| 642 | - <form action="<?php echo esc_url( self::$plugin_url ); ?>" method="POST"> |
|
| 641 | + <h1><?php esc_html__('Algolia Woo Indexer Settings', 'algolia-woo-indexer'); ?></h1> |
|
| 642 | + <form action="<?php echo esc_url(self::$plugin_url); ?>" method="POST"> |
|
| 643 | 643 | <?php |
| 644 | - settings_fields( 'algolia_woo_options' ); |
|
| 645 | - do_settings_sections( 'algolia_woo_indexer' ); |
|
| 646 | - submit_button( '', 'primary wide' ); |
|
| 644 | + settings_fields('algolia_woo_options'); |
|
| 645 | + do_settings_sections('algolia_woo_indexer'); |
|
| 646 | + submit_button('', 'primary wide'); |
|
| 647 | 647 | ?> |
| 648 | 648 | </form> |
| 649 | - <form action="<?php echo esc_url( self::$plugin_url ); ?>" method="POST"> |
|
| 650 | - <?php wp_nonce_field( 'send_products_to_algolia_nonce_action', 'send_products_to_algolia_nonce_name' ); ?> |
|
| 649 | + <form action="<?php echo esc_url(self::$plugin_url); ?>" method="POST"> |
|
| 650 | + <?php wp_nonce_field('send_products_to_algolia_nonce_action', 'send_products_to_algolia_nonce_name'); ?> |
|
| 651 | 651 | <input type="hidden" name="send_products_to_algolia" id="send_products_to_algolia" value="true" /> |
| 652 | - <?php submit_button( esc_html__( 'Send products to Algolia', 'algolia_woo_indexer_settings' ), 'primary wide', '', false ); ?> |
|
| 652 | + <?php submit_button(esc_html__('Send products to Algolia', 'algolia_woo_indexer_settings'), 'primary wide', '', false); ?> |
|
| 653 | 653 | </form> |
| 654 | 654 | </div> |
| 655 | 655 | <?php |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | * @return object |
| 662 | 662 | */ |
| 663 | 663 | public static function get_instance() { |
| 664 | - if ( ! self::$instance ) { |
|
| 664 | + if ( ! self::$instance) { |
|
| 665 | 665 | self::$instance = new Algolia_Woo_Indexer(); |
| 666 | 666 | } |
| 667 | 667 | return self::$instance; |
@@ -677,47 +677,47 @@ discard block |
||
| 677 | 677 | /** |
| 678 | 678 | * Set default values for options if not already set |
| 679 | 679 | */ |
| 680 | - $index_in_stock = get_option( ALGOWOO_DB_OPTION . '_index_in_stock' ); |
|
| 681 | - $automatically_send_new_products = get_option( ALGOWOO_DB_OPTION . '_automatically_send_new_products' ); |
|
| 682 | - $algolia_application_id = get_option( ALGOWOO_DB_OPTION . '_application_id' ); |
|
| 683 | - $algolia_api_key = get_option( ALGOWOO_DB_OPTION . '_admin_api_key' ); |
|
| 684 | - $algolia_index_name = get_option( ALGOWOO_DB_OPTION . '_index_name' ); |
|
| 680 | + $index_in_stock = get_option(ALGOWOO_DB_OPTION . '_index_in_stock'); |
|
| 681 | + $automatically_send_new_products = get_option(ALGOWOO_DB_OPTION . '_automatically_send_new_products'); |
|
| 682 | + $algolia_application_id = get_option(ALGOWOO_DB_OPTION . '_application_id'); |
|
| 683 | + $algolia_api_key = get_option(ALGOWOO_DB_OPTION . '_admin_api_key'); |
|
| 684 | + $algolia_index_name = get_option(ALGOWOO_DB_OPTION . '_index_name'); |
|
| 685 | 685 | |
| 686 | - if ( empty( $index_in_stock ) ) { |
|
| 686 | + if (empty($index_in_stock)) { |
|
| 687 | 687 | add_option( |
| 688 | 688 | ALGOWOO_DB_OPTION . '_index_in_stock', |
| 689 | 689 | '0' |
| 690 | 690 | ); |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | - if ( empty( $automatically_send_new_products ) ) { |
|
| 693 | + if (empty($automatically_send_new_products)) { |
|
| 694 | 694 | add_option( |
| 695 | 695 | ALGOWOO_DB_OPTION . '_automatically_send_new_products', |
| 696 | 696 | '0' |
| 697 | 697 | ); |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | - if ( empty( $algolia_application_id ) ) { |
|
| 700 | + if (empty($algolia_application_id)) { |
|
| 701 | 701 | add_option( |
| 702 | 702 | ALGOWOO_DB_OPTION . '_application_id', |
| 703 | 703 | 'Change me' |
| 704 | 704 | ); |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | - if ( empty( $algolia_api_key ) ) { |
|
| 707 | + if (empty($algolia_api_key)) { |
|
| 708 | 708 | add_option( |
| 709 | 709 | ALGOWOO_DB_OPTION . '_admin_api_key', |
| 710 | 710 | 'Change me' |
| 711 | 711 | ); |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | - if ( empty( $algolia_index_name ) ) { |
|
| 714 | + if (empty($algolia_index_name)) { |
|
| 715 | 715 | add_option( |
| 716 | 716 | ALGOWOO_DB_OPTION . '_index_name', |
| 717 | 717 | 'Change me' |
| 718 | 718 | ); |
| 719 | 719 | } |
| 720 | - set_transient( self::PLUGIN_TRANSIENT, true ); |
|
| 720 | + set_transient(self::PLUGIN_TRANSIENT, true); |
|
| 721 | 721 | } |
| 722 | 722 | |
| 723 | 723 | /** |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | * @return void |
| 727 | 727 | */ |
| 728 | 728 | public static function deactivate_plugin() { |
| 729 | - delete_transient( self::PLUGIN_TRANSIENT, true ); |
|
| 729 | + delete_transient(self::PLUGIN_TRANSIENT, true); |
|
| 730 | 730 | } |
| 731 | 731 | } |
| 732 | 732 | } |
@@ -18,64 +18,64 @@ |
||
| 18 | 18 | * Abort if this file is called directly |
| 19 | 19 | */ |
| 20 | 20 | if (! defined('ABSPATH')) { |
| 21 | - exit; |
|
| 21 | + exit; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | if (! class_exists('Algolia_Check_Requirements')) { |
| 25 | - /** |
|
| 26 | - * Check requirements for Algolia plugin |
|
| 27 | - */ |
|
| 28 | - class Algolia_Check_Requirements |
|
| 29 | - { |
|
| 25 | + /** |
|
| 26 | + * Check requirements for Algolia plugin |
|
| 27 | + */ |
|
| 28 | + class Algolia_Check_Requirements |
|
| 29 | + { |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Check for required PHP version. |
|
| 33 | - * |
|
| 34 | - * @return bool |
|
| 35 | - */ |
|
| 36 | - public static function algolia_php_version_check() |
|
| 37 | - { |
|
| 38 | - if (version_compare(PHP_VERSION, ALGOLIA_MIN_PHP_VERSION, '<')) { |
|
| 39 | - return false; |
|
| 40 | - } |
|
| 41 | - return true; |
|
| 42 | - } |
|
| 31 | + /** |
|
| 32 | + * Check for required PHP version. |
|
| 33 | + * |
|
| 34 | + * @return bool |
|
| 35 | + */ |
|
| 36 | + public static function algolia_php_version_check() |
|
| 37 | + { |
|
| 38 | + if (version_compare(PHP_VERSION, ALGOLIA_MIN_PHP_VERSION, '<')) { |
|
| 39 | + return false; |
|
| 40 | + } |
|
| 41 | + return true; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Check for required WordPress version. |
|
| 46 | - * |
|
| 47 | - * @return bool |
|
| 48 | - */ |
|
| 49 | - public static function algolia_wp_version_check() |
|
| 50 | - { |
|
| 51 | - if (version_compare($GLOBALS['wp_version'], ALGOLIA_MIN_WP_VERSION, '<')) { |
|
| 52 | - return false; |
|
| 53 | - } |
|
| 54 | - return true; |
|
| 55 | - } |
|
| 44 | + /** |
|
| 45 | + * Check for required WordPress version. |
|
| 46 | + * |
|
| 47 | + * @return bool |
|
| 48 | + */ |
|
| 49 | + public static function algolia_wp_version_check() |
|
| 50 | + { |
|
| 51 | + if (version_compare($GLOBALS['wp_version'], ALGOLIA_MIN_WP_VERSION, '<')) { |
|
| 52 | + return false; |
|
| 53 | + } |
|
| 54 | + return true; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Check that we have all of the required PHP extensions installed |
|
| 59 | - * |
|
| 60 | - * @return void |
|
| 61 | - */ |
|
| 62 | - public static function check_unmet_requirements() |
|
| 63 | - { |
|
| 64 | - if (! extension_loaded('mbstring')) { |
|
| 65 | - echo '<div class="error notice"> |
|
| 57 | + /** |
|
| 58 | + * Check that we have all of the required PHP extensions installed |
|
| 59 | + * |
|
| 60 | + * @return void |
|
| 61 | + */ |
|
| 62 | + public static function check_unmet_requirements() |
|
| 63 | + { |
|
| 64 | + if (! extension_loaded('mbstring')) { |
|
| 65 | + echo '<div class="error notice"> |
|
| 66 | 66 | <p>' . esc_html__('Algolia Woo Indexer requires the "mbstring" PHP extension to be enabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
| 67 | 67 | </div>'; |
| 68 | - } elseif (! function_exists('mb_ereg_replace')) { |
|
| 69 | - echo '<div class="error notice"> |
|
| 68 | + } elseif (! function_exists('mb_ereg_replace')) { |
|
| 69 | + echo '<div class="error notice"> |
|
| 70 | 70 | <p>' . esc_html__('Algolia Woo Indexer needs "mbregex" NOT to be disabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
| 71 | 71 | </div>'; |
| 72 | - } |
|
| 73 | - if (! extension_loaded('curl')) { |
|
| 74 | - echo '<div class="error notice"> |
|
| 72 | + } |
|
| 73 | + if (! extension_loaded('curl')) { |
|
| 74 | + echo '<div class="error notice"> |
|
| 75 | 75 | <p>' . esc_html__('Algolia Woo Indexer requires the "cURL" PHP extension to be enabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
| 76 | 76 | </div>'; |
| 77 | - return; |
|
| 78 | - } |
|
| 79 | - } |
|
| 77 | + return; |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | 80 | } |
| 81 | 81 | } |
@@ -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 | */ |
@@ -61,16 +61,16 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public static function check_unmet_requirements() |
| 63 | 63 | { |
| 64 | - if (! extension_loaded('mbstring')) { |
|
| 64 | + if ( ! extension_loaded('mbstring')) { |
|
| 65 | 65 | echo '<div class="error notice"> |
| 66 | 66 | <p>' . esc_html__('Algolia Woo Indexer requires the "mbstring" PHP extension to be enabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
| 67 | 67 | </div>'; |
| 68 | - } elseif (! function_exists('mb_ereg_replace')) { |
|
| 68 | + } elseif ( ! function_exists('mb_ereg_replace')) { |
|
| 69 | 69 | echo '<div class="error notice"> |
| 70 | 70 | <p>' . esc_html__('Algolia Woo Indexer needs "mbregex" NOT to be disabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
| 71 | 71 | </div>'; |
| 72 | 72 | } |
| 73 | - if (! extension_loaded('curl')) { |
|
| 73 | + if ( ! extension_loaded('curl')) { |
|
| 74 | 74 | echo '<div class="error notice"> |
| 75 | 75 | <p>' . esc_html__('Algolia Woo Indexer requires the "cURL" PHP extension to be enabled. Please contact your hosting provider.', 'algolia-woo-indexer') . '</p> |
| 76 | 76 | </div>'; |