Skip to content

Commit 9903a61

Browse files
committed
simplify control structures
* extract common parts from if-else branches * convert redundante elseif to else
1 parent c88d716 commit 9903a61

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

inc/class-statifyblacklist-settings.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @since 1.7.0
99
*/
1010

11-
// Quit if accessed directly..
11+
// Quit if accessed directly.
1212
defined( 'ABSPATH' ) || exit;
1313

1414
/**
@@ -575,14 +575,13 @@ private static function sanitize_referer_options( &$options ) {
575575
* @since 1.7.0
576576
*/
577577
private static function sanitize_target_options( &$options ) {
578-
$target_given = $options['blacklist'];
579-
$target_invalid = array();
578+
$target_given = $options['blacklist'];
579+
$target_sanitized = $target_given;
580580
if ( StatifyBlacklist::MODE_REGEX === $options['regexp'] || StatifyBlacklist::MODE_REGEX_CI === $options['regexp'] ) {
581-
$target_sanitized = $target_given;
582581
// Check regular expressions.
583582
$target_invalid = self::sanitize_regex( $target_given );
584583
} else {
585-
$target_sanitized = $target_given;
584+
$target_invalid = array();
586585
}
587586
$options['blacklist'] = $target_sanitized;
588587

inc/class-statifyblacklist-system.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public static function upgrade() {
186186
);
187187
} elseif ( ! isset( $options['ua']['blacklist'] ) ) {
188188
$options['ua']['blacklist'] = array();
189-
} elseif ( isset( $options['ua'] ) ) {
189+
} else {
190190
// User agent strings got stored incorrectly in 1.6.0 - luckily the version was not updated, either.
191191
$options['ua']['blacklist'] = array_flip( $options['ua']['blacklist'] );
192192
}

0 commit comments

Comments
 (0)