update phpcs ignore statements; PHPdoc indentation

This commit is contained in:
Stefan Kalscheuer 2020-05-10 12:13:39 +02:00
parent 31c04d6b92
commit aa9980106e
4 changed files with 15 additions and 10 deletions

View File

@ -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 );
}
);

View File

@ -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 ) {

View File

@ -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;

View File

@ -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
*/