diff --git a/class-autoloader.php b/class-autoloader.php index 1486963c..c5745514 100644 --- a/class-autoloader.php +++ b/class-autoloader.php @@ -90,10 +90,10 @@ class Autoloader { protected static function check_namespaces( $class_name ) { $found = false; foreach ( static::$namespaces as $namespace ) { - if ( substr( $class_name, 0, strlen( $namespace ) ) == $namespace ) { + if ( substr( $class_name, 0, strlen( $namespace ) ) === $namespace ) { $found = true; } - if ( $namespace == 'OBFX_Module' && substr( $class_name, strlen( $namespace ) * ( -1 ), strlen( $namespace ) ) == $namespace ) { + if ( $namespace === 'OBFX_Module' && substr( $class_name, strlen( $namespace ) * ( -1 ), strlen( $namespace ) ) === $namespace ) { return static::module_loader( $class_name ); } } @@ -147,7 +147,7 @@ public static function loader( $class_name ) { */ public static function module_loader( $class_name ) { $module_name = str_replace( '_', '-', strtolower( str_replace( '_OBFX_Module', '', $class_name ) ) ); - if ( static::$plugins_path != '' ) { + if ( static::$plugins_path !== '' ) { $directories = glob( static::$plugins_path . '*' . DIRECTORY_SEPARATOR . 'obfx_modules' . DIRECTORY_SEPARATOR . $module_name, GLOB_ONLYDIR ); foreach ( $directories as $directory ) { $filename = $directory . DIRECTORY_SEPARATOR . 'init.php'; diff --git a/core/app/abstract/class-orbit-fox-module-abstract.php b/core/app/abstract/class-orbit-fox-module-abstract.php index 232d7d54..33548fa4 100644 --- a/core/app/abstract/class-orbit-fox-module-abstract.php +++ b/core/app/abstract/class-orbit-fox-module-abstract.php @@ -207,13 +207,15 @@ public function get_notices() { */ public function update_showed_notices() { $showed_notices = $this->get_status( 'showed_notices' ); + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison if ( $showed_notices == false ) { $showed_notices = array(); } foreach ( $this->notices as $notice ) { + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison if ( $notice['display_always'] == false ) { $hash = md5( serialize( $notice ) ); - if ( ! in_array( $hash, $showed_notices ) ) { + if ( ! in_array( $hash, $showed_notices, true ) ) { $showed_notices[] = $hash; } } @@ -294,7 +296,7 @@ public abstract function hooks(); * @return bool */ final public function get_is_active() { - if ( $this->auto == true ) { + if ( $this->auto === true ) { return true; } if ( ! isset( $this->model ) ) { @@ -490,7 +492,7 @@ private function set_styles( $enqueue, $prefix ) { $order = 0; $map = array(); foreach ( $enqueue['css'] as $file_name => $dependencies ) { - if ( $dependencies == false ) { + if ( $dependencies === false ) { $dependencies = array(); } else { // check if any dependency has been loaded by us. If yes, then use that id as the dependency. @@ -564,7 +566,7 @@ private function set_scripts( $enqueue, $prefix ) { $order = 0; $map = array(); foreach ( $enqueue['js'] as $file_name => $dependencies ) { - if ( $dependencies == false ) { + if ( $dependencies === false ) { $dependencies = array(); } else { // check if any dependency has been loaded by us. If yes, then use that id as the dependency. diff --git a/core/app/class-orbit-fox-admin.php b/core/app/class-orbit-fox-admin.php index e43b4747..9d57f678 100644 --- a/core/app/class-orbit-fox-admin.php +++ b/core/app/class-orbit-fox-admin.php @@ -76,7 +76,7 @@ public function enqueue_styles() { if ( empty( $screen ) ) { return; } - if ( in_array( $screen->id, array( 'toplevel_page_obfx_companion' ) ) ) { + if ( in_array( $screen->id, array( 'toplevel_page_obfx_companion' ), true ) ) { wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . '../assets/css/orbit-fox-admin.css', array(), $this->version, 'all' ); } do_action( 'obfx_admin_enqueue_styles' ); @@ -105,7 +105,7 @@ public function enqueue_scripts() { if ( empty( $screen ) ) { return; } - if ( in_array( $screen->id, array( 'toplevel_page_obfx_companion' ) ) ) { + if ( in_array( $screen->id, array( 'toplevel_page_obfx_companion' ), true ) ) { wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . '../assets/js/orbit-fox-admin.js', array( 'jquery' ), $this->version, false ); } do_action( 'obfx_admin_enqueue_scripts' ); @@ -163,6 +163,7 @@ class="notice-dismiss" style="text-decoration: none;"> function visit_dashboard_notice_dismiss() { global $current_user; $user_id = $current_user->ID; + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison if ( isset( $_GET['obfx_ignore_visit_dashboard_notice'] ) && '0' == $_GET['obfx_ignore_visit_dashboard_notice'] ) { add_user_meta( $user_id, 'obfx_ignore_visit_dashboard_notice', 'true', true ); wp_safe_redirect( admin_url( 'admin.php?page=obfx_companion' ) ); @@ -419,7 +420,7 @@ public function try_module_activate( $data ) { * @access public */ public function trigger_activate_deactivate( $active_status, Orbit_Fox_Module_Abstract $module ) { - if ( $active_status == true ) { + if ( $active_status === true ) { do_action( $module->get_slug() . '_activate' ); } else { do_action( $module->get_slug() . '_deactivate' ); @@ -457,8 +458,10 @@ public function page_modules_render() { $data = array( 'notice' => $notice, ); - if ( $notice['display_always'] == false && ! in_array( $hash, $showed_notices ) ) { + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + if ( $notice['display_always'] == false && ! in_array( $hash, $showed_notices, true ) ) { $toasts .= $rdh->get_partial( 'module-toast', $data ); + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison } elseif ( $notice['display_always'] == true ) { $toasts .= $rdh->get_partial( 'module-toast', $data ); } @@ -466,7 +469,7 @@ public function page_modules_render() { } $module->update_showed_notices(); - if ( $module->auto == false ) { + if ( $module->auto === false ) { $count_modules ++; $checked = ''; if ( $module->get_is_active() ) { @@ -510,7 +513,7 @@ public function page_modules_render() { $no_modules = false; $empty_tpl = ''; - if ( $count_modules == 0 ) { + if ( $count_modules === 0 ) { $no_modules = true; $empty_tpl = $rdh->get_partial( 'empty', diff --git a/core/app/helpers/class-orbit-fox-render-helper.php b/core/app/helpers/class-orbit-fox-render-helper.php index c431d9b7..c8d0b4e7 100644 --- a/core/app/helpers/class-orbit-fox-render-helper.php +++ b/core/app/helpers/class-orbit-fox-render-helper.php @@ -191,7 +191,7 @@ private function field_text( $option = array(), $is_email = false ) { */ private function set_field_value( $option = array() ) { $field_value = $option['default']; - if ( isset( $option['value'] ) && $option['value'] != '' ) { + if ( isset( $option['value'] ) && $option['value'] !== '' ) { $field_value = $option['value']; } @@ -306,6 +306,7 @@ private function field_select( $option = array() ) { $select_options = ''; foreach ( $option['options'] as $value => $label ) { $is_selected = ''; + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison if ( $field_value == $value ) { $is_selected = 'selected'; } @@ -335,7 +336,7 @@ private function field_radio( $option = array() ) { $select_options = ''; foreach ( $option['options'] as $value => $label ) { $checked = ''; - if ( $value == $field_value ) { + if ( $value === $field_value ) { $checked = 'checked'; } $select_options .= $this->generate_check_type( 'radio', $value, $checked, $label, $option ); diff --git a/core/app/views/modules-page.php b/core/app/views/modules-page.php index 5fd41f01..2a1b7359 100644 --- a/core/app/views/modules-page.php +++ b/core/app/views/modules-page.php @@ -92,7 +92,7 @@