Test Failed
Push — tmp ( 15f615...89cc97 )
by Paul
10:31 queued 04:40
created
plugin/Controllers/ListTableColumns/ColumnValueIpAddress.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     /**
10 10
      * {@inheritdoc}
11 11
      */
12
-    public function handle(Review $review)
12
+    public function handle( Review $review )
13 13
     {
14 14
         return $review->ip_address;
15 15
     }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableColumns/ColumnValueReviewType.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@
 block discarded – undo
9 9
     /**
10 10
      * {@inheritdoc}
11 11
      */
12
-    public function handle(Review $review)
12
+    public function handle( Review $review )
13 13
     {
14
-        return array_key_exists($review->type, glsr()->reviewTypes)
14
+        return array_key_exists( $review->type, glsr()->reviewTypes )
15 15
             ? glsr()->reviewTypes[$review->type]
16
-            : _x('Unsupported Type', 'admin-text', 'site-reviews');
16
+            : _x( 'Unsupported Type', 'admin-text', 'site-reviews' );
17 17
     }
18 18
 }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableColumns/ColumnValueEmail.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     /**
10 10
      * {@inheritdoc}
11 11
      */
12
-    public function handle(Review $review)
12
+    public function handle( Review $review )
13 13
     {
14 14
         return $review->email;
15 15
     }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableColumns/ColumnValueRating.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
     /**
10 10
      * {@inheritdoc}
11 11
      */
12
-    public function handle(Review $review)
12
+    public function handle( Review $review )
13 13
     {
14
-        return glsr_star_rating($review->rating);
14
+        return glsr_star_rating( $review->rating );
15 15
     }
16 16
 }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableColumns/ColumnValueReviewer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
     /**
12 12
      * {@inheritdoc}
13 13
      */
14
-    public function handle(Review $review)
14
+    public function handle( Review $review )
15 15
     {
16
-        if ($userId = (int) $review->author_id) {
17
-            return glsr(Builder::class)->a([
18
-                'href' => get_author_posts_url($userId),
19
-                'text' => Helper::ifEmpty($review->author, __('Unknown', 'admin-text', 'site-reviews')),
20
-            ]);
16
+        if( $userId = (int)$review->author_id ) {
17
+            return glsr( Builder::class )->a( [
18
+                'href' => get_author_posts_url( $userId ),
19
+                'text' => Helper::ifEmpty( $review->author, __( 'Unknown', 'admin-text', 'site-reviews' ) ),
20
+            ] );
21 21
         }
22 22
         return $review->author;
23 23
     }
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
      * @return array
25 25
      * @filter wp_editor_settings
26 26
      */
27
-    public function filterEditorSettings($settings)
27
+    public function filterEditorSettings( $settings )
28 28
     {
29
-        return glsr(Customization::class)->filterEditorSettings(
30
-            Arr::consolidate($settings)
29
+        return glsr( Customization::class )->filterEditorSettings(
30
+            Arr::consolidate( $settings )
31 31
         );
32 32
     }
33 33
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
      * @return string
38 38
      * @filter the_editor
39 39
      */
40
-    public function filterEditorTextarea($html)
40
+    public function filterEditorTextarea( $html )
41 41
     {
42
-        return glsr(Customization::class)->filterEditorTextarea($html);
42
+        return glsr( Customization::class )->filterEditorTextarea( $html );
43 43
     }
44 44
 
45 45
     /**
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
      * @return bool
50 50
      * @filter is_protected_meta
51 51
      */
52
-    public function filterIsProtectedMeta($protected, $metaKey, $metaType)
52
+    public function filterIsProtectedMeta( $protected, $metaKey, $metaType )
53 53
     {
54
-        if ('post' == $metaType && glsr()->post_type == get_post_type()) {
55
-            $values = glsr(CreateReviewDefaults::class)->unguarded();
56
-            $values = Arr::prefixKeys($values);
57
-            if (array_key_exists($metaKey, $values)) {
54
+        if( 'post' == $metaType && glsr()->post_type == get_post_type() ) {
55
+            $values = glsr( CreateReviewDefaults::class )->unguarded();
56
+            $values = Arr::prefixKeys( $values );
57
+            if( array_key_exists( $metaKey, $values ) ) {
58 58
                 $protected = false;
59 59
             }
60 60
         }
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
      * @return array
67 67
      * @filter post_updated_messages
68 68
      */
69
-    public function filterUpdateMessages($messages)
69
+    public function filterUpdateMessages( $messages )
70 70
     {
71
-        return glsr(Labels::class)->filterUpdateMessages(
72
-            Arr::consolidate($messages)
71
+        return glsr( Labels::class )->filterUpdateMessages(
72
+            Arr::consolidate( $messages )
73 73
         );
74 74
     }
75 75
 
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
      * @return void
78 78
      * @action add_meta_boxes_{Application::POST_TYPE}
79 79
      */
80
-    public function registerMetaBoxes($post)
80
+    public function registerMetaBoxes( $post )
81 81
     {
82
-        add_meta_box(Application::ID.'_assigned_to', _x('Assigned To', 'admin-text', 'site-reviews'), [$this, 'renderAssignedToMetabox'], null, 'side');
83
-        add_meta_box(Application::ID.'_review', _x('Details', 'admin-text', 'site-reviews'), [$this, 'renderDetailsMetaBox'], null, 'side');
84
-        if ('local' === glsr(Query::class)->review($post->ID)->type) {
85
-            add_meta_box(Application::ID.'_response', _x('Respond Publicly', 'admin-text', 'site-reviews'), [$this, 'renderResponseMetaBox'], null, 'normal');
82
+        add_meta_box( Application::ID.'_assigned_to', _x( 'Assigned To', 'admin-text', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' );
83
+        add_meta_box( Application::ID.'_review', _x( 'Details', 'admin-text', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' );
84
+        if( 'local' === glsr( Query::class )->review( $post->ID )->type ) {
85
+            add_meta_box( Application::ID.'_response', _x( 'Respond Publicly', 'admin-text', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' );
86 86
         }
87 87
     }
88 88
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function removeAutosave()
94 94
     {
95
-        glsr(Customization::class)->removeAutosave();
95
+        glsr( Customization::class )->removeAutosave();
96 96
     }
97 97
 
98 98
     /**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function removeMetaBoxes()
103 103
     {
104
-        glsr(Customization::class)->removeMetaBoxes();
104
+        glsr( Customization::class )->removeMetaBoxes();
105 105
     }
106 106
 
107 107
     /**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function removePostTypeSupport()
111 111
     {
112
-        glsr(Customization::class)->removePostTypeSupport();
112
+        glsr( Customization::class )->removePostTypeSupport();
113 113
     }
114 114
 
115 115
     /**
@@ -117,23 +117,23 @@  discard block
 block discarded – undo
117 117
      * @return void
118 118
      * @callback add_meta_box
119 119
      */
120
-    public function renderAssignedToMetabox($post)
120
+    public function renderAssignedToMetabox( $post )
121 121
     {
122
-        if (Review::isReview($post)) {
123
-            $review = glsr(Query::class)->review($post->ID);
124
-            wp_nonce_field('assigned_to', '_nonce-assigned-to', false);
125
-            $templates = array_reduce($review->assigned_post_ids, function ($carry, $postId) {
126
-                return $carry.glsr(Template::class)->build('partials/editor/assigned-post', [
122
+        if( Review::isReview( $post ) ) {
123
+            $review = glsr( Query::class )->review( $post->ID );
124
+            wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
125
+            $templates = array_reduce( $review->assigned_post_ids, function( $carry, $postId ) {
126
+                return $carry.glsr( Template::class )->build( 'partials/editor/assigned-post', [
127 127
                     'context' => [
128 128
                         'data.id' => $postId,
129
-                        'data.url' => (string) get_permalink($postId),
130
-                        'data.title' => get_the_title($postId),
129
+                        'data.url' => (string)get_permalink( $postId ),
130
+                        'data.title' => get_the_title( $postId ),
131 131
                     ],
132
-                ]);
132
+                ] );
133 133
             });
134
-            glsr()->render('partials/editor/metabox-assigned-to', [
134
+            glsr()->render( 'partials/editor/metabox-assigned-to', [
135 135
                 'templates' => $templates,
136
-            ]);
136
+            ] );
137 137
         }
138 138
     }
139 139
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
      * @return void
143 143
      * @callback add_meta_box
144 144
      */
145
-    public function renderDetailsMetaBox($post)
145
+    public function renderDetailsMetaBox( $post )
146 146
     {
147
-        if (Review::isReview($post)) {
148
-            $review = glsr(Query::class)->review($post);
149
-            glsr()->render('partials/editor/metabox-details', [
150
-                'metabox' => $this->normalizeDetailsMetaBox($review),
151
-            ]);
147
+        if( Review::isReview( $post ) ) {
148
+            $review = glsr( Query::class )->review( $post );
149
+            glsr()->render( 'partials/editor/metabox-details', [
150
+                'metabox' => $this->normalizeDetailsMetaBox( $review ),
151
+            ] );
152 152
         }
153 153
     }
154 154
 
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
      */
159 159
     public function renderPinnedInPublishMetaBox()
160 160
     {
161
-        $review = glsr(Query::class)->review(get_post()->ID);
162
-        if ($review->isValid() && glsr()->can('edit_others_posts')) {
163
-            glsr(Template::class)->render('partials/editor/pinned', [
161
+        $review = glsr( Query::class )->review( get_post()->ID );
162
+        if( $review->isValid() && glsr()->can( 'edit_others_posts' ) ) {
163
+            glsr( Template::class )->render( 'partials/editor/pinned', [
164 164
                 'context' => [
165
-                    'no' => _x('No', 'admin-text', 'site-reviews'),
166
-                    'yes' => _x('Yes', 'admin-text', 'site-reviews'),
165
+                    'no' => _x( 'No', 'admin-text', 'site-reviews' ),
166
+                    'yes' => _x( 'Yes', 'admin-text', 'site-reviews' ),
167 167
                 ],
168 168
                 'pinned' => $review->is_pinned,
169
-            ]);
169
+            ] );
170 170
         }
171 171
     }
172 172
 
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
      * @return void
176 176
      * @callback add_meta_box
177 177
      */
178
-    public function renderResponseMetaBox($post)
178
+    public function renderResponseMetaBox( $post )
179 179
     {
180
-        if (Review::isReview($post)) {
181
-            wp_nonce_field('response', '_nonce-response', false);
182
-            glsr()->render('partials/editor/metabox-response', [
183
-                'response' => glsr(Database::class)->meta($post->ID, 'response'),
184
-            ]);
180
+        if( Review::isReview( $post ) ) {
181
+            wp_nonce_field( 'response', '_nonce-response', false );
182
+            glsr()->render( 'partials/editor/metabox-response', [
183
+                'response' => glsr( Database::class )->meta( $post->ID, 'response' ),
184
+            ] );
185 185
         }
186 186
     }
187 187
 
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
      * @return void
191 191
      * @action edit_form_after_title
192 192
      */
193
-    public function renderReviewEditor($post)
193
+    public function renderReviewEditor( $post )
194 194
     {
195
-        if (Review::isReview($post) && !Review::isEditable($post)) {
196
-            glsr()->render('partials/editor/review', [
195
+        if( Review::isReview( $post ) && !Review::isEditable( $post ) ) {
196
+            glsr()->render( 'partials/editor/review', [
197 197
                 'post' => $post,
198
-                'response' => glsr(Database::class)->meta($post->ID, 'response'),
199
-            ]);
198
+                'response' => glsr( Database::class )->meta( $post->ID, 'response' ),
199
+            ] );
200 200
         }
201 201
     }
202 202
 
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
     public function renderReviewFields()
208 208
     {
209 209
         $screen = glsr_current_screen();
210
-        if ('post' === $screen->base && glsr()->post_type === $screen->post_type) {
211
-            add_action('edit_form_after_title', [$this, 'renderReviewEditor']);
212
-            add_action('edit_form_top', [$this, 'renderReviewNotice']);
210
+        if( 'post' === $screen->base && glsr()->post_type === $screen->post_type ) {
211
+            add_action( 'edit_form_after_title', [$this, 'renderReviewEditor'] );
212
+            add_action( 'edit_form_top', [$this, 'renderReviewNotice'] );
213 213
         }
214 214
     }
215 215
 
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
      * @return void
219 219
      * @action edit_form_top
220 220
      */
221
-    public function renderReviewNotice($post)
221
+    public function renderReviewNotice( $post )
222 222
     {
223
-        if (Review::isReview($post) && !Review::isEditable($post)) {
224
-            glsr(Notice::class)->addWarning(sprintf(
225
-                _x('%s reviews are read-only.', 'admin-text', 'site-reviews'),
226
-                glsr(ColumnValueReviewType::class)->handle(glsr(Query::class)->review($post->ID))
227
-            ));
228
-            glsr(Template::class)->render('partials/editor/notice', [
223
+        if( Review::isReview( $post ) && !Review::isEditable( $post ) ) {
224
+            glsr( Notice::class )->addWarning( sprintf(
225
+                _x( '%s reviews are read-only.', 'admin-text', 'site-reviews' ),
226
+                glsr( ColumnValueReviewType::class )->handle( glsr( Query::class )->review( $post->ID ) )
227
+            ) );
228
+            glsr( Template::class )->render( 'partials/editor/notice', [
229 229
                 'context' => [
230
-                    'notices' => glsr(Notice::class)->get(),
230
+                    'notices' => glsr( Notice::class )->get(),
231 231
                 ],
232
-            ]);
232
+            ] );
233 233
         }
234 234
     }
235 235
 
@@ -239,14 +239,14 @@  discard block
 block discarded – undo
239 239
      * @see glsr_categories_meta_box()
240 240
      * @callback register_taxonomy
241 241
      */
242
-    public function renderTaxonomyMetabox($post)
242
+    public function renderTaxonomyMetabox( $post )
243 243
     {
244
-        if (Review::isReview($post)) {
245
-            glsr()->render('partials/editor/metabox-categories', [
244
+        if( Review::isReview( $post ) ) {
245
+            glsr()->render( 'partials/editor/metabox-categories', [
246 246
                 'post' => $post,
247 247
                 'tax_name' => glsr()->taxonomy,
248
-                'taxonomy' => get_taxonomy(glsr()->taxonomy),
249
-            ]);
248
+                'taxonomy' => get_taxonomy( glsr()->taxonomy ),
249
+            ] );
250 250
         }
251 251
     }
252 252
 
@@ -257,30 +257,30 @@  discard block
 block discarded – undo
257 257
      * @return void
258 258
      * @action save_post_.Application::POST_TYPE
259 259
      */
260
-    public function saveMetaboxes($postId, $post, $isUpdating)
260
+    public function saveMetaboxes( $postId, $post, $isUpdating )
261 261
     {
262
-        glsr(Metaboxes::class)->saveAssignedToMetabox($postId);
263
-        glsr(Metaboxes::class)->saveResponseMetabox($postId);
264
-        if ($isUpdating) {
265
-            glsr()->action('review/saved', glsr(Query::class)->review($postId));
262
+        glsr( Metaboxes::class )->saveAssignedToMetabox( $postId );
263
+        glsr( Metaboxes::class )->saveResponseMetabox( $postId );
264
+        if( $isUpdating ) {
265
+            glsr()->action( 'review/saved', glsr( Query::class )->review( $postId ) );
266 266
         }
267 267
     }
268 268
 
269 269
     /**
270 270
      * @return string|void
271 271
      */
272
-    protected function getReviewType(Review $review)
272
+    protected function getReviewType( Review $review )
273 273
     {
274
-        if (count(glsr()->reviewTypes) < 2) {
274
+        if( count( glsr()->reviewTypes ) < 2 ) {
275 275
             return;
276 276
         }
277 277
         $type = $review->type();
278
-        if (!empty($review->url)) {
279
-            return glsr(Builder::class)->a([
278
+        if( !empty($review->url) ) {
279
+            return glsr( Builder::class )->a( [
280 280
                 'href' => $review->url,
281 281
                 'target' => '_blank',
282 282
                 'text' => $type,
283
-            ]);
283
+            ] );
284 284
         }
285 285
         return $type;
286 286
     }
@@ -288,29 +288,29 @@  discard block
 block discarded – undo
288 288
     /**
289 289
      * @return array
290 290
      */
291
-    protected function normalizeDetailsMetaBox(Review $review)
291
+    protected function normalizeDetailsMetaBox( Review $review )
292 292
     {
293 293
         $user = empty($review->author_id)
294
-            ? _x('Unregistered user', 'admin-text', 'site-reviews')
295
-            : glsr(Builder::class)->a(get_the_author_meta('display_name', $review->author_id), [
296
-                'href' => get_author_posts_url($review->author_id),
297
-            ]);
294
+            ? _x( 'Unregistered user', 'admin-text', 'site-reviews' )
295
+            : glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->author_id ), [
296
+                'href' => get_author_posts_url( $review->author_id ),
297
+            ] );
298 298
         $email = empty($review->email)
299 299
             ? '&mdash;'
300
-            : glsr(Builder::class)->a($review->email, [
301
-                'href' => 'mailto:'.$review->email.'?subject='.esc_attr(_x('RE:', 'admin-text', 'site-reviews').' '.$review->title),
302
-            ]);
300
+            : glsr( Builder::class )->a( $review->email, [
301
+                'href' => 'mailto:'.$review->email.'?subject='.esc_attr( _x( 'RE:', 'admin-text', 'site-reviews' ).' '.$review->title ),
302
+            ] );
303 303
         $metabox = [
304
-            _x('Rating', 'admin-text', 'site-reviews') => $review->rating(),
305
-            _x('Type', 'admin-text', 'site-reviews') => $this->getReviewType($review),
306
-            _x('Date', 'admin-text', 'site-reviews') => $review->date(),
307
-            _x('Name', 'admin-text', 'site-reviews') => $review->author,
308
-            _x('Email', 'admin-text', 'site-reviews') => $email,
309
-            _x('User', 'admin-text', 'site-reviews') => $user,
310
-            _x('IP Address', 'admin-text', 'site-reviews') => $review->ip_address,
311
-            _x('Avatar', 'admin-text', 'site-reviews') => sprintf('<img src="%s" width="96">', $review->avatar),
304
+            _x( 'Rating', 'admin-text', 'site-reviews' ) => $review->rating(),
305
+            _x( 'Type', 'admin-text', 'site-reviews' ) => $this->getReviewType( $review ),
306
+            _x( 'Date', 'admin-text', 'site-reviews' ) => $review->date(),
307
+            _x( 'Name', 'admin-text', 'site-reviews' ) => $review->author,
308
+            _x( 'Email', 'admin-text', 'site-reviews' ) => $email,
309
+            _x( 'User', 'admin-text', 'site-reviews' ) => $user,
310
+            _x( 'IP Address', 'admin-text', 'site-reviews' ) => $review->ip_address,
311
+            _x( 'Avatar', 'admin-text', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ),
312 312
         ];
313
-        return array_filter(glsr()->filterArray('metabox/details', $metabox, $review));
313
+        return array_filter( glsr()->filterArray( 'metabox/details', $metabox, $review ) );
314 314
     }
315 315
 
316 316
     /**
@@ -318,16 +318,16 @@  discard block
 block discarded – undo
318 318
      * @param int $messageIndex
319 319
      * @return void
320 320
      */
321
-    protected function redirect($postId, $messageIndex)
321
+    protected function redirect( $postId, $messageIndex )
322 322
     {
323 323
         $referer = wp_get_referer();
324 324
         $hasReferer = !$referer
325
-            || Str::contains($referer, 'post.php')
326
-            || Str::contains($referer, 'post-new.php');
325
+            || Str::contains( $referer, 'post.php' )
326
+            || Str::contains( $referer, 'post-new.php' );
327 327
         $redirectUri = $hasReferer
328
-            ? remove_query_arg(['deleted', 'ids', 'trashed', 'untrashed'], $referer)
329
-            : get_edit_post_link($postId);
330
-        wp_safe_redirect(add_query_arg(['message' => $messageIndex], $redirectUri));
328
+            ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer )
329
+            : get_edit_post_link( $postId );
330
+        wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) );
331 331
         exit;
332 332
     }
333 333
 }
Please login to merge, or discard this patch.
plugin/Controllers/TrustalyzeController.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
      * @return array
22 22
      * @filter site-reviews/settings/callback
23 23
      */
24
-    public function filterSettingsCallback(array $settings)
24
+    public function filterSettingsCallback( array $settings )
25 25
     {
26
-        if ('yes' !== Arr::get($settings, $this->enabledKey)) {
26
+        if( 'yes' !== Arr::get( $settings, $this->enabledKey ) ) {
27 27
             return $settings;
28 28
         }
29
-        $isApiKeyModified = $this->isEmptyOrModified($this->apiKey, $settings);
30
-        $isEmailModified = $this->isEmptyOrModified($this->emailKey, $settings);
31
-        $isAccountVerified = glsr(OptionManager::class)->getWP($this->trustalyzeKey, false);
32
-        if (!$isAccountVerified || $isApiKeyModified || $isEmailModified) {
33
-            $settings = $this->sanitizeTrustalyzeSettings($settings);
29
+        $isApiKeyModified = $this->isEmptyOrModified( $this->apiKey, $settings );
30
+        $isEmailModified = $this->isEmptyOrModified( $this->emailKey, $settings );
31
+        $isAccountVerified = glsr( OptionManager::class )->getWP( $this->trustalyzeKey, false );
32
+        if( !$isAccountVerified || $isApiKeyModified || $isEmailModified ) {
33
+            $settings = $this->sanitizeTrustalyzeSettings( $settings );
34 34
         }
35 35
         return $settings;
36 36
     }
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
      * @return array
41 41
      * @filter site-reviews/interpolate/partials/form/table-row-multiple
42 42
      */
43
-    public function filterSettingsTableRow(array $context, $template, array $data)
43
+    public function filterSettingsTableRow( array $context, $template, array $data )
44 44
     {
45
-        if ($this->enabledKey !== Arr::get($data, 'field.path')) {
45
+        if( $this->enabledKey !== Arr::get( $data, 'field.path' ) ) {
46 46
             return $context;
47 47
         }
48
-        $isAccountValidated = !empty(glsr(OptionManager::class)->getWP($this->trustalyzeKey));
49
-        $isIntegrationEnabled = glsr(OptionManager::class)->getBool('settings.general.trustalyze');
50
-        if ($isAccountValidated && $isIntegrationEnabled) {
48
+        $isAccountValidated = !empty(glsr( OptionManager::class )->getWP( $this->trustalyzeKey ));
49
+        $isIntegrationEnabled = glsr( OptionManager::class )->getBool( 'settings.general.trustalyze' );
50
+        if( $isAccountValidated && $isIntegrationEnabled ) {
51 51
             return $context;
52 52
         }
53 53
         $context['field'] .= $this->buildCreateButton();
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
      * @return void
60 60
      * @action site-reviews/review/created
61 61
      */
62
-    public function onCreated(Review $review)
62
+    public function onCreated( Review $review )
63 63
     {
64
-        if (!$this->canPostReview($review)) {
64
+        if( !$this->canPostReview( $review ) ) {
65 65
             return;
66 66
         }
67
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
68
-        if ($trustalyze->success) {
69
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
67
+        $trustalyze = glsr( Trustalyze::class )->sendReview( $review );
68
+        if( $trustalyze->success ) {
69
+            glsr( Database::class )->set( $review->ID, 'trustalyze', $trustalyze->review_id );
70 70
         }
71 71
     }
72 72
 
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
      * @return void
76 76
      * @action site-reviews/review/reverted
77 77
      */
78
-    public function onReverted(Review $review)
78
+    public function onReverted( Review $review )
79 79
     {
80
-        if (!$this->canPostReview($review)) {
80
+        if( !$this->canPostReview( $review ) ) {
81 81
             return;
82 82
         }
83
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
84
-        if ($trustalyze->success) {
85
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
83
+        $trustalyze = glsr( Trustalyze::class )->sendReview( $review );
84
+        if( $trustalyze->success ) {
85
+            glsr( Database::class )->set( $review->ID, 'trustalyze', $trustalyze->review_id );
86 86
         }
87 87
     }
88 88
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
      * @return void
92 92
      * @action site-reviews/review/saved
93 93
      */
94
-    public function onSaved(Review $review)
94
+    public function onSaved( Review $review )
95 95
     {
96
-        if (!$this->canPostReview($review)) {
96
+        if( !$this->canPostReview( $review ) ) {
97 97
             return;
98 98
         }
99
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
100
-        if ($trustalyze->success) {
101
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
99
+        $trustalyze = glsr( Trustalyze::class )->sendReview( $review );
100
+        if( $trustalyze->success ) {
101
+            glsr( Database::class )->set( $review->ID, 'trustalyze', $trustalyze->review_id );
102 102
         }
103 103
     }
104 104
 
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
      * @return void
111 111
      * @action updated_postmeta
112 112
      */
113
-    public function onUpdatedMeta($metaId, $postId, $metaKey)
113
+    public function onUpdatedMeta( $metaId, $postId, $metaKey )
114 114
     {
115
-        $review = glsr_get_review($postId);
116
-        if (!$this->canPostResponse($review) || '_response' !== $metaKey) {
115
+        $review = glsr_get_review( $postId );
116
+        if( !$this->canPostResponse( $review ) || '_response' !== $metaKey ) {
117 117
             return;
118 118
         }
119
-        $trustalyze = glsr(Trustalyze::class)->sendReviewResponse($review);
120
-        if ($trustalyze->success) {
121
-            glsr(Database::class)->set($review->ID, 'trustalyze_response', true);
119
+        $trustalyze = glsr( Trustalyze::class )->sendReviewResponse( $review );
120
+        if( $trustalyze->success ) {
121
+            glsr( Database::class )->set( $review->ID, 'trustalyze_response', true );
122 122
         }
123 123
     }
124 124
 
@@ -127,32 +127,32 @@  discard block
 block discarded – undo
127 127
      */
128 128
     protected function buildCreateButton()
129 129
     {
130
-        return glsr(Builder::class)->a(_x('Create Your Trustalyze Account', 'admin-text', 'site-reviews'), [
130
+        return glsr( Builder::class )->a( _x( 'Create Your Trustalyze Account', 'admin-text', 'site-reviews' ), [
131 131
             'class' => 'button',
132 132
             'href' => Trustalyze::WEB_URL,
133 133
             'target' => '_blank',
134
-        ]);
134
+        ] );
135 135
     }
136 136
 
137 137
     /**
138 138
      * @return bool
139 139
      */
140
-    protected function canPostResponse(Review $review)
140
+    protected function canPostResponse( Review $review )
141 141
     {
142 142
         $requiredValues = [
143
-            glsr(Database::class)->get($review->ID, 'trustalyze'),
143
+            glsr( Database::class )->get( $review->ID, 'trustalyze' ),
144 144
             $review->response,
145 145
             $review->review_id,
146 146
         ];
147
-        return $this->canProceed($review, 'trustalyze_response')
147
+        return $this->canProceed( $review, 'trustalyze_response' )
148 148
             && 'publish' === $review->status
149
-            && 3 === count(array_filter($requiredValues));
149
+            && 3 === count( array_filter( $requiredValues ) );
150 150
     }
151 151
 
152 152
     /**
153 153
      * @return bool
154 154
      */
155
-    protected function canPostReview(Review $review)
155
+    protected function canPostReview( Review $review )
156 156
     {
157 157
         $requiredValues = [
158 158
             $review->author,
@@ -161,60 +161,60 @@  discard block
 block discarded – undo
161 161
             $review->review_id,
162 162
             $review->title,
163 163
         ];
164
-        return $this->canProceed($review)
164
+        return $this->canProceed( $review )
165 165
             && 'publish' === $review->status
166
-            && 5 === count(array_filter($requiredValues));
166
+            && 5 === count( array_filter( $requiredValues ) );
167 167
     }
168 168
 
169 169
     /**
170 170
      * @param string $metaKey
171 171
      * @return bool
172 172
      */
173
-    protected function canProceed(Review $review, $metaKey = 'trustalyze')
173
+    protected function canProceed( Review $review, $metaKey = 'trustalyze' )
174 174
     {
175
-        return glsr(OptionManager::class)->getBool($this->enabledKey)
176
-            && Review::isReview($review->ID)
177
-            && !$this->hasMetaKey($review, $metaKey);
175
+        return glsr( OptionManager::class )->getBool( $this->enabledKey )
176
+            && Review::isReview( $review->ID )
177
+            && !$this->hasMetaKey( $review, $metaKey );
178 178
     }
179 179
 
180 180
     /**
181 181
      * @param string $metaKey
182 182
      * @return bool
183 183
      */
184
-    protected function hasMetaKey(Review $review, $metaKey = 'trustalyze')
184
+    protected function hasMetaKey( Review $review, $metaKey = 'trustalyze' )
185 185
     {
186
-        return '' !== glsr(Database::class)->get($review->ID, $metaKey);
186
+        return '' !== glsr( Database::class )->get( $review->ID, $metaKey );
187 187
     }
188 188
 
189 189
     /**
190 190
      * @param string $key
191 191
      * @return bool
192 192
      */
193
-    protected function isEmptyOrModified($key, array $settings)
193
+    protected function isEmptyOrModified( $key, array $settings )
194 194
     {
195
-        $oldValue = glsr_get_option($key);
196
-        $newValue = Arr::get($settings, $key);
195
+        $oldValue = glsr_get_option( $key );
196
+        $newValue = Arr::get( $settings, $key );
197 197
         return empty($newValue) || $newValue !== $oldValue;
198 198
     }
199 199
 
200 200
     /**
201 201
      * @return array
202 202
      */
203
-    protected function sanitizeTrustalyzeSettings(array $settings)
203
+    protected function sanitizeTrustalyzeSettings( array $settings )
204 204
     {
205
-        $trustalyze = glsr(Trustalyze::class)->activateKey(
206
-            Arr::get($settings, $this->apiKey),
207
-            Arr::get($settings, $this->emailKey)
205
+        $trustalyze = glsr( Trustalyze::class )->activateKey(
206
+            Arr::get( $settings, $this->apiKey ),
207
+            Arr::get( $settings, $this->emailKey )
208 208
         );
209
-        if ($trustalyze->success) {
210
-            update_option($this->trustalyzeKey, Arr::get($trustalyze->response, 'producttype'));
209
+        if( $trustalyze->success ) {
210
+            update_option( $this->trustalyzeKey, Arr::get( $trustalyze->response, 'producttype' ) );
211 211
         } else {
212
-            delete_option($this->trustalyzeKey);
213
-            $settings = Arr::set($settings, $this->enabledKey, 'no');
214
-            glsr(Notice::class)->addError(sprintf(
215
-                _x('Your Trustalyze account details could not be verified, please try again. %s', 'admin-text', 'site-reviews'),
212
+            delete_option( $this->trustalyzeKey );
213
+            $settings = Arr::set( $settings, $this->enabledKey, 'no' );
214
+            glsr( Notice::class )->addError( sprintf(
215
+                _x( 'Your Trustalyze account details could not be verified, please try again. %s', 'admin-text', 'site-reviews' ),
216 216
                 '('.$trustalyze->message.')'
217
-            ));
217
+            ) );
218 218
         }
219 219
         return $settings;
220 220
     }
Please login to merge, or discard this patch.
plugin/Controllers/ReviewController.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public function approve()
19 19
     {
20
-        if (glsr()->id == filter_input(INPUT_GET, 'plugin')) {
21
-            check_admin_referer('approve-review_'.($postId = $this->getPostId()));
22
-            $this->execute(new ToggleStatus($postId, 'publish'));
23
-            wp_safe_redirect(wp_get_referer());
20
+        if( glsr()->id == filter_input( INPUT_GET, 'plugin' ) ) {
21
+            check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) );
22
+            $this->execute( new ToggleStatus( $postId, 'publish' ) );
23
+            wp_safe_redirect( wp_get_referer() );
24 24
             exit;
25 25
         }
26 26
     }
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
      * @return array
31 31
      * @filter the_posts
32 32
      */
33
-    public function filterPostsToCacheReviews($posts)
33
+    public function filterPostsToCacheReviews( $posts )
34 34
     {
35
-        $reviews = array_filter($posts, function ($post) {
35
+        $reviews = array_filter( $posts, function( $post ) {
36 36
             return glsr()->post_type === $post->post_type;
37 37
         });
38
-        if ($postIds = wp_list_pluck($reviews, 'ID')) {
39
-            glsr(Query::class)->reviews([], $postIds); // this caches the associated Review objects
38
+        if( $postIds = wp_list_pluck( $reviews, 'ID' ) ) {
39
+            glsr( Query::class )->reviews( [], $postIds ); // this caches the associated Review objects
40 40
         }
41 41
         return $posts;
42 42
     }
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
      * @return void
54 54
      * @action set_object_terms
55 55
      */
56
-    public function onAfterChangeAssignedTerms($postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds)
56
+    public function onAfterChangeAssignedTerms( $postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds )
57 57
     {
58
-        if (!Review::isReview($postId)) {
58
+        if( !Review::isReview( $postId ) ) {
59 59
             return;
60 60
         }
61
-        $diff = $this->getAssignedDiff($oldTTIds, $newTTIds);
62
-        $review = glsr(Query::class)->review($postId);
63
-        foreach ($diff['old'] as $termId) {
64
-            glsr(ReviewManager::class)->unassignTerm($review, $termId);
61
+        $diff = $this->getAssignedDiff( $oldTTIds, $newTTIds );
62
+        $review = glsr( Query::class )->review( $postId );
63
+        foreach( $diff['old'] as $termId ) {
64
+            glsr( ReviewManager::class )->unassignTerm( $review, $termId );
65 65
         }
66
-        foreach ($diff['new'] as $termId) {
67
-            glsr(ReviewManager::class)->assignTerm($review, $termId);
66
+        foreach( $diff['new'] as $termId ) {
67
+            glsr( ReviewManager::class )->assignTerm( $review, $termId );
68 68
         }
69 69
     }
70 70
 
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
      * @return void
75 75
      * @action site-reviews/review/updated/post_ids
76 76
      */
77
-    public function onChangeAssignedPosts(Review $review, array $postIds = [])
77
+    public function onChangeAssignedPosts( Review $review, array $postIds = [] )
78 78
     {
79
-        $diff = $this->getAssignedDiff($review->assigned_post_ids, $postIds);
80
-        foreach ($diff['old'] as $postId) {
81
-            glsr(ReviewManager::class)->unassignPost($review, $postId);
79
+        $diff = $this->getAssignedDiff( $review->assigned_post_ids, $postIds );
80
+        foreach( $diff['old'] as $postId ) {
81
+            glsr( ReviewManager::class )->unassignPost( $review, $postId );
82 82
         }
83
-        foreach ($diff['new'] as $postId) {
84
-            glsr(ReviewManager::class)->assignPost($review, $postId);
83
+        foreach( $diff['new'] as $postId ) {
84
+            glsr( ReviewManager::class )->assignPost( $review, $postId );
85 85
         }
86 86
     }
87 87
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
      * @return void
92 92
      * @action site-reviews/review/updated/user_ids
93 93
      */
94
-    public function onChangeAssignedUsers(Review $review, array $userIds = [])
94
+    public function onChangeAssignedUsers( Review $review, array $userIds = [] )
95 95
     {
96
-        $diff = $this->getAssignedDiff($review->assigned_user_ids, $userIds);
97
-        foreach ($diff['old'] as $userId) {
98
-            glsr(ReviewManager::class)->unassignUser($review, $userId);
96
+        $diff = $this->getAssignedDiff( $review->assigned_user_ids, $userIds );
97
+        foreach( $diff['old'] as $userId ) {
98
+            glsr( ReviewManager::class )->unassignUser( $review, $userId );
99 99
         }
100
-        foreach ($diff['new'] as $userId) {
101
-            glsr(ReviewManager::class)->assignUser($review, $userId);
100
+        foreach( $diff['new'] as $userId ) {
101
+            glsr( ReviewManager::class )->assignUser( $review, $userId );
102 102
         }
103 103
     }
104 104
 
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function unapprove()
110 110
     {
111
-        if (glsr()->id == filter_input(INPUT_GET, 'plugin')) {
112
-            check_admin_referer('unapprove-review_'.($postId = $this->getPostId()));
113
-            $this->execute(new ToggleStatus($postId, 'pending'));
114
-            wp_safe_redirect(wp_get_referer());
111
+        if( glsr()->id == filter_input( INPUT_GET, 'plugin' ) ) {
112
+            check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) );
113
+            $this->execute( new ToggleStatus( $postId, 'pending' ) );
114
+            wp_safe_redirect( wp_get_referer() );
115 115
             exit;
116 116
         }
117 117
     }
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
     /**
120 120
      * @return array
121 121
      */
122
-    protected function getAssignedDiff(array $existing, array $replacements)
122
+    protected function getAssignedDiff( array $existing, array $replacements )
123 123
     {
124
-        sort($existing);
125
-        sort($replacements);
124
+        sort( $existing );
125
+        sort( $replacements );
126 126
         $new = $old = [];
127
-        if ($existing !== $replacements) {
128
-            $ignored = array_intersect($existing, $replacements);
129
-            $new = array_diff($replacements, $ignored);
130
-            $old = array_diff($existing, $ignored);
127
+        if( $existing !== $replacements ) {
128
+            $ignored = array_intersect( $existing, $replacements );
129
+            $new = array_diff( $replacements, $ignored );
130
+            $old = array_diff( $existing, $ignored );
131 131
         }
132 132
         return [
133 133
             'new' => $new,
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         ];
136 136
     }
137 137
 
138
-    public function onAfterChangeAssignedUsers($userIds)
138
+    public function onAfterChangeAssignedUsers( $userIds )
139 139
     {
140 140
     }
141 141
 
@@ -148,20 +148,20 @@  discard block
 block discarded – undo
148 148
      * @return void
149 149
      * @action transition_post_status
150 150
      */
151
-    public function onAfterChangeStatus($newStatus, $oldStatus, $post)
151
+    public function onAfterChangeStatus( $newStatus, $oldStatus, $post )
152 152
     {
153
-        if (in_array($oldStatus, ['new', $newStatus])) {
153
+        if( in_array( $oldStatus, ['new', $newStatus] ) ) {
154 154
             return;
155 155
         }
156
-        $postType = get_post_type($post);
157
-        if (glsr()->post_type === $postType) {
158
-            glsr(ReviewManager::class)->update($post->ID, [
156
+        $postType = get_post_type( $post );
157
+        if( glsr()->post_type === $postType ) {
158
+            glsr( ReviewManager::class )->update( $post->ID, [
159 159
                 'is_approved' => 'publish' === $newStatus,
160
-            ]);
160
+            ] );
161 161
         } else {
162
-            glsr(ReviewManager::class)->updateAssignedPost($post->ID, [
162
+            glsr( ReviewManager::class )->updateAssignedPost( $post->ID, [
163 163
                 'is_published' => 'publish' === $newStatus,
164
-            ]);
164
+            ] );
165 165
         }
166 166
     }
167 167
 
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
      * @action site-reviews/review/creating
173 173
      * @todo fix $command->review_type
174 174
      */
175
-    public function onAfterCreate(WP_Post $post, CreateReview $command)
175
+    public function onAfterCreate( WP_Post $post, CreateReview $command )
176 176
     {
177
-        glsr(ReviewManager::class)->insert($post->ID, [
177
+        glsr( ReviewManager::class )->insert( $post->ID, [
178 178
             'is_approved' => 'publish' === $post->status,
179 179
             'rating' => $command->rating,
180 180
             'type' => $command->review_type,
181
-        ]);
181
+        ] );
182 182
     }
183 183
 }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
      * @return array
23 23
      * @filter manage_.Application::POST_TYPE._posts_columns
24 24
      */
25
-    public function filterColumnsForPostType($columns)
25
+    public function filterColumnsForPostType( $columns )
26 26
     {
27
-        $columns = Arr::consolidate($columns);
28
-        $postTypeColumns = glsr()->retrieve('columns.'.glsr()->post_type, []);
29
-        foreach ($postTypeColumns as $key => &$value) {
30
-            if (array_key_exists($key, $columns) && empty($value)) {
27
+        $columns = Arr::consolidate( $columns );
28
+        $postTypeColumns = glsr()->retrieve( 'columns.'.glsr()->post_type, [] );
29
+        foreach( $postTypeColumns as $key => &$value ) {
30
+            if( array_key_exists( $key, $columns ) && empty($value) ) {
31 31
                 $value = $columns[$key];
32 32
             }
33 33
         }
34
-        return array_filter($postTypeColumns, 'strlen');
34
+        return array_filter( $postTypeColumns, 'strlen' );
35 35
     }
36 36
 
37 37
     /**
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
      * @return string
41 41
      * @filter post_date_column_status
42 42
      */
43
-    public function filterDateColumnStatus($status, $post)
43
+    public function filterDateColumnStatus( $status, $post )
44 44
     {
45
-        if (glsr()->post_type == Arr::get($post, 'post_type')) {
46
-            $status = _x('Submitted', 'admin-text', 'site-reviews');
45
+        if( glsr()->post_type == Arr::get( $post, 'post_type' ) ) {
46
+            $status = _x( 'Submitted', 'admin-text', 'site-reviews' );
47 47
         }
48 48
         return $status;
49 49
     }
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
      * @return array
55 55
      * @filter default_hidden_columns
56 56
      */
57
-    public function filterDefaultHiddenColumns($hidden, $screen)
57
+    public function filterDefaultHiddenColumns( $hidden, $screen )
58 58
     {
59
-        if (Arr::get($screen, 'id') == 'edit-'.glsr()->post_type) {
60
-            $hidden = Arr::consolidate($hidden);
61
-            $hidden = array_unique(array_merge($hidden, [
59
+        if( Arr::get( $screen, 'id' ) == 'edit-'.glsr()->post_type ) {
60
+            $hidden = Arr::consolidate( $hidden );
61
+            $hidden = array_unique( array_merge( $hidden, [
62 62
                 'email', 'ip_address', 'response', 'reviewer',
63
-            ]));
63
+            ] ) );
64 64
         }
65 65
         return $hidden;
66 66
     }
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
      * @return void
70 70
      * @filter posts_clauses
71 71
      */
72
-    public function filterPostClauses(array $clauses, WP_Query $query)
72
+    public function filterPostClauses( array $clauses, WP_Query $query )
73 73
     {
74
-        if (!$this->hasPermission($query)) {
74
+        if( !$this->hasPermission( $query ) ) {
75 75
             return $clauses;
76 76
         }
77
-        $table = glsr(Query::class)->table('ratings');
78
-        foreach ($clauses as $key => &$clause) {
79
-            $method = Helper::buildMethodName($key, 'modifyClause');
80
-            if (method_exists($this, $method)) {
81
-                $clause = call_user_func([$this, $method], $clause, $table, $query);
77
+        $table = glsr( Query::class )->table( 'ratings' );
78
+        foreach( $clauses as $key => &$clause ) {
79
+            $method = Helper::buildMethodName( $key, 'modifyClause' );
80
+            if( method_exists( $this, $method ) ) {
81
+                $clause = call_user_func( [$this, $method], $clause, $table, $query );
82 82
             }
83 83
         }
84 84
         return $clauses;
@@ -90,30 +90,30 @@  discard block
 block discarded – undo
90 90
      * @return array
91 91
      * @filter post_row_actions
92 92
      */
93
-    public function filterRowActions($actions, $post)
93
+    public function filterRowActions( $actions, $post )
94 94
     {
95
-        if (glsr()->post_type != Arr::get($post, 'post_type')
95
+        if( glsr()->post_type != Arr::get( $post, 'post_type' )
96 96
             || 'trash' == $post->post_status
97
-            || !user_can(get_current_user_id(), 'edit_post', $post->ID)) {
97
+            || !user_can( get_current_user_id(), 'edit_post', $post->ID ) ) {
98 98
             return $actions;
99 99
         }
100 100
         unset($actions['inline hide-if-no-js']); //Remove Quick-edit
101 101
         $rowActions = [
102
-            'approve' => _x('Approve', 'admin-text', 'site-reviews'),
103
-            'unapprove' => _x('Unapprove', 'admin-text', 'site-reviews'),
102
+            'approve' => _x( 'Approve', 'admin-text', 'site-reviews' ),
103
+            'unapprove' => _x( 'Unapprove', 'admin-text', 'site-reviews' ),
104 104
         ];
105 105
         $newActions = [];
106
-        foreach ($rowActions as $key => $text) {
107
-            $newActions[$key] = glsr(Builder::class)->a($text, [
108
-                'aria-label' => esc_attr(sprintf(_x('%s this review', 'Approve the review (admin-text)', 'site-reviews'), $text)),
106
+        foreach( $rowActions as $key => $text ) {
107
+            $newActions[$key] = glsr( Builder::class )->a( $text, [
108
+                'aria-label' => esc_attr( sprintf( _x( '%s this review', 'Approve the review (admin-text)', 'site-reviews' ), $text ) ),
109 109
                 'class' => 'glsr-toggle-status',
110 110
                 'href' => wp_nonce_url(
111
-                    admin_url('post.php?post='.$post->ID.'&action='.$key.'&plugin='.glsr()->id),
111
+                    admin_url( 'post.php?post='.$post->ID.'&action='.$key.'&plugin='.glsr()->id ),
112 112
                     $key.'-review_'.$post->ID
113 113
                 ),
114
-            ]);
114
+            ] );
115 115
         }
116
-        return $newActions + Arr::consolidate($actions);
116
+        return $newActions + Arr::consolidate( $actions );
117 117
     }
118 118
 
119 119
     /**
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
      * @return array
122 122
      * @filter manage_edit-.Application::POST_TYPE._sortable_columns
123 123
      */
124
-    public function filterSortableColumns($columns)
124
+    public function filterSortableColumns( $columns )
125 125
     {
126
-        $columns = Arr::consolidate($columns);
127
-        $postTypeColumns = glsr()->retrieve('columns.'.glsr()->post_type, []);
126
+        $columns = Arr::consolidate( $columns );
127
+        $postTypeColumns = glsr()->retrieve( 'columns.'.glsr()->post_type, [] );
128 128
         unset($postTypeColumns['cb']);
129
-        foreach ($postTypeColumns as $key => $value) {
130
-            if (!Str::startsWith('assigned', $key) && !Str::startsWith('taxonomy', $key)) {
129
+        foreach( $postTypeColumns as $key => $value ) {
130
+            if( !Str::startsWith( 'assigned', $key ) && !Str::startsWith( 'taxonomy', $key ) ) {
131 131
                 $columns[$key] = $key;
132 132
             }
133 133
         }
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
      * @return void
141 141
      * @action bulk_edit_custom_box
142 142
      */
143
-    public function renderBulkEditFields($columnName, $postType)
143
+    public function renderBulkEditFields( $columnName, $postType )
144 144
     {
145
-        if ('assigned_to' == $columnName && glsr()->post_type == $postType) {
146
-            glsr()->render('partials/editor/bulk-edit-assigned-to');
145
+        if( 'assigned_to' == $columnName && glsr()->post_type == $postType ) {
146
+            glsr()->render( 'partials/editor/bulk-edit-assigned-to' );
147 147
         }
148 148
     }
149 149
 
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
      * @return void
153 153
      * @action restrict_manage_posts
154 154
      */
155
-    public function renderColumnFilters($postType)
155
+    public function renderColumnFilters( $postType )
156 156
     {
157
-        if (glsr()->post_type !== $postType) {
157
+        if( glsr()->post_type !== $postType ) {
158 158
             return;
159 159
         }
160
-        if ($filter = glsr()->runIf(ColumnFilterRating::class)) {
160
+        if( $filter = glsr()->runIf( ColumnFilterRating::class ) ) {
161 161
             echo $filter;
162 162
         }
163
-        if ($filter = glsr()->runIf(ColumnFilterReviewType::class)) {
163
+        if( $filter = glsr()->runIf( ColumnFilterReviewType::class ) ) {
164 164
             echo $filter;
165 165
         }
166 166
     }
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
      * @return void
172 172
      * @action manage_posts_custom_column
173 173
      */
174
-    public function renderColumnValues($column, $postId)
174
+    public function renderColumnValues( $column, $postId )
175 175
     {
176
-        $review = glsr(Query::class)->review($postId);
177
-        if (!$review->isValid()) {
178
-            glsr(Migrate::class)->reset(); // looks like a migration is needed!
176
+        $review = glsr( Query::class )->review( $postId );
177
+        if( !$review->isValid() ) {
178
+            glsr( Migrate::class )->reset(); // looks like a migration is needed!
179 179
             return;
180 180
         }
181
-        $className = Helper::buildClassName('ColumnValue'.$column, 'Controllers\ListTableColumns');
182
-        $value = glsr()->runIf($className, $review);
183
-        $value = glsr()->filterString('columns/'.$column, $value, $postId);
184
-        echo Helper::ifEmpty($value, '&mdash;');
181
+        $className = Helper::buildClassName( 'ColumnValue'.$column, 'Controllers\ListTableColumns' );
182
+        $value = glsr()->runIf( $className, $review );
183
+        $value = glsr()->filterString( 'columns/'.$column, $value, $postId );
184
+        echo Helper::ifEmpty( $value, '&mdash;' );
185 185
     }
186 186
 
187 187
     /**
@@ -189,14 +189,14 @@  discard block
 block discarded – undo
189 189
      * @return void
190 190
      * @action save_post_.Application::POST_TYPE
191 191
      */
192
-    public function saveBulkEditFields($postId)
192
+    public function saveBulkEditFields( $postId )
193 193
     {
194
-        if (glsr()->can('edit_posts')) {
195
-            $review = glsr(Query::class)->review($reviewId);
196
-            $assignedPostIds = Arr::consolidate(filter_input(INPUT_GET, 'assigned_to'));
197
-            $assignedUserIds = Arr::consolidate(filter_input(INPUT_GET, 'user_ids'));
198
-            glsr()->action('review/updated/post_ids', $review, $assignedPostIds);
199
-            glsr()->action('review/updated/user_ids', $review, $assignedUserIds);
194
+        if( glsr()->can( 'edit_posts' ) ) {
195
+            $review = glsr( Query::class )->review( $reviewId );
196
+            $assignedPostIds = Arr::consolidate( filter_input( INPUT_GET, 'assigned_to' ) );
197
+            $assignedUserIds = Arr::consolidate( filter_input( INPUT_GET, 'user_ids' ) );
198
+            glsr()->action( 'review/updated/post_ids', $review, $assignedPostIds );
199
+            glsr()->action( 'review/updated/user_ids', $review, $assignedUserIds );
200 200
         }
201 201
     }
202 202
 
@@ -204,15 +204,15 @@  discard block
 block discarded – undo
204 204
      * @return void
205 205
      * @action pre_get_posts
206 206
      */
207
-    public function setQueryForColumn(WP_Query $query)
207
+    public function setQueryForColumn( WP_Query $query )
208 208
     {
209
-        if (!$this->hasPermission($query)) {
209
+        if( !$this->hasPermission( $query ) ) {
210 210
             return;
211 211
         }
212
-        $orderby = $query->get('orderby');
213
-        if ('response' === $orderby) {
214
-            $query->set('meta_key', Str::prefix('_', $orderby));
215
-            $query->set('orderby', 'meta_value');
212
+        $orderby = $query->get( 'orderby' );
213
+        if( 'response' === $orderby ) {
214
+            $query->set( 'meta_key', Str::prefix( '_', $orderby ) );
215
+            $query->set( 'orderby', 'meta_value' );
216 216
         }
217 217
     }
218 218
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      * @param string $domain
222 222
      * @return bool
223 223
      */
224
-    protected function canModifyTranslation($domain = 'default')
224
+    protected function canModifyTranslation( $domain = 'default' )
225 225
     {
226 226
         $screen = glsr_current_screen();
227 227
         return 'default' == $domain
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
     /**
233 233
      * @return bool
234 234
      */
235
-    protected function hasPermission(WP_Query $query)
235
+    protected function hasPermission( WP_Query $query )
236 236
     {
237 237
         global $pagenow;
238 238
         return is_admin()
239 239
             && $query->is_main_query()
240
-            && glsr()->post_type == $query->get('post_type')
240
+            && glsr()->post_type == $query->get( 'post_type' )
241 241
             && 'edit.php' == $pagenow;
242 242
     }
243 243
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      * @param string $join
246 246
      * @return string
247 247
      */
248
-    protected function modifyClauseJoin($join, $table, WP_Query $query)
248
+    protected function modifyClauseJoin( $join, $table, WP_Query $query )
249 249
     {
250 250
         global $wpdb;
251 251
         $join .= " INNER JOIN {$table} ON {$table}.review_id = {$wpdb->posts}.ID ";
@@ -256,10 +256,10 @@  discard block
 block discarded – undo
256 256
      * @param string $orderby
257 257
      * @return string
258 258
      */
259
-    protected function modifyClauseOrderby($orderby, $table, WP_Query $query)
259
+    protected function modifyClauseOrderby( $orderby, $table, WP_Query $query )
260 260
     {
261
-        $order = $query->get('order');
262
-        $orderby = $query->get('orderby');
261
+        $order = $query->get( 'order' );
262
+        $orderby = $query->get( 'orderby' );
263 263
         $columns = [
264 264
             'email' => 'email',
265 265
             'ip_address' => 'ip_address',
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
             'review_type' => 'type',
269 269
             'reviewer' => 'name',
270 270
         ];
271
-        if (array_key_exists($orderby, $columns)) {
271
+        if( array_key_exists( $orderby, $columns ) ) {
272 272
             $column = "{$table}.{$columns[$orderby]}";
273 273
             $orderby = "NULLIF({$column}, '') IS NULL, {$column} {$order}";
274 274
         }
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
      * @param string $where
280 280
      * @return string
281 281
      */
282
-    protected function modifyClauseWhere($where, $table, WP_Query $query)
282
+    protected function modifyClauseWhere( $where, $table, WP_Query $query )
283 283
     {
284
-        $filters = Arr::removeEmptyValues([
285
-            'rating' => filter_input(INPUT_GET, 'rating'),
286
-            'type' => filter_input(INPUT_GET, 'review_type'),
287
-        ]);
288
-        foreach ($filters as $key => $value) {
284
+        $filters = Arr::removeEmptyValues( [
285
+            'rating' => filter_input( INPUT_GET, 'rating' ),
286
+            'type' => filter_input( INPUT_GET, 'review_type' ),
287
+        ] );
288
+        foreach( $filters as $key => $value ) {
289 289
             $where .= " (AND {$table}.{$key} = '{$value}') ";
290 290
         }
291 291
         return $where;
Please login to merge, or discard this patch.