Passed
Push — master ( ccb079...7906b4 )
by Paul
04:39
created
plugin/Modules/Html/Partials/StarRating.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@  discard block
 block discarded – undo
14 14
     /**
15 15
      * {@inheritdoc}
16 16
      */
17
-    public function build(array $args = [])
17
+    public function build( array $args = [] )
18 18
     {
19
-        $this->setProperties($args);
20
-        $fullStars = intval(floor($this->rating));
21
-        $halfStars = intval(ceil($this->rating - $fullStars));
22
-        $emptyStars = max(0, glsr()->constant('MAX_RATING', Rating::class) - $fullStars - $halfStars);
23
-        return glsr(Template::class)->build('templates/rating/stars', [
19
+        $this->setProperties( $args );
20
+        $fullStars = intval( floor( $this->rating ) );
21
+        $halfStars = intval( ceil( $this->rating - $fullStars ) );
22
+        $emptyStars = max( 0, glsr()->constant( 'MAX_RATING', Rating::class ) - $fullStars - $halfStars );
23
+        return glsr( Template::class )->build( 'templates/rating/stars', [
24 24
             'context' => [
25
-                'empty_stars' => $this->getTemplate('empty-star', $emptyStars),
26
-                'full_stars' => $this->getTemplate('full-star', $fullStars),
27
-                'half_stars' => $this->getTemplate('half-star', $halfStars),
25
+                'empty_stars' => $this->getTemplate( 'empty-star', $emptyStars ),
26
+                'full_stars' => $this->getTemplate( 'full-star', $fullStars ),
27
+                'half_stars' => $this->getTemplate( 'half-star', $halfStars ),
28 28
                 'prefix' => $this->prefix,
29
-                'title' => sprintf(__('%s rating', 'site-reviews'), number_format_i18n($this->rating, 1)),
29
+                'title' => sprintf( __( '%s rating', 'site-reviews' ), number_format_i18n( $this->rating, 1 ) ),
30 30
             ],
31
-        ]);
31
+        ] );
32 32
     }
33 33
 
34 34
     /**
@@ -36,26 +36,26 @@  discard block
 block discarded – undo
36 36
      * @param int $timesRepeated
37 37
      * @return string
38 38
      */
39
-    protected function getTemplate($templateName, $timesRepeated)
39
+    protected function getTemplate( $templateName, $timesRepeated )
40 40
     {
41
-        $template = glsr(Template::class)->build('templates/rating/'.$templateName, [
41
+        $template = glsr( Template::class )->build( 'templates/rating/'.$templateName, [
42 42
             'context' => [
43 43
                 'prefix' => $this->prefix,
44 44
             ],
45
-        ]);
46
-        return str_repeat($template, $timesRepeated);
45
+        ] );
46
+        return str_repeat( $template, $timesRepeated );
47 47
     }
48 48
 
49 49
     /**
50 50
      * @return array
51 51
      */
52
-    protected function setProperties(array $args)
52
+    protected function setProperties( array $args )
53 53
     {
54
-        $args = wp_parse_args($args, [
54
+        $args = wp_parse_args( $args, [
55 55
             'prefix' => glsr()->isAdmin() ? '' : 'glsr-',
56 56
             'rating' => 0,
57
-        ]);
57
+        ] );
58 58
         $this->prefix = $args['prefix'];
59
-        $this->rating = (float) str_replace(',', '.', $args['rating']);
59
+        $this->rating = (float)str_replace( ',', '.', $args['rating'] );
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 1 patch
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
      * @param Reviews|null $reviews
46 46
      * @return ReviewsHtml
47 47
      */
48
-    public function build(array $args = [], $reviews = null)
48
+    public function build( array $args = [], $reviews = null )
49 49
     {
50
-        $this->args = glsr(SiteReviewsDefaults::class)->merge($args);
51
-        $this->options = Arr::flatten(glsr(OptionManager::class)->all());
50
+        $this->args = glsr( SiteReviewsDefaults::class )->merge( $args );
51
+        $this->options = Arr::flatten( glsr( OptionManager::class )->all() );
52 52
         $this->reviews = $reviews instanceof Reviews
53 53
             ? $reviews
54
-            : glsr(ReviewManager::class)->get($this->args);
54
+            : glsr( ReviewManager::class )->get( $this->args );
55 55
         $this->generateSchema();
56 56
         return $this->buildReviews();
57 57
     }
@@ -59,26 +59,26 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * @return ReviewHtml
61 61
      */
62
-    public function buildReview(Review $review)
62
+    public function buildReview( Review $review )
63 63
     {
64
-        $review = apply_filters('site-reviews/review/build/before', $review);
64
+        $review = apply_filters( 'site-reviews/review/build/before', $review );
65 65
         $this->current = $review;
66 66
         $renderedFields = [];
67
-        foreach ($review as $key => $value) {
68
-            $method = Helper::buildMethodName($key, 'buildOption');
69
-            $field = method_exists($this, $method)
70
-                ? $this->$method($key, $value)
67
+        foreach( $review as $key => $value ) {
68
+            $method = Helper::buildMethodName( $key, 'buildOption' );
69
+            $field = method_exists( $this, $method )
70
+                ? $this->$method( $key, $value )
71 71
                 : false;
72
-            $field = apply_filters('site-reviews/review/build/'.$key, $field, $value, $review, $this);
73
-            if (false === $field) {
72
+            $field = apply_filters( 'site-reviews/review/build/'.$key, $field, $value, $review, $this );
73
+            if( false === $field ) {
74 74
                 continue;
75 75
             }
76 76
             $renderedFields[$key] = $field;
77 77
         }
78
-        $this->wrap($renderedFields, $review);
79
-        $renderedFields = apply_filters('site-reviews/review/build/after', $renderedFields, $review, $this);
78
+        $this->wrap( $renderedFields, $review );
79
+        $renderedFields = apply_filters( 'site-reviews/review/build/after', $renderedFields, $review, $this );
80 80
         $this->current = null;
81
-        return new ReviewHtml($review, (array) $renderedFields);
81
+        return new ReviewHtml( $review, (array)$renderedFields );
82 82
     }
83 83
 
84 84
     /**
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
     public function buildReviews()
88 88
     {
89 89
         $renderedReviews = [];
90
-        foreach ($this->reviews as $index => $review) {
91
-            $renderedReviews[] = $this->buildReview($review);
90
+        foreach( $this->reviews as $index => $review ) {
91
+            $renderedReviews[] = $this->buildReview( $review );
92 92
         }
93
-        return new ReviewsHtml($renderedReviews, $this->reviews->max_num_pages, $this->args);
93
+        return new ReviewsHtml( $renderedReviews, $this->reviews->max_num_pages, $this->args );
94 94
     }
95 95
 
96 96
     /**
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function generateSchema()
100 100
     {
101
-        if (!wp_validate_boolean($this->args['schema'])) {
101
+        if( !wp_validate_boolean( $this->args['schema'] ) ) {
102 102
             return;
103 103
         }
104
-        glsr(Schema::class)->store(
105
-            glsr(Schema::class)->build($this->args)
104
+        glsr( Schema::class )->store(
105
+            glsr( Schema::class )->build( $this->args )
106 106
         );
107 107
     }
108 108
 
@@ -110,20 +110,20 @@  discard block
 block discarded – undo
110 110
      * @param string $text
111 111
      * @return string
112 112
      */
113
-    public function getExcerpt($text)
113
+    public function getExcerpt( $text )
114 114
     {
115
-        $limit = intval($this->getOption('settings.reviews.excerpts_length', 55));
116
-        $split = extension_loaded('intl')
117
-            ? $this->getExcerptIntlSplit($text, $limit)
118
-            : $this->getExcerptSplit($text, $limit);
119
-        $hiddenText = substr($text, $split);
120
-        if (!empty($hiddenText)) {
121
-            $showMore = glsr(Builder::class)->span($hiddenText, [
115
+        $limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) );
116
+        $split = extension_loaded( 'intl' )
117
+            ? $this->getExcerptIntlSplit( $text, $limit )
118
+            : $this->getExcerptSplit( $text, $limit );
119
+        $hiddenText = substr( $text, $split );
120
+        if( !empty($hiddenText) ) {
121
+            $showMore = glsr( Builder::class )->span( $hiddenText, [
122 122
                 'class' => 'glsr-hidden glsr-hidden-text',
123
-                'data-show-less' => __('Show less', 'site-reviews'),
124
-                'data-show-more' => __('Show more', 'site-reviews'),
125
-            ]);
126
-            $text = ltrim(substr($text, 0, $split)).$showMore;
123
+                'data-show-less' => __( 'Show less', 'site-reviews' ),
124
+                'data-show-more' => __( 'Show more', 'site-reviews' ),
125
+            ] );
126
+            $text = ltrim( substr( $text, 0, $split ) ).$showMore;
127 127
         }
128 128
         return $text;
129 129
     }
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
      * @param string $path
134 134
      * @return bool
135 135
      */
136
-    public function isHidden($key, $path = '')
136
+    public function isHidden( $key, $path = '' )
137 137
     {
138 138
         $isOptionEnabled = !empty($path)
139
-            ? $this->isOptionEnabled($path)
139
+            ? $this->isOptionEnabled( $path )
140 140
             : true;
141
-        return in_array($key, $this->args['hide']) || !$isOptionEnabled;
141
+        return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
142 142
     }
143 143
 
144 144
     /**
@@ -146,25 +146,25 @@  discard block
 block discarded – undo
146 146
      * @param string $value
147 147
      * @return bool
148 148
      */
149
-    public function isHiddenOrEmpty($key, $value)
149
+    public function isHiddenOrEmpty( $key, $value )
150 150
     {
151
-        return $this->isHidden($key) || empty($value);
151
+        return $this->isHidden( $key ) || empty($value);
152 152
     }
153 153
 
154 154
     /**
155 155
      * @param string $text
156 156
      * @return string
157 157
      */
158
-    public function normalizeText($text)
158
+    public function normalizeText( $text )
159 159
     {
160
-        $text = wp_kses($text, wp_kses_allowed_html());
161
-        $text = convert_smilies(strip_shortcodes($text));
162
-        $text = str_replace(']]>', ']]>', $text);
163
-        $text = preg_replace('/(\R){2,}/', '$1', $text);
164
-        if ($this->isOptionEnabled('settings.reviews.excerpts')) {
165
-            $text = $this->getExcerpt($text);
160
+        $text = wp_kses( $text, wp_kses_allowed_html() );
161
+        $text = convert_smilies( strip_shortcodes( $text ) );
162
+        $text = str_replace( ']]>', ']]>', $text );
163
+        $text = preg_replace( '/(\R){2,}/', '$1', $text );
164
+        if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) {
165
+            $text = $this->getExcerpt( $text );
166 166
         }
167
-        return wptexturize(nl2br($text));
167
+        return wptexturize( nl2br( $text ) );
168 168
     }
169 169
 
170 170
     /**
@@ -172,19 +172,19 @@  discard block
 block discarded – undo
172 172
      * @param string $value
173 173
      * @return void|string
174 174
      */
175
-    protected function buildOptionAssignedTo($key, $value)
175
+    protected function buildOptionAssignedTo( $key, $value )
176 176
     {
177
-        if ($this->isHidden($key, 'settings.reviews.assigned_links')) {
177
+        if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) ) {
178 178
             return;
179 179
         }
180
-        $post = get_post(glsr(Multilingual::class)->getPostId($value));
181
-        if (empty($post->ID)) {
180
+        $post = get_post( glsr( Multilingual::class )->getPostId( $value ) );
181
+        if( empty($post->ID) ) {
182 182
             return;
183 183
         }
184
-        $permalink = glsr(Builder::class)->a(get_the_title($post->ID), [
185
-            'href' => get_the_permalink($post->ID),
186
-        ]);
187
-        $assignedTo = sprintf(__('Review of %s', 'site-reviews'), $permalink);
184
+        $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
185
+            'href' => get_the_permalink( $post->ID ),
186
+        ] );
187
+        $assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
188 188
         return '<span>'.$assignedTo.'</span>';
189 189
     }
190 190
 
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
      * @param string $value
194 194
      * @return void|string
195 195
      */
196
-    protected function buildOptionAuthor($key, $value)
196
+    protected function buildOptionAuthor( $key, $value )
197 197
     {
198
-        if (!$this->isHidden($key)) {
198
+        if( !$this->isHidden( $key ) ) {
199 199
             $name = Str::convertName(
200 200
                 $value,
201
-                glsr_get_option('reviews.name.format'),
202
-                glsr_get_option('reviews.name.initial')
201
+                glsr_get_option( 'reviews.name.format' ),
202
+                glsr_get_option( 'reviews.name.initial' )
203 203
             );
204 204
             return '<span>'.$name.'</span>';
205 205
         }
@@ -210,18 +210,18 @@  discard block
 block discarded – undo
210 210
      * @param string $value
211 211
      * @return void|string
212 212
      */
213
-    protected function buildOptionAvatar($key, $value)
213
+    protected function buildOptionAvatar( $key, $value )
214 214
     {
215
-        if ($this->isHidden($key, 'settings.reviews.avatars')) {
215
+        if( $this->isHidden( $key, 'settings.reviews.avatars' ) ) {
216 216
             return;
217 217
         }
218
-        $size = $this->getOption('settings.reviews.avatars_size', 40);
219
-        return glsr(Builder::class)->img([
218
+        $size = $this->getOption( 'settings.reviews.avatars_size', 40 );
219
+        return glsr( Builder::class )->img( [
220 220
             'height' => $size,
221
-            'src' => $this->generateAvatar($value),
222
-            'style' => sprintf('width:%1$spx; height:%1$spx;', $size),
221
+            'src' => $this->generateAvatar( $value ),
222
+            'style' => sprintf( 'width:%1$spx; height:%1$spx;', $size ),
223 223
             'width' => $size,
224
-        ]);
224
+        ] );
225 225
     }
226 226
 
227 227
     /**
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
      * @param string $value
230 230
      * @return void|string
231 231
      */
232
-    protected function buildOptionContent($key, $value)
232
+    protected function buildOptionContent( $key, $value )
233 233
     {
234
-        $text = $this->normalizeText($value);
235
-        if (!$this->isHiddenOrEmpty($key, $text)) {
234
+        $text = $this->normalizeText( $value );
235
+        if( !$this->isHiddenOrEmpty( $key, $text ) ) {
236 236
             return '<p>'.$text.'</p>';
237 237
         }
238 238
     }
@@ -242,19 +242,19 @@  discard block
 block discarded – undo
242 242
      * @param string $value
243 243
      * @return void|string
244 244
      */
245
-    protected function buildOptionDate($key, $value)
245
+    protected function buildOptionDate( $key, $value )
246 246
     {
247
-        if ($this->isHidden($key)) {
247
+        if( $this->isHidden( $key ) ) {
248 248
             return;
249 249
         }
250
-        $dateFormat = $this->getOption('settings.reviews.date.format', 'default');
251
-        if ('relative' == $dateFormat) {
252
-            $date = glsr(Date::class)->relative($value);
250
+        $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
251
+        if( 'relative' == $dateFormat ) {
252
+            $date = glsr( Date::class )->relative( $value );
253 253
         } else {
254 254
             $format = 'custom' == $dateFormat
255
-                ? $this->getOption('settings.reviews.date.custom', 'M j, Y')
256
-                : glsr(OptionManager::class)->getWP('date_format', 'F j, Y');
257
-            $date = date_i18n($format, strtotime($value));
255
+                ? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
256
+                : glsr( OptionManager::class )->getWP( 'date_format', 'F j, Y' );
257
+            $date = date_i18n( $format, strtotime( $value ) );
258 258
         }
259 259
         return '<span>'.$date.'</span>';
260 260
     }
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
      * @param string $value
265 265
      * @return void|string
266 266
      */
267
-    protected function buildOptionRating($key, $value)
267
+    protected function buildOptionRating( $key, $value )
268 268
     {
269
-        if (!$this->isHiddenOrEmpty($key, $value)) {
270
-            return glsr_star_rating($value);
269
+        if( !$this->isHiddenOrEmpty( $key, $value ) ) {
270
+            return glsr_star_rating( $value );
271 271
         }
272 272
     }
273 273
 
@@ -276,16 +276,16 @@  discard block
 block discarded – undo
276 276
      * @param string $value
277 277
      * @return void|string
278 278
      */
279
-    protected function buildOptionResponse($key, $value)
279
+    protected function buildOptionResponse( $key, $value )
280 280
     {
281
-        if ($this->isHiddenOrEmpty($key, $value)) {
281
+        if( $this->isHiddenOrEmpty( $key, $value ) ) {
282 282
             return;
283 283
         }
284
-        $title = sprintf(__('Response from %s', 'site-reviews'), get_bloginfo('name'));
285
-        $text = $this->normalizeText($value);
284
+        $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
285
+        $text = $this->normalizeText( $value );
286 286
         $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
287
-        $response = glsr(Builder::class)->div($text, ['class' => 'glsr-review-response-inner']);
288
-        $background = glsr(Builder::class)->div(['class' => 'glsr-review-response-background']);
287
+        $response = glsr( Builder::class )->div( $text, ['class' => 'glsr-review-response-inner'] );
288
+        $background = glsr( Builder::class )->div( ['class' => 'glsr-review-response-background'] );
289 289
         return $response.$background;
290 290
     }
291 291
 
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
      * @param string $value
295 295
      * @return void|string
296 296
      */
297
-    protected function buildOptionTitle($key, $value)
297
+    protected function buildOptionTitle( $key, $value )
298 298
     {
299
-        if ($this->isHidden($key)) {
299
+        if( $this->isHidden( $key ) ) {
300 300
             return;
301 301
         }
302
-        if (empty($value)) {
303
-            $value = __('No Title', 'site-reviews');
302
+        if( empty($value) ) {
303
+            $value = __( 'No Title', 'site-reviews' );
304 304
         }
305 305
         return '<h3>'.$value.'</h3>';
306 306
     }
@@ -309,18 +309,18 @@  discard block
 block discarded – undo
309 309
      * @param string $avatarUrl
310 310
      * @return string
311 311
      */
312
-    protected function generateAvatar($avatarUrl)
312
+    protected function generateAvatar( $avatarUrl )
313 313
     {
314
-        if (!$this->isOptionEnabled('settings.reviews.avatars_regenerate') || 'local' != $this->current->review_type) {
314
+        if( !$this->isOptionEnabled( 'settings.reviews.avatars_regenerate' ) || 'local' != $this->current->review_type ) {
315 315
             return $avatarUrl;
316 316
         }
317
-        if ($this->current->user_id) {
318
-        $authorIdOrEmail = get_the_author_meta('ID', $this->current->user_id);
317
+        if( $this->current->user_id ) {
318
+        $authorIdOrEmail = get_the_author_meta( 'ID', $this->current->user_id );
319 319
         }
320
-        if (empty($authorIdOrEmail)) {
320
+        if( empty($authorIdOrEmail) ) {
321 321
             $authorIdOrEmail = $this->current->email;
322 322
         }
323
-        if ($newAvatar = get_avatar_url($authorIdOrEmail)) {
323
+        if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) {
324 324
             return $newAvatar;
325 325
         }
326 326
         return $avatarUrl;
@@ -331,22 +331,22 @@  discard block
 block discarded – undo
331 331
      * @param int $limit
332 332
      * @return int
333 333
      */
334
-    protected function getExcerptIntlSplit($text, $limit)
334
+    protected function getExcerptIntlSplit( $text, $limit )
335 335
     {
336
-        $words = IntlRuleBasedBreakIterator::createWordInstance('');
337
-        $words->setText($text);
336
+        $words = IntlRuleBasedBreakIterator::createWordInstance( '' );
337
+        $words->setText( $text );
338 338
         $count = 0;
339
-        foreach ($words as $offset) {
340
-            if (IntlRuleBasedBreakIterator::WORD_NONE === $words->getRuleStatus()) {
339
+        foreach( $words as $offset ) {
340
+            if( IntlRuleBasedBreakIterator::WORD_NONE === $words->getRuleStatus() ) {
341 341
                 continue;
342 342
             }
343 343
             ++$count;
344
-            if ($count != $limit) {
344
+            if( $count != $limit ) {
345 345
                 continue;
346 346
             }
347 347
             return $offset;
348 348
         }
349
-        return strlen($text);
349
+        return strlen( $text );
350 350
     }
351 351
 
352 352
     /**
@@ -354,13 +354,13 @@  discard block
 block discarded – undo
354 354
      * @param int $limit
355 355
      * @return int
356 356
      */
357
-    protected function getExcerptSplit($text, $limit)
357
+    protected function getExcerptSplit( $text, $limit )
358 358
     {
359
-        if (str_word_count($text, 0) > $limit) {
360
-            $words = array_keys(str_word_count($text, 2));
359
+        if( str_word_count( $text, 0 ) > $limit ) {
360
+            $words = array_keys( str_word_count( $text, 2 ) );
361 361
             return $words[$limit];
362 362
         }
363
-        return strlen($text);
363
+        return strlen( $text );
364 364
     }
365 365
 
366 366
     /**
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
      * @param mixed $fallback
369 369
      * @return mixed
370 370
      */
371
-    protected function getOption($path, $fallback = '')
371
+    protected function getOption( $path, $fallback = '' )
372 372
     {
373
-        if (array_key_exists($path, $this->options)) {
373
+        if( array_key_exists( $path, $this->options ) ) {
374 374
             return $this->options[$path];
375 375
         }
376 376
         return $fallback;
@@ -380,25 +380,25 @@  discard block
 block discarded – undo
380 380
      * @param string $path
381 381
      * @return bool
382 382
      */
383
-    protected function isOptionEnabled($path)
383
+    protected function isOptionEnabled( $path )
384 384
     {
385
-        return 'yes' == $this->getOption($path);
385
+        return 'yes' == $this->getOption( $path );
386 386
     }
387 387
 
388 388
     /**
389 389
      * @return void
390 390
      */
391
-    protected function wrap(array &$renderedFields, Review $review)
391
+    protected function wrap( array &$renderedFields, Review $review )
392 392
     {
393
-        $renderedFields = apply_filters('site-reviews/review/wrap', $renderedFields, $review, $this);
394
-        array_walk($renderedFields, function (&$value, $key) use ($review) {
395
-            $value = apply_filters('site-reviews/review/wrap/'.$key, $value, $review);
396
-            if (empty($value)) {
393
+        $renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review, $this );
394
+        array_walk( $renderedFields, function( &$value, $key ) use ($review) {
395
+            $value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review );
396
+            if( empty($value) ) {
397 397
                 return;
398 398
             }
399
-            $value = glsr(Builder::class)->div($value, [
399
+            $value = glsr( Builder::class )->div( $value, [
400 400
                 'class' => 'glsr-review-'.$key,
401
-            ]);
401
+            ] );
402 402
         });
403 403
     }
404 404
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partial.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@  discard block
 block discarded – undo
10 10
      * @param string $partialPath
11 11
      * @return string
12 12
      */
13
-    public function build($partialPath, array $args = [])
13
+    public function build( $partialPath, array $args = [] )
14 14
     {
15
-        $className = Helper::buildClassName($partialPath, 'Modules\Html\Partials');
16
-        $className = apply_filters('site-reviews/partial/classname', $className, $partialPath);
17
-        if (!class_exists($className)) {
18
-            glsr_log()->error('Partial missing: '.$className);
15
+        $className = Helper::buildClassName( $partialPath, 'Modules\Html\Partials' );
16
+        $className = apply_filters( 'site-reviews/partial/classname', $className, $partialPath );
17
+        if( !class_exists( $className ) ) {
18
+            glsr_log()->error( 'Partial missing: '.$className );
19 19
             return;
20 20
         }
21
-        $args = apply_filters('site-reviews/partial/args/'.$partialPath, $args);
22
-        $partial = glsr($className)->build($args);
23
-        $partial = apply_filters('site-reviews/rendered/partial', $partial, $partialPath, $args);
24
-        $partial = apply_filters('site-reviews/rendered/partial/'.$partialPath, $partial, $args);
21
+        $args = apply_filters( 'site-reviews/partial/args/'.$partialPath, $args );
22
+        $partial = glsr( $className )->build( $args );
23
+        $partial = apply_filters( 'site-reviews/rendered/partial', $partial, $partialPath, $args );
24
+        $partial = apply_filters( 'site-reviews/rendered/partial/'.$partialPath, $partial, $args );
25 25
         return $partial;
26 26
     }
27 27
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
      * @param string $partialPath
30 30
      * @return void
31 31
      */
32
-    public function render($partialPath, array $args = [])
32
+    public function render( $partialPath, array $args = [] )
33 33
     {
34
-        echo $this->build($partialPath, $args);
34
+        echo $this->build( $partialPath, $args );
35 35
     }
36 36
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewsHtml.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public $reviews;
30 30
 
31
-    public function __construct(array $renderedReviews, $maxPageCount, array $args)
31
+    public function __construct( array $renderedReviews, $maxPageCount, array $args )
32 32
     {
33 33
         $this->args = $args;
34 34
         $this->max_num_pages = $maxPageCount;
35 35
         $this->reviews = $renderedReviews;
36 36
         $this->pagination = $this->buildPagination();
37
-        parent::__construct($renderedReviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
37
+        parent::__construct( $renderedReviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
38 38
     }
39 39
 
40 40
     /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function __toString()
44 44
     {
45
-        return glsr(Template::class)->build('templates/reviews', [
45
+        return glsr( Template::class )->build( 'templates/reviews', [
46 46
             'args' => $this->args,
47 47
             'context' => [
48 48
                 'assigned_to' => $this->args['assigned_to'],
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                 'pagination' => $this->getPagination(),
53 53
                 'reviews' => $this->getReviews(),
54 54
             ],
55
-        ]);
55
+        ] );
56 56
     }
57 57
 
58 58
     /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function getPagination()
62 62
     {
63
-        return wp_validate_boolean($this->args['pagination'])
63
+        return wp_validate_boolean( $this->args['pagination'] )
64 64
             ? $this->pagination
65 65
             : '';
66 66
     }
@@ -72,27 +72,27 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $html = empty($this->reviews)
74 74
             ? $this->getReviewsFallback()
75
-            : implode(PHP_EOL, $this->reviews);
76
-        return glsr(Builder::class)->div($html, [
75
+            : implode( PHP_EOL, $this->reviews );
76
+        return glsr( Builder::class )->div( $html, [
77 77
             'class' => 'glsr-reviews-list',
78 78
             'data-reviews' => '',
79
-        ]);
79
+        ] );
80 80
     }
81 81
 
82 82
     /**
83 83
      * @param mixed $key
84 84
      * @return mixed
85 85
      */
86
-    public function offsetGet($key)
86
+    public function offsetGet( $key )
87 87
     {
88
-        if ('navigation' == $key) {
88
+        if( 'navigation' == $key ) {
89 89
             glsr()->deprecated[] = 'The $reviewsHtml->navigation property has been been deprecated. Please use the $reviewsHtml->pagination property instead.';
90 90
             return $this->pagination;
91 91
         }
92
-        if (array_key_exists($key, $this->reviews)) {
92
+        if( array_key_exists( $key, $this->reviews ) ) {
93 93
             return $this->reviews[$key];
94 94
         }
95
-        return property_exists($this, $key)
95
+        return property_exists( $this, $key )
96 96
             ? $this->$key
97 97
             : null;
98 98
     }
@@ -102,16 +102,16 @@  discard block
 block discarded – undo
102 102
      */
103 103
     protected function buildPagination()
104 104
     {
105
-        $html = glsr(Partial::class)->build('pagination', [
106
-            'baseUrl' => Arr::get($this->args, 'pagedUrl'),
107
-            'current' => Arr::get($this->args, 'paged'),
105
+        $html = glsr( Partial::class )->build( 'pagination', [
106
+            'baseUrl' => Arr::get( $this->args, 'pagedUrl' ),
107
+            'current' => Arr::get( $this->args, 'paged' ),
108 108
             'total' => $this->max_num_pages,
109
-        ]);
110
-        return glsr(Builder::class)->div($html, [
109
+        ] );
110
+        return glsr( Builder::class )->div( $html, [
111 111
             'class' => 'glsr-pagination',
112 112
             'data-atts' => $this->args['json'],
113 113
             'data-pagination' => '',
114
-        ]);
114
+        ] );
115 115
     }
116 116
 
117 117
     /**
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
         $defaults = [
123 123
             'glsr-reviews',
124 124
         ];
125
-        if ('ajax' == $this->args['pagination']) {
125
+        if( 'ajax' == $this->args['pagination'] ) {
126 126
             $defaults[] = 'glsr-ajax-pagination';
127 127
         }
128
-        $classes = explode(' ', $this->args['class']);
129
-        $classes = array_unique(array_merge($defaults, array_filter($classes)));
130
-        return implode(' ', $classes);
128
+        $classes = explode( ' ', $this->args['class'] );
129
+        $classes = array_unique( array_merge( $defaults, array_filter( $classes ) ) );
130
+        return implode( ' ', $classes );
131 131
     }
132 132
 
133 133
     /**
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
      */
136 136
     protected function getReviewsFallback()
137 137
     {
138
-        if (empty($this->args['fallback']) && glsr(OptionManager::class)->getBool('settings.reviews.fallback')) {
139
-            $this->args['fallback'] = __('There are no reviews yet. Be the first one to write one.', 'site-reviews');
138
+        if( empty($this->args['fallback']) && glsr( OptionManager::class )->getBool( 'settings.reviews.fallback' ) ) {
139
+            $this->args['fallback'] = __( 'There are no reviews yet. Be the first one to write one.', 'site-reviews' );
140 140
         }
141 141
         $fallback = '<p class="glsr-no-margins">'.$this->args['fallback'].'</p>';
142
-        return apply_filters('site-reviews/reviews/fallback', $fallback, $this->args);
142
+        return apply_filters( 'site-reviews/reviews/fallback', $fallback, $this->args );
143 143
     }
144 144
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Builder.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -62,18 +62,18 @@  discard block
 block discarded – undo
62 62
      * @param array $args
63 63
      * @return string|void
64 64
      */
65
-    public function __call($method, $args)
65
+    public function __call( $method, $args )
66 66
     {
67 67
         $instance = new static();
68
-        $instance->setTagFromMethod($method);
69
-        call_user_func_array([$instance, 'normalize'], $args);
70
-        $tags = array_merge(static::TAGS_FORM, static::TAGS_SINGLE, static::TAGS_STRUCTURE, static::TAGS_TEXT);
71
-        do_action_ref_array('site-reviews/builder', [$instance]);
72
-        $generatedTag = in_array($instance->tag, $tags)
68
+        $instance->setTagFromMethod( $method );
69
+        call_user_func_array( [$instance, 'normalize'], $args );
70
+        $tags = array_merge( static::TAGS_FORM, static::TAGS_SINGLE, static::TAGS_STRUCTURE, static::TAGS_TEXT );
71
+        do_action_ref_array( 'site-reviews/builder', [$instance] );
72
+        $generatedTag = in_array( $instance->tag, $tags )
73 73
             ? $instance->buildTag()
74 74
             : $instance->buildCustomField();
75
-        $generatedTag = apply_filters('site-reviews/builder/result', $generatedTag, $instance);
76
-        if (!$this->render) {
75
+        $generatedTag = apply_filters( 'site-reviews/builder/result', $generatedTag, $instance );
76
+        if( !$this->render ) {
77 77
             return $generatedTag;
78 78
         }
79 79
         echo $generatedTag;
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
      * @param mixed $value
85 85
      * @return void
86 86
      */
87
-    public function __set($property, $value)
87
+    public function __set( $property, $value )
88 88
     {
89 89
         $properties = [
90 90
             'args' => 'is_array',
91 91
             'render' => 'is_bool',
92 92
             'tag' => 'is_string',
93 93
         ];
94
-        if (array_key_exists($property, $properties) && !empty($value)) {
94
+        if( array_key_exists( $property, $properties ) && !empty($value) ) {
95 95
             $this->$property = $value;
96 96
         }
97 97
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function getClosingTag()
103 103
     {
104
-        if (!empty($this->tag)) {
104
+        if( !empty($this->tag) ) {
105 105
             return '</'.$this->tag.'>';
106 106
         }
107 107
     }
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public function getOpeningTag()
113 113
     {
114
-        if (!empty($this->tag)) {
115
-            $attributes = glsr(Attributes::class)->{$this->tag}($this->args)->toString();
116
-            return '<'.trim($this->tag.' '.$attributes).'>';
114
+        if( !empty($this->tag) ) {
115
+            $attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString();
116
+            return '<'.trim( $this->tag.' '.$attributes ).'>';
117 117
         }
118 118
     }
119 119
 
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function getTag()
124 124
     {
125
-        if (in_array($this->tag, static::TAGS_SINGLE)) {
125
+        if( in_array( $this->tag, static::TAGS_SINGLE ) ) {
126 126
             return $this->getOpeningTag();
127 127
         }
128
-        if (!in_array($this->tag, static::TAGS_FORM)) {
128
+        if( !in_array( $this->tag, static::TAGS_FORM ) ) {
129 129
             return $this->buildDefaultTag();
130 130
         }
131
-        return call_user_func([$this, 'buildForm'.ucfirst($this->tag)]).$this->buildFieldDescription();
131
+        return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription();
132 132
     }
133 133
 
134 134
     /**
135 135
      * @return string
136 136
      */
137
-    public function raw(array $field)
137
+    public function raw( array $field )
138 138
     {
139 139
         unset($field['label']);
140 140
         return $this->{$field['type']}($field);
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
     protected function buildCustomField()
147 147
     {
148 148
         $className = $this->getCustomFieldClassName();
149
-        if (class_exists($className)) {
150
-            return (new $className($this))->build();
149
+        if( class_exists( $className ) ) {
150
+            return (new $className( $this ))->build();
151 151
         }
152
-        glsr_log()->error('Field class missing: '.$className);
152
+        glsr_log()->error( 'Field class missing: '.$className );
153 153
     }
154 154
 
155 155
     /**
156 156
      * @return string|void
157 157
      */
158
-    protected function buildDefaultTag($text = '')
158
+    protected function buildDefaultTag( $text = '' )
159 159
     {
160
-        if (empty($text)) {
160
+        if( empty($text) ) {
161 161
             $text = $this->args['text'];
162 162
         }
163 163
         return $this->getOpeningTag().$text.$this->getClosingTag();
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
      */
169 169
     protected function buildFieldDescription()
170 170
     {
171
-        if (empty($this->args['description'])) {
171
+        if( empty($this->args['description']) ) {
172 172
             return;
173 173
         }
174
-        if ($this->args['is_widget']) {
175
-            return $this->small($this->args['description']);
174
+        if( $this->args['is_widget'] ) {
175
+            return $this->small( $this->args['description'] );
176 176
         }
177
-        return $this->p($this->args['description'], ['class' => 'description']);
177
+        return $this->p( $this->args['description'], ['class' => 'description'] );
178 178
     }
179 179
 
180 180
     /**
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
      */
183 183
     protected function buildFormInput()
184 184
     {
185
-        if (!in_array($this->args['type'], ['checkbox', 'radio'])) {
186
-            if (isset($this->args['multiple'])) {
185
+        if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) {
186
+            if( isset($this->args['multiple']) ) {
187 187
                 $this->args['name'] .= '[]';
188 188
             }
189 189
             return $this->buildFormLabel().$this->getOpeningTag();
@@ -198,19 +198,19 @@  discard block
 block discarded – undo
198 198
      */
199 199
     protected function buildFormInputChoice()
200 200
     {
201
-        if (!empty($this->args['text'])) {
201
+        if( !empty($this->args['text']) ) {
202 202
             $this->args['label'] = $this->args['text'];
203 203
         }
204
-        if (!$this->args['is_public']) {
205
-            return $this->buildFormLabel([
204
+        if( !$this->args['is_public'] ) {
205
+            return $this->buildFormLabel( [
206 206
                 'class' => 'glsr-'.$this->args['type'].'-label',
207 207
                 'text' => $this->getOpeningTag().' '.$this->args['label'].'<span></span>',
208
-            ]);
208
+            ] );
209 209
         }
210
-        return $this->getOpeningTag().$this->buildFormLabel([
210
+        return $this->getOpeningTag().$this->buildFormLabel( [
211 211
             'class' => 'glsr-'.$this->args['type'].'-label',
212 212
             'text' => $this->args['label'].'<span></span>',
213
-        ]);
213
+        ] );
214 214
     }
215 215
 
216 216
     /**
@@ -218,39 +218,39 @@  discard block
 block discarded – undo
218 218
      */
219 219
     protected function buildFormInputMultiChoice()
220 220
     {
221
-        if ('checkbox' == $this->args['type']) {
221
+        if( 'checkbox' == $this->args['type'] ) {
222 222
             $this->args['name'] .= '[]';
223 223
         }
224 224
         $index = 0;
225
-        $options = array_reduce(array_keys($this->args['options']), function ($carry, $key) use (&$index) {
226
-            return $carry.$this->li($this->{$this->args['type']}([
227
-                'checked' => in_array($key, (array) $this->args['value']),
225
+        $options = array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) use (&$index) {
226
+            return $carry.$this->li( $this->{$this->args['type']}([
227
+                'checked' => in_array( $key, (array)$this->args['value'] ),
228 228
                 'id' => $this->args['id'].'-'.$index++,
229 229
                 'name' => $this->args['name'],
230 230
                 'text' => $this->args['options'][$key],
231 231
                 'value' => $key,
232
-            ]));
232
+            ]) );
233 233
         });
234
-        return $this->ul($options, [
234
+        return $this->ul( $options, [
235 235
             'class' => $this->args['class'],
236 236
             'id' => $this->args['id'],
237
-        ]);
237
+        ] );
238 238
     }
239 239
 
240 240
     /**
241 241
      * @return void|string
242 242
      */
243
-    protected function buildFormLabel(array $customArgs = [])
243
+    protected function buildFormLabel( array $customArgs = [] )
244 244
     {
245
-        if (empty($this->args['label']) || 'hidden' == $this->args['type']) {
245
+        if( empty($this->args['label']) || 'hidden' == $this->args['type'] ) {
246 246
             return;
247 247
         }
248
-        return $this->label(wp_parse_args($customArgs, [
248
+        return $this->label( wp_parse_args( $customArgs, [
249 249
             'for' => $this->args['id'],
250 250
             'is_public' => $this->args['is_public'],
251 251
             'text' => $this->args['label'],
252 252
             'type' => $this->args['type'],
253
-        ]));
253
+        ] ) );
254 254
     }
255 255
 
256 256
     /**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     protected function buildFormSelect()
260 260
     {
261
-        return $this->buildFormLabel().$this->buildDefaultTag($this->buildFormSelectOptions());
261
+        return $this->buildFormLabel().$this->buildDefaultTag( $this->buildFormSelectOptions() );
262 262
     }
263 263
 
264 264
     /**
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
      */
267 267
     protected function buildFormSelectOptions()
268 268
     {
269
-        return array_reduce(array_keys($this->args['options']), function ($carry, $key) {
270
-            return $carry.$this->option([
271
-                'selected' => $this->args['value'] === (string) $key,
269
+        return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) {
270
+            return $carry.$this->option( [
271
+                'selected' => $this->args['value'] === (string)$key,
272 272
                 'text' => $this->args['options'][$key],
273 273
                 'value' => $key,
274
-            ]);
274
+            ] );
275 275
         });
276 276
     }
277 277
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
      */
281 281
     protected function buildFormTextarea()
282 282
     {
283
-        return $this->buildFormLabel().$this->buildDefaultTag($this->args['value']);
283
+        return $this->buildFormLabel().$this->buildDefaultTag( $this->args['value'] );
284 284
     }
285 285
 
286 286
     /**
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
      */
298 298
     protected function getCustomFieldClassName()
299 299
     {
300
-        $classname = Helper::buildClassName($this->tag, __NAMESPACE__.'\Fields');
301
-        return apply_filters('site-reviews/builder/field/'.$this->tag, $classname);
300
+        $classname = Helper::buildClassName( $this->tag, __NAMESPACE__.'\Fields' );
301
+        return apply_filters( 'site-reviews/builder/field/'.$this->tag, $classname );
302 302
     }
303 303
 
304 304
     /**
@@ -307,29 +307,29 @@  discard block
 block discarded – undo
307 307
     protected function mergeArgsWithRequiredDefaults()
308 308
     {
309 309
         $className = $this->getCustomFieldClassName();
310
-        if (class_exists($className)) {
311
-            $this->args = $className::merge($this->args);
310
+        if( class_exists( $className ) ) {
311
+            $this->args = $className::merge( $this->args );
312 312
         }
313
-        $this->args = glsr(BuilderDefaults::class)->merge($this->args);
313
+        $this->args = glsr( BuilderDefaults::class )->merge( $this->args );
314 314
     }
315 315
 
316 316
     /**
317 317
      * @param string|array ...$params
318 318
      * @return void
319 319
      */
320
-    protected function normalize(...$params)
320
+    protected function normalize( ...$params )
321 321
     {
322
-        $parameter1 = Arr::get($params, 0);
323
-        $parameter2 = Arr::get($params, 1);
324
-        if (is_string($parameter1) || is_numeric($parameter1)) {
325
-            $this->setNameOrTextAttributeForTag($parameter1);
322
+        $parameter1 = Arr::get( $params, 0 );
323
+        $parameter2 = Arr::get( $params, 1 );
324
+        if( is_string( $parameter1 ) || is_numeric( $parameter1 ) ) {
325
+            $this->setNameOrTextAttributeForTag( $parameter1 );
326 326
         }
327
-        if (is_array($parameter1)) {
327
+        if( is_array( $parameter1 ) ) {
328 328
             $this->args += $parameter1;
329
-        } elseif (is_array($parameter2)) {
329
+        } elseif( is_array( $parameter2 ) ) {
330 330
             $this->args += $parameter2;
331 331
         }
332
-        if (!isset($this->args['is_public'])) {
332
+        if( !isset($this->args['is_public']) ) {
333 333
             $this->args['is_public'] = false;
334 334
         }
335 335
     }
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
      * @param string $value
339 339
      * @return void
340 340
      */
341
-    protected function setNameOrTextAttributeForTag($value)
341
+    protected function setNameOrTextAttributeForTag( $value )
342 342
     {
343
-        $attribute = in_array($this->tag, static::TAGS_FORM)
343
+        $attribute = in_array( $this->tag, static::TAGS_FORM )
344 344
             ? 'name'
345 345
             : 'text';
346 346
         $this->args[$attribute] = $value;
@@ -350,10 +350,10 @@  discard block
 block discarded – undo
350 350
      * @param string $method
351 351
      * @return void
352 352
      */
353
-    protected function setTagFromMethod($method)
353
+    protected function setTagFromMethod( $method )
354 354
     {
355
-        $this->tag = strtolower($method);
356
-        if (in_array($this->tag, static::INPUT_TYPES)) {
355
+        $this->tag = strtolower( $method );
356
+        if( in_array( $this->tag, static::INPUT_TYPES ) ) {
357 357
             $this->args['type'] = $this->tag;
358 358
             $this->tag = 'input';
359 359
         }
Please login to merge, or discard this patch.
plugin/Modules/Html/Settings.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -20,31 +20,31 @@  discard block
 block discarded – undo
20 20
      * @param string $id
21 21
      * @return string
22 22
      */
23
-    public function buildFields($id)
23
+    public function buildFields( $id )
24 24
     {
25
-        $this->settings = glsr(DefaultsManager::class)->settings();
26
-        $method = Helper::buildMethodName($id, 'getTemplateDataFor');
27
-        $data = !method_exists($this, $method)
28
-            ? $this->getTemplateData($id)
29
-            : $this->$method($id);
30
-        return glsr(Template::class)->build('pages/settings/'.$id, $data);
25
+        $this->settings = glsr( DefaultsManager::class )->settings();
26
+        $method = Helper::buildMethodName( $id, 'getTemplateDataFor' );
27
+        $data = !method_exists( $this, $method )
28
+            ? $this->getTemplateData( $id )
29
+            : $this->$method( $id );
30
+        return glsr( Template::class )->build( 'pages/settings/'.$id, $data );
31 31
     }
32 32
 
33 33
     /**
34 34
      * @return string
35 35
      */
36
-    protected function getFieldDefault(array $field)
36
+    protected function getFieldDefault( array $field )
37 37
     {
38
-        return Arr::get($field, 'default');
38
+        return Arr::get( $field, 'default' );
39 39
     }
40 40
 
41 41
     /**
42 42
      * @return string
43 43
      */
44
-    protected function getFieldNameForDependsOn($path)
44
+    protected function getFieldNameForDependsOn( $path )
45 45
     {
46
-        $fieldName = Str::convertPathToName($path, OptionManager::databaseKey());
47
-        return $this->isMultiDependency($path)
46
+        $fieldName = Str::convertPathToName( $path, OptionManager::databaseKey() );
47
+        return $this->isMultiDependency( $path )
48 48
             ? $fieldName.'[]'
49 49
             : $fieldName;
50 50
     }
@@ -52,25 +52,25 @@  discard block
 block discarded – undo
52 52
     /**
53 53
      * @return array
54 54
      */
55
-    protected function getSettingFields($path)
55
+    protected function getSettingFields( $path )
56 56
     {
57
-        return array_filter($this->settings, function ($key) use ($path) {
58
-            return Str::startsWith($path, $key);
59
-        }, ARRAY_FILTER_USE_KEY);
57
+        return array_filter( $this->settings, function( $key ) use ($path) {
58
+            return Str::startsWith( $path, $key );
59
+        }, ARRAY_FILTER_USE_KEY );
60 60
     }
61 61
 
62 62
     /**
63 63
      * @return string
64 64
      */
65
-    protected function getSettingRows(array $fields)
65
+    protected function getSettingRows( array $fields )
66 66
     {
67 67
         $rows = '';
68
-        foreach ($fields as $name => $field) {
69
-            $field = wp_parse_args($field, [
68
+        foreach( $fields as $name => $field ) {
69
+            $field = wp_parse_args( $field, [
70 70
                 'is_setting' => true,
71 71
                 'name' => $name,
72
-            ]);
73
-            $rows.= new Field($this->normalize($field));
72
+            ] );
73
+            $rows .= new Field( $this->normalize( $field ) );
74 74
         }
75 75
         return $rows;
76 76
     }
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
      * @param string $id
80 80
      * @return array
81 81
      */
82
-    protected function getTemplateData($id)
82
+    protected function getTemplateData( $id )
83 83
     {
84
-        $fields = $this->getSettingFields($this->normalizeSettingPath($id));
84
+        $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
85 85
         return [
86 86
             'context' => [
87
-                'rows' => $this->getSettingRows($fields),
87
+                'rows' => $this->getSettingRows( $fields ),
88 88
             ],
89 89
         ];
90 90
     }
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
      * @param string $id
94 94
      * @return array
95 95
      */
96
-    protected function getTemplateDataForAddons($id)
96
+    protected function getTemplateDataForAddons( $id )
97 97
     {
98
-        $fields = $this->getSettingFields($this->normalizeSettingPath($id));
99
-        $settings = Arr::convertFromDotNotation($fields);
100
-        $settingKeys = array_keys($settings['settings']['addons']);
98
+        $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
99
+        $settings = Arr::convertFromDotNotation( $fields );
100
+        $settingKeys = array_keys( $settings['settings']['addons'] );
101 101
         $results = [];
102
-        foreach ($settingKeys as $key) {
103
-            $addonFields = array_filter($fields, function ($path) use ($key) {
104
-                return Str::startsWith('settings.addons.'.$key, $path);
105
-            }, ARRAY_FILTER_USE_KEY);
106
-            $results[$key] = $this->getSettingRows($addonFields);
102
+        foreach( $settingKeys as $key ) {
103
+            $addonFields = array_filter( $fields, function( $path ) use ($key) {
104
+                return Str::startsWith( 'settings.addons.'.$key, $path );
105
+            }, ARRAY_FILTER_USE_KEY );
106
+            $results[$key] = $this->getSettingRows( $addonFields );
107 107
         }
108
-        ksort($results);
108
+        ksort( $results );
109 109
         return [
110 110
             'settings' => $results,
111 111
         ];
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
      * @param string $id
116 116
      * @return array
117 117
      */
118
-    protected function getTemplateDataForLicenses($id)
118
+    protected function getTemplateDataForLicenses( $id )
119 119
     {
120
-        $fields = $this->getSettingFields($this->normalizeSettingPath($id));
121
-        ksort($fields);
120
+        $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
121
+        ksort( $fields );
122 122
         return [
123 123
             'context' => [
124
-                'rows' => $this->getSettingRows($fields),
124
+                'rows' => $this->getSettingRows( $fields ),
125 125
             ],
126 126
         ];
127 127
     }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     protected function getTemplateDataForTranslations()
133 133
     {
134
-        $translations = glsr(Translation::class)->renderAll();
134
+        $translations = glsr( Translation::class )->renderAll();
135 135
         $class = empty($translations)
136 136
             ? 'glsr-hidden'
137 137
             : '';
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
      * @param string|array $expectedValue
150 150
      * @return bool
151 151
      */
152
-    protected function isFieldHidden($path, $expectedValue)
152
+    protected function isFieldHidden( $path, $expectedValue )
153 153
     {
154
-        $optionValue = glsr(OptionManager::class)->get(
154
+        $optionValue = glsr( OptionManager::class )->get(
155 155
             $path,
156
-            Arr::get(glsr()->defaults, $path)
156
+            Arr::get( glsr()->defaults, $path )
157 157
         );
158
-        if (is_array($expectedValue)) {
159
-            return is_array($optionValue)
160
-                ? 0 === count(array_intersect($optionValue, $expectedValue))
161
-                : !in_array($optionValue, $expectedValue);
158
+        if( is_array( $expectedValue ) ) {
159
+            return is_array( $optionValue )
160
+                ? 0 === count( array_intersect( $optionValue, $expectedValue ) )
161
+                : !in_array( $optionValue, $expectedValue );
162 162
         }
163 163
         return $optionValue != $expectedValue;
164 164
     }
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
     /**
167 167
      * @return bool
168 168
      */
169
-    protected function isMultiDependency($path)
169
+    protected function isMultiDependency( $path )
170 170
     {
171
-        if (isset($this->settings[$path])) {
171
+        if( isset($this->settings[$path]) ) {
172 172
             $field = $this->settings[$path];
173 173
             return ('checkbox' == $field['type'] && !empty($field['options']))
174 174
                 || !empty($field['multiple']);
@@ -179,32 +179,32 @@  discard block
 block discarded – undo
179 179
     /**
180 180
      * @return array
181 181
      */
182
-    protected function normalize(array $field)
182
+    protected function normalize( array $field )
183 183
     {
184
-        $field = $this->normalizeDependsOn($field);
185
-        $field = $this->normalizeLabelAndLegend($field);
186
-        $field = $this->normalizeValue($field);
184
+        $field = $this->normalizeDependsOn( $field );
185
+        $field = $this->normalizeLabelAndLegend( $field );
186
+        $field = $this->normalizeValue( $field );
187 187
         return $field;
188 188
     }
189 189
 
190 190
     /**
191 191
      * @return array
192 192
      */
193
-    protected function normalizeDependsOn(array $field)
193
+    protected function normalizeDependsOn( array $field )
194 194
     {
195
-        if (!empty($field['depends_on']) && is_array($field['depends_on'])) {
195
+        if( !empty($field['depends_on']) && is_array( $field['depends_on'] ) ) {
196 196
             $isFieldHidden = false;
197 197
             $conditions = [];
198
-            foreach ($field['depends_on'] as $path => $value) {
198
+            foreach( $field['depends_on'] as $path => $value ) {
199 199
                 $conditions[] = [
200
-                    'name' => $this->getFieldNameForDependsOn($path),
200
+                    'name' => $this->getFieldNameForDependsOn( $path ),
201 201
                     'value' => $value,
202 202
                 ];
203
-                if ($this->isFieldHidden($path, $value)) {
203
+                if( $this->isFieldHidden( $path, $value ) ) {
204 204
                     $isFieldHidden = true;
205 205
                 }
206 206
             }
207
-            $field['data-depends'] = json_encode($conditions, JSON_HEX_APOS | JSON_HEX_QUOT);
207
+            $field['data-depends'] = json_encode( $conditions, JSON_HEX_APOS | JSON_HEX_QUOT );
208 208
             $field['is_hidden'] = $isFieldHidden;
209 209
         }
210 210
         return $field;
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
     /**
214 214
      * @return array
215 215
      */
216
-    protected function normalizeLabelAndLegend(array $field)
216
+    protected function normalizeLabelAndLegend( array $field )
217 217
     {
218
-        if (!empty($field['label'])) {
218
+        if( !empty($field['label']) ) {
219 219
             $field['legend'] = $field['label'];
220 220
             unset($field['label']);
221 221
         } else {
222 222
             $field['is_valid'] = false;
223
-            glsr_log()->warning('Setting field is missing a label')->debug($field);
223
+            glsr_log()->warning( 'Setting field is missing a label' )->debug( $field );
224 224
         }
225 225
         return $field;
226 226
     }
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
     /**
229 229
      * @return array
230 230
      */
231
-    protected function normalizeValue(array $field)
231
+    protected function normalizeValue( array $field )
232 232
     {
233
-        if (!isset($field['value'])) {
234
-            $field['value'] = glsr(OptionManager::class)->get(
233
+        if( !isset($field['value']) ) {
234
+            $field['value'] = glsr( OptionManager::class )->get(
235 235
                 $field['name'],
236
-                $this->getFieldDefault($field)
236
+                $this->getFieldDefault( $field )
237 237
             );
238 238
         }
239 239
         return $field;
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
     /**
243 243
      * @return string
244 244
      */
245
-    protected function normalizeSettingPath($path)
245
+    protected function normalizeSettingPath( $path )
246 246
     {
247
-        return Str::prefix('settings.', rtrim($path, '.'));
247
+        return Str::prefix( 'settings.', rtrim( $path, '.' ) );
248 248
     }
249 249
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Attributes.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -83,23 +83,23 @@  discard block
 block discarded – undo
83 83
      * @param array $args
84 84
      * @return static
85 85
      */
86
-    public function __call($method, $args)
86
+    public function __call( $method, $args )
87 87
     {
88
-        $constant = 'static::ATTRIBUTES_'.strtoupper($method);
89
-        $allowedAttributeKeys = defined($constant)
90
-            ? constant($constant)
88
+        $constant = 'static::ATTRIBUTES_'.strtoupper( $method );
89
+        $allowedAttributeKeys = defined( $constant )
90
+            ? constant( $constant )
91 91
             : [];
92
-        $this->normalize(Arr::consolidate(Arr::get($args, 0)), $allowedAttributeKeys);
93
-        $this->normalizeInputType($method);
92
+        $this->normalize( Arr::consolidate( Arr::get( $args, 0 ) ), $allowedAttributeKeys );
93
+        $this->normalizeInputType( $method );
94 94
         return $this;
95 95
     }
96 96
 
97 97
     /**
98 98
      * @return static
99 99
      */
100
-    public function set(array $attributes)
100
+    public function set( array $attributes )
101 101
     {
102
-        $this->normalize($attributes);
102
+        $this->normalize( $attributes );
103 103
         return $this;
104 104
     }
105 105
 
@@ -117,21 +117,21 @@  discard block
 block discarded – undo
117 117
     public function toString()
118 118
     {
119 119
         $attributes = [];
120
-        foreach ($this->attributes as $attribute => $value) {
121
-            $quote = $this->getQuoteChar($attribute);
122
-            $attributes[] = in_array($attribute, static::BOOLEAN_ATTRIBUTES)
120
+        foreach( $this->attributes as $attribute => $value ) {
121
+            $quote = $this->getQuoteChar( $attribute );
122
+            $attributes[] = in_array( $attribute, static::BOOLEAN_ATTRIBUTES )
123 123
                 ? $attribute
124
-                : $attribute.'='.$quote.implode(',', (array) $value).$quote;
124
+                : $attribute.'='.$quote.implode( ',', (array)$value ).$quote;
125 125
         }
126
-        return implode(' ', $attributes);
126
+        return implode( ' ', $attributes );
127 127
     }
128 128
 
129 129
     /**
130 130
      * @return array
131 131
      */
132
-    protected function filterAttributes(array $allowedAttributeKeys)
132
+    protected function filterAttributes( array $allowedAttributeKeys )
133 133
     {
134
-        return array_intersect_key($this->attributes, array_flip($allowedAttributeKeys));
134
+        return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ) );
135 135
     }
136 136
 
137 137
     /**
@@ -139,15 +139,15 @@  discard block
 block discarded – undo
139 139
      */
140 140
     protected function filterGlobalAttributes()
141 141
     {
142
-        $globalAttributes = $this->filterAttributes(static::GLOBAL_ATTRIBUTES);
142
+        $globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES );
143 143
         $wildcards = [];
144
-        foreach (static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard) {
145
-            $newWildcards = array_filter($this->attributes, function ($key) use ($wildcard) {
146
-                return Str::startsWith($wildcard, $key);
147
-            }, ARRAY_FILTER_USE_KEY);
148
-            $wildcards = array_merge($wildcards, $newWildcards);
144
+        foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) {
145
+            $newWildcards = array_filter( $this->attributes, function( $key ) use ($wildcard) {
146
+                return Str::startsWith( $wildcard, $key );
147
+            }, ARRAY_FILTER_USE_KEY );
148
+            $wildcards = array_merge( $wildcards, $newWildcards );
149 149
         }
150
-        return array_merge($globalAttributes, $wildcards);
150
+        return array_merge( $globalAttributes, $wildcards );
151 151
     }
152 152
 
153 153
     /**
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     protected function getPermanentAttributes()
157 157
     {
158 158
         $permanentAttributes = [];
159
-        if (array_key_exists('value', $this->attributes)) {
159
+        if( array_key_exists( 'value', $this->attributes ) ) {
160 160
             $permanentAttributes['value'] = $this->attributes['value'];
161 161
         }
162 162
         return $permanentAttributes;
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
      * @param string $attribute
167 167
      * @return string
168 168
      */
169
-    protected function getQuoteChar($attribute)
169
+    protected function getQuoteChar( $attribute )
170 170
     {
171
-        return Str::startsWith('data-', $attribute)
171
+        return Str::startsWith( 'data-', $attribute )
172 172
             ? '\''
173 173
             : '"';
174 174
     }
@@ -178,19 +178,19 @@  discard block
 block discarded – undo
178 178
      * @param mixed $value
179 179
      * @return bool
180 180
      */
181
-    protected function isAttributeKeyNumeric($key, $value)
181
+    protected function isAttributeKeyNumeric( $key, $value )
182 182
     {
183
-        return is_string($value)
184
-            && is_numeric($key)
185
-            && !array_key_exists($value, $this->attributes);
183
+        return is_string( $value )
184
+            && is_numeric( $key )
185
+            && !array_key_exists( $value, $this->attributes );
186 186
     }
187 187
 
188 188
     /**
189 189
      * @return void
190 190
      */
191
-    protected function normalize(array $args, array $allowedAttributeKeys = [])
191
+    protected function normalize( array $args, array $allowedAttributeKeys = [] )
192 192
     {
193
-        $this->attributes = array_change_key_case($args, CASE_LOWER);
193
+        $this->attributes = array_change_key_case( $args, CASE_LOWER );
194 194
         $this->normalizeBooleanAttributes();
195 195
         $this->normalizeDataAttributes();
196 196
         $this->normalizeStringAttributes();
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $this->removeIndexedAttributes();
199 199
         $this->attributes = array_merge(
200 200
             $this->filterGlobalAttributes(),
201
-            $this->filterAttributes($allowedAttributeKeys)
201
+            $this->filterAttributes( $allowedAttributeKeys )
202 202
         );
203 203
     }
204 204
 
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
      */
208 208
     protected function normalizeBooleanAttributes()
209 209
     {
210
-        foreach ($this->attributes as $key => $value) {
211
-            if ($this->isAttributeKeyNumeric($key, $value)) {
210
+        foreach( $this->attributes as $key => $value ) {
211
+            if( $this->isAttributeKeyNumeric( $key, $value ) ) {
212 212
                 $key = $value;
213 213
                 $value = true;
214 214
             }
215
-            if (!in_array($key, static::BOOLEAN_ATTRIBUTES)) {
215
+            if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ) ) {
216 216
                 continue;
217 217
             }
218
-            $this->attributes[$key] = wp_validate_boolean($value);
218
+            $this->attributes[$key] = wp_validate_boolean( $value );
219 219
         }
220 220
     }
221 221
 
@@ -224,16 +224,16 @@  discard block
 block discarded – undo
224 224
      */
225 225
     protected function normalizeDataAttributes()
226 226
     {
227
-        foreach ($this->attributes as $key => $value) {
228
-            if ($this->isAttributeKeyNumeric($key, $value)) {
227
+        foreach( $this->attributes as $key => $value ) {
228
+            if( $this->isAttributeKeyNumeric( $key, $value ) ) {
229 229
                 $key = $value;
230 230
                 $value = '';
231 231
             }
232
-            if (!Str::startsWith('data-', $key)) {
232
+            if( !Str::startsWith( 'data-', $key ) ) {
233 233
                 continue;
234 234
             }
235
-            if (is_array($value)) {
236
-                $value = json_encode($value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
235
+            if( is_array( $value ) ) {
236
+                $value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
237 237
             }
238 238
             $this->attributes[$key] = $value;
239 239
         }
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
      */
245 245
     protected function normalizeStringAttributes()
246 246
     {
247
-        foreach ($this->attributes as $key => $value) {
248
-            if (is_string($value)) {
249
-                $this->attributes[$key] = trim($value);
247
+        foreach( $this->attributes as $key => $value ) {
248
+            if( is_string( $value ) ) {
249
+                $this->attributes[$key] = trim( $value );
250 250
             }
251 251
         }
252 252
     }
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
      * @param string $method
256 256
      * @return void
257 257
      */
258
-    protected function normalizeInputType($method)
258
+    protected function normalizeInputType( $method )
259 259
     {
260
-        if ('input' != $method) {
260
+        if( 'input' != $method ) {
261 261
             return;
262 262
         }
263
-        $attributes = wp_parse_args($this->attributes, ['type' => '']);
264
-        if (!in_array($attributes['type'], static::INPUT_TYPES)) {
263
+        $attributes = wp_parse_args( $this->attributes, ['type' => ''] );
264
+        if( !in_array( $attributes['type'], static::INPUT_TYPES ) ) {
265 265
             $this->attributes['type'] = 'text';
266 266
         }
267 267
     }
@@ -273,16 +273,16 @@  discard block
 block discarded – undo
273 273
     {
274 274
         $attributes = $this->attributes;
275 275
         $permanentAttributes = $this->getPermanentAttributes();
276
-        foreach ($this->attributes as $key => $value) {
277
-            if (in_array($key, static::BOOLEAN_ATTRIBUTES) && !$value) {
276
+        foreach( $this->attributes as $key => $value ) {
277
+            if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) {
278 278
                 unset($attributes[$key]);
279 279
             }
280
-            if (Str::startsWith('data-', $key)) {
280
+            if( Str::startsWith( 'data-', $key ) ) {
281 281
                 $permanentAttributes[$key] = $value;
282 282
                 unset($attributes[$key]);
283 283
             }
284 284
         }
285
-        $this->attributes = array_merge(array_filter($attributes), $permanentAttributes);
285
+        $this->attributes = array_merge( array_filter( $attributes ), $permanentAttributes );
286 286
     }
287 287
 
288 288
     /**
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
     {
293 293
         $this->attributes = array_diff_key(
294 294
             $this->attributes,
295
-            array_filter($this->attributes, 'is_numeric', ARRAY_FILTER_USE_KEY)
295
+            array_filter( $this->attributes, 'is_numeric', ARRAY_FILTER_USE_KEY )
296 296
         );
297 297
     }
298 298
 }
Please login to merge, or discard this patch.
plugin/Modules/System.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
             'setting' => 'Plugin Settings',
43 43
             'reviews' => 'Review Counts',
44 44
         ];
45
-        $systemInfo = array_reduce(array_keys($details), function ($carry, $key) use ($details) {
46
-            $methodName = Helper::buildMethodName('get-'.$key.'-details');
47
-            if (method_exists($this, $methodName) && $systemDetails = $this->$methodName()) {
45
+        $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use ($details) {
46
+            $methodName = Helper::buildMethodName( 'get-'.$key.'-details' );
47
+            if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) {
48 48
                 return $carry.$this->implode(
49
-                    strtoupper($details[$key]),
50
-                    apply_filters('site-reviews/system/'.$key, $systemDetails)
49
+                    strtoupper( $details[$key] ),
50
+                    apply_filters( 'site-reviews/system/'.$key, $systemDetails )
51 51
                 );
52 52
             }
53 53
             return $carry;
54 54
         });
55
-        return trim($systemInfo);
55
+        return trim( $systemInfo );
56 56
     }
57 57
 
58 58
     /**
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
     public function getActivePluginDetails()
62 62
     {
63 63
         $plugins = get_plugins();
64
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
65
-        $inactive = array_diff_key($plugins, array_flip($activePlugins));
66
-        return $this->normalizePluginList(array_diff_key($plugins, $inactive));
64
+        $activePlugins = glsr( OptionManager::class )->getWP( 'active_plugins', [], 'array' );
65
+        $inactive = array_diff_key( $plugins, array_flip( $activePlugins ) );
66
+        return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
67 67
     }
68 68
 
69 69
     /**
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function getAddonDetails()
73 73
     {
74
-        $details = apply_filters('site-reviews/addon/system-info', []);
75
-        ksort($details);
74
+        $details = apply_filters( 'site-reviews/addon/system-info', [] );
75
+        ksort( $details );
76 76
         return $details;
77 77
     }
78 78
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
     public function getBrowserDetails()
83 83
     {
84 84
         $browser = new Browser();
85
-        $name = esc_attr($browser->getName());
86
-        $userAgent = esc_attr($browser->getUserAgent()->getUserAgentString());
87
-        $version = esc_attr($browser->getVersion());
85
+        $name = esc_attr( $browser->getName() );
86
+        $userAgent = esc_attr( $browser->getUserAgent()->getUserAgentString() );
87
+        $version = esc_attr( $browser->getVersion() );
88 88
         return [
89
-            'Browser Name' => sprintf('%s %s', $name, $version),
89
+            'Browser Name' => sprintf( '%s %s', $name, $version ),
90 90
             'Browser UA' => $userAgent,
91 91
         ];
92 92
     }
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function getInactivePluginDetails()
98 98
     {
99
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
100
-        $inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins)));
99
+        $activePlugins = glsr( OptionManager::class )->getWP( 'active_plugins', [], 'array' );
100
+        $inactivePlugins = $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) );
101 101
         $multisitePlugins = $this->getMultisitePluginDetails();
102 102
         return empty($multisitePlugins)
103 103
             ? $inactivePlugins
104
-            : array_diff($inactivePlugins, $multisitePlugins);
104
+            : array_diff( $inactivePlugins, $multisitePlugins );
105 105
     }
106 106
 
107 107
     /**
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getMuPluginDetails()
111 111
     {
112
-        if (empty($plugins = get_mu_plugins())) {
112
+        if( empty($plugins = get_mu_plugins()) ) {
113 113
             return [];
114 114
         }
115
-        return $this->normalizePluginList($plugins);
115
+        return $this->normalizePluginList( $plugins );
116 116
     }
117 117
 
118 118
     /**
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function getMultisitePluginDetails()
122 122
     {
123
-        $activePlugins = (array) get_site_option('active_sitewide_plugins', []);
124
-        if (!is_multisite() || empty($activePlugins)) {
123
+        $activePlugins = (array)get_site_option( 'active_sitewide_plugins', [] );
124
+        if( !is_multisite() || empty($activePlugins) ) {
125 125
             return [];
126 126
         }
127
-        return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins));
127
+        return $this->normalizePluginList( array_intersect_key( get_plugins(), $activePlugins ) );
128 128
     }
129 129
 
130 130
     /**
@@ -132,31 +132,31 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function getPhpDetails()
134 134
     {
135
-        $displayErrors = $this->getINI('display_errors', null)
136
-            ? 'On ('.$this->getINI('display_errors').')'
135
+        $displayErrors = $this->getINI( 'display_errors', null )
136
+            ? 'On ('.$this->getINI( 'display_errors' ).')'
137 137
             : 'N/A';
138
-        $intlSupport = extension_loaded('intl')
139
-            ? phpversion('intl')
138
+        $intlSupport = extension_loaded( 'intl' )
139
+            ? phpversion( 'intl' )
140 140
             : 'false';
141 141
         return [
142
-            'cURL' => var_export(function_exists('curl_init'), true),
143
-            'Default Charset' => $this->getINI('default_charset'),
142
+            'cURL' => var_export( function_exists( 'curl_init' ), true ),
143
+            'Default Charset' => $this->getINI( 'default_charset' ),
144 144
             'Display Errors' => $displayErrors,
145
-            'fsockopen' => var_export(function_exists('fsockopen'), true),
145
+            'fsockopen' => var_export( function_exists( 'fsockopen' ), true ),
146 146
             'Intl' => $intlSupport,
147
-            'IPv6' => var_export(defined('AF_INET6'), true),
148
-            'Max Execution Time' => $this->getINI('max_execution_time'),
149
-            'Max Input Nesting Level' => $this->getINI('max_input_nesting_level'),
150
-            'Max Input Vars' => $this->getINI('max_input_vars'),
151
-            'Memory Limit' => $this->getINI('memory_limit'),
152
-            'Post Max Size' => $this->getINI('post_max_size'),
153
-            'Sendmail Path' => $this->getINI('sendmail_path'),
154
-            'Session Cookie Path' => esc_html($this->getINI('session.cookie_path')),
155
-            'Session Name' => esc_html($this->getINI('session.name')),
156
-            'Session Save Path' => esc_html($this->getINI('session.save_path')),
157
-            'Session Use Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_cookies', false)), true),
158
-            'Session Use Only Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_only_cookies', false)), true),
159
-            'Upload Max Filesize' => $this->getINI('upload_max_filesize'),
147
+            'IPv6' => var_export( defined( 'AF_INET6' ), true ),
148
+            'Max Execution Time' => $this->getINI( 'max_execution_time' ),
149
+            'Max Input Nesting Level' => $this->getINI( 'max_input_nesting_level' ),
150
+            'Max Input Vars' => $this->getINI( 'max_input_vars' ),
151
+            'Memory Limit' => $this->getINI( 'memory_limit' ),
152
+            'Post Max Size' => $this->getINI( 'post_max_size' ),
153
+            'Sendmail Path' => $this->getINI( 'sendmail_path' ),
154
+            'Session Cookie Path' => esc_html( $this->getINI( 'session.cookie_path' ) ),
155
+            'Session Name' => esc_html( $this->getINI( 'session.name' ) ),
156
+            'Session Save Path' => esc_html( $this->getINI( 'session.save_path' ) ),
157
+            'Session Use Cookies' => var_export( wp_validate_boolean( $this->getINI( 'session.use_cookies', false ) ), true ),
158
+            'Session Use Only Cookies' => var_export( wp_validate_boolean( $this->getINI( 'session.use_only_cookies', false ) ), true ),
159
+            'Upload Max Filesize' => $this->getINI( 'upload_max_filesize' ),
160 160
         ];
161 161
     }
162 162
 
@@ -165,19 +165,19 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function getReviewsDetails()
167 167
     {
168
-        $counts = glsr(CountsManager::class)->getCounts();
169
-        $counts = Arr::flatten($counts);
170
-        array_walk($counts, function (&$ratings) use ($counts) {
171
-            if (is_array($ratings)) {
172
-                $ratings = array_sum($ratings).' ('.implode(', ', $ratings).')';
168
+        $counts = glsr( CountsManager::class )->getCounts();
169
+        $counts = Arr::flatten( $counts );
170
+        array_walk( $counts, function( &$ratings ) use ($counts) {
171
+            if( is_array( $ratings ) ) {
172
+                $ratings = array_sum( $ratings ).' ('.implode( ', ', $ratings ).')';
173 173
                 return;
174 174
             }
175 175
             glsr_log()
176
-                ->error('$ratings is not an array, possibly due to incorrectly imported reviews.')
177
-                ->debug($ratings)
178
-                ->debug($counts);
176
+                ->error( '$ratings is not an array, possibly due to incorrectly imported reviews.' )
177
+                ->debug( $ratings )
178
+                ->debug( $counts );
179 179
         });
180
-        ksort($counts);
180
+        ksort( $counts );
181 181
         return $counts;
182 182
     }
183 183
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             'Host Name' => $this->getHostName(),
192 192
             'MySQL Version' => $wpdb->db_version(),
193 193
             'PHP Version' => PHP_VERSION,
194
-            'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'),
194
+            'Server Software' => filter_input( INPUT_SERVER, 'SERVER_SOFTWARE' ),
195 195
         ];
196 196
     }
197 197
 
@@ -200,16 +200,16 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function getSettingDetails()
202 202
     {
203
-        $settings = glsr(OptionManager::class)->get('settings', []);
204
-        $settings = Arr::flatten($settings, true);
205
-        $settings = $this->purgeSensitiveData($settings);
206
-        ksort($settings);
203
+        $settings = glsr( OptionManager::class )->get( 'settings', [] );
204
+        $settings = Arr::flatten( $settings, true );
205
+        $settings = $this->purgeSensitiveData( $settings );
206
+        ksort( $settings );
207 207
         $details = [];
208
-        foreach ($settings as $key => $value) {
209
-            if (Str::startsWith('strings', $key) && Str::endsWith('id', $key)) {
208
+        foreach( $settings as $key => $value ) {
209
+            if( Str::startsWith( 'strings', $key ) && Str::endsWith( 'id', $key ) ) {
210 210
                 continue;
211 211
             }
212
-            $value = htmlspecialchars(trim(preg_replace('/\s\s+/', '\\n', $value)), ENT_QUOTES, 'UTF-8');
212
+            $value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' );
213 213
             $details[$key] = $value;
214 214
         }
215 215
         return $details;
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
     public function getPluginDetails()
222 222
     {
223 223
         return [
224
-            'Console level' => glsr(Console::class)->humanLevel(),
225
-            'Console size' => glsr(Console::class)->humanSize('0'),
226
-            'Last Migration Run' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_migration_run'), 'unknown'),
227
-            'Last Rating Count' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_review_count'), 'unknown'),
224
+            'Console level' => glsr( Console::class )->humanLevel(),
225
+            'Console size' => glsr( Console::class )->humanSize( '0' ),
226
+            'Last Migration Run' => glsr( Date::class )->localized( glsr( OptionManager::class )->get( 'last_migration_run' ), 'unknown' ),
227
+            'Last Rating Count' => glsr( Date::class )->localized( glsr( OptionManager::class )->get( 'last_review_count' ), 'unknown' ),
228 228
             'Version (current)' => glsr()->version,
229
-            'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'),
229
+            'Version (previous)' => glsr( OptionManager::class )->get( 'version_upgraded_from' ),
230 230
         ];
231 231
     }
232 232
 
@@ -238,23 +238,23 @@  discard block
 block discarded – undo
238 238
         global $wpdb;
239 239
         $theme = wp_get_theme();
240 240
         return [
241
-            'Active Theme' => sprintf('%s v%s', (string) $theme->Name, (string) $theme->Version),
242
-            'Email Domain' => substr(strrchr(glsr(OptionManager::class)->getWP('admin_email'), '@'), 1),
241
+            'Active Theme' => sprintf( '%s v%s', (string)$theme->Name, (string)$theme->Version ),
242
+            'Email Domain' => substr( strrchr( glsr( OptionManager::class )->getWP( 'admin_email' ), '@' ), 1 ),
243 243
             'Home URL' => home_url(),
244 244
             'Language' => get_locale(),
245 245
             'Memory Limit' => WP_MEMORY_LIMIT,
246
-            'Multisite' => var_export(is_multisite(), true),
247
-            'Page For Posts ID' => glsr(OptionManager::class)->getWP('page_for_posts'),
248
-            'Page On Front ID' => glsr(OptionManager::class)->getWP('page_on_front'),
249
-            'Permalink Structure' => glsr(OptionManager::class)->getWP('permalink_structure', 'default'),
250
-            'Post Stati' => implode(', ', get_post_stati()),
251
-            'Remote Post' => glsr(Cache::class)->getRemotePostTest(),
252
-            'Show On Front' => glsr(OptionManager::class)->getWP('show_on_front'),
246
+            'Multisite' => var_export( is_multisite(), true ),
247
+            'Page For Posts ID' => glsr( OptionManager::class )->getWP( 'page_for_posts' ),
248
+            'Page On Front ID' => glsr( OptionManager::class )->getWP( 'page_on_front' ),
249
+            'Permalink Structure' => glsr( OptionManager::class )->getWP( 'permalink_structure', 'default' ),
250
+            'Post Stati' => implode( ', ', get_post_stati() ),
251
+            'Remote Post' => glsr( Cache::class )->getRemotePostTest(),
252
+            'Show On Front' => glsr( OptionManager::class )->getWP( 'show_on_front' ),
253 253
             'Site URL' => site_url(),
254
-            'Timezone' => glsr(OptionManager::class)->getWP('timezone_string', $this->getINI('date.timezone').' (PHP)'),
255
-            'Version' => get_bloginfo('version'),
256
-            'WP Debug' => var_export(defined('WP_DEBUG'), true),
257
-            'WP Max Upload Size' => size_format(wp_max_upload_size()),
254
+            'Timezone' => glsr( OptionManager::class )->getWP( 'timezone_string', $this->getINI( 'date.timezone' ).' (PHP)' ),
255
+            'Version' => get_bloginfo( 'version' ),
256
+            'WP Debug' => var_export( defined( 'WP_DEBUG' ), true ),
257
+            'WP Max Upload Size' => size_format( wp_max_upload_size() ),
258 258
             'WP Memory Limit' => WP_MEMORY_LIMIT,
259 259
         ];
260 260
     }
@@ -284,13 +284,13 @@  discard block
 block discarded – undo
284 284
             'secureserver.net' => 'GoDaddy',
285 285
             'WPE_APIKEY' => 'WP Engine',
286 286
         ];
287
-        foreach ($checks as $key => $value) {
288
-            if (!$this->isWebhostCheckValid($key)) {
287
+        foreach( $checks as $key => $value ) {
288
+            if( !$this->isWebhostCheckValid( $key ) ) {
289 289
                 continue;
290 290
             }
291 291
             return $value;
292 292
         }
293
-        return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')]));
293
+        return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ) );
294 294
     }
295 295
 
296 296
     /**
@@ -298,16 +298,16 @@  discard block
 block discarded – undo
298 298
      */
299 299
     protected function getHostName()
300 300
     {
301
-        return sprintf('%s (%s)',
301
+        return sprintf( '%s (%s)',
302 302
             $this->detectWebhostProvider(),
303 303
             Helper::getIpAddress()
304 304
         );
305 305
     }
306 306
 
307
-    protected function getINI($name, $disabledValue = 'ini_get() is disabled.')
307
+    protected function getINI( $name, $disabledValue = 'ini_get() is disabled.' )
308 308
     {
309
-        return function_exists('ini_get')
310
-            ? ini_get($name)
309
+        return function_exists( 'ini_get' )
310
+            ? ini_get( $name )
311 311
             : $disabledValue;
312 312
     }
313 313
 
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
     protected function getWordpressPlugins()
318 318
     {
319 319
         $plugins = get_plugins();
320
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
321
-        $inactive = $this->normalizePluginList(array_diff_key($plugins, array_flip($activePlugins)));
322
-        $active = $this->normalizePluginList(array_diff_key($plugins, $inactive));
320
+        $activePlugins = glsr( OptionManager::class )->getWP( 'active_plugins', [], 'array' );
321
+        $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) );
322
+        $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
323 323
         return $active + $inactive;
324 324
     }
325 325
 
@@ -327,48 +327,48 @@  discard block
 block discarded – undo
327 327
      * @param string $title
328 328
      * @return string
329 329
      */
330
-    protected function implode($title, array $details)
330
+    protected function implode( $title, array $details )
331 331
     {
332 332
         $strings = ['['.$title.']'];
333
-        $padding = max(array_map('strlen', array_keys($details)));
334
-        $padding = max([$padding, static::PAD]);
335
-        foreach ($details as $key => $value) {
336
-            $strings[] = is_string($key)
337
-                ? sprintf('%s : %s', str_pad($key, $padding, '.'), $value)
333
+        $padding = max( array_map( 'strlen', array_keys( $details ) ) );
334
+        $padding = max( [$padding, static::PAD] );
335
+        foreach( $details as $key => $value ) {
336
+            $strings[] = is_string( $key )
337
+                ? sprintf( '%s : %s', str_pad( $key, $padding, '.' ), $value )
338 338
                 : ' - '.$value;
339 339
         }
340
-        return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL;
340
+        return implode( PHP_EOL, $strings ).PHP_EOL.PHP_EOL;
341 341
     }
342 342
 
343 343
     /**
344 344
      * @param string $key
345 345
      * @return bool
346 346
      */
347
-    protected function isWebhostCheckValid($key)
347
+    protected function isWebhostCheckValid( $key )
348 348
     {
349
-        return defined($key)
350
-            || filter_input(INPUT_SERVER, $key)
351
-            || Str::contains(filter_input(INPUT_SERVER, 'SERVER_NAME'), $key)
352
-            || Str::contains(DB_HOST, $key)
353
-            || Str::contains(php_uname(), $key);
349
+        return defined( $key )
350
+            || filter_input( INPUT_SERVER, $key )
351
+            || Str::contains( filter_input( INPUT_SERVER, 'SERVER_NAME' ), $key )
352
+            || Str::contains( DB_HOST, $key )
353
+            || Str::contains( php_uname(), $key );
354 354
     }
355 355
 
356 356
     /**
357 357
      * @return array
358 358
      */
359
-    protected function normalizePluginList(array $plugins)
359
+    protected function normalizePluginList( array $plugins )
360 360
     {
361
-        $plugins = array_map(function ($plugin) {
362
-            return sprintf('%s v%s', Arr::get($plugin, 'Name'), Arr::get($plugin, 'Version'));
363
-        }, $plugins);
364
-        natcasesort($plugins);
365
-        return array_flip($plugins);
361
+        $plugins = array_map( function( $plugin ) {
362
+            return sprintf( '%s v%s', Arr::get( $plugin, 'Name' ), Arr::get( $plugin, 'Version' ) );
363
+        }, $plugins );
364
+        natcasesort( $plugins );
365
+        return array_flip( $plugins );
366 366
     }
367 367
 
368 368
     /**
369 369
      * @return array
370 370
      */
371
-    protected function purgeSensitiveData(array $settings)
371
+    protected function purgeSensitiveData( array $settings )
372 372
     {
373 373
         $keys = [
374 374
             'general.trustalyze_serial',
@@ -376,12 +376,12 @@  discard block
 block discarded – undo
376 376
             'submissions.recaptcha.key',
377 377
             'submissions.recaptcha.secret',
378 378
         ];
379
-        array_walk($settings, function (&$value, $setting) use ($keys) {
380
-            foreach ($keys as $key) {
381
-                if (!Str::startsWith($key, $setting) || empty($value)) {
379
+        array_walk( $settings, function( &$value, $setting ) use ($keys) {
380
+            foreach( $keys as $key ) {
381
+                if( !Str::startsWith( $key, $setting ) || empty($value) ) {
382 382
                     continue;
383 383
                 }
384
-                $value = str_repeat('•', 13);
384
+                $value = str_repeat( '•', 13 );
385 385
                 return;
386 386
             }
387 387
         });
Please login to merge, or discard this patch.
plugin/Modules/Migrations/Migrate_3_0_0.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $this->newSettings = $this->getNewSettings();
67 67
         $this->oldSettings = $this->getOldSettings();
68
-        if (empty($this->oldSettings) || empty($this->newSettings)) {
68
+        if( empty($this->oldSettings) || empty($this->newSettings) ) {
69 69
             return;
70 70
         }
71
-        foreach (static::MAPPED_SETTINGS as $old => $new) {
72
-            if (empty($this->oldSettings[$old])) {
71
+        foreach( static::MAPPED_SETTINGS as $old => $new ) {
72
+            if( empty($this->oldSettings[$old]) ) {
73 73
                 continue;
74 74
             }
75 75
             $this->newSettings[$new] = $this->oldSettings[$old];
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
         $this->migrateNotificationSettings();
78 78
         $this->migrateRecaptchaSettings();
79 79
         $this->migrateRequiredSettings();
80
-        $oldSettings = Arr::convertFromDotNotation($this->oldSettings);
81
-        $newSettings = Arr::convertFromDotNotation($this->newSettings);
82
-        if (isset($oldSettings['settings']['strings']) && is_array($oldSettings['settings']['strings'])) {
80
+        $oldSettings = Arr::convertFromDotNotation( $this->oldSettings );
81
+        $newSettings = Arr::convertFromDotNotation( $this->newSettings );
82
+        if( isset($oldSettings['settings']['strings']) && is_array( $oldSettings['settings']['strings'] ) ) {
83 83
             $newSettings['settings']['strings'] = $oldSettings['settings']['strings'];
84 84
         }
85
-        update_option(OptionManager::databaseKey(3), $newSettings);
85
+        update_option( OptionManager::databaseKey( 3 ), $newSettings );
86 86
     }
87 87
 
88 88
     /**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     protected function getNewSettings()
100 100
     {
101
-        return  Arr::flatten(Arr::consolidate(OptionManager::databaseKey(3)));
101
+        return  Arr::flatten( Arr::consolidate( OptionManager::databaseKey( 3 ) ) );
102 102
     }
103 103
 
104 104
     /**
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
      */
107 107
     protected function getOldSettings()
108 108
     {
109
-        $defaults = array_fill_keys(array_keys(static::MAPPED_SETTINGS), '');
110
-        $settings = Arr::consolidate(get_option(OptionManager::databaseKey(2)));
111
-        $settings = Arr::flatten($settings);
109
+        $defaults = array_fill_keys( array_keys( static::MAPPED_SETTINGS ), '' );
110
+        $settings = Arr::consolidate( get_option( OptionManager::databaseKey( 2 ) ) );
111
+        $settings = Arr::flatten( $settings );
112 112
         return !empty($settings)
113
-            ? wp_parse_args($settings, $defaults)
113
+            ? wp_parse_args( $settings, $defaults )
114 114
             : [];
115 115
     }
116 116
 
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
             'webhook' => 'slack',
126 126
         ];
127 127
         $this->newSettings['settings.general.notifications'] = [];
128
-        foreach ($notifications as $old => $new) {
129
-            if ($this->oldSettings['settings.general.notification'] != $old) {
128
+        foreach( $notifications as $old => $new ) {
129
+            if( $this->oldSettings['settings.general.notification'] != $old ) {
130 130
                 continue;
131 131
             }
132 132
             $this->newSettings['settings.general.notifications'][] = $new;
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
             'SecretKey' => $this->oldSettings['settings.reviews-form.recaptcha.secret'],
144 144
             'SiteKey' => $this->oldSettings['settings.reviews-form.recaptcha.key'],
145 145
         ];
146
-        if (in_array($this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'])) {
146
+        if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] ) ) {
147 147
             $this->newSettings['settings.submissions.recaptcha.integration'] = 'all';
148 148
         }
149
-        if ('invisible-recaptcha' == $this->oldSettings['settings.reviews-form.recaptcha.integration']) {
150
-            $recaptcha = wp_parse_args((array) get_site_option('ic-settings', [], false), $recaptcha);
149
+        if( 'invisible-recaptcha' == $this->oldSettings['settings.reviews-form.recaptcha.integration'] ) {
150
+            $recaptcha = wp_parse_args( (array)get_site_option( 'ic-settings', [], false ), $recaptcha );
151 151
         }
152 152
         $this->newSettings['settings.submissions.recaptcha.key'] = $recaptcha['SiteKey'];
153 153
         $this->newSettings['settings.submissions.recaptcha.secret'] = $recaptcha['SecretKey'];
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     protected function migrateRequiredSettings()
161 161
     {
162
-        $this->newSettings['settings.submissions.required'] = array_filter((array) $this->oldSettings['settings.reviews-form.required']);
162
+        $this->newSettings['settings.submissions.required'] = array_filter( (array)$this->oldSettings['settings.reviews-form.required'] );
163 163
         $this->newSettings['settings.submissions.required'][] = 'rating';
164 164
         $this->newSettings['settings.submissions.required'][] = 'terms';
165 165
     }
Please login to merge, or discard this patch.