@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | $config = Kirki_Config::get_instance( $config_id, $args ); |
| 116 | 116 | $config_args = $config->get_config(); |
| 117 | - self::$config[ $config_args['id'] ] = $config_args; |
|
| 117 | + self::$config[$config_args['id']] = $config_args; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $args['active_callback'] = ( isset( $args['required'] ) ) ? array( 'Kirki_Active_Callback', 'evaluate' ) : '__return_true'; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - self::$panels[ $args['id'] ] = $args; |
|
| 139 | + self::$panels[$args['id']] = $args; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $args['active_callback'] = ( isset( $args['required'] ) ) ? array( 'Kirki_Active_Callback', 'evaluate' ) : '__return_true'; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - self::$sections[ $args['id'] ] = $args; |
|
| 162 | + self::$sections[$args['id']] = $args; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -208,9 +208,9 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public static function get_config_param( $id, $param ) { |
| 210 | 210 | |
| 211 | - if ( ! isset( self::$config[ $id ] ) || ! isset( self::$config[ $id ][ $param ] ) ) { |
|
| 211 | + if ( ! isset( self::$config[$id] ) || ! isset( self::$config[$id][$param] ) ) { |
|
| 212 | 212 | return ''; |
| 213 | 213 | } |
| 214 | - return self::$config[ $id ][ $param ]; |
|
| 214 | + return self::$config[$id][$param]; |
|
| 215 | 215 | } |
| 216 | 216 | } |
@@ -257,13 +257,13 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | // Get the config arguments, and merge them with the defaults. |
| 259 | 259 | $config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array(); |
| 260 | - if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) { |
|
| 261 | - $config_defaults = Kirki::$config[ $this->kirki_config ]; |
|
| 260 | + if ( 'global' !== $this->kirki_config && isset( Kirki::$config[$this->kirki_config] ) ) { |
|
| 261 | + $config_defaults = Kirki::$config[$this->kirki_config]; |
|
| 262 | 262 | } |
| 263 | 263 | $config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array(); |
| 264 | 264 | foreach ( $config_defaults as $key => $value ) { |
| 265 | - if ( isset( $defaults[ $key ] ) && ! empty( $value ) && $value !== $defaults[ $key ] ) { |
|
| 266 | - $defaults[ $key ] = $value; |
|
| 265 | + if ( isset( $defaults[$key] ) && ! empty( $value ) && $value !== $defaults[$key] ) { |
|
| 266 | + $defaults[$key] = $value; |
|
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | |
@@ -308,11 +308,11 @@ discard block |
||
| 308 | 308 | // Get all arguments with their values. |
| 309 | 309 | $args = get_object_vars( $this ); |
| 310 | 310 | foreach ( array_keys( $args ) as $key ) { |
| 311 | - $args[ $key ] = $this->$key; |
|
| 311 | + $args[$key] = $this->$key; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | // Add the field to the static $fields variable properly indexed. |
| 315 | - Kirki::$fields[ $this->settings ] = $args; |
|
| 315 | + Kirki::$fields[$this->settings] = $args; |
|
| 316 | 316 | |
| 317 | 317 | } |
| 318 | 318 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
| 408 | 408 | /* translators: %1$s represents the field ID where the error occurs. */ |
| 409 | 409 | _doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' ); |
| 410 | - unset( $this->partial_refresh[ $id ] ); |
|
| 410 | + unset( $this->partial_refresh[$id] ); |
|
| 411 | 411 | continue; |
| 412 | 412 | } |
| 413 | 413 | } |
@@ -435,10 +435,10 @@ discard block |
||
| 435 | 435 | } |
| 436 | 436 | $settings = array(); |
| 437 | 437 | foreach ( $this->settings as $setting_key => $setting_value ) { |
| 438 | - $settings[ $setting_key ] = $setting_value; |
|
| 438 | + $settings[$setting_key] = $setting_value; |
|
| 439 | 439 | // If we're using serialized options then we need to spice this up. |
| 440 | 440 | if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
| 441 | - $settings[ $setting_key ] = "{$this->option_name}[{$setting_value}]"; |
|
| 441 | + $settings[$setting_key] = "{$this->option_name}[{$setting_value}]"; |
|
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | $this->settings = $settings; |
@@ -563,17 +563,17 @@ discard block |
||
| 563 | 563 | } |
| 564 | 564 | foreach ( $this->output as $key => $output ) { |
| 565 | 565 | if ( empty( $output ) || ! isset( $output['element'] ) ) { |
| 566 | - unset( $this->output[ $key ] ); |
|
| 566 | + unset( $this->output[$key] ); |
|
| 567 | 567 | continue; |
| 568 | 568 | } |
| 569 | 569 | if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) { |
| 570 | - $this->output[ $key ]['sanitize_callback'] = $output['callback']; |
|
| 570 | + $this->output[$key]['sanitize_callback'] = $output['callback']; |
|
| 571 | 571 | } |
| 572 | 572 | // Convert element arrays to strings. |
| 573 | 573 | if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { |
| 574 | - $this->output[ $key ]['element'] = array_unique( $this->output[ $key ]['element'] ); |
|
| 575 | - sort( $this->output[ $key ]['element'] ); |
|
| 576 | - $this->output[ $key ]['element'] = implode( ',', $this->output[ $key ]['element'] ); |
|
| 574 | + $this->output[$key]['element'] = array_unique( $this->output[$key]['element'] ); |
|
| 575 | + sort( $this->output[$key]['element'] ); |
|
| 576 | + $this->output[$key]['element'] = implode( ',', $this->output[$key]['element'] ); |
|
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | 579 | } |
@@ -118,9 +118,9 @@ |
||
| 118 | 118 | // If we have a variable_callback defined then get the value of the option |
| 119 | 119 | // and run it through the callback function. |
| 120 | 120 | // If no callback is defined (false) then just get the value. |
| 121 | - $variables[ $variable_name ] = Kirki_Values::get_value( $field['settings'] ); |
|
| 121 | + $variables[$variable_name] = Kirki_Values::get_value( $field['settings'] ); |
|
| 122 | 122 | if ( $variable_callback ) { |
| 123 | - $variables[ $variable_name ] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) ); |
|
| 123 | + $variables[$variable_name] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) ); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -147,15 +147,15 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | foreach ( array_keys( $this->json['value'] ) as $key ) { |
| 150 | - if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ) ) && ! isset( $this->json['default'][ $key ] ) ) { |
|
| 151 | - unset( $this->json['value'][ $key ] ); |
|
| 150 | + if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ) ) && ! isset( $this->json['default'][$key] ) ) { |
|
| 151 | + unset( $this->json['value'][$key] ); |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // Fix for https://github.com/aristath/kirki/issues/1405. |
| 156 | 156 | foreach ( array_keys( $this->json['value'] ) as $key ) { |
| 157 | - if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) { |
|
| 158 | - unset( $this->json['value'][ $key ] ); |
|
| 157 | + if ( isset( $this->json['default'][$key] ) && false === $this->json['default'][$key] ) { |
|
| 158 | + unset( $this->json['value'][$key] ); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | $this->json['show_variants'] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true; |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | if ( is_string( $variant ) ) { |
| 339 | 339 | $final_variants[] = array( |
| 340 | 340 | 'id' => $variant, |
| 341 | - 'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant, |
|
| 341 | + 'label' => isset( $all_variants[$variant] ) ? $all_variants[$variant] : $variant, |
|
| 342 | 342 | ); |
| 343 | 343 | } elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) { |
| 344 | 344 | $final_variants[] = $variant; |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | if ( array_key_exists( $variant, $all_variants ) ) { |
| 420 | 420 | $available_variants[] = array( |
| 421 | 421 | 'id' => $variant, |
| 422 | - 'label' => $all_variants[ $variant ], |
|
| 422 | + 'label' => $all_variants[$variant], |
|
| 423 | 423 | ); |
| 424 | 424 | } |
| 425 | 425 | } |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | if ( array_key_exists( $subset, $all_subsets ) ) { |
| 432 | 432 | $available_subsets[] = array( |
| 433 | 433 | 'id' => $subset, |
| 434 | - 'label' => $all_subsets[ $subset ], |
|
| 434 | + 'label' => $all_subsets[$subset], |
|
| 435 | 435 | ); |
| 436 | 436 | } |
| 437 | 437 | } |
@@ -336,7 +336,8 @@ discard block |
||
| 336 | 336 | </div> |
| 337 | 337 | <?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?> |
| 338 | 338 | <input class="typography-hidden-value" type="hidden" {{{ data.link }}}> |
| 339 | - <?php else : ?> |
|
| 339 | + <?php else { |
|
| 340 | + : ?> |
|
| 340 | 341 | <# |
| 341 | 342 | if ( ! _.isUndefined( data.value['font-family'] ) ) { |
| 342 | 343 | data.value['font-family'] = data.value['font-family'].replace( /"/g, ''' ); |
@@ -344,7 +345,9 @@ discard block |
||
| 344 | 345 | valueJSON = JSON.stringify( data.value ).replace( /'/g, ''' ); |
| 345 | 346 | #> |
| 346 | 347 | <input class="typography-hidden-value" type="hidden" value='{{{ valueJSON }}}' {{{ data.link }}}> |
| 347 | - <?php endif; ?> |
|
| 348 | + <?php endif; |
|
| 349 | +} |
|
| 350 | +?> |
|
| 348 | 351 | <?php |
| 349 | 352 | } |
| 350 | 353 | |
@@ -180,9 +180,12 @@ |
||
| 180 | 180 | <div class="iris-target"></div> |
| 181 | 181 | <?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?> |
| 182 | 182 | <input class="multicolor-hidden-value" type="hidden" {{{ data.link }}}> |
| 183 | - <?php else : ?> |
|
| 183 | + <?php else { |
|
| 184 | + : ?> |
|
| 184 | 185 | <input class="multicolor-hidden-value" type="hidden" value='{{{ JSON.stringify( data.value ) }}}' {{{ data.link }}}> |
| 185 | - <?php endif; ?> |
|
| 186 | + <?php endif; |
|
| 187 | +} |
|
| 188 | +?> |
|
| 186 | 189 | <?php |
| 187 | 190 | } |
| 188 | 191 | |
@@ -200,10 +200,13 @@ |
||
| 200 | 200 | </div> |
| 201 | 201 | <?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?> |
| 202 | 202 | <input class="background-hidden-value" type="hidden" {{{ data.link }}}> |
| 203 | - <?php else : ?> |
|
| 203 | + <?php else { |
|
| 204 | + : ?> |
|
| 204 | 205 | <# valueJSON = JSON.stringify( data.value ).replace( /'/g, ''' ); #> |
| 205 | 206 | <input class="background-hidden-value" type="hidden" value='{{{ valueJSON }}}' {{{ data.link }}}> |
| 206 | - <?php endif; ?> |
|
| 207 | + <?php endif; |
|
| 208 | +} |
|
| 209 | +?> |
|
| 207 | 210 | <?php |
| 208 | 211 | } |
| 209 | 212 | } |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | * Returns an array of paths where translation files may be located. |
| 94 | 94 | * |
| 95 | 95 | * @access protected |
| 96 | - * @return array |
|
| 96 | + * @return string[] |
|
| 97 | 97 | */ |
| 98 | 98 | protected function get_paths() { |
| 99 | 99 | |
@@ -117,9 +117,9 @@ |
||
| 117 | 117 | public function override_load_textdomain( $override, $domain, $mofile ) { |
| 118 | 118 | |
| 119 | 119 | global $l10n; |
| 120 | - if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) { |
|
| 120 | + if ( isset( $l10n[$this->get_theme_textdomain()] ) ) { |
|
| 121 | 121 | // @codingStandardsIgnoreLine WordPress.Variables.GlobalVariables.OverrideProhibited |
| 122 | - $l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; |
|
| 122 | + $l10n['kirki'] = $l10n[$this->get_theme_textdomain()]; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // Check if the domain is "kirki". |