@@ -13,7 +13,9 @@ |
||
13 | 13 | */ |
14 | 14 | public function __call( $name, array $args = [] ) |
15 | 15 | { |
16 | - if( !method_exists( $this, $name ))return; |
|
16 | + if( !method_exists( $this, $name )) { |
|
17 | + return; |
|
18 | + } |
|
17 | 19 | $defaults = call_user_func_array( [$this, $name], $args ); |
18 | 20 | $hookName = (new ReflectionClass( $this ))->getShortName(); |
19 | 21 | $hookName = str_replace( 'Defaults', '', $hookName ); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function __call( $name, array $args = [] ) |
15 | 15 | { |
16 | - if( !method_exists( $this, $name ))return; |
|
16 | + if( !method_exists( $this, $name ) )return; |
|
17 | 17 | $defaults = call_user_func_array( [$this, $name], $args ); |
18 | 18 | $hookName = (new ReflectionClass( $this ))->getShortName(); |
19 | 19 | $hookName = str_replace( 'Defaults', '', $hookName ); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | protected function filter( array $values = [] ) |
33 | 33 | { |
34 | - return $this->merge( array_filter( $values )); |
|
34 | + return $this->merge( array_filter( $values ) ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -17,9 +17,13 @@ discard block |
||
17 | 17 | { |
18 | 18 | $queries = []; |
19 | 19 | foreach( $keys as $key ) { |
20 | - if( !array_key_exists( $key, $values ))continue; |
|
20 | + if( !array_key_exists( $key, $values )) { |
|
21 | + continue; |
|
22 | + } |
|
21 | 23 | $methodName = glsr( Helper::class )->buildMethodName( $key, __FUNCTION__ ); |
22 | - if( !method_exists( $this, $methodName ))continue; |
|
24 | + if( !method_exists( $this, $methodName )) { |
|
25 | + continue; |
|
26 | + } |
|
23 | 27 | $query = call_user_func( [$this, $methodName], $values[$key] ); |
24 | 28 | if( is_array( $query )) { |
25 | 29 | $queries[] = $query; |
@@ -36,7 +40,9 @@ discard block |
||
36 | 40 | $string = ''; |
37 | 41 | $values = array_filter( $values ); |
38 | 42 | foreach( $conditions as $key => $value ) { |
39 | - if( !isset( $values[$key] ))continue; |
|
43 | + if( !isset( $values[$key] )) { |
|
44 | + continue; |
|
45 | + } |
|
40 | 46 | $values[$key] = implode( ',', (array)$values[$key] ); |
41 | 47 | $string .= strpos( $value, '%s' ) !== false |
42 | 48 | ? sprintf( $value, strval( $values[$key] )) |
@@ -110,7 +116,9 @@ discard block |
||
110 | 116 | */ |
111 | 117 | protected function buildQueryAssignedTo( $value ) |
112 | 118 | { |
113 | - if( empty( $value ))return; |
|
119 | + if( empty( $value )) { |
|
120 | + return; |
|
121 | + } |
|
114 | 122 | $postIds = glsr( Helper::class )->convertStringToArray( $value, 'is_numeric' ); |
115 | 123 | return [ |
116 | 124 | 'compare' => 'IN', |
@@ -125,7 +133,9 @@ discard block |
||
125 | 133 | */ |
126 | 134 | protected function buildQueryCategory( $value ) |
127 | 135 | { |
128 | - if( empty( $value ))return; |
|
136 | + if( empty( $value )) { |
|
137 | + return; |
|
138 | + } |
|
129 | 139 | return [ |
130 | 140 | 'field' => 'term_id', |
131 | 141 | 'taxonomy' => Application::TAXONOMY, |
@@ -139,7 +149,9 @@ discard block |
||
139 | 149 | */ |
140 | 150 | protected function buildQueryRating( $value ) |
141 | 151 | { |
142 | - if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return; |
|
152 | + if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) { |
|
153 | + return; |
|
154 | + } |
|
143 | 155 | return [ |
144 | 156 | 'compare' => '>=', |
145 | 157 | 'key' => 'rating', |
@@ -153,7 +165,9 @@ discard block |
||
153 | 165 | */ |
154 | 166 | protected function buildQueryType( $value ) |
155 | 167 | { |
156 | - if( in_array( $value, ['','all'] ))return; |
|
168 | + if( in_array( $value, ['','all'] )) { |
|
169 | + return; |
|
170 | + } |
|
157 | 171 | return [ |
158 | 172 | 'key' => 'review_type', |
159 | 173 | 'value' => $value, |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | { |
18 | 18 | $queries = []; |
19 | 19 | foreach( $keys as $key ) { |
20 | - if( !array_key_exists( $key, $values ))continue; |
|
20 | + if( !array_key_exists( $key, $values ) )continue; |
|
21 | 21 | $methodName = glsr( Helper::class )->buildMethodName( $key, __FUNCTION__ ); |
22 | - if( !method_exists( $this, $methodName ))continue; |
|
22 | + if( !method_exists( $this, $methodName ) )continue; |
|
23 | 23 | $query = call_user_func( [$this, $methodName], $values[$key] ); |
24 | - if( is_array( $query )) { |
|
24 | + if( is_array( $query ) ) { |
|
25 | 25 | $queries[] = $query; |
26 | 26 | } |
27 | 27 | } |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | $string = ''; |
37 | 37 | $values = array_filter( $values ); |
38 | 38 | foreach( $conditions as $key => $value ) { |
39 | - if( !isset( $values[$key] ))continue; |
|
39 | + if( !isset($values[$key]) )continue; |
|
40 | 40 | $values[$key] = implode( ',', (array)$values[$key] ); |
41 | 41 | $string .= strpos( $value, '%s' ) !== false |
42 | - ? sprintf( $value, strval( $values[$key] )) |
|
42 | + ? sprintf( $value, strval( $values[$key] ) ) |
|
43 | 43 | : $value; |
44 | 44 | } |
45 | 45 | return $string; |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function buildSqlOr( $values, $sprintfFormat ) |
55 | 55 | { |
56 | - if( !is_array( $values )) { |
|
56 | + if( !is_array( $values ) ) { |
|
57 | 57 | $values = explode( ',', $values ); |
58 | 58 | } |
59 | - $values = array_filter( array_map( 'trim', (array)$values )); |
|
60 | - $values = array_map( function( $value ) use( $sprintfFormat ) { |
|
59 | + $values = array_filter( array_map( 'trim', (array)$values ) ); |
|
60 | + $values = array_map( function( $value ) use($sprintfFormat) { |
|
61 | 61 | return sprintf( $sprintfFormat, $value ); |
62 | 62 | }, $values ); |
63 | 63 | return implode( ' OR ', $values ); |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function filterSearchByTitle( $search, WP_Query $query ) |
74 | 74 | { |
75 | - if( empty( $search ) || empty( $query->get( 'search_terms' ))) { |
|
75 | + if( empty($search) || empty($query->get( 'search_terms' )) ) { |
|
76 | 76 | return $search; |
77 | 77 | } |
78 | 78 | global $wpdb; |
79 | - $n = empty( $query->get( 'exact' )) |
|
79 | + $n = empty($query->get( 'exact' )) |
|
80 | 80 | ? '%' |
81 | 81 | : ''; |
82 | 82 | $search = []; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ? glsr()->constant( 'PAGED_QUERY_VAR' ) |
101 | 101 | : 'page'; |
102 | 102 | return $isEnabled |
103 | - ? max( 1, intval( get_query_var( $pagedQuery ))) |
|
103 | + ? max( 1, intval( get_query_var( $pagedQuery ) ) ) |
|
104 | 104 | : 1; |
105 | 105 | } |
106 | 106 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | protected function buildQueryAssignedTo( $value ) |
112 | 112 | { |
113 | - if( empty( $value ))return; |
|
113 | + if( empty($value) )return; |
|
114 | 114 | $postIds = glsr( Helper::class )->convertStringToArray( $value, 'is_numeric' ); |
115 | 115 | return [ |
116 | 116 | 'compare' => 'IN', |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | protected function buildQueryCategory( $value ) |
127 | 127 | { |
128 | - if( empty( $value ))return; |
|
128 | + if( empty($value) )return; |
|
129 | 129 | return [ |
130 | 130 | 'field' => 'term_id', |
131 | 131 | 'taxonomy' => Application::TAXONOMY, |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function buildQueryRating( $value ) |
141 | 141 | { |
142 | - if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return; |
|
142 | + if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ) ) )return; |
|
143 | 143 | return [ |
144 | 144 | 'compare' => '>=', |
145 | 145 | 'key' => 'rating', |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | protected function buildQueryType( $value ) |
155 | 155 | { |
156 | - if( in_array( $value, ['','all'] ))return; |
|
156 | + if( in_array( $value, ['', 'all'] ) )return; |
|
157 | 157 | return [ |
158 | 158 | 'key' => 'review_type', |
159 | 159 | 'value' => $value, |
@@ -20,7 +20,9 @@ |
||
20 | 20 | public function build( array $args = [] ) |
21 | 21 | { |
22 | 22 | $this->args = $this->normalize( $args ); |
23 | - if( $this->args['total'] < 2 )return; |
|
23 | + if( $this->args['total'] < 2 ) { |
|
24 | + return; |
|
25 | + } |
|
24 | 26 | return glsr( Template::class )->build( 'templates/pagination', [ |
25 | 27 | 'context' => [ |
26 | 28 | 'links' => apply_filters( 'site-reviews/paginate_links', $this->buildLinks(), $this->args ), |
@@ -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 | } |
@@ -22,7 +22,9 @@ |
||
22 | 22 | } |
23 | 23 | glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | - if( $command->ajax_request )return; |
|
25 | + if( $command->ajax_request ) { |
|
26 | + return; |
|
27 | + } |
|
26 | 28 | wp_safe_redirect( $this->getReferer( $command )); |
27 | 29 | exit; |
28 | 30 | } |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | $review = glsr( ReviewManager::class )->create( $command ); |
18 | 18 | if( !$review ) { |
19 | 19 | glsr( Session::class )->set( $command->form_id.'errors', [] ); |
20 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' )); |
|
20 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) ); |
|
21 | 21 | return; |
22 | 22 | } |
23 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
|
23 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) ); |
|
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | 25 | if( $command->ajax_request )return; |
26 | - wp_safe_redirect( $this->getReferer( $command )); |
|
26 | + wp_safe_redirect( $this->getReferer( $command ) ); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected function getReferer( Command $command ) |
34 | 34 | { |
35 | - $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ))); |
|
35 | + $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
36 | 36 | $referer = apply_filters( 'site-reviews/review/redirect', $referer, $command ); |
37 | - if( empty( $referer )) { |
|
37 | + if( empty($referer) ) { |
|
38 | 38 | $referer = $command->referer; |
39 | 39 | } |
40 | - if( empty( $referer )) { |
|
40 | + if( empty($referer) ) { |
|
41 | 41 | glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->debug( $command ); |
42 | 42 | $referer = home_url(); |
43 | 43 | } |
@@ -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"> |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | $filenames = []; |
21 | 21 | $iterator = new DirectoryIterator( dirname( __FILE__ ).'/Upgrader' ); |
22 | 22 | foreach( $iterator as $fileinfo ) { |
23 | - if( !$fileinfo->isFile() )continue; |
|
23 | + if( !$fileinfo->isFile() ) { |
|
24 | + continue; |
|
25 | + } |
|
24 | 26 | $filenames[] = $fileinfo->getFilename(); |
25 | 27 | } |
26 | 28 | natsort( $filenames ); |
@@ -28,7 +30,9 @@ discard block |
||
28 | 30 | $className = str_replace( '.php', '', $file ); |
29 | 31 | $version = str_replace( ['Upgrade_', '_'], ['', '.'], $className ); |
30 | 32 | $versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions |
31 | - if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return; |
|
33 | + if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' )) { |
|
34 | + return; |
|
35 | + } |
|
32 | 36 | glsr( 'Modules\\Upgrader\\'.$className ); |
33 | 37 | glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix ); |
34 | 38 | }); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $className = str_replace( '.php', '', $file ); |
25 | 25 | $version = str_replace( ['Upgrade_', '_'], ['', '.'], $className ); |
26 | 26 | $versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions |
27 | - if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return; |
|
27 | + if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ) )return; |
|
28 | 28 | glsr( 'Modules\\Upgrader\\'.$className ); |
29 | 29 | glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix ); |
30 | 30 | }); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $this->setReviewCounts(); |
42 | 42 | $this->updateVersionFrom( $version ); |
43 | 43 | } |
44 | - else if( !glsr( OptionManager::class )->get( 'last_review_count', false )) { |
|
44 | + else if( !glsr( OptionManager::class )->get( 'last_review_count', false ) ) { |
|
45 | 45 | $this->setReviewCounts(); |
46 | 46 | } |
47 | 47 | } |
@@ -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 ); |
@@ -203,7 +203,9 @@ discard block |
||
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 )) { |
|
207 | + continue; |
|
208 | + } |
|
207 | 209 | $this->attributes[$key] = wp_validate_boolean( $value ); |
208 | 210 | } |
209 | 211 | } |
@@ -218,7 +220,9 @@ discard block |
||
218 | 220 | $key = $value; |
219 | 221 | $value = ''; |
220 | 222 | } |
221 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; |
|
223 | + if( !glsr( Helper::class )->startsWith( 'data-', $key )) { |
|
224 | + continue; |
|
225 | + } |
|
222 | 226 | if( is_array( $value )) { |
223 | 227 | $value = json_encode( $value, JSON_HEX_APOS|JSON_NUMERIC_CHECK|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ); |
224 | 228 | } |
@@ -232,7 +236,9 @@ discard block |
||
232 | 236 | protected function normalizeStringAttributes() |
233 | 237 | { |
234 | 238 | foreach( $this->attributes as $key => $value ) { |
235 | - if( !is_string( $value ))continue; |
|
239 | + if( !is_string( $value )) { |
|
240 | + continue; |
|
241 | + } |
|
236 | 242 | $this->attributes[$key] = trim( $value ); |
237 | 243 | } |
238 | 244 | } |
@@ -243,7 +249,9 @@ discard block |
||
243 | 249 | */ |
244 | 250 | protected function normalizeInputType( $method ) |
245 | 251 | { |
246 | - if( $method != 'input' )return; |
|
252 | + if( $method != 'input' ) { |
|
253 | + return; |
|
254 | + } |
|
247 | 255 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); |
248 | 256 | if( !in_array( $attributes['type'], static::INPUT_TYPES )) { |
249 | 257 | $this->attributes['type'] = 'text'; |