From aa9980106e9add58e5fed47158a9b7e4308e0064 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 10 May 2020 12:13:39 +0200 Subject: [PATCH] update phpcs ignore statements; PHPdoc indentation --- inc/class-statifyblacklist-admin.php | 15 +++++++++------ inc/class-statifyblacklist-system.php | 5 ++++- inc/class-statifyblacklist.php | 3 +-- statify-blacklist.php | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/inc/class-statifyblacklist-admin.php b/inc/class-statifyblacklist-admin.php index 78a43fb..caed7fc 100644 --- a/inc/class-statifyblacklist-admin.php +++ b/inc/class-statifyblacklist-admin.php @@ -54,10 +54,11 @@ class StatifyBlacklist_Admin extends StatifyBlacklist { /** * Update options. * + * @since 1.1.1 + * * @param array $options Optional. New options to save. * * @return array|bool array of sanitized array on errors, FALSE if there were none. - * @since 1.1.1 */ public static function update_options( $options = null ) { if ( isset( $options ) && current_user_can( 'manage_options' ) ) { @@ -263,13 +264,14 @@ class StatifyBlacklist_Admin extends StatifyBlacklist { global $wpdb; // Execute filter on database. - // @codingStandardsIgnoreStart These statements produce warnings, rework in future release (TODO). + // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- These statements produce warnings, rework in future release (TODO). if ( ! empty( $referer_regexp ) ) { $wpdb->query( $wpdb->prepare( "DELETE FROM `$wpdb->statify` WHERE " . ( ( 1 === self::$options['referer']['regexp'] ) ? ' BINARY ' : '' ) - . 'referrer REGEXP %s', $referer_regexp + . 'referrer REGEXP %s', + $referer_regexp ) ); } @@ -278,11 +280,12 @@ class StatifyBlacklist_Admin extends StatifyBlacklist { $wpdb->prepare( "DELETE FROM `$wpdb->statify` WHERE " . ( ( 1 === self::$options['target']['regexp'] ) ? ' BINARY ' : '' ) - . 'target REGEXP %s', $target_regexp + . 'target REGEXP %s', + $target_regexp ) ); } - // @codingStandardsIgnoreEnd + // phpcs:enable WordPress.DB.PreparedSQL.NotPrepared // Optimize DB. $wpdb->query( "OPTIMIZE TABLE `$wpdb->statify`" ); @@ -355,7 +358,7 @@ class StatifyBlacklist_Admin extends StatifyBlacklist { function ( $re ) { // Check of preg_match() fails (warnings suppressed). - // phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged + // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged return false === @preg_match( StatifyBlacklist::regex( $re, false ), null ); } ); diff --git a/inc/class-statifyblacklist-system.php b/inc/class-statifyblacklist-system.php index a0312c3..842310b 100644 --- a/inc/class-statifyblacklist-system.php +++ b/inc/class-statifyblacklist-system.php @@ -27,6 +27,7 @@ class StatifyBlacklist_System extends StatifyBlacklist { * @since 1.0.0 * * @param bool $network_wide Whether the plugin was activated network-wide or not. + * * @return void */ public static function install( $network_wide = false ) { @@ -62,6 +63,7 @@ class StatifyBlacklist_System extends StatifyBlacklist { * @since 1.4.3 * * @param integer $site_id Site ID. + * * @return void */ public static function install_site( $site_id ) { @@ -88,7 +90,7 @@ class StatifyBlacklist_System extends StatifyBlacklist { if ( function_exists( 'get_sites' ) ) { $sites = get_sites(); } elseif ( function_exists( 'wp_get_sites' ) ) { - // @codingStandardsIgnoreLine Legacy support for WP < 4.6. + // phpcs:ignore WordPress.WP.DeprecatedFunctions.wp_get_sitesFound -- Legacy support for WP < 4.6. $sites = wp_get_sites(); } else { return; @@ -115,6 +117,7 @@ class StatifyBlacklist_System extends StatifyBlacklist { * @since 1.4.3 * * @param integer $site_id Site ID. + * * @return void */ public static function uninstall_site( $site_id ) { diff --git a/inc/class-statifyblacklist.php b/inc/class-statifyblacklist.php index 17718e3..abc7780 100644 --- a/inc/class-statifyblacklist.php +++ b/inc/class-statifyblacklist.php @@ -319,15 +319,14 @@ class StatifyBlacklist { 'REMOTE_ADDR', ) as $k ) { - // @codingStandardsIgnoreStart The globals are checked. if ( isset( $_SERVER[ $k ] ) ) { + // phpcs:ignore foreach ( explode( ',', $_SERVER[ $k ] ) as $ip ) { if ( false !== filter_var( $ip, FILTER_VALIDATE_IP ) ) { return $ip; } } } - // @codingStandardsIgnoreEnd } return false; diff --git a/statify-blacklist.php b/statify-blacklist.php index e9488c5..b74f44b 100644 --- a/statify-blacklist.php +++ b/statify-blacklist.php @@ -62,7 +62,7 @@ if ( statify_blacklist_compatibility_check() ) { /** * Autoloader for StatifyBlacklist classes. * - * @param string $class Name of the class to load. + * @param string $class Name of the class to load. * * @since 1.0.0 */