Passed
Push — master ( ae1954...aab291 )
by Paul
08:17 queued 04:15
created
plugin/Controllers/SettingsController.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -14,17 +14,17 @@  discard block
 block discarded – undo
14 14
      * @return array
15 15
      * @callback register_setting
16 16
      */
17
-    public function callbackRegisterSettings($input)
17
+    public function callbackRegisterSettings( $input )
18 18
     {
19
-        $settings = glsr(Helper::class)->consolidateArray($input);
20
-        if (1 === count($settings) && array_key_exists('settings', $settings)) {
21
-            $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
22
-            $options = $this->sanitizeGeneral($input, $options);
23
-            $options = $this->sanitizeSubmissions($input, $options);
24
-            $options = $this->sanitizeTranslations($input, $options);
25
-            $options = apply_filters('site-reviews/settings/callback', $options, $settings);
26
-            if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
27
-                glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
19
+        $settings = glsr( Helper::class )->consolidateArray( $input );
20
+        if( 1 === count( $settings ) && array_key_exists( 'settings', $settings ) ) {
21
+            $options = array_replace_recursive( glsr( OptionManager::class )->all(), $input );
22
+            $options = $this->sanitizeGeneral( $input, $options );
23
+            $options = $this->sanitizeSubmissions( $input, $options );
24
+            $options = $this->sanitizeTranslations( $input, $options );
25
+            $options = apply_filters( 'site-reviews/settings/callback', $options, $settings );
26
+            if( filter_input( INPUT_POST, 'option_page' ) == Application::ID.'-settings' ) {
27
+                glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
28 28
             }
29 29
             return $options;
30 30
         }
@@ -37,31 +37,31 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function registerSettings()
39 39
     {
40
-        register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
40
+        register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [
41 41
             'sanitize_callback' => [$this, 'callbackRegisterSettings'],
42
-        ]);
42
+        ] );
43 43
     }
44 44
 
45 45
     /**
46 46
      * @return array
47 47
      */
