From bcd42bde2a34f1ba548579a532bc297f1d3e471c Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sat, 20 Oct 2018 10:12:38 +0200 Subject: [PATCH] Minor code style fixes --- composer.json | 8 ++++---- inc/class-statifyblacklist-admin.php | 23 ++++++++++++++++++----- inc/class-statifyblacklist-system.php | 2 +- inc/class-statifyblacklist.php | 3 ++- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index dc35535..36727f2 100644 --- a/composer.json +++ b/composer.json @@ -23,13 +23,13 @@ }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4", - "consolidation/robo": "^1.0.0", + "consolidation/robo": "^1.3", "phpunit/phpunit": "*", "phpunit/php-code-coverage": "*", "slowprog/composer-copy-file": "~0.2", - "squizlabs/php_codesniffer": "^3.1", - "wimg/php-compatibility": "^8.0", - "wp-coding-standards/wpcs": "~0.14" + "squizlabs/php_codesniffer": "^3.3", + "wimg/php-compatibility": "^9.0", + "wp-coding-standards/wpcs": "^1.1" }, "scripts": { "build": [ diff --git a/inc/class-statifyblacklist-admin.php b/inc/class-statifyblacklist-admin.php index e807ef9..b391de3 100644 --- a/inc/class-statifyblacklist-admin.php +++ b/inc/class-statifyblacklist-admin.php @@ -74,14 +74,24 @@ class StatifyBlacklist_Admin extends StatifyBlacklist { $title = __( 'Statify Blacklist', 'statify-blacklist' ); if ( self::$multisite ) { add_submenu_page( - 'settings.php', $title, $title, 'manage_network_plugins', 'statify-blacklist-settings', array( + 'settings.php', + $title, + $title, + 'manage_network_plugins', + 'statify-blacklist-settings', + array( 'StatifyBlacklist_Admin', 'settings_page', ) ); } else { add_submenu_page( - 'options-general.php', $title, $title, 'manage_options', 'statify-blacklist', array( + 'options-general.php', + $title, + $title, + 'manage_options', + 'statify-blacklist', + array( 'StatifyBlacklist_Admin', 'settings_page', ) @@ -251,12 +261,15 @@ class StatifyBlacklist_Admin extends StatifyBlacklist { */ private static function sanitizeIPs( $ips ) { return array_filter( - $ips, function ( $ip ) { + $ips, + function ( $ip ) { return preg_match( - '/^((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])(\/([0-9]|[1-2][0-9]|3[0-2]))?$/', $ip + '/^((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])(\/([0-9]|[1-2][0-9]|3[0-2]))?$/', + $ip ) || preg_match( - '/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))(\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$/', $ip + '/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))(\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$/', + $ip ); } ); diff --git a/inc/class-statifyblacklist-system.php b/inc/class-statifyblacklist-system.php index 66b822f..8d65df5 100644 --- a/inc/class-statifyblacklist-system.php +++ b/inc/class-statifyblacklist-system.php @@ -1,6 +1,6 @@