@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | protected function getSettingFields( $path ) |
| 56 | 56 | { |
| 57 | - return array_filter( $this->settings, function( $key ) use( $path ) { |
|
| 57 | + return array_filter( $this->settings, function( $key ) use($path) { |
|
| 58 | 58 | return glsr( Helper::class )->startsWith( $path, $key ); |
| 59 | 59 | }, ARRAY_FILTER_USE_KEY ); |
| 60 | 60 | } |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | $field = wp_parse_args( $field, [ |
| 70 | 70 | 'is_setting' => true, |
| 71 | 71 | 'name' => $name, |
| 72 | - ]); |
|
| 73 | - $rows.= new Field( $this->normalize( $field )); |
|
| 72 | + ] ); |
|
| 73 | + $rows .= new Field( $this->normalize( $field ) ); |
|
| 74 | 74 | } |
| 75 | 75 | return $rows; |
| 76 | 76 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | protected function getTemplateData( $id ) |
| 83 | 83 | { |
| 84 | - $fields = $this->getSettingFields( $this->normalizeSettingPath( $id )); |
|
| 84 | + $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) ); |
|
| 85 | 85 | return [ |
| 86 | 86 | 'context' => [ |
| 87 | 87 | 'rows' => $this->getSettingRows( $fields ), |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | protected function getTemplateDataForAddons( $id ) |
| 97 | 97 | { |
| 98 | - $fields = $this->getSettingFields( $this->normalizeSettingPath( $id )); |
|
| 98 | + $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) ); |
|
| 99 | 99 | $settings = glsr( Helper::class )->convertDotNotationArray( $fields ); |
| 100 | 100 | $settingKeys = array_keys( $settings['settings']['addons'] ); |
| 101 | 101 | $results = []; |
| 102 | 102 | foreach( $settingKeys as $key ) { |
| 103 | - $addonFields = array_filter( $fields, function( $path ) use( $key ) { |
|
| 103 | + $addonFields = array_filter( $fields, function( $path ) use($key) { |
|
| 104 | 104 | return glsr( Helper::class )->startsWith( 'settings.addons.'.$key, $path ); |
| 105 | 105 | }, ARRAY_FILTER_USE_KEY ); |
| 106 | 106 | $results[$key] = $this->getSettingRows( $addonFields ); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | protected function getTemplateDataForLicenses( $id ) |
| 119 | 119 | { |
| 120 | - $fields = $this->getSettingFields( $this->normalizeSettingPath( $id )); |
|
| 120 | + $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) ); |
|
| 121 | 121 | ksort( $fields ); |
| 122 | 122 | return [ |
| 123 | 123 | 'context' => [ |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | protected function getTemplateDataForTranslations() |
| 133 | 133 | { |
| 134 | 134 | $translations = glsr( Translation::class )->renderAll(); |
| 135 | - $class = empty( $translations ) |
|
| 135 | + $class = empty($translations) |
|
| 136 | 136 | ? 'glsr-hidden' |
| 137 | 137 | : ''; |
| 138 | 138 | return [ |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | $path, |
| 156 | 156 | glsr( Helper::class )->dataGet( glsr()->defaults, $path ) |
| 157 | 157 | ); |
| 158 | - if( is_array( $expectedValue )) { |
|
| 158 | + if( is_array( $expectedValue ) ) { |
|
| 159 | 159 | return is_array( $optionValue ) |
| 160 | - ? count( array_intersect( $optionValue, $expectedValue )) === 0 |
|
| 160 | + ? count( array_intersect( $optionValue, $expectedValue ) ) === 0 |
|
| 161 | 161 | : !in_array( $optionValue, $expectedValue ); |
| 162 | 162 | } |
| 163 | 163 | return $optionValue != $expectedValue; |
@@ -168,10 +168,10 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | protected function isMultiDependency( $path ) |
| 170 | 170 | { |
| 171 | - if( isset( $this->settings[$path] )) { |
|
| 171 | + if( isset($this->settings[$path]) ) { |
|
| 172 | 172 | $field = $this->settings[$path]; |
| 173 | - return ( $field['type'] == 'checkbox' && !empty( $field['options'] )) |
|
| 174 | - || !empty( $field['multiple'] ); |
|
| 173 | + return ($field['type'] == 'checkbox' && !empty($field['options'])) |
|
| 174 | + || !empty($field['multiple']); |
|
| 175 | 175 | } |
| 176 | 176 | return false; |
| 177 | 177 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | protected function normalizeDependsOn( array $field ) |
| 194 | 194 | { |
| 195 | - if( !empty( $field['depends_on'] ) && is_array( $field['depends_on'] )) { |
|
| 195 | + if( !empty($field['depends_on']) && is_array( $field['depends_on'] ) ) { |
|
| 196 | 196 | $isFieldHidden = false; |
| 197 | 197 | $conditions = []; |
| 198 | 198 | foreach( $field['depends_on'] as $path => $value ) { |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | 'name' => $this->getFieldNameForDependsOn( $path ), |
| 201 | 201 | 'value' => $value, |
| 202 | 202 | ]; |
| 203 | - if( $this->isFieldHidden( $path, $value )) { |
|
| 203 | + if( $this->isFieldHidden( $path, $value ) ) { |
|
| 204 | 204 | $isFieldHidden = true; |
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | - $field['data-depends'] = json_encode( $conditions, JSON_HEX_APOS|JSON_HEX_QUOT ); |
|
| 207 | + $field['data-depends'] = json_encode( $conditions, JSON_HEX_APOS | JSON_HEX_QUOT ); |
|
| 208 | 208 | $field['is_hidden'] = $isFieldHidden; |
| 209 | 209 | } |
| 210 | 210 | return $field; |
@@ -215,9 +215,9 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | protected function normalizeLabelAndLegend( array $field ) |
| 217 | 217 | { |
| 218 | - if( !empty( $field['label'] )) { |
|
| 218 | + if( !empty($field['label']) ) { |
|
| 219 | 219 | $field['legend'] = $field['label']; |
| 220 | - unset( $field['label'] ); |
|
| 220 | + unset($field['label']); |
|
| 221 | 221 | } |
| 222 | 222 | else { |
| 223 | 223 | $field['is_valid'] = false; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | protected function normalizeValue( array $field ) |
| 233 | 233 | { |
| 234 | - if( !isset( $field['value'] )) { |
|
| 234 | + if( !isset($field['value']) ) { |
|
| 235 | 235 | $field['value'] = glsr( OptionManager::class )->get( |
| 236 | 236 | $field['name'], |
| 237 | 237 | $this->getFieldDefault( $field ) |