@@ -73,7 +73,7 @@ |
||
| 73 | 73 | $this->filterShortcodeClass(); |
| 74 | 74 | $this->filterShowMoreLinks( 'content' ); |
| 75 | 75 | $this->filterShowMoreLinks( 'response' ); |
| 76 | - if( !$this->hasVisibleFields( $shortcode, $attributes )) { |
|
| 76 | + if( !$this->hasVisibleFields( $shortcode, $attributes ) ) { |
|
| 77 | 77 | $this->filterInterpolation(); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $this->filterRatingField(); |
| 49 | 49 | $this->filterShortcodeClass(); |
| 50 | 50 | $this->filterSubmitButton(); |
| 51 | - if( !$this->hasVisibleFields( $shortcode, $attributes )) { |
|
| 51 | + if( !$this->hasVisibleFields( $shortcode, $attributes ) ) { |
|
| 52 | 52 | $this->filterInterpolation(); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | add_filter( 'site-reviews/rendered/field', function( $html, $type, $args ) { |
| 92 | 92 | if( $args['path'] == 'rating' ) { |
| 93 | 93 | $stars = '<span class="glsr-stars">'; |
| 94 | - $stars.= str_repeat( '<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', 5 ); |
|
| 95 | - $stars.= '</span>'; |
|
| 94 | + $stars .= str_repeat( '<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', 5 ); |
|
| 95 | + $stars .= '</span>'; |
|
| 96 | 96 | $html = preg_replace( '/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html ); |
| 97 | 97 | } |
| 98 | 98 | return $html; |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function normalize( array $attributes ) |
| 21 | 21 | { |
| 22 | - $hide = array_flip( explode( ',', $attributes['hide'] )); |
|
| 23 | - unset( $hide['if_empty'] ); |
|
| 24 | - $attributes['hide'] = implode( ',', array_keys( $hide )); |
|
| 25 | - if( !isset( $attributes['assigned_to'] )) { |
|
| 22 | + $hide = array_flip( explode( ',', $attributes['hide'] ) ); |
|
| 23 | + unset($hide['if_empty']); |
|
| 24 | + $attributes['hide'] = implode( ',', array_keys( $hide ) ); |
|
| 25 | + if( !isset($attributes['assigned_to']) ) { |
|
| 26 | 26 | return $attributes; |
| 27 | 27 | } |
| 28 | 28 | if( $attributes['assigned_to'] == 'post_id' ) { |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function register( $block ) |
| 41 | 41 | { |
| 42 | - if( !function_exists( 'register_block_type' ))return; |
|
| 42 | + if( !function_exists( 'register_block_type' ) )return; |
|
| 43 | 43 | register_block_type( Application::ID.'/'.$block, [ |
| 44 | 44 | 'attributes' => $this->attributes(), |
| 45 | 45 | 'editor_script' => Application::ID.'/blocks', |
| 46 | 46 | 'editor_style' => Application::ID.'/blocks', |
| 47 | 47 | 'render_callback' => [$this, 'render'], |
| 48 | 48 | 'style' => Application::ID, |
| 49 | - ]); |
|
| 49 | + ] ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $args = $shortcode->normalize( $attributes ); |
| 64 | 64 | $defaults = $shortcode->getHideOptions(); |
| 65 | 65 | $hide = array_flip( $args['hide'] ); |
| 66 | - unset( $defaults['if_empty'], $hide['if_empty'] ); |
|
| 67 | - return !empty( array_diff_key( $defaults, $hide )); |
|
| 66 | + unset($defaults['if_empty'], $hide['if_empty']); |
|
| 67 | + return !empty(array_diff_key( $defaults, $hide )); |
|
| 68 | 68 | } |
| 69 | 69 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | if( filter_input( INPUT_GET, 'context' ) == 'edit' ) { |
| 59 | 59 | $attributes = $this->normalize( $attributes ); |
| 60 | 60 | $this->filterShortcodeClass(); |
| 61 | - if( !$this->hasVisibleFields( $shortcode, $attributes )) { |
|
| 61 | + if( !$this->hasVisibleFields( $shortcode, $attributes ) ) { |
|
| 62 | 62 | $this->filterInterpolation(); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function build( array $args = [] ) |
| 48 | 48 | { |
| 49 | 49 | $this->args = $args; |
| 50 | - if( !is_user_logged_in() && glsr( OptionManager::class )->getBool( 'settings.general.require.login' )) { |
|
| 50 | + if( !is_user_logged_in() && glsr( OptionManager::class )->getBool( 'settings.general.require.login' ) ) { |
|
| 51 | 51 | return $this->buildLoginRegister(); |
| 52 | 52 | } |
| 53 | 53 | $this->errors = glsr( Session::class )->get( $args['id'].'errors', [], true ); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | 'response' => $this->buildResponse(), |
| 67 | 67 | 'submit_button' => $this->buildSubmitButton().$this->buildRecaptcha(), |
| 68 | 68 | ], |
| 69 | - ]); |
|
| 69 | + ] ); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | 'context' => [ |
| 79 | 79 | 'text' => trim( $this->getLoginText().' '.$this->getRegisterText() ), |
| 80 | 80 | ], |
| 81 | - ]); |
|
| 81 | + ] ); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | protected function buildRecaptcha() |
| 88 | 88 | { |
| 89 | 89 | if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return; |
| 90 | - return glsr( Builder::class )->div([ |
|
| 90 | + return glsr( Builder::class )->div( [ |
|
| 91 | 91 | 'class' => 'glsr-recaptcha-holder', |
| 92 | 92 | 'data-badge' => glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ), |
| 93 | - 'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' )), |
|
| 93 | + 'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' ) ), |
|
| 94 | 94 | 'data-size' => 'invisible', |
| 95 | - ]); |
|
| 95 | + ] ); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | protected function buildResponse() |
| 102 | 102 | { |
| 103 | - $classes = !empty( $this->errors ) |
|
| 103 | + $classes = !empty($this->errors) |
|
| 104 | 104 | ? glsr( StyleValidationDefaults::class )->defaults()['message_error_class'] |
| 105 | 105 | : ''; |
| 106 | 106 | return glsr( Template::class )->build( 'templates/form/response', [ |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | 'class' => $classes, |
| 109 | 109 | 'message' => wpautop( $this->message ), |
| 110 | 110 | ], |
| 111 | - 'has_errors' => !empty( $this->errors ), |
|
| 112 | - ]); |
|
| 111 | + 'has_errors' => !empty($this->errors), |
|
| 112 | + ] ); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | 'context' => [ |
| 122 | 122 | 'text' => __( 'Submit your review', 'site-reviews' ), |
| 123 | 123 | ], |
| 124 | - ]); |
|
| 124 | + ] ); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -139,14 +139,14 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $hiddenFields = $this->getHiddenFields(); |
| 141 | 141 | $hiddenFields[] = $this->getHoneypotField(); |
| 142 | - $fields = $this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' )); |
|
| 142 | + $fields = $this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ) ); |
|
| 143 | 143 | $paths = array_map( function( $obj ) { |
| 144 | 144 | return $obj->field['path']; |
| 145 | 145 | }, $hiddenFields ); |
| 146 | 146 | foreach( $fields as $field ) { |
| 147 | 147 | $index = array_search( $field->field['path'], $paths ); |
| 148 | 148 | if( $index === false )continue; |
| 149 | - unset( $hiddenFields[$index] ); |
|
| 149 | + unset($hiddenFields[$index]); |
|
| 150 | 150 | } |
| 151 | 151 | return array_merge( $hiddenFields, $fields ); |
| 152 | 152 | } |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | protected function getLoginText() |
| 158 | 158 | { |
| 159 | - $loginLink = glsr( Builder::class )->a([ |
|
| 160 | - 'href' => wp_login_url( strval( get_permalink() )), |
|
| 159 | + $loginLink = glsr( Builder::class )->a( [ |
|
| 160 | + 'href' => wp_login_url( strval( get_permalink() ) ), |
|
| 161 | 161 | 'text' => __( 'logged in', 'site-reviews' ), |
| 162 | - ]); |
|
| 162 | + ] ); |
|
| 163 | 163 | return sprintf( __( 'You must be %s to submit a review.', 'site-reviews' ), $loginLink ); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -168,11 +168,11 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | protected function getRegisterText() |
| 170 | 170 | { |
| 171 | - if( !get_option( 'users_can_register' ) || !glsr( OptionManager::class )->getBool( 'settings.general.require.login' ))return; |
|
| 172 | - $registerLink = glsr( Builder::class )->a([ |
|
| 171 | + if( !get_option( 'users_can_register' ) || !glsr( OptionManager::class )->getBool( 'settings.general.require.login' ) )return; |
|
| 172 | + $registerLink = glsr( Builder::class )->a( [ |
|
| 173 | 173 | 'href' => wp_registration_url(), |
| 174 | 174 | 'text' => __( 'register', 'site-reviews' ), |
| 175 | - ]); |
|
| 175 | + ] ); |
|
| 176 | 176 | return sprintf( __( 'You may also %s for an account.', 'site-reviews' ), $registerLink ); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -184,32 +184,32 @@ discard block |
||
| 184 | 184 | $fields = [[ |
| 185 | 185 | 'name' => '_action', |
| 186 | 186 | 'value' => 'submit-review', |
| 187 | - ],[ |
|
| 187 | + ], [ |
|
| 188 | 188 | 'name' => '_counter', |
| 189 | - ],[ |
|
| 189 | + ], [ |
|
| 190 | 190 | 'name' => '_nonce', |
| 191 | 191 | 'value' => wp_create_nonce( 'submit-review' ), |
| 192 | - ],[ |
|
| 192 | + ], [ |
|
| 193 | 193 | 'name' => '_post_id', |
| 194 | 194 | 'value' => get_the_ID(), |
| 195 | - ],[ |
|
| 195 | + ], [ |
|
| 196 | 196 | 'name' => '_referer', |
| 197 | - 'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' )), |
|
| 198 | - ],[ |
|
| 197 | + 'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' ) ), |
|
| 198 | + ], [ |
|
| 199 | 199 | 'name' => 'assign_to', |
| 200 | 200 | 'value' => $this->args['assign_to'], |
| 201 | - ],[ |
|
| 201 | + ], [ |
|
| 202 | 202 | 'name' => 'category', |
| 203 | 203 | 'value' => $this->args['category'], |
| 204 | - ],[ |
|
| 204 | + ], [ |
|
| 205 | 205 | 'name' => 'excluded', |
| 206 | 206 | 'value' => $this->args['hide'], |
| 207 | - ],[ |
|
| 207 | + ], [ |
|
| 208 | 208 | 'name' => 'form_id', |
| 209 | 209 | 'value' => $this->args['id'], |
| 210 | 210 | ]]; |
| 211 | 211 | return array_map( function( $field ) { |
| 212 | - return new Field( wp_parse_args( $field, ['type' => 'hidden'] )); |
|
| 212 | + return new Field( wp_parse_args( $field, ['type' => 'hidden'] ) ); |
|
| 213 | 213 | }, $fields ); |
| 214 | 214 | } |
| 215 | 215 | |
@@ -218,10 +218,10 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | protected function getHoneypotField() |
| 220 | 220 | { |
| 221 | - return new Field([ |
|
| 221 | + return new Field( [ |
|
| 222 | 222 | 'name' => 'gotcha', |
| 223 | 223 | 'type' => 'honeypot', |
| 224 | - ]); |
|
| 224 | + ] ); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | protected function normalizeFieldId( Field &$field ) |
| 231 | 231 | { |
| 232 | - if( empty( $this->args['id'] ) || empty( $field->field['id'] ))return; |
|
| 233 | - $field->field['id'].= '-'.$this->args['id']; |
|
| 232 | + if( empty($this->args['id']) || empty($field->field['id']) )return; |
|
| 233 | + $field->field['id'] .= '-'.$this->args['id']; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | protected function normalizeFieldClass( Field &$field ) |
| 240 | 240 | { |
| 241 | - if( !isset( $field->field['class'] )) { |
|
| 241 | + if( !isset($field->field['class']) ) { |
|
| 242 | 242 | $field->field['class'] = ''; |
| 243 | 243 | } |
| 244 | 244 | $field->field['class'] = trim( $field->field['class'].' glsr-field-control' ); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | protected function normalizeFieldErrors( Field &$field ) |
| 251 | 251 | { |
| 252 | - if( !array_key_exists( $field->field['path'], $this->errors ))return; |
|
| 252 | + if( !array_key_exists( $field->field['path'], $this->errors ) )return; |
|
| 253 | 253 | $field->field['errors'] = $this->errors[$field->field['path']]; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | protected function normalizeFieldRequired( Field &$field ) |
| 260 | 260 | { |
| 261 | - if( !in_array( $field->field['path'], $this->required ))return; |
|
| 261 | + if( !in_array( $field->field['path'], $this->required ) )return; |
|
| 262 | 262 | $field->field['required'] = true; |
| 263 | 263 | } |
| 264 | 264 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | { |
| 270 | 270 | $normalizedFields = []; |
| 271 | 271 | foreach( $fields as $field ) { |
| 272 | - if( in_array( $field->field['path'], $this->args['hide'] ))continue; |
|
| 272 | + if( in_array( $field->field['path'], $this->args['hide'] ) )continue; |
|
| 273 | 273 | $field->field['is_public'] = true; |
| 274 | 274 | $this->normalizeFieldClass( $field ); |
| 275 | 275 | $this->normalizeFieldErrors( $field ); |
@@ -286,8 +286,8 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | protected function normalizeFieldValue( Field &$field ) |
| 288 | 288 | { |
| 289 | - if( !array_key_exists( $field->field['path'], $this->values ))return; |
|
| 290 | - if( in_array( $field->field['type'], ['radio', 'checkbox'] )) { |
|
| 289 | + if( !array_key_exists( $field->field['path'], $this->values ) )return; |
|
| 290 | + if( in_array( $field->field['type'], ['radio', 'checkbox'] ) ) { |
|
| 291 | 291 | $field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']]; |
| 292 | 292 | } |
| 293 | 293 | else { |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | $this->reviews = $reviews; |
| 32 | 32 | $this->navigation = glsr( Partial::class )->build( 'pagination', [ |
| 33 | 33 | 'total' => $maxPageCount, |
| 34 | - ]); |
|
| 35 | - parent::__construct( $reviews, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS ); |
|
| 34 | + ] ); |
|
| 35 | + parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | 'navigation' => $this->getNavigation(), |
| 59 | 59 | 'reviews' => $this->getReviews(), |
| 60 | 60 | ], |
| 61 | - ]); |
|
| 61 | + ] ); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $defaults[] = 'glsr-ajax-pagination'; |
| 74 | 74 | } |
| 75 | 75 | $classes = explode( ' ', $this->args['class'] ); |
| 76 | - $classes = array_unique( array_merge( $defaults, $classes )); |
|
| 76 | + $classes = array_unique( array_merge( $defaults, $classes ) ); |
|
| 77 | 77 | return implode( ' ', $classes ); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | protected function getReviews() |
| 94 | 94 | { |
| 95 | - return empty( $this->reviews ) |
|
| 95 | + return empty($this->reviews) |
|
| 96 | 96 | ? $this->getReviewsFallback() |
| 97 | 97 | : implode( PHP_EOL, $this->reviews ); |
| 98 | 98 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | protected function getReviewsFallback() |
| 104 | 104 | { |
| 105 | - if( empty( $this->args['fallback'] ) && glsr( OptionManager::class )->getBool( 'settings.reviews.fallback' )) { |
|
| 105 | + if( empty($this->args['fallback']) && glsr( OptionManager::class )->getBool( 'settings.reviews.fallback' ) ) { |
|
| 106 | 106 | $this->args['fallback'] = __( 'There are no reviews yet. Be the first one to write one.', 'site-reviews' ); |
| 107 | 107 | } |
| 108 | 108 | $fallback = '<p class="glsr-no-margins">'.$this->args['fallback'].'</p>'; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | defined( 'WPINC' ) || die; |
| 20 | 20 | |
| 21 | -if( !class_exists( 'GL_Plugin_Check_v3' )) { |
|
| 21 | +if( !class_exists( 'GL_Plugin_Check_v3' ) ) { |
|
| 22 | 22 | require_once __DIR__.'/activate.php'; |
| 23 | 23 | } |
| 24 | 24 | $check = new GL_Plugin_Check_v3( __FILE__ ); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $app = new GeminiLabs\SiteReviews\Application; |
| 32 | 32 | $app->make( 'Provider' )->register( $app ); |
| 33 | -register_activation_hook( __FILE__, array( $app, 'activate' )); |
|
| 34 | -register_deactivation_hook( __FILE__, array( $app, 'deactivate' )); |
|
| 35 | -register_shutdown_function( array( $app, 'catchFatalError' )); |
|
| 33 | +register_activation_hook( __FILE__, array( $app, 'activate' ) ); |
|
| 34 | +register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) ); |
|
| 35 | +register_shutdown_function( array( $app, 'catchFatalError' ) ); |
|
| 36 | 36 | $app->init(); |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | 'glsr_log', |
| 21 | 21 | 'glsr_star_rating', |
| 22 | 22 | ); |
| 23 | - if( !in_array( $hook, $hooks ) || !function_exists( $hook ))return; |
|
| 24 | - add_filter( $hook, function() use( $hook, $args ) { |
|
| 23 | + if( !in_array( $hook, $hooks ) || !function_exists( $hook ) )return; |
|
| 24 | + add_filter( $hook, function() use($hook, $args) { |
|
| 25 | 25 | array_shift( $args ); // remove the fallback value |
| 26 | 26 | return call_user_func_array( $hook, $args ); |
| 27 | 27 | }); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | function glsr( $alias = null ) { |
| 34 | 34 | $app = \GeminiLabs\SiteReviews\Application::load(); |
| 35 | - return !empty( $alias ) |
|
| 35 | + return !empty($alias) |
|
| 36 | 36 | ? $app->make( $alias ) |
| 37 | 37 | : $app; |
| 38 | 38 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $result = array(); |
| 47 | 47 | foreach( $array as $subarray ) { |
| 48 | 48 | $subarray = (array)$subarray; |
| 49 | - if( !isset( $subarray[$column] ))continue; |
|
| 49 | + if( !isset($subarray[$column]) )continue; |
|
| 50 | 50 | $result[] = $subarray[$column]; |
| 51 | 51 | } |
| 52 | 52 | return $result; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | function glsr_calculate_ratings() { |
| 59 | 59 | glsr( 'Controllers\AdminController' )->routerCountReviews( false ); |
| 60 | - glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' )); |
|
| 60 | + glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' ) ); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | * @return \WP_Screen|object |
| 75 | 75 | */ |
| 76 | 76 | function glsr_current_screen() { |
| 77 | - if( function_exists( 'get_current_screen' )) { |
|
| 77 | + if( function_exists( 'get_current_screen' ) ) { |
|
| 78 | 78 | $screen = get_current_screen(); |
| 79 | 79 | } |
| 80 | - return empty( $screen ) |
|
| 80 | + return empty($screen) |
|
| 81 | 81 | ? (object)array_fill_keys( ['base', 'id', 'post_type'], null ) |
| 82 | 82 | : $screen; |
| 83 | 83 | } |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | function glsr_get_review( $post_id ) { |
| 136 | 136 | $post = null; |
| 137 | - if( is_numeric( $post_id )) { |
|
| 137 | + if( is_numeric( $post_id ) ) { |
|
| 138 | 138 | $post = get_post( $post_id ); |
| 139 | 139 | } |
| 140 | - if( !( $post instanceof WP_Post )) { |
|
| 140 | + if( !($post instanceof WP_Post) ) { |
|
| 141 | 141 | $post = new WP_Post( (object)[] ); |
| 142 | 142 | } |
| 143 | 143 | return glsr( 'Database\ReviewManager' )->single( $post ); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @return array |
| 148 | 148 | */ |
| 149 | 149 | function glsr_get_reviews( $args = array() ) { |
| 150 | - return glsr( 'Database\ReviewManager' )->get( glsr( 'Helper' )->consolidateArray( $args )); |
|
| 150 | + return glsr( 'Database\ReviewManager' )->get( glsr( 'Helper' )->consolidateArray( $args ) ); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | $args = func_get_args(); |
| 158 | 158 | $console = glsr( 'Modules\Console' ); |
| 159 | 159 | $value = glsr( 'Helper' )->dataGet( $args, '0' ); |
| 160 | - return !empty( $value ) |
|
| 161 | - ? $console->log( 'debug', $value, glsr( 'Helper' )->dataGet( $args, '1', [] )) |
|
| 160 | + return !empty($value) |
|
| 161 | + ? $console->log( 'debug', $value, glsr( 'Helper' )->dataGet( $args, '1', [] ) ) |
|
| 162 | 162 | : $console; |
| 163 | 163 | } |
| 164 | 164 | |
@@ -30,25 +30,25 @@ discard block |
||
| 30 | 30 | public function __construct( $input ) |
| 31 | 31 | { |
| 32 | 32 | $this->request = $input; |
| 33 | - $this->ajax_request = isset( $input['_ajax_request'] ); |
|
| 33 | + $this->ajax_request = isset($input['_ajax_request']); |
|
| 34 | 34 | $this->assigned_to = $this->getNumeric( 'assign_to' ); |
| 35 | - $this->author = sanitize_text_field( $this->getUser( 'name' )); |
|
| 35 | + $this->author = sanitize_text_field( $this->getUser( 'name' ) ); |
|
| 36 | 36 | $this->avatar = $this->getAvatar(); |
| 37 | - $this->blacklisted = isset( $input['blacklisted'] ); |
|
| 38 | - $this->category = sanitize_key( $this->get( 'category' )); |
|
| 39 | - $this->content = sanitize_textarea_field( $this->get( 'content' )); |
|
| 37 | + $this->blacklisted = isset($input['blacklisted']); |
|
| 38 | + $this->category = sanitize_key( $this->get( 'category' ) ); |
|
| 39 | + $this->content = sanitize_textarea_field( $this->get( 'content' ) ); |
|
| 40 | 40 | $this->custom = $this->getCustom(); |
| 41 | 41 | $this->date = $this->getDate( 'date' ); |
| 42 | - $this->email = sanitize_email( $this->getUser( 'email' )); |
|
| 43 | - $this->form_id = sanitize_key( $this->get( 'form_id' )); |
|
| 42 | + $this->email = sanitize_email( $this->getUser( 'email' ) ); |
|
| 43 | + $this->form_id = sanitize_key( $this->get( 'form_id' ) ); |
|
| 44 | 44 | $this->ip_address = $this->get( 'ip_address' ); |
| 45 | - $this->post_id = intval( $this->get( '_post_id' )); |
|
| 46 | - $this->rating = intval( $this->get( 'rating' )); |
|
| 45 | + $this->post_id = intval( $this->get( '_post_id' ) ); |
|
| 46 | + $this->rating = intval( $this->get( 'rating' ) ); |
|
| 47 | 47 | $this->referer = $this->get( '_referer' ); |
| 48 | - $this->response = sanitize_textarea_field( $this->get( 'response' )); |
|
| 49 | - $this->terms = !empty( $input['terms'] ); |
|
| 50 | - $this->title = sanitize_text_field( $this->get( 'title' )); |
|
| 51 | - $this->url = esc_url_raw( $this->get( 'url' )); |
|
| 48 | + $this->response = sanitize_textarea_field( $this->get( 'response' ) ); |
|
| 49 | + $this->terms = !empty($input['terms']); |
|
| 50 | + $this->title = sanitize_text_field( $this->get( 'title' ) ); |
|
| 51 | + $this->url = esc_url_raw( $this->get( 'url' ) ); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $avatar = $this->get( 'avatar' ); |
| 69 | 69 | return !filter_var( $avatar, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED ) |
| 70 | - ? (string)get_avatar_url( $this->get( 'email' )) |
|
| 70 | + ? (string)get_avatar_url( $this->get( 'email' ) ) |
|
| 71 | 71 | : $avatar; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $unset = apply_filters( 'site-reviews/create/unset-keys-from-custom', $unset ); |
| 85 | 85 | $custom = $this->request; |
| 86 | 86 | foreach( $unset as $value ) { |
| 87 | - unset( $custom[$value] ); |
|
| 87 | + unset($custom[$value]); |
|
| 88 | 88 | } |
| 89 | 89 | return $custom; |
| 90 | 90 | } |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | protected function getDate( $key ) |
| 97 | 97 | { |
| 98 | - $date = strtotime( $this->get( $key )); |
|
| 98 | + $date = strtotime( $this->get( $key ) ); |
|
| 99 | 99 | if( $date === false ) { |
| 100 | 100 | $date = time(); |
| 101 | 101 | } |
| 102 | - return get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $date )); |
|
| 102 | + return get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $date ) ); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -109,13 +109,13 @@ discard block |
||
| 109 | 109 | protected function getUser( $key ) |
| 110 | 110 | { |
| 111 | 111 | $value = $this->get( $key ); |
| 112 | - if( empty( $value )) { |
|
| 112 | + if( empty($value) ) { |
|
| 113 | 113 | $user = wp_get_current_user(); |
| 114 | 114 | $userValues = [ |
| 115 | 115 | 'email' => 'user_email', |
| 116 | 116 | 'name' => 'display_name', |
| 117 | 117 | ]; |
| 118 | - if( $user->exists() && array_key_exists( $key, $userValues )) { |
|
| 118 | + if( $user->exists() && array_key_exists( $key, $userValues ) ) { |
|
| 119 | 119 | return $user->{$userValues[$key]}; |
| 120 | 120 | } |
| 121 | 121 | } |