@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $config_ids = Kirki_Config::get_config_ids(); |
| 54 | 54 | global $kirki_deprecated_filters_iteration; |
| 55 | 55 | foreach ( $config_ids as $config_id ) { |
| 56 | - foreach( array( |
|
| 56 | + foreach ( array( |
|
| 57 | 57 | '/dynamic_css', |
| 58 | 58 | '/output/control-classnames', |
| 59 | 59 | '/css/skip_hidden', |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | $kirki_deprecated_filters_iteration = array( $config_id, $filter_suffix ); |
| 65 | 65 | add_filter( "kirki_{$config_id}_{$filter_suffix}", function( $args ) { |
| 66 | 66 | global $kirki_deprecated_filters_iteration; |
| 67 | - $kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] ); |
|
| 68 | - return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args ); |
|
| 67 | + $kirki_deprecated_filters_iteration[ 1 ] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[ 1 ] ); |
|
| 68 | + return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[ 0 ]}/{$kirki_deprecated_filters_iteration[ 1 ]}", $args ); |
|
| 69 | 69 | }, 99 ); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -1,55 +1,68 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // @codingStandardsIgnoreFile |
| 3 | 3 | |
| 4 | -add_filter( 'kirki_config', function( $args ) { |
|
| 4 | +add_filter( 'kirki_config', function( $args ) |
|
| 5 | +{ |
|
| 5 | 6 | return apply_filters( 'kirki/config', $args ); |
| 6 | 7 | }, 99 ); |
| 7 | 8 | |
| 8 | -add_filter( 'kirki_control_types', function( $args ) { |
|
| 9 | +add_filter( 'kirki_control_types', function( $args ) |
|
| 10 | +{ |
|
| 9 | 11 | return apply_filters( 'kirki/control_types', $args ); |
| 10 | 12 | }, 99 ); |
| 11 | 13 | |
| 12 | -add_filter( 'kirki_section_types', function( $args ) { |
|
| 14 | +add_filter( 'kirki_section_types', function( $args ) |
|
| 15 | +{ |
|
| 13 | 16 | return apply_filters( 'kirki/section_types', $args ); |
| 14 | 17 | }, 99 ); |
| 15 | 18 | |
| 16 | -add_filter( 'kirki_section_types_exclude', function( $args ) { |
|
| 19 | +add_filter( 'kirki_section_types_exclude', function( $args ) |
|
| 20 | +{ |
|
| 17 | 21 | return apply_filters( 'kirki/section_types/exclude', $args ); |
| 18 | 22 | }, 99 ); |
| 19 | 23 | |
| 20 | -add_filter( 'kirki_control_types_exclude', function( $args ) { |
|
| 24 | +add_filter( 'kirki_control_types_exclude', function( $args ) |
|
| 25 | +{ |
|
| 21 | 26 | return apply_filters( 'kirki/control_types/exclude', $args ); |
| 22 | 27 | }, 99 ); |
| 23 | 28 | |
| 24 | -add_filter( 'kirki_controls', function( $args ) { |
|
| 29 | +add_filter( 'kirki_controls', function( $args ) |
|
| 30 | +{ |
|
| 25 | 31 | return apply_filters( 'kirki/controls', $args ); |
| 26 | 32 | }, 99 ); |
| 27 | 33 | |
| 28 | -add_filter( 'kirki_fields', function( $args ) { |
|
| 34 | +add_filter( 'kirki_fields', function( $args ) |
|
| 35 | +{ |
|
| 29 | 36 | return apply_filters( 'kirki/fields', $args ); |
| 30 | 37 | }, 99 ); |
| 31 | 38 | |
| 32 | -add_filter( 'kirki_modules', function( $args ) { |
|
| 39 | +add_filter( 'kirki_modules', function( $args ) |
|
| 40 | +{ |
|
| 33 | 41 | return apply_filters( 'kirki/modules', $args ); |
| 34 | 42 | }, 99 ); |
| 35 | 43 | |
| 36 | -add_filter( 'kirki_panel_types', function( $args ) { |
|
| 44 | +add_filter( 'kirki_panel_types', function( $args ) |
|
| 45 | +{ |
|
| 37 | 46 | return apply_filters( 'kirki/panel_types', $args ); |
| 38 | 47 | }, 99 ); |
| 39 | 48 | |
| 40 | -add_filter( 'kirki_setting_types', function( $args ) { |
|
| 49 | +add_filter( 'kirki_setting_types', function( $args ) |
|
| 50 | +{ |
|
| 41 | 51 | return apply_filters( 'kirki/setting_types', $args ); |
| 42 | 52 | }, 99 ); |
| 43 | 53 | |
| 44 | -add_filter( 'kirki_variable', function( $args ) { |
|
| 54 | +add_filter( 'kirki_variable', function( $args ) |
|
| 55 | +{ |
|
| 45 | 56 | return apply_filters( 'kirki/variable', $args ); |
| 46 | 57 | }, 99 ); |
| 47 | 58 | |
| 48 | -add_filter( 'kirki_values_get_value', function( $arg1, $arg2 ) { |
|
| 59 | +add_filter( 'kirki_values_get_value', function( $arg1, $arg2 ) |
|
| 60 | +{ |
|
| 49 | 61 | return apply_filters( 'kirki/values/get_value', $arg1, $arg2 ); |
| 50 | 62 | }, 99, 2 ); |
| 51 | 63 | |
| 52 | -add_action( 'init', function() { |
|
| 64 | +add_action( 'init', function() |
|
| 65 | +{ |
|
| 53 | 66 | $config_ids = Kirki_Config::get_config_ids(); |
| 54 | 67 | global $kirki_deprecated_filters_iteration; |
| 55 | 68 | foreach ( $config_ids as $config_id ) { |
@@ -62,7 +75,8 @@ discard block |
||
| 62 | 75 | '/webfonts/skip_hidden', |
| 63 | 76 | ) as $filter_suffix ) { |
| 64 | 77 | $kirki_deprecated_filters_iteration = array( $config_id, $filter_suffix ); |
| 65 | - add_filter( "kirki_{$config_id}_{$filter_suffix}", function( $args ) { |
|
| 78 | + add_filter( "kirki_{$config_id}_{$filter_suffix}", function( $args ) |
|
| 79 | + { |
|
| 66 | 80 | global $kirki_deprecated_filters_iteration; |
| 67 | 81 | $kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] ); |
| 68 | 82 | return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args ); |
@@ -71,38 +85,47 @@ discard block |
||
| 71 | 85 | } |
| 72 | 86 | }, 99 ); |
| 73 | 87 | |
| 74 | -add_filter( 'kirki_enqueue_google_fonts', function( $args ) { |
|
| 88 | +add_filter( 'kirki_enqueue_google_fonts', function( $args ) |
|
| 89 | +{ |
|
| 75 | 90 | return apply_filters( 'kirki/enqueue_google_fonts', $args ); |
| 76 | 91 | }, 99 ); |
| 77 | 92 | |
| 78 | -add_filter( 'kirki_styles_array', function( $args ) { |
|
| 93 | +add_filter( 'kirki_styles_array', function( $args ) |
|
| 94 | +{ |
|
| 79 | 95 | return apply_filters( 'kirki/styles_array', $args ); |
| 80 | 96 | }, 99 ); |
| 81 | 97 | |
| 82 | -add_filter( 'kirki_dynamic_css_method', function( $args ) { |
|
| 98 | +add_filter( 'kirki_dynamic_css_method', function( $args ) |
|
| 99 | +{ |
|
| 83 | 100 | return apply_filters( 'kirki/dynamic_css/method', $args ); |
| 84 | 101 | }, 99 ); |
| 85 | 102 | |
| 86 | -add_filter( 'kirki_postmessage_script', function( $args ) { |
|
| 103 | +add_filter( 'kirki_postmessage_script', function( $args ) |
|
| 104 | +{ |
|
| 87 | 105 | return apply_filters( 'kirki/postmessage/script', $args ); |
| 88 | 106 | }, 99 ); |
| 89 | 107 | |
| 90 | -add_filter( 'kirki_fonts_all', function( $args ) { |
|
| 108 | +add_filter( 'kirki_fonts_all', function( $args ) |
|
| 109 | +{ |
|
| 91 | 110 | return apply_filters( 'kirki/fonts/all', $args ); |
| 92 | 111 | }, 99 ); |
| 93 | 112 | |
| 94 | -add_filter( 'kirki_fonts_standard_fonts', function( $args ) { |
|
| 113 | +add_filter( 'kirki_fonts_standard_fonts', function( $args ) |
|
| 114 | +{ |
|
| 95 | 115 | return apply_filters( 'kirki/fonts/standard_fonts', $args ); |
| 96 | 116 | }, 99 ); |
| 97 | 117 | |
| 98 | -add_filter( 'kirki_fonts_backup_fonts', function( $args ) { |
|
| 118 | +add_filter( 'kirki_fonts_backup_fonts', function( $args ) |
|
| 119 | +{ |
|
| 99 | 120 | return apply_filters( 'kirki/fonts/backup_fonts', $args ); |
| 100 | 121 | }, 99 ); |
| 101 | 122 | |
| 102 | -add_filter( 'kirki_fonts_google_fonts', function( $args ) { |
|
| 123 | +add_filter( 'kirki_fonts_google_fonts', function( $args ) |
|
| 124 | +{ |
|
| 103 | 125 | return apply_filters( 'kirki/fonts/google_fonts', $args ); |
| 104 | 126 | }, 99 ); |
| 105 | 127 | |
| 106 | -add_filter( 'kirki_googlefonts_load_method', function( $args ) { |
|
| 128 | +add_filter( 'kirki_googlefonts_load_method', function( $args ) |
|
| 129 | +{ |
|
| 107 | 130 | return apply_filters( 'kirki/googlefonts_load_method', $args ); |
| 108 | 131 | }, 99 ); |
@@ -76,13 +76,13 @@ |
||
| 76 | 76 | |
| 77 | 77 | $fields = Kirki::$fields; |
| 78 | 78 | foreach ( $fields as $field ) { |
| 79 | - if ( isset( $field['tooltip'] ) && ! empty( $field['tooltip'] ) ) { |
|
| 79 | + if ( isset( $field[ 'tooltip' ] ) && ! empty( $field[ 'tooltip' ] ) ) { |
|
| 80 | 80 | // Get the control ID and properly format it for the tooltips |
| 81 | - $id = str_replace( '[', '-', str_replace( ']', '', $field['settings'] ) ); |
|
| 81 | + $id = str_replace( '[', '-', str_replace( ']', '', $field[ 'settings' ] ) ); |
|
| 82 | 82 | // Add the tooltips content. |
| 83 | 83 | $this->tooltips_content[ $id ] = array( |
| 84 | 84 | 'id' => $id, |
| 85 | - 'content' => wp_kses_post( $field['tooltip'] ), |
|
| 85 | + 'content' => wp_kses_post( $field[ 'tooltip' ] ), |
|
| 86 | 86 | ); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -35,25 +35,25 @@ discard block |
||
| 35 | 35 | public function to_json() { |
| 36 | 36 | parent::to_json(); |
| 37 | 37 | |
| 38 | - if ( is_array( $this->json['value'] ) ) { |
|
| 39 | - foreach ( array_keys( $this->json['value'] ) as $key ) { |
|
| 40 | - if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][ $key ] ) ) { |
|
| 41 | - unset( $this->json['value'][ $key ] ); |
|
| 38 | + if ( is_array( $this->json[ 'value' ] ) ) { |
|
| 39 | + foreach ( array_keys( $this->json[ 'value' ] ) as $key ) { |
|
| 40 | + if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json[ 'default' ][ $key ] ) ) { |
|
| 41 | + unset( $this->json[ 'value' ][ $key ] ); |
|
| 42 | 42 | } |
| 43 | 43 | // Fix for https://wordpress.org/support/topic/white-font-after-updateing-to-3-0-16. |
| 44 | - if ( ! isset( $this->json['default'][ $key ] ) ) { |
|
| 45 | - unset( $this->json['value'][ $key ] ); |
|
| 44 | + if ( ! isset( $this->json[ 'default' ][ $key ] ) ) { |
|
| 45 | + unset( $this->json[ 'value' ][ $key ] ); |
|
| 46 | 46 | } |
| 47 | 47 | // Fix for https://github.com/aristath/kirki/issues/1405. |
| 48 | - if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) { |
|
| 49 | - unset( $this->json['value'][ $key ] ); |
|
| 48 | + if ( isset( $this->json[ 'default' ][ $key ] ) && false === $this->json[ 'default' ][ $key ] ) { |
|
| 49 | + unset( $this->json[ 'value' ][ $key ] ); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $this->json['show_variants'] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true; |
|
| 55 | - $this->json['show_subsets'] = ( true === Kirki_Fonts_Google::$force_load_all_subsets ) ? false : true; |
|
| 56 | - $this->json['languages'] = Kirki_Fonts::get_google_font_subsets(); |
|
| 54 | + $this->json[ 'show_variants' ] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true; |
|
| 55 | + $this->json[ 'show_subsets' ] = ( true === Kirki_Fonts_Google::$force_load_all_subsets ) ? false : true; |
|
| 56 | + $this->json[ 'languages' ] = Kirki_Fonts::get_google_font_subsets(); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -250,12 +250,12 @@ discard block |
||
| 250 | 250 | $final_variants = array(); |
| 251 | 251 | foreach ( $variants as $variant ) { |
| 252 | 252 | if ( is_string( $variant ) ) { |
| 253 | - $final_variants[] = array( |
|
| 253 | + $final_variants[ ] = array( |
|
| 254 | 254 | 'id' => $variant, |
| 255 | 255 | 'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant, |
| 256 | 256 | ); |
| 257 | - } elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) { |
|
| 258 | - $final_variants[] = $variant; |
|
| 257 | + } elseif ( is_array( $variant ) && isset( $variant[ 'id' ] ) && isset( $variant[ 'label' ] ) ) { |
|
| 258 | + $final_variants[ ] = $variant; |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | return $final_variants; |