@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | public function approve() |
23 | 23 | { |
24 | 24 | if( filter_input( INPUT_GET, 'plugin' ) != Application::ID )return; |
25 | - check_admin_referer( 'approve-review_'.( $postId = $this->getPostId() )); |
|
26 | - wp_update_post([ |
|
25 | + check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) ); |
|
26 | + wp_update_post( [ |
|
27 | 27 | 'ID' => $postId, |
28 | 28 | 'post_status' => 'publish', |
29 | - ]); |
|
29 | + ] ); |
|
30 | 30 | wp_safe_redirect( wp_get_referer() ); |
31 | 31 | exit; |
32 | 32 | } |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | $columns = glsr( Helper::class )->consolidateArray( $columns ); |
60 | 60 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
61 | 61 | foreach( $postTypeColumns as $key => &$value ) { |
62 | - if( !array_key_exists( $key, $columns ) || !empty( $value ))continue; |
|
62 | + if( !array_key_exists( $key, $columns ) || !empty($value) )continue; |
|
63 | 63 | $value = $columns[$key]; |
64 | 64 | } |
65 | - if( count( glsr( Database::class )->getReviewsMeta( 'review_type' )) < 2 ) { |
|
66 | - unset( $postTypeColumns['review_type'] ); |
|
65 | + if( count( glsr( Database::class )->getReviewsMeta( 'review_type' ) ) < 2 ) { |
|
66 | + unset($postTypeColumns['review_type']); |
|
67 | 67 | } |
68 | 68 | return array_filter( $postTypeColumns, 'strlen' ); |
69 | 69 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function filterPostStates( $postStates, WP_Post $post ) { |
104 | 104 | $postStates = glsr( Helper::class )->consolidateArray( $postStates ); |
105 | - if( $post->post_type == Application::POST_TYPE && array_key_exists( 'pending', $postStates )) { |
|
105 | + if( $post->post_type == Application::POST_TYPE && array_key_exists( 'pending', $postStates ) ) { |
|
106 | 106 | $postStates['pending'] = __( 'Unapproved', 'site-reviews' ); |
107 | 107 | } |
108 | 108 | return $postStates; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | if( $post->post_type != Application::POST_TYPE || $post->post_status == 'trash' ) { |
119 | 119 | return $actions; |
120 | 120 | } |
121 | - unset( $actions['inline hide-if-no-js'] ); //Remove Quick-edit |
|
121 | + unset($actions['inline hide-if-no-js']); //Remove Quick-edit |
|
122 | 122 | $rowActions = [ |
123 | 123 | 'approve' => esc_attr__( 'Approve', 'site-reviews' ), |
124 | 124 | 'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ), |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | admin_url( 'post.php?post='.$post->ID.'&action='.$key.'&plugin='.Application::ID ), |
133 | 133 | $key.'-review_'.$post->ID |
134 | 134 | ), |
135 | - ]); |
|
135 | + ] ); |
|
136 | 136 | } |
137 | 137 | return $newActions + glsr( Helper::class )->consolidateArray( $actions ); |
138 | 138 | } |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | { |
147 | 147 | $columns = glsr( Helper::class )->consolidateArray( $columns ); |
148 | 148 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
149 | - unset( $postTypeColumns['cb'] ); |
|
149 | + unset($postTypeColumns['cb']); |
|
150 | 150 | foreach( $postTypeColumns as $key => $value ) { |
151 | - if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue; |
|
151 | + if( glsr( Helper::class )->startsWith( 'taxonomy', $key ) )continue; |
|
152 | 152 | $columns[$key] = $key; |
153 | 153 | } |
154 | 154 | return $columns; |
@@ -166,18 +166,18 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function filterStatusText( $translation, $single, $plural, $number, $domain ) |
168 | 168 | { |
169 | - if( $this->canModifyTranslation( $domain )) { |
|
169 | + if( $this->canModifyTranslation( $domain ) ) { |
|
170 | 170 | $strings = [ |
171 | 171 | 'Published' => __( 'Approved', 'site-reviews' ), |
172 | 172 | 'Pending' => __( 'Unapproved', 'site-reviews' ), |
173 | 173 | ]; |
174 | 174 | foreach( $strings as $search => $replace ) { |
175 | 175 | if( strpos( $single, $search ) === false )continue; |
176 | - $translation = $this->getTranslation([ |
|
176 | + $translation = $this->getTranslation( [ |
|
177 | 177 | 'number' => $number, |
178 | 178 | 'plural' => str_replace( $search, $replace, $plural ), |
179 | 179 | 'single' => str_replace( $search, $replace, $single ), |
180 | - ]); |
|
180 | + ] ); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | return $translation; |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public function saveBulkEditFields( $postId ) |
226 | 226 | { |
227 | - if( !current_user_can( 'edit_posts' ))return; |
|
227 | + if( !current_user_can( 'edit_posts' ) )return; |
|
228 | 228 | $assignedTo = filter_input( INPUT_GET, 'assigned_to' ); |
229 | - if( $assignedTo && get_post( $assignedTo )) { |
|
229 | + if( $assignedTo && get_post( $assignedTo ) ) { |
|
230 | 230 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
231 | 231 | } |
232 | 232 | } |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function setQueryForColumn( WP_Query $query ) |
239 | 239 | { |
240 | - if( !$this->hasPermission( $query ))return; |
|
240 | + if( !$this->hasPermission( $query ) )return; |
|
241 | 241 | $this->setMetaQuery( $query, [ |
242 | 242 | 'rating', 'review_type', |
243 | - ]); |
|
243 | + ] ); |
|
244 | 244 | $this->setOrderby( $query ); |
245 | 245 | } |
246 | 246 | |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | public function unapprove() |
252 | 252 | { |
253 | 253 | if( filter_input( INPUT_GET, 'plugin' ) != Application::ID )return; |
254 | - check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() )); |
|
255 | - wp_update_post([ |
|
254 | + check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) ); |
|
255 | + wp_update_post( [ |
|
256 | 256 | 'ID' => $postId, |
257 | 257 | 'post_status' => 'pending', |
258 | - ]); |
|
258 | + ] ); |
|
259 | 259 | wp_safe_redirect( wp_get_referer() ); |
260 | 260 | exit; |
261 | 261 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | 'single' => '', |
286 | 286 | 'text' => '', |
287 | 287 | ]; |
288 | - $args = (object) wp_parse_args( $args, $defaults ); |
|
288 | + $args = (object)wp_parse_args( $args, $defaults ); |
|
289 | 289 | $translations = get_translations_for_domain( Application::ID ); |
290 | 290 | return $args->text |
291 | 291 | ? $translations->translate( $args->text ) |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | protected function setMetaQuery( WP_Query $query, array $metaKeys ) |
311 | 311 | { |
312 | 312 | foreach( $metaKeys as $key ) { |
313 | - if( !( $value = filter_input( INPUT_GET, $key )))continue; |
|
313 | + if( !($value = filter_input( INPUT_GET, $key )) )continue; |
|
314 | 314 | $metaQuery = (array)$query->get( 'meta_query' ); |
315 | 315 | $metaQuery[] = [ |
316 | 316 | 'key' => $key, |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | { |
328 | 328 | $orderby = $query->get( 'orderby' ); |
329 | 329 | $columns = glsr()->postTypeColumns[Application::POST_TYPE]; |
330 | - unset( $columns['cb'], $columns['title'], $columns['date'] ); |
|
331 | - if( in_array( $orderby, array_keys( $columns ))) { |
|
330 | + unset($columns['cb'], $columns['title'], $columns['date']); |
|
331 | + if( in_array( $orderby, array_keys( $columns ) ) ) { |
|
332 | 332 | if( $orderby == 'reviewer' ) { |
333 | 333 | $orderby = 'author'; |
334 | 334 | } |