@@ -190,7 +190,9 @@ |
||
| 190 | 190 | if( $index === false |
| 191 | 191 | || !isset( $caller[$index+2]['class'] ) |
| 192 | 192 | || !isset( $caller[$index+2]['function'] ) |
| 193 | - )return; |
|
| 193 | + ) { |
|
| 194 | + return; |
|
| 195 | + } |
|
| 194 | 196 | return sprintf( '[%s()->%s:%s] ', |
| 195 | 197 | $caller[$index+2]['class'], |
| 196 | 198 | $caller[$index+2]['function'], |
@@ -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, |
@@ -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 | } |
@@ -51,9 +53,13 @@ discard block |
||
| 51 | 53 | */ |
| 52 | 54 | public function routePublicPostRequest() |
| 53 | 55 | { |
| 54 | - if( is_admin() )return; |
|
| 56 | + if( is_admin() ) { |
|
| 57 | + return; |
|
| 58 | + } |
|
| 55 | 59 | $request = $this->getRequest(); |
| 56 | - if( !$this->isValidPostRequest( $request ))return; |
|
| 60 | + if( !$this->isValidPostRequest( $request )) { |
|
| 61 | + return; |
|
| 62 | + } |
|
| 57 | 63 | if( !wp_verify_nonce( $request['_wpnonce'], $request['action'] )) { |
| 58 | 64 | glsr_log()->error( 'Nonce check failed for public request' )->info( $request ); |
| 59 | 65 | return; |
@@ -67,7 +73,9 @@ discard block |
||
| 67 | 73 | public function routeWebhookRequest() |
| 68 | 74 | { |
| 69 | 75 | $request = filter_input( INPUT_GET, Application::PREFIX.'hook' ); |
| 70 | - if( !$request )return; |
|
| 76 | + if( !$request ) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 71 | 79 | // @todo manage webhook here |
| 72 | 80 | } |
| 73 | 81 | |
@@ -92,7 +100,9 @@ discard block |
||
| 92 | 100 | { |
| 93 | 101 | foreach( ['request', Application::ID] as $key ) { |
| 94 | 102 | $request = glsr( Helper::class )->filterInputArray( $key ); |
| 95 | - if( !empty( $request ))break; |
|
| 103 | + if( !empty( $request )) { |
|
| 104 | + break; |
|
| 105 | + } |
|
| 96 | 106 | } |
| 97 | 107 | return $this->normalizeRequest( $request ); |
| 98 | 108 | } |
@@ -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 | } |
@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | foreach( glsr( Database::class )->getReviews( $this->args )->results as $review ) { |
| 35 | 35 | // Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews. |
| 36 | 36 | // @see https://developers.google.com/search/docs/data-types/review |
| 37 | - if( $review->review_type != 'local' )continue; |
|
| 37 | + if( $review->review_type != 'local' ) { |
|
| 38 | + continue; |
|
| 39 | + } |
|
| 38 | 40 | $reviews[] = $this->buildReview( $review ); |
| 39 | 41 | } |
| 40 | 42 | if( !empty( $reviews )) { |
@@ -79,7 +81,9 @@ discard block |
||
| 79 | 81 | */ |
| 80 | 82 | public function render() |
| 81 | 83 | { |
| 82 | - if( is_null( glsr()->schemas ))return; |
|
| 84 | + if( is_null( glsr()->schemas )) { |
|
| 85 | + return; |
|
| 86 | + } |
|
| 83 | 87 | printf( '<script type="application/ld+json">%s</script>', json_encode( |
| 84 | 88 | apply_filters( 'site-reviews/schema/all', glsr()->schemas ), |
| 85 | 89 | 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; |
@@ -243,7 +249,9 @@ discard block |
||
| 243 | 249 | if( $value != $fallback ) { |
| 244 | 250 | return $value; |
| 245 | 251 | } |
| 246 | - if( !is_single() && !is_page() )return; |
|
| 252 | + if( !is_single() && !is_page() ) { |
|
| 253 | + return; |
|
| 254 | + } |
|
| 247 | 255 | // @todo make this dynamic |
| 248 | 256 | switch( $option ) { |
| 249 | 257 | case 'description': |