diff --git a/inc/class-statifyblacklist-admin.php b/inc/class-statifyblacklist-admin.php index 2ab7e29..2644d4c 100644 --- a/inc/class-statifyblacklist-admin.php +++ b/inc/class-statifyblacklist-admin.php @@ -64,7 +64,7 @@ class StatifyBlacklist_Admin extends StatifyBlacklist { // Sanitize referer list. $given_referer = $options['referer']['blacklist']; - $invalid_referer = []; + $invalid_referer = array(); if ( self::MODE_NORMAL === $options['referer']['regexp'] ) { // Sanitize URLs and remove empty inputs. $sanitized_referer = self::sanitize_urls( $given_referer ); @@ -78,7 +78,7 @@ class StatifyBlacklist_Admin extends StatifyBlacklist { // Sanitize target list. $given_target = $options['target']['blacklist']; - $invalid_target = []; + $invalid_target = array(); if ( self::MODE_REGEX === $options['target']['regexp'] || self::MODE_REGEX_CI === $options['target']['regexp'] ) { $sanitized_target = $given_target; // Check regular expressions. @@ -92,22 +92,22 @@ class StatifyBlacklist_Admin extends StatifyBlacklist { $sanitized_ip = self::sanitize_ips( $given_ip ); // Abort on errors. - $errors = [ - 'referer' => [ + $errors = array( + 'referer' => array( 'sanitized' => $sanitized_referer, 'diff' => array_diff( $given_referer, $sanitized_referer ), 'invalid' => $invalid_referer, - ], - 'target' => [ + ), + 'target' => array( 'sanitized' => $sanitized_target, 'diff' => array_diff( $given_target, $sanitized_target ), 'invalid' => $invalid_target, - ], - 'ip' => [ + ), + 'ip' => array( 'sanitized' => $sanitized_ip, 'diff' => array_diff( $given_ip, $sanitized_ip ), - ], - ]; + ), + ); if ( ! empty( $errors['referer']['diff'] ) || ! empty( $errors['referer']['invalid'] ) || ! empty( $errors['target']['diff'] ) diff --git a/views/settings-page.php b/views/settings-page.php index e4c6404..46ce8d0 100755 --- a/views/settings-page.php +++ b/views/settings-page.php @@ -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 '
' . - wp_kses( $w, [ 'br' => [] ] ) . + wp_kses( $w, array( 'br' => array() ) ) . '
' . esc_html( 'Settings have not been saved yet.', 'statify-blacklist' ) . '