@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | foreach( $args as $key => $value ) { |
| 32 | 32 | $property = glsr( Helper::class )->buildPropertyName( $key ); |
| 33 | - if( !property_exists( $this, $property ))continue; |
|
| 33 | + if( !property_exists( $this, $property ) )continue; |
|
| 34 | 34 | $this->$property = $value; |
| 35 | - unset( $args[$key] ); |
|
| 35 | + unset($args[$key]); |
|
| 36 | 36 | } |
| 37 | 37 | $this->args = wp_parse_args( $args, [ |
| 38 | 38 | 'menu_name' => $this->plural, |
| 39 | - ]); |
|
| 39 | + ] ); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | 'singular_name' => $this->single, |
| 60 | 60 | 'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Uploaded to this Post', 'site-reviews' ), $this->single ), |
| 61 | 61 | 'view_item' => sprintf( _x( 'View %s', 'View Post', 'site-reviews' ), $this->single ), |
| 62 | - ]); |
|
| 63 | - unset( $this->args['menu_name'] ); |
|
| 62 | + ] ); |
|
| 63 | + unset($this->args['menu_name']); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | protected function normalizeColumns() |
| 70 | 70 | { |
| 71 | 71 | $this->columns = ['cb' => ''] + $this->columns; |
| 72 | - if( array_key_exists( 'category', $this->columns )) { |
|
| 72 | + if( array_key_exists( 'category', $this->columns ) ) { |
|
| 73 | 73 | $keys = array_keys( $this->columns ); |
| 74 | 74 | $keys[array_search( 'category', $keys )] = 'taxonomy-'.Application::TAXONOMY; |
| 75 | 75 | $this->columns = array_combine( $keys, $this->columns ); |
| 76 | 76 | } |
| 77 | - if( array_key_exists( 'pinned', $this->columns )) { |
|
| 77 | + if( array_key_exists( 'pinned', $this->columns ) ) { |
|
| 78 | 78 | $this->columns['pinned'] = glsr( Builder::class )->span( '<span>'.$this->columns['pinned'].'</span>', |
| 79 | 79 | ['class' => 'pinned-icon'] |
| 80 | 80 | ); |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function buildPlainTextMessage( PHPMailer $phpmailer ) |
| 92 | 92 | { |
| 93 | - if( empty( $this->email ))return; |
|
| 94 | - if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return; |
|
| 93 | + if( empty($this->email) )return; |
|
| 94 | + if( $phpmailer->ContentType === 'text/plain' || !empty($phpmailer->AltBody) )return; |
|
| 95 | 95 | $message = $this->stripHtmlTags( $phpmailer->Body ); |
| 96 | 96 | $phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this ); |
| 97 | 97 | } |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | $allowed = [ |
| 105 | 105 | 'bcc', 'cc', 'from', 'reply-to', |
| 106 | 106 | ]; |
| 107 | - $headers = array_intersect_key( $this->email, array_flip( $allowed )); |
|
| 107 | + $headers = array_intersect_key( $this->email, array_flip( $allowed ) ); |
|
| 108 | 108 | $headers = array_filter( $headers ); |
| 109 | 109 | foreach( $headers as $key => $value ) { |
| 110 | - unset( $headers[$key] ); |
|
| 110 | + unset($headers[$key]); |
|
| 111 | 111 | $headers[] = $key.': '.$value; |
| 112 | 112 | } |
| 113 | 113 | $headers[] = 'Content-Type: text/html'; |
@@ -119,16 +119,16 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | protected function buildHtmlMessage() |
| 121 | 121 | { |
| 122 | - $template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' )); |
|
| 123 | - if( !empty( $template )) { |
|
| 122 | + $template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ) ); |
|
| 123 | + if( !empty($template) ) { |
|
| 124 | 124 | $message = glsr( Template::class )->interpolate( $template, $this->email['template-tags'] ); |
| 125 | 125 | } |
| 126 | 126 | else if( $this->email['template'] ) { |
| 127 | 127 | $message = glsr( Template::class )->build( 'templates/'.$this->email['template'], [ |
| 128 | 128 | 'context' => $this->email['template-tags'], |
| 129 | - ]); |
|
| 129 | + ] ); |
|
| 130 | 130 | } |
| 131 | - if( !isset( $message )) { |
|
| 131 | + if( !isset($message) ) { |
|
| 132 | 132 | $message = $this->email['message']; |
| 133 | 133 | } |
| 134 | 134 | $message = $this->email['before'].$message.$this->email['after']; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $message = str_replace( ']]>', ']]>', $message ); |
| 140 | 140 | $message = glsr( Template::class )->build( 'partials/email/index', [ |
| 141 | 141 | 'context' => ['message' => $message], |
| 142 | - ]); |
|
| 142 | + ] ); |
|
| 143 | 143 | return apply_filters( 'site-reviews/email/message', stripslashes( $message ), 'html', $this ); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | protected function normalize( array $email = [] ) |
| 150 | 150 | { |
| 151 | 151 | $email = shortcode_atts( glsr( EmailDefaults::class )->defaults(), $email ); |
| 152 | - if( empty( $email['reply-to'] )) { |
|
| 152 | + if( empty($email['reply-to']) ) { |
|
| 153 | 153 | $email['reply-to'] = $email['from']; |
| 154 | 154 | } |
| 155 | 155 | $this->email = apply_filters( 'site-reviews/email/compose', $email, $this ); |
@@ -10,13 +10,13 @@ |
||
| 10 | 10 | <p>{{ description }}</p> |
| 11 | 11 | </div> |
| 12 | 12 | <div class="glsr-addon-footer"> |
| 13 | - <?php if( !is_wp_error( validate_plugin( $plugin ))) : ?> |
|
| 14 | - <?php if( is_plugin_active( $plugin )) : ?> |
|
| 13 | + <?php if( !is_wp_error( validate_plugin( $plugin ) ) ) : ?> |
|
| 14 | + <?php if( is_plugin_active( $plugin ) ) : ?> |
|
| 15 | 15 | <span class="glsr-addon-link button button-secondary" disabled> |
| 16 | 16 | <?= __( 'Installed', 'site-reviews' ); ?> |
| 17 | 17 | </span> |
| 18 | 18 | <?php else: ?> |
| 19 | - <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin );?>" class="glsr-addon-link button button-secondary"> |
|
| 19 | + <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin ); ?>" class="glsr-addon-link button button-secondary"> |
|
| 20 | 20 | <?= __( 'Activate', 'site-reviews' ); ?> |
| 21 | 21 | </a> |
| 22 | 22 | <?php endif; ?> |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $this->versions = wp_parse_args( $versions, array( |
| 31 | 31 | 'php' => static::MIN_PHP_VERSION, |
| 32 | 32 | 'wordpress' => static::MIN_WORDPRESS_VERSION, |
| 33 | - )); |
|
| 33 | + ) ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | if( $this->isValid() ) { |
| 42 | 42 | return true; |
| 43 | 43 | } |
| 44 | - add_action( 'activated_plugin', array( $this, 'deactivate' )); |
|
| 45 | - add_action( 'admin_notices', array( $this, 'deactivate' )); |
|
| 44 | + add_action( 'activated_plugin', array( $this, 'deactivate' ) ); |
|
| 45 | + add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | filter_input( INPUT_GET, 'plugin_status' ), |
| 138 | 138 | filter_input( INPUT_GET, 'paged' ), |
| 139 | 139 | filter_input( INPUT_GET, 's' ) |
| 140 | - ))); |
|
| 140 | + ) ) ); |
|
| 141 | 141 | exit; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function __call( $method, array $arguments ) |
| 41 | 41 | { |
| 42 | - $value = isset( $arguments[0] ) |
|
| 42 | + $value = isset($arguments[0]) |
|
| 43 | 43 | ? $arguments[0] |
| 44 | 44 | : ''; |
| 45 | 45 | return $this->setProperty( $method, $value ); |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | * @param mixed $default |
| 97 | 97 | * @return mixed |
| 98 | 98 | */ |
| 99 | - public function getProperty( $property, $default = null) |
|
| 99 | + public function getProperty( $property, $default = null ) |
|
| 100 | 100 | { |
| 101 | - return isset( $this->properties[$property] ) |
|
| 101 | + return isset($this->properties[$property]) |
|
| 102 | 102 | ? $this->properties[$property] |
| 103 | 103 | : $default; |
| 104 | 104 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function offsetUnset( $offset ) |
| 168 | 168 | { |
| 169 | - unset( $this->properties[$offset] ); |
|
| 169 | + unset($this->properties[$offset]); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -212,16 +212,16 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | protected function getParents( $parents = null ) |
| 214 | 214 | { |
| 215 | - if( !isset( $parents )) { |
|
| 215 | + if( !isset($parents) ) { |
|
| 216 | 216 | $parents = $this->parents; |
| 217 | 217 | } |
| 218 | 218 | $newParents = $parents; |
| 219 | 219 | foreach( $parents as $parent ) { |
| 220 | 220 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 221 | - if( !class_exists( $parentClass ))continue; |
|
| 222 | - $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents )); |
|
| 221 | + if( !class_exists( $parentClass ) )continue; |
|
| 222 | + $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents ) ); |
|
| 223 | 223 | } |
| 224 | - return array_values( array_unique( $newParents )); |
|
| 224 | + return array_values( array_unique( $newParents ) ); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | $parents = $this->getParents(); |
| 233 | 233 | foreach( $parents as $parent ) { |
| 234 | 234 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 235 | - if( !class_exists( $parentClass ))continue; |
|
| 236 | - $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ))); |
|
| 235 | + if( !class_exists( $parentClass ) )continue; |
|
| 236 | + $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ) ) ); |
|
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
@@ -243,17 +243,17 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | protected function serializeProperty( $property ) |
| 245 | 245 | { |
| 246 | - if( is_array( $property )) { |
|
| 246 | + if( is_array( $property ) ) { |
|
| 247 | 247 | return array_map( [$this, 'serializeProperty'], $property ); |
| 248 | 248 | } |
| 249 | 249 | if( $property instanceof Type ) { |
| 250 | 250 | $property = $property->toArray(); |
| 251 | - unset( $property['@context'] ); |
|
| 251 | + unset($property['@context']); |
|
| 252 | 252 | } |
| 253 | 253 | if( $property instanceof DateTimeInterface ) { |
| 254 | 254 | $property = $property->format( DateTime::ATOM ); |
| 255 | 255 | } |
| 256 | - if( is_object( $property )) { |
|
| 256 | + if( is_object( $property ) ) { |
|
| 257 | 257 | throw new InvalidProperty(); |
| 258 | 258 | } |
| 259 | 259 | return $property; |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function approve() |
| 23 | 23 | { |
| 24 | - check_admin_referer( 'approve-review_'.( $postId = $this->getPostId() )); |
|
| 25 | - wp_update_post([ |
|
| 24 | + check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) ); |
|
| 25 | + wp_update_post( [ |
|
| 26 | 26 | 'ID' => $postId, |
| 27 | 27 | 'post_status' => 'publish', |
| 28 | - ]); |
|
| 28 | + ] ); |
|
| 29 | 29 | wp_safe_redirect( wp_get_referer() ); |
| 30 | 30 | exit; |
| 31 | 31 | } |
@@ -54,11 +54,11 @@ 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) )continue; |
|
| 58 | 58 | $value = $columns[$key]; |
| 59 | 59 | } |
| 60 | - if( count( glsr( Database::class )->getReviewsMeta( 'review_type' )) < 2 ) { |
|
| 61 | - unset( $postTypeColumns['review_type'] ); |
|
| 60 | + if( count( glsr( Database::class )->getReviewsMeta( 'review_type' ) ) < 2 ) { |
|
| 61 | + unset($postTypeColumns['review_type']); |
|
| 62 | 62 | } |
| 63 | 63 | return array_filter( $postTypeColumns, 'strlen' ); |
| 64 | 64 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function filterPostStates( array $postStates, WP_Post $post ) { |
| 96 | 96 | if( $post->post_type == Application::POST_TYPE |
| 97 | - && array_key_exists( 'pending', $postStates )) { |
|
| 97 | + && array_key_exists( 'pending', $postStates ) ) { |
|
| 98 | 98 | $postStates['pending'] = __( 'Unapproved', 'site-reviews' ); |
| 99 | 99 | } |
| 100 | 100 | return $postStates; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | if( $post->post_type != Application::POST_TYPE || $post->post_status == 'trash' ) { |
| 110 | 110 | return $actions; |
| 111 | 111 | } |
| 112 | - unset( $actions['inline hide-if-no-js'] ); //Remove Quick-edit |
|
| 112 | + unset($actions['inline hide-if-no-js']); //Remove Quick-edit |
|
| 113 | 113 | $rowActions = [ |
| 114 | 114 | 'approve' => esc_attr__( 'Approve', 'site-reviews' ), |
| 115 | 115 | 'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ), |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | admin_url( 'post.php?post='.$post->ID.'&action='.$key ), |
| 124 | 124 | $key.'-review_'.$post->ID |
| 125 | 125 | ), |
| 126 | - ]); |
|
| 126 | + ] ); |
|
| 127 | 127 | } |
| 128 | 128 | return $newActions + $actions; |
| 129 | 129 | } |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | public function filterSortableColumns( array $columns ) |
| 136 | 136 | { |
| 137 | 137 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
| 138 | - unset( $postTypeColumns['cb'] ); |
|
| 138 | + unset($postTypeColumns['cb']); |
|
| 139 | 139 | foreach( $postTypeColumns as $key => $value ) { |
| 140 | - if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue; |
|
| 140 | + if( glsr( Helper::class )->startsWith( 'taxonomy', $key ) )continue; |
|
| 141 | 141 | $columns[$key] = $key; |
| 142 | 142 | } |
| 143 | 143 | return $columns; |
@@ -155,18 +155,18 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function filterStatusText( $translation, $single, $plural, $number, $domain ) |
| 157 | 157 | { |
| 158 | - if( $this->canModifyTranslation( $domain )) { |
|
| 158 | + if( $this->canModifyTranslation( $domain ) ) { |
|
| 159 | 159 | $strings = [ |
| 160 | 160 | 'Published' => __( 'Approved', 'site-reviews' ), |
| 161 | 161 | 'Pending' => __( 'Unapproved', 'site-reviews' ), |
| 162 | 162 | ]; |
| 163 | 163 | foreach( $strings as $search => $replace ) { |
| 164 | 164 | if( strpos( $single, $search ) === false )continue; |
| 165 | - $translation = $this->getTranslation([ |
|
| 165 | + $translation = $this->getTranslation( [ |
|
| 166 | 166 | 'number' => $number, |
| 167 | 167 | 'plural' => str_replace( $search, $replace, $plural ), |
| 168 | 168 | 'single' => str_replace( $search, $replace, $single ), |
| 169 | - ]); |
|
| 169 | + ] ); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | return $translation; |
@@ -213,9 +213,9 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function saveBulkEditFields( $postId ) |
| 215 | 215 | { |
| 216 | - if( !current_user_can( 'edit_posts' ))return; |
|
| 216 | + if( !current_user_can( 'edit_posts' ) )return; |
|
| 217 | 217 | $assignedTo = filter_input( INPUT_GET, 'assigned_to' ); |
| 218 | - if( $assignedTo && get_post( $assignedTo )) { |
|
| 218 | + if( $assignedTo && get_post( $assignedTo ) ) { |
|
| 219 | 219 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
| 220 | 220 | } |
| 221 | 221 | } |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | public function setQueryForColumn( WP_Query $query ) |
| 228 | 228 | { |
| 229 | - if( !$this->hasPermission( $query ))return; |
|
| 229 | + if( !$this->hasPermission( $query ) )return; |
|
| 230 | 230 | $this->setMetaQuery( $query, [ |
| 231 | 231 | 'rating', 'review_type', |
| 232 | - ]); |
|
| 232 | + ] ); |
|
| 233 | 233 | $this->setOrderby( $query ); |
| 234 | 234 | } |
| 235 | 235 | |
@@ -239,11 +239,11 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public function unapprove() |
| 241 | 241 | { |
| 242 | - check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() )); |
|
| 243 | - wp_update_post([ |
|
| 242 | + check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) ); |
|
| 243 | + wp_update_post( [ |
|
| 244 | 244 | 'ID' => $postId, |
| 245 | 245 | 'post_status' => 'pending', |
| 246 | - ]); |
|
| 246 | + ] ); |
|
| 247 | 247 | wp_safe_redirect( wp_get_referer() ); |
| 248 | 248 | exit; |
| 249 | 249 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | 'single' => '', |
| 274 | 274 | 'text' => '', |
| 275 | 275 | ]; |
| 276 | - $args = (object) wp_parse_args( $args, $defaults ); |
|
| 276 | + $args = (object)wp_parse_args( $args, $defaults ); |
|
| 277 | 277 | $translations = get_translations_for_domain( Application::ID ); |
| 278 | 278 | return $args->text |
| 279 | 279 | ? $translations->translate( $args->text ) |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | protected function setMetaQuery( WP_Query $query, array $metaKeys ) |
| 299 | 299 | { |
| 300 | 300 | foreach( $metaKeys as $key ) { |
| 301 | - if( !( $value = filter_input( INPUT_GET, $key )))continue; |
|
| 301 | + if( !($value = filter_input( INPUT_GET, $key )) )continue; |
|
| 302 | 302 | $metaQuery = (array)$query->get( 'meta_query' ); |
| 303 | 303 | $metaQuery[] = [ |
| 304 | 304 | 'key' => $key, |
@@ -315,8 +315,8 @@ discard block |
||
| 315 | 315 | { |
| 316 | 316 | $orderby = $query->get( 'orderby' ); |
| 317 | 317 | $columns = glsr()->postTypeColumns[Application::POST_TYPE]; |
| 318 | - unset( $columns['cb'], $columns['title'], $columns['date'] ); |
|
| 319 | - if( in_array( $orderby, array_keys( $columns ))) { |
|
| 318 | + unset($columns['cb'], $columns['title'], $columns['date']); |
|
| 319 | + if( in_array( $orderby, array_keys( $columns ) ) ) { |
|
| 320 | 320 | $query->set( 'meta_key', $orderby ); |
| 321 | 321 | $query->set( 'orderby', 'meta_value' ); |
| 322 | 322 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | 'is_valid' => true, |
| 28 | 28 | 'is_widget' => false, |
| 29 | 29 | 'path' => '', |
| 30 | - ]); |
|
| 30 | + ] ); |
|
| 31 | 31 | $this->normalize(); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | if( !$this->field['is_valid'] )return; |
| 48 | 48 | if( $this->field['is_raw'] ) { |
| 49 | - return glsr( Builder::class )->{$this->field['type']}( $this->field ); |
|
| 49 | + return glsr( Builder::class )->{$this->field['type']}($this->field); |
|
| 50 | 50 | } |
| 51 | 51 | if( !$this->field['is_setting'] ) { |
| 52 | 52 | return $this->buildField(); |
@@ -75,15 +75,15 @@ discard block |
||
| 75 | 75 | 'class' => $this->getFieldClass(), |
| 76 | 76 | 'errors' => $this->getFieldErrors(), |
| 77 | 77 | 'field' => glsr( Builder::class )->raw( $this->field ), |
| 78 | - 'label' => glsr( Builder::class )->label([ |
|
| 78 | + 'label' => glsr( Builder::class )->label( [ |
|
| 79 | 79 | 'class' => 'glsr-'.$this->field['type'].'-label', |
| 80 | 80 | 'for' => $this->field['id'], |
| 81 | 81 | 'is_public' => $this->field['is_public'], |
| 82 | 82 | 'text' => $this->field['label'].'<span></span>', |
| 83 | 83 | 'type' => $this->field['type'], |
| 84 | - ]), |
|
| 84 | + ] ), |
|
| 85 | 85 | ], |
| 86 | - ]); |
|
| 86 | + ] ); |
|
| 87 | 87 | return apply_filters( 'site-reviews/rendered/field', $field, $this->field['type'], $this->field ); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | return glsr( Template::class )->build( 'partials/form/table-row', [ |
| 96 | 96 | 'context' => [ |
| 97 | 97 | 'class' => $this->getFieldClass(), |
| 98 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
| 98 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
| 99 | 99 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
| 100 | 100 | ], |
| 101 | - ]); |
|
| 101 | + ] ); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -107,16 +107,16 @@ discard block |
||
| 107 | 107 | protected function buildSettingMultiField() |
| 108 | 108 | { |
| 109 | 109 | $dependsOn = $this->getFieldDependsOn(); |
| 110 | - unset( $this->field['data-depends'] ); |
|
| 110 | + unset($this->field['data-depends']); |
|
| 111 | 111 | return glsr( Template::class )->build( 'partials/form/table-row-multiple', [ |
| 112 | 112 | 'context' => [ |
| 113 | 113 | 'class' => $this->getFieldClass(), |
| 114 | 114 | 'depends_on' => $dependsOn, |
| 115 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
| 115 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
| 116 | 116 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
| 117 | 117 | 'legend' => $this->field['legend'], |
| 118 | 118 | ], |
| 119 | - ]); |
|
| 119 | + ] ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -125,13 +125,13 @@ discard block |
||
| 125 | 125 | protected function getFieldClass() |
| 126 | 126 | { |
| 127 | 127 | $classes = []; |
| 128 | - if( !empty( $this->field['errors'] )) { |
|
| 128 | + if( !empty($this->field['errors']) ) { |
|
| 129 | 129 | $classes[] = 'glsr-has-error'; |
| 130 | 130 | } |
| 131 | 131 | if( $this->field['is_hidden'] ) { |
| 132 | 132 | $classes[] = 'hidden'; |
| 133 | 133 | } |
| 134 | - if( !empty( $this->field['required'] )) { |
|
| 134 | + if( !empty($this->field['required']) ) { |
|
| 135 | 135 | $classes[] = 'glsr-required'; |
| 136 | 136 | } |
| 137 | 137 | return implode( ' ', $classes ); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | protected function getFieldDependsOn() |
| 144 | 144 | { |
| 145 | - return !empty( $this->field['data-depends'] ) |
|
| 145 | + return !empty($this->field['data-depends']) |
|
| 146 | 146 | ? $this->field['data-depends'] |
| 147 | 147 | : ''; |
| 148 | 148 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | protected function getFieldErrors() |
| 154 | 154 | { |
| 155 | - if( empty( $this->field['errors'] ) || !is_array( $this->field['errors'] ))return; |
|
| 155 | + if( empty($this->field['errors']) || !is_array( $this->field['errors'] ) )return; |
|
| 156 | 156 | $errors = array_reduce( $this->field['errors'], function( $carry, $error ) { |
| 157 | 157 | return $carry.glsr( Builder::class )->span( $error, ['class' => 'glsr-field-error'] ); |
| 158 | 158 | }); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | 'context' => [ |
| 161 | 161 | 'errors' => $errors, |
| 162 | 162 | ], |
| 163 | - ]); |
|
| 163 | + ] ); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -183,13 +183,13 @@ discard block |
||
| 183 | 183 | 'name', 'type', |
| 184 | 184 | ]; |
| 185 | 185 | foreach( $requiredValues as $value ) { |
| 186 | - if( isset( $this->field[$value] ))continue; |
|
| 186 | + if( isset($this->field[$value]) )continue; |
|
| 187 | 187 | $missingValues[] = $value; |
| 188 | 188 | $this->field['is_valid'] = false; |
| 189 | 189 | } |
| 190 | - if( !empty( $missingValues )) { |
|
| 190 | + if( !empty($missingValues) ) { |
|
| 191 | 191 | glsr_log() |
| 192 | - ->warning( 'Field is missing: '.implode( ', ', $missingValues )) |
|
| 192 | + ->warning( 'Field is missing: '.implode( ', ', $missingValues ) ) |
|
| 193 | 193 | ->info( $this->field ); |
| 194 | 194 | } |
| 195 | 195 | return $this->field['is_valid']; |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | if( !$this->isFieldValid() )return; |
| 204 | 204 | $this->field['path'] = $this->field['name']; |
| 205 | 205 | $className = glsr( Helper::class )->buildClassName( $this->field['type'], __NAMESPACE__.'\Fields' ); |
| 206 | - if( class_exists( $className )) { |
|
| 206 | + if( class_exists( $className ) ) { |
|
| 207 | 207 | $this->field = array_merge( |
| 208 | 208 | wp_parse_args( $this->field, $className::defaults() ), |
| 209 | 209 | $className::required() |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | protected function normalizeFieldId() |
| 220 | 220 | { |
| 221 | - if( isset( $this->field['id'] ) || $this->field['is_raw'] )return; |
|
| 221 | + if( isset($this->field['id']) || $this->field['is_raw'] )return; |
|
| 222 | 222 | $this->field['id'] = glsr( Helper::class )->convertPathToId( |
| 223 | 223 | $this->field['path'], |
| 224 | 224 | $this->getFieldPrefix() |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function saveAssignedToMetabox( $postId ) |
| 15 | 15 | { |
| 16 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
| 17 | - $assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' )); |
|
| 16 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ) )return; |
|
| 17 | + $assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ) ); |
|
| 18 | 18 | if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) { |
| 19 | - $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
|
| 19 | + $review = glsr( ReviewManager::class )->single( get_post( $postId ) ); |
|
| 20 | 20 | glsr( CountsManager::class )->decreasePostCounts( $review ); |
| 21 | 21 | } |
| 22 | 22 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function saveResponseMetabox( $postId ) |
| 30 | 30 | { |
| 31 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return; |
|
| 32 | - $response = strval( glsr( Helper::class )->filterInput( 'response' )); |
|
| 31 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ) )return; |
|
| 32 | + $response = strval( glsr( Helper::class )->filterInput( 'response' ) ); |
|
| 33 | 33 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
| 34 | 34 | 'a' => ['href' => [], 'title' => []], |
| 35 | 35 | 'em' => [], |
| 36 | 36 | 'strong' => [], |
| 37 | - ]))); |
|
| 37 | + ] ) ) ); |
|
| 38 | 38 | } |
| 39 | 39 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | if( strpos( $message, '%s' ) === false ) { |
| 29 | 29 | return $message; |
| 30 | 30 | } |
| 31 | - return preg_replace_callback( '/(%s)/', function() use( &$parameters ) { |
|
| 31 | + return preg_replace_callback( '/(%s)/', function() use(&$parameters) { |
|
| 32 | 32 | foreach( $parameters as $key => $value ) { |
| 33 | 33 | return array_shift( $parameters ); |
| 34 | 34 | } |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | public function validateRequired( $value ) |
| 114 | 114 | { |
| 115 | 115 | return is_null( $value ) |
| 116 | - || ( is_string( $value ) && trim( $value ) === '' ) |
|
| 117 | - || ( is_array( $value ) && count( $value ) < 1 ) |
|
| 116 | + || (is_string( $value ) && trim( $value ) === '') |
|
| 117 | + || (is_array( $value ) && count( $value ) < 1) |
|
| 118 | 118 | ? false |
| 119 | 119 | : true; |
| 120 | 120 | } |