@@ -20,7 +20,9 @@ |
||
20 | 20 | public function build( array $args = [] ) |
21 | 21 | { |
22 | 22 | $this->args = $this->normalize( $args ); |
23 | - if( $this->args['total'] < 2 )return; |
|
23 | + if( $this->args['total'] < 2 ) { |
|
24 | + return; |
|
25 | + } |
|
24 | 26 | return glsr( Template::class )->build( 'templates/pagination', [ |
25 | 27 | 'context' => [ |
26 | 28 | 'links' => apply_filters( 'site-reviews/paginate_links', $this->buildLinks(), $this->args ), |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'loader' => '<div class="glsr-loader"></div>', |
28 | 28 | 'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ), |
29 | 29 | ], |
30 | - ]); |
|
30 | + ] ); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | */ |
36 | 36 | protected function buildLinks() |
37 | 37 | { |
38 | - $args = glsr( Style::class )->paginationArgs([ |
|
38 | + $args = glsr( Style::class )->paginationArgs( [ |
|
39 | 39 | 'current' => $this->args['paged'], |
40 | 40 | 'total' => $this->args['total'], |
41 | - ]); |
|
41 | + ] ); |
|
42 | 42 | if( is_front_page() ) { |
43 | - unset( $args['format'] ); |
|
43 | + unset($args['format']); |
|
44 | 44 | } |
45 | 45 | if( $args['type'] == 'array' ) { |
46 | 46 | $args['type'] = 'plain'; |
@@ -56,6 +56,6 @@ discard block |
||
56 | 56 | return wp_parse_args( $args, [ |
57 | 57 | 'paged' => glsr( QueryBuilder::class )->getPaged(), |
58 | 58 | 'total' => 1, |
59 | - ]); |
|
59 | + ] ); |
|
60 | 60 | } |
61 | 61 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 'navigation' => $navigation, |
58 | 58 | 'reviews' => $this->buildReviews(), |
59 | 59 | ], |
60 | - ]); |
|
60 | + ] ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | $reviews = ''; |
69 | 69 | foreach( $this->reviews->results as $index => $result ) { |
70 | 70 | $this->current = $index; |
71 | - $reviews.= glsr( Template::class )->build( 'templates/review', [ |
|
71 | + $reviews .= glsr( Template::class )->build( 'templates/review', [ |
|
72 | 72 | 'context' => $this->buildReview( $result )->values, |
73 | - ]); |
|
73 | + ] ); |
|
74 | 74 | } |
75 | 75 | return $reviews; |
76 | 76 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $renderedFields = []; |
86 | 86 | foreach( $review as $key => $value ) { |
87 | 87 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' ); |
88 | - if( !method_exists( $this, $method ))continue; |
|
88 | + if( !method_exists( $this, $method ) )continue; |
|
89 | 89 | $renderedFields[$key] = $this->$method( $key, $value ); |
90 | 90 | } |
91 | 91 | $renderedFields = apply_filters( 'site-reviews/review/build/after', (array)$renderedFields ); |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | */ |
100 | 100 | protected function buildOptionAssignedTo( $key, $value ) |
101 | 101 | { |
102 | - if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return; |
|
102 | + if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) )return; |
|
103 | 103 | $post = glsr( Polylang::class )->getPost( $value ); |
104 | - if( !( $post instanceof WP_Post ))return; |
|
104 | + if( !($post instanceof WP_Post) )return; |
|
105 | 105 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
106 | 106 | 'href' => get_the_permalink( $post->ID ), |
107 | - ]); |
|
107 | + ] ); |
|
108 | 108 | $assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink ); |
109 | 109 | return $this->wrap( $key, '<span>'.$assignedTo.'</span>' ); |
110 | 110 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function buildOptionAuthor( $key, $value ) |
118 | 118 | { |
119 | - if( $this->isHidden( $key ))return; |
|
119 | + if( $this->isHidden( $key ) )return; |
|
120 | 120 | return $this->wrap( $key, '<span>'.$value.'</span>' ); |
121 | 121 | } |
122 | 122 | |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function buildOptionAvatar( $key, $value ) |
129 | 129 | { |
130 | - if( $this->isHidden( $key, 'settings.reviews.avatars' ))return; |
|
130 | + if( $this->isHidden( $key, 'settings.reviews.avatars' ) )return; |
|
131 | 131 | $size = $this->getOption( 'settings.reviews.avatars_size', 40 ); |
132 | - return $this->wrap( $key, glsr( Builder::class )->img([ |
|
132 | + return $this->wrap( $key, glsr( Builder::class )->img( [ |
|
133 | 133 | 'src' => $this->generateAvatar( $value ), |
134 | 134 | 'height' => $size, |
135 | 135 | 'width' => $size, |
136 | - ])); |
|
136 | + ] ) ); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | protected function buildOptionContent( $key, $value ) |
145 | 145 | { |
146 | 146 | $text = $this->normalizeText( $value ); |
147 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
147 | + if( $this->isHiddenOrEmpty( $key, $text ) )return; |
|
148 | 148 | return $this->wrap( $key, '<p>'.$text.'</p>' ); |
149 | 149 | } |
150 | 150 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | protected function buildOptionDate( $key, $value ) |
157 | 157 | { |
158 | - if( $this->isHidden( $key ))return; |
|
158 | + if( $this->isHidden( $key ) )return; |
|
159 | 159 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
160 | 160 | if( $dateFormat == 'relative' ) { |
161 | 161 | $date = glsr( Date::class )->relative( $value ); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $format = $dateFormat == 'custom' |
165 | 165 | ? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' ) |
166 | 166 | : (string)get_option( 'date_format' ); |
167 | - $date = date_i18n( $format, strtotime( $value )); |
|
167 | + $date = date_i18n( $format, strtotime( $value ) ); |
|
168 | 168 | } |
169 | 169 | return $this->wrap( $key, '<span>'.$date.'</span>' ); |
170 | 170 | } |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | */ |
177 | 177 | protected function buildOptionRating( $key, $value ) |
178 | 178 | { |
179 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
179 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
180 | 180 | $rating = glsr( Partial::class )->build( 'star-rating', [ |
181 | 181 | 'rating' => $value, |
182 | - ]); |
|
182 | + ] ); |
|
183 | 183 | return $this->wrap( $key, $rating ); |
184 | 184 | } |
185 | 185 | |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | */ |
191 | 191 | protected function buildOptionResponse( $key, $value ) |
192 | 192 | { |
193 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
194 | - $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
|
193 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
194 | + $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) ); |
|
195 | 195 | $text = $this->normalizeText( $value ); |
196 | 196 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
197 | 197 | return $this->wrap( $key, |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | */ |
208 | 208 | protected function buildOptionTitle( $key, $value ) |
209 | 209 | { |
210 | - if( $this->isHidden( $key ))return; |
|
211 | - if( empty( $value )) { |
|
210 | + if( $this->isHidden( $key ) )return; |
|
211 | + if( empty($value) ) { |
|
212 | 212 | $value = __( 'No Title', 'site-reviews' ); |
213 | 213 | } |
214 | 214 | return $this->wrap( $key, '<h3>'.$value.'</h3>' ); |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | return $avatarUrl; |
226 | 226 | } |
227 | 227 | $authorIdOrEmail = get_the_author_meta( 'ID', $review->user_id ); |
228 | - if( empty( $authorIdOrEmail )) { |
|
228 | + if( empty($authorIdOrEmail) ) { |
|
229 | 229 | $authorIdOrEmail = $review->email; |
230 | 230 | } |
231 | - if( $newAvatar = get_avatar_url( $authorIdOrEmail )) { |
|
231 | + if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) { |
|
232 | 232 | return $newAvatar; |
233 | 233 | } |
234 | 234 | return $avatarUrl; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | protected function generateSchema() |
241 | 241 | { |
242 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
242 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
243 | 243 | glsr( Schema::class )->store( |
244 | 244 | glsr( Schema::class )->build( $this->args ) |
245 | 245 | ); |
@@ -262,18 +262,18 @@ discard block |
||
262 | 262 | */ |
263 | 263 | protected function getExcerpt( $text ) |
264 | 264 | { |
265 | - $limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 )); |
|
265 | + $limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) ); |
|
266 | 266 | $split = extension_loaded( 'intl' ) |
267 | 267 | ? $this->getExcerptIntlSplit( $text, $limit ) |
268 | 268 | : $this->getExcerptSplit( $text, $limit ); |
269 | 269 | $hiddenText = substr( $text, $split ); |
270 | - if( !empty( $hiddenText )) { |
|
270 | + if( !empty($hiddenText) ) { |
|
271 | 271 | $showMore = glsr( Builder::class )->span( $hiddenText, [ |
272 | 272 | 'class' => 'glsr-hidden glsr-hidden-text', |
273 | 273 | 'data-show-less' => __( 'Show less', 'site-reviews' ), |
274 | 274 | 'data-show-more' => __( 'Show more', 'site-reviews' ), |
275 | - ]); |
|
276 | - $text = ltrim( substr( $text, 0, $split )).$showMore; |
|
275 | + ] ); |
|
276 | + $text = ltrim( substr( $text, 0, $split ) ).$showMore; |
|
277 | 277 | } |
278 | 278 | return nl2br( $text ); |
279 | 279 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $words = IntlRuleBasedBreakIterator::createWordInstance( '' ); |
289 | 289 | $words->setText( $text ); |
290 | 290 | $count = 0; |
291 | - foreach( $words as $offset ){ |
|
291 | + foreach( $words as $offset ) { |
|
292 | 292 | if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue; |
293 | 293 | $count++; |
294 | 294 | if( $count != $limit )continue; |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | protected function getExcerptSplit( $text, $limit ) |
306 | 306 | { |
307 | 307 | if( str_word_count( $text, 0 ) > $limit ) { |
308 | - $words = array_keys( str_word_count( $text, 2 )); |
|
308 | + $words = array_keys( str_word_count( $text, 2 ) ); |
|
309 | 309 | return $words[$limit]; |
310 | 310 | } |
311 | 311 | return strlen( $text ); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | protected function getOption( $path, $fallback = '' ) |
320 | 320 | { |
321 | - if( array_key_exists( $path, $this->options )) { |
|
321 | + if( array_key_exists( $path, $this->options ) ) { |
|
322 | 322 | return $this->options[$path]; |
323 | 323 | } |
324 | 324 | return $fallback; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | */ |
332 | 332 | protected function isHidden( $key, $path = '' ) |
333 | 333 | { |
334 | - $isOptionEnabled = !empty( $path ) |
|
334 | + $isOptionEnabled = !empty($path) |
|
335 | 335 | ? $this->isOptionEnabled( $path ) |
336 | 336 | : true; |
337 | 337 | return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | protected function isHiddenOrEmpty( $key, $value ) |
346 | 346 | { |
347 | - return $this->isHidden( $key ) || empty( $value ); |
|
347 | + return $this->isHidden( $key ) || empty($value); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -363,10 +363,10 @@ discard block |
||
363 | 363 | protected function normalizeText( $text ) |
364 | 364 | { |
365 | 365 | $text = wp_kses( $text, wp_kses_allowed_html() ); |
366 | - $text = convert_smilies( strip_shortcodes( $text )); |
|
366 | + $text = convert_smilies( strip_shortcodes( $text ) ); |
|
367 | 367 | $text = str_replace( ']]>', ']]>', $text ); |
368 | 368 | $text = preg_replace( '/(\R){2,}/', '$1', $text ); |
369 | - if( $this->isOptionEnabled( 'settings.reviews.excerpts' )) { |
|
369 | + if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) { |
|
370 | 370 | $text = $this->getExcerpt( $text ); |
371 | 371 | } |
372 | 372 | return wptexturize( $text ); |
@@ -381,6 +381,6 @@ discard block |
||
381 | 381 | { |
382 | 382 | return glsr( Builder::class )->div( $value, [ |
383 | 383 | 'class' => 'glsr-review-'.$key, |
384 | - ]); |
|
384 | + ] ); |
|
385 | 385 | } |
386 | 386 | } |
@@ -85,7 +85,9 @@ discard block |
||
85 | 85 | $renderedFields = []; |
86 | 86 | foreach( $review as $key => $value ) { |
87 | 87 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' ); |
88 | - if( !method_exists( $this, $method ))continue; |
|
88 | + if( !method_exists( $this, $method )) { |
|
89 | + continue; |
|
90 | + } |
|
89 | 91 | $renderedFields[$key] = $this->$method( $key, $value ); |
90 | 92 | } |
91 | 93 | $renderedFields = apply_filters( 'site-reviews/review/build/after', (array)$renderedFields ); |
@@ -99,9 +101,13 @@ discard block |
||
99 | 101 | */ |
100 | 102 | protected function buildOptionAssignedTo( $key, $value ) |
101 | 103 | { |
102 | - if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return; |
|
104 | + if( $this->isHidden( $key, 'settings.reviews.assigned_links' )) { |
|
105 | + return; |
|
106 | + } |
|
103 | 107 | $post = glsr( Polylang::class )->getPost( $value ); |
104 | - if( !( $post instanceof WP_Post ))return; |
|
108 | + if( !( $post instanceof WP_Post )) { |
|
109 | + return; |
|
110 | + } |
|
105 | 111 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
106 | 112 | 'href' => get_the_permalink( $post->ID ), |
107 | 113 | ]); |
@@ -116,7 +122,9 @@ discard block |
||
116 | 122 | */ |
117 | 123 | protected function buildOptionAuthor( $key, $value ) |
118 | 124 | { |
119 | - if( $this->isHidden( $key ))return; |
|
125 | + if( $this->isHidden( $key )) { |
|
126 | + return; |
|
127 | + } |
|
120 | 128 | return $this->wrap( $key, '<span>'.$value.'</span>' ); |
121 | 129 | } |
122 | 130 | |
@@ -127,7 +135,9 @@ discard block |
||
127 | 135 | */ |
128 | 136 | protected function buildOptionAvatar( $key, $value ) |
129 | 137 | { |
130 | - if( $this->isHidden( $key, 'settings.reviews.avatars' ))return; |
|
138 | + if( $this->isHidden( $key, 'settings.reviews.avatars' )) { |
|
139 | + return; |
|
140 | + } |
|
131 | 141 | $size = $this->getOption( 'settings.reviews.avatars_size', 40 ); |
132 | 142 | return $this->wrap( $key, glsr( Builder::class )->img([ |
133 | 143 | 'src' => $this->generateAvatar( $value ), |
@@ -144,7 +154,9 @@ discard block |
||
144 | 154 | protected function buildOptionContent( $key, $value ) |
145 | 155 | { |
146 | 156 | $text = $this->normalizeText( $value ); |
147 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
157 | + if( $this->isHiddenOrEmpty( $key, $text )) { |
|
158 | + return; |
|
159 | + } |
|
148 | 160 | return $this->wrap( $key, '<p>'.$text.'</p>' ); |
149 | 161 | } |
150 | 162 | |
@@ -155,7 +167,9 @@ discard block |
||
155 | 167 | */ |
156 | 168 | protected function buildOptionDate( $key, $value ) |
157 | 169 | { |
158 | - if( $this->isHidden( $key ))return; |
|
170 | + if( $this->isHidden( $key )) { |
|
171 | + return; |
|
172 | + } |
|
159 | 173 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
160 | 174 | if( $dateFormat == 'relative' ) { |
161 | 175 | $date = glsr( Date::class )->relative( $value ); |
@@ -176,7 +190,9 @@ discard block |
||
176 | 190 | */ |
177 | 191 | protected function buildOptionRating( $key, $value ) |
178 | 192 | { |
179 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
193 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
194 | + return; |
|
195 | + } |
|
180 | 196 | $rating = glsr( Partial::class )->build( 'star-rating', [ |
181 | 197 | 'rating' => $value, |
182 | 198 | ]); |
@@ -190,7 +206,9 @@ discard block |
||
190 | 206 | */ |
191 | 207 | protected function buildOptionResponse( $key, $value ) |
192 | 208 | { |
193 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
209 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
210 | + return; |
|
211 | + } |
|
194 | 212 | $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
195 | 213 | $text = $this->normalizeText( $value ); |
196 | 214 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
@@ -207,7 +225,9 @@ discard block |
||
207 | 225 | */ |
208 | 226 | protected function buildOptionTitle( $key, $value ) |
209 | 227 | { |
210 | - if( $this->isHidden( $key ))return; |
|
228 | + if( $this->isHidden( $key )) { |
|
229 | + return; |
|
230 | + } |
|
211 | 231 | if( empty( $value )) { |
212 | 232 | $value = __( 'No Title', 'site-reviews' ); |
213 | 233 | } |
@@ -239,7 +259,9 @@ discard block |
||
239 | 259 | */ |
240 | 260 | protected function generateSchema() |
241 | 261 | { |
242 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
262 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
263 | + return; |
|
264 | + } |
|
243 | 265 | glsr( Schema::class )->store( |
244 | 266 | glsr( Schema::class )->build( $this->args ) |
245 | 267 | ); |
@@ -289,9 +311,13 @@ discard block |
||
289 | 311 | $words->setText( $text ); |
290 | 312 | $count = 0; |
291 | 313 | foreach( $words as $offset ){ |
292 | - if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue; |
|
314 | + if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE ) { |
|
315 | + continue; |
|
316 | + } |
|
293 | 317 | $count++; |
294 | - if( $count != $limit )continue; |
|
318 | + if( $count != $limit ) { |
|
319 | + continue; |
|
320 | + } |
|
295 | 321 | return $offset; |
296 | 322 | } |
297 | 323 | return strlen( $text ); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | 'avatar' => '', |
19 | 19 | 'content' => '', |
20 | 20 | 'custom' => '', |
21 | - 'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' )), |
|
21 | + 'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' ) ), |
|
22 | 22 | 'email' => '', |
23 | 23 | 'ip_address' => glsr( Helper::class )->getIpAddress(), |
24 | 24 | 'pinned' => false, |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function callbackRegisterSettings( $input ) |
19 | 19 | { |
20 | - if( !is_array( $input )) { |
|
20 | + if( !is_array( $input ) ) { |
|
21 | 21 | $input = ['settings' => []]; |
22 | 22 | } |
23 | 23 | if( key( $input ) == 'settings' ) { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $options = $this->sanitizeGeneral( $input, $options ); |
26 | 26 | $options = $this->sanitizeSubmissions( $input, $options ); |
27 | 27 | $options = $this->sanitizeTranslations( $input, $options ); |
28 | - glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' )); |
|
28 | + glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) ); |
|
29 | 29 | return $options; |
30 | 30 | } |
31 | 31 | return $input; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [ |
41 | 41 | 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
42 | - ]); |
|
42 | + ] ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | if( $inputForm['support']['polylang'] == 'yes' ) { |
52 | 52 | if( !glsr( Polylang::class )->isActive() ) { |
53 | 53 | $options['settings']['general']['support']['polylang'] = 'no'; |
54 | - glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' )); |
|
54 | + glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ) ); |
|
55 | 55 | } |
56 | 56 | else if( !glsr( Polylang::class )->isSupported() ) { |
57 | 57 | $options['settings']['general']['support']['polylang'] = 'no'; |
58 | - glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' )); |
|
58 | + glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ) ); |
|
59 | 59 | } |
60 | 60 | } |
61 | - if( !isset( $inputForm['notifications'] )) { |
|
61 | + if( !isset($inputForm['notifications']) ) { |
|
62 | 62 | $options['settings']['general']['notifications'] = []; |
63 | 63 | } |
64 | 64 | if( trim( $inputForm['notification_message'] ) == '' ) { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | protected function sanitizeSubmissions( array $input, array $options ) |
74 | 74 | { |
75 | 75 | $inputForm = $input['settings']['submissions']; |
76 | - if( !isset( $inputForm['required'] )) { |
|
76 | + if( !isset($inputForm['required']) ) { |
|
77 | 77 | $options['settings']['submissions']['required'] = []; |
78 | 78 | } |
79 | 79 | return $options; |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function sanitizeTranslations( array $input, array $options ) |
86 | 86 | { |
87 | - if( isset( $input['settings']['strings'] )) { |
|
88 | - $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] )); |
|
87 | + if( isset($input['settings']['strings']) ) { |
|
88 | + $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) ); |
|
89 | 89 | $allowedTags = ['a' => ['class' => [], 'href' => [], 'target' => []]]; |
90 | - array_walk( $options['settings']['strings'], function( &$string ) use( $allowedTags ) { |
|
91 | - if( isset( $string['s2'] )) { |
|
90 | + array_walk( $options['settings']['strings'], function( &$string ) use($allowedTags) { |
|
91 | + if( isset($string['s2']) ) { |
|
92 | 92 | $string['s2'] = wp_kses( $string['s2'], $allowedTags ); |
93 | 93 | } |
94 | - if( isset( $string['p2'] )) { |
|
94 | + if( isset($string['p2']) ) { |
|
95 | 95 | $string['p2'] = wp_kses( $string['p2'], $allowedTags ); |
96 | 96 | } |
97 | 97 | }); |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | $review = glsr( ReviewManager::class )->create( $command ); |
18 | 18 | if( !$review ) { |
19 | 19 | glsr( Session::class )->set( $command->form_id.'errors', [] ); |
20 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' )); |
|
20 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) ); |
|
21 | 21 | return; |
22 | 22 | } |
23 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
|
23 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) ); |
|
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | 25 | if( $command->ajax_request )return; |
26 | - wp_safe_redirect( $this->getReferer( $command )); |
|
26 | + wp_safe_redirect( $this->getReferer( $command ) ); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected function getReferer( Command $command ) |
34 | 34 | { |
35 | - $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ))); |
|
36 | - if( empty( $referer )) { |
|
35 | + $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
36 | + if( empty($referer) ) { |
|
37 | 37 | $referer = $command->referer; |
38 | 38 | } |
39 | - if( empty( $referer )) { |
|
39 | + if( empty($referer) ) { |
|
40 | 40 | glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command ); |
41 | 41 | $referer = home_url(); |
42 | 42 | } |
@@ -22,7 +22,9 @@ |
||
22 | 22 | } |
23 | 23 | glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | - if( $command->ajax_request )return; |
|
25 | + if( $command->ajax_request ) { |
|
26 | + return; |
|
27 | + } |
|
26 | 28 | wp_safe_redirect( $this->getReferer( $command )); |
27 | 29 | exit; |
28 | 30 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $fields = []; |
30 | 30 | foreach( glsr()->config( 'forms/'.$id ) as $name => $field ) { |
31 | - $fields[] = new Field( wp_parse_args( $field, ['name' => $name] )); |
|
31 | + $fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) ); |
|
32 | 32 | } |
33 | 33 | return $fields; |
34 | 34 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | // Database/ReviewManager.php |
6 | 6 | add_action( 'site-reviews/review/created', function( $review ) { |
7 | - if( has_action( 'site-reviews/local/review/create' )) { |
|
7 | + if( has_action( 'site-reviews/local/review/create' ) ) { |
|
8 | 8 | glsr()->deprecated[] = 'The "site-reviews/local/review/create" hook has been deprecated. Please use the "site-reviews/create/review" hook instead.'; |
9 | 9 | do_action( 'site-reviews/local/review/create', (array)get_post( $review->ID ), (array)$review, $review->ID ); |
10 | 10 | } |
@@ -12,18 +12,18 @@ discard block |
||
12 | 12 | |
13 | 13 | // Handlers/CreateReview.php |
14 | 14 | add_action( 'site-reviews/review/submitted', function( $review ) { |
15 | - if( has_action( 'site-reviews/local/review/submitted' )) { |
|
15 | + if( has_action( 'site-reviews/local/review/submitted' ) ) { |
|
16 | 16 | glsr()->deprecated[] = 'The "site-reviews/local/review/submitted" hook has been deprecated. Please use the "site-reviews/review/submitted" hook instead.'; |
17 | 17 | do_action( 'site-reviews/local/review/submitted', null, $review ); |
18 | 18 | } |
19 | - if( has_filter( 'site-reviews/local/review/submitted/message' )) { |
|
19 | + if( has_filter( 'site-reviews/local/review/submitted/message' ) ) { |
|
20 | 20 | glsr()->deprecated[] = 'The "site-reviews/local/review/submitted/message" hook has been deprecated.'; |
21 | 21 | } |
22 | 22 | }, 9 ); |
23 | 23 | |
24 | 24 | // Database/ReviewManager.php |
25 | 25 | add_filter( 'site-reviews/create/review-values', function( $values, $command ) { |
26 | - if( has_filter( 'site-reviews/local/review' )) { |
|
26 | + if( has_filter( 'site-reviews/local/review' ) ) { |
|
27 | 27 | glsr()->deprecated[] = 'The "site-reviews/local/review" hook has been deprecated. Please use the "site-reviews/create/review-values" hook instead.'; |
28 | 28 | return apply_filters( 'site-reviews/local/review', $values, $command ); |
29 | 29 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | // Handlers/EnqueuePublicAssets.php |
34 | 34 | add_filter( 'site-reviews/enqueue/public/localize', function( $variables ) { |
35 | - if( has_filter( 'site-reviews/enqueue/localize' )) { |
|
35 | + if( has_filter( 'site-reviews/enqueue/localize' ) ) { |
|
36 | 36 | glsr()->deprecated[] = 'The "site-reviews/enqueue/localize" hook has been deprecated. Please use the "site-reviews/enqueue/public/localize" hook instead.'; |
37 | 37 | return apply_filters( 'site-reviews/enqueue/localize', $variables ); |
38 | 38 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | // Modules/Rating.php |
43 | 43 | add_filter( 'site-reviews/rating/average', function( $average ) { |
44 | - if( has_filter( 'site-reviews/average/rating' )) { |
|
44 | + if( has_filter( 'site-reviews/average/rating' ) ) { |
|
45 | 45 | glsr()->deprecated[] = 'The "site-reviews/average/rating" hook has been deprecated. Please use the "site-reviews/rating/average" hook instead.'; |
46 | 46 | } |
47 | 47 | return $average; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | // Modules/Rating.php |
51 | 51 | add_filter( 'site-reviews/rating/ranking', function( $ranking ) { |
52 | - if( has_filter( 'site-reviews/bayesian/ranking' )) { |
|
52 | + if( has_filter( 'site-reviews/bayesian/ranking' ) ) { |
|
53 | 53 | glsr()->deprecated[] = 'The "site-reviews/bayesian/ranking" hook has been deprecated. Please use the "site-reviews/rating/ranking" hook instead.'; |
54 | 54 | } |
55 | 55 | return $ranking; |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | // Modules/Html/Partials/SiteReviews.php |
59 | 59 | add_filter( 'site-reviews/review/build/after', function( $renderedFields ) { |
60 | - if( has_filter( 'site-reviews/reviews/review/text' )) { |
|
60 | + if( has_filter( 'site-reviews/reviews/review/text' ) ) { |
|
61 | 61 | glsr()->deprecated[] = 'The "site-reviews/reviews/review/text" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.'; |
62 | 62 | } |
63 | - if( has_filter( 'site-reviews/reviews/review/title' )) { |
|
63 | + if( has_filter( 'site-reviews/reviews/review/title' ) ) { |
|
64 | 64 | glsr()->deprecated[] = 'The "site-reviews/reviews/review/title" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.'; |
65 | 65 | } |
66 | 66 | return $renderedFields; |
@@ -68,26 +68,26 @@ discard block |
||
68 | 68 | |
69 | 69 | // Modules/Html/Partials/SiteReviews.php |
70 | 70 | add_filter( 'site-reviews/review/build/before', function( $review ) { |
71 | - if( has_filter( 'site-reviews/rendered/review' )) { |
|
71 | + if( has_filter( 'site-reviews/rendered/review' ) ) { |
|
72 | 72 | glsr()->deprecated[] = 'The "site-reviews/rendered/review" hook has been deprecated. Please either use a custom "review.php" template (refer to the documentation), or use the "site-reviews/review/build/after" hook instead.'; |
73 | 73 | } |
74 | - if( has_filter( 'site-reviews/rendered/review/meta/order' )) { |
|
74 | + if( has_filter( 'site-reviews/rendered/review/meta/order' ) ) { |
|
75 | 75 | glsr()->deprecated[] = 'The "site-reviews/rendered/review/meta/order" hook has been deprecated. Please use a custom "review.php" template instead (refer to the documentation).'; |
76 | 76 | } |
77 | - if( has_filter( 'site-reviews/rendered/review/order' )) { |
|
77 | + if( has_filter( 'site-reviews/rendered/review/order' ) ) { |
|
78 | 78 | glsr()->deprecated[] = 'The "site-reviews/rendered/review/order" hook has been deprecated. Please use a custom "review.php" template instead (refer to the documentation).'; |
79 | 79 | } |
80 | - if( has_filter( 'site-reviews/rendered/review-form/login-register' )) { |
|
80 | + if( has_filter( 'site-reviews/rendered/review-form/login-register' ) ) { |
|
81 | 81 | glsr()->deprecated[] = 'The "site-reviews/rendered/review-form/login-register" hook has been deprecated. Please use a custom "login-register.php" template instead (refer to the documentation).'; |
82 | 82 | } |
83 | - if( has_filter( 'site-reviews/reviews/navigation_links' )) { |
|
83 | + if( has_filter( 'site-reviews/reviews/navigation_links' ) ) { |
|
84 | 84 | glsr()->deprecated[] = 'The "site-reviews/reviews/navigation_links" hook has been deprecated. Please use a custom "pagination.php" template instead (refer to the documentation).'; |
85 | 85 | } |
86 | 86 | return $review; |
87 | 87 | }, 9 ); |
88 | 88 | |
89 | 89 | add_filter( 'site-reviews/validate/custom', function( $result, $request ) { |
90 | - if( has_filter( 'site-reviews/validate/review/submission' )) { |
|
90 | + if( has_filter( 'site-reviews/validate/review/submission' ) ) { |
|
91 | 91 | glsr_log()->notice( 'The "site-reviews/validate/review/submission" hook has been deprecated. Please use the "site-reviews/validate/custom" hook instead.' ); |
92 | 92 | return apply_filters( 'site-reviews/validate/review/submission', $result, $request ); |
93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | }, 9, 2 ); |
96 | 96 | |
97 | 97 | add_filter( 'site-reviews/views/file', function( $file, $view, $data ) { |
98 | - if( has_filter( 'site-reviews/addon/views/file' )) { |
|
98 | + if( has_filter( 'site-reviews/addon/views/file' ) ) { |
|
99 | 99 | glsr()->deprecated[] = 'The "site-reviews/addon/views/file" hook has been deprecated. Please use the "site-reviews/views/file" hook instead.'; |
100 | 100 | $file = apply_filters( 'site-reviews/addon/views/file', $file, $view, $data ); |
101 | 101 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | }, 9, 3 ); |
104 | 104 | |
105 | 105 | add_action( 'wp_footer', function() { |
106 | - $notices = array_keys( array_flip( glsr()->deprecated )); |
|
106 | + $notices = array_keys( array_flip( glsr()->deprecated ) ); |
|
107 | 107 | natsort( $notices ); |
108 | 108 | foreach( $notices as $notice ) { |
109 | 109 | glsr_log()->notice( $notice ); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | <p>{{ data.s1 }}</p> |
8 | 8 | </div> |
9 | 9 | <p class="row-actions"> |
10 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
10 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
11 | 11 | </p> |
12 | 12 | </td> |
13 | 13 | <td class="glsr-string-td2"> |
@@ -8,7 +8,7 @@ |
||
8 | 8 | <p>{{ data.p1 }}</p> |
9 | 9 | </div> |
10 | 10 | <p class="row-actions"> |
11 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
11 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
12 | 12 | </p> |
13 | 13 | </td> |
14 | 14 | <td class="glsr-string-td2"> |