@@ -125,7 +125,9 @@ discard block |
||
| 125 | 125 | $termId = intval( $termId ); |
| 126 | 126 | } |
| 127 | 127 | $term = term_exists( $termId, Application::TAXONOMY ); |
| 128 | - if( !isset( $term['term_id'] ))continue; |
|
| 128 | + if( !isset( $term['term_id'] )) { |
|
| 129 | + continue; |
|
| 130 | + } |
|
| 129 | 131 | $terms[] = $term; |
| 130 | 132 | } |
| 131 | 133 | return $terms; |
@@ -137,7 +139,9 @@ discard block |
||
| 137 | 139 | */ |
| 138 | 140 | public function revert( $postId ) |
| 139 | 141 | { |
| 140 | - if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return; |
|
| 142 | + if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE ) { |
|
| 143 | + return; |
|
| 144 | + } |
|
| 141 | 145 | delete_post_meta( $postId, '_edit_last' ); |
| 142 | 146 | $result = wp_update_post([ |
| 143 | 147 | 'ID' => $postId, |
@@ -182,7 +186,9 @@ discard block |
||
| 182 | 186 | protected function setTerms( $postId, $termIds ) |
| 183 | 187 | { |
| 184 | 188 | $termIds = $this->normalizeTermIds( $termIds ); |
| 185 | - if( empty( $termIds ))return; |
|
| 189 | + if( empty( $termIds )) { |
|
| 190 | + return; |
|
| 191 | + } |
|
| 186 | 192 | $termTaxonomyIds = wp_set_object_terms( $postId, $termIds, Application::TAXONOMY ); |
| 187 | 193 | if( is_wp_error( $termTaxonomyIds )) { |
| 188 | 194 | glsr_log()->error( $termTaxonomyIds->get_error_message() ); |
@@ -67,7 +67,9 @@ discard block |
||
| 67 | 67 | $field = method_exists( $this, $method ) |
| 68 | 68 | ? $this->$method( $key, $value ) |
| 69 | 69 | : apply_filters( 'site-reviews/review/build/'.$key, false, $value, $this, $review ); |
| 70 | - if( $field === false )continue; |
|
| 70 | + if( $field === false ) { |
|
| 71 | + continue; |
|
| 72 | + } |
|
| 71 | 73 | $renderedFields[$key] = $field; |
| 72 | 74 | } |
| 73 | 75 | $this->wrap( $renderedFields, $review ); |
@@ -95,7 +97,9 @@ discard block |
||
| 95 | 97 | */ |
| 96 | 98 | public function generateSchema() |
| 97 | 99 | { |
| 98 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
| 100 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
| 101 | + return; |
|
| 102 | + } |
|
| 99 | 103 | glsr( Schema::class )->store( |
| 100 | 104 | glsr( Schema::class )->build( $this->args ) |
| 101 | 105 | ); |
@@ -121,9 +125,13 @@ discard block |
||
| 121 | 125 | */ |
| 122 | 126 | protected function buildOptionAssignedTo( $key, $value ) |
| 123 | 127 | { |
| 124 | - if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return; |
|
| 128 | + if( $this->isHidden( $key, 'settings.reviews.assigned_links' )) { |
|
| 129 | + return; |
|
| 130 | + } |
|
| 125 | 131 | $post = glsr( Polylang::class )->getPost( $value ); |
| 126 | - if( !( $post instanceof WP_Post ))return; |
|
| 132 | + if( !( $post instanceof WP_Post )) { |
|
| 133 | + return; |
|
| 134 | + } |
|
| 127 | 135 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
| 128 | 136 | 'href' => get_the_permalink( $post->ID ), |
| 129 | 137 | ]); |
@@ -138,7 +146,9 @@ discard block |
||
| 138 | 146 | */ |
| 139 | 147 | protected function buildOptionAuthor( $key, $value ) |
| 140 | 148 | { |
| 141 | - if( $this->isHidden( $key ))return; |
|
| 149 | + if( $this->isHidden( $key )) { |
|
| 150 | + return; |
|
| 151 | + } |
|
| 142 | 152 | return '<span>'.$value.'</span>'; |
| 143 | 153 | } |
| 144 | 154 | |
@@ -149,7 +159,9 @@ discard block |
||
| 149 | 159 | */ |
| 150 | 160 | protected function buildOptionAvatar( $key, $value ) |
| 151 | 161 | { |
| 152 | - if( $this->isHidden( $key, 'settings.reviews.avatars' ))return; |
|
| 162 | + if( $this->isHidden( $key, 'settings.reviews.avatars' )) { |
|
| 163 | + return; |
|
| 164 | + } |
|
| 153 | 165 | $size = $this->getOption( 'settings.reviews.avatars_size', 40 ); |
| 154 | 166 | return glsr( Builder::class )->img([ |
| 155 | 167 | 'height' => $size, |
@@ -167,7 +179,9 @@ discard block |
||
| 167 | 179 | protected function buildOptionContent( $key, $value ) |
| 168 | 180 | { |
| 169 | 181 | $text = $this->normalizeText( $value ); |
| 170 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
| 182 | + if( $this->isHiddenOrEmpty( $key, $text )) { |
|
| 183 | + return; |
|
| 184 | + } |
|
| 171 | 185 | return '<p>'.$text.'</p>'; |
| 172 | 186 | } |
| 173 | 187 | |
@@ -178,7 +192,9 @@ discard block |
||
| 178 | 192 | */ |
| 179 | 193 | protected function buildOptionDate( $key, $value ) |
| 180 | 194 | { |
| 181 | - if( $this->isHidden( $key ))return; |
|
| 195 | + if( $this->isHidden( $key )) { |
|
| 196 | + return; |
|
| 197 | + } |
|
| 182 | 198 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
| 183 | 199 | if( $dateFormat == 'relative' ) { |
| 184 | 200 | $date = glsr( Date::class )->relative( $value ); |
@@ -199,7 +215,9 @@ discard block |
||
| 199 | 215 | */ |
| 200 | 216 | protected function buildOptionRating( $key, $value ) |
| 201 | 217 | { |
| 202 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 218 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
| 219 | + return; |
|
| 220 | + } |
|
| 203 | 221 | return glsr_star_rating( $value ); |
| 204 | 222 | } |
| 205 | 223 | |
@@ -210,7 +228,9 @@ discard block |
||
| 210 | 228 | */ |
| 211 | 229 | protected function buildOptionResponse( $key, $value ) |
| 212 | 230 | { |
| 213 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 231 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
| 232 | + return; |
|
| 233 | + } |
|
| 214 | 234 | $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
| 215 | 235 | $text = $this->normalizeText( $value ); |
| 216 | 236 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
@@ -226,7 +246,9 @@ discard block |
||
| 226 | 246 | */ |
| 227 | 247 | protected function buildOptionTitle( $key, $value ) |
| 228 | 248 | { |
| 229 | - if( $this->isHidden( $key ))return; |
|
| 249 | + if( $this->isHidden( $key )) { |
|
| 250 | + return; |
|
| 251 | + } |
|
| 230 | 252 | if( empty( $value )) { |
| 231 | 253 | $value = __( 'No Title', 'site-reviews' ); |
| 232 | 254 | } |
@@ -285,9 +307,13 @@ discard block |
||
| 285 | 307 | $words->setText( $text ); |
| 286 | 308 | $count = 0; |
| 287 | 309 | foreach( $words as $offset ){ |
| 288 | - if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue; |
|
| 310 | + if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE ) { |
|
| 311 | + continue; |
|
| 312 | + } |
|
| 289 | 313 | $count++; |
| 290 | - if( $count != $limit )continue; |
|
| 314 | + if( $count != $limit ) { |
|
| 315 | + continue; |
|
| 316 | + } |
|
| 291 | 317 | return $offset; |
| 292 | 318 | } |
| 293 | 319 | return strlen( $text ); |
@@ -363,7 +389,9 @@ discard block |
||
| 363 | 389 | $renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review ); |
| 364 | 390 | array_walk( $renderedFields, function( &$value, $key ) use( $review ) { |
| 365 | 391 | $value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review ); |
| 366 | - if( empty( $value ))return; |
|
| 392 | + if( empty( $value )) { |
|
| 393 | + return; |
|
| 394 | + } |
|
| 367 | 395 | $value = glsr( Builder::class )->div( $value, [ |
| 368 | 396 | 'class' => 'glsr-review-'.$key, |
| 369 | 397 | ]); |
@@ -86,7 +86,9 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | protected function buildRecaptcha() |
| 88 | 88 | { |
| 89 | - if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return; |
|
| 89 | + if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) { |
|
| 90 | + return; |
|
| 91 | + } |
|
| 90 | 92 | return glsr( Builder::class )->div([ |
| 91 | 93 | 'class' => 'glsr-recaptcha-holder', |
| 92 | 94 | 'data-badge' => glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ), |
@@ -145,7 +147,9 @@ discard block |
||
| 145 | 147 | }, $hiddenFields ); |
| 146 | 148 | foreach( $fields as $field ) { |
| 147 | 149 | $index = array_search( $field->field['path'], $paths ); |
| 148 | - if( $index === false )continue; |
|
| 150 | + if( $index === false ) { |
|
| 151 | + continue; |
|
| 152 | + } |
|
| 149 | 153 | unset( $hiddenFields[$index] ); |
| 150 | 154 | } |
| 151 | 155 | return array_merge( $hiddenFields, $fields ); |
@@ -168,7 +172,9 @@ discard block |
||
| 168 | 172 | */ |
| 169 | 173 | protected function getRegisterText() |
| 170 | 174 | { |
| 171 | - if( !get_option( 'users_can_register' ) || !glsr( OptionManager::class )->getBool( 'settings.general.require.login' ))return; |
|
| 175 | + if( !get_option( 'users_can_register' ) || !glsr( OptionManager::class )->getBool( 'settings.general.require.login' )) { |
|
| 176 | + return; |
|
| 177 | + } |
|
| 172 | 178 | $registerLink = glsr( Builder::class )->a([ |
| 173 | 179 | 'href' => wp_registration_url(), |
| 174 | 180 | 'text' => __( 'register', 'site-reviews' ), |
@@ -229,7 +235,9 @@ discard block |
||
| 229 | 235 | */ |
| 230 | 236 | protected function normalizeFieldId( Field &$field ) |
| 231 | 237 | { |
| 232 | - if( empty( $this->args['id'] ) || empty( $field->field['id'] ))return; |
|
| 238 | + if( empty( $this->args['id'] ) || empty( $field->field['id'] )) { |
|
| 239 | + return; |
|
| 240 | + } |
|
| 233 | 241 | $field->field['id'].= '-'.$this->args['id']; |
| 234 | 242 | } |
| 235 | 243 | |
@@ -249,7 +257,9 @@ discard block |
||
| 249 | 257 | */ |
| 250 | 258 | protected function normalizeFieldErrors( Field &$field ) |
| 251 | 259 | { |
| 252 | - if( !array_key_exists( $field->field['path'], $this->errors ))return; |
|
| 260 | + if( !array_key_exists( $field->field['path'], $this->errors )) { |
|
| 261 | + return; |
|
| 262 | + } |
|
| 253 | 263 | $field->field['errors'] = $this->errors[$field->field['path']]; |
| 254 | 264 | } |
| 255 | 265 | |
@@ -258,7 +268,9 @@ discard block |
||
| 258 | 268 | */ |
| 259 | 269 | protected function normalizeFieldRequired( Field &$field ) |
| 260 | 270 | { |
| 261 | - if( !in_array( $field->field['path'], $this->required ))return; |
|
| 271 | + if( !in_array( $field->field['path'], $this->required )) { |
|
| 272 | + return; |
|
| 273 | + } |
|
| 262 | 274 | $field->field['required'] = true; |
| 263 | 275 | } |
| 264 | 276 | |
@@ -269,7 +281,9 @@ discard block |
||
| 269 | 281 | { |
| 270 | 282 | $normalizedFields = []; |
| 271 | 283 | foreach( $fields as $field ) { |
| 272 | - if( in_array( $field->field['path'], $this->args['hide'] ))continue; |
|
| 284 | + if( in_array( $field->field['path'], $this->args['hide'] )) { |
|
| 285 | + continue; |
|
| 286 | + } |
|
| 273 | 287 | $field->field['is_public'] = true; |
| 274 | 288 | $this->normalizeFieldClass( $field ); |
| 275 | 289 | $this->normalizeFieldErrors( $field ); |
@@ -286,7 +300,9 @@ discard block |
||
| 286 | 300 | */ |
| 287 | 301 | protected function normalizeFieldValue( Field &$field ) |
| 288 | 302 | { |
| 289 | - if( !array_key_exists( $field->field['path'], $this->values ))return; |
|
| 303 | + if( !array_key_exists( $field->field['path'], $this->values )) { |
|
| 304 | + return; |
|
| 305 | + } |
|
| 290 | 306 | if( in_array( $field->field['type'], ['radio', 'checkbox'] )) { |
| 291 | 307 | $field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']]; |
| 292 | 308 | } |
@@ -78,7 +78,9 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function renderFilters( $postType ) |
| 80 | 80 | { |
| 81 | - if( $postType !== Application::POST_TYPE )return; |
|
| 81 | + if( $postType !== Application::POST_TYPE ) { |
|
| 82 | + return; |
|
| 83 | + } |
|
| 82 | 84 | if( !( $status = filter_input( INPUT_GET, 'post_status' ))) { |
| 83 | 85 | $status = 'publish'; |
| 84 | 86 | } |
@@ -107,7 +109,9 @@ discard block |
||
| 107 | 109 | */ |
| 108 | 110 | protected function renderFilterRatings( $ratings ) |
| 109 | 111 | { |
| 110 | - if( empty( $ratings ))return; |
|
| 112 | + if( empty( $ratings )) { |
|
| 113 | + return; |
|
| 114 | + } |
|
| 111 | 115 | $ratings = array_flip( array_reverse( $ratings )); |
| 112 | 116 | array_walk( $ratings, function( &$value, $key ) { |
| 113 | 117 | $label = _n( '%s star', '%s stars', $key, 'site-reviews' ); |
@@ -130,7 +134,9 @@ discard block |
||
| 130 | 134 | */ |
| 131 | 135 | protected function renderFilterTypes( $types ) |
| 132 | 136 | { |
| 133 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
| 137 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
| 138 | + return; |
|
| 139 | + } |
|
| 134 | 140 | echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [ |
| 135 | 141 | 'class' => 'screen-reader-text', |
| 136 | 142 | 'for' => 'review_type', |
@@ -22,7 +22,9 @@ |
||
| 22 | 22 | require_once __DIR__.'/activate.php'; |
| 23 | 23 | } |
| 24 | 24 | $check = new GL_Plugin_Check_v3( __FILE__ ); |
| 25 | -if( !$check->canProceed() )return; |
|
| 25 | +if( !$check->canProceed() ) { |
|
| 26 | + return; |
|
| 27 | +} |
|
| 26 | 28 | require_once __DIR__.'/autoload.php'; |
| 27 | 29 | require_once __DIR__.'/compatibility.php'; |
| 28 | 30 | require_once __DIR__.'/deprecated.php'; |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | 'glsr_log', |
| 21 | 21 | 'glsr_star_rating', |
| 22 | 22 | ); |
| 23 | - if( !in_array( $hook, $hooks ) || !function_exists( $hook ))return; |
|
| 23 | + if( !in_array( $hook, $hooks ) || !function_exists( $hook )) { |
|
| 24 | + return; |
|
| 25 | + } |
|
| 24 | 26 | add_filter( $hook, function() use( $hook, $args ) { |
| 25 | 27 | array_shift( $args ); // remove the fallback value |
| 26 | 28 | return call_user_func_array( $hook, $args ); |
@@ -30,7 +32,8 @@ discard block |
||
| 30 | 32 | /** |
| 31 | 33 | * @return mixed |
| 32 | 34 | */ |
| 33 | -function glsr( $alias = null ) { |
|
| 35 | +function glsr( $alias = null ) |
|
| 36 | +{ |
|
| 34 | 37 | $app = \GeminiLabs\SiteReviews\Application::load(); |
| 35 | 38 | return !empty( $alias ) |
| 36 | 39 | ? $app->make( $alias ) |
@@ -42,11 +45,14 @@ discard block |
||
| 42 | 45 | * @param $column string |
| 43 | 46 | * @return array |
| 44 | 47 | */ |
| 45 | -function glsr_array_column( array $array, $column ) { |
|
| 48 | +function glsr_array_column( array $array, $column ) |
|
| 49 | +{ |
|
| 46 | 50 | $result = array(); |
| 47 | 51 | foreach( $array as $subarray ) { |
| 48 | 52 | $subarray = (array)$subarray; |
| 49 | - if( !isset( $subarray[$column] ))continue; |
|
| 53 | + if( !isset( $subarray[$column] )) { |
|
| 54 | + continue; |
|
| 55 | + } |
|
| 50 | 56 | $result[] = $subarray[$column]; |
| 51 | 57 | } |
| 52 | 58 | return $result; |
@@ -55,7 +61,8 @@ discard block |
||
| 55 | 61 | /** |
| 56 | 62 | * @return void |
| 57 | 63 | */ |
| 58 | -function glsr_calculate_ratings() { |
|
| 64 | +function glsr_calculate_ratings() |
|
| 65 | +{ |
|
| 59 | 66 | glsr( 'Controllers\AdminController' )->routerCountReviews( false ); |
| 60 | 67 | glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' )); |
| 61 | 68 | } |
@@ -63,7 +70,8 @@ discard block |
||
| 63 | 70 | /** |
| 64 | 71 | * @return \GeminiLabs\SiteReviews\Review|false |
| 65 | 72 | */ |
| 66 | -function glsr_create_review( $reviewValues = array() ) { |
|
| 73 | +function glsr_create_review( $reviewValues = array() ) |
|
| 74 | +{ |
|
| 67 | 75 | $review = new \GeminiLabs\SiteReviews\Commands\CreateReview( |
| 68 | 76 | glsr( 'Helper' )->consolidateArray( $reviewValues ) |
| 69 | 77 | ); |
@@ -73,7 +81,8 @@ discard block |
||
| 73 | 81 | /** |
| 74 | 82 | * @return \WP_Screen|object |
| 75 | 83 | */ |
| 76 | -function glsr_current_screen() { |
|
| 84 | +function glsr_current_screen() |
|
| 85 | +{ |
|
| 77 | 86 | if( function_exists( 'get_current_screen' )) { |
| 78 | 87 | $screen = get_current_screen(); |
| 79 | 88 | } |
@@ -86,7 +95,8 @@ discard block |
||
| 86 | 95 | * @param mixed ...$vars |
| 87 | 96 | * @return void |
| 88 | 97 | */ |
| 89 | -function glsr_debug( ...$vars ) { |
|
| 98 | +function glsr_debug( ...$vars ) |
|
| 99 | +{ |
|
| 90 | 100 | if( count( $vars ) == 1 ) { |
| 91 | 101 | $value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' ); |
| 92 | 102 | printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value ); |
@@ -106,7 +116,8 @@ discard block |
||
| 106 | 116 | * @param mixed $fallback |
| 107 | 117 | * @return mixed |
| 108 | 118 | */ |
| 109 | -function glsr_get( $array, $path = '', $fallback = '' ) { |
|
| 119 | +function glsr_get( $array, $path = '', $fallback = '' ) |
|
| 120 | +{ |
|
| 110 | 121 | return glsr( 'Helper' )->dataGet( $array, $path, $fallback ); |
| 111 | 122 | } |
| 112 | 123 | |
@@ -115,7 +126,8 @@ discard block |
||
| 115 | 126 | * @param mixed $fallback |
| 116 | 127 | * @return string|array |
| 117 | 128 | */ |
| 118 | -function glsr_get_option( $path = '', $fallback = '' ) { |
|
| 129 | +function glsr_get_option( $path = '', $fallback = '' ) |
|
| 130 | +{ |
|
| 119 | 131 | return is_string( $path ) |
| 120 | 132 | ? glsr( 'Database\OptionManager' )->get( 'settings.'.$path, $fallback ) |
| 121 | 133 | : $fallback; |
@@ -124,7 +136,8 @@ discard block |
||
| 124 | 136 | /** |
| 125 | 137 | * @return array |
| 126 | 138 | */ |
| 127 | -function glsr_get_options() { |
|
| 139 | +function glsr_get_options() |
|
| 140 | +{ |
|
| 128 | 141 | return glsr( 'Database\OptionManager' )->get( 'settings' ); |
| 129 | 142 | } |
| 130 | 143 | |
@@ -132,7 +145,8 @@ discard block |
||
| 132 | 145 | * @param int $post_id |
| 133 | 146 | * @return \GeminiLabs\SiteReviews\Review |
| 134 | 147 | */ |
| 135 | -function glsr_get_review( $post_id ) { |
|
| 148 | +function glsr_get_review( $post_id ) |
|
| 149 | +{ |
|
| 136 | 150 | $post = null; |
| 137 | 151 | if( is_numeric( $post_id )) { |
| 138 | 152 | $post = get_post( $post_id ); |
@@ -146,14 +160,16 @@ discard block |
||
| 146 | 160 | /** |
| 147 | 161 | * @return array |
| 148 | 162 | */ |
| 149 | -function glsr_get_reviews( $args = array() ) { |
|
| 163 | +function glsr_get_reviews( $args = array() ) |
|
| 164 | +{ |
|
| 150 | 165 | return glsr( 'Database\ReviewManager' )->get( glsr( 'Helper' )->consolidateArray( $args )); |
| 151 | 166 | } |
| 152 | 167 | |
| 153 | 168 | /** |
| 154 | 169 | * @return \GeminiLabs\SiteReviews\Modules\Console |
| 155 | 170 | */ |
| 156 | -function glsr_log() { |
|
| 171 | +function glsr_log() |
|
| 172 | +{ |
|
| 157 | 173 | $args = func_get_args(); |
| 158 | 174 | $console = glsr( 'Modules\Console' ); |
| 159 | 175 | $value = glsr( 'Helper' )->dataGet( $args, '0' ); |
@@ -165,6 +181,7 @@ discard block |
||
| 165 | 181 | /** |
| 166 | 182 | * @return string |
| 167 | 183 | */ |
| 168 | -function glsr_star_rating( $rating ) { |
|
| 184 | +function glsr_star_rating( $rating ) |
|
| 185 | +{ |
|
| 169 | 186 | return glsr( 'Modules\Html\Partial' )->build( 'star-rating', ['rating' => $rating] ); |
| 170 | 187 | } |
@@ -185,7 +185,9 @@ discard block |
||
| 185 | 185 | $once = glsr( Helper::class )->consolidateArray( $once ); |
| 186 | 186 | $levels = $this->getLevels(); |
| 187 | 187 | foreach( $once as $entry ) { |
| 188 | - if( !in_array( glsr_get( $entry, 'level' ), $levels ))continue; |
|
| 188 | + if( !in_array( glsr_get( $entry, 'level' ), $levels )) { |
|
| 189 | + continue; |
|
| 190 | + } |
|
| 189 | 191 | $level = glsr_get( $entry, 'level' ); |
| 190 | 192 | $message = glsr_get( $entry, 'message' ); |
| 191 | 193 | $backtraceLine = glsr_get( $entry, 'backtrace' ); |
@@ -218,7 +220,9 @@ discard block |
||
| 218 | 220 | return glsr_get( $entry, 'level' ) == $level |
| 219 | 221 | && glsr_get( $entry, 'handle' ) == $handle; |
| 220 | 222 | }); |
| 221 | - if( !empty( $filtered ))return; |
|
| 223 | + if( !empty( $filtered )) { |
|
| 224 | + return; |
|
| 225 | + } |
|
| 222 | 226 | $once[] = [ |
| 223 | 227 | 'backtrace' => $this->getBacktraceLineFromData( $data ), |
| 224 | 228 | 'handle' => $handle, |
@@ -411,7 +415,9 @@ discard block |
||
| 411 | 415 | */ |
| 412 | 416 | protected function reset() |
| 413 | 417 | { |
| 414 | - if( $this->size() <= pow( 1024, 2 ) / 8 )return; |
|
| 418 | + if( $this->size() <= pow( 1024, 2 ) / 8 ) { |
|
| 419 | + return; |
|
| 420 | + } |
|
| 415 | 421 | $this->clear(); |
| 416 | 422 | file_put_contents( |
| 417 | 423 | $this->file, |
@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function saveAssignedToMetabox( $postId ) |
| 14 | 14 | { |
| 15 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
| 15 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' )) { |
|
| 16 | + return; |
|
| 17 | + } |
|
| 16 | 18 | $assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' )); |
| 17 | 19 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
| 18 | 20 | } |
@@ -23,7 +25,9 @@ discard block |
||
| 23 | 25 | */ |
| 24 | 26 | public function saveResponseMetabox( $postId ) |
| 25 | 27 | { |
| 26 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return; |
|
| 28 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' )) { |
|
| 29 | + return; |
|
| 30 | + } |
|
| 27 | 31 | $response = strval( glsr( Helper::class )->filterInput( 'response' )); |
| 28 | 32 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
| 29 | 33 | 'a' => ['href' => [], 'title' => []], |
@@ -22,7 +22,9 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | global $menu, $typenow; |
| 24 | 24 | foreach( $menu as $key => $value ) { |
| 25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 25 | + if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) { |
|
| 26 | + continue; |
|
| 27 | + } |
|
| 26 | 28 | $postCount = wp_count_posts( Application::POST_TYPE ); |
| 27 | 29 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
| 28 | 30 | 'class' => 'pending-count', |
@@ -53,7 +55,9 @@ discard block |
||
| 53 | 55 | foreach( $pages as $slug => $title ) { |
| 54 | 56 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
| 55 | 57 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
| 56 | - if( !is_callable( $callback ))continue; |
|
| 58 | + if( !is_callable( $callback )) { |
|
| 59 | + continue; |
|
| 60 | + } |
|
| 57 | 61 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission( $slug ), $slug, $callback ); |
| 58 | 62 | } |
| 59 | 63 | } |