Minor code style fixes
This commit is contained in:
parent
f34b761942
commit
bcd42bde2a
@ -23,13 +23,13 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.4",
|
"dealerdirect/phpcodesniffer-composer-installer": "^0.4",
|
||||||
"consolidation/robo": "^1.0.0",
|
"consolidation/robo": "^1.3",
|
||||||
"phpunit/phpunit": "*",
|
"phpunit/phpunit": "*",
|
||||||
"phpunit/php-code-coverage": "*",
|
"phpunit/php-code-coverage": "*",
|
||||||
"slowprog/composer-copy-file": "~0.2",
|
"slowprog/composer-copy-file": "~0.2",
|
||||||
"squizlabs/php_codesniffer": "^3.1",
|
"squizlabs/php_codesniffer": "^3.3",
|
||||||
"wimg/php-compatibility": "^8.0",
|
"wimg/php-compatibility": "^9.0",
|
||||||
"wp-coding-standards/wpcs": "~0.14"
|
"wp-coding-standards/wpcs": "^1.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": [
|
"build": [
|
||||||
|
@ -74,14 +74,24 @@ class StatifyBlacklist_Admin extends StatifyBlacklist {
|
|||||||
$title = __( 'Statify Blacklist', 'statify-blacklist' );
|
$title = __( 'Statify Blacklist', 'statify-blacklist' );
|
||||||
if ( self::$multisite ) {
|
if ( self::$multisite ) {
|
||||||
add_submenu_page(
|
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',
|
'StatifyBlacklist_Admin',
|
||||||
'settings_page',
|
'settings_page',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
add_submenu_page(
|
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',
|
'StatifyBlacklist_Admin',
|
||||||
'settings_page',
|
'settings_page',
|
||||||
)
|
)
|
||||||
@ -251,12 +261,15 @@ class StatifyBlacklist_Admin extends StatifyBlacklist {
|
|||||||
*/
|
*/
|
||||||
private static function sanitizeIPs( $ips ) {
|
private static function sanitizeIPs( $ips ) {
|
||||||
return array_filter(
|
return array_filter(
|
||||||
$ips, function ( $ip ) {
|
$ips,
|
||||||
|
function ( $ip ) {
|
||||||
return preg_match(
|
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(
|
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
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Statify Blacklist: StatifyBlacklist_Syste, class
|
* Statify Blacklist: StatifyBlacklist_System class
|
||||||
*
|
*
|
||||||
* This file contains the derived class for the plugin's system operations.
|
* This file contains the derived class for the plugin's system operations.
|
||||||
*
|
*
|
||||||
|
@ -94,7 +94,8 @@ class StatifyBlacklist {
|
|||||||
if ( self::$multisite ) {
|
if ( self::$multisite ) {
|
||||||
add_action( 'network_admin_menu', array( 'StatifyBlacklist_Admin', 'add_menu_page' ) );
|
add_action( 'network_admin_menu', array( 'StatifyBlacklist_Admin', 'add_menu_page' ) );
|
||||||
add_filter(
|
add_filter(
|
||||||
'network_admin_plugin_action_links', array(
|
'network_admin_plugin_action_links',
|
||||||
|
array(
|
||||||
'StatifyBlacklist_Admin',
|
'StatifyBlacklist_Admin',
|
||||||
'plugin_actions_links',
|
'plugin_actions_links',
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user