@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | 'navigation' => $navigation, |
| 59 | 59 | 'reviews' => $this->buildReviews(), |
| 60 | 60 | ], |
| 61 | - ]); |
|
| 61 | + ] ); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | $reviews = ''; |
| 70 | 70 | foreach( $this->reviews->results as $index => $result ) { |
| 71 | 71 | $this->current = $index; |
| 72 | - $reviews.= glsr( Template::class )->build( 'templates/review', [ |
|
| 72 | + $reviews .= glsr( Template::class )->build( 'templates/review', [ |
|
| 73 | 73 | 'context' => $this->buildReview( $result )->values, |
| 74 | - ]); |
|
| 74 | + ] ); |
|
| 75 | 75 | } |
| 76 | 76 | return $reviews; |
| 77 | 77 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function isHidden( $key, $path = '' ) |
| 85 | 85 | { |
| 86 | - $isOptionEnabled = !empty( $path ) |
|
| 86 | + $isOptionEnabled = !empty($path) |
|
| 87 | 87 | ? $this->isOptionEnabled( $path ) |
| 88 | 88 | : true; |
| 89 | 89 | return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled; |
@@ -117,12 +117,12 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | protected function buildOptionAssignedTo( $key, $value ) |
| 119 | 119 | { |
| 120 | - if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return; |
|
| 120 | + if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) )return; |
|
| 121 | 121 | $post = glsr( Polylang::class )->getPost( $value ); |
| 122 | - if( !( $post instanceof WP_Post ))return; |
|
| 122 | + if( !($post instanceof WP_Post) )return; |
|
| 123 | 123 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
| 124 | 124 | 'href' => get_the_permalink( $post->ID ), |
| 125 | - ]); |
|
| 125 | + ] ); |
|
| 126 | 126 | $assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink ); |
| 127 | 127 | return '<span>'.$assignedTo.'</span>'; |
| 128 | 128 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | protected function buildOptionAuthor( $key, $value ) |
| 136 | 136 | { |
| 137 | - if( $this->isHidden( $key ))return; |
|
| 137 | + if( $this->isHidden( $key ) )return; |
|
| 138 | 138 | return '<span>'.$value.'</span>'; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -145,14 +145,14 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | protected function buildOptionAvatar( $key, $value ) |
| 147 | 147 | { |
| 148 | - if( $this->isHidden( $key, 'settings.reviews.avatars' ))return; |
|
| 148 | + if( $this->isHidden( $key, 'settings.reviews.avatars' ) )return; |
|
| 149 | 149 | $size = $this->getOption( 'settings.reviews.avatars_size', 40 ); |
| 150 | - return glsr( Builder::class )->img([ |
|
| 150 | + return glsr( Builder::class )->img( [ |
|
| 151 | 151 | 'height' => $size, |
| 152 | 152 | 'src' => $this->generateAvatar( $value ), |
| 153 | 153 | 'style' => sprintf( 'width:%1$spx; height:%1$spx;', $size ), |
| 154 | 154 | 'width' => $size, |
| 155 | - ]); |
|
| 155 | + ] ); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | protected function buildOptionContent( $key, $value ) |
| 164 | 164 | { |
| 165 | 165 | $text = $this->normalizeText( $value ); |
| 166 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
| 166 | + if( $this->isHiddenOrEmpty( $key, $text ) )return; |
|
| 167 | 167 | return '<p>'.$text.'</p>'; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | protected function buildOptionDate( $key, $value ) |
| 176 | 176 | { |
| 177 | - if( $this->isHidden( $key ))return; |
|
| 177 | + if( $this->isHidden( $key ) )return; |
|
| 178 | 178 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
| 179 | 179 | if( $dateFormat == 'relative' ) { |
| 180 | 180 | $date = glsr( Date::class )->relative( $value ); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $format = $dateFormat == 'custom' |
| 184 | 184 | ? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' ) |
| 185 | 185 | : (string)get_option( 'date_format' ); |
| 186 | - $date = date_i18n( $format, strtotime( $value )); |
|
| 186 | + $date = date_i18n( $format, strtotime( $value ) ); |
|
| 187 | 187 | } |
| 188 | 188 | return '<span>'.$date.'</span>'; |
| 189 | 189 | } |
@@ -195,10 +195,10 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | protected function buildOptionRating( $key, $value ) |
| 197 | 197 | { |
| 198 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 198 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
| 199 | 199 | return glsr( Partial::class )->build( 'star-rating', [ |
| 200 | 200 | 'rating' => $value, |
| 201 | - ]); |
|
| 201 | + ] ); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | protected function buildOptionResponse( $key, $value ) |
| 210 | 210 | { |
| 211 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 212 | - $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
|
| 211 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
| 212 | + $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) ); |
|
| 213 | 213 | $text = $this->normalizeText( $value ); |
| 214 | 214 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
| 215 | 215 | $response = glsr( Builder::class )->div( $text, ['class' => 'glsr-review-response-inner'] ); |
@@ -224,8 +224,8 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | protected function buildOptionTitle( $key, $value ) |
| 226 | 226 | { |
| 227 | - if( $this->isHidden( $key ))return; |
|
| 228 | - if( empty( $value )) { |
|
| 227 | + if( $this->isHidden( $key ) )return; |
|
| 228 | + if( empty($value) ) { |
|
| 229 | 229 | $value = __( 'No Title', 'site-reviews' ); |
| 230 | 230 | } |
| 231 | 231 | return '<h3>'.$value.'</h3>'; |
@@ -242,10 +242,10 @@ discard block |
||
| 242 | 242 | return $avatarUrl; |
| 243 | 243 | } |
| 244 | 244 | $authorIdOrEmail = get_the_author_meta( 'ID', $review->user_id ); |
| 245 | - if( empty( $authorIdOrEmail )) { |
|
| 245 | + if( empty($authorIdOrEmail) ) { |
|
| 246 | 246 | $authorIdOrEmail = $review->email; |
| 247 | 247 | } |
| 248 | - if( $newAvatar = get_avatar_url( $authorIdOrEmail )) { |
|
| 248 | + if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) { |
|
| 249 | 249 | return $newAvatar; |
| 250 | 250 | } |
| 251 | 251 | return $avatarUrl; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | protected function generateSchema() |
| 258 | 258 | { |
| 259 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
| 259 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
| 260 | 260 | glsr( Schema::class )->store( |
| 261 | 261 | glsr( Schema::class )->build( $this->args ) |
| 262 | 262 | ); |
@@ -279,18 +279,18 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | protected function getExcerpt( $text ) |
| 281 | 281 | { |
| 282 | - $limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 )); |
|
| 282 | + $limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) ); |
|
| 283 | 283 | $split = extension_loaded( 'intl' ) |
| 284 | 284 | ? $this->getExcerptIntlSplit( $text, $limit ) |
| 285 | 285 | : $this->getExcerptSplit( $text, $limit ); |
| 286 | 286 | $hiddenText = substr( $text, $split ); |
| 287 | - if( !empty( $hiddenText )) { |
|
| 287 | + if( !empty($hiddenText) ) { |
|
| 288 | 288 | $showMore = glsr( Builder::class )->span( $hiddenText, [ |
| 289 | 289 | 'class' => 'glsr-hidden glsr-hidden-text', |
| 290 | 290 | 'data-show-less' => __( 'Show less', 'site-reviews' ), |
| 291 | 291 | 'data-show-more' => __( 'Show more', 'site-reviews' ), |
| 292 | - ]); |
|
| 293 | - $text = ltrim( substr( $text, 0, $split )).$showMore; |
|
| 292 | + ] ); |
|
| 293 | + $text = ltrim( substr( $text, 0, $split ) ).$showMore; |
|
| 294 | 294 | } |
| 295 | 295 | return nl2br( $text ); |
| 296 | 296 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $words = IntlRuleBasedBreakIterator::createWordInstance( '' ); |
| 306 | 306 | $words->setText( $text ); |
| 307 | 307 | $count = 0; |
| 308 | - foreach( $words as $offset ){ |
|
| 308 | + foreach( $words as $offset ) { |
|
| 309 | 309 | if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue; |
| 310 | 310 | $count++; |
| 311 | 311 | if( $count != $limit )continue; |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | protected function getExcerptSplit( $text, $limit ) |
| 323 | 323 | { |
| 324 | 324 | if( str_word_count( $text, 0 ) > $limit ) { |
| 325 | - $words = array_keys( str_word_count( $text, 2 )); |
|
| 325 | + $words = array_keys( str_word_count( $text, 2 ) ); |
|
| 326 | 326 | return $words[$limit]; |
| 327 | 327 | } |
| 328 | 328 | return strlen( $text ); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | protected function getOption( $path, $fallback = '' ) |
| 337 | 337 | { |
| 338 | - if( array_key_exists( $path, $this->options )) { |
|
| 338 | + if( array_key_exists( $path, $this->options ) ) { |
|
| 339 | 339 | return $this->options[$path]; |
| 340 | 340 | } |
| 341 | 341 | return $fallback; |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | */ |
| 349 | 349 | protected function isHiddenOrEmpty( $key, $value ) |
| 350 | 350 | { |
| 351 | - return $this->isHidden( $key ) || empty( $value ); |
|
| 351 | + return $this->isHidden( $key ) || empty($value); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | /** |
@@ -367,10 +367,10 @@ discard block |
||
| 367 | 367 | protected function normalizeText( $text ) |
| 368 | 368 | { |
| 369 | 369 | $text = wp_kses( $text, wp_kses_allowed_html() ); |
| 370 | - $text = convert_smilies( strip_shortcodes( $text )); |
|
| 370 | + $text = convert_smilies( strip_shortcodes( $text ) ); |
|
| 371 | 371 | $text = str_replace( ']]>', ']]>', $text ); |
| 372 | 372 | $text = preg_replace( '/(\R){2,}/', '$1', $text ); |
| 373 | - if( $this->isOptionEnabled( 'settings.reviews.excerpts' )) { |
|
| 373 | + if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) { |
|
| 374 | 374 | $text = $this->getExcerpt( $text ); |
| 375 | 375 | } |
| 376 | 376 | return wptexturize( $text ); |
@@ -382,12 +382,12 @@ discard block |
||
| 382 | 382 | protected function wrap( array &$renderedFields, Review $review ) |
| 383 | 383 | { |
| 384 | 384 | $renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review ); |
| 385 | - array_walk( $renderedFields, function( &$value, $key ) use( $review ) { |
|
| 385 | + array_walk( $renderedFields, function( &$value, $key ) use($review) { |
|
| 386 | 386 | $value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review ); |
| 387 | - if( empty( $value ))return; |
|
| 387 | + if( empty($value) )return; |
|
| 388 | 388 | $value = glsr( Builder::class )->div( $value, [ |
| 389 | 389 | 'class' => 'glsr-review-'.$key, |
| 390 | - ]); |
|
| 390 | + ] ); |
|
| 391 | 391 | }); |
| 392 | 392 | } |
| 393 | 393 | } |
@@ -102,7 +102,9 @@ discard block |
||
| 102 | 102 | $field = method_exists( $this, $method ) |
| 103 | 103 | ? $this->$method( $key, $value ) |
| 104 | 104 | : apply_filters( 'site-reviews/review/build/'.$key, false, $value, $this, $review ); |
| 105 | - if( $field === false )continue; |
|
| 105 | + if( $field === false ) { |
|
| 106 | + continue; |
|
| 107 | + } |
|
| 106 | 108 | $renderedFields[$key] = $field; |
| 107 | 109 | } |
| 108 | 110 | $this->wrap( $renderedFields, $review ); |
@@ -117,9 +119,13 @@ discard block |
||
| 117 | 119 | */ |
| 118 | 120 | protected function buildOptionAssignedTo( $key, $value ) |
| 119 | 121 | { |
| 120 | - if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return; |
|
| 122 | + if( $this->isHidden( $key, 'settings.reviews.assigned_links' )) { |
|
| 123 | + return; |
|
| 124 | + } |
|
| 121 | 125 | $post = glsr( Polylang::class )->getPost( $value ); |
| 122 | - if( !( $post instanceof WP_Post ))return; |
|
| 126 | + if( !( $post instanceof WP_Post )) { |
|
| 127 | + return; |
|
| 128 | + } |
|
| 123 | 129 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
| 124 | 130 | 'href' => get_the_permalink( $post->ID ), |
| 125 | 131 | ]); |
@@ -134,7 +140,9 @@ discard block |
||
| 134 | 140 | */ |
| 135 | 141 | protected function buildOptionAuthor( $key, $value ) |
| 136 | 142 | { |
| 137 | - if( $this->isHidden( $key ))return; |
|
| 143 | + if( $this->isHidden( $key )) { |
|
| 144 | + return; |
|
| 145 | + } |
|
| 138 | 146 | return '<span>'.$value.'</span>'; |
| 139 | 147 | } |
| 140 | 148 | |
@@ -145,7 +153,9 @@ discard block |
||
| 145 | 153 | */ |
| 146 | 154 | protected function buildOptionAvatar( $key, $value ) |
| 147 | 155 | { |
| 148 | - if( $this->isHidden( $key, 'settings.reviews.avatars' ))return; |
|
| 156 | + if( $this->isHidden( $key, 'settings.reviews.avatars' )) { |
|
| 157 | + return; |
|
| 158 | + } |
|
| 149 | 159 | $size = $this->getOption( 'settings.reviews.avatars_size', 40 ); |
| 150 | 160 | return glsr( Builder::class )->img([ |
| 151 | 161 | 'height' => $size, |
@@ -163,7 +173,9 @@ discard block |
||
| 163 | 173 | protected function buildOptionContent( $key, $value ) |
| 164 | 174 | { |
| 165 | 175 | $text = $this->normalizeText( $value ); |
| 166 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
| 176 | + if( $this->isHiddenOrEmpty( $key, $text )) { |
|
| 177 | + return; |
|
| 178 | + } |
|
| 167 | 179 | return '<p>'.$text.'</p>'; |
| 168 | 180 | } |
| 169 | 181 | |
@@ -174,7 +186,9 @@ discard block |
||
| 174 | 186 | */ |
| 175 | 187 | protected function buildOptionDate( $key, $value ) |
| 176 | 188 | { |
| 177 | - if( $this->isHidden( $key ))return; |
|
| 189 | + if( $this->isHidden( $key )) { |
|
| 190 | + return; |
|
| 191 | + } |
|
| 178 | 192 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
| 179 | 193 | if( $dateFormat == 'relative' ) { |
| 180 | 194 | $date = glsr( Date::class )->relative( $value ); |
@@ -195,7 +209,9 @@ discard block |
||
| 195 | 209 | */ |
| 196 | 210 | protected function buildOptionRating( $key, $value ) |
| 197 | 211 | { |
| 198 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 212 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
| 213 | + return; |
|
| 214 | + } |
|
| 199 | 215 | return glsr( Partial::class )->build( 'star-rating', [ |
| 200 | 216 | 'rating' => $value, |
| 201 | 217 | ]); |
@@ -208,7 +224,9 @@ discard block |
||
| 208 | 224 | */ |
| 209 | 225 | protected function buildOptionResponse( $key, $value ) |
| 210 | 226 | { |
| 211 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 227 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
| 228 | + return; |
|
| 229 | + } |
|
| 212 | 230 | $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
| 213 | 231 | $text = $this->normalizeText( $value ); |
| 214 | 232 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
@@ -224,7 +242,9 @@ discard block |
||
| 224 | 242 | */ |
| 225 | 243 | protected function buildOptionTitle( $key, $value ) |
| 226 | 244 | { |
| 227 | - if( $this->isHidden( $key ))return; |
|
| 245 | + if( $this->isHidden( $key )) { |
|
| 246 | + return; |
|
| 247 | + } |
|
| 228 | 248 | if( empty( $value )) { |
| 229 | 249 | $value = __( 'No Title', 'site-reviews' ); |
| 230 | 250 | } |
@@ -256,7 +276,9 @@ discard block |
||
| 256 | 276 | */ |
| 257 | 277 | protected function generateSchema() |
| 258 | 278 | { |
| 259 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
| 279 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
| 280 | + return; |
|
| 281 | + } |
|
| 260 | 282 | glsr( Schema::class )->store( |
| 261 | 283 | glsr( Schema::class )->build( $this->args ) |
| 262 | 284 | ); |
@@ -306,9 +328,13 @@ discard block |
||
| 306 | 328 | $words->setText( $text ); |
| 307 | 329 | $count = 0; |
| 308 | 330 | foreach( $words as $offset ){ |
| 309 | - if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue; |
|
| 331 | + if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE ) { |
|
| 332 | + continue; |
|
| 333 | + } |
|
| 310 | 334 | $count++; |
| 311 | - if( $count != $limit )continue; |
|
| 335 | + if( $count != $limit ) { |
|
| 336 | + continue; |
|
| 337 | + } |
|
| 312 | 338 | return $offset; |
| 313 | 339 | } |
| 314 | 340 | return strlen( $text ); |
@@ -384,7 +410,9 @@ discard block |
||
| 384 | 410 | $renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review ); |
| 385 | 411 | array_walk( $renderedFields, function( &$value, $key ) use( $review ) { |
| 386 | 412 | $value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review ); |
| 387 | - if( empty( $value ))return; |
|
| 413 | + if( empty( $value )) { |
|
| 414 | + return; |
|
| 415 | + } |
|
| 388 | 416 | $value = glsr( Builder::class )->div( $value, [ |
| 389 | 417 | 'class' => 'glsr-review-'.$key, |
| 390 | 418 | ]); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | public function __construct() |
| 34 | 34 | { |
| 35 | 35 | static::$instance = $this; |
| 36 | - $this->file = realpath( trailingslashit( dirname( __DIR__ )).static::ID.'.php' ); |
|
| 36 | + $this->file = realpath( trailingslashit( dirname( __DIR__ ) ).static::ID.'.php' ); |
|
| 37 | 37 | $plugin = get_file_data( $this->file, [ |
| 38 | 38 | 'languages' => 'Domain Path', |
| 39 | 39 | 'name' => 'Plugin Name', |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $constant = 'static::'.$property; |
| 87 | 87 | return defined( $constant ) |
| 88 | - ? apply_filters( 'site-reviews/const/'.$property, constant( $constant )) |
|
| 88 | + ? apply_filters( 'site-reviews/const/'.$property, constant( $constant ) ) |
|
| 89 | 89 | : ''; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -103,15 +103,15 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function file( $view ) |
| 105 | 105 | { |
| 106 | - $view.= '.php'; |
|
| 106 | + $view .= '.php'; |
|
| 107 | 107 | $filePaths = []; |
| 108 | - if( glsr( Helper::class )->startsWith( 'templates/', $view )) { |
|
| 109 | - $filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view )); |
|
| 108 | + if( glsr( Helper::class )->startsWith( 'templates/', $view ) ) { |
|
| 109 | + $filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ) ); |
|
| 110 | 110 | } |
| 111 | 111 | $filePaths[] = $this->path( $view ); |
| 112 | 112 | $filePaths[] = $this->path( 'views/'.$view ); |
| 113 | 113 | foreach( $filePaths as $file ) { |
| 114 | - if( !file_exists( $file ))continue; |
|
| 114 | + if( !file_exists( $file ) )continue; |
|
| 115 | 115 | return $file; |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function getDefaults() |
| 123 | 123 | { |
| 124 | - if( empty( $this->defaults )) { |
|
| 124 | + if( empty($this->defaults) ) { |
|
| 125 | 125 | $this->defaults = $this->make( DefaultsManager::class )->get(); |
| 126 | 126 | $this->upgrade(); |
| 127 | 127 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function hasPermission() |
| 135 | 135 | { |
| 136 | 136 | $isAdmin = $this->isAdmin(); |
| 137 | - return !$isAdmin || ( $isAdmin && current_user_can( $this->constant( 'CAPABILITY' ))); |
|
| 137 | + return !$isAdmin || ($isAdmin && current_user_can( $this->constant( 'CAPABILITY' ) )); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $types = apply_filters( 'site-reviews/addon/types', [] ); |
| 191 | 191 | $this->reviewTypes = wp_parse_args( $types, [ |
| 192 | 192 | 'local' => __( 'Local', 'site-reviews' ), |
| 193 | - ]); |
|
| 193 | + ] ); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | $view = apply_filters( 'site-reviews/render/view', $view, $data ); |
| 203 | 203 | $file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data ); |
| 204 | - if( !file_exists( $file )) { |
|
| 204 | + if( !file_exists( $file ) ) { |
|
| 205 | 205 | glsr_log()->error( 'File not found: '.$file ); |
| 206 | 206 | return; |
| 207 | 207 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function scheduleCronJob() |
| 217 | 217 | { |
| 218 | - if( wp_next_scheduled( static::CRON_EVENT ))return; |
|
| 218 | + if( wp_next_scheduled( static::CRON_EVENT ) )return; |
|
| 219 | 219 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public function unscheduleCronJob() |
| 235 | 235 | { |
| 236 | - wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT ); |
|
| 236 | + wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT ); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function url( $path = '' ) |
| 267 | 267 | { |
| 268 | - $url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' )); |
|
| 268 | + $url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) ); |
|
| 269 | 269 | return apply_filters( 'site-reviews/url', $url, $path ); |
| 270 | 270 | } |
| 271 | 271 | } |
@@ -60,7 +60,9 @@ discard block |
||
| 60 | 60 | public function catchFatalError() |
| 61 | 61 | { |
| 62 | 62 | $error = error_get_last(); |
| 63 | - if( $error['type'] !== E_ERROR || strpos( $error['message'], $this->path() ) === false )return; |
|
| 63 | + if( $error['type'] !== E_ERROR || strpos( $error['message'], $this->path() ) === false ) { |
|
| 64 | + return; |
|
| 65 | + } |
|
| 64 | 66 | glsr_log()->error( $error['message'] ); |
| 65 | 67 | } |
| 66 | 68 | |
@@ -111,7 +113,9 @@ discard block |
||
| 111 | 113 | $filePaths[] = $this->path( $view ); |
| 112 | 114 | $filePaths[] = $this->path( 'views/'.$view ); |
| 113 | 115 | foreach( $filePaths as $file ) { |
| 114 | - if( !file_exists( $file ))continue; |
|
| 116 | + if( !file_exists( $file )) { |
|
| 117 | + continue; |
|
| 118 | + } |
|
| 115 | 119 | return $file; |
| 116 | 120 | } |
| 117 | 121 | } |
@@ -215,7 +219,9 @@ discard block |
||
| 215 | 219 | */ |
| 216 | 220 | public function scheduleCronJob() |
| 217 | 221 | { |
| 218 | - if( wp_next_scheduled( static::CRON_EVENT ))return; |
|
| 222 | + if( wp_next_scheduled( static::CRON_EVENT )) { |
|
| 223 | + return; |
|
| 224 | + } |
|
| 219 | 225 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
| 220 | 226 | } |
| 221 | 227 | |
@@ -255,7 +261,9 @@ discard block |
||
| 255 | 261 | || !in_array( plugin_basename( $this->file ), $data['plugins'] ) |
| 256 | 262 | || $data['action'] != 'update' |
| 257 | 263 | || $data['type'] != 'plugin' |
| 258 | - )return; |
|
| 264 | + ) { |
|
| 265 | + return; |
|
| 266 | + } |
|
| 259 | 267 | $this->upgrade(); |
| 260 | 268 | } |
| 261 | 269 | |