Passed
Push — master ( 6b35fa...ccb079 )
by Paul
10:24 queued 05:13
created
views/pages/settings/translations.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<p><?= sprintf(__('Here you can customise any text of the plugin, including the submission form labels and placeholders. However, if you have a multilingual website you should use the %s plugin instead.', 'site-reviews'), '<a href="https://wordpress.org/plugins/loco-translate/">Loco Translate</a>'); ?></p>
3
+<p><?= sprintf( __( 'Here you can customise any text of the plugin, including the submission form labels and placeholders. However, if you have a multilingual website you should use the %s plugin instead.', 'site-reviews' ), '<a href="https://wordpress.org/plugins/loco-translate/">Loco Translate</a>' ); ?></p>
4 4
 
5 5
 <div class="glsr-strings-form">
6 6
     <div class="glsr-search-box" id="glsr-search-translations">
7
-        <span class="screen-reader-text"><?= __('Search for translatable text', 'site-reviews'); ?></span>
7
+        <span class="screen-reader-text"><?= __( 'Search for translatable text', 'site-reviews' ); ?></span>
8 8
         <div class="glsr-spinner">
9 9
             <span class="spinner"></span>
10 10
         </div>
11
-        <input type="search" class="glsr-search-input" autocomplete="off" placeholder="<?= __('Search here for text to translate...', 'site-reviews'); ?>">
12
-        <?php wp_nonce_field('search-translations', '_search_nonce', false); ?>
11
+        <input type="search" class="glsr-search-input" autocomplete="off" placeholder="<?= __( 'Search here for text to translate...', 'site-reviews' ); ?>">
12
+        <?php wp_nonce_field( 'search-translations', '_search_nonce', false ); ?>
13 13
         <div class="glsr-search-results" data-prefix="{{ database_key }}"></div>
14 14
     </div>
15 15
     <table class="glsr-strings-table wp-list-table widefat striped {{ class }}">
16 16
         <thead>
17 17
             <tr>
18
-                <th scope="col" class="manage-column column-primary"><?= __('Original Text', 'site-reviews'); ?></th>
19
-                <th scope="col" class="manage-column"><?= __('Custom Translation', 'site-reviews'); ?></th>
18
+                <th scope="col" class="manage-column column-primary"><?= __( 'Original Text', 'site-reviews' ); ?></th>
19
+                <th scope="col" class="manage-column"><?= __( 'Custom Translation', 'site-reviews' ); ?></th>
20 20
             </tr>
21 21
         </thead>
22 22
         <tbody>{{ translations }}</tbody>
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 </div>
26 26
 
27 27
 <script type="text/html" id="tmpl-glsr-string-plural">
28
-<?php include glsr()->path('views/partials/translations/plural.php'); ?>
28
+<?php include glsr()->path( 'views/partials/translations/plural.php' ); ?>
29 29
 </script>
30 30
 <script type="text/html" id="tmpl-glsr-string-single">
31
-<?php include glsr()->path('views/partials/translations/single.php'); ?>
31
+<?php include glsr()->path( 'views/partials/translations/single.php' ); ?>
32 32
 </script>
Please login to merge, or discard this patch.
plugin/Modules/ReviewLimits.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -14,26 +14,26 @@  discard block
 block discarded – undo
14 14
      * @return array
15 15
      * @filter site-reviews/get/reviews/query
16 16
      */
