@@ -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 @@ 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 | })); |
@@ -15,7 +15,9 @@ |
||
15 | 15 | */ |
16 | 16 | public function download( $filename, $content ) |
17 | 17 | { |
18 | - if( !current_user_can( Application::CAPABILITY ))return; |
|
18 | + if( !current_user_can( Application::CAPABILITY )) { |
|
19 | + return; |
|
20 | + } |
|
19 | 21 | nocache_headers(); |
20 | 22 | header( 'Content-Type: text/plain' ); |
21 | 23 | header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |
@@ -87,7 +87,9 @@ |
||
87 | 87 | */ |
88 | 88 | public function deactivate( $plugin ) |
89 | 89 | { |
90 | - if( static::isValid() )return; |
|
90 | + if( static::isValid() ) { |
|
91 | + return; |
|
92 | + } |
|
91 | 93 | $pluginSlug = plugin_basename( static::$file ); |
92 | 94 | if( $plugin == $pluginSlug ) { |
93 | 95 | $this->redirect(); //exit |
@@ -57,9 +57,13 @@ discard block |
||
57 | 57 | protected function generateFields( array $fields ) |
58 | 58 | { |
59 | 59 | $generatedFields = array_map( function( $field ) { |
60 | - if( empty( $field ))return; |
|
60 | + if( empty( $field )) { |
|
61 | + return; |
|
62 | + } |
|
61 | 63 | $field = $this->normalize( $field ); |
62 | - if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return; |
|
64 | + if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ))) { |
|
65 | + return; |
|
66 | + } |
|
63 | 67 | return $this->$method( $field ); |
64 | 68 | }, $fields ); |
65 | 69 | return array_values( array_filter( $generatedFields )); |
@@ -74,7 +78,9 @@ discard block |
||
74 | 78 | if( !empty( $this->errors )) { |
75 | 79 | $errors = []; |
76 | 80 | foreach( $this->required as $name => $alert ) { |
77 | - if( false !== array_search( $name, array_column( $fields, 'name' )))continue; |
|
81 | + if( false !== array_search( $name, array_column( $fields, 'name' ))) { |
|
82 | + continue; |
|
83 | + } |
|
78 | 84 | $errors[] = $this->errors[$name]; |
79 | 85 | } |
80 | 86 | $this->errors = $errors; |
@@ -118,7 +124,9 @@ discard block |
||
118 | 124 | */ |
119 | 125 | protected function normalizeContainer( array $field ) |
120 | 126 | { |
121 | - if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return; |
|
127 | + if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field )) { |
|
128 | + return; |
|
129 | + } |
|
122 | 130 | $field['items'] = $this->generateFields( $field['items'] ); |
123 | 131 | return $field; |
124 | 132 | } |
@@ -128,7 +136,9 @@ discard block |
||
128 | 136 | */ |
129 | 137 | protected function normalizeField( array $field, array $defaults ) |
130 | 138 | { |
131 | - if( !$this->validate( $field ))return; |
|
139 | + if( !$this->validate( $field )) { |
|
140 | + return; |
|
141 | + } |
|
132 | 142 | return array_filter( shortcode_atts( $defaults, $field ), function( $value ) { |
133 | 143 | return $value !== ''; |
134 | 144 | }); |
@@ -149,7 +159,9 @@ discard block |
||
149 | 159 | 'type' => '', |
150 | 160 | 'value' => '', |
151 | 161 | ]); |
152 | - if( !is_array( $listbox ))return; |
|
162 | + if( !is_array( $listbox )) { |
|
163 | + return; |
|
164 | + } |
|
153 | 165 | if( !array_key_exists( '', $listbox['options'] )) { |
154 | 166 | $listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options']; |
155 | 167 | } |
@@ -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 = intval( floor( $diff / $timePeriod[1] )); |
35 | 37 | $relativeDates = [ |
36 | 38 | _n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ), |
@@ -161,7 +161,9 @@ discard block |
||
161 | 161 | if( !empty( $sessions )) { |
162 | 162 | $now = time(); |
163 | 163 | foreach( $sessions as $session ) { |
164 | - if( $now <= $session->expiration )continue; |
|
164 | + if( $now <= $session->expiration ) { |
|
165 | + continue; |
|
166 | + } |
|
165 | 167 | $expiredSessions[] = $session->name; |
166 | 168 | $expiredSessions[] = str_replace( '_expires_', '_', $session->name ); |
167 | 169 | } |
@@ -204,7 +206,9 @@ discard block |
||
204 | 206 | */ |
205 | 207 | protected function setCookie() |
206 | 208 | { |
207 | - if( headers_sent() )return; |
|
209 | + if( headers_sent() ) { |
|
210 | + return; |
|
211 | + } |
|
208 | 212 | $cookie = $this->sessionId.'||'.$this->expiryTimestamp.'||'.$this->expiryTimestampReset; |
209 | 213 | $cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ))); |
210 | 214 | setcookie( static::SESSION_COOKIE, $cookie, $this->expiryTimestamp, $cookiePath ); |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | natsort( $routines ); |
17 | 17 | array_walk( $routines, function( $routine ) { |
18 | 18 | $version = str_replace( strtolower( __CLASS__ ).'_', '', $routine ); |
19 | - if( version_compare( glsr()->version, $version, '>=' ))return; |
|
19 | + if( version_compare( glsr()->version, $version, '>=' )) { |
|
20 | + return; |
|
21 | + } |
|
20 | 22 | call_user_func( [$this, $routine] ); |
21 | 23 | }); |
22 | 24 | $this->updateVersion(); |
@@ -37,5 +39,6 @@ discard block |
||
37 | 39 | } |
38 | 40 | |
39 | 41 | protected function upgrade_3_0_0() |
40 | - {} |
|
42 | + { |
|
43 | +} |
|
41 | 44 | } |