@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->versions = wp_parse_args( $versions, array( |
31 | 31 | 'php' => static::MIN_PHP_VERSION, |
32 | 32 | 'wordpress' => static::MIN_WORDPRESS_VERSION, |
33 | - )); |
|
33 | + ) ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | if( $this->isValid() ) { |
42 | 42 | return true; |
43 | 43 | } |
44 | - add_action( 'activated_plugin', array( $this, 'deactivate' )); |
|
45 | - add_action( 'admin_notices', array( $this, 'deactivate' )); |
|
44 | + add_action( 'activated_plugin', array( $this, 'deactivate' ) ); |
|
45 | + add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | filter_input( INPUT_GET, 'plugin_status' ), |
138 | 138 | filter_input( INPUT_GET, 'paged' ), |
139 | 139 | filter_input( INPUT_GET, 's' ) |
140 | - ))); |
|
140 | + ) ) ); |
|
141 | 141 | exit; |
142 | 142 | } |
143 | 143 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | if( strpos( $message, '%s' ) === false ) { |
29 | 29 | return $message; |
30 | 30 | } |
31 | - return preg_replace_callback( '/(%s)/', function() use( &$parameters ) { |
|
31 | + return preg_replace_callback( '/(%s)/', function() use(&$parameters) { |
|
32 | 32 | foreach( $parameters as $key => $value ) { |
33 | 33 | return array_shift( $parameters ); |
34 | 34 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | public function validateRequired( $value ) |
114 | 114 | { |
115 | 115 | return is_null( $value ) |
116 | - || ( is_string( $value ) && trim( $value ) === '' ) |
|
117 | - || ( is_array( $value ) && count( $value ) < 1 ) |
|
116 | + || (is_string( $value ) && trim( $value ) === '') |
|
117 | + || (is_array( $value ) && count( $value ) < 1) |
|
118 | 118 | ? false |
119 | 119 | : true; |
120 | 120 | } |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function isBlacklisted( array $review ) |
13 | 13 | { |
14 | - $target = implode( "\n", array_filter([ |
|
14 | + $target = implode( "\n", array_filter( [ |
|
15 | 15 | $review['name'], |
16 | 16 | $review['content'], |
17 | 17 | $review['email'], |
18 | 18 | $review['ip_address'], |
19 | 19 | $review['title'], |
20 | - ])); |
|
20 | + ] ) ); |
|
21 | 21 | return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted', |
22 | 22 | $this->check( $target ), |
23 | 23 | $review |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | */ |
31 | 31 | protected function check( $target ) |
32 | 32 | { |
33 | - $blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' )); |
|
34 | - if( empty( $blacklist )) { |
|
33 | + $blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ) ); |
|
34 | + if( empty($blacklist) ) { |
|
35 | 35 | return false; |
36 | 36 | } |
37 | 37 | $lines = explode( "\n", $blacklist ); |
38 | 38 | foreach( (array)$lines as $line ) { |
39 | 39 | $line = trim( $line ); |
40 | - if( empty( $line ) || 256 < strlen( $line ))continue; |
|
41 | - $pattern = sprintf( '#%s#i', preg_quote( $line, '#' )); |
|
42 | - if( preg_match( $pattern, $target )) { |
|
40 | + if( empty($line) || 256 < strlen( $line ) )continue; |
|
41 | + $pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) ); |
|
42 | + if( preg_match( $pattern, $target ) ) { |
|
43 | 43 | return true; |
44 | 44 | } |
45 | 45 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'loader' => '<div class="glsr-loader"></div>', |
28 | 28 | 'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ), |
29 | 29 | ], |
30 | - ]); |
|
30 | + ] ); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | */ |
36 | 36 | protected function buildLinks() |
37 | 37 | { |
38 | - $args = glsr( Style::class )->paginationArgs([ |
|
38 | + $args = glsr( Style::class )->paginationArgs( [ |
|
39 | 39 | 'current' => $this->args['paged'], |
40 | 40 | 'total' => $this->args['total'], |
41 | - ]); |
|
41 | + ] ); |
|
42 | 42 | if( is_front_page() ) { |
43 | - unset( $args['format'] ); |
|
43 | + unset($args['format']); |
|
44 | 44 | } |
45 | 45 | if( $args['type'] == 'array' ) { |
46 | 46 | $args['type'] = 'plain'; |
@@ -56,6 +56,6 @@ discard block |
||
56 | 56 | return wp_parse_args( $args, [ |
57 | 57 | 'paged' => glsr( QueryBuilder::class )->getPaged(), |
58 | 58 | 'total' => 1, |
59 | - ]); |
|
59 | + ] ); |
|
60 | 60 | } |
61 | 61 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $fields = []; |
30 | 30 | foreach( glsr()->config( 'forms/'.$id ) as $name => $field ) { |
31 | - $fields[] = new Field( wp_parse_args( $field, ['name' => $name] )); |
|
31 | + $fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) ); |
|
32 | 32 | } |
33 | 33 | return $fields; |
34 | 34 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | <p>{{ data.s1 }}</p> |
8 | 8 | </div> |
9 | 9 | <p class="row-actions"> |
10 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
10 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
11 | 11 | </p> |
12 | 12 | </td> |
13 | 13 | <td class="glsr-string-td2"> |
@@ -8,7 +8,7 @@ |
||
8 | 8 | <p>{{ data.p1 }}</p> |
9 | 9 | </div> |
10 | 10 | <p class="row-actions"> |
11 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
11 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
12 | 12 | </p> |
13 | 13 | </td> |
14 | 14 | <td class="glsr-string-td2"> |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | protected function filterAttributes( array $allowedAttributeKeys ) |
124 | 124 | { |
125 | - return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys )); |
|
125 | + return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ) ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES ); |
134 | 134 | $wildcards = []; |
135 | 135 | foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) { |
136 | - $newWildcards = array_filter( $this->attributes, function( $key ) use( $wildcard ) { |
|
136 | + $newWildcards = array_filter( $this->attributes, function( $key ) use($wildcard) { |
|
137 | 137 | return glsr( Helper::class )->startsWith( $wildcard, $key ); |
138 | 138 | }, ARRAY_FILTER_USE_KEY ); |
139 | 139 | $wildcards = array_merge( $wildcards, $newWildcards ); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | protected function getPermanentAttributes() |
148 | 148 | { |
149 | 149 | $permanentAttributes = []; |
150 | - if( array_key_exists( 'value', $this->attributes )) { |
|
150 | + if( array_key_exists( 'value', $this->attributes ) ) { |
|
151 | 151 | $permanentAttributes['value'] = $this->attributes['value']; |
152 | 152 | } |
153 | 153 | return $permanentAttributes; |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | protected function normalizeBooleanAttributes() |
200 | 200 | { |
201 | 201 | foreach( $this->attributes as $key => $value ) { |
202 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
202 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
203 | 203 | $key = $value; |
204 | 204 | $value = true; |
205 | 205 | } |
206 | - if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue; |
|
206 | + if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ) )continue; |
|
207 | 207 | $this->attributes[$key] = wp_validate_boolean( $value ); |
208 | 208 | } |
209 | 209 | } |
@@ -214,13 +214,13 @@ discard block |
||
214 | 214 | protected function normalizeDataAttributes() |
215 | 215 | { |
216 | 216 | foreach( $this->attributes as $key => $value ) { |
217 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
217 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
218 | 218 | $key = $value; |
219 | 219 | $value = ''; |
220 | 220 | } |
221 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; |
|
222 | - if( is_array( $value )) { |
|
223 | - $value = json_encode( $value, JSON_HEX_APOS|JSON_NUMERIC_CHECK|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ); |
|
221 | + if( !glsr( Helper::class )->startsWith( 'data-', $key ) )continue; |
|
222 | + if( is_array( $value ) ) { |
|
223 | + $value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); |
|
224 | 224 | } |
225 | 225 | $this->attributes[$key] = $value; |
226 | 226 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | protected function normalizeStringAttributes() |
233 | 233 | { |
234 | 234 | foreach( $this->attributes as $key => $value ) { |
235 | - if( !is_string( $value ))continue; |
|
235 | + if( !is_string( $value ) )continue; |
|
236 | 236 | $this->attributes[$key] = trim( $value ); |
237 | 237 | } |
238 | 238 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | if( $method != 'input' )return; |
247 | 247 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); |
248 | - if( !in_array( $attributes['type'], static::INPUT_TYPES )) { |
|
248 | + if( !in_array( $attributes['type'], static::INPUT_TYPES ) ) { |
|
249 | 249 | $this->attributes['type'] = 'text'; |
250 | 250 | } |
251 | 251 | } |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | $permanentAttributes = $this->getPermanentAttributes(); |
260 | 260 | foreach( $this->attributes as $key => $value ) { |
261 | 261 | if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) { |
262 | - unset( $attributes[$key] ); |
|
262 | + unset($attributes[$key]); |
|
263 | 263 | } |
264 | - if( glsr( Helper::class )->startsWith( 'data-', $key )) { |
|
264 | + if( glsr( Helper::class )->startsWith( 'data-', $key ) ) { |
|
265 | 265 | $permanentAttributes[$key] = $value; |
266 | - unset( $attributes[$key] ); |
|
266 | + unset($attributes[$key]); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | $this->attributes = array_merge( array_filter( $attributes ), $permanentAttributes ); |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | { |
75 | 75 | $this->newSettings = $this->getNewSettings(); |
76 | 76 | $this->oldSettings = $this->getOldSettings(); |
77 | - if( empty( $this->oldSettings ))return; |
|
77 | + if( empty($this->oldSettings) )return; |
|
78 | 78 | foreach( static::MAPPED_SETTINGS as $old => $new ) { |
79 | - if( empty( $this->oldSettings[$old] ))continue; |
|
79 | + if( empty($this->oldSettings[$old]) )continue; |
|
80 | 80 | $this->newSettings[$new] = $this->oldSettings[$old]; |
81 | 81 | } |
82 | 82 | $this->migrateNotificationSettings(); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->migrateRequiredSettings(); |
85 | 85 | $oldSettings = glsr( Helper::class )->convertDotNotationArray( $this->oldSettings ); |
86 | 86 | $newSettings = glsr( Helper::class )->convertDotNotationArray( $this->newSettings ); |
87 | - if( isset( $oldSettings['settings']['strings'] ) && is_array( $oldSettings['settings']['strings'] )) { |
|
87 | + if( isset($oldSettings['settings']['strings']) && is_array( $oldSettings['settings']['strings'] ) ) { |
|
88 | 88 | $newSettings['settings']['strings'] = $oldSettings['settings']['strings']; |
89 | 89 | } |
90 | 90 | glsr( OptionManager::class )->set( $newSettings ); |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | protected function getOldSettings() |
118 | 118 | { |
119 | 119 | $defaults = array_fill_keys( array_keys( static::MAPPED_SETTINGS ), '' ); |
120 | - $settings = glsr( Helper::class )->flattenArray( get_option( 'geminilabs_site_reviews-v2', [] )); |
|
121 | - if( !empty( $settings )) { |
|
120 | + $settings = glsr( Helper::class )->flattenArray( get_option( 'geminilabs_site_reviews-v2', [] ) ); |
|
121 | + if( !empty($settings) ) { |
|
122 | 122 | $settings = wp_parse_args( $settings, $defaults ); |
123 | 123 | } |
124 | 124 | return $settings; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | 'SecretKey' => $this->oldSettings['settings.reviews-form.recaptcha.secret'], |
152 | 152 | 'SiteKey' => $this->oldSettings['settings.reviews-form.recaptcha.key'], |
153 | 153 | ]; |
154 | - if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] )) { |
|
154 | + if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] ) ) { |
|
155 | 155 | $this->newSettings['settings.submissions.recaptcha.integration'] = 'all'; |
156 | 156 | } |
157 | 157 | if( $this->oldSettings['settings.reviews-form.recaptcha.integration'] == 'invisible-recaptcha' ) { |