diff --git a/bootstrap/load.php b/bootstrap/load.php
index 3dcd955d..0095d663 100644
--- a/bootstrap/load.php
+++ b/bootstrap/load.php
@@ -43,7 +43,7 @@ function _init_locale( $ignore = false ) {
\load_plugin_textdomain(
'the-seo-framework-extension-manager',
false,
- dirname( TSF_EXTENSION_MANAGER_PLUGIN_BASENAME ) . DIRECTORY_SEPARATOR . 'language'
+ \dirname( TSF_EXTENSION_MANAGER_PLUGIN_BASENAME ) . DIRECTORY_SEPARATOR . 'language'
);
}
}
@@ -89,6 +89,7 @@ function _protect_options() {
*/
function _pre_execute_protect_option( $new_value, $old_value, $option ) {
+ // phpcs:ignore, TSF.Performance.Functions.PHP -- required
if ( false === class_exists( 'TSF_Extension_Manager\SecureOption', true ) )
\wp_die( '' . \esc_html( $option ) . '
is a protected option.' );
@@ -161,7 +162,7 @@ function _init_tsf_extension_manager() {
* @since 1.5.0
*/
\do_action( 'tsfem_extensions_initialized' );
- } elseif ( ! function_exists( '\\the_seo_framework' ) ) {
+ } elseif ( ! \function_exists( '\\the_seo_framework' ) ) {
/**
* Nothing is loaded at this point; not even The SEO Framework.
*
@@ -192,7 +193,7 @@ function _register_autoloader() {
];
foreach ( $integrity_classes as $_class )
- $iniquity = class_exists( $_class, false );
+ $iniquity = class_exists( $_class, false ); // phpcs:ignore, TSF.Performance.Functions.PHP -- required.
$iniquity and die;
/**
@@ -223,7 +224,7 @@ function can_load_class() {
if ( isset( $can_load ) )
return $can_load;
- if ( function_exists( '\\the_seo_framework' ) ) {
+ if ( \function_exists( '\\the_seo_framework' ) ) {
if ( version_compare( THE_SEO_FRAMEWORK_VERSION, '4.0.5', '>=' ) && \the_seo_framework()->loaded )
return $can_load = (bool) \apply_filters( 'tsf_extension_manager_enabled', true );
}
diff --git a/bootstrap/update.php b/bootstrap/update.php
index d1baeccc..0e8f80a6 100644
--- a/bootstrap/update.php
+++ b/bootstrap/update.php
@@ -22,7 +22,7 @@ function _prepare_tsf_installer() {
if ( ! \current_user_can( 'install_plugins' ) ) return;
if ( 'update.php' === $GLOBALS['pagenow'] ) return;
- if ( ! function_exists( '\\get_plugins' ) )
+ if ( ! \function_exists( '\\get_plugins' ) )
require_once ABSPATH . 'wp-admin/includes/plugin.php';
$plugins = \get_plugins();
@@ -96,7 +96,7 @@ function _nag_install_tsf() {
'%3$s',
\esc_url( $details_url ),
/* translators: %s: Plugin name */
- \esc_attr( sprintf( __( 'Learn more about %s', 'the-seo-framework-extension-manager' ), $tsf_text ) ),
+ \esc_attr( sprintf( \__( 'Learn more about %s', 'the-seo-framework-extension-manager' ), $tsf_text ) ),
\esc_html__( 'View plugin details', 'the-seo-framework-extension-manager' )
);
$nag = sprintf(
@@ -227,14 +227,14 @@ function _hook_plugins_api( $res, $action, $args ) {
\esc_url( TSF_EXTENSION_MANAGER_DL_URI ),
'https://theseoframework.com/contact/'
);
- $res = new WP_Error( 'plugins_api_failed',
+ $res = new \WP_Error( 'plugins_api_failed',
$error_message,
$request->get_error_message() // $data
);
} else {
$res = \maybe_unserialize( \wp_remote_retrieve_body( $request ) ); // phpcs:ignore -- No objects are sent.
- if ( ! is_object( $res ) && ! is_array( $res ) ) {
- $res = new WP_Error( 'plugins_api_failed',
+ if ( ! \is_object( $res ) && ! \is_array( $res ) ) {
+ $res = new \WP_Error( 'plugins_api_failed',
sprintf(
/* translators: %s: support forums URL */
\__( 'An unexpected error occurred. Something may be wrong with TheSEOFramework.com or this server’s configuration. If you continue to have problems, please contact us.', 'the-seo-framework-extension-manager' ),
@@ -242,7 +242,7 @@ function _hook_plugins_api( $res, $action, $args ) {
),
\wp_remote_retrieve_body( $request )
);
- } elseif ( is_array( $res ) ) {
+ } elseif ( \is_array( $res ) ) {
$res = (object) $res;
}
}
diff --git a/bootstrap/upgrader.class.php b/bootstrap/upgrader.class.php
index 08774a84..4b95a43b 100644
--- a/bootstrap/upgrader.class.php
+++ b/bootstrap/upgrader.class.php
@@ -43,7 +43,7 @@
* @link https://bugs.php.net/bug.php?id=75771
*/
$_load_upgrader_class = function() {
- new Upgrader();
+ new Upgrader(); // phpcs:ignore, TSF.Performance.Opcodes.ShouldHaveNamespaceEscape -- correct scope.
};
/**
@@ -384,7 +384,7 @@ private function yield_runs( \stdClass $upgrade ) {
*/
private function do_upgrade_cb( $version, callable $callback ) {
return [
- 'success' => (bool) call_user_func_array( $callback, [ $version ] ),
+ 'success' => (bool) \call_user_func_array( $callback, [ $version ] ),
'version' => $version,
];
}
diff --git a/extensions/essentials/articles/trunk/inc/classes/admin.class.php b/extensions/essentials/articles/trunk/inc/classes/admin.class.php
index 30cea437..87574094 100644
--- a/extensions/essentials/articles/trunk/inc/classes/admin.class.php
+++ b/extensions/essentials/articles/trunk/inc/classes/admin.class.php
@@ -252,7 +252,7 @@ private function generate_post_type_settings() {
'_check' => [
\__( 'Enable article markup support?', 'the-seo-framework-extension-manager' ),
],
- '_data' => [
+ '_data' => [
'is-type-listener' => '1',
'set-type-to-if-value' => [
'enabled' => '1',
@@ -405,7 +405,7 @@ public function _register_sanitization( $settings ) {
*/
public static function _sanitize_option_post_type( $value ) {
- if ( ! is_array( $value ) )
+ if ( ! \is_array( $value ) )
$value = [];
$post_types = \the_seo_framework()->get_supported_post_types();
@@ -615,7 +615,7 @@ public function _prepare_bulk_views( $post_type, $taxonomy ) {
'type' => [
'label' => \__( 'Article Type', 'the-seo-framework-extension-manager' ),
'options' => [
- 'nochange' => __( '— No Change —', 'default' ),
+ 'nochange' => \__( '— No Change —', 'default' ),
] + static::filter_article_keys( [
'disabled' => \__( '— Disabled —', 'the-seo-framework-extension-manager' ),
'Article' => \__( 'Article', 'the-seo-framework-extension-manager' ),
diff --git a/extensions/essentials/cord/trunk/inc/classes/admin.class.php b/extensions/essentials/cord/trunk/inc/classes/admin.class.php
index 11d56596..4cf67534 100644
--- a/extensions/essentials/cord/trunk/inc/classes/admin.class.php
+++ b/extensions/essentials/cord/trunk/inc/classes/admin.class.php
@@ -250,7 +250,7 @@ public function _register_sanitization( $settings ) {
*/
public static function _sanitize_options_analytics( $value ) {
- if ( ! is_array( $value ) )
+ if ( ! \is_array( $value ) )
$value = [];
// TODO do we want to strip unknown entries from payload?
@@ -291,6 +291,7 @@ public static function _sanitize_options_analytics( $value ) {
case 'facebook_pixel':
$key = 'pixel_id';
+
$value[ $index ][ $key ] = trim( \tsf_extension_manager()->coalesce_var( $value[ $index ][ $key ], '' ) );
if ( ! preg_match( '/^[0-9]+$/', $value[ $index ][ $key ] ) ) {
$value[ $index ][ $key ] = '';
diff --git a/extensions/essentials/focus/trunk/inc/classes/admin.class.php b/extensions/essentials/focus/trunk/inc/classes/admin.class.php
index c05a8d88..4056f183 100644
--- a/extensions/essentials/focus/trunk/inc/classes/admin.class.php
+++ b/extensions/essentials/focus/trunk/inc/classes/admin.class.php
@@ -157,11 +157,11 @@ private function is_language_supported( $type ) {
$locale = substr( \get_locale(), 0, 2 );
$supported = false;
- if ( in_array( $type, [ 'any', 'synonyms' ], true ) ) {
+ if ( \in_array( $type, [ 'any', 'synonyms' ], true ) ) {
$supported = 'en' === $locale;
}
- if ( in_array( $type, [ 'any', 'inflections' ], true ) ) {
- $supported = $supported || in_array( $locale, [ 'en', 'es', 'lv', 'hi', 'sw', 'ta', 'ro' ], true );
+ if ( \in_array( $type, [ 'any', 'inflections' ], true ) ) {
+ $supported = $supported || \in_array( $locale, [ 'en', 'es', 'lv', 'hi', 'sw', 'ta', 'ro' ], true );
}
return $supported;
@@ -340,7 +340,7 @@ private function process_meta( $post, $data ) {
default:
break;
}
- if ( is_null( $store[ $key ] ) ) unset( $store[ $key ] );
+ if ( \is_null( $store[ $key ] ) ) unset( $store[ $key ] );
endforeach;
if ( empty( $store ) ) {
@@ -364,7 +364,7 @@ private function sanitize_keyword_data( array $values ) {
$output = [];
foreach ( $values as $id => $items ) {
//= Don't store when no keyword is set.
- if ( ! isset( $items['keyword'] ) || ! strlen( $items['keyword'] ) )
+ if ( ! isset( $items['keyword'] ) || ! \strlen( $items['keyword'] ) )
continue;
foreach ( (array) $items as $key => $value ) {
@@ -416,7 +416,7 @@ private function sanitize_keyword_data_by_type( $type, $value ) {
break;
case 'scores':
- if ( ! is_array( $value ) ) {
+ if ( ! \is_array( $value ) ) {
$value = [];
} else {
foreach ( $value as $_t => $_v ) {
diff --git a/extensions/essentials/focus/trunk/inc/classes/ajax.class.php b/extensions/essentials/focus/trunk/inc/classes/ajax.class.php
index 96d8465e..b182c142 100644
--- a/extensions/essentials/focus/trunk/inc/classes/ajax.class.php
+++ b/extensions/essentials/focus/trunk/inc/classes/ajax.class.php
@@ -150,7 +150,7 @@ public function _get_lexicalforms() {
$send = [];
- if ( ! strlen( $keyword ) || ! $language ) {
+ if ( ! \strlen( $keyword ) || ! $language ) {
//= How in the...
$send['results'] = $this->get_ajax_notice( false, 1100101 );
} else {
@@ -181,7 +181,7 @@ public function _get_lexicalforms() {
} elseif ( ! isset( $response->data ) ) {
$send['results'] = $this->get_ajax_notice( false, 1100104 );
} else {
- $_data = is_string( $response->data ) ? json_decode( $response->data ) : (object) $response->data;
+ $_data = \is_string( $response->data ) ? json_decode( $response->data ) : (object) $response->data;
if ( isset( $_data->forms ) ) {
$type = 'success'; // The API responded as intended, although the data may not be useful.
@@ -261,7 +261,7 @@ public function _get_inflections() {
} elseif ( ! isset( $response->data ) ) {
$send['results'] = $this->get_ajax_notice( false, 1100305 );
} else {
- $_data = is_string( $response->data ) ? json_decode( $response->data ) : (object) $response->data;
+ $_data = \is_string( $response->data ) ? json_decode( $response->data ) : (object) $response->data;
if ( isset( $_data->inflections ) ) {
$type = 'success'; // The API responded as intended, although the data may not be useful.
@@ -271,7 +271,7 @@ public function _get_inflections() {
// When no inflections are returned, or if the one returned is only of the same kind as the keyword, fail.
// NOTE: Uses weak non-UTF8 strtolower. Users are smart enough to ignore useless data.
if ( ! $send['data']['inflections']
- || count( $send['data']['inflections'] ) < 2
+ || \count( $send['data']['inflections'] ) < 2
&& strtolower( $send['data']['inflections'][0] ) === strtolower( $keyword ) ) {
$send['results'] = $this->get_ajax_notice( false, 1100306 );
} else {
@@ -346,7 +346,7 @@ public function _get_synonyms() {
} elseif ( ! isset( $response->data ) ) {
$send['results'] = $this->get_ajax_notice( false, 1100204 );
} else {
- $_data = is_string( $response->data ) ? json_decode( $response->data ) : (object) $response->data;
+ $_data = \is_string( $response->data ) ? json_decode( $response->data ) : (object) $response->data;
if ( isset( $_data->synonyms ) ) {
$type = 'success'; // The API responded as intended, although the data may not be useful.
diff --git a/extensions/essentials/focus/trunk/inc/classes/scoring.class.php b/extensions/essentials/focus/trunk/inc/classes/scoring.class.php
index cda3d31c..02cd2199 100644
--- a/extensions/essentials/focus/trunk/inc/classes/scoring.class.php
+++ b/extensions/essentials/focus/trunk/inc/classes/scoring.class.php
@@ -216,7 +216,7 @@ public function get_nearest_numeric_index_value( array $a, $value ) {
*/
public function get_data_attributes( $type ) {
return \TSF_Extension_Manager\HTML::make_data_attributes( [
- 'scores' => \tsf_extension_manager()->filter_keys(
+ 'scores' => \tsf_extension_manager()->filter_keys(
$this->get_template( $type ),
[ 'assessment', 'maxScore', 'minScore', 'phrasing', 'rating', 'scoring' ]
),
diff --git a/extensions/free/amp/trunk/amp.php b/extensions/free/amp/trunk/amp.php
index 2f60c47d..e0d9a505 100644
--- a/extensions/free/amp/trunk/amp.php
+++ b/extensions/free/amp/trunk/amp.php
@@ -65,7 +65,7 @@ function _amp_init() {
} else {
$is_amp = false;
- if ( function_exists( '\\is_amp_endpoint' ) ) {
+ if ( \function_exists( '\\is_amp_endpoint' ) ) {
$is_amp = \is_amp_endpoint();
} elseif ( \defined( 'AMP_QUERY_VAR' ) ) {
$is_amp = \get_query_var( AMP_QUERY_VAR, false ) !== false;
diff --git a/extensions/premium/local/trunk/inc/traits/schema-packer.trait.php b/extensions/premium/local/trunk/inc/traits/schema-packer.trait.php
index e7337aaf..0c463250 100644
--- a/extensions/premium/local/trunk/inc/traits/schema-packer.trait.php
+++ b/extensions/premium/local/trunk/inc/traits/schema-packer.trait.php
@@ -51,7 +51,7 @@ private function should_change_precision() {
if ( isset( $cache ) )
return $cache;
- $precision = function_exists( 'ini_get' ) ? ini_get( 'serialize_precision' ) : null;
+ $precision = \function_exists( 'ini_get' ) ? ini_get( 'serialize_precision' ) : null;
//= -1 means it's optimized correctly. 7 to 14 would also do, actually.
if ( isset( $precision ) && -1 !== (int) $precision )
@@ -75,7 +75,7 @@ private function can_change_precision() {
if ( isset( $cache ) )
return $cache;
- if ( ! function_exists( 'ini_get_all' ) )
+ if ( ! \function_exists( 'ini_get_all' ) )
return $cache = false;
$ini_all = ini_get_all();
@@ -151,7 +151,7 @@ protected function get_schema() {
$schema_file = TSFEM_E_LOCAL_DIR_PATH . 'lib' . DIRECTORY_SEPARATOR . 'schema' . DIRECTORY_SEPARATOR . 'schema.json';
$timeout = stream_context_create( [ 'http' => [ 'timeout' => 3 ] ] );
- // phpcs:ignore, WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- This isn't a remote call.
+ // phpcs:ignore, WordPress.WP.AlternativeFunctions, TSF.Performance.Functions -- This isn't a remote call; required.
return json_decode( file_get_contents( $schema_file, false, $timeout ) );
}
@@ -170,7 +170,7 @@ protected function pack_data( array $data, $pretty = false ) {
$schema = $this->get_schema();
- if ( ! is_object( $schema ) )
+ if ( ! \is_object( $schema ) )
return '';
$this->correct_precision();
diff --git a/extensions/premium/local/trunk/inc/traits/secure-post.trait.php b/extensions/premium/local/trunk/inc/traits/secure-post.trait.php
index d668983e..47f60b6c 100644
--- a/extensions/premium/local/trunk/inc/traits/secure-post.trait.php
+++ b/extensions/premium/local/trunk/inc/traits/secure-post.trait.php
@@ -163,7 +163,7 @@ public function _do_ajax_form_save() {
* If this page doesn't parse the site options,
* there's no need to check them on each request.
*/
- if ( ! is_array( $data[ TSF_EXTENSION_MANAGER_EXTENSION_OPTIONS ][ $this->o_index ] ) ) {
+ if ( ! \is_array( $data[ TSF_EXTENSION_MANAGER_EXTENSION_OPTIONS ][ $this->o_index ] ) ) {
$type = 'failure';
$send['results'] = $this->get_ajax_notice( false, 1070100 );
} else {
@@ -198,7 +198,7 @@ public function _init_ajax_iteration_callback() {
if ( $key ) {
$method = $this->get_iterator_callback_by_key( $key );
if ( $method ) {
- $fields = &\TSF_Extension_Manager\FormGenerator::_collect_ajax_its_fields();
+ $fields = &\TSF_Extension_Manager\FormGenerator::_collect_ajax_its_fields(); // phpcs:ignore -- collector, wrong assessment.
$fields = Fields::get_instance()->{$method}();
}
}
@@ -284,7 +284,7 @@ private function send_ajax_form_json_validation() {
*/
if ( empty( $data )
|| ( ! isset( $data[ TSF_EXTENSION_MANAGER_EXTENSION_OPTIONS ][ $this->o_index ] ) )
- || ( ! is_array( $data[ TSF_EXTENSION_MANAGER_EXTENSION_OPTIONS ][ $this->o_index ] ) )
+ || ( ! \is_array( $data[ TSF_EXTENSION_MANAGER_EXTENSION_OPTIONS ][ $this->o_index ] ) )
) {
$type = 'failure';
$send['results'] = $this->get_ajax_notice( false, 1070200 );
diff --git a/extensions/premium/local/trunk/views/layout/general/top.php b/extensions/premium/local/trunk/views/layout/general/top.php
index 9be037d9..63cd26db 100644
--- a/extensions/premium/local/trunk/views/layout/general/top.php
+++ b/extensions/premium/local/trunk/views/layout/general/top.php
@@ -14,8 +14,7 @@
TSFEM_E_LOCAL_DIR_URL . 'lib/images/icon.svg',
- // '2x' => TSFEM_E_LOCAL_DIR_URL . 'lib/images/icon-58x58.png',
- '1x' => TSFEM_E_LOCAL_DIR_URL . 'lib/images/icon-29x29px.png',
+ '1x' => TSFEM_E_LOCAL_DIR_URL . 'lib/images/icon-29x29px.png',
];
$size = '1em';
diff --git a/extensions/premium/monitor/trunk/views/layout/general/top.php b/extensions/premium/monitor/trunk/views/layout/general/top.php
index 469fd504..4101be3b 100644
--- a/extensions/premium/monitor/trunk/views/layout/general/top.php
+++ b/extensions/premium/monitor/trunk/views/layout/general/top.php
@@ -24,7 +24,6 @@
TSFEM_E_MONITOR_DIR_URL . 'lib/images/icon.svg',
- // '2x' => TSFEM_E_MONITOR_DIR_URL . 'lib/images/icon-58x58.png',
'1x' => TSFEM_E_MONITOR_DIR_URL . 'lib/images/icon-29x29px.png',
];
$size = '1em';
diff --git a/inc/classes/abstract/secure.abstract.class.php b/inc/classes/abstract/secure.abstract.class.php
index 3d3ff0f1..eb0bf3ae 100644
--- a/inc/classes/abstract/secure.abstract.class.php
+++ b/inc/classes/abstract/secure.abstract.class.php
@@ -140,7 +140,7 @@ final private static function reset_instance() {
foreach ( $class_vars as $property => $value ) :
if ( isset( self::$$property ) )
- self::$$property = is_array( self::$$property ) ? [] : null;
+ self::$$property = \is_array( self::$$property ) ? [] : null;
endforeach;
}
@@ -241,7 +241,7 @@ final protected static function is_premium_user() {
$level = isset( self::$account['level'] ) ? self::$account['level'] : '';
- return $is_premium = in_array( $level, [ 'Enterprise', 'Premium' ], true );
+ return $is_premium = \in_array( $level, [ 'Enterprise', 'Premium' ], true );
}
/**
@@ -261,7 +261,7 @@ final protected static function is_connected_user() {
$level = isset( self::$account['level'] ) ? self::$account['level'] : '';
- return $is_connected = in_array( $level, [ 'Enterprise', 'Premium', 'Essentials' ], true );
+ return $is_connected = \in_array( $level, [ 'Enterprise', 'Premium', 'Essentials' ], true );
}
/**
diff --git a/inc/classes/adminpages.class.php b/inc/classes/adminpages.class.php
index 79b488e1..9a545aa2 100644
--- a/inc/classes/adminpages.class.php
+++ b/inc/classes/adminpages.class.php
@@ -130,7 +130,7 @@ final public function _add_menu_link() {
];
if ( \TSF_Extension_Manager\can_do_manager_settings() ) {
- $notice_count = count( \get_option( $this->error_notice_option, false ) ?: [] );
+ $notice_count = \count( \get_option( $this->error_notice_option, false ) ?: [] );
} else {
$notice_count = 0;
}
@@ -144,7 +144,7 @@ final public function _add_menu_link() {
$notice_i18n = \number_format_i18n( $notice_count );
$notice_text = sprintf(
/* translators: %s: number of notices waiting */
- _n( '%s notice waiting', '%s notices waiting', $notice_count, 'the-seo-framework-extension-manager' ),
+ \_n( '%s notice waiting', '%s notices waiting', $notice_count, 'the-seo-framework-extension-manager' ),
$notice_i18n
);
@@ -184,7 +184,7 @@ final public function load_menu_notice_styles() {
* 'midnight' should also be excluded, but that's messed up on another level.
* Let's just say we got this mildly accurate on 6 out of 8 schemes.
*/
- $inline = in_array( $_scheme, [ 'fresh', 'light', 'blue' ], true ) ? null : [
+ $inline = \in_array( $_scheme, [ 'fresh', 'light', 'blue' ], true ) ? null : [
'#adminmenu .tsfem-menu-notice' => [
'background-color:{{$color_accent}}',
'color:{{$rel_color_accent}}',
diff --git a/inc/classes/ajax.class.php b/inc/classes/ajax.class.php
index a792e56c..1dd2c317 100644
--- a/inc/classes/ajax.class.php
+++ b/inc/classes/ajax.class.php
@@ -45,7 +45,7 @@ final class AJAX extends Secure_Abstract {
*
* @var bool Whether the instance is validated.
*/
- private static $_validated = false;
+ private static $_validated = false; // phpcs:ignore -- internal
/**
* @var null|AJAX The class instance.
@@ -272,7 +272,7 @@ public static function _wp_ajax_tsfemForm_get_geocode() {
//= Input gets forwarded to secure location. Sanitization happens externally.
$input = isset( $_POST['input'] ) ? json_decode( \wp_unslash( $_POST['input'] ) ) : '';
- if ( ! $input || ! is_object( $input ) ) {
+ if ( ! $input || ! \is_object( $input ) ) {
$send['results'] = static::$instance->get_ajax_notice( false, 17000 );
} else {
$account = self::get_property( 'account' );
@@ -376,24 +376,23 @@ public static function _wp_ajax_tsfemForm_get_geocode() {
*/
private static function build_ajax_dismissible_notice() {
- // phpcs:disable, WordPress.Security.NonceVerification.Missing -- Caller must check for this.
+ // phpcs:disable, WordPress.Security.NonceVerification -- Caller must check for this.
$data = [];
$data['key'] = (int) static::$tsfem->coalesce_var( $_POST['tsfem-notice-key'], false );
if ( $data['key'] ) {
$notice = static::$instance->get_error_notice( $data['key'] );
- if ( is_array( $notice ) ) {
+ if ( \is_array( $notice ) ) {
//= If it has a custom message (already stored in browser), then don't output the notice message.
$msg = ! empty( $_POST['tsfem-notice-has-msg'] ) ? $notice['before'] : $notice['message'];
$data['notice'] = static::$tsfem->get_dismissible_notice( $msg, $notice['type'], true, false );
$data['type'] = $notice['type'];
- // $_type = $data['notice'] ? 'success' : 'failure';
}
}
- // phpcs:enable, WordPress.Security.NonceVerification.Missing
+ // phpcs:enable, WordPress.Security.NonceVerification
return $data;
}
diff --git a/inc/classes/alias.class.php b/inc/classes/alias.class.php
index b3b39ac9..fe29e7d9 100644
--- a/inc/classes/alias.class.php
+++ b/inc/classes/alias.class.php
@@ -24,7 +24,8 @@
* along with this program. If not, see .
*/
-// phpcs:disable, Squiz.Commenting.FunctionComment.Missing -- Implied.
+// phpcs:disable, Squiz.Commenting.FunctionComment.Missing -- implied.
+// phpcs:disable, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- implicit.
/**
* Class TSF_Extension_Manager\Alias
@@ -44,7 +45,7 @@ public function __get( $name ) {
}
public function __set( $name, $value ) {
- return;
+ return; // phpcs:ignore, Squiz.PHP.NonExecutableCode.ReturnNotRequired -- implicit
}
public function __isset( $name ) {
diff --git a/inc/classes/api.class.php b/inc/classes/api.class.php
index 891bec0b..99023e63 100644
--- a/inc/classes/api.class.php
+++ b/inc/classes/api.class.php
@@ -208,10 +208,11 @@ final public function &get_api_endpoint_type() {
*/
final protected function set_api_endpoint_type( $type = null ) {
+ // phpcs:ignore, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- parser doesn't recognize reference funcs.
$endpoint = &$this->get_api_endpoint_type();
if ( $type ) {
- $endpoint = in_array( $type, [ 'eu', 'global' ], true ) ? $type : 'global';
+ $endpoint = \in_array( $type, [ 'eu', 'global' ], true ) ? $type : 'global';
} elseif ( $this->is_connected_user() ) {
$endpoint = $this->get_key_endpoint_origin( $this->get_subscription_status()['key'] );
} else {
@@ -517,7 +518,7 @@ final public function _get_protected_api_response( $object, $key, $args ) {
*/
final private function _verify_api_access( $object, $key ) {
$keys = &$this->generate_api_access_key();
- return $this->coalesce_var( $keys[ get_class( $object ) ], null ) === (string) $key;
+ return $this->coalesce_var( $keys[ \get_class( $object ) ], null ) === (string) $key;
}
/**
diff --git a/inc/classes/extensions.class.php b/inc/classes/extensions.class.php
index e3f90826..11616dc4 100644
--- a/inc/classes/extensions.class.php
+++ b/inc/classes/extensions.class.php
@@ -31,6 +31,8 @@
*/
\TSF_Extension_Manager\_load_trait( 'manager/extensions' );
+// phpcs:disable, Generic.Files.OneObjectStructurePerFile -- Initializes fallback dummy traits.
+
/**
* Require extensions layout traits depending on admin page type.
*
@@ -207,7 +209,7 @@ public static function set_instance_extension_slug( $slug ) {
private static function filter_extensions( array $extensions = [], $what = 'maybe_network' ) {
// Temporarily. Exchange for count( $what ) > 1
- if ( is_array( $what ) ) {
+ if ( \is_array( $what ) ) {
foreach ( $what as $w ) {
// Reassigns and retests itself until filtered.
$extensions = static::filter_extensions( $extensions, $w );
diff --git a/inc/classes/formfieldparser.class.php b/inc/classes/formfieldparser.class.php
index 6eaff200..5e7a12e4 100644
--- a/inc/classes/formfieldparser.class.php
+++ b/inc/classes/formfieldparser.class.php
@@ -58,7 +58,7 @@ public static function get_mda_value( $keys, &$value ) {
//= Because it's cast to array, the return will always be inside this loop.
foreach ( (array) $keys as $k => $v ) {
- if ( is_array( $v ) ) {
+ if ( \is_array( $v ) ) {
return isset( $value[ $k ] ) ? static::get_mda_value( $v, $value[ $k ] ) : null;
} else {
if ( $k ) {
@@ -116,7 +116,8 @@ public static function umatosa( $value ) {
*/
public static function get_last_value( array $a ) {
- while ( is_array( $a = end( $a ) ) );
+ // phpcs:ignore, WordPress.CodeAnalysis.AssignmentInCondition -- Don't fault my amazingness.
+ while ( \is_array( $a = end( $a ) ) );
return $a;
}
diff --git a/inc/classes/formgenerator.class.php b/inc/classes/formgenerator.class.php
index b084051c..3720447c 100644
--- a/inc/classes/formgenerator.class.php
+++ b/inc/classes/formgenerator.class.php
@@ -1422,7 +1422,7 @@ private function get_collapse_wrap( $what, array $args = [] ) {
$content_start = '
';
return sprintf( '
%s%s%s', $s_id, $checkbox, $header, $content_start );
- ; // Added to prevent breaking alternative if/elseif control.
+ ; // phpcs:ignore -- Added to prevent breaking alternative if/elseif control. PHP bug?
elseif ( 'end' === $what ) :
// ok.
return '
';
@@ -2137,6 +2137,8 @@ private function create_checkbox_field( array $args ) {
* @param array $args The field generation arguments.
* @return void
*/
+ // phpcs:disable
private function create_radio_field( array $args ) {}
private function create_textarea_field( array $args ) {}
+ // phpcs:enable
}
diff --git a/inc/classes/inpostgui.class.php b/inc/classes/inpostgui.class.php
index d726c2bd..9ef114ad 100644
--- a/inc/classes/inpostgui.class.php
+++ b/inc/classes/inpostgui.class.php
@@ -32,7 +32,7 @@
* @link https://bugs.php.net/bug.php?id=75771
*/
$_load_inpostgui_class = function() {
- new InpostGUI();
+ new InpostGUI(); // phpcs:ignore, TSF.Performance.Opcodes.ShouldHaveNamespaceEscape -- correct scope.
};
/**
@@ -202,7 +202,7 @@ private function register_tabs() {
*/
public function _prepare_admin_scripts( $hook ) {
- if ( ! in_array( $hook, [ 'post.php', 'post-new.php' ], true ) )
+ if ( ! \in_array( $hook, [ 'post.php', 'post-new.php' ], true ) )
return;
$this->register_default_scripts();
@@ -245,7 +245,7 @@ private function register_default_scripts() {
'isPremium' => \tsf_extension_manager()->is_premium_user(),
'isConnected' => \tsf_extension_manager()->is_connected_user(),
'locale' => \get_locale(),
- 'userLocale' => function_exists( '\\get_user_locale' ) ? \get_user_locale() : \get_locale(),
+ 'userLocale' => \function_exists( '\\get_user_locale' ) ? \get_user_locale() : \get_locale(),
'debug' => (bool) WP_DEBUG,
'rtl' => (bool) \is_rtl(),
'i18n' => [
@@ -259,7 +259,7 @@ private function register_default_scripts() {
],
],
'tmpl' => [
- 'file' => tsf_extension_manager()->get_template_location( 'inpostnotice' ),
+ 'file' => \tsf_extension_manager()->get_template_location( 'inpostnotice' ),
],
] );
static::register_script( [
@@ -392,8 +392,8 @@ private function convert_color_css( array $css ) {
if (
! isset( $_colors[ $_scheme ]->colors )
- || ! is_array( $_colors[ $_scheme ]->colors )
- || count( $_colors[ $_scheme ]->colors ) < 4
+ || ! \is_array( $_colors[ $_scheme ]->colors )
+ || \count( $_colors[ $_scheme ]->colors ) < 4
) {
//= Default 'fresh' table.
$_table = [
@@ -537,7 +537,7 @@ public static function _verify_nonce( $post_id, $post ) {
if ( ( empty( $_POST[ static::NONCE_NAME ] ) ) // Input var OK.
|| ( ! \wp_verify_nonce( $_POST[ static::NONCE_NAME ], static::NONCE_ACTION ) ) // Input var, sanitization OK.
|| ( ! \current_user_can( 'edit_post', $post->ID ) )
- ) return;
+ ) return;
static::$save_access_state = TSFEM_INPOST_IS_SECURE;
diff --git a/inc/classes/inposthtml.class.php b/inc/classes/inposthtml.class.php
index bd3cb8d3..f9701bf8 100644
--- a/inc/classes/inposthtml.class.php
+++ b/inc/classes/inposthtml.class.php
@@ -66,7 +66,7 @@ public static function notification_area( $id ) {
* @param string $for The input ID an input label is for. Should be escaped.
*/
public static function wrap_flex( $what, $content, $id = '', $for = '' ) {
- //= Input should already be escaped.
+ // phpcs:ignore, WordPress.Security.EscapeOutput.OutputNotEscaped -- See method docs
echo static::construct_flex_wrap( $what, $content, $id, $for );
}
@@ -85,7 +85,7 @@ public static function wrap_flex( $what, $content, $id = '', $for = '' ) {
* @param string $id The wrap ID.
*/
public static function wrap_flex_multi( $what, array $contents, $id = '' ) {
- //= Input should already be escaped.
+ // phpcs:ignore, WordPress.Security.EscapeOutput.OutputNotEscaped -- See method docs
echo static::contruct_flex_wrap_multi( $what, $contents, $id );
}
@@ -186,10 +186,12 @@ public static function construct_flex_wrap( $what, $content, $id = '', $for = ''
$content = '';
break;
+ // phpcs:disable
//! Not used.
// case 'checkbox':
// $content = sprintf( '%s
', $content );
// break;
+ // phpcs:enable
default:
break;
diff --git a/inc/classes/layout.class.php b/inc/classes/layout.class.php
index 05518a86..37017294 100644
--- a/inc/classes/layout.class.php
+++ b/inc/classes/layout.class.php
@@ -147,6 +147,7 @@ private static function get_disconnect_button() {
);
$switcher_class = 'tsfem-button-flag tsfem-button';
+ // phpcs:ignore -- maybe later
// $switcher_class .= $tsfem->are_options_valid() ? '' : ' tsfem-button-pulse';
$switcher = ''
@@ -331,7 +332,7 @@ private static function get_account_info() {
) );
$output .= static::wrap_row_content( \esc_html__( 'API endpoint:', 'the-seo-framework-extension-manager' ), $_ep_html, false );
- if ( is_int( $requests_remaining ) ) {
+ if ( \is_int( $requests_remaining ) ) {
$_notice = '';
$_classes = [ 'tsfem-dashicon' ];
diff --git a/inc/classes/listedit.class.php b/inc/classes/listedit.class.php
index 028f9f74..ab1cd671 100644
--- a/inc/classes/listedit.class.php
+++ b/inc/classes/listedit.class.php
@@ -138,7 +138,8 @@ private function construct() {
//= Saving.
\add_action( 'save_post', [ static::class, '_verify_nonce_post' ], 1, 2 );
- // \add_action( 'edit_term', [ static::class, '_verify_nonce_term' ], 1, 3 ); // No extension supports this.
+ // phpcs:ignore -- No extension supports this.
+ // \add_action( 'edit_term', [ static::class, '_verify_nonce_term' ], 1, 3 );
//= Output.
\add_action( 'the_seo_framework_after_quick_edit', [ $this, '_load_quick_sections' ], 10, 2 );
@@ -240,7 +241,7 @@ private function register_default_scripts() {
'name' => 'tsfem-listedit',
'base' => TSF_EXTENSION_MANAGER_DIR_URL . 'lib/js/',
'ver' => TSF_EXTENSION_MANAGER_VERSION,
- 'l10n' => [
+ 'l10n' => [
'name' => 'tsfem_listeditL10n',
'data' => [],
],
diff --git a/inc/functions/api.php b/inc/functions/api.php
index e5f30ebe..7021589c 100644
--- a/inc/functions/api.php
+++ b/inc/functions/api.php
@@ -145,7 +145,7 @@ function _load_wp_compat( $version = '' ) {
if ( isset( $loaded[ $version ] ) )
return $loaded[ $version ];
- if ( empty( $version ) || 3 !== strlen( $version ) ) {
+ if ( empty( $version ) || 3 !== \strlen( $version ) ) {
\the_seo_framework()->_doing_it_wrong( __FUNCTION__, 'You must tell the two-point required WordPress version.' );
return $loaded[ $version ] = false;
}
diff --git a/inc/traits/core/error.trait.php b/inc/traits/core/error.trait.php
index a1401359..719331c2 100644
--- a/inc/traits/core/error.trait.php
+++ b/inc/traits/core/error.trait.php
@@ -75,21 +75,22 @@ final protected function init_errors() {
*/
final public function _do_error_notices() {
- if ( $options = \get_option( $this->error_notice_option, false ) ) {
+ $options = \get_option( $this->error_notice_option, false );
- $notices = $this->get_error_notices( $options );
+ if ( ! $options ) return;
- if ( empty( $notices ) ) {
- $this->unset_error_notice_option();
- return;
- }
-
- // Already escaped.
- foreach ( $notices as $notice )
- \tsf_extension_manager()->do_dismissible_notice( $notice['message'], $notice['type'], true, false );
+ $notices = $this->get_error_notices( $options );
+ if ( empty( $notices ) ) {
$this->unset_error_notice_option();
+ return;
}
+
+ // Already escaped.
+ foreach ( $notices as $notice )
+ \tsf_extension_manager()->do_dismissible_notice( $notice['message'], $notice['type'], true, false );
+
+ $this->unset_error_notice_option();
}
/**
@@ -121,7 +122,7 @@ final protected function set_error_notice( $notice = [], $clear_old = false ) {
//# This prevents adding timestamps preemptively in the future.
//? We could form a timestamp collection per notice, separately.
//# But, that would cause performance issues.
- if ( in_array( $notice, $notices, true ) ) {
+ if ( \in_array( $notice, $notices, true ) ) {
//= We already have the notice stored in cache.
return;
} else {
@@ -155,7 +156,7 @@ final protected function unset_error_notice_option() {
*/
final protected function get_error_notice( $option ) {
- if ( is_array( $option ) ) {
+ if ( \is_array( $option ) ) {
$key = key( $option );
} elseif ( is_scalar( $option ) ) {
$key = $option;
@@ -165,7 +166,7 @@ final protected function get_error_notice( $option ) {
return '';
$notice = $this->get_error_notice_by_key( $key, true );
- $additional_info = is_array( $option ) && ! empty( $option[ $key ] ) ? $option[ $key ] : '';
+ $additional_info = \is_array( $option ) && ! empty( $option[ $key ] ) ? $option[ $key ] : '';
$args = [
'type' => $notice['type'],
@@ -333,7 +334,7 @@ protected function get_error_notice_by_key( $key, $get_type = true ) {
\esc_html__( 'Invalid API license key. Login to the %s page to find a valid API License Key.', 'the-seo-framework-extension-manager' ),
$this->get_my_account_link()
);
- $type = 'error';
+ $type = 'error';
break;
case 304:
@@ -386,7 +387,7 @@ protected function get_error_notice_by_key( $key, $get_type = true ) {
\esc_html__( 'Exceeded maximum number of activations. Login to the %s page to manage your sites.', 'the-seo-framework-extension-manager' ),
$this->get_my_account_link()
);
- $type = 'error';
+ $type = 'error';
break;
case 306:
@@ -437,7 +438,7 @@ protected function get_error_notice_by_key( $key, $get_type = true ) {
\esc_html__( "Your subscription instance couldn't be verified. Login to the %s page and verify if this site is still connected.", 'the-seo-framework-extension-manager' ),
$this->get_my_account_link()
);
- $type = 'warning';
+ $type = 'warning';
break;
case 904:
diff --git a/inc/traits/core/overload.trait.php b/inc/traits/core/overload.trait.php
index d74644b3..dd9e1f9f 100644
--- a/inc/traits/core/overload.trait.php
+++ b/inc/traits/core/overload.trait.php
@@ -24,6 +24,10 @@
* along with this program. If not, see
.
*/
+// phpcs:disable, Generic.Files.OneObjectStructurePerFile.MultipleFound -- Collection, not auto-loaded nor class-mapped.
+// phpcs:disable, Generic.CodeAnalysis.UselessOverridingMethod.Found -- Enforced, not useless.
+// phpcs:disable, Squiz.Commenting.FunctionComment.Missing -- The trait doc explains it.
+
/**
* Legend/Definitions:
*
@@ -106,8 +110,6 @@
* -
: Should not exist.
*/
-// phpcs:disable, Squiz.Commenting.FunctionComment.Missing -- Implied.
-
/**
* Holds private overloading functions to prevent injection or abstraction.
*
@@ -356,7 +358,7 @@ final private function __construct() {}
*/
final public static function set_instance() {
- if ( is_null( static::$instance ) ) {
+ if ( \is_null( static::$instance ) ) {
static::$instance = new static();
}
}
@@ -372,7 +374,7 @@ final public static function set_instance() {
*/
final public static function get_instance() {
- if ( is_null( static::$instance ) ) {
+ if ( \is_null( static::$instance ) ) {
static::set_instance();
}
@@ -418,7 +420,7 @@ private function __construct() {}
*/
private static function set_instance() {
- if ( is_null( static::$instance ) ) {
+ if ( \is_null( static::$instance ) ) {
static::$instance = new static();
}
}
@@ -434,7 +436,7 @@ private static function set_instance() {
*/
private static function get_instance() {
- if ( is_null( static::$instance ) ) {
+ if ( \is_null( static::$instance ) ) {
static::set_instance();
}
@@ -503,7 +505,7 @@ trait Ignore_Properties_Core_Public_Final {
* @param string $name The inexisting property name.
* @param mixed $value The propertie value that ought to be set.
*/
- final public function __set( $name = '', $value = null ) {
+ final public function __set( $name = '', $value = null ) { // phpcs:ignore, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
\the_seo_framework()->_doing_it_wrong( __METHOD__, \esc_html( __CLASS__ . '::$' . $name . ' does not exist.' ) );
}
diff --git a/inc/traits/core/ui.trait.php b/inc/traits/core/ui.trait.php
index b8b0d353..d13da665 100644
--- a/inc/traits/core/ui.trait.php
+++ b/inc/traits/core/ui.trait.php
@@ -137,7 +137,7 @@ final public function panes_wrap() {
printf(
'',
// phpcs:ignore, WordPress.Security.EscapeOutput.OutputNotEscaped
- in_array( $this->wrap_type, [ 'column', 'row' ], true ) ? $this->wrap_type : 'column'
+ \in_array( $this->wrap_type, [ 'column', 'row' ], true ) ? $this->wrap_type : 'column'
);
\do_action( 'tsfem_content' );
echo '';
@@ -306,9 +306,10 @@ final protected function register_form_scripts( $scripts ) {
'name' => 'tsfemFormL10n',
'data' => [
'nonce' => \TSF_Extension_Manager\can_do_extension_settings() ? \wp_create_nonce( 'tsfem-form-nonce' ) : '',
- 'callee' => get_class( $this ), //! Don't use __CLASS__, we require the core instance.
+ 'callee' => \get_class( $this ), //! Don't use __CLASS__, we require the core instance.
'i18n' => [
- // TODO categorize
+ // TODO categorize in multidimensionals
+ // phpcs:disable, WordPress.Arrays.MultipleStatementAlignment -- Alignment is fine.
// Validation.
'requiredSelectAny' => \esc_html__( 'Please select any of the fields to proceed.', 'the-seo-framework-extension-manager' ),
@@ -333,13 +334,16 @@ final protected function register_form_scripts( $scripts ) {
'selectAddressTitle' => \esc_html__( 'Select address', 'the-seo-framework-extension-manager' ),
'selectAddressText' => \esc_html__( 'Select an address below.', 'the-seo-framework-extension-manager' ),
'reverseGeoWarning' => \esc_html__( 'Validation will be done only using Latitude and Longitude.', 'the-seo-framework-extension-manager' ),
+ // phpcs:enable, WordPress.Arrays.MultipleStatementAlignment
],
],
],
+ // phpcs:disable
// Inherits from 'tsfem'
// 'tmpl' => [
// 'file' => \tsf_extension_manager()->get_template_location( 'fbtopnotice' ),
// ],
+ // phpcs:enable
],
] );
}
@@ -381,6 +385,7 @@ final protected function register_media_scripts( $scripts ) {
'imgRemoveTitle' => \esc_attr__( 'Remove selected image', 'the-seo-framework-extension-manager' ),
'imgFrameTitle' => \esc_attr_x( 'Select Image', 'Frame title', 'the-seo-framework-extension-manager' ),
'imgFrameButton' => \esc_attr__( 'Use this image', 'the-seo-framework-extension-manager' ),
+ // phpcs:ignore -- redundant, maybe later.
// 'mediaEnqueued' => \wp_style_is( 'media', 'enqueued' ),
],
],
diff --git a/inc/traits/extension/forms.trait.php b/inc/traits/extension/forms.trait.php
index 99ece1d8..eee1aa14 100644
--- a/inc/traits/extension/forms.trait.php
+++ b/inc/traits/extension/forms.trait.php
@@ -237,7 +237,7 @@ public function _get_action_button( $url = '', array $items = [] ) {
return '';
}
- if ( empty( $items['input'] ) || ! is_array( $items['input'] ) ) {
+ if ( empty( $items['input'] ) || ! \is_array( $items['input'] ) ) {
\the_seo_framework()->_doing_it_wrong( __METHOD__, 'Form input items must be in an array. Supply at least a submit button.' );
return '';
}
diff --git a/inc/traits/extension/options.trait.php b/inc/traits/extension/options.trait.php
index a6268b94..d962083a 100644
--- a/inc/traits/extension/options.trait.php
+++ b/inc/traits/extension/options.trait.php
@@ -24,6 +24,8 @@
* along with this program. If not, see .
*/
+// phpcs:disable, Generic.Files.OneObjectStructurePerFile.MultipleFound -- Classes intertwine for cache abstraction.
+
/**
* Class TSF_Extension_Manager\Extensions_Options_Cache.
*
@@ -68,7 +70,7 @@ private static function init_options_cache() {
*/
public static function _get_options_cache() {
- if ( is_null( static::$options ) )
+ if ( \is_null( static::$options ) )
static::init_options_cache();
return static::$options;
@@ -92,7 +94,7 @@ public static function _get_options_cache() {
*/
public static function _set_options_cache( $index = '', $new_options = null, $delete = false ) {
- if ( is_null( static::$options ) )
+ if ( \is_null( static::$options ) )
static::init_options_cache();
if ( isset( $new_options ) && $index ) {
@@ -149,7 +151,7 @@ private static function init_options_cache() {
*/
public static function _get_options_cache() {
- if ( is_null( static::$options ) )
+ if ( \is_null( static::$options ) )
static::init_options_cache();
return static::$options;
@@ -173,7 +175,7 @@ public static function _get_options_cache() {
*/
public static function _set_options_cache( $index = '', $new_options = null, $delete = false ) {
- if ( is_null( static::$options ) )
+ if ( \is_null( static::$options ) )
static::init_options_cache();
if ( isset( $new_options ) && $index ) {
diff --git a/inc/traits/extension/post-meta.trait.php b/inc/traits/extension/post-meta.trait.php
index 85654e71..4c50e592 100644
--- a/inc/traits/extension/post-meta.trait.php
+++ b/inc/traits/extension/post-meta.trait.php
@@ -24,6 +24,8 @@
* along with this program. If not, see .
*/
+// phpcs:disable, Generic.Files.OneObjectStructurePerFile.MultipleFound -- Class and trait intertwine for cache abstraction.
+
/**
* Class TSF_Extension_Manager\Extensions_Post_Meta_Cache.
*
@@ -268,8 +270,8 @@ final protected function update_post_meta( $key, $value ) {
$c_meta = Extensions_Post_Meta_Cache::_get_meta_cache( $this->pm_id );
$c_meta[ $this->pm_index ] = $meta;
- // phpcs:ignore -- Security check OK, this is a serialization of an array, sub-unserialization can't happen.
// Addslashes here, so WordPress doesn't unslash it, whereafter unserialization fails.
+ // phpcs:ignore -- Security check OK, this is a serialization of an array, sub-unserialization can't happen.
$success = \update_post_meta( $this->pm_id, TSF_EXTENSION_MANAGER_EXTENSION_POST_META, addslashes( serialize( $c_meta ) ) );
if ( $success ) {
@@ -308,8 +310,8 @@ final protected function delete_post_meta( $key ) {
$c_meta = Extensions_Post_Meta_Cache::_get_meta_cache( $this->pm_id );
$c_meta[ $this->pm_index ] = $meta;
- // phpcs:ignore -- Security check OK, this is a serialization of an array, sub-unserialization can't happen.
// Addslashes here, so WordPress doesn't unslash it, whereafter unserialization fails.
+ // phpcs:ignore -- Security check OK, this is a serialization of an array, sub-unserialization can't happen.
$success = \update_post_meta( $this->pm_id, TSF_EXTENSION_MANAGER_EXTENSION_POST_META, addslashes( serialize( $c_meta ) ) );
if ( $success ) {
diff --git a/inc/traits/factory/memory.trait.php b/inc/traits/factory/memory.trait.php
index 78ac3f18..076838b7 100644
--- a/inc/traits/factory/memory.trait.php
+++ b/inc/traits/factory/memory.trait.php
@@ -24,6 +24,8 @@
* along with this program. If not, see .
*/
+// phpcs:disable, Generic.Files.OneObjectStructurePerFile.MultipleFound -- Class and trait intertwine for cache abstraction.
+
/**
* Holds memory cache for the Memory trait.
* Ironically.
@@ -61,7 +63,7 @@ final public static function get_memory_limit_in_bytes() {
return $limit;
$_limit = trim( ini_get( 'memory_limit' ) );
- $quantifier = strtolower( $_limit[ strlen( $_limit ) - 1 ] );
+ $quantifier = strtolower( $_limit[ \strlen( $_limit ) - 1 ] );
$val = filter_var( $_limit, FILTER_SANITIZE_NUMBER_INT );
switch ( $quantifier ) {
diff --git a/inc/traits/factory/time.trait.php b/inc/traits/factory/time.trait.php
index 5551bf55..0210c5f8 100644
--- a/inc/traits/factory/time.trait.php
+++ b/inc/traits/factory/time.trait.php
@@ -124,7 +124,7 @@ protected function get_time_ago_i18n( $since ) {
*/
protected function get_rectified_date( $format, $timestamp = null ) {
- is_null( $timestamp )
+ \is_null( $timestamp )
and $timestamp = time();
$tsf = \the_seo_framework();
@@ -150,7 +150,7 @@ protected function get_rectified_date( $format, $timestamp = null ) {
*/
protected function get_rectified_date_i18n( $format, $timestamp = null ) {
- is_null( $timestamp )
+ \is_null( $timestamp )
and $timestamp = time();
$tsf = \the_seo_framework();
@@ -267,7 +267,7 @@ protected function _upscale_time( $x, $x_scale, $scales, $precise ) {
$_threshold = $scale_table[ $x_scale ][0];
if ( $x_remaining >= $_threshold // > vs >= is 24 hours vs 1 day.
- && ( ! $precise || ( count( $times ) < $scales - 1 ) ) // -1 as we're adding another to reach this.
+ && ( ! $precise || ( \count( $times ) < $scales - 1 ) ) // -1 as we're adding another to reach this.
) {
if ( $x_remaining % $_threshold ) {
// Calculate current and next time scale.
@@ -296,7 +296,7 @@ protected function _upscale_time( $x, $x_scale, $scales, $precise ) {
$times = array_reverse( $times );
//= Don't return more items than the threshold.
- $count = min( count( $times ), $scales );
+ $count = min( \count( $times ), $scales );
for ( $i = 0; $i < $count; $i++ ) {
if ( 0 === $i ) {
diff --git a/inc/traits/manager/extensions-layout.trait.php b/inc/traits/manager/extensions-layout.trait.php
index d0c12c3d..484dea3f 100644
--- a/inc/traits/manager/extensions-layout.trait.php
+++ b/inc/traits/manager/extensions-layout.trait.php
@@ -24,6 +24,8 @@
* along with this program. If not, see .
*/
+// phpcs:disable, Generic.Files.OneObjectStructurePerFile.MultipleFound -- Traits intertwine.
+
/**
* Holds i18n data functions for class TSF_Extension_Manager\Extensions.
*
@@ -129,7 +131,7 @@ private static function get_extensions_list() {
if ( ! isset( $extension['slug'], $extension['type'], $extension['area'] ) )
continue;
- if ( in_array( $extension['slug'], (array) TSF_EXTENSION_MANAGER_HIDDEN_EXTENSIONS, true ) )
+ if ( \in_array( $extension['slug'], (array) TSF_EXTENSION_MANAGER_HIDDEN_EXTENSIONS, true ) )
continue;
if ( false === static::get_extension_header( $extension['slug'] ) )
@@ -244,7 +246,7 @@ private static function make_extension_subheader( $extension ) {
$party_class = 'first' === $extension['party'] ? 'tsfem-extension-first-party-icon' : 'tsfem-extension-third-party-icon';
$party_title = 'first' === $extension['party'] ? static::get_i18n( 'first-party' ) : static::get_i18n( 'third-party' );
- $party = sprintf( '', $party_class, \esc_attr( $party_title ) );
+ $party = sprintf( '', $party_class, \esc_attr( $party_title ) );
$author = '' . \esc_html( static::get_extension_header( $extension['slug'] )['Author'] ) . '';
return '';
@@ -328,7 +330,7 @@ private static function get_extension_button_form( $slug = '', $type = '', $disa
return '';
endswitch;
- $disabled = $disabled || array_key_exists( $slug, (array) TSF_EXTENSION_MANAGER_FORCED_EXTENSIONS );
+ $disabled = $disabled || \array_key_exists( $slug, (array) TSF_EXTENSION_MANAGER_FORCED_EXTENSIONS );
if ( $disabled ) {
$button = sprintf( '%s', $s_class, \esc_html( $text ) );
@@ -352,13 +354,13 @@ private static function get_extension_button_form( $slug = '', $type = '', $disa
$cache['input_name'],
$s_slug
);
- $submit = sprintf(
+ $submit = sprintf(
'',
$s_slug,
$s_class,
\esc_attr( $text )
);
- $nojs = sprintf(
+ $nojs = sprintf(
'',
$cache['admin_url'],
$s_slug,
@@ -425,10 +427,12 @@ private static function get_extension_description_footer( $extension, $wrap = tr
$data = static::get_extension_header( $extension['slug'] );
$items = [];
- // Make extension author element. (move link to what's already shown?)
+ // phpcs:disable
+ // MAYBE: Make extension author element. (move link to what's already shown?)
// $author = $data['Author'];
// $author_url = $data['AuthorURI'];
// $author = sprintf( '%s', \esc_url( $author_url, [ 'https', 'http' ] ), \esc_attr( static::get_i18n( 'visit-author' ) ), \esc_html( $author ) );
+ // phpcs:enable
// Make extension version element.
$items['version'] = sprintf( '%s %s',
@@ -494,7 +498,7 @@ private static function get_extension_desc_compat_item( $extension ) {
$incompatibility = static::determine_extension_incompatibility( $extension );
if ( $incompatibility & ( TSFEM_EXTENSION_TSF_INCOMPATIBLE | TSFEM_EXTENSION_WP_INCOMPATIBLE ) ) {
- $compat_class = 'tsfem-error';
+ $compat_class = 'tsfem-error';
$compat_notice = sprintf(
/* translators: 1: Version number, 2: Version number */
\__( 'WordPress %1$s and The SEO Framework %2$s are required.', 'the-seo-framework-extension-manager' ),
@@ -517,8 +521,8 @@ private static function get_extension_desc_compat_item( $extension ) {
break;
endswitch;
- $compat_class = 'tsfem-unknown';
- $compat_name = static::get_i18n( 'compatible' );
+ $compat_class = 'tsfem-unknown';
+ $compat_name = static::get_i18n( 'compatible' );
$compat_notice .= '
' . \__( 'The extension will always be tested for errors before activation.', 'the-seo-framework-extension-manager' );
} else {
$compat_class = 'tsfem-success';
diff --git a/inc/traits/manager/extensions.trait.php b/inc/traits/manager/extensions.trait.php
index 248a636c..33f12d02 100644
--- a/inc/traits/manager/extensions.trait.php
+++ b/inc/traits/manager/extensions.trait.php
@@ -24,6 +24,8 @@
* along with this program. If not, see .
*/
+// phpcs:disable, Generic.Files.OneObjectStructurePerFile.MultipleFound -- Traits intertwine.
+
/**
* Holds extension data check functions for class TSF_Extension_Manager\Extensions.
*
@@ -332,6 +334,7 @@ private static function get_extension_relative_path( $slug ) {
if ( empty( $extension ) )
return '';
+ // phpcs:ignore -- No network support like this, yet.
// $network = static::is_extension_network( $extension );
$premium = static::is_extension_premium( $extension );
$essentials = static::is_extension_essentials( $extension );
@@ -339,6 +342,7 @@ private static function get_extension_relative_path( $slug ) {
$path[ $slug ] = '';
$path[ $slug ] .= 'extensions/';
+ // phpcs:ignore -- No network support like this, yet.
// $path[ $slug ] .= $network ? 'network/' : '';
$path[ $slug ] .= $premium ? 'premium/' : ( $essentials ? 'essentials/' : 'free/' );
$path[ $slug ] .= $slug . '/';
@@ -358,10 +362,11 @@ private static function get_extension_relative_path( $slug ) {
*/
private static function get_extension_header_file_location( $slug ) {
- if ( $path = static::get_extension_trunk_path( $slug ) )
- return $path . $slug . '.php';
+ $path = static::get_extension_trunk_path( $slug );
+
+ if ( ! $path ) return '';
- return '';
+ return $path . $slug . '.php';
}
/**
@@ -513,7 +518,7 @@ private static function get_active_extensions( $placeholder = [] ) {
|| ! $is_premium_user && static::is_extension_premium( $_extension )
|| ( ! $is_connected_user && static::is_extension_essentials( $_extension ) )
|| ( ! static::is_extension_compatible( $_extension ) )
- ) {
+ ) {
unset( $extensions[ $_extension ] );
}
}
@@ -1049,6 +1054,7 @@ public static function _shutdown_handle_test_extension_fatal_error() {
$error['message'] = static::clean_error_message( $error['message'], $error );
$error_notice = $error_type . ' ' . \esc_html__( 'Extension is not compatible with your server configuration.', 'the-seo-framework-extension-manager' );
+
$advanced_error_notice = \esc_html( $error['message'] ) . ' in file ' . \esc_html( $error['file'] ) . ' on line ' . \esc_html( $error['line'] ) . '.';
if ( \wp_doing_ajax() ) {
@@ -1087,6 +1093,8 @@ public static function _shutdown_handle_test_extension_fatal_error() {
*/
private static function clean_error_message( $message = '', $error = [] ) {
+ // phpcs:disable, WordPress.CodeAnalysis.AssignmentInCondition
+
// Remove stack trace.
if ( false !== ( $stack_pos = stripos( $message, 'Stack trace:' ) ) )
$message = substr( $message, 0, $stack_pos );
@@ -1106,6 +1114,8 @@ private static function clean_error_message( $message = '', $error = [] ) {
}
}
+ // phpcs:enable, WordPress.CodeAnalysis.AssignmentInCondition
+
return $message;
}
diff --git a/inc/traits/manager/options.trait.php b/inc/traits/manager/options.trait.php
index 6b9c284f..ec2590ba 100644
--- a/inc/traits/manager/options.trait.php
+++ b/inc/traits/manager/options.trait.php
@@ -216,7 +216,7 @@ final protected function update_option_multi( array $options = [], $type = 'inst
// This won't fire the filter 'wp_parse_str'. As $options requires to be an array.
$options = \wp_parse_args( $options, $_options );
- $run = true;
+ $run = true;
$this->initialize_option_update_instance( $type );
@@ -393,9 +393,9 @@ final protected function kill_options() {
$success = [
$this->delete_options_instance(),
- \delete_option( TSF_EXTENSION_MANAGER_SITE_OPTIONS )
+ \delete_option( TSF_EXTENSION_MANAGER_SITE_OPTIONS ),
];
- return $this->killed_options = ! in_array( false, $success, true );
+ return $this->killed_options = ! \in_array( false, $success, true );
}
}
diff --git a/phpcs.xml b/phpcs.xml
index 05887b67..b6835226 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/the-seo-framework-extension-manager.php b/the-seo-framework-extension-manager.php
index ff1093ee..a21828b7 100644
--- a/the-seo-framework-extension-manager.php
+++ b/the-seo-framework-extension-manager.php
@@ -3,7 +3,7 @@
* Plugin Name: The SEO Framework - Extension Manager
* Plugin URI: https://theseoframework.com/extension-manager/
* Description: Add more powerful SEO features to The SEO Framework. Right from your WordPress dashboard.
- * Version: 2.4.1-dev-2
+ * Version: 2.4.1-dev-3
* Author: The SEO Framework Team
* Author URI: https://theseoframework.com/
* License: GPLv3
diff --git a/views/layout/extension/top.php b/views/layout/extension/top.php
index 880ff370..0cd5502d 100644
--- a/views/layout/extension/top.php
+++ b/views/layout/extension/top.php
@@ -14,7 +14,6 @@
tsf_extension_manager()->get_image_file_location( 'tsflogo.svg', true ),
- // '2x' => tsf_extension_manager()->get_image_file_location( 'tsflogo-58x58px.png', true ),
'1x' => tsf_extension_manager()->get_image_file_location( 'tsflogo-29x29px.png', true ),
];
$size = '1em';
diff --git a/views/layout/general/top.php b/views/layout/general/top.php
index e4d6ccbc..1a743e52 100644
--- a/views/layout/general/top.php
+++ b/views/layout/general/top.php
@@ -60,7 +60,6 @@
$this->get_image_file_location( 'tsflogo.svg', true ),
- // '2x' => $this->get_image_file_location( 'tsflogo-58x58px.png', true ),
'1x' => $this->get_image_file_location( 'tsflogo-29x29px.png', true ),
];
$size = '1em';
diff --git a/views/layout/pages/activation.php b/views/layout/pages/activation.php
index a58c9865..c0f361fd 100644
--- a/views/layout/pages/activation.php
+++ b/views/layout/pages/activation.php
@@ -24,10 +24,12 @@
get_view( 'forms/get', [ 'name' => $this->request_name['activate-external'], 'action' => $this->get_activation_url( 'get/' ), 'redirect' => 'activate', 'text' => \__( 'Get your API key', 'the-seo-framework-extension-manager' ), 'classes' => [ 'tsfem-button', 'tsfem-button-primary' ] ] );
// $this->get_view( 'forms/get', [ 'name' => $this->request_name['activate-external'], 'action' => $this->get_activation_url( 'get/' ), 'redirect' => 'connect', 'text' => \__( 'Connect', 'the-seo-framework-extension-manager' ), 'classes' => [ 'tsfem-button' ] ] );
// $this->get_remote_activation_listener();
+ // phpcs:enable
// phpcs:disable, WordPress.Security.EscapeOutput.OutputNotEscaped -- get_link() escapes
echo $this->get_link( [