@@ -37,7 +37,9 @@ |
||
| 37 | 37 | $lines = explode( "\n", $blacklist ); |
| 38 | 38 | foreach( (array) $lines as $line ) { |
| 39 | 39 | $line = trim( $line ); |
| 40 | - if( empty( $line ) || 256 < strlen( $line ))continue; |
|
| 40 | + if( empty( $line ) || 256 < strlen( $line )) { |
|
| 41 | + continue; |
|
| 42 | + } |
|
| 41 | 43 | $pattern = sprintf( '#%s#i', preg_quote( $line, '#' )); |
| 42 | 44 | if( preg_match( $pattern, $target )) { |
| 43 | 45 | return true; |
@@ -15,7 +15,9 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function add( $type, $message, array $args = [] ) |
| 17 | 17 | { |
| 18 | - if( empty( array_filter( [$message, $type] )))return; |
|
| 18 | + if( empty( array_filter( [$message, $type] ))) { |
|
| 19 | + return; |
|
| 20 | + } |
|
| 19 | 21 | $args['message'] = $message; |
| 20 | 22 | $args['type'] = $type; |
| 21 | 23 | add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ))); |
@@ -56,7 +58,9 @@ discard block |
||
| 56 | 58 | $notices = array_map( 'unserialize', |
| 57 | 59 | array_unique( array_map( 'serialize', get_settings_errors( Application::ID ))) |
| 58 | 60 | ); |
| 59 | - if( empty( $notices ))return; |
|
| 61 | + if( empty( $notices )) { |
|
| 62 | + return; |
|
| 63 | + } |
|
| 60 | 64 | return array_reduce( $notices, function( $carry, $notice ) { |
| 61 | 65 | return $carry.$this->buildNotice( json_decode( $notice['message'], true )); |
| 62 | 66 | }); |
@@ -30,7 +30,9 @@ |
||
| 30 | 30 | { |
| 31 | 31 | $diff = time() - strtotime( $date ); |
| 32 | 32 | foreach( static::$TIME_PERIODS as $i => $timePeriod ) { |
| 33 | - if( $diff > $timePeriod[0] )continue; |
|
| 33 | + if( $diff > $timePeriod[0] ) { |
|
| 34 | + continue; |
|
| 35 | + } |
|
| 34 | 36 | $unit = floor( $diff / $timePeriod[1] ); |
| 35 | 37 | $relativeDates = [ |
| 36 | 38 | _n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ), |
@@ -83,7 +83,9 @@ discard block |
||
| 83 | 83 | get_mu_plugins(), |
| 84 | 84 | get_plugins( '/../'.basename( WPMU_PLUGIN_DIR )) |
| 85 | 85 | ); |
| 86 | - if( empty( $plugins ))return; |
|
| 86 | + if( empty( $plugins )) { |
|
| 87 | + return; |
|
| 88 | + } |
|
| 87 | 89 | return $this->normalizePluginList( $plugins ); |
| 88 | 90 | } |
| 89 | 91 | |
@@ -92,7 +94,9 @@ discard block |
||
| 92 | 94 | */ |
| 93 | 95 | public function getMultisitePluginDetails() |
| 94 | 96 | { |
| 95 | - if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return; |
|
| 97 | + if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] ))) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 96 | 100 | return $this->normalizePluginList( wp_get_active_network_plugins() ); |
| 97 | 101 | } |
| 98 | 102 | |
@@ -146,12 +150,16 @@ discard block |
||
| 146 | 150 | $settings = glsr( OptionManager::class )->get( 'settings' ); |
| 147 | 151 | $settings = $helper->flattenArray( $settings ); |
| 148 | 152 | foreach( ['submissions.recaptcha.key', 'submissions.recaptcha.secret'] as $key ) { |
| 149 | - if( empty( $settings[$key] ))continue; |
|
| 153 | + if( empty( $settings[$key] )) { |
|
| 154 | + continue; |
|
| 155 | + } |
|
| 150 | 156 | $settings[$key] = str_repeat( '*', 10 ); |
| 151 | 157 | } |
| 152 | 158 | $details = []; |
| 153 | 159 | foreach( $settings as $key => $value ) { |
| 154 | - if( $helper->startsWith( 'translations', $key ) && $helper->endsWith( 'id', $key ))continue; |
|
| 160 | + if( $helper->startsWith( 'translations', $key ) && $helper->endsWith( 'id', $key )) { |
|
| 161 | + continue; |
|
| 162 | + } |
|
| 155 | 163 | $value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' ); |
| 156 | 164 | $details[$key] = $value; |
| 157 | 165 | } |
@@ -108,7 +108,9 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function render() |
| 110 | 110 | { |
| 111 | - if( is_null( glsr()->schemas ))return; |
|
| 111 | + if( is_null( glsr()->schemas )) { |
|
| 112 | + return; |
|
| 113 | + } |
|
| 112 | 114 | printf( '<script type="application/ld+json">%s</script>', json_encode( |
| 113 | 115 | apply_filters( 'site-reviews/schema/all', glsr()->schemas ), |
| 114 | 116 | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES |
@@ -181,7 +183,9 @@ discard block |
||
| 181 | 183 | if( $value != $fallback ) { |
| 182 | 184 | return $value; |
| 183 | 185 | } |
| 184 | - if( !is_single() && !is_page() )return; |
|
| 186 | + if( !is_single() && !is_page() ) { |
|
| 187 | + return; |
|
| 188 | + } |
|
| 185 | 189 | switch( $option ) { |
| 186 | 190 | case 'description': |
| 187 | 191 | return get_the_excerpt(); |
@@ -30,7 +30,9 @@ discard block |
||
| 30 | 30 | // 'is_test' => 1, |
| 31 | 31 | ]; |
| 32 | 32 | foreach( $_SERVER as $key => $value ) { |
| 33 | - if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ))continue; |
|
| 33 | + if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] )) { |
|
| 34 | + continue; |
|
| 35 | + } |
|
| 34 | 36 | $submission[$key] = $value; |
| 35 | 37 | } |
| 36 | 38 | return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review )); |
@@ -56,12 +58,16 @@ discard block |
||
| 56 | 58 | { |
| 57 | 59 | $query = []; |
| 58 | 60 | foreach( $data as $key => $value ) { |
| 59 | - if( is_array( $value ) || is_object( $value ))continue; |
|
| 61 | + if( is_array( $value ) || is_object( $value )) { |
|
| 62 | + continue; |
|
| 63 | + } |
|
| 60 | 64 | if( $value === false ) { |
| 61 | 65 | $value = '0'; |
| 62 | 66 | } |
| 63 | 67 | $value = trim( $value ); |
| 64 | - if( !strlen( $value ))continue; |
|
| 68 | + if( !strlen( $value )) { |
|
| 69 | + continue; |
|
| 70 | + } |
|
| 65 | 71 | $query[] = urlencode( $key ).'='.urlencode( $value ); |
| 66 | 72 | } |
| 67 | 73 | return implode( '&', $query ); |
@@ -63,7 +63,9 @@ discard block |
||
| 63 | 63 | $counts = array_fill_keys( [5,4,3,2,1], [] ); |
| 64 | 64 | array_walk( $counts, function( &$count, $key ) use( $reviews ) { |
| 65 | 65 | $count = count( array_filter( $reviews, function( $review ) use( $key ) { |
| 66 | - if( !isset( $review->rating ))return; |
|
| 66 | + if( !isset( $review->rating )) { |
|
| 67 | + return; |
|
| 68 | + } |
|
| 67 | 69 | return $review->rating == $key; |
| 68 | 70 | })); |
| 69 | 71 | }); |
@@ -83,7 +85,9 @@ discard block |
||
| 83 | 85 | public function getLowerBound( array $upDownRatings, $confidencePercentage = 95 ) |
| 84 | 86 | { |
| 85 | 87 | $numRatings = count( $upDownRatings ); |
| 86 | - if( !$numRatings )return 0; |
|
| 88 | + if( !$numRatings ) { |
|
| 89 | + return 0; |
|
| 90 | + } |
|
| 87 | 91 | $positiveRatings = count( array_filter( $upDownRatings, function( $value ) { |
| 88 | 92 | return $value > 0; |
| 89 | 93 | })); |
@@ -42,7 +42,9 @@ |
||
| 42 | 42 | $options = $this->all(); |
| 43 | 43 | $pointer = &$options; |
| 44 | 44 | foreach( $keys as $key ) { |
| 45 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
| 45 | + if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] )) { |
|
| 46 | + continue; |
|
| 47 | + } |
|
| 46 | 48 | $pointer = &$pointer[$key]; |
| 47 | 49 | } |
| 48 | 50 | unset( $pointer[$last] ); |
@@ -16,9 +16,13 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $queries = []; |
| 18 | 18 | foreach( $keys as $key ) { |
| 19 | - if( !array_key_exists( $key, $values ))continue; |
|
| 19 | + if( !array_key_exists( $key, $values )) { |
|
| 20 | + continue; |
|
| 21 | + } |
|
| 20 | 22 | $methodName = glsr( Helper::class )->buildMethodName( $key, $prefix = __METHOD__ ); |
| 21 | - if( !method_exists( $this, $methodName ))continue; |
|
| 23 | + if( !method_exists( $this, $methodName )) { |
|
| 24 | + continue; |
|
| 25 | + } |
|
| 22 | 26 | $query = call_user_func( [$this, $methodName], $values[$key] ); |
| 23 | 27 | if( is_array( $query )) { |
| 24 | 28 | $queries[] = $query; |
@@ -90,7 +94,9 @@ discard block |
||
| 90 | 94 | */ |
| 91 | 95 | protected function buildQueryAssignedTo( $value ) |
| 92 | 96 | { |
| 93 | - if( empty( $value ))return; |
|
| 97 | + if( empty( $value )) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 94 | 100 | return [ |
| 95 | 101 | 'compare' => 'IN', |
| 96 | 102 | 'key' => 'assigned_to', |
@@ -104,7 +110,9 @@ discard block |
||
| 104 | 110 | */ |
| 105 | 111 | protected function buildQueryCategory( $value ) |
| 106 | 112 | { |
| 107 | - if( empty( $value ))return; |
|
| 113 | + if( empty( $value )) { |
|
| 114 | + return; |
|
| 115 | + } |
|
| 108 | 116 | return [ |
| 109 | 117 | 'field' => 'term_id', |
| 110 | 118 | 'taxonomy' => Application::TAXONOMY, |
@@ -118,7 +126,9 @@ discard block |
||
| 118 | 126 | */ |
| 119 | 127 | protected function buildQueryRating( $value ) |
| 120 | 128 | { |
| 121 | - if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return; |
|
| 129 | + if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) { |
|
| 130 | + return; |
|
| 131 | + } |
|
| 122 | 132 | return [ |
| 123 | 133 | 'compare' => '>=', |
| 124 | 134 | 'key' => 'rating', |
@@ -132,7 +142,9 @@ discard block |
||
| 132 | 142 | */ |
| 133 | 143 | protected function buildQueryType( $value ) |
| 134 | 144 | { |
| 135 | - if( in_array( $value, ['','all'] ))return; |
|
| 145 | + if( in_array( $value, ['','all'] )) { |
|
| 146 | + return; |
|
| 147 | + } |
|
| 136 | 148 | return [ |
| 137 | 149 | 'key' => 'review_type', |
| 138 | 150 | 'value' => $value, |