@@ -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, __FUNCTION__ ); |
| 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; |
@@ -92,7 +96,9 @@ discard block |
||
| 92 | 96 | */ |
| 93 | 97 | protected function buildQueryAssignedTo( $value ) |
| 94 | 98 | { |
| 95 | - if( empty( $value ))return; |
|
| 99 | + if( empty( $value )) { |
|
| 100 | + return; |
|
| 101 | + } |
|
| 96 | 102 | return [ |
| 97 | 103 | 'compare' => 'IN', |
| 98 | 104 | 'key' => 'assigned_to', |
@@ -106,7 +112,9 @@ discard block |
||
| 106 | 112 | */ |
| 107 | 113 | protected function buildQueryCategory( $value ) |
| 108 | 114 | { |
| 109 | - if( empty( $value ))return; |
|
| 115 | + if( empty( $value )) { |
|
| 116 | + return; |
|
| 117 | + } |
|
| 110 | 118 | return [ |
| 111 | 119 | 'field' => 'term_id', |
| 112 | 120 | 'taxonomy' => Application::TAXONOMY, |
@@ -120,7 +128,9 @@ discard block |
||
| 120 | 128 | */ |
| 121 | 129 | protected function buildQueryRating( $value ) |
| 122 | 130 | { |
| 123 | - if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return; |
|
| 131 | + if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) { |
|
| 132 | + return; |
|
| 133 | + } |
|
| 124 | 134 | return [ |
| 125 | 135 | 'compare' => '>=', |
| 126 | 136 | 'key' => 'rating', |
@@ -134,7 +144,9 @@ discard block |
||
| 134 | 144 | */ |
| 135 | 145 | protected function buildQueryType( $value ) |
| 136 | 146 | { |
| 137 | - if( in_array( $value, ['','all'] ))return; |
|
| 147 | + if( in_array( $value, ['','all'] )) { |
|
| 148 | + return; |
|
| 149 | + } |
|
| 138 | 150 | return [ |
| 139 | 151 | 'key' => 'review_type', |
| 140 | 152 | 'value' => $value, |
@@ -212,7 +212,9 @@ discard block |
||
| 212 | 212 | $newParents = $parents; |
| 213 | 213 | foreach( $parents as $parent ) { |
| 214 | 214 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 215 | - if( !class_exists( $parentClass ))continue; |
|
| 215 | + if( !class_exists( $parentClass )) { |
|
| 216 | + continue; |
|
| 217 | + } |
|
| 216 | 218 | $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents )); |
| 217 | 219 | } |
| 218 | 220 | return array_values( array_unique( $newParents )); |
@@ -226,7 +228,9 @@ discard block |
||
| 226 | 228 | $parents = $this->getParents(); |
| 227 | 229 | foreach( $parents as $parent ) { |
| 228 | 230 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 229 | - if( !class_exists( $parentClass ))continue; |
|
| 231 | + if( !class_exists( $parentClass )) { |
|
| 232 | + continue; |
|
| 233 | + } |
|
| 230 | 234 | $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ))); |
| 231 | 235 | } |
| 232 | 236 | } |
@@ -33,7 +33,9 @@ discard block |
||
| 33 | 33 | foreach( glsr( Database::class )->getReviews( $this->args )->results as $review ) { |
| 34 | 34 | // Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews. |
| 35 | 35 | // @see https://developers.google.com/search/docs/data-types/review |
| 36 | - if( $review->review_type != 'local' )continue; |
|
| 36 | + if( $review->review_type != 'local' ) { |
|
| 37 | + continue; |
|
| 38 | + } |
|
| 37 | 39 | $reviews[] = $this->buildReview( $review ); |
| 38 | 40 | } |
| 39 | 41 | if( !empty( $reviews )) { |
@@ -78,7 +80,9 @@ discard block |
||
| 78 | 80 | */ |
| 79 | 81 | public function render() |
| 80 | 82 | { |
| 81 | - if( is_null( glsr()->schemas ))return; |
|
| 83 | + if( is_null( glsr()->schemas )) { |
|
| 84 | + return; |
|
| 85 | + } |
|
| 82 | 86 | printf( '<script type="application/ld+json">%s</script>', json_encode( |
| 83 | 87 | apply_filters( 'site-reviews/schema/all', glsr()->schemas ), |
| 84 | 88 | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES |
@@ -129,7 +133,9 @@ discard block |
||
| 129 | 133 | { |
| 130 | 134 | foreach( $values as $value ) { |
| 131 | 135 | $option = $this->getSchemaOptionValue( $value ); |
| 132 | - if( empty( $option ))continue; |
|
| 136 | + if( empty( $option )) { |
|
| 137 | + continue; |
|
| 138 | + } |
|
| 133 | 139 | $schema->$value( $option ); |
| 134 | 140 | } |
| 135 | 141 | return $schema; |
@@ -242,7 +248,9 @@ discard block |
||
| 242 | 248 | if( $value != $fallback ) { |
| 243 | 249 | return $value; |
| 244 | 250 | } |
| 245 | - if( !is_single() && !is_page() )return; |
|
| 251 | + if( !is_single() && !is_page() ) { |
|
| 252 | + return; |
|
| 253 | + } |
|
| 246 | 254 | $method = glsr( Helper::class )->buildMethodName( $option, 'getThing' ); |
| 247 | 255 | if( method_exists( $this, $method )) { |
| 248 | 256 | return $this->$method(); |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | public function routeAdminPostRequest() |
| 17 | 17 | { |
| 18 | 18 | $request = $this->getRequest(); |
| 19 | - if( !$this->isValidPostRequest( $request ))return; |
|
| 19 | + if( !$this->isValidPostRequest( $request )) { |
|
| 20 | + return; |
|
| 21 | + } |
|
| 20 | 22 | $this->checkAdminNonce( $request['action'] ); |
| 21 | 23 | $this->routeRequest( 'admin', $request['action'], $request ); |
| 22 | 24 | } |
@@ -44,10 +46,16 @@ discard block |
||
| 44 | 46 | */ |
| 45 | 47 | public function routePublicPostRequest() |
| 46 | 48 | { |
| 47 | - if( is_admin() )return; |
|
| 49 | + if( is_admin() ) { |
|
| 50 | + return; |
|
| 51 | + } |
|
| 48 | 52 | $request = $this->getRequest(); |
| 49 | - if( !$this->isValidPostRequest( $request ))return; |
|
| 50 | - if( !$this->isValidPublicNonce( $request ))return; |
|
| 53 | + if( !$this->isValidPostRequest( $request )) { |
|
| 54 | + return; |
|
| 55 | + } |
|
| 56 | + if( !$this->isValidPublicNonce( $request )) { |
|
| 57 | + return; |
|
| 58 | + } |
|
| 51 | 59 | $this->routeRequest( 'public', $request['action'], $request ); |
| 52 | 60 | } |
| 53 | 61 | |
@@ -57,7 +65,9 @@ discard block |
||
| 57 | 65 | public function routeWebhookRequest() |
| 58 | 66 | { |
| 59 | 67 | $request = filter_input( INPUT_GET, Application::PREFIX.'hook' ); |
| 60 | - if( !$request )return; |
|
| 68 | + if( !$request ) { |
|
| 69 | + return; |
|
| 70 | + } |
|
| 61 | 71 | // @todo manage webhook here |
| 62 | 72 | } |
| 63 | 73 | |
@@ -80,7 +90,9 @@ discard block |
||
| 80 | 90 | */ |
| 81 | 91 | protected function checkAjaxNonce( array $request ) |
| 82 | 92 | { |
| 83 | - if( !is_user_logged_in() )return; |
|
| 93 | + if( !is_user_logged_in() ) { |
|
| 94 | + return; |
|
| 95 | + } |
|
| 84 | 96 | if( !isset( $request['nonce'] )) { |
| 85 | 97 | glsr_log()->error( 'The AJAX request must include a nonce' )->info( $request ); |
| 86 | 98 | wp_die(); |
@@ -98,7 +110,9 @@ discard block |
||
| 98 | 110 | { |
| 99 | 111 | foreach( ['request', Application::ID] as $key ) { |
| 100 | 112 | $request = glsr( Helper::class )->filterInputArray( $key ); |
| 101 | - if( !empty( $request ))break; |
|
| 113 | + if( !empty( $request )) { |
|
| 114 | + break; |
|
| 115 | + } |
|
| 102 | 116 | } |
| 103 | 117 | return $this->normalizeRequest( $request ); |
| 104 | 118 | } |