use long array syntax
For some reason short syntax is discouraged in the latest WPCS ruleset. To stay in line with WPCS we use long syntax now.
This commit is contained in:
@ -33,7 +33,7 @@ if ( ! empty( $_POST['statifyblacklist'] ) ) {
|
||||
$referer_str = sanitize_textarea_field( wp_unslash( $_POST['statifyblacklist']['referer']['blacklist'] ) );
|
||||
}
|
||||
if ( empty( trim( $referer_str ) ) ) {
|
||||
$referer = [];
|
||||
$referer = array();
|
||||
} else {
|
||||
$referer = array_filter(
|
||||
array_map(
|
||||
@ -53,7 +53,7 @@ if ( ! empty( $_POST['statifyblacklist'] ) ) {
|
||||
$target_str = sanitize_textarea_field( wp_unslash( $_POST['statifyblacklist']['target']['blacklist'] ) );
|
||||
}
|
||||
if ( empty( trim( $target_str ) ) ) {
|
||||
$target = [];
|
||||
$target = array();
|
||||
} else {
|
||||
$target = array_filter(
|
||||
array_map(
|
||||
@ -73,7 +73,7 @@ if ( ! empty( $_POST['statifyblacklist'] ) ) {
|
||||
$ip_str = sanitize_textarea_field( wp_unslash( $_POST['statifyblacklist']['ip']['blacklist'] ) );
|
||||
}
|
||||
if ( empty( trim( $ip_str ) ) ) {
|
||||
$ip = [];
|
||||
$ip = array();
|
||||
} else {
|
||||
$ip = array_filter(
|
||||
array_map(
|
||||
@ -90,8 +90,8 @@ if ( ! empty( $_POST['statifyblacklist'] ) ) {
|
||||
|
||||
// Update options (data will be sanitized).
|
||||
$statifyblacklist_update_result = StatifyBlacklist_Admin::update_options(
|
||||
[
|
||||
'referer' => [
|
||||
array(
|
||||
'referer' => array(
|
||||
'active' => isset( $_POST['statifyblacklist']['referer']['active'] )
|
||||
? (int) $_POST['statifyblacklist']['referer']['active'] : 0,
|
||||
'cron' => isset( $_POST['statifyblacklist']['referer']['cron'] )
|
||||
@ -99,8 +99,8 @@ if ( ! empty( $_POST['statifyblacklist'] ) ) {
|
||||
'regexp' => isset( $_POST['statifyblacklist']['referer']['regexp'] )
|
||||
? (int) $_POST['statifyblacklist']['referer']['regexp'] : 0,
|
||||
'blacklist' => array_flip( $referer ),
|
||||
],
|
||||
'target' => [
|
||||
),
|
||||
'target' => array(
|
||||
'active' => isset( $_POST['statifyblacklist']['target']['active'] )
|
||||
? (int) $_POST['statifyblacklist']['target']['active'] : 0,
|
||||
'cron' => isset( $_POST['statifyblacklist']['target']['cron'] )
|
||||
@ -108,19 +108,19 @@ if ( ! empty( $_POST['statifyblacklist'] ) ) {
|
||||
'regexp' => isset( $_POST['statifyblacklist']['target']['regexp'] )
|
||||
? (int) $_POST['statifyblacklist']['target']['regexp'] : 0,
|
||||
'blacklist' => array_flip( $target ),
|
||||
],
|
||||
'ip' => [
|
||||
),
|
||||
'ip' => array(
|
||||
'active' => isset( $_POST['statifyblacklist']['ip']['active'] )
|
||||
? (int) $_POST['statifyblacklist']['ip']['active'] : 0,
|
||||
'blacklist' => $ip,
|
||||
],
|
||||
),
|
||||
'version' => StatifyBlacklist::VERSION_MAIN,
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
// Generate messages.
|
||||
if ( false !== $statifyblacklist_update_result ) {
|
||||
$statifyblacklist_post_warning = [];
|
||||
$statifyblacklist_post_warning = array();
|
||||
if ( ! empty( $statifyblacklist_update_result['referer']['diff'] ) ) {
|
||||
$statifyblacklist_post_warning[] = __( 'Some URLs are invalid and have been sanitized.', 'statify-blacklist' );
|
||||
}
|
||||
@ -156,7 +156,7 @@ if ( ! empty( $_POST['statifyblacklist'] ) ) {
|
||||
if ( isset( $statifyblacklist_post_warning ) ) {
|
||||
foreach ( $statifyblacklist_post_warning as $w ) {
|
||||
print '<div class="notice notice-warning"><p>' .
|
||||
wp_kses( $w, [ 'br' => [] ] ) .
|
||||
wp_kses( $w, array( 'br' => array() ) ) .
|
||||
'</p></div>';
|
||||
}
|
||||
print '<div class="notice notice-warning"><p>' . esc_html( 'Settings have not been saved yet.', 'statify-blacklist' ) . '</p></div>';
|
||||
|
Reference in New Issue
Block a user