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