48
-    protected function sanitizeGeneral(array $input, array $options)
48
+    protected function sanitizeGeneral( array $input, array $options )
49 49
     {
50 50
         $inputForm = $input['settings']['general'];
51
-        if (!$this->hasMultilingualIntegration($inputForm['support']['multilingual'])) {
51
+        if( !$this->hasMultilingualIntegration( $inputForm['support']['multilingual'] ) ) {
52 52
             $options['settings']['general']['support']['multilingual'] = '';
53 53
         }
54
-        if ('' == trim($inputForm['notification_message'])) {
54
+        if( '' == trim( $inputForm['notification_message'] ) ) {
55 55
             $options['settings']['general']['notification_message'] = glsr()->defaults['settings']['general']['notification_message'];
56 56
         }
57
-        $options['settings']['general']['notifications'] = glsr_get($inputForm, 'notifications', []);
57
+        $options['settings']['general']['notifications'] = glsr_get( $inputForm, 'notifications', [] );
58 58
         return $options;
59 59
     }
60 60
 
61 61
     /**
62 62
      * @return array
63 63
      */
64
-    protected function sanitizeSubmissions(array $input, array $options)
64
+    protected function sanitizeSubmissions( array $input, array $options )
65 65
     {
66 66
         $inputForm = $input['settings']['submissions'];
67 67
         $options['settings']['submissions']['required'] = isset($inputForm['required'])
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
     /**
74 74
      * @return array
75 75
      */
76
-    protected function sanitizeTranslations(array $input, array $options)
76
+    protected function sanitizeTranslations( array $input, array $options )
77 77
     {
78
-        if (isset($input['settings']['strings'])) {
79
-            $options['settings']['strings'] = array_values(array_filter($input['settings']['strings']));
78
+        if( isset($input['settings']['strings']) ) {
79
+            $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) );
80 80
             $allowedTags = [
81 81
                 'a' => ['class' => [], 'href' => [], 'target' => []],
82 82
                 'span' => ['class' => []],
83 83
             ];
84
-            array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
85
-                if (isset($string['s2'])) {
86
-                    $string['s2'] = wp_kses($string['s2'], $allowedTags);
84
+            array_walk( $options['settings']['strings'], function( &$string ) use ($allowedTags) {
85
+                if( isset($string['s2']) ) {
86
+                    $string['s2'] = wp_kses( $string['s2'], $allowedTags );
87 87
                 }
88
-                if (isset($string['p2'])) {
89
-                    $string['p2'] = wp_kses($string['p2'], $allowedTags);
88
+                if( isset($string['p2']) ) {
89
+                    $string['p2'] = wp_kses( $string['p2'], $allowedTags );
90 90
                 }
91 91
             });
92 92
         }
@@ -96,24 +96,24 @@  discard block
 block discarded – undo
96 96
     /**
97 97
      * @return bool
98 98
      */
99
-    protected function hasMultilingualIntegration($integration)
99
+    protected function hasMultilingualIntegration( $integration )
100 100
     {
101
-        if (!in_array($integration, ['polylang', 'wpml'])) {
101
+        if( !in_array( $integration, ['polylang', 'wpml'] ) ) {
102 102
             return false;
103 103
         }
104
-        $integrationClass = 'GeminiLabs\SiteReviews\Modules\\'.ucfirst($integration);
105
-        if (!glsr($integrationClass)->isActive()) {
106
-            glsr(Notice::class)->addError(sprintf(
107
-                __('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
108
-                constant($integrationClass.'::PLUGIN_NAME')
109
-            ));
104
+        $integrationClass = 'GeminiLabs\SiteReviews\Modules\\'.ucfirst( $integration );
105
+        if( !glsr( $integrationClass )->isActive() ) {
106
+            glsr( Notice::class )->addError( sprintf(
107
+                __( 'Please install/activate the %s plugin to enable integration.', 'site-reviews' ),
108
+                constant( $integrationClass.'::PLUGIN_NAME' )
109
+            ) );
110 110
             return false;
111
-        } elseif (!glsr($integrationClass)->isSupported()) {
112
-            glsr(Notice::class)->addError(sprintf(
113
-                __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
114
-                constant($integrationClass.'::PLUGIN_NAME'),
115
-                constant($integrationClass.'::SUPPORTED_VERSION')
116
-            ));
111
+        } elseif( !glsr( $integrationClass )->isSupported() ) {
112
+            glsr( Notice::class )->addError( sprintf(
113
+                __( 'Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews' ),
114
+                constant( $integrationClass.'::PLUGIN_NAME' ),
115
+                constant( $integrationClass.'::SUPPORTED_VERSION' )
116
+            ) );
117 117
             return false;
118 118
         }
119 119
         return true;
Please login to merge, or discard this patch.
helpers.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined('WPINC') || die;
3
+defined( 'WPINC' ) || die;
4 4
 
5 5
 /*
6 6
  * Alternate method of using the functions without having to use `function_exists()`
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @param mixed ...
9 9
  * @return mixed
10 10
  */
11
-add_filter('plugins_loaded', function () {
11
+add_filter( 'plugins_loaded', function() {
12 12
     $hooks = array(
13 13
         'glsr_calculate_ratings' => 1,
14 14
         'glsr_create_review' => 2,
@@ -21,23 +21,23 @@  discard block
 block discarded – undo
21 21
         'glsr_log' => 3,
22 22
         'glsr_star_rating' => 2,
23 23
     );
24
-    foreach ($hooks as $function => $acceptedArgs) {
25
-        add_filter($function, function () use ($function) {
24
+    foreach( $hooks as $function => $acceptedArgs ) {
25
+        add_filter( $function, function() use ($function) {
26 26
             $args = func_get_args();
27
-            array_shift($args); // remove the fallback value
28
-            return call_user_func_array($function, $args);
29
-        }, 10, $acceptedArgs);
27
+            array_shift( $args ); // remove the fallback value
28
+            return call_user_func_array( $function, $args );
29
+        }, 10, $acceptedArgs );
30 30
     }
31 31
 });
32 32
 
33 33
 /**
34 34
  * @return mixed
35 35
  */
36
-function glsr($alias = null)
36
+function glsr( $alias = null )
37 37
 {
38 38
     $app = \GeminiLabs\SiteReviews\Application::load();
39 39
     return !empty($alias)
40
-        ? $app->make($alias)
40
+        ? $app->make( $alias )
41 41
         : $app;
42 42
 }
43 43
 
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
  * @param $column string
47 47
  * @return array
48 48
  */
49
-function glsr_array_column(array $array, $column)
49
+function glsr_array_column( array $array, $column )
50 50
 {
51 51
     $result = array();
52
-    foreach ($array as $subarray) {
53
-        $subarray = (array) $subarray;
54
-        if (!isset($subarray[$column])) {
52
+    foreach( $array as $subarray ) {
53
+        $subarray = (array)$subarray;
54
+        if( !isset($subarray[$column]) ) {
55 55
             continue;
56 56
         }
57 57
         $result[] = $subarray[$column];
@@ -64,19 +64,19 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function glsr_calculate_ratings()
66 66
 {
67
-    glsr('Controllers\AdminController')->routerCountReviews(false);
68
-    glsr_log()->notice(__('Recalculated rating counts.', 'site-reviews'));
67
+    glsr( 'Controllers\AdminController' )->routerCountReviews( false );
68
+    glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' ) );
69 69
 }
70 70
 
71 71
 /**
72 72
  * @return \GeminiLabs\SiteReviews\Review|false
73 73
  */
74
-function glsr_create_review($reviewValues = array())
74
+function glsr_create_review( $reviewValues = array() )
75 75
 {
76 76
     $review = new \GeminiLabs\SiteReviews\Commands\CreateReview(
77
-        glsr('Helper')->consolidateArray($reviewValues)
77
+        glsr( 'Helper' )->consolidateArray( $reviewValues )
78 78
     );
79
-    return glsr('Database\ReviewManager')->create($review);
79
+    return glsr( 'Database\ReviewManager' )->create( $review );
80 80
 }
81 81
 
82 82
 /**
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
  */
85 85
 function glsr_current_screen()
86 86
 {
87
-    if (function_exists('get_current_screen')) {
87
+    if( function_exists( 'get_current_screen' ) ) {
88 88
         $screen = get_current_screen();
89 89
     }
90 90
     return empty($screen)
91
-        ? (object) array_fill_keys(['base', 'id', 'post_type'], null)
91
+        ? (object)array_fill_keys( ['base', 'id', 'post_type'], null )
92 92
         : $screen;
93 93
 }
94 94
 
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
  * @param mixed ...$vars
97 97
  * @return void
98 98
  */
99
-function glsr_debug(...$vars)
99
+function glsr_debug( ...$vars )
100 100
 {
101
-    if (1 == count($vars)) {
102
-        $value = htmlspecialchars(print_r($vars[0], true), ENT_QUOTES, 'UTF-8');
103
-        printf('<div class="glsr-debug"><pre>%s</pre></div>', $value);
101
+    if( 1 == count( $vars ) ) {
102
+        $value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' );
103
+        printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value );
104 104
     } else {
105 105
         echo '<div class="glsr-debug-group">';
106
-        foreach ($vars as $var) {
107
-            glsr_debug($var);
106
+        foreach( $vars as $var ) {
107
+            glsr_debug( $var );
108 108
         }
109 109
         echo '</div>';
110 110
     }
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
  * @param mixed $fallback
117 117
  * @return mixed
118 118
  */
119
-function glsr_get($array, $path = '', $fallback = '')
119
+function glsr_get( $array, $path = '', $fallback = '' )
120 120
 {
121
-    return glsr('Helper')->dataGet($array, $path, $fallback);
121
+    return glsr( 'Helper' )->dataGet( $array, $path, $fallback );
122 122
 }
123 123
 
124 124
 /**
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
  * @param string $cast
128 128
  * @return string|array
129 129
  */
130
-function glsr_get_option($path = '', $fallback = '', $cast = '')
130
+function glsr_get_option( $path = '', $fallback = '', $cast = '' )
131 131
 {
132
-    return is_string($path)
133
-        ? glsr('Database\OptionManager')->get(glsr('Helper')->prefix('settings.', $path), $fallback, $cast)
132
+    return is_string( $path )
133
+        ? glsr( 'Database\OptionManager' )->get( glsr( 'Helper' )->prefix( 'settings.', $path ), $fallback, $cast )
134 134
         : $fallback;
135 135
 }
136 136
 
@@ -139,30 +139,30 @@  discard block
 block discarded – undo
139 139
  */
140 140
 function glsr_get_options()
141 141
 {
142
-    return glsr('Database\OptionManager')->get('settings');
142
+    return glsr( 'Database\OptionManager' )->get( 'settings' );
143 143
 }
144 144
 
145 145
 /**
146 146
  * @param \WP_Post|int $post
147 147
  * @return \GeminiLabs\SiteReviews\Review
148 148
  */
149
-function glsr_get_review($post)
149
+function glsr_get_review( $post )
150 150
 {
151
-    if (is_numeric($post)) {
152
-        $post = get_post($post);
151
+    if( is_numeric( $post ) ) {
152
+        $post = get_post( $post );
153 153
     }
154
-    if (!($post instanceof WP_Post)) {
155
-        $post = new WP_Post((object) []);
154
+    if( !($post instanceof WP_Post) ) {
155
+        $post = new WP_Post( (object)[] );
156 156
     }
157
-    return glsr('Database\ReviewManager')->single($post);
157
+    return glsr( 'Database\ReviewManager' )->single( $post );
158 158
 }
159 159
 
160 160
 /**
161 161
  * @return array
162 162
  */
163
-function glsr_get_reviews($args = array())
163
+function glsr_get_reviews( $args = array() )
164 164
 {
165
-    return glsr('Database\ReviewManager')->get(glsr('Helper')->consolidateArray($args));
165
+    return glsr( 'Database\ReviewManager' )->get( glsr( 'Helper' )->consolidateArray( $args ) );
166 166
 }
167 167
 
168 168
 /**
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 function glsr_log()
172 172
 {
173 173
     $args = func_get_args();
174
-    $console = glsr('Modules\Console');
175
-    if ($value = glsr_get($args, '0')) {
176
-        return $console->debug($value, glsr_get($args, '1', []));
174
+    $console = glsr( 'Modules\Console' );
175
+    if( $value = glsr_get( $args, '0' ) ) {
176
+        return $console->debug( $value, glsr_get( $args, '1', [] ) );
177 177
     }
178 178
     return $console;
179 179
 }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 /**
182 182
  * @return string
183 183
  */
184
-function glsr_star_rating($rating)
184
+function glsr_star_rating( $rating )
185 185
 {
186
-    return glsr('Modules\Html\Partial')->build('star-rating', ['rating' => $rating]);
186
+    return glsr( 'Modules\Html\Partial' )->build( 'star-rating', ['rating' => $rating] );
187 187
 }
Please login to merge, or discard this patch.
plugin/Database/OptionManager.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
     /**
16 16
      * @return string
17 17
      */
18
-    public static function databaseKey($version = null)
18
+    public static function databaseKey( $version = null )
19 19
     {
20
-        if (null === $version) {
21
-            $version = explode('.', glsr()->version);
22
-            $version = array_shift($version);
20
+        if( null === $version ) {
21
+            $version = explode( '.', glsr()->version );
22
+            $version = array_shift( $version );
23 23
         }
24
-        return glsr(Helper::class)->snakeCase(
25
-            Application::ID.'-v'.intval($version)
24
+        return glsr( Helper::class )->snakeCase(
25
+            Application::ID.'-v'.intval( $version )
26 26
         );
27 27
     }
28 28
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function all()
33 33
     {
34
-        if (empty($this->options)) {
34
+        if( empty($this->options) ) {
35 35
             $this->reset();
36 36
         }
37 37
         return $this->options;
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
      * @param string $path
42 42
      * @return bool
43 43
      */
44
-    public function delete($path)
44
+    public function delete( $path )
45 45
     {
46
-        $keys = explode('.', $path);
47
-        $last = array_pop($keys);
46
+        $keys = explode( '.', $path );
47
+        $last = array_pop( $keys );
48 48
         $options = $this->all();
49 49
         $pointer = &$options;
50
-        foreach ($keys as $key) {
51
-            if (!isset($pointer[$key]) || !is_array($pointer[$key])) {
50
+        foreach( $keys as $key ) {
51
+            if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) ) {
52 52
                 continue;
53 53
             }
54 54
             $pointer = &$pointer[$key];
55 55
         }
56 56
         unset($pointer[$last]);
57
-        return $this->set($options);
57
+        return $this->set( $options );
58 58
     }
59 59
 
60 60
     /**
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
      * @param string $cast
64 64
      * @return mixed
65 65
      */
66
-    public function get($path = '', $fallback = '', $cast = '')
66
+    public function get( $path = '', $fallback = '', $cast = '' )
67 67
     {
68
-        $result = glsr(Helper::class)->dataGet($this->all(), $path, $fallback);
69
-        return glsr(Helper::class)->castTo($cast, $result);
68
+        $result = glsr( Helper::class )->dataGet( $this->all(), $path, $fallback );
69
+        return glsr( Helper::class )->castTo( $cast, $result );
70 70
     }
71 71
 
72 72
     /**
73 73
      * @param string $path
74 74
      * @return bool
75 75
      */
76
-    public function getBool($path)
76
+    public function getBool( $path )
77 77
     {
78
-        return glsr(Helper::class)->castTo('bool', $this->get($path));
78
+        return glsr( Helper::class )->castTo( 'bool', $this->get( $path ) );
79 79
     }
80 80
 
81 81
     /**
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
      * @param string $cast
85 85
      * @return mixed
86 86
      */
87
-    public function getWP($path, $fallback = '', $cast = '')
87
+    public function getWP( $path, $fallback = '', $cast = '' )
88 88
     {
89
-        $option = get_option($path, $fallback);
90
-        if (empty($option)) {
89
+        $option = get_option( $path, $fallback );
90
+        if( empty($option) ) {
91 91
             $option = $fallback;
92 92
         }
93
-        return glsr(Helper::class)->castTo($cast, $option);
93
+        return glsr( Helper::class )->castTo( $cast, $option );
94 94
     }
95 95
 
96 96
     /**
@@ -98,25 +98,25 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function json()
100 100
     {
101
-        return json_encode($this->all());
101
+        return json_encode( $this->all() );
102 102
     }
103 103
 
104 104
     /**
105 105
      * @return array
106 106
      */
107
-    public function normalize(array $options = [])
107
+    public function normalize( array $options = [] )
108 108
     {
109 109
         $options = wp_parse_args(
110
-            glsr(Helper::class)->flattenArray($options),
111
-            glsr(DefaultsManager::class)->defaults()
110
+            glsr( Helper::class )->flattenArray( $options ),
111
+            glsr( DefaultsManager::class )->defaults()
112 112
         );
113
-        array_walk($options, function (&$value) {
114
-            if (!is_string($value)) {
113
+        array_walk( $options, function( &$value ) {
114
+            if( !is_string( $value ) ) {
115 115
                 return;
116 116
             }
117
-            $value = wp_kses($value, wp_kses_allowed_html('post'));
117
+            $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) );
118 118
         });
119
-        return glsr(Helper::class)->convertDotNotationArray($options);
119
+        return glsr( Helper::class )->convertDotNotationArray( $options );
120 120
     }
121 121
 
122 122
     /**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function isRecaptchaEnabled()
126 126
     {
127
-        $integration = $this->get('settings.submissions.recaptcha.integration');
127
+        $integration = $this->get( 'settings.submissions.recaptcha.integration' );
128 128
         return 'all' == $integration || ('guest' == $integration && !is_user_logged_in());
129 129
     }
130 130
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function reset()
135 135
     {
136
-        $options = $this->getWP(static::databaseKey(), []);
137
-        if (!is_array($options) || empty($options)) {
138
-            delete_option(static::databaseKey());
136
+        $options = $this->getWP( static::databaseKey(), [] );
137
+        if( !is_array( $options ) || empty($options) ) {
138
+            delete_option( static::databaseKey() );
139 139
             $options = glsr()->defaults ?: [];
140 140
         }
141 141
         $this->options = $options;
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
      * @param mixed $value
147 147
      * @return bool
148 148
      */
149
-    public function set($pathOrOptions, $value = '')
149
+    public function set( $pathOrOptions, $value = '' )
150 150
     {
151
-        if (is_string($pathOrOptions)) {
152
-            $pathOrOptions = glsr(Helper::class)->dataSet($this->all(), $pathOrOptions, $value);
151
+        if( is_string( $pathOrOptions ) ) {
152
+            $pathOrOptions = glsr( Helper::class )->dataSet( $this->all(), $pathOrOptions, $value );
153 153
         }
154
-        if ($result = update_option(static::databaseKey(), (array) $pathOrOptions)) {
154
+        if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) {
155 155
             $this->reset();
156 156
         }
157 157
         return $result;
Please login to merge, or discard this patch.
plugin/Filters.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
     protected $translator;
26 26
     protected $welcome;
27 27
 
28
-    public function __construct(Application $app)
28
+    public function __construct( Application $app )
29 29
     {
30 30
         $this->app = $app;
31
-        $this->admin = $app->make(AdminController::class);
32
-        $this->basename = plugin_basename($app->file);
33
-        $this->blocks = $app->make(BlocksController::class);
34
-        $this->editor = $app->make(EditorController::class);
35
-        $this->listtable = $app->make(ListTableController::class);
36
-        $this->public = $app->make(PublicController::class);
37
-        $this->rebusify = $app->make(RebusifyController::class);
38
-        $this->translator = $app->make(Translator::class);
39
-        $this->welcome = $app->make(WelcomeController::class);
31
+        $this->admin = $app->make( AdminController::class );
32
+        $this->basename = plugin_basename( $app->file );
33
+        $this->blocks = $app->make( BlocksController::class );
34
+        $this->editor = $app->make( EditorController::class );
35
+        $this->listtable = $app->make( ListTableController::class );
36
+        $this->public = $app->make( PublicController::class );
37
+        $this->rebusify = $app->make( RebusifyController::class );
38
+        $this->translator = $app->make( Translator::class );
39
+        $this->welcome = $app->make( WelcomeController::class );
40 40
     }
41 41
 
42 42
     /**
@@ -44,39 +44,39 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function run()
46 46
     {
47
-        add_filter('map_meta_cap',                                              [$this->admin, 'filterCreateCapability'], 10, 2);
48
-        add_filter('mce_external_plugins',                                      [$this->admin, 'filterTinymcePlugins'], 15);
49
-        add_filter('plugin_action_links_'.$this->basename,                      [$this->admin, 'filterActionLinks']);
50
-        add_filter('dashboard_glance_items',                                    [$this->admin, 'filterDashboardGlanceItems']);
51
-        add_filter('block_categories',                                          [$this->blocks, 'filterBlockCategories']);
52
-        add_filter('classic_editor_enabled_editors_for_post_type',              [$this->blocks, 'filterEnabledEditors'], 10, 2);
53
-        add_filter('use_block_editor_for_post_type',                            [$this->blocks, 'filterUseBlockEditor'], 10, 2);
54
-        add_filter('wp_editor_settings',                                        [$this->editor, 'filterEditorSettings']);
55
-        add_filter('the_editor',                                                [$this->editor, 'filterEditorTextarea']);
56
-        add_filter('is_protected_meta',                                         [$this->editor, 'filterIsProtectedMeta'], 10, 3);
57
-        add_filter('gettext',                                                   [$this->editor, 'filterPostStatusLabels'], 10, 3);
58
-        add_filter('gettext_with_context',                                      [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4);
59
-        add_filter('post_updated_messages',                                     [$this->editor, 'filterUpdateMessages']);
60
-        add_filter('bulk_post_updated_messages',                                [$this->listtable, 'filterBulkUpdateMessages'], 10, 2);
61
-        add_filter('manage_'.Application::POST_TYPE.'_posts_columns',           [$this->listtable, 'filterColumnsForPostType']);
62
-        add_filter('post_date_column_status',                                   [$this->listtable, 'filterDateColumnStatus'], 10, 2);
63
-        add_filter('default_hidden_columns',                                    [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2);
64
-        add_filter('display_post_states',                                       [$this->listtable, 'filterPostStates'], 10, 2);
65
-        add_filter('post_row_actions',                                          [$this->listtable, 'filterRowActions'], 10, 2);
66
-        add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns',   [$this->listtable, 'filterSortableColumns']);
67
-        add_filter('ngettext',                                                  [$this->listtable, 'filterStatusText'], 10, 5);
68
-        add_filter('script_loader_tag',                                         [$this->public, 'filterEnqueuedScripts'], 10, 2);
69
-        add_filter('site-reviews/config/forms/submission-form',                 [$this->public, 'filterFieldOrder'], 11);
70
-        add_filter('query_vars',                                                [$this->public, 'filterQueryVars']);
71
-        add_filter('site-reviews/render/view',                                  [$this->public, 'filterRenderView']);
72
-        add_filter('site-reviews/settings/callback',                            [$this->rebusify, 'filterSettingsCallback']);
73
-        add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->rebusify, 'filterSettingsTableRow'], 10, 3);
74
-        add_filter('gettext',                                                   [$this->translator, 'filterGettext'], 10, 3);
75
-        add_filter('gettext_with_context',                                      [$this->translator, 'filterGettextWithContext'], 10, 4);
76
-        add_filter('ngettext',                                                  [$this->translator, 'filterNgettext'], 10, 5);
77
-        add_filter('ngettext_with_context',                                     [$this->translator, 'filterNgettextWithContext'], 10, 6);
78
-        add_filter('plugin_action_links_'.$this->basename,                      [$this->welcome, 'filterActionLinks'], 9);
79
-        add_filter('admin_title',                                               [$this->welcome, 'filterAdminTitle']);
80
-        add_filter('admin_footer_text',                                         [$this->welcome, 'filterFooterText']);
47
+        add_filter( 'map_meta_cap', [$this->admin, 'filterCreateCapability'], 10, 2 );
48
+        add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 );
49
+        add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] );
50
+        add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] );
51
+        add_filter( 'block_categories', [$this->blocks, 'filterBlockCategories'] );
52
+        add_filter( 'classic_editor_enabled_editors_for_post_type', [$this->blocks, 'filterEnabledEditors'], 10, 2 );
53
+        add_filter( 'use_block_editor_for_post_type', [$this->blocks, 'filterUseBlockEditor'], 10, 2 );
54
+        add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] );
55
+        add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] );
56
+        add_filter( 'is_protected_meta', [$this->editor, 'filterIsProtectedMeta'], 10, 3 );
57
+        add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 );
58
+        add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 );
59
+        add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] );
60
+        add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 );
61
+        add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] );
62
+        add_filter( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 );
63
+        add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 );
64
+        add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 );
65
+        add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 );
66
+        add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] );
67
+        add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 );
68
+        add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 );
69
+        add_filter( 'site-reviews/config/forms/submission-form', [$this->public, 'filterFieldOrder'], 11 );
70
+        add_filter( 'query_vars', [$this->public, 'filterQueryVars'] );
71
+        add_filter( 'site-reviews/render/view', [$this->public, 'filterRenderView'] );
72
+        add_filter( 'site-reviews/settings/callback', [$this->rebusify, 'filterSettingsCallback'] );
73
+        add_filter( 'site-reviews/interpolate/partials/form/table-row-multiple', [$this->rebusify, 'filterSettingsTableRow'], 10, 3 );
74
+        add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 );
75
+        add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 );
76
+        add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 );
77
+        add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 );
78
+        add_filter( 'plugin_action_links_'.$this->basename, [$this->welcome, 'filterActionLinks'], 9 );
79
+        add_filter( 'admin_title', [$this->welcome, 'filterAdminTitle'] );
80
+        add_filter( 'admin_footer_text', [$this->welcome, 'filterFooterText'] );
81 81
     }
82 82
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Field.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public $field;
15 15
 
16
-    public function __construct(array $field = [])
16
+    public function __construct( array $field = [] )
17 17
     {
18
-        $this->field = wp_parse_args($field, [
18
+        $this->field = wp_parse_args( $field, [
19 19
             'errors' => false,
20 20
             'is_hidden' => false,
21 21
             'is_multi' => false,
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             'is_valid' => true,
26 26
             'is_widget' => false,
27 27
             'path' => '',
28
-        ]);
28
+        ] );
29 29
         $this->normalize();
30 30
     }
31 31
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function __toString()
36 36
     {
37
-        return (string) $this->build();
37
+        return (string)$this->build();
38 38
     }
39 39
 
40 40
     /**
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function build()
44 44
     {
45
-        if (!$this->field['is_valid']) {
45
+        if( !$this->field['is_valid'] ) {
46 46
             return;
47 47
         }
48
-        if ($this->field['is_raw']) {
49
-            return glsr(Builder::class)->{$this->field['type']}($this->field);
48
+        if( $this->field['is_raw'] ) {
49
+            return glsr( Builder::class )->{$this->field['type']}($this->field);
50 50
         }
51
-        if (!$this->field['is_setting']) {
51
+        if( !$this->field['is_setting'] ) {
52 52
             return $this->buildField();
53 53
         }
54
-        if (!$this->field['is_multi']) {
54
+        if( !$this->field['is_multi'] ) {
55 55
             return $this->buildSettingField();
56 56
         }
57 57
         return $this->buildSettingMultiField();
@@ -70,22 +70,22 @@  discard block
 block discarded – undo
70 70
      */
71 71
     protected function buildField()
72 72
     {
73
-        $field = glsr(Template::class)->build('templates/form/field_'.$this->field['type'], [
73
+        $field = glsr( Template::class )->build( 'templates/form/field_'.$this->field['type'], [
74 74
             'context' => [
75 75
                 'class' => $this->getFieldClass(),
76 76
                 'errors' => $this->getFieldErrors(),
77
-                'field' => glsr(Builder::class)->raw($this->field),
78
-                'label' => glsr(Builder::class)->label([
77
+                'field' => glsr( Builder::class )->raw( $this->field ),
78
+                'label' => glsr( Builder::class )->label( [
79 79
                     'class' => 'glsr-'.$this->field['type'].'-label',
80 80
                     'for' => $this->field['id'],
81 81
                     'is_public' => $this->field['is_public'],
82 82
                     'text' => $this->field['label'].'<span></span>',
83 83
                     'type' => $this->field['type'],
84
-                ]),
84
+                ] ),
85 85
             ],
86 86
             'field' => $this->field,
87
-        ]);
88
-        return apply_filters('site-reviews/rendered/field', $field, $this->field['type'], $this->field);
87
+        ] );
88
+        return apply_filters( 'site-reviews/rendered/field', $field, $this->field['type'], $this->field );
89 89
     }
90 90
 
91 91
     /**
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
      */
94 94
     protected function buildSettingField()
95 95
     {
96
-        return glsr(Template::class)->build('partials/form/table-row', [
96
+        return glsr( Template::class )->build( 'partials/form/table-row', [
97 97
             'context' => [
98 98
                 'class' => $this->getFieldClass(),
99
-                'field' => glsr(Builder::class)->{$this->field['type']}($this->field),
100
-                'label' => glsr(Builder::class)->label($this->field['legend'], ['for' => $this->field['id']]),
99
+                'field' => glsr( Builder::class )->{$this->field['type']}($this->field),
100
+                'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ),
101 101
             ],
102 102
             'field' => $this->field,
103
-        ]);
103
+        ] );
104 104
     }
105 105
 
106 106
     /**
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $dependsOn = $this->getFieldDependsOn();
112 112
         unset($this->field['data-depends']);
113
-        return glsr(Template::class)->build('partials/form/table-row-multiple', [
113
+        return glsr( Template::class )->build( 'partials/form/table-row-multiple', [
114 114
             'context' => [
115 115
                 'class' => $this->getFieldClass(),
116 116
                 'depends_on' => $dependsOn,
117
-                'field' => glsr(Builder::class)->{$this->field['type']}($this->field),
118
-                'label' => glsr(Builder::class)->label($this->field['legend'], ['for' => $this->field['id']]),
117
+                'field' => glsr( Builder::class )->{$this->field['type']}($this->field),
118
+                'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ),
119 119
                 'legend' => $this->field['legend'],
120 120
             ],
121 121
             'field' => $this->field,
122
-        ]);
122
+        ] );
123 123
     }
124 124
 
125 125
     /**
@@ -128,17 +128,17 @@  discard block
 block discarded – undo
128 128
     protected function getFieldClass()
129 129
     {
130 130
         $classes = [];
131
-        if (!empty($this->field['errors'])) {
131
+        if( !empty($this->field['errors']) ) {
132 132
             $classes[] = 'glsr-has-error';
133 133
         }
134
-        if ($this->field['is_hidden']) {
134
+        if( $this->field['is_hidden'] ) {
135 135
             $classes[] = 'hidden';
136 136
         }
137
-        if (!empty($this->field['required'])) {
137
+        if( !empty($this->field['required']) ) {
138 138
             $classes[] = 'glsr-required';
139 139
         }
140
-        $classes = apply_filters('site-reviews/rendered/field/classes', $classes, $this->field);
141
-        return implode(' ', $classes);
140
+        $classes = apply_filters( 'site-reviews/rendered/field/classes', $classes, $this->field );
141
+        return implode( ' ', $classes );
142 142
     }
143 143
 
144 144
     /**
@@ -156,18 +156,18 @@  discard block
 block discarded – undo
156 156
      */
157 157
     protected function getFieldErrors()
158 158
     {
159
-        if (empty($this->field['errors']) || !is_array($this->field['errors'])) {
159
+        if( empty($this->field['errors']) || !is_array( $this->field['errors'] ) ) {
160 160
             return;
161 161
         }
162
-        $errors = array_reduce($this->field['errors'], function ($carry, $error) {
163
-            return $carry.glsr(Builder::class)->span($error, ['class' => 'glsr-field-error']);
162
+        $errors = array_reduce( $this->field['errors'], function( $carry, $error ) {
163
+            return $carry.glsr( Builder::class )->span( $error, ['class' => 'glsr-field-error'] );
164 164
         });
165
-        return glsr(Template::class)->build('templates/form/field-errors', [
165
+        return glsr( Template::class )->build( 'templates/form/field-errors', [
166 166
             'context' => [
167 167
                 'errors' => $errors,
168 168
             ],
169 169
             'field' => $this->field,
170
-        ]);
170
+        ] );
171 171
     }
172 172
 
173 173
     /**
@@ -189,17 +189,17 @@  discard block
 block discarded – undo
189 189
         $requiredValues = [
190 190
             'name', 'type',
191 191
         ];
192
-        foreach ($requiredValues as $value) {
193
-            if (isset($this->field[$value])) {
192
+        foreach( $requiredValues as $value ) {
193
+            if( isset($this->field[$value]) ) {
194 194
                 continue;
195 195
             }
196 196
             $missingValues[] = $value;
197 197
             $this->field['is_valid'] = false;
198 198
         }
199
-        if (!empty($missingValues)) {
199
+        if( !empty($missingValues) ) {
200 200
             glsr_log()
201
-                ->warning('Field is missing: '.implode(', ', $missingValues))
202
-                ->debug($this->field);
201
+                ->warning( 'Field is missing: '.implode( ', ', $missingValues ) )
202
+                ->debug( $this->field );
203 203
         }
204 204
         return $this->field['is_valid'];
205 205
     }
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
      */
210 210
     protected function normalize()
211 211
     {
212
-        if (!$this->isFieldValid()) {
212
+        if( !$this->isFieldValid() ) {
213 213
             return;
214 214
         }
215 215
         $this->field['path'] = $this->field['name'];
216
-        $className = glsr(Helper::class)->buildClassName($this->field['type'], __NAMESPACE__.'\Fields');
217
-        if (class_exists($className)) {
218
-            $this->field = $className::merge($this->field);
216
+        $className = glsr( Helper::class )->buildClassName( $this->field['type'], __NAMESPACE__.'\Fields' );
217
+        if( class_exists( $className ) ) {
218
+            $this->field = $className::merge( $this->field );
219 219
         }
220 220
         $this->normalizeFieldId();
221 221
         $this->normalizeFieldName();
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
      */
227 227
     protected function normalizeFieldId()
228 228
     {
229
-        if (isset($this->field['id']) || $this->field['is_raw']) {
229
+        if( isset($this->field['id']) || $this->field['is_raw'] ) {
230 230
             return;
231 231
         }
232
-        $this->field['id'] = glsr(Helper::class)->convertPathToId(
232
+        $this->field['id'] = glsr( Helper::class )->convertPathToId(
233 233
             $this->field['path'],
234 234
             $this->getFieldPrefix()
235 235
         );
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      */
241 241
     protected function normalizeFieldName()
242 242
     {
243
-        $this->field['name'] = glsr(Helper::class)->convertPathToName(
243
+        $this->field['name'] = glsr( Helper::class )->convertPathToName(
244 244
             $this->field['path'],
245 245
             $this->getFieldPrefix()
246 246
         );
Please login to merge, or discard this patch.
plugin/Modules/Html/Template.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
      * @param string $templatePath
11 11
      * @return void|string
12 12
      */
13
-    public function build($templatePath, array $data = [])
13
+    public function build( $templatePath, array $data = [] )
14 14
     {
15
-        $data = $this->normalize($data);
15
+        $data = $this->normalize( $data );
16 16
         ob_start();
17
-        glsr()->render($templatePath, $data);
17
+        glsr()->render( $templatePath, $data );
18 18
         $template = ob_get_clean();
19
-        $path = glsr(Helper::class)->removePrefix('templates/', $templatePath);
20
-        $template = apply_filters('site-reviews/build/template/'.$path, $template, $data);
21
-        $template = $this->interpolate($template, $data, $path);
22
-        $template = apply_filters('site-reviews/rendered/template', $template, $templatePath, $data);
23
-        $template = apply_filters('site-reviews/rendered/template/'.$path, $template, $data);
19
+        $path = glsr( Helper::class )->removePrefix( 'templates/', $templatePath );
20
+        $template = apply_filters( 'site-reviews/build/template/'.$path, $template, $data );
21
+        $template = $this->interpolate( $template, $data, $path );
22
+        $template = apply_filters( 'site-reviews/rendered/template', $template, $templatePath, $data );
23
+        $template = apply_filters( 'site-reviews/rendered/template/'.$path, $template, $data );
24 24
         return $template;
25 25
     }
26 26
 
@@ -30,37 +30,37 @@  discard block
 block discarded – undo
30 30
      * @param string $templatePath
31 31
      * @return string
32 32
      */
33
-    public function interpolate($template, array $data = [], $templatePath)
33
+    public function interpolate( $template, array $data = [], $templatePath )
34 34
     {
35
-        $context = $this->normalizeContext(glsr_get($data, 'context', []));
36
-        $context = apply_filters('site-reviews/interpolate/'.$templatePath, $context, $template, $data);
37
-        foreach ($context as $key => $value) {
35
+        $context = $this->normalizeContext( glsr_get( $data, 'context', [] ) );
36
+        $context = apply_filters( 'site-reviews/interpolate/'.$templatePath, $context, $template, $data );
37
+        foreach( $context as $key => $value ) {
38 38
             $template = strtr(
39 39
                 $template,
40
-                array_fill_keys(['{'.$key.'}', '{{ '.$key.' }}'], $value)
40
+                array_fill_keys( ['{'.$key.'}', '{{ '.$key.' }}'], $value )
41 41
             );
42 42
         }
43
-        return trim($template);
43
+        return trim( $template );
44 44
     }
45 45
 
46 46
     /**
47 47
      * @param string $templatePath
48 48
      * @return void|string
49 49
      */
50
-    public function render($templatePath, array $data = [])
50
+    public function render( $templatePath, array $data = [] )
51 51
     {
52
-        echo $this->build($templatePath, $data);
52
+        echo $this->build( $templatePath, $data );
53 53
     }
54 54
 
55 55
     /**
56 56
      * @return array
57 57
      */
58
-    protected function normalize(array $data)
58
+    protected function normalize( array $data )
59 59
     {
60 60
         $arrayKeys = ['context', 'globals'];
61
-        $data = wp_parse_args($data, array_fill_keys($arrayKeys, []));
62
-        foreach ($arrayKeys as $key) {
63
-            if (is_array($data[$key])) {
61
+        $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ) );
62
+        foreach( $arrayKeys as $key ) {
63
+            if( is_array( $data[$key] ) ) {
64 64
                 continue;
65 65
             }
66 66
             $data[$key] = [];
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
     /**
72 72
      * @return array
73 73
      */
74
-    protected function normalizeContext(array $context)
74
+    protected function normalizeContext( array $context )
75 75
     {
76
-        $context = array_filter($context, function ($value) {
77
-            return !is_array($value) && !is_object($value);
76
+        $context = array_filter( $context, function( $value ) {
77
+            return !is_array( $value ) && !is_object( $value );
78 78
         });
79
-        return array_map(function ($value) {
80
-            return (string) $value;
81
-        }, $context);
79
+        return array_map( function( $value ) {
80
+            return (string)$value;
81
+        }, $context );
82 82
     }
83 83
 }
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined('WP_UNINSTALL_PLUGIN') || die;
3
+defined( 'WP_UNINSTALL_PLUGIN' ) || die;
4 4
 
5 5
 require_once __DIR__.'/site-reviews.php';
6 6
 
7
-if (!(new GL_Plugin_Check_v3(__FILE__))->isValid()) {
7
+if( !(new GL_Plugin_Check_v3( __FILE__ ))->isValid() ) {
8 8
     return;
9 9
 }
10
-delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(3));
11
-delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(4));
12
-delete_option('_glsr_rebusify');
13
-delete_option('widget_'.glsr()->id.'_site-reviews');
14
-delete_option('widget_'.glsr()->id.'_site-reviews-form');
15
-delete_option('widget_'.glsr()->id.'_site-reviews-summary');
16
-delete_transient(glsr()->id.'_cloudflare_ips');
17
-delete_transient(glsr()->id.'_remote_post_test');
18
-wp_cache_delete(glsr()->id);
10
+delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey( 3 ) );
11
+delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey( 4 ) );
12
+delete_option( '_glsr_rebusify' );
13
+delete_option( 'widget_'.glsr()->id.'_site-reviews' );
14
+delete_option( 'widget_'.glsr()->id.'_site-reviews-form' );
15
+delete_option( 'widget_'.glsr()->id.'_site-reviews-summary' );
16
+delete_transient( glsr()->id.'_cloudflare_ips' );
17
+delete_transient( glsr()->id.'_remote_post_test' );
18
+wp_cache_delete( glsr()->id );
19 19
 
20 20
 global $wpdb;
21 21
 
22
-$wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key = '_glsr_notices'");
22
+$wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key = '_glsr_notices'" );
Please login to merge, or discard this patch.
plugin/Modules/Upgrader/Upgrade_4_0_0.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
         $this->migrateSettings();
15 15
         $this->protectMetaKeys();
16 16
         $this->deleteSessions();
17
-        delete_transient(Application::ID.'_cloudflare_ips');
17
+        delete_transient( Application::ID.'_cloudflare_ips' );
18 18
     }
19 19
 
20 20
     /**
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
     public function deleteSessions()
24 24
     {
25 25
         global $wpdb;
26
-        $wpdb->query("
26
+        $wpdb->query( "
27 27
             DELETE
28 28
             FROM {$wpdb->options}
29 29
             WHERE option_name LIKE '_glsr_session%'
30
-        ");
30
+        " );
31 31
     }
32 32
 
33 33
     /**
@@ -35,23 +35,23 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function migrateSettings()
37 37
     {
38
-        if ($settings = get_option(OptionManager::databaseKey(3))) {
39
-            $multilingual = 'yes' == glsr(Helper::class)->dataGet($settings, 'settings.general.support.polylang')
38
+        if( $settings = get_option( OptionManager::databaseKey( 3 ) ) ) {
39
+            $multilingual = 'yes' == glsr( Helper::class )->dataGet( $settings, 'settings.general.support.polylang' )
40 40
                 ? 'polylang'
41 41
                 : '';
42
-            $settings = glsr(Helper::class)->dataSet($settings, 'settings.general.multilingual', $multilingual);
43
-            $settings = glsr(Helper::class)->dataSet($settings, 'settings.general.rebusify', 'no');
44
-            $settings = glsr(Helper::class)->dataSet($settings, 'settings.general.rebusify_email', '');
45
-            $settings = glsr(Helper::class)->dataSet($settings, 'settings.general.rebusify_serial', '');
46
-            $settings = glsr(Helper::class)->dataSet($settings, 'settings.reviews.name.format', '');
47
-            $settings = glsr(Helper::class)->dataSet($settings, 'settings.reviews.name.initial', '');
48
-            $settings = glsr(Helper::class)->dataSet($settings, 'settings.submissions.blacklist.integration', '');
49
-            $settings = glsr(Helper::class)->dataSet($settings, 'settings.submissions.limit', '');
50
-            $settings = glsr(Helper::class)->dataSet($settings, 'settings.submissions.limit_whitelist.email', '');
51
-            $settings = glsr(Helper::class)->dataSet($settings, 'settings.submissions.limit_whitelist.ip_address', '');
52
-            $settings = glsr(Helper::class)->dataSet($settings, 'settings.submissions.limit_whitelist.username', '');
42
+            $settings = glsr( Helper::class )->dataSet( $settings, 'settings.general.multilingual', $multilingual );
43
+            $settings = glsr( Helper::class )->dataSet( $settings, 'settings.general.rebusify', 'no' );
44
+            $settings = glsr( Helper::class )->dataSet( $settings, 'settings.general.rebusify_email', '' );
45
+            $settings = glsr( Helper::class )->dataSet( $settings, 'settings.general.rebusify_serial', '' );
46
+            $settings = glsr( Helper::class )->dataSet( $settings, 'settings.reviews.name.format', '' );
47
+            $settings = glsr( Helper::class )->dataSet( $settings, 'settings.reviews.name.initial', '' );
48
+            $settings = glsr( Helper::class )->dataSet( $settings, 'settings.submissions.blacklist.integration', '' );
49
+            $settings = glsr( Helper::class )->dataSet( $settings, 'settings.submissions.limit', '' );
50
+            $settings = glsr( Helper::class )->dataSet( $settings, 'settings.submissions.limit_whitelist.email', '' );
51
+            $settings = glsr( Helper::class )->dataSet( $settings, 'settings.submissions.limit_whitelist.ip_address', '' );
52
+            $settings = glsr( Helper::class )->dataSet( $settings, 'settings.submissions.limit_whitelist.username', '' );
53 53
             unset($settings['settings']['general']['support']);
54
-            update_option(OptionManager::databaseKey(4), $settings);
54
+            update_option( OptionManager::databaseKey( 4 ), $settings );
55 55
         }
56 56
     }
57 57
 
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
     public function protectMetaKeys()
62 62
     {
63 63
         global $wpdb;
64
-        $keys = array_keys(glsr(CreateReviewDefaults::class)->defaults());
65
-        $keys = implode("','", $keys);
64
+        $keys = array_keys( glsr( CreateReviewDefaults::class )->defaults() );
65
+        $keys = implode( "','", $keys );
66 66
         $postType = Application::POST_TYPE;
67
-        $wpdb->query("
67
+        $wpdb->query( "
68 68
             UPDATE {$wpdb->postmeta} pm
69 69
             INNER JOIN {$wpdb->posts} p ON p.id = pm.post_id
70 70
             SET pm.meta_key = CONCAT('_', pm.meta_key)
71 71
             WHERE pm.meta_key IN ('{$keys}')
72 72
             AND p.post_type = '{$postType}'
73
-        ");
73
+        " );
74 74
     }
75 75
 }
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
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
      * @param Reviews|null $reviews
44 44
      * @return ReviewsHtml
45 45
      */
46
-    public function build(array $args = [], $reviews = null)
46
+    public function build( array $args = [], $reviews = null )
47 47
     {
48
-        $this->args = glsr(SiteReviewsDefaults::class)->merge($args);
49
-        $this->options = glsr(Helper::class)->flattenArray(glsr(OptionManager::class)->all());
48
+        $this->args = glsr( SiteReviewsDefaults::class )->merge( $args );
49
+        $this->options = glsr( Helper::class )->flattenArray( glsr( OptionManager::class )->all() );
50 50
         $this->reviews = $reviews instanceof Reviews
51 51
             ? $reviews
52
-            : glsr(ReviewManager::class)->get($args);
52
+            : glsr( ReviewManager::class )->get( $args );
53 53
         $this->generateSchema();
54 54
         return $this->buildReviews();
55 55
     }
@@ -57,26 +57,26 @@  discard block
 block discarded – undo
57 57
     /**
58 58
      * @return ReviewHtml
59 59
      */
60
-    public function buildReview(Review $review)
60
+    public function buildReview( Review $review )
61 61
     {
62
-        $review = apply_filters('site-reviews/review/build/before', $review);
62
+        $review = apply_filters( 'site-reviews/review/build/before', $review );
63 63
         $this->current = $review;
64 64
         $renderedFields = [];
65
-        foreach ($review as $key => $value) {
66
-            $method = glsr(Helper::class)->buildMethodName($key, 'buildOption');
67
-            $field = method_exists($this, $method)
68
-                ? $this->$method($key, $value)
65
+        foreach( $review as $key => $value ) {
66
+            $method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' );
67
+            $field = method_exists( $this, $method )
68
+                ? $this->$method( $key, $value )
69 69
                 : false;
70
-            $field = apply_filters('site-reviews/review/build/'.$key, $field, $value, $this, $review);
71
-            if (false === $field) {
70
+            $field = apply_filters( 'site-reviews/review/build/'.$key, $field, $value, $this, $review );
71
+            if( false === $field ) {
72 72
                 continue;
73 73
             }
74 74
             $renderedFields[$key] = $field;
75 75
         }
76
-        $this->wrap($renderedFields, $review);
77
-        $renderedFields = apply_filters('site-reviews/review/build/after', $renderedFields, $review, $this);
76
+        $this->wrap( $renderedFields, $review );
77
+        $renderedFields = apply_filters( 'site-reviews/review/build/after', $renderedFields, $review, $this );
78 78
         $this->current = null;
79
-        return new ReviewHtml($review, (array) $renderedFields);
79
+        return new ReviewHtml( $review, (array)$renderedFields );
80 80
     }
81 81
 
82 82
     /**
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
     public function buildReviews()
86 86
     {
87 87
         $renderedReviews = [];
88
-        foreach ($this->reviews as $index => $review) {
89
-            $renderedReviews[] = $this->buildReview($review);
88
+        foreach( $this->reviews as $index => $review ) {
89
+            $renderedReviews[] = $this->buildReview( $review );
90 90
         }
91
-        return new ReviewsHtml($renderedReviews, $this->reviews->max_num_pages, $this->args);
91
+        return new ReviewsHtml( $renderedReviews, $this->reviews->max_num_pages, $this->args );
92 92
     }
93 93
 
94 94
     /**
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function generateSchema()
98 98
     {
99
-        if (!wp_validate_boolean($this->args['schema'])) {
99
+        if( !wp_validate_boolean( $this->args['schema'] ) ) {
100 100
             return;
101 101
         }
102
-        glsr(Schema::class)->store(
103
-            glsr(Schema::class)->build($this->args)
102
+        glsr( Schema::class )->store(
103
+            glsr( Schema::class )->build( $this->args )
104 104
         );
105 105
     }
106 106
 
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
      * @param string $path
110 110
      * @return bool
111 111
      */
112
-    public function isHidden($key, $path = '')
112
+    public function isHidden( $key, $path = '' )
113 113
     {
114 114
         $isOptionEnabled = !empty($path)
115
-            ? $this->isOptionEnabled($path)
115
+            ? $this->isOptionEnabled( $path )
116 116
             : true;
117
-        return in_array($key, $this->args['hide']) || !$isOptionEnabled;
117
+        return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
118 118
     }
119 119
 
120 120
     /**
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
      * @param string $value
123 123
      * @return void|string
124 124
      */
125
-    protected function buildOptionAssignedTo($key, $value)
125
+    protected function buildOptionAssignedTo( $key, $value )
126 126
     {
127
-        if ($this->isHidden($key, 'settings.reviews.assigned_links')) {
127
+        if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) ) {
128 128
             return;
129 129
         }
130
-        $post = glsr(Polylang::class)->getPost($value);
131
-        if (!($post instanceof WP_Post)) {
130
+        $post = glsr( Polylang::class )->getPost( $value );
131
+        if( !($post instanceof WP_Post) ) {
132 132
             return;
133 133
         }
134
-        $permalink = glsr(Builder::class)->a(get_the_title($post->ID), [
135
-            'href' => get_the_permalink($post->ID),
136
-        ]);
137
-        $assignedTo = sprintf(__('Review of %s', 'site-reviews'), $permalink);
134
+        $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
135
+            'href' => get_the_permalink( $post->ID ),
136
+        ] );
137
+        $assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
138 138
         return '<span>'.$assignedTo.'</span>';
139 139
     }
140 140
 
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
      * @param string $value
144 144
      * @return void|string
145 145
      */
146
-    protected function buildOptionAuthor($key, $value)
146
+    protected function buildOptionAuthor( $key, $value )
147 147
     {
148
-        if (!$this->isHidden($key)) {
149
-            $name = glsr(Helper::class)->convertName(
148
+        if( !$this->isHidden( $key ) ) {
149
+            $name = glsr( Helper::class )->convertName(
150 150
                 $value,
151
-                glsr_get_option('reviews.name.format'),
152
-                glsr_get_option('reviews.name.initial')
151
+                glsr_get_option( 'reviews.name.format' ),
152
+                glsr_get_option( 'reviews.name.initial' )
153 153
             );
154 154
             return '<span>'.$name.'</span>';
155 155
         }
@@ -160,18 +160,18 @@  discard block
 block discarded – undo
160 160
      * @param string $value
161 161
      * @return void|string
162 162
      */
163
-    protected function buildOptionAvatar($key, $value)
163
+    protected function buildOptionAvatar( $key, $value )
164 164
     {
165
-        if ($this->isHidden($key, 'settings.reviews.avatars')) {
165
+        if( $this->isHidden( $key, 'settings.reviews.avatars' ) ) {
166 166
             return;
167 167
         }
168
-        $size = $this->getOption('settings.reviews.avatars_size', 40);
169
-        return glsr(Builder::class)->img([
168
+        $size = $this->getOption( 'settings.reviews.avatars_size', 40 );
169
+        return glsr( Builder::class )->img( [
170 170
             'height' => $size,
171
-            'src' => $this->generateAvatar($value),
172
-            'style' => sprintf('width:%1$spx; height:%1$spx;', $size),
171
+            'src' => $this->generateAvatar( $value ),
172
+            'style' => sprintf( 'width:%1$spx; height:%1$spx;', $size ),
173 173
             'width' => $size,
174
-        ]);
174
+        ] );
175 175
     }
176 176
 
177 177
     /**
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
      * @param string $value
180 180
      * @return void|string
181 181
      */
182
-    protected function buildOptionContent($key, $value)
182
+    protected function buildOptionContent( $key, $value )
183 183
     {
184
-        $text = $this->normalizeText($value);
185
-        if (!$this->isHiddenOrEmpty($key, $text)) {
184
+        $text = $this->normalizeText( $value );
185
+        if( !$this->isHiddenOrEmpty( $key, $text ) ) {
186 186
             return '<p>'.$text.'</p>';
187 187
         }
188 188
     }
@@ -192,19 +192,19 @@  discard block
 block discarded – undo
192 192
      * @param string $value
193 193
      * @return void|string
194 194
      */
195
-    protected function buildOptionDate($key, $value)
195
+    protected function buildOptionDate( $key, $value )
196 196
     {
197
-        if ($this->isHidden($key)) {
197
+        if( $this->isHidden( $key ) ) {
198 198
             return;
199 199
         }
200
-        $dateFormat = $this->getOption('settings.reviews.date.format', 'default');
201
-        if ('relative' == $dateFormat) {
202
-            $date = glsr(Date::class)->relative($value);
200
+        $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
201
+        if( 'relative' == $dateFormat ) {
202
+            $date = glsr( Date::class )->relative( $value );
203 203
         } else {
204 204
             $format = 'custom' == $dateFormat
205
-                ? $this->getOption('settings.reviews.date.custom', 'M j, Y')
206
-                : glsr(OptionManager::class)->getWP('date_format', 'F j, Y');
207
-            $date = date_i18n($format, strtotime($value));
205
+                ? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
206
+                : glsr( OptionManager::class )->getWP( 'date_format', 'F j, Y' );
207
+            $date = date_i18n( $format, strtotime( $value ) );
208 208
         }
209 209
         return '<span>'.$date.'</span>';
210 210
     }
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
      * @param string $value
215 215
      * @return void|string
216 216
      */
217
-    protected function buildOptionRating($key, $value)
217
+    protected function buildOptionRating( $key, $value )
218 218
     {
219
-        if (!$this->isHiddenOrEmpty($key, $value)) {
220
-            return glsr_star_rating($value);
219
+        if( !$this->isHiddenOrEmpty( $key, $value ) ) {
220
+            return glsr_star_rating( $value );
221 221
         }
222 222
     }
223 223
 
@@ -226,16 +226,16 @@  discard block
 block discarded – undo
226 226
      * @param string $value
227 227
      * @return void|string
228 228
      */
229
-    protected function buildOptionResponse($key, $value)
229
+    protected function buildOptionResponse( $key, $value )
230 230
     {
231
-        if ($this->isHiddenOrEmpty($key, $value)) {
231
+        if( $this->isHiddenOrEmpty( $key, $value ) ) {
232 232
             return;
233 233
         }
234
-        $title = sprintf(__('Response from %s', 'site-reviews'), get_bloginfo('name'));
235
-        $text = $this->normalizeText($value);
234
+        $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
235
+        $text = $this->normalizeText( $value );
236 236
         $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
237
-        $response = glsr(Builder::class)->div($text, ['class' => 'glsr-review-response-inner']);
238
-        $background = glsr(Builder::class)->div(['class' => 'glsr-review-response-background']);
237
+        $response = glsr( Builder::class )->div( $text, ['class' => 'glsr-review-response-inner'] );
238
+        $background = glsr( Builder::class )->div( ['class' => 'glsr-review-response-background'] );
239 239
         return $response.$background;
240 240
     }
241 241
 
@@ -244,13 +244,13 @@  discard block
 block discarded – undo
244 244
      * @param string $value
245 245
      * @return void|string
246 246
      */
247
-    protected function buildOptionTitle($key, $value)
247
+    protected function buildOptionTitle( $key, $value )
248 248
     {
249
-        if ($this->isHidden($key)) {
249
+        if( $this->isHidden( $key ) ) {
250 250
             return;
251 251
         }
252
-        if (empty($value)) {
253
-            $value = __('No Title', 'site-reviews');
252
+        if( empty($value) ) {
253
+            $value = __( 'No Title', 'site-reviews' );
254 254
         }
255 255
         return '<h3>'.$value.'</h3>';
256 256
     }
@@ -259,16 +259,16 @@  discard block
 block discarded – undo
259 259
      * @param string $avatarUrl
260 260
      * @return string
261 261
      */
262
-    protected function generateAvatar($avatarUrl)
262
+    protected function generateAvatar( $avatarUrl )
263 263
     {
264
-        if (!$this->isOptionEnabled('settings.reviews.avatars_regenerate') || 'local' != $this->current->review_type) {
264
+        if( !$this->isOptionEnabled( 'settings.reviews.avatars_regenerate' ) || 'local' != $this->current->review_type ) {
265 265
             return $avatarUrl;
266 266
         }
267
-        $authorIdOrEmail = get_the_author_meta('ID', $this->current->user_id);
268
-        if (empty($authorIdOrEmail)) {
267
+        $authorIdOrEmail = get_the_author_meta( 'ID', $this->current->user_id );
268
+        if( empty($authorIdOrEmail) ) {
269 269
             $authorIdOrEmail = $this->current->email;
270 270
         }
271
-        if ($newAvatar = get_avatar_url($authorIdOrEmail)) {
271
+        if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) {
272 272
             return $newAvatar;
273 273
         }
274 274
         return $avatarUrl;
@@ -278,20 +278,20 @@  discard block
 block discarded – undo
278 278
      * @param string $text
279 279
      * @return string
280 280
      */
281
-    protected function getExcerpt($text)
281
+    protected function getExcerpt( $text )
282 282
     {
283
-        $limit = intval($this->getOption('settings.reviews.excerpts_length', 55));
284
-        $split = extension_loaded('intl')
285
-            ? $this->getExcerptIntlSplit($text, $limit)
286
-            : $this->getExcerptSplit($text, $limit);
287
-        $hiddenText = substr($text, $split);
288
-        if (!empty($hiddenText)) {
289
-            $showMore = glsr(Builder::class)->span($hiddenText, [
283
+        $limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) );
284
+        $split = extension_loaded( 'intl' )
285
+            ? $this->getExcerptIntlSplit( $text, $limit )
286
+            : $this->getExcerptSplit( $text, $limit );
287
+        $hiddenText = substr( $text, $split );
288
+        if( !empty($hiddenText) ) {
289
+            $showMore = glsr( Builder::class )->span( $hiddenText, [
290 290
                 'class' => 'glsr-hidden glsr-hidden-text',
291
-                'data-show-less' => __('Show less', 'site-reviews'),
292
-                'data-show-more' => __('Show more', 'site-reviews'),
293
-            ]);
294
-            $text = ltrim(substr($text, 0, $split)).$showMore;
291
+                'data-show-less' => __( 'Show less', 'site-reviews' ),
292
+                'data-show-more' => __( 'Show more', 'site-reviews' ),
293
+            ] );
294
+            $text = ltrim( substr( $text, 0, $split ) ).$showMore;
295 295
         }
296 296
         return $text;
297 297
     }
@@ -301,22 +301,22 @@  discard block
 block discarded – undo
301 301
      * @param int $limit
302 302
      * @return int
303 303
      */
304
-    protected function getExcerptIntlSplit($text, $limit)
304
+    protected function getExcerptIntlSplit( $text, $limit )
305 305
     {
306
-        $words = IntlRuleBasedBreakIterator::createWordInstance('');
307
-        $words->setText($text);
306
+        $words = IntlRuleBasedBreakIterator::createWordInstance( '' );
307
+        $words->setText( $text );
308 308
         $count = 0;
309
-        foreach ($words as $offset) {
310
-            if (IntlRuleBasedBreakIterator::WORD_NONE === $words->getRuleStatus()) {
309
+        foreach( $words as $offset ) {
310
+            if( IntlRuleBasedBreakIterator::WORD_NONE === $words->getRuleStatus() ) {
311 311
                 continue;
312 312
             }
313 313
             ++$count;
314
-            if ($count != $limit) {
314
+            if( $count != $limit ) {
315 315
                 continue;
316 316
             }
317 317
             return $offset;
318 318
         }
319
-        return strlen($text);
319
+        return strlen( $text );
320 320
     }
321 321
 
322 322
     /**
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
      * @param int $limit
325 325
      * @return int
326 326
      */
327
-    protected function getExcerptSplit($text, $limit)
327
+    protected function getExcerptSplit( $text, $limit )
328 328
     {
329
-        if (str_word_count($text, 0) > $limit) {
330
-            $words = array_keys(str_word_count($text, 2));
329
+        if( str_word_count( $text, 0 ) > $limit ) {
330
+            $words = array_keys( str_word_count( $text, 2 ) );
331 331
             return $words[$limit];
332 332
         }
333
-        return strlen($text);
333
+        return strlen( $text );
334 334
     }
335 335
 
336 336
     /**
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
      * @param mixed $fallback
339 339
      * @return mixed
340 340
      */
341
-    protected function getOption($path, $fallback = '')
341
+    protected function getOption( $path, $fallback = '' )
342 342
     {
343
-        if (array_key_exists($path, $this->options)) {
343
+        if( array_key_exists( $path, $this->options ) ) {
344 344
             return $this->options[$path];
345 345
         }
346 346
         return $fallback;
@@ -351,50 +351,50 @@  discard block
 block discarded – undo
351 351
      * @param string $value
352 352
      * @return bool
353 353
      */
354
-    protected function isHiddenOrEmpty($key, $value)
354
+    protected function isHiddenOrEmpty( $key, $value )
355 355
     {
356
-        return $this->isHidden($key) || empty($value);
356
+        return $this->isHidden( $key ) || empty($value);
357 357
     }
358 358
 
359 359
     /**
360 360
      * @param string $path
361 361
      * @return bool
362 362
      */
363
-    protected function isOptionEnabled($path)
363
+    protected function isOptionEnabled( $path )
364 364
     {
365
-        return 'yes' == $this->getOption($path);
365
+        return 'yes' == $this->getOption( $path );
366 366
     }
367 367
 
368 368
     /**
369 369
      * @param string $text
370 370
      * @return string
371 371
      */
372
-    protected function normalizeText($text)
372
+    protected function normalizeText( $text )
373 373
     {
374
-        $text = wp_kses($text, wp_kses_allowed_html());
375
-        $text = convert_smilies(strip_shortcodes($text));
376
-        $text = str_replace(']]>', ']]&gt;', $text);
377
-        $text = preg_replace('/(\R){2,}/', '$1', $text);
378
-        if ($this->isOptionEnabled('settings.reviews.excerpts')) {
379
-            $text = $this->getExcerpt($text);
374
+        $text = wp_kses( $text, wp_kses_allowed_html() );
375
+        $text = convert_smilies( strip_shortcodes( $text ) );
376
+        $text = str_replace( ']]>', ']]&gt;', $text );
377
+        $text = preg_replace( '/(\R){2,}/', '$1', $text );
378
+        if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) {
379
+            $text = $this->getExcerpt( $text );
380 380
         }
381
-        return wptexturize(nl2br($text));
381
+        return wptexturize( nl2br( $text ) );
382 382
     }
383 383
 
384 384
     /**
385 385
      * @return void
386 386
      */
387
-    protected function wrap(array &$renderedFields, Review $review)
387
+    protected function wrap( array &$renderedFields, Review $review )
388 388
     {
389
-        $renderedFields = apply_filters('site-reviews/review/wrap', $renderedFields, $review, $this);
390
-        array_walk($renderedFields, function (&$value, $key) use ($review) {
391
-            $value = apply_filters('site-reviews/review/wrap/'.$key, $value, $review);
392
-            if (empty($value)) {
389
+        $renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review, $this );
390
+        array_walk( $renderedFields, function( &$value, $key ) use ($review) {
391
+            $value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review );
392
+            if( empty($value) ) {
393 393
                 return;
394 394
             }
395
-            $value = glsr(Builder::class)->div($value, [
395
+            $value = glsr( Builder::class )->div( $value, [
396 396
                 'class' => 'glsr-review-'.$key,
397
-            ]);
397
+            ] );
398 398
         });
399 399
     }
400 400
 }
Please login to merge, or discard this patch.