17
-    public function filterReviewsQuery(array $parameters, array $args)
17
+    public function filterReviewsQuery( array $parameters, array $args )
18 18
     {
19
-        if ($authorId = get_current_user_id()) {
19
+        if( $authorId = get_current_user_id() ) {
20 20
             $parameters['author'] = $authorId;
21 21
         }
22 22
         $parameters['post_status'] = ['pending', 'publish'];
23
-        return apply_filters('site-reviews/review-limits/query', $parameters, $args);
23
+        return apply_filters( 'site-reviews/review-limits/query', $parameters, $args );
24 24
     }
25 25
 
26 26
     /**
27 27
      * @return bool
28 28
      */
29
-    public function hasReachedLimit(array $request = [])
29
+    public function hasReachedLimit( array $request = [] )
30 30
     {
31 31
         $this->request = $request;
32 32
         $method = Helper::buildMethodName(
33
-            glsr(OptionManager::class)->get('settings.submissions.limit'), 'validateBy'
33
+            glsr( OptionManager::class )->get( 'settings.submissions.limit' ), 'validateBy'
34 34
         );
35
-        return method_exists($this, $method)
36
-            ? !call_user_func([$this, $method])
35
+        return method_exists( $this, $method )
36
+            ? !call_user_func( [$this, $method] )
37 37
             : false;
38 38
     }
39 39
 
@@ -42,41 +42,41 @@  discard block
 block discarded – undo
42 42
      * @param string $whitelist
43 43
      * @return bool
44 44
      */
45
-    public function isWhitelisted($value, $whitelist)
45
+    public function isWhitelisted( $value, $whitelist )
46 46
     {
47
-        if (empty($whitelist)) {
47
+        if( empty($whitelist) ) {
48 48
             return false;
49 49
         }
50
-        return in_array($value, array_filter(explode("\n", $whitelist), 'trim'));
50
+        return in_array( $value, array_filter( explode( "\n", $whitelist ), 'trim' ) );
51 51
     }
52 52
 
53 53
     /**
54 54
      * @param string $whitelistName
55 55
      * @return string
56 56
      */
57
-    protected function getWhitelist($whitelistName)
57
+    protected function getWhitelist( $whitelistName )
58 58
     {
59
-        return glsr(OptionManager::class)->get('settings.submissions.limit_whitelist.'.$whitelistName);
59
+        return glsr( OptionManager::class )->get( 'settings.submissions.limit_whitelist.'.$whitelistName );
60 60
     }
61 61
 
62 62
     /**
63 63
      * @return bool
64 64
      */
65
-    protected function validate($key, $value, $addMetaQuery = true)
65
+    protected function validate( $key, $value, $addMetaQuery = true )
66 66
     {
67
-        if ($this->isWhitelisted($value, $this->getWhitelist($key))) {
67
+        if( $this->isWhitelisted( $value, $this->getWhitelist( $key ) ) ) {
68 68
             return true;
69 69
         }
70
-        add_filter('site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5, 2);
71
-        $args = ['assigned_to' => Arr::get($this->request, 'assign_to')];
72
-        if ($addMetaQuery) {
70
+        add_filter( 'site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5, 2 );
71
+        $args = ['assigned_to' => Arr::get( $this->request, 'assign_to' )];
72
+        if( $addMetaQuery ) {
73 73
             $args[$key] = $value;
74 74
         }
75
-        $reviews = glsr_get_reviews($args);
76
-        remove_filter('site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5);
77
-        $result = 0 === count($reviews);
78
-        $result = apply_filters('site-reviews/review-limits/validate', $result, $reviews, $this->request, $key);
79
-        return wp_validate_boolean($result);
75
+        $reviews = glsr_get_reviews( $args );
76
+        remove_filter( 'site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5 );
77
+        $result = 0 === count( $reviews );
78
+        $result = apply_filters( 'site-reviews/review-limits/validate', $result, $reviews, $this->request, $key );
79
+        return wp_validate_boolean( $result );
80 80
     }
81 81
 
82 82
     /**
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
      */
85 85
     protected function validateByEmail()
86 86
     {
87
-        glsr_log()->debug('Email is: '.Arr::get($this->request, 'email'));
88
-        return $this->validate('email', Arr::get($this->request, 'email'));
87
+        glsr_log()->debug( 'Email is: '.Arr::get( $this->request, 'email' ) );
88
+        return $this->validate( 'email', Arr::get( $this->request, 'email' ) );
89 89
     }
90 90
 
91 91
     /**
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
      */
94 94
     protected function validateByIpAddress()
95 95
     {
96
-        glsr_log()->debug('IP Address is: '.Arr::get($this->request, 'ip_address'));
97
-        return $this->validate('ip_address', Arr::get($this->request, 'ip_address'));
96
+        glsr_log()->debug( 'IP Address is: '.Arr::get( $this->request, 'ip_address' ) );
97
+        return $this->validate( 'ip_address', Arr::get( $this->request, 'ip_address' ) );
98 98
     }
99 99
 
100 100
     /**
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
     protected function validateByUsername()
104 104
     {
105 105
         $user = wp_get_current_user();
106
-        if (!$user->exists()) {
106
+        if( !$user->exists() ) {
107 107
             return true;
108 108
         }
109
-        glsr_log()->debug('Username is: '.$user->user_login);
110
-        return $this->validate('username', $user->user_login, false);
109
+        glsr_log()->debug( 'Username is: '.$user->user_login );
110
+        return $this->validate( 'username', $user->user_login, false );
111 111
     }
112 112
 }
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidationRules.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@  discard block
 block discarded – undo
16 16
      * @param mixed $value
17 17
      * @return mixed
18 18
      */
19
-    abstract protected function getSize($attribute, $value);
19
+    abstract protected function getSize( $attribute, $value );
20 20
 
21 21
     /**
22 22
      * Replace all placeholders.
23 23
      * @param string $message
24 24
      * @return string
25 25
      */
26
-    protected function replace($message, array $parameters)
26
+    protected function replace( $message, array $parameters )
27 27
     {
28
-        if (!Str::contains($message, '%s')) {
28
+        if( !Str::contains( $message, '%s' ) ) {
29 29
             return $message;
30 30
         }
31
-        return preg_replace_callback('/(%s)/', function () use (&$parameters) {
32
-            foreach ($parameters as $key => $value) {
33
-                return array_shift($parameters);
31
+        return preg_replace_callback( '/(%s)/', function() use (&$parameters) {
32
+            foreach( $parameters as $key => $value ) {
33
+                return array_shift( $parameters );
34 34
             }
35
-        }, $message);
35
+        }, $message );
36 36
     }
37 37
 
38 38
     /**
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
      * @param mixed $value
43 43
      * @return bool
44 44
      */
45
-    public function validateAccepted($value)
45
+    public function validateAccepted( $value )
46 46
     {
47 47
         $acceptable = ['yes', 'on', '1', 1, true, 'true'];
48
-        return $this->validateRequired($value) && in_array($value, $acceptable, true);
48
+        return $this->validateRequired( $value ) && in_array( $value, $acceptable, true );
49 49
     }
50 50
 
51 51
     /**
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
      * @param mixed $value
55 55
      * @return bool
56 56
      */
57
-    public function validateBetween($value, $attribute, array $parameters)
57
+    public function validateBetween( $value, $attribute, array $parameters )
58 58
     {
59
-        $this->requireParameterCount(2, $parameters, 'between');
60
-        $size = $this->getSize($attribute, $value);
59
+        $this->requireParameterCount( 2, $parameters, 'between' );
60
+        $size = $this->getSize( $attribute, $value );
61 61
         return $size >= $parameters[0] && $size <= $parameters[1];
62 62
     }
63 63
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
      * @param mixed $value
67 67
      * @return bool
68 68
      */
69
-    public function validateEmail($value)
69
+    public function validateEmail( $value )
70 70
     {
71
-        return false !== filter_var($value, FILTER_VALIDATE_EMAIL);
71
+        return false !== filter_var( $value, FILTER_VALIDATE_EMAIL );
72 72
     }
73 73
 
74 74
     /**
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
      * @param mixed $value
78 78
      * @return bool
79 79
      */
80
-    public function validateMax($value, $attribute, array $parameters)
80
+    public function validateMax( $value, $attribute, array $parameters )
81 81
     {
82
-        $this->requireParameterCount(1, $parameters, 'max');
83
-        return $this->getSize($attribute, $value) <= $parameters[0];
82
+        $this->requireParameterCount( 1, $parameters, 'max' );
83
+        return $this->getSize( $attribute, $value ) <= $parameters[0];
84 84
     }
85 85
 
86 86
     /**
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
      * @param mixed $value
90 90
      * @return bool
91 91
      */
92
-    public function validateMin($value, $attribute, array $parameters)
92
+    public function validateMin( $value, $attribute, array $parameters )
93 93
     {
94
-        $this->requireParameterCount(1, $parameters, 'min');
95
-        return $this->getSize($attribute, $value) >= $parameters[0];
94
+        $this->requireParameterCount( 1, $parameters, 'min' );
95
+        return $this->getSize( $attribute, $value ) >= $parameters[0];
96 96
     }
97 97
 
98 98
     /**
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
      * @param mixed $value
101 101
      * @return bool
102 102
      */
103
-    public function validateNumber($value)
103
+    public function validateNumber( $value )
104 104
     {
105
-        return is_numeric($value);
105
+        return is_numeric( $value );
106 106
     }
107 107
 
108 108
     /**
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
      * @param mixed $value
111 111
      * @return bool
112 112
      */
113
-    public function validateRequired($value)
113
+    public function validateRequired( $value )
114 114
     {
115
-        return is_null($value)
116
-            || (is_string($value) && in_array(trim($value), ['', '[]']))
117
-            || (is_array($value) && empty($value))
115
+        return is_null( $value )
116
+            || (is_string( $value ) && in_array( trim( $value ), ['', '[]'] ))
117
+            || (is_array( $value ) && empty($value))
118 118
             ? false
119 119
             : true;
120 120
     }
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
      * @return void
127 127
      * @throws InvalidArgumentException
128 128
      */
129
-    protected function requireParameterCount($count, array $parameters, $rule)
129
+    protected function requireParameterCount( $count, array $parameters, $rule )
130 130
     {
131
-        if (count($parameters) < $count) {
132
-            throw new InvalidArgumentException("Validation rule $rule requires at least $count parameters.");
131
+        if( count( $parameters ) < $count ) {
132
+            throw new InvalidArgumentException( "Validation rule $rule requires at least $count parameters." );
133 133
         }
134 134
     }
135 135
 }
Please login to merge, or discard this patch.
plugin/Contracts/MultilingualContract.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
      * @param int|string $postId
9 9
      * @return int
10 10
      */
11
-    public function getPostId($postId);
11
+    public function getPostId( $postId );
12 12
 
13 13
     /**
14 14
      * @return array
15 15
      */
16
-    public function getPostIds(array $postIds);
16
+    public function getPostIds( array $postIds );
17 17
 
18 18
     /**
19 19
      * @return bool
Please login to merge, or discard this patch.
views/pages/documentation/index.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="wrap">
4 4
     <h1 class="wp-heading-inline">
5
-        <?= esc_html(get_admin_page_title()); ?>
6
-        <a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=welcome'); ?>" class="page-title-action"><?= __('About', 'site-reviews'); ?></a>
5
+        <?= esc_html( get_admin_page_title() ); ?>
6
+        <a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=welcome' ); ?>" class="page-title-action"><?= __( 'About', 'site-reviews' ); ?></a>
7 7
     </h1>
8 8
     <?= $notices; ?>
9
-    <p><?= __('Click an active tab to expand/collapse all sections.', 'site-reviews'); ?></p>
9
+    <p><?= __( 'Click an active tab to expand/collapse all sections.', 'site-reviews' ); ?></p>
10 10
     <h2 class="glsr-nav-tab-wrapper nav-tab-wrapper">
11
-        <?php foreach ($tabs as $id => $title) : ?>
11
+        <?php foreach( $tabs as $id => $title ) : ?>
12 12
         <a class="glsr-nav-tab nav-tab" href="#<?= $id; ?>"><?= $title; ?></a>
13 13
         <?php endforeach; ?>
14 14
     </h2>
15
-    <?php foreach ($tabs as $id => $title) : ?>
15
+    <?php foreach( $tabs as $id => $title ) : ?>
16 16
     <div class="glsr-nav-view ui-tabs-hide" id="<?= $id; ?>">
17
-        <?php glsr()->render('pages/documentation/'.$id, $data); ?>
17
+        <?php glsr()->render( 'pages/documentation/'.$id, $data ); ?>
18 18
     </div>
19 19
     <?php endforeach; ?>
20 20
     <input type="hidden" name="_active_tab">
Please login to merge, or discard this patch.
views/pages/welcome/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="glsr-welcome wrap about-wrap about-wrap-content">
4 4
     <h1>Welcome to <?= glsr()->name; ?></h1>
5 5
     <div class="about-text">Site Reviews is a free WordPress review plugin with advanced features that makes it easy to manage reviews on your website. Follow the instructions below to get started!</div>
6 6
     <div class="wp-badge">Version <?= glsr()->version; ?></div>
7 7
     <p class="about-buttons">
8
-        <a class="button" href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation'); ?>">Documentation</a>
8
+        <a class="button" href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation' ); ?>">Documentation</a>
9 9
         <a class="button" href="https://wordpress.org/support/plugin/site-reviews/">Support</a>
10 10
         <a target="_blank" class="button" href="https://www.facebook.com/sharer/sharer.php?u=https%3A//geminilabs.io/site-reviews"><span class="dashicons dashicons-facebook-alt"></span> Share</a>
11 11
         <a target="_blank" class="button" href="https://twitter.com/intent/tweet?text=Site Reviews is a fantastic WordPress review plugin with advanced features that makes it easy to manage reviews on your website.&url=https://geminilabs.io/site-reviews&hashtags=WordPress,reviewplugins,"><span class="dashicons dashicons-twitter"></span> Tweet</a>
12 12
     </p>
13 13
     <nav class="glsr-nav-tab-wrapper nav-tab-wrapper">
14
-        <?php foreach ($tabs as $id => $title) : ?>
14
+        <?php foreach( $tabs as $id => $title ) : ?>
15 15
         <a class="glsr-nav-tab nav-tab" href="#<?= $id; ?>"><?= $title; ?></a>
16 16
         <?php endforeach; ?>
17 17
     </nav>
18
-    <?php foreach ($tabs as $id => $title) : ?>
18
+    <?php foreach( $tabs as $id => $title ) : ?>
19 19
     <div class="glsr-nav-view ui-tabs-hide" id="<?= $id; ?>">
20
-        <?php $template->render('pages/welcome/'.$id, $data); ?>
20
+        <?php $template->render( 'pages/welcome/'.$id, $data ); ?>
21 21
     </div>
22 22
     <?php endforeach; ?>
23 23
     <input type="hidden" name="_active_tab">
Please login to merge, or discard this patch.
plugin/Controllers/SettingsController.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
      * @return array
18 18
      * @callback register_setting
19 19
      */
20
-    public function callbackRegisterSettings($input)
20
+    public function callbackRegisterSettings( $input )
21 21
     {
22
-        $settings = Arr::consolidateArray($input);
23
-        if (1 === count($settings) && array_key_exists('settings', $settings)) {
24
-            $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
25
-            $options = $this->sanitizeGeneral($input, $options);
26
-            $options = $this->sanitizeLicenses($input, $options);
27
-            $options = $this->sanitizeSubmissions($input, $options);
28
-            $options = $this->sanitizeTranslations($input, $options);
29
-            $options = apply_filters('site-reviews/settings/callback', $options, $settings);
30
-            if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
31
-                glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
22
+        $settings = Arr::consolidateArray( $input );
23
+        if( 1 === count( $settings ) && array_key_exists( 'settings', $settings ) ) {
24
+            $options = array_replace_recursive( glsr( OptionManager::class )->all(), $input );
25
+            $options = $this->sanitizeGeneral( $input, $options );
26
+            $options = $this->sanitizeLicenses( $input, $options );
27
+            $options = $this->sanitizeSubmissions( $input, $options );
28
+            $options = $this->sanitizeTranslations( $input, $options );
29
+            $options = apply_filters( 'site-reviews/settings/callback', $options, $settings );
30
+            if( filter_input( INPUT_POST, 'option_page' ) == Application::ID.'-settings' ) {
31
+                glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
32 32
             }
33 33
             return $options;
34 34
         }
@@ -41,77 +41,77 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function registerSettings()
43 43
     {
44
-        register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
44
+        register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [
45 45
             'sanitize_callback' => [$this, 'callbackRegisterSettings'],
46
-        ]);
46
+        ] );
47 47
     }
48 48
 
49 49
     /**
50 50
      * @return array
51 51
      */
52
-    protected function sanitizeGeneral(array $input, array $options)
52
+    protected function sanitizeGeneral( array $input, array $options )
53 53
     {
54 54
         $key = 'settings.general';
55
-        $inputForm = Arr::get($input, $key);
56
-        if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) {
57
-            $options = Arr::set($options, $key.'.multilingual', '');
55
+        $inputForm = Arr::get( $input, $key );
56
+        if( !$this->hasMultilingualIntegration( Arr::get( $inputForm, 'multilingual' ) ) ) {
57
+            $options = Arr::set( $options, $key.'.multilingual', '' );
58 58
         }
59
-        if ('' == trim(Arr::get($inputForm, 'notification_message'))) {
60
-            $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message');
61
-            $options = Arr::set($options, $key.'.notification_message', $defaultValue);
59
+        if( '' == trim( Arr::get( $inputForm, 'notification_message' ) ) ) {
60
+            $defaultValue = Arr::get( glsr()->defaults, $key.'.notification_message' );
61
+            $options = Arr::set( $options, $key.'.notification_message', $defaultValue );
62 62
         }
63
-        $defaultValue = Arr::get($inputForm, 'notifications', []);
64
-        $options = Arr::set($options, $key.'.notifications', $defaultValue);
63
+        $defaultValue = Arr::get( $inputForm, 'notifications', [] );
64
+        $options = Arr::set( $options, $key.'.notifications', $defaultValue );
65 65
         return $options;
66 66
     }
67 67
 
68 68
     /**
69 69
      * @return array
70 70
      */
71
-    protected function sanitizeLicenses(array $input, array $options)
71
+    protected function sanitizeLicenses( array $input, array $options )
72 72
     {
73 73
         $key = 'settings.licenses';
74
-        $licenses = Arr::consolidateArray(Arr::get($input, $key));
75
-        foreach ($licenses as $slug => &$license) {
76
-            $license = $this->verifyLicense($license, $slug);
74
+        $licenses = Arr::consolidateArray( Arr::get( $input, $key ) );
75
+        foreach( $licenses as $slug => &$license ) {
76
+            $license = $this->verifyLicense( $license, $slug );
77 77
         }
78
-        $options = Arr::set($options, $key, $licenses);
78
+        $options = Arr::set( $options, $key, $licenses );
79 79
         return $options;
80 80
     }
81 81
 
82 82
     /**
83 83
      * @return array
84 84
      */
85
-    protected function sanitizeSubmissions(array $input, array $options)
85
+    protected function sanitizeSubmissions( array $input, array $options )
86 86
     {
87 87
         $key = 'settings.submissions';
88
-        $inputForm = Arr::get($input, $key);
88
+        $inputForm = Arr::get( $input, $key );
89 89
         $defaultValue = isset($inputForm['required'])
90 90
             ? $inputForm['required']
91 91
             : [];
92
-        $options = Arr::set($options, $key.'.required', $defaultValue);
92
+        $options = Arr::set( $options, $key.'.required', $defaultValue );
93 93
         return $options;
94 94
     }
95 95
 
96 96
     /**
97 97
      * @return array
98 98
      */
99
-    protected function sanitizeTranslations(array $input, array $options)
99
+    protected function sanitizeTranslations( array $input, array $options )
100 100
     {
101 101
         $key = 'settings.strings';
102
-        $inputForm = Arr::consolidateArray(Arr::get($input, $key));
103
-        if (!empty($inputForm)) {
104
-            $options = Arr::set($options, $key, array_values(array_filter($inputForm)));
102
+        $inputForm = Arr::consolidateArray( Arr::get( $input, $key ) );
103
+        if( !empty($inputForm) ) {
104
+            $options = Arr::set( $options, $key, array_values( array_filter( $inputForm ) ) );
105 105
             $allowedTags = [
106 106
                 'a' => ['class' => [], 'href' => [], 'target' => []],
107 107
                 'span' => ['class' => []],
108 108
             ];
109
-            array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
110
-                if (isset($string['s2'])) {
111
-                    $string['s2'] = wp_kses($string['s2'], $allowedTags);
109
+            array_walk( $options['settings']['strings'], function( &$string ) use ($allowedTags) {
110
+                if( isset($string['s2']) ) {
111
+                    $string['s2'] = wp_kses( $string['s2'], $allowedTags );
112 112
                 }
113
-                if (isset($string['p2'])) {
114
-                    $string['p2'] = wp_kses($string['p2'], $allowedTags);
113
+                if( isset($string['p2']) ) {
114
+                    $string['p2'] = wp_kses( $string['p2'], $allowedTags );
115 115
                 }
116 116
             });
117 117
         }
@@ -122,24 +122,24 @@  discard block
 block discarded – undo
122 122
      * @param string $integrationSlug
123 123
      * @return bool
124 124
      */
125
-    protected function hasMultilingualIntegration($integrationSlug)
125
+    protected function hasMultilingualIntegration( $integrationSlug )
126 126
     {
127
-        $integration = glsr(Multilingual::class)->getIntegration($integrationSlug);
128
-        if (!$integration) {
127
+        $integration = glsr( Multilingual::class )->getIntegration( $integrationSlug );
128
+        if( !$integration ) {
129 129
             return false;
130 130
         }
131
-        if (!$integration->isActive()) {
132
-            glsr(Notice::class)->addError(sprintf(
133
-                __('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
131
+        if( !$integration->isActive() ) {
132
+            glsr( Notice::class )->addError( sprintf(
133
+                __( 'Please install/activate the %s plugin to enable integration.', 'site-reviews' ),
134 134
                 $integration->pluginName
135
-            ));
135
+            ) );
136 136
             return false;
137
-        } elseif (!$integration->isSupported()) {
138
-            glsr(Notice::class)->addError(sprintf(
139
-                __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
137
+        } elseif( !$integration->isSupported() ) {
138
+            glsr( Notice::class )->addError( sprintf(
139
+                __( 'Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews' ),
140 140
                 $integration->pluginName,
141 141
                 $integration->supportedVersion
142
-            ));
142
+            ) );
143 143
             return false;
144 144
         }
145 145
         return true;
@@ -150,21 +150,21 @@  discard block
 block discarded – undo
150 150
      * @param string $slug
151 151
      * @return string
152 152
      */
153
-    protected function verifyLicense($license, $slug)
153
+    protected function verifyLicense( $license, $slug )
154 154
     {
155 155
         try {
156
-            $addon = glsr($slug);
157
-            $updater = new Updater($addon->update_url, $addon->file, [
156
+            $addon = glsr( $slug );
157
+            $updater = new Updater( $addon->update_url, $addon->file, [
158 158
                 'license' => $license,
159 159
                 'testedTo' => $addon->testedTo,
160
-            ]);
161
-            if (!$updater->isLicenseValid()) {
162
-                throw new Exception('Invalid license: '.$license.' ('.$addon->id.')');
160
+            ] );
161
+            if( !$updater->isLicenseValid() ) {
162
+                throw new Exception( 'Invalid license: '.$license.' ('.$addon->id.')' );
163 163
             }
164
-        } catch (Exception $e) {
164
+        } catch( Exception $e ) {
165 165
             $license = '';
166
-            glsr_log()->debug($e->getMessage());
167
-            glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews'));
166
+            glsr_log()->debug( $e->getMessage() );
167
+            glsr( Notice::class )->addError( __( 'A license you entered was invalid.', 'site-reviews' ) );
168 168
         }
169 169
         return $license;
170 170
     }
Please login to merge, or discard this patch.
plugin/Reviews.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public $reviews;
26 26
 
27
-    public function __construct(array $reviews, $maxPageCount, array $args)
27
+    public function __construct( array $reviews, $maxPageCount, array $args )
28 28
     {
29 29
         $this->args = $args;
30 30
         $this->max_num_pages = $maxPageCount;
31 31
         $this->reviews = $reviews;
32
-        parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
32
+        parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
33 33
     }
34 34
 
35 35
     /**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function __toString()
39 39
     {
40
-        return (string) $this->build();
40
+        return (string)$this->build();
41 41
     }
42 42
 
43 43
     /**
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function build()
47 47
     {
48
-        $args = glsr(SiteReviewsDefaults::class)->merge($this->args);
49
-        return glsr(SiteReviewsPartial::class)->build($args, $this);
48
+        $args = glsr( SiteReviewsDefaults::class )->merge( $this->args );
49
+        return glsr( SiteReviewsPartial::class )->build( $args, $this );
50 50
     }
51 51
 
52 52
     /**
53 53
      * @param mixed $key
54 54
      * @return mixed
55 55
      */
56
-    public function offsetGet($key)
56
+    public function offsetGet( $key )
57 57
     {
58
-        if (array_key_exists($key, $this->reviews)) {
58
+        if( array_key_exists( $key, $this->reviews ) ) {
59 59
             return $this->reviews[$key];
60 60
         }
61
-        return property_exists($this, $key)
61
+        return property_exists( $this, $key )
62 62
             ? $this->$key
63 63
             : null;
64 64
     }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Pagination.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,19 +18,19 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * @return string
20 20
      */
21
-    public function build(array $args = [])
21
+    public function build( array $args = [] )
22 22
     {
23
-        $this->args = $this->normalize($args);
24
-        if ($this->args['total'] < 2) {
23
+        $this->args = $this->normalize( $args );
24
+        if( $this->args['total'] < 2 ) {
25 25
             return '';
26 26
         }
27
-        return glsr(Template::class)->build('templates/pagination', [
27
+        return glsr( Template::class )->build( 'templates/pagination', [
28 28
             'context' => [
29
-                'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
29
+                'links' => apply_filters( 'site-reviews/paginate_links', $this->buildLinks(), $this->args ),
30 30
                 'loader' => '<div class="glsr-loader"></div>',
31
-                'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
31
+                'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ),
32 32
             ],
33
-        ]);
33
+        ] );
34 34
     }
35 35
 
36 36
     /**
@@ -38,24 +38,24 @@  discard block
 block discarded – undo
38 38
      */
39 39
     protected function buildLinks()
40 40
     {
41
-        $args = glsr(Style::class)->paginationArgs($this->args);
42
-        if ('array' == $args['type']) {
41
+        $args = glsr( Style::class )->paginationArgs( $this->args );
42
+        if( 'array' == $args['type'] ) {
43 43
             $args['type'] = 'plain';
44 44
         }
45
-        return paginate_links($args);
45
+        return paginate_links( $args );
46 46
     }
47 47
 
48 48
     /**
49 49
      * @return array
50 50
      */
51
-    protected function normalize(array $args)
51
+    protected function normalize( array $args )
52 52
     {
53
-        if ($baseUrl = Arr::get($args, 'baseUrl')) {
53
+        if( $baseUrl = Arr::get( $args, 'baseUrl' ) ) {
54 54
             $args['base'] = $baseUrl.'%_%';
55 55
         }
56
-        return wp_parse_args(array_filter($args), [
57
-            'current' => glsr(QueryBuilder::class)->getPaged(),
56
+        return wp_parse_args( array_filter( $args ), [
57
+            'current' => glsr( QueryBuilder::class )->getPaged(),
58 58
             'total' => 1,
59
-        ]);
59
+        ] );
60 60
     }
61 61
 }
Please login to merge, or discard this patch.