@@ -17,7 +17,7 @@ |
||
| 17 | 17 | 'no' => __( 'No', 'site-reviews' ), |
| 18 | 18 | 'yes' => __( 'Yes', 'site-reviews' ), |
| 19 | 19 | ], |
| 20 | - ]); |
|
| 20 | + ] ); |
|
| 21 | 21 | $this->builder->tag = 'input'; |
| 22 | 22 | return $this->builder->buildFormInput(); |
| 23 | 23 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $instance = new static(); |
| 67 | 67 | $instance->setTagFromMethod( $method ); |
| 68 | - call_user_func_array( [$instance, 'normalize'], $args += ['',''] ); |
|
| 68 | + call_user_func_array( [$instance, 'normalize'], $args += ['', ''] ); |
|
| 69 | 69 | $tags = array_merge( static::TAGS_FORM, static::TAGS_STRUCTURE, static::TAGS_TEXT ); |
| 70 | 70 | $generatedTag = in_array( $instance->tag, $tags ) |
| 71 | 71 | ? $instance->buildTag() |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | 'render' => 'is_bool', |
| 90 | 90 | 'tag' => 'is_string', |
| 91 | 91 | ]; |
| 92 | - if( !isset( $properties[$property] ) |
|
| 93 | - || empty( array_filter( [$value], $properties[$property] )) |
|
| 92 | + if( !isset($properties[$property]) |
|
| 93 | + || empty(array_filter( [$value], $properties[$property] )) |
|
| 94 | 94 | )return; |
| 95 | 95 | $this->$property = $value; |
| 96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function getOpeningTag() |
| 110 | 110 | { |
| 111 | - $attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString(); |
|
| 111 | + $attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString(); |
|
| 112 | 112 | return '<'.trim( $this->tag.' '.$attributes ).'>'; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | protected function buildCustomField() |
| 119 | 119 | { |
| 120 | 120 | $className = glsr( Helper::class )->buildClassName( $this->tag, __NAMESPACE__.'\Fields' ); |
| 121 | - if( !class_exists( $className )) { |
|
| 121 | + if( !class_exists( $className ) ) { |
|
| 122 | 122 | glsr_log()->error( 'Field missing: '.$className ); |
| 123 | 123 | return; |
| 124 | 124 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | protected function buildDefaultTag( $text = '' ) |
| 132 | 132 | { |
| 133 | - if( empty( $text )) { |
|
| 133 | + if( empty($text) ) { |
|
| 134 | 134 | $text = $this->args['text']; |
| 135 | 135 | } |
| 136 | 136 | return $this->getOpeningTag().$text.$this->getClosingTag(); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | protected function buildFieldDescription() |
| 143 | 143 | { |
| 144 | - if( !empty( $this->args['description'] )) { |
|
| 144 | + if( !empty($this->args['description']) ) { |
|
| 145 | 145 | return $this->small( $this->args['description'] ); |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | protected function buildFormInput() |
| 153 | 153 | { |
| 154 | - if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) { |
|
| 154 | + if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) { |
|
| 155 | 155 | return $this->buildFormLabel().$this->getOpeningTag(); |
| 156 | 156 | } |
| 157 | - return empty( $this->args['options'] ) |
|
| 157 | + return empty($this->args['options']) |
|
| 158 | 158 | ? $this->buildFormInputChoice() |
| 159 | 159 | : $this->buildFormInputMultiChoice(); |
| 160 | 160 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | 'name' => $this->args['name'].'[]', |
| 179 | 179 | 'text' => $this->args['options'][$key], |
| 180 | 180 | 'value' => $key, |
| 181 | - ])); |
|
| 181 | + ]) ); |
|
| 182 | 182 | }); |
| 183 | 183 | return $this->ul( $options ); |
| 184 | 184 | } |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | protected function buildFormLabel() |
| 190 | 190 | { |
| 191 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
| 192 | - return $this->label([ |
|
| 191 | + if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return; |
|
| 192 | + return $this->label( [ |
|
| 193 | 193 | 'for' => $this->args['id'], |
| 194 | 194 | 'text' => $this->args['label'], |
| 195 | - ]); |
|
| 195 | + ] ); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | protected function buildFormSelectOptions() |
| 210 | 210 | { |
| 211 | 211 | return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
| 212 | - return $carry.$this->option([ |
|
| 212 | + return $carry.$this->option( [ |
|
| 213 | 213 | 'selected' => $this->args['value'] == $key, |
| 214 | 214 | 'text' => $this->args['options'][$key], |
| 215 | 215 | 'value' => $key, |
| 216 | - ]); |
|
| 216 | + ] ); |
|
| 217 | 217 | }); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | protected function buildTag() |
| 232 | 232 | { |
| 233 | - if( !in_array( $this->tag, static::TAGS_FORM )) { |
|
| 233 | + if( !in_array( $this->tag, static::TAGS_FORM ) ) { |
|
| 234 | 234 | return $this->buildDefaultTag(); |
| 235 | 235 | } |
| 236 | 236 | return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription(); |
@@ -242,13 +242,13 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | protected function normalize( ...$params ) |
| 244 | 244 | { |
| 245 | - if( is_string( $params[0] ) || is_numeric( $params[0] )) { |
|
| 245 | + if( is_string( $params[0] ) || is_numeric( $params[0] ) ) { |
|
| 246 | 246 | $this->setNameOrTextAttributeForTag( $params[0] ); |
| 247 | 247 | } |
| 248 | - if( is_array( $params[0] )) { |
|
| 248 | + if( is_array( $params[0] ) ) { |
|
| 249 | 249 | $this->args += $params[0]; |
| 250 | 250 | } |
| 251 | - else if( is_array( $params[1] )) { |
|
| 251 | + else if( is_array( $params[1] ) ) { |
|
| 252 | 252 | $this->args += $params[1]; |
| 253 | 253 | } |
| 254 | 254 | $this->args = glsr( BuilderDefaults::class )->merge( $this->args ); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | protected function setTagFromMethod( $method ) |
| 274 | 274 | { |
| 275 | 275 | $this->tag = strtolower( $method ); |
| 276 | - if( in_array( $this->tag, static::INPUT_TYPES )) { |
|
| 276 | + if( in_array( $this->tag, static::INPUT_TYPES ) ) { |
|
| 277 | 277 | $this->args['type'] = $this->tag; |
| 278 | 278 | $this->tag = 'input'; |
| 279 | 279 | } |
@@ -14,14 +14,14 @@ |
||
| 14 | 14 | { |
| 15 | 15 | $partial = glsr( Html::class )->buildTemplate( 'templates/reviews-form', [ |
| 16 | 16 | 'globals' => $args, |
| 17 | - ]); |
|
| 17 | + ] ); |
|
| 18 | 18 | $form = glsr( Builder::class )->form( $partial, [ |
| 19 | 19 | 'class' => 'glsr-form', |
| 20 | 20 | 'id' => $args['id'], |
| 21 | 21 | 'method' => 'post', |
| 22 | - ]); |
|
| 22 | + ] ); |
|
| 23 | 23 | return glsr( Builder::class )->div( $form, [ |
| 24 | 24 | 'class' => 'glsr-form-wrap '.$args['class'], |
| 25 | - ]); |
|
| 25 | + ] ); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | 'page' => '', |
| 36 | 36 | 'tab' => '', |
| 37 | 37 | 'tabs' => [], |
| 38 | - ]); |
|
| 38 | + ] ); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -50,6 +50,6 @@ discard block |
||
| 50 | 50 | return glsr( Builder::class )->a( $this->args['tabs'][$tab]['title'], [ |
| 51 | 51 | 'class' => 'nav-tab'.$class, |
| 52 | 52 | 'href' => '?post_type='.Application::POST_TYPE.'&page='.$this->args['page'].'&tab='.$tab, |
| 53 | - ]); |
|
| 53 | + ] ); |
|
| 54 | 54 | } |
| 55 | 55 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $this->normalize( $args ); |
| 27 | 27 | if( count( $this->sections ) < 2 )return; |
| 28 | 28 | $links = array_reduce( array_keys( $this->sections ), function( $result, $section ) { |
| 29 | - return $result.glsr( Builder::class )->li( $this->buildLink( $section )); |
|
| 29 | + return $result.glsr( Builder::class )->li( $this->buildLink( $section ) ); |
|
| 30 | 30 | }); |
| 31 | 31 | return glsr( Builder::class )->ul( $links, ['class' => 'subsubsub glsr-subsubsub'] ); |
| 32 | 32 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'section' => '', |
| 42 | 42 | 'tab' => '', |
| 43 | 43 | 'tabs' => [], |
| 44 | - ]); |
|
| 44 | + ] ); |
|
| 45 | 45 | $this->sections = $this->args['tabs'][$this->args['tab']]['sections']; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -61,6 +61,6 @@ discard block |
||
| 61 | 61 | return glsr( Builder::class )->a( $this->sections[$section], [ |
| 62 | 62 | 'class' => $class, |
| 63 | 63 | 'href' => '?post_type='.Application::POST_TYPE.'&page='.$this->args['page'].'&tab='.$this->args['tab'].'§ion='.$section, |
| 64 | - ]).$separator; |
|
| 64 | + ] ).$separator; |
|
| 65 | 65 | } |
| 66 | 66 | } |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | public function build( $name, array $args = [] ) |
| 16 | 16 | { |
| 17 | 17 | $roundedRating = floor( round( $args['rating'], 1 ) * 2 ) / 2; |
| 18 | - $percentage = glsr( Builder::class )->span([ |
|
| 19 | - 'style' => 'width:'.( $roundedRating / Rating::MAX_RATING * 100 ).'%;', |
|
| 20 | - ]); |
|
| 18 | + $percentage = glsr( Builder::class )->span( [ |
|
| 19 | + 'style' => 'width:'.($roundedRating / Rating::MAX_RATING * 100).'%;', |
|
| 20 | + ] ); |
|
| 21 | 21 | return glsr( Builder::class )->span( $percentage, [ |
| 22 | 22 | 'class' => 'glsr-star-rating', |
| 23 | - ]); |
|
| 23 | + ] ); |
|
| 24 | 24 | } |
| 25 | 25 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | return glsr( Builder::class )->div( $this->buildSummary().$this->buildPercentageBars(), [ |
| 39 | 39 | 'class' => 'glsr-summary-wrap '.$args['class'], |
| 40 | 40 | 'id' => $args['id'], |
| 41 | - ]); |
|
| 41 | + ] ); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -51,20 +51,20 @@ discard block |
||
| 51 | 51 | $build = glsr( Builder::class ); |
| 52 | 52 | $label = $build->span( $this->args['labels'][$index], [ |
| 53 | 53 | 'class' => 'glsr-bar-label', |
| 54 | - ]); |
|
| 55 | - $barBackground = $build->span([ |
|
| 54 | + ] ); |
|
| 55 | + $barBackground = $build->span( [ |
|
| 56 | 56 | 'class' => 'glsr-bar-percent', |
| 57 | 57 | 'style' => 'width:'.$percent, |
| 58 | - ]); |
|
| 58 | + ] ); |
|
| 59 | 59 | $barPercent = $build->span( $barBackground, [ |
| 60 | 60 | 'class' => 'glsr-bar-background', |
| 61 | - ]); |
|
| 61 | + ] ); |
|
| 62 | 62 | $percent = $build->span( $percent, [ |
| 63 | 63 | 'class' => 'glsr-bar-count', |
| 64 | - ]); |
|
| 64 | + ] ); |
|
| 65 | 65 | return $build->div( $label.$barPercent.$percent, [ |
| 66 | 66 | 'class' => 'glsr-percentage-bar', |
| 67 | - ]); |
|
| 67 | + ] ); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | protected function buildPercentageBars() |
| 74 | 74 | { |
| 75 | - if( in_array( 'bars', $this->args['hide'] ))return; |
|
| 76 | - $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews->results )); |
|
| 75 | + if( in_array( 'bars', $this->args['hide'] ) )return; |
|
| 76 | + $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews->results ) ); |
|
| 77 | 77 | $range = range( Rating::MAX_RATING, 1 ); |
| 78 | - $bars = array_reduce( $range, function( $carry, $index ) use( $percentages ) { |
|
| 78 | + $bars = array_reduce( $range, function( $carry, $index ) use($percentages) { |
|
| 79 | 79 | return $carry.$this->buildPercentageBar( intval( $index ), $percentages[$index] ); |
| 80 | 80 | }); |
| 81 | 81 | return glsr( Builder::class )->div( $bars, [ |
| 82 | 82 | 'class' => 'glsr-percentage-bars', |
| 83 | - ]); |
|
| 83 | + ] ); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | if( !$this->args['schema'] )return; |
| 92 | 92 | $schema = glsr( Schema::class ); |
| 93 | - $schema->store( $schema->buildSummary( $this->args )); |
|
| 93 | + $schema->store( $schema->buildSummary( $this->args ) ); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | protected function buildSummary() |
| 100 | 100 | { |
| 101 | 101 | $summary = $this->buildSummaryRating().$this->buildSummaryStars().$this->buildSummaryText(); |
| 102 | - if( empty( $summary ))return; |
|
| 102 | + if( empty($summary) )return; |
|
| 103 | 103 | return glsr( Builder::class )->div( $summary, [ |
| 104 | 104 | 'class' => 'glsr-summary', |
| 105 | - ]); |
|
| 105 | + ] ); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | protected function buildSummaryRating() |
| 112 | 112 | { |
| 113 | - if( in_array( 'rating', $this->args['hide'] ))return; |
|
| 113 | + if( in_array( 'rating', $this->args['hide'] ) )return; |
|
| 114 | 114 | return glsr( Builder::class )->span( $this->rating, [ |
| 115 | 115 | 'class' => 'glsr-summary-rating', |
| 116 | - ]); |
|
| 116 | + ] ); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | protected function buildSummaryStars() |
| 123 | 123 | { |
| 124 | - if( in_array( 'stars', $this->args['hide'] ))return; |
|
| 124 | + if( in_array( 'stars', $this->args['hide'] ) )return; |
|
| 125 | 125 | $stars = glsr( Html::class )->buildPartial( 'star-rating', [ |
| 126 | 126 | 'rating' => $this->rating, |
| 127 | - ]); |
|
| 127 | + ] ); |
|
| 128 | 128 | return glsr( Builder::class )->span( $stars, [ |
| 129 | 129 | 'class' => 'glsr-summary-stars', |
| 130 | - ]); |
|
| 130 | + ] ); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | protected function buildSummaryText() |
| 137 | 137 | { |
| 138 | - if( in_array( 'summary', $this->args['hide'] ))return; |
|
| 138 | + if( in_array( 'summary', $this->args['hide'] ) )return; |
|
| 139 | 139 | $count = count( $this->reviews->results ); |
| 140 | - if( empty( $this->args['text'] )) { |
|
| 140 | + if( empty($this->args['text']) ) { |
|
| 141 | 141 | $this->args['text'] = _nx( |
| 142 | 142 | '{rating} out of {max} stars (based on %d review)', |
| 143 | 143 | '{rating} out of {max} stars (based on %d reviews)', |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | ); |
| 148 | 148 | } |
| 149 | 149 | $summary = str_replace( |
| 150 | - ['{rating}','{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text'] |
|
| 150 | + ['{rating}', '{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text'] |
|
| 151 | 151 | ); |
| 152 | - return str_replace( ['%s','%d'], $count, $summary ); |
|
| 152 | + return str_replace( ['%s', '%d'], $count, $summary ); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -157,6 +157,6 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | protected function isHidden() |
| 159 | 159 | { |
| 160 | - return empty( $this->reviews->results ) && in_array( 'if_empty', $this->args['hide'] ); |
|
| 160 | + return empty($this->reviews->results) && in_array( 'if_empty', $this->args['hide'] ); |
|
| 161 | 161 | } |
| 162 | 162 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | $args = $this->normalize( $args ); |
| 16 | 16 | $file = glsr()->path( 'views/'.$templatePath.'.php' ); |
| 17 | - if( !file_exists( $file )) { |
|
| 17 | + if( !file_exists( $file ) ) { |
|
| 18 | 18 | glsr_log()->error( 'Template missing: '.$file ); |
| 19 | 19 | return; |
| 20 | 20 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $args = shortcode_atts( array_fill_keys( ['context', 'globals'], [] ), $args ); |
| 60 | 60 | foreach( $args as $key => $value ) { |
| 61 | - if( is_array( $value ))continue; |
|
| 61 | + if( is_array( $value ) )continue; |
|
| 62 | 62 | $args[$key] = []; |
| 63 | 63 | } |
| 64 | 64 | return $args; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | protected function filterAttributes( array $allowedAttributeKeys ) |
| 114 | 114 | { |
| 115 | - return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys )); |
|
| 115 | + return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ) ); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES ); |
| 124 | 124 | $wildcards = []; |
| 125 | 125 | foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) { |
| 126 | - $newWildcards = array_filter( $this->attributes, function( $key ) use( $wildcard ) { |
|
| 126 | + $newWildcards = array_filter( $this->attributes, function( $key ) use($wildcard) { |
|
| 127 | 127 | return glsr( Helper::class )->startsWith( $wildcard, $key ); |
| 128 | 128 | }, ARRAY_FILTER_USE_KEY ); |
| 129 | 129 | $wildcards = array_merge( $wildcards, $newWildcards ); |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | protected function normalizeBooleanAttributes() |
| 178 | 178 | { |
| 179 | 179 | foreach( $this->attributes as $key => $value ) { |
| 180 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
| 180 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
| 181 | 181 | $key = $value; |
| 182 | 182 | $value = true; |
| 183 | 183 | } |
| 184 | - if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue; |
|
| 184 | + if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ) )continue; |
|
| 185 | 185 | $this->attributes[$key] = wp_validate_boolean( $value ); |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | protected function normalizeDataAttributes() |
| 193 | 193 | { |
| 194 | 194 | foreach( $this->attributes as $key => $value ) { |
| 195 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
| 195 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
| 196 | 196 | $key = $value; |
| 197 | 197 | $value = ''; |
| 198 | 198 | } |
| 199 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; |
|
| 200 | - if( is_array( $value )) { |
|
| 199 | + if( !glsr( Helper::class )->startsWith( 'data-', $key ) )continue; |
|
| 200 | + if( is_array( $value ) ) { |
|
| 201 | 201 | $value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); |
| 202 | 202 | } |
| 203 | 203 | $this->attributes[$key] = $value; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | protected function normalizeStringAttributes() |
| 211 | 211 | { |
| 212 | 212 | foreach( $this->attributes as $key => $value ) { |
| 213 | - if( !is_string( $value ))continue; |
|
| 213 | + if( !is_string( $value ) )continue; |
|
| 214 | 214 | $this->attributes[$key] = trim( $value ); |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | { |
| 224 | 224 | if( $method != 'input' )return; |
| 225 | 225 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); |
| 226 | - if( !in_array( $attributes['type'], static::INPUT_TYPES )) { |
|
| 226 | + if( !in_array( $attributes['type'], static::INPUT_TYPES ) ) { |
|
| 227 | 227 | $this->attributes['type'] = 'text'; |
| 228 | 228 | } |
| 229 | 229 | } |
@@ -237,11 +237,11 @@ discard block |
||
| 237 | 237 | $dataAttributes = []; |
| 238 | 238 | foreach( $this->attributes as $key => $value ) { |
| 239 | 239 | if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) { |
| 240 | - unset( $attributes[$key] ); |
|
| 240 | + unset($attributes[$key]); |
|
| 241 | 241 | } |
| 242 | - if( glsr( Helper::class )->startsWith( 'data-', $key )) { |
|
| 242 | + if( glsr( Helper::class )->startsWith( 'data-', $key ) ) { |
|
| 243 | 243 | $dataAttributes[$key] = $value; |
| 244 | - unset( $attributes[$key] ); |
|
| 244 | + unset($attributes[$key]); |
|
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | $this->attributes = array_merge( array_filter( $attributes ), $dataAttributes ); |