@@ -153,7 +153,9 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function scheduleCronJob() |
155 | 155 | { |
156 | - if( wp_next_scheduled( static::CRON_EVENT ))return; |
|
156 | + if( wp_next_scheduled( static::CRON_EVENT )) { |
|
157 | + return; |
|
158 | + } |
|
157 | 159 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
158 | 160 | } |
159 | 161 | |
@@ -184,7 +186,9 @@ discard block |
||
184 | 186 | || !in_array( plugin_basename( $this->file ), $data['plugins'] ) |
185 | 187 | || $data['action'] != 'update' |
186 | 188 | || $data['type'] != 'plugin' |
187 | - )return; |
|
189 | + ) { |
|
190 | + return; |
|
191 | + } |
|
188 | 192 | $this->upgrade(); |
189 | 193 | } |
190 | 194 |
@@ -76,7 +76,9 @@ discard block |
||
76 | 76 | $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args )); |
77 | 77 | array_walk( $args, function( &$value, $key ) { |
78 | 78 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
79 | - if( !method_exists( $this, $methodName ))return; |
|
79 | + if( !method_exists( $this, $methodName )) { |
|
80 | + return; |
|
81 | + } |
|
80 | 82 | $value = $this->$methodName( $value ); |
81 | 83 | }); |
82 | 84 | return $this->sanitize( $args ); |
@@ -141,7 +143,9 @@ discard block |
||
141 | 143 | $defaults = array_pad( $defaults, Rating::MAX_RATING, '' ); |
142 | 144 | $labels = array_map( 'trim', explode( ',', $labels )); |
143 | 145 | foreach( $defaults as $i => $label ) { |
144 | - if( empty( $labels[$i] ))continue; |
|
146 | + if( empty( $labels[$i] )) { |
|
147 | + continue; |
|
148 | + } |
|
145 | 149 | $defaults[$i] = $labels[$i]; |
146 | 150 | } |
147 | 151 | return array_combine( range( Rating::MAX_RATING, 1 ), $defaults ); |
@@ -29,7 +29,9 @@ |
||
29 | 29 | { |
30 | 30 | foreach( $args as $key => $value ) { |
31 | 31 | $property = glsr( Helper::class )->buildPropertyName( $key ); |
32 | - if( !property_exists( $this, $property ))continue; |
|
32 | + if( !property_exists( $this, $property )) { |
|
33 | + continue; |
|
34 | + } |
|
33 | 35 | $this->$property = $value; |
34 | 36 | unset( $args[$key] ); |
35 | 37 | } |
@@ -58,7 +58,9 @@ |
||
58 | 58 | { |
59 | 59 | $args = shortcode_atts( array_fill_keys( ['context', 'globals'], [] ), $args ); |
60 | 60 | foreach( $args as $key => $value ) { |
61 | - if( is_array( $value ))continue; |
|
61 | + if( is_array( $value )) { |
|
62 | + continue; |
|
63 | + } |
|
62 | 64 | $args[$key] = []; |
63 | 65 | } |
64 | 66 | return $args; |
@@ -181,7 +181,9 @@ discard block |
||
181 | 181 | $key = $value; |
182 | 182 | $value = true; |
183 | 183 | } |
184 | - if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue; |
|
184 | + if( !in_array( $key, static::BOOLEAN_ATTRIBUTES )) { |
|
185 | + continue; |
|
186 | + } |
|
185 | 187 | $this->attributes[$key] = wp_validate_boolean( $value ); |
186 | 188 | } |
187 | 189 | } |
@@ -196,7 +198,9 @@ discard block |
||
196 | 198 | $key = $value; |
197 | 199 | $value = ''; |
198 | 200 | } |
199 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; |
|
201 | + if( !glsr( Helper::class )->startsWith( 'data-', $key )) { |
|
202 | + continue; |
|
203 | + } |
|
200 | 204 | if( is_array( $value )) { |
201 | 205 | $value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); |
202 | 206 | } |
@@ -210,7 +214,9 @@ discard block |
||
210 | 214 | protected function normalizeStringAttributes() |
211 | 215 | { |
212 | 216 | foreach( $this->attributes as $key => $value ) { |
213 | - if( !is_string( $value ))continue; |
|
217 | + if( !is_string( $value )) { |
|
218 | + continue; |
|
219 | + } |
|
214 | 220 | $this->attributes[$key] = trim( $value ); |
215 | 221 | } |
216 | 222 | } |
@@ -221,7 +227,9 @@ discard block |
||
221 | 227 | */ |
222 | 228 | protected function normalizeInputType( $method ) |
223 | 229 | { |
224 | - if( $method != 'input' )return; |
|
230 | + if( $method != 'input' ) { |
|
231 | + return; |
|
232 | + } |
|
225 | 233 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); |
226 | 234 | if( !in_array( $attributes['type'], static::INPUT_TYPES )) { |
227 | 235 | $this->attributes['type'] = 'text'; |
@@ -24,7 +24,9 @@ |
||
24 | 24 | public function build( $name, array $args = [] ) |
25 | 25 | { |
26 | 26 | $this->normalize( $args ); |
27 | - if( count( $this->sections ) < 2 )return; |
|
27 | + if( count( $this->sections ) < 2 ) { |
|
28 | + return; |
|
29 | + } |
|
28 | 30 | $links = array_reduce( array_keys( $this->sections ), function( $result, $section ) { |
29 | 31 | return $result.glsr( Builder::class )->li( $this->buildLink( $section )); |
30 | 32 | }); |
@@ -32,7 +32,9 @@ discard block |
||
32 | 32 | { |
33 | 33 | $this->args = $args; |
34 | 34 | $this->reviews = glsr( Database::class )->getReviews( $args ); |
35 | - if( $this->isHidden() )return; |
|
35 | + if( $this->isHidden() ) { |
|
36 | + return; |
|
37 | + } |
|
36 | 38 | $this->rating = glsr( Rating::class )->getAverage( $this->reviews->results ); |
37 | 39 | $this->buildSchema(); |
38 | 40 | return glsr( Builder::class )->div( $this->buildSummary().$this->buildPercentageBars(), [ |
@@ -72,7 +74,9 @@ discard block |
||
72 | 74 | */ |
73 | 75 | protected function buildPercentageBars() |
74 | 76 | { |
75 | - if( in_array( 'bars', $this->args['hide'] ))return; |
|
77 | + if( in_array( 'bars', $this->args['hide'] )) { |
|
78 | + return; |
|
79 | + } |
|
76 | 80 | $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews->results )); |
77 | 81 | $range = range( Rating::MAX_RATING, 1 ); |
78 | 82 | $bars = array_reduce( $range, function( $carry, $index ) use( $percentages ) { |
@@ -88,7 +92,9 @@ discard block |
||
88 | 92 | */ |
89 | 93 | protected function buildSchema() |
90 | 94 | { |
91 | - if( !$this->args['schema'] )return; |
|
95 | + if( !$this->args['schema'] ) { |
|
96 | + return; |
|
97 | + } |
|
92 | 98 | $schema = glsr( Schema::class ); |
93 | 99 | $schema->store( $schema->buildSummary( $this->args )); |
94 | 100 | } |
@@ -99,7 +105,9 @@ discard block |
||
99 | 105 | protected function buildSummary() |
100 | 106 | { |
101 | 107 | $summary = $this->buildSummaryRating().$this->buildSummaryStars().$this->buildSummaryText(); |
102 | - if( empty( $summary ))return; |
|
108 | + if( empty( $summary )) { |
|
109 | + return; |
|
110 | + } |
|
103 | 111 | return glsr( Builder::class )->div( $summary, [ |
104 | 112 | 'class' => 'glsr-summary', |
105 | 113 | ]); |
@@ -110,7 +118,9 @@ discard block |
||
110 | 118 | */ |
111 | 119 | protected function buildSummaryRating() |
112 | 120 | { |
113 | - if( in_array( 'rating', $this->args['hide'] ))return; |
|
121 | + if( in_array( 'rating', $this->args['hide'] )) { |
|
122 | + return; |
|
123 | + } |
|
114 | 124 | return glsr( Builder::class )->span( $this->rating, [ |
115 | 125 | 'class' => 'glsr-summary-rating', |
116 | 126 | ]); |
@@ -121,7 +131,9 @@ discard block |
||
121 | 131 | */ |
122 | 132 | protected function buildSummaryStars() |
123 | 133 | { |
124 | - if( in_array( 'stars', $this->args['hide'] ))return; |
|
134 | + if( in_array( 'stars', $this->args['hide'] )) { |
|
135 | + return; |
|
136 | + } |
|
125 | 137 | $stars = glsr( Html::class )->buildPartial( 'star-rating', [ |
126 | 138 | 'rating' => $this->rating, |
127 | 139 | ]); |
@@ -135,7 +147,9 @@ discard block |
||
135 | 147 | */ |
136 | 148 | protected function buildSummaryText() |
137 | 149 | { |
138 | - if( in_array( 'summary', $this->args['hide'] ))return; |
|
150 | + if( in_array( 'summary', $this->args['hide'] )) { |
|
151 | + return; |
|
152 | + } |
|
139 | 153 | $count = count( $this->reviews->results ); |
140 | 154 | if( empty( $this->args['text'] )) { |
141 | 155 | $this->args['text'] = _nx( |
@@ -19,7 +19,9 @@ |
||
19 | 19 | public function build( $name, array $args = [] ) |
20 | 20 | { |
21 | 21 | $this->normalize( $args ); |
22 | - if( count( $this->args['tabs'] ) < 2 )return; |
|
22 | + if( count( $this->args['tabs'] ) < 2 ) { |
|
23 | + return; |
|
24 | + } |
|
23 | 25 | $links = array_reduce( array_keys( $this->args['tabs'] ), function( $result, $tab ) { |
24 | 26 | return $result.$this->buildLink( $tab ); |
25 | 27 | }); |
@@ -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; |