@@ -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 | check_admin_referer( $request['action'] ); |
| 21 | 23 | $this->routeRequest( 'admin', $request['action'], $request ); |
| 22 | 24 | } |
@@ -38,10 +40,16 @@ discard block |
||
| 38 | 40 | */ |
| 39 | 41 | public function routePublicPostRequest() |
| 40 | 42 | { |
| 41 | - if( is_admin() )return; |
|
| 43 | + if( is_admin() ) { |
|
| 44 | + return; |
|
| 45 | + } |
|
| 42 | 46 | $request = $this->getRequest(); |
| 43 | - if( !$this->isValidPostRequest( $request ))return; |
|
| 44 | - if( !$this->isValidPublicNonce( $request ))return; |
|
| 47 | + if( !$this->isValidPostRequest( $request )) { |
|
| 48 | + return; |
|
| 49 | + } |
|
| 50 | + if( !$this->isValidPublicNonce( $request )) { |
|
| 51 | + return; |
|
| 52 | + } |
|
| 45 | 53 | $this->routeRequest( 'public', $request['action'], $request ); |
| 46 | 54 | } |
| 47 | 55 | |
@@ -50,7 +58,9 @@ discard block |
||
| 50 | 58 | */ |
| 51 | 59 | protected function checkAjaxNonce( array $request ) |
| 52 | 60 | { |
| 53 | - if( !is_user_logged_in() )return; |
|
| 61 | + if( !is_user_logged_in() ) { |
|
| 62 | + return; |
|
| 63 | + } |
|
| 54 | 64 | if( !isset( $request['nonce'] )) { |
| 55 | 65 | $this->sendAjaxError( 'The request is missing a nonce', $request ); |
| 56 | 66 | } |
@@ -83,7 +83,9 @@ discard block |
||
| 83 | 83 | $reviewValues = []; |
| 84 | 84 | foreach( $review as $key => $value ) { |
| 85 | 85 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' ); |
| 86 | - if( !method_exists( $this, $method ))continue; |
|
| 86 | + if( !method_exists( $this, $method )) { |
|
| 87 | + continue; |
|
| 88 | + } |
|
| 87 | 89 | $reviewValues[$key] = $this->$method( $key, $value ); |
| 88 | 90 | } |
| 89 | 91 | $reviewValues = apply_filters( 'site-reviews/review/build/after', $reviewValues ); |
@@ -97,9 +99,13 @@ discard block |
||
| 97 | 99 | */ |
| 98 | 100 | protected function buildOptionAssignedTo( $key, $value ) |
| 99 | 101 | { |
| 100 | - if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ))return; |
|
| 102 | + if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' )) { |
|
| 103 | + return; |
|
| 104 | + } |
|
| 101 | 105 | $post = get_post( intval( $value )); |
| 102 | - if( !( $post instanceof WP_Post ))return; |
|
| 106 | + if( !( $post instanceof WP_Post )) { |
|
| 107 | + return; |
|
| 108 | + } |
|
| 103 | 109 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
| 104 | 110 | 'href' => get_the_permalink( $post->ID ), |
| 105 | 111 | ]); |
@@ -114,7 +120,9 @@ discard block |
||
| 114 | 120 | */ |
| 115 | 121 | protected function buildOptionAuthor( $key, $value ) |
| 116 | 122 | { |
| 117 | - if( $this->isHidden( $key ))return; |
|
| 123 | + if( $this->isHidden( $key )) { |
|
| 124 | + return; |
|
| 125 | + } |
|
| 118 | 126 | $prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' ) |
| 119 | 127 | ? apply_filters( 'site-reviews/review/author/prefix', '—' ) |
| 120 | 128 | : ''; |
@@ -128,7 +136,9 @@ discard block |
||
| 128 | 136 | */ |
| 129 | 137 | protected function buildOptionAvatar( $key, $value ) |
| 130 | 138 | { |
| 131 | - if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return; |
|
| 139 | + if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' )) { |
|
| 140 | + return; |
|
| 141 | + } |
|
| 132 | 142 | $size = $this->getOption( 'settings.reviews.avatars.size', 40 ); |
| 133 | 143 | return $this->wrap( $key, glsr( Builder::class )->img([ |
| 134 | 144 | 'src' => $this->generateAvatar( $value ), |
@@ -145,7 +155,9 @@ discard block |
||
| 145 | 155 | protected function buildOptionContent( $key, $value ) |
| 146 | 156 | { |
| 147 | 157 | $text = $this->normalizeText( $value ); |
| 148 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
| 158 | + if( $this->isHiddenOrEmpty( $key, $text )) { |
|
| 159 | + return; |
|
| 160 | + } |
|
| 149 | 161 | return $this->wrap( $key, '<p>'.$text.'</p>' ); |
| 150 | 162 | } |
| 151 | 163 | |
@@ -156,7 +168,9 @@ discard block |
||
| 156 | 168 | */ |
| 157 | 169 | protected function buildOptionDate( $key, $value ) |
| 158 | 170 | { |
| 159 | - if( $this->isHidden( $key ))return; |
|
| 171 | + if( $this->isHidden( $key )) { |
|
| 172 | + return; |
|
| 173 | + } |
|
| 160 | 174 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
| 161 | 175 | if( $dateFormat == 'relative' ) { |
| 162 | 176 | $date = glsr( Date::class )->relative( $value ); |
@@ -177,7 +191,9 @@ discard block |
||
| 177 | 191 | */ |
| 178 | 192 | protected function buildOptionRating( $key, $value ) |
| 179 | 193 | { |
| 180 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 194 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
| 195 | + return; |
|
| 196 | + } |
|
| 181 | 197 | $rating = glsr( Html::class )->buildPartial( 'star-rating', [ |
| 182 | 198 | 'rating' => $value, |
| 183 | 199 | ]); |
@@ -191,7 +207,9 @@ discard block |
||
| 191 | 207 | */ |
| 192 | 208 | protected function buildOptionResponse( $key, $value ) |
| 193 | 209 | { |
| 194 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 210 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
| 211 | + return; |
|
| 212 | + } |
|
| 195 | 213 | $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
| 196 | 214 | $text = $this->normalizeText( $value ); |
| 197 | 215 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
@@ -208,7 +226,9 @@ discard block |
||
| 208 | 226 | */ |
| 209 | 227 | protected function buildOptionTitle( $key, $value ) |
| 210 | 228 | { |
| 211 | - if( $this->isHidden( $key ))return; |
|
| 229 | + if( $this->isHidden( $key )) { |
|
| 230 | + return; |
|
| 231 | + } |
|
| 212 | 232 | if( empty( $value )) { |
| 213 | 233 | $value = __( 'No Title', 'site-reviews' ); |
| 214 | 234 | } |
@@ -238,7 +258,9 @@ discard block |
||
| 238 | 258 | */ |
| 239 | 259 | protected function generateSchema() |
| 240 | 260 | { |
| 241 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
| 261 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
| 262 | + return; |
|
| 263 | + } |
|
| 242 | 264 | glsr( Schema::class )->store( |
| 243 | 265 | glsr( Schema::class )->build( $this->args ) |
| 244 | 266 | ); |
@@ -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 ); |
@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | foreach( glsr( ReviewManager::class )->get( $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 |
@@ -131,7 +135,9 @@ discard block |
||
| 131 | 135 | { |
| 132 | 136 | foreach( $values as $value ) { |
| 133 | 137 | $option = $this->getSchemaOptionValue( $value ); |
| 134 | - if( empty( $option ))continue; |
|
| 138 | + if( empty( $option )) { |
|
| 139 | + continue; |
|
| 140 | + } |
|
| 135 | 141 | $schema->$value( $option ); |
| 136 | 142 | } |
| 137 | 143 | return $schema; |
@@ -237,7 +243,9 @@ discard block |
||
| 237 | 243 | if( $value != $fallback ) { |
| 238 | 244 | return $value; |
| 239 | 245 | } |
| 240 | - if( !is_single() && !is_page() )return; |
|
| 246 | + if( !is_single() && !is_page() ) { |
|
| 247 | + return; |
|
| 248 | + } |
|
| 241 | 249 | $method = glsr( Helper::class )->buildMethodName( $option, 'getThing' ); |
| 242 | 250 | if( method_exists( $this, $method )) { |
| 243 | 251 | return $this->$method(); |
@@ -54,7 +54,9 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
| 56 | 56 | foreach( $postTypeColumns as $key => &$value ) { |
| 57 | - if( !array_key_exists( $key, $columns ) || !empty( $value ))continue; |
|
| 57 | + if( !array_key_exists( $key, $columns ) || !empty( $value )) { |
|
| 58 | + continue; |
|
| 59 | + } |
|
| 58 | 60 | $value = $columns[$key]; |
| 59 | 61 | } |
| 60 | 62 | if( count( glsr( Database::class )->getReviewsMeta( 'review_type' )) < 2 ) { |
@@ -92,7 +94,8 @@ discard block |
||
| 92 | 94 | * @return array |
| 93 | 95 | * @filter display_post_states |
| 94 | 96 | */ |
| 95 | - public function filterPostStates( array $postStates, WP_Post $post ) { |
|
| 97 | + public function filterPostStates( array $postStates, WP_Post $post ) |
|
| 98 | + { |
|
| 96 | 99 | if( $post->post_type == Application::POST_TYPE |
| 97 | 100 | && array_key_exists( 'pending', $postStates )) { |
| 98 | 101 | $postStates['pending'] = __( 'Unapproved', 'site-reviews' ); |
@@ -137,7 +140,9 @@ discard block |
||
| 137 | 140 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
| 138 | 141 | unset( $postTypeColumns['cb'] ); |
| 139 | 142 | foreach( $postTypeColumns as $key => $value ) { |
| 140 | - if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue; |
|
| 143 | + if( glsr( Helper::class )->startsWith( 'taxonomy', $key )) { |
|
| 144 | + continue; |
|
| 145 | + } |
|
| 141 | 146 | $columns[$key] = $key; |
| 142 | 147 | } |
| 143 | 148 | return $columns; |
@@ -161,7 +166,9 @@ discard block |
||
| 161 | 166 | 'Pending' => __( 'Unapproved', 'site-reviews' ), |
| 162 | 167 | ]; |
| 163 | 168 | foreach( $strings as $search => $replace ) { |
| 164 | - if( strpos( $single, $search ) === false )continue; |
|
| 169 | + if( strpos( $single, $search ) === false ) { |
|
| 170 | + continue; |
|
| 171 | + } |
|
| 165 | 172 | $translation = $this->getTranslation([ |
| 166 | 173 | 'number' => $number, |
| 167 | 174 | 'plural' => str_replace( $search, $replace, $plural ), |
@@ -213,7 +220,9 @@ discard block |
||
| 213 | 220 | */ |
| 214 | 221 | public function saveBulkEditFields( $postId ) |
| 215 | 222 | { |
| 216 | - if( !current_user_can( 'edit_posts' ))return; |
|
| 223 | + if( !current_user_can( 'edit_posts' )) { |
|
| 224 | + return; |
|
| 225 | + } |
|
| 217 | 226 | $assignedTo = filter_input( INPUT_GET, 'assigned_to' ); |
| 218 | 227 | if( $assignedTo && get_post( $assignedTo )) { |
| 219 | 228 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
@@ -226,7 +235,9 @@ discard block |
||
| 226 | 235 | */ |
| 227 | 236 | public function setQueryForColumn( WP_Query $query ) |
| 228 | 237 | { |
| 229 | - if( !$this->hasPermission( $query ))return; |
|
| 238 | + if( !$this->hasPermission( $query )) { |
|
| 239 | + return; |
|
| 240 | + } |
|
| 230 | 241 | $this->setMetaQuery( $query, [ |
| 231 | 242 | 'rating', 'review_type', |
| 232 | 243 | ]); |
@@ -298,7 +309,9 @@ discard block |
||
| 298 | 309 | protected function setMetaQuery( WP_Query $query, array $metaKeys ) |
| 299 | 310 | { |
| 300 | 311 | foreach( $metaKeys as $key ) { |
| 301 | - if( !( $value = filter_input( INPUT_GET, $key )))continue; |
|
| 312 | + if( !( $value = filter_input( INPUT_GET, $key ))) { |
|
| 313 | + continue; |
|
| 314 | + } |
|
| 302 | 315 | $metaQuery = (array)$query->get( 'meta_query' ); |
| 303 | 316 | $metaQuery[] = [ |
| 304 | 317 | 'key' => $key, |
@@ -4,7 +4,8 @@ discard block |
||
| 4 | 4 | /** |
| 5 | 5 | * @return mixed |
| 6 | 6 | */ |
| 7 | -function glsr( $alias = null ) { |
|
| 7 | +function glsr( $alias = null ) |
|
| 8 | +{ |
|
| 8 | 9 | $app = \GeminiLabs\SiteReviews\Application::load(); |
| 9 | 10 | return !empty( $alias ) |
| 10 | 11 | ? $app->make( $alias ) |
@@ -14,7 +15,8 @@ discard block |
||
| 14 | 15 | /** |
| 15 | 16 | * @return \WP_Screen|object |
| 16 | 17 | */ |
| 17 | -function glsr_current_screen() { |
|
| 18 | +function glsr_current_screen() |
|
| 19 | +{ |
|
| 18 | 20 | if( function_exists( 'get_current_screen' )) { |
| 19 | 21 | $screen = get_current_screen(); |
| 20 | 22 | } |
@@ -26,7 +28,8 @@ discard block |
||
| 26 | 28 | /** |
| 27 | 29 | * @return \GeminiLabs\SiteReviews\Database |
| 28 | 30 | */ |
| 29 | -function glsr_db() { |
|
| 31 | +function glsr_db() |
|
| 32 | +{ |
|
| 30 | 33 | return glsr( 'Database' ); |
| 31 | 34 | } |
| 32 | 35 | |
@@ -34,7 +37,8 @@ discard block |
||
| 34 | 37 | * @param mixed ...$vars |
| 35 | 38 | * @return void |
| 36 | 39 | */ |
| 37 | -function glsr_debug( ...$vars ) { |
|
| 40 | +function glsr_debug( ...$vars ) |
|
| 41 | +{ |
|
| 38 | 42 | if( count( $vars ) == 1 ) { |
| 39 | 43 | $value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' ); |
| 40 | 44 | printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value ); |
@@ -51,7 +55,8 @@ discard block |
||
| 51 | 55 | /** |
| 52 | 56 | * @return \GeminiLabs\SiteReviews\Modules\Console |
| 53 | 57 | */ |
| 54 | -function glsr_log() { |
|
| 58 | +function glsr_log() |
|
| 59 | +{ |
|
| 55 | 60 | $args = func_get_args(); |
| 56 | 61 | $context = isset( $args[1] ) |
| 57 | 62 | ? $args[1] |
@@ -67,14 +72,16 @@ discard block |
||
| 67 | 72 | * @param mixed $fallback |
| 68 | 73 | * @return string|array |
| 69 | 74 | */ |
| 70 | -function glsr_get_option( $path = '', $fallback = '' ) { |
|
| 75 | +function glsr_get_option( $path = '', $fallback = '' ) |
|
| 76 | +{ |
|
| 71 | 77 | return glsr( 'Database\OptionManager' )->get( 'settings.'.$path, $fallback ); |
| 72 | 78 | } |
| 73 | 79 | |
| 74 | 80 | /** |
| 75 | 81 | * @return array |
| 76 | 82 | */ |
| 77 | -function glsr_get_options() { |
|
| 83 | +function glsr_get_options() |
|
| 84 | +{ |
|
| 78 | 85 | return glsr( 'Database\OptionManager' )->get( 'settings' ); |
| 79 | 86 | } |
| 80 | 87 | |
@@ -82,7 +89,8 @@ discard block |
||
| 82 | 89 | * @param int $post_id |
| 83 | 90 | * @return void|\GeminiLabs\SiteReviews\Review |
| 84 | 91 | */ |
| 85 | -function glsr_get_review( $post_id ) { |
|
| 92 | +function glsr_get_review( $post_id ) |
|
| 93 | +{ |
|
| 86 | 94 | $post = get_post( $post_id ); |
| 87 | 95 | if( $post instanceof WP_Post ) { |
| 88 | 96 | return glsr( 'Database\ReviewManager' )->single( $post ); |
@@ -93,6 +101,7 @@ discard block |
||
| 93 | 101 | * @return array |
| 94 | 102 | * @todo document change of $reviews->reviews to $reviews->results |
| 95 | 103 | */ |
| 96 | -function glsr_get_reviews( array $args = array() ) { |
|
| 104 | +function glsr_get_reviews( array $args = array() ) |
|
| 105 | +{ |
|
| 97 | 106 | return glsr( 'Database\ReviewManager' )->get( $args ); |
| 98 | 107 | } |
@@ -90,7 +90,9 @@ |
||
| 90 | 90 | { |
| 91 | 91 | $total = array_sum( $ratingCounts ); |
| 92 | 92 | foreach( $ratingCounts as $index => $count ) { |
| 93 | - if( empty( $count ))continue; |
|
| 93 | + if( empty( $count )) { |
|
| 94 | + continue; |
|
| 95 | + } |
|
| 94 | 96 | $ratingCounts[$index] = $count / $total * 100; |
| 95 | 97 | } |
| 96 | 98 | return $this->getRoundedPercentages( $ratingCounts ); |
@@ -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; |
@@ -35,7 +39,9 @@ discard block |
||
| 35 | 39 | $string = ''; |
| 36 | 40 | $values = array_filter( $values ); |
| 37 | 41 | foreach( $conditions as $key => $value ) { |
| 38 | - if( !isset( $values[$key] ))continue; |
|
| 42 | + if( !isset( $values[$key] )) { |
|
| 43 | + continue; |
|
| 44 | + } |
|
| 39 | 45 | $values[$key] = implode( ',', (array)$values[$key] ); |
| 40 | 46 | $string .= strpos( $value, '%s' ) !== false |
| 41 | 47 | ? sprintf( $value, strval( $values[$key] )) |
@@ -109,7 +115,9 @@ discard block |
||
| 109 | 115 | */ |
| 110 | 116 | protected function buildQueryAssignedTo( $value ) |
| 111 | 117 | { |
| 112 | - if( empty( $value ))return; |
|
| 118 | + if( empty( $value )) { |
|
| 119 | + return; |
|
| 120 | + } |
|
| 113 | 121 | return [ |
| 114 | 122 | 'compare' => 'IN', |
| 115 | 123 | 'key' => 'assigned_to', |
@@ -123,7 +131,9 @@ discard block |
||
| 123 | 131 | */ |
| 124 | 132 | protected function buildQueryCategory( $value ) |
| 125 | 133 | { |
| 126 | - if( empty( $value ))return; |
|
| 134 | + if( empty( $value )) { |
|
| 135 | + return; |
|
| 136 | + } |
|
| 127 | 137 | return [ |
| 128 | 138 | 'field' => 'term_id', |
| 129 | 139 | 'taxonomy' => Application::TAXONOMY, |
@@ -137,7 +147,9 @@ discard block |
||
| 137 | 147 | */ |
| 138 | 148 | protected function buildQueryRating( $value ) |
| 139 | 149 | { |
| 140 | - if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return; |
|
| 150 | + if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) { |
|
| 151 | + return; |
|
| 152 | + } |
|
| 141 | 153 | return [ |
| 142 | 154 | 'compare' => '>=', |
| 143 | 155 | 'key' => 'rating', |
@@ -151,7 +163,9 @@ discard block |
||
| 151 | 163 | */ |
| 152 | 164 | protected function buildQueryType( $value ) |
| 153 | 165 | { |
| 154 | - if( in_array( $value, ['','all'] ))return; |
|
| 166 | + if( in_array( $value, ['','all'] )) { |
|
| 167 | + return; |
|
| 168 | + } |
|
| 155 | 169 | return [ |
| 156 | 170 | 'key' => 'review_type', |
| 157 | 171 | 'value' => $value, |
@@ -23,7 +23,9 @@ discard block |
||
| 23 | 23 | if( empty( $assignedTo )) { |
| 24 | 24 | $assignedTo = get_post_meta( $postId, 'assigned_to', true ); |
| 25 | 25 | } |
| 26 | - if( empty( $assignedTo ))return; |
|
| 26 | + if( empty( $assignedTo )) { |
|
| 27 | + return; |
|
| 28 | + } |
|
| 27 | 29 | $assignedPost = get_post( $assignedTo ); |
| 28 | 30 | if( $assignedPost instanceof WP_Post && $assignedPost->ID != $postId ) { |
| 29 | 31 | return $assignedPost; |
@@ -112,7 +114,9 @@ discard block |
||
| 112 | 114 | add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 ); |
| 113 | 115 | $search = new WP_Query( $args ); |
| 114 | 116 | remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 ); |
| 115 | - if( !$search->have_posts() )return; |
|
| 117 | + if( !$search->have_posts() ) { |
|
| 118 | + return; |
|
| 119 | + } |
|
| 116 | 120 | $results = ''; |
| 117 | 121 | while( $search->have_posts() ) { |
| 118 | 122 | $search->the_post(); |
@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | $this->sendNotification( $postId ); |
| 35 | 35 | do_action( 'site-reviews/local/review/submitted', $postId, $command ); |
| 36 | 36 | glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
| 37 | - if( $command->ajax_request )return; |
|
| 37 | + if( $command->ajax_request ) { |
|
| 38 | + return; |
|
| 39 | + } |
|
| 38 | 40 | wp_safe_redirect( $command->referrer ); |
| 39 | 41 | exit; |
| 40 | 42 | } |
@@ -100,7 +102,9 @@ discard block |
||
| 100 | 102 | protected function sendNotification( $postId ) |
| 101 | 103 | { |
| 102 | 104 | $notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' ); |
| 103 | - if( !in_array( $notificationType, ['default','custom','webhook'] ))return; |
|
| 105 | + if( !in_array( $notificationType, ['default','custom','webhook'] )) { |
|
| 106 | + return; |
|
| 107 | + } |
|
| 104 | 108 | $assignedToTitle = get_the_title( (int)$this->command->assigned_to ); |
| 105 | 109 | $notificationSubject = _nx( |
| 106 | 110 | 'New %s-star review', |
@@ -148,7 +152,9 @@ discard block |
||
| 148 | 152 | */ |
| 149 | 153 | protected function sendWebhookNotification( array $args ) |
| 150 | 154 | { |
| 151 | - if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )))return; |
|
| 155 | + if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' ))) { |
|
| 156 | + return; |
|
| 157 | + } |
|
| 152 | 158 | $notification = $this->createWebhookNotification( $args ); |
| 153 | 159 | $result = wp_remote_post( $endpoint, [ |
| 154 | 160 | 'blocking' => false, |