@@ -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,15 +64,15 @@ 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 | - if ( false !== strpos( $kirki_deprecated_filters_iteration[1], '-' ) ) { |
|
| 71 | - $kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] ); |
|
| 70 | + if ( false !== strpos( $kirki_deprecated_filters_iteration[ 1 ], '-' ) ) { |
|
| 71 | + $kirki_deprecated_filters_iteration[ 1 ] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[ 1 ] ); |
|
| 72 | 72 | add_filter( "kirki_{$config_id}_{$filter_suffix}", function( $args ) { |
| 73 | 73 | global $kirki_deprecated_filters_iteration; |
| 74 | - $kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] ); |
|
| 75 | - return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args ); |
|
| 74 | + $kirki_deprecated_filters_iteration[ 1 ] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[ 1 ] ); |
|
| 75 | + return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[ 0 ]}/{$kirki_deprecated_filters_iteration[ 1 ]}", $args ); |
|
| 76 | 76 | }, 99 ); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | * @access protected |
| 60 | 60 | */ |
| 61 | 61 | protected function set_choices() { |
| 62 | - if ( ! isset( $this->choices['language'] ) ) { |
|
| 62 | + if ( ! isset( $this->choices[ 'language' ] ) ) { |
|
| 63 | 63 | return; |
| 64 | 64 | } |
| 65 | - $language = $this->choices['language']; |
|
| 65 | + $language = $this->choices[ 'language' ]; |
|
| 66 | 66 | switch ( $language ) { |
| 67 | 67 | case 'json': |
| 68 | 68 | case 'xml': |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | $language = 'text/x-' . $language; |
| 91 | 91 | break; |
| 92 | 92 | } |
| 93 | - if ( ! isset( $this->editor_settings['codemirror'] ) ) { |
|
| 94 | - $this->editor_settings['codemirror'] = array(); |
|
| 93 | + if ( ! isset( $this->editor_settings[ 'codemirror' ] ) ) { |
|
| 94 | + $this->editor_settings[ 'codemirror' ] = array(); |
|
| 95 | 95 | } |
| 96 | - if ( ! isset( $this->editor_settings['codemirror']['mode'] ) ) { |
|
| 97 | - $this->editor_settings['codemirror']['mode'] = $language; |
|
| 96 | + if ( ! isset( $this->editor_settings[ 'codemirror' ][ 'mode' ] ) ) { |
|
| 97 | + $this->editor_settings[ 'codemirror' ][ 'mode' ] = $language; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -32,6 +32,6 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | public function to_json() { |
| 34 | 34 | parent::to_json(); |
| 35 | - $this->json['required'] = $this->required; |
|
| 35 | + $this->json[ 'required' ] = $this->required; |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -32,6 +32,6 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | public function to_json() { |
| 34 | 34 | parent::to_json(); |
| 35 | - $this->json['required'] = $this->required; |
|
| 35 | + $this->json[ 'required' ] = $this->required; |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -35,23 +35,23 @@ 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; |
|
| 54 | + $this->json[ 'show_variants' ] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -238,12 +238,12 @@ discard block |
||
| 238 | 238 | $final_variants = array(); |
| 239 | 239 | foreach ( $variants as $variant ) { |
| 240 | 240 | if ( is_string( $variant ) ) { |
| 241 | - $final_variants[] = array( |
|
| 241 | + $final_variants[ ] = array( |
|
| 242 | 242 | 'id' => $variant, |
| 243 | 243 | 'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant, |
| 244 | 244 | ); |
| 245 | - } elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) { |
|
| 246 | - $final_variants[] = $variant; |
|
| 245 | + } elseif ( is_array( $variant ) && isset( $variant[ 'id' ] ) && isset( $variant[ 'label' ] ) ) { |
|
| 246 | + $final_variants[ ] = $variant; |
|
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | return $final_variants; |
@@ -137,11 +137,11 @@ |
||
| 137 | 137 | |
| 138 | 138 | $google_fonts = array(); |
| 139 | 139 | if ( is_array( $fonts ) ) { |
| 140 | - foreach ( $fonts['items'] as $font ) { |
|
| 141 | - $google_fonts[ $font['family'] ] = array( |
|
| 142 | - 'label' => $font['family'], |
|
| 143 | - 'variants' => $font['variants'], |
|
| 144 | - 'category' => $font['category'], |
|
| 140 | + foreach ( $fonts[ 'items' ] as $font ) { |
|
| 141 | + $google_fonts[ $font[ 'family' ] ] = array( |
|
| 142 | + 'label' => $font[ 'family' ], |
|
| 143 | + 'variants' => $font[ 'variants' ], |
|
| 144 | + 'category' => $font[ 'category' ], |
|
| 145 | 145 | ); |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $fonts_to_load = $this->googlefonts->fonts; |
| 88 | 88 | |
| 89 | 89 | if ( ! empty( $fonts_to_load ) && 'preconnect' === $relation_type ) { |
| 90 | - $urls[] = array( |
|
| 90 | + $urls[ ] = array( |
|
| 91 | 91 | 'href' => 'https://fonts.gstatic.com', |
| 92 | 92 | 'crossorigin', |
| 93 | 93 | ); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $weights[ $key ] = str_replace( array( 'regular', 'bold', 'italic' ), array( '400', '', 'i' ), $value ); |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | - $this->fonts_to_load[] = $font . ':' . join( ',', $weights ) . ':cyrillic,cyrillic-ext,devanagari,greek,greek-ext,khmer,latin,latin-ext,vietnamese,hebrew,arabic,bengali,gujarati,tamil,telugu,thai'; |
|
| 123 | + $this->fonts_to_load[ ] = $font . ':' . join( ',', $weights ) . ':cyrillic,cyrillic-ext,devanagari,greek,greek-ext,khmer,latin,latin-ext,vietnamese,hebrew,arabic,bengali,gujarati,tamil,telugu,thai'; |
|
| 124 | 124 | } |
| 125 | 125 | if ( ! empty( $this->fonts_to_load ) ) { |
| 126 | 126 | Kirki_Modules_Webfont_Loader::$load = true; |
@@ -39,18 +39,18 @@ |
||
| 39 | 39 | |
| 40 | 40 | foreach ( array_keys( $value ) as $key ) { |
| 41 | 41 | |
| 42 | - $property = ( empty( $output['property'] ) ) ? $key : $output['property'] . '-' . $key; |
|
| 43 | - if ( isset( $output['choice'] ) && $output['property'] ) { |
|
| 44 | - if ( $key === $output['choice'] ) { |
|
| 45 | - $property = $output['property']; |
|
| 42 | + $property = ( empty( $output[ 'property' ] ) ) ? $key : $output[ 'property' ] . '-' . $key; |
|
| 43 | + if ( isset( $output[ 'choice' ] ) && $output[ 'property' ] ) { |
|
| 44 | + if ( $key === $output[ 'choice' ] ) { |
|
| 45 | + $property = $output[ 'property' ]; |
|
| 46 | 46 | } else { |
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | - if ( false !== strpos( $output['property'], '%%' ) ) { |
|
| 51 | - $property = str_replace( '%%', $key, $output['property'] ); |
|
| 50 | + if ( false !== strpos( $output[ 'property' ], '%%' ) ) { |
|
| 51 | + $property = str_replace( '%%', $key, $output[ 'property' ] ); |
|
| 52 | 52 | } |
| 53 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $key ] ) . $output['suffix']; |
|
| 53 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $property ] = $output[ 'prefix' ] . $this->process_property_value( $property, $value[ $key ] ) . $output[ 'suffix' ]; |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | // Apply the kirki_config filter. |
| 64 | 64 | $config = apply_filters( 'kirki_config', array() ); |
| 65 | - if ( isset( $config['url_path'] ) ) { |
|
| 66 | - Kirki::$url = $config['url_path']; |
|
| 65 | + if ( isset( $config[ 'url_path' ] ) ) { |
|
| 66 | + Kirki::$url = $config[ 'url_path' ]; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Make sure the right protocol is used. |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | $this->control_types = $this->default_control_types(); |
| 145 | 145 | if ( ! class_exists( 'WP_Customize_Code_Editor_Control' ) ) { |
| 146 | - unset( $this->control_types['code_editor'] ); |
|
| 146 | + unset( $this->control_types[ 'code_editor' ] ); |
|
| 147 | 147 | } |
| 148 | 148 | foreach ( $this->control_types as $key => $classname ) { |
| 149 | 149 | if ( ! class_exists( $classname ) ) { |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | if ( ! empty( Kirki::$panels ) ) { |
| 175 | 175 | foreach ( Kirki::$panels as $panel_args ) { |
| 176 | 176 | // Extra checks for nested panels. |
| 177 | - if ( isset( $panel_args['panel'] ) ) { |
|
| 178 | - if ( isset( Kirki::$panels[ $panel_args['panel'] ] ) ) { |
|
| 177 | + if ( isset( $panel_args[ 'panel' ] ) ) { |
|
| 178 | + if ( isset( Kirki::$panels[ $panel_args[ 'panel' ] ] ) ) { |
|
| 179 | 179 | // Set the type to nested. |
| 180 | - $panel_args['type'] = 'kirki-nested'; |
|
| 180 | + $panel_args[ 'type' ] = 'kirki-nested'; |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
@@ -195,14 +195,14 @@ discard block |
||
| 195 | 195 | if ( ! empty( Kirki::$sections ) ) { |
| 196 | 196 | foreach ( Kirki::$sections as $section_args ) { |
| 197 | 197 | // Extra checks for nested sections. |
| 198 | - if ( isset( $section_args['section'] ) ) { |
|
| 199 | - if ( isset( Kirki::$sections[ $section_args['section'] ] ) ) { |
|
| 198 | + if ( isset( $section_args[ 'section' ] ) ) { |
|
| 199 | + if ( isset( Kirki::$sections[ $section_args[ 'section' ] ] ) ) { |
|
| 200 | 200 | // Set the type to nested. |
| 201 | - $section_args['type'] = 'kirki-nested'; |
|
| 201 | + $section_args[ 'type' ] = 'kirki-nested'; |
|
| 202 | 202 | // We need to check if the parent section is nested inside a panel. |
| 203 | - $parent_section = Kirki::$sections[ $section_args['section'] ]; |
|
| 204 | - if ( isset( $parent_section['panel'] ) ) { |
|
| 205 | - $section_args['panel'] = $parent_section['panel']; |
|
| 203 | + $parent_section = Kirki::$sections[ $section_args[ 'section' ] ]; |
|
| 204 | + if ( isset( $parent_section[ 'panel' ] ) ) { |
|
| 205 | + $section_args[ 'panel' ] = $parent_section[ 'panel' ]; |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | } |