@@ -86,7 +86,7 @@ |
||
| 86 | 86 | $weights[ $key ] = str_replace( array( 'regular', 'bold', 'italic' ), array( '400', '', 'i' ), $value ); |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | - $fonts_to_load[] = $font . ':' . join( ',', $weights ); |
|
| 89 | + $fonts_to_load[ ] = $font . ':' . join( ',', $weights ); |
|
| 90 | 90 | } |
| 91 | 91 | wp_enqueue_script( 'webfont-loader', 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js', array(), KIRKI_VERSION ); |
| 92 | 92 | if ( empty( $fonts_to_load ) ) { |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | protected function process_output( $output, $value ) { |
| 25 | 25 | |
| 26 | - $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
|
| 27 | - $output['element'] = ( isset( $output['element'] ) ) ? $output['element'] : 'body'; |
|
| 28 | - $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : ''; |
|
| 29 | - $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
|
| 26 | + $output[ 'media_query' ] = ( isset( $output[ 'media_query' ] ) ) ? $output[ 'media_query' ] : 'global'; |
|
| 27 | + $output[ 'element' ] = ( isset( $output[ 'element' ] ) ) ? $output[ 'element' ] : 'body'; |
|
| 28 | + $output[ 'prefix' ] = ( isset( $output[ 'prefix' ] ) ) ? $output[ 'prefix' ] : ''; |
|
| 29 | + $output[ 'suffix' ] = ( isset( $output[ 'suffix' ] ) ) ? $output[ 'suffix' ] : ''; |
|
| 30 | 30 | |
| 31 | 31 | $value = Kirki_Field_Typography::sanitize( $value ); |
| 32 | 32 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | foreach ( $properties as $property ) { |
| 49 | 49 | |
| 50 | 50 | // Early exit if the value is not in the defaults. |
| 51 | - if ( ! isset( $this->field['default'][ $property ] ) ) { |
|
| 51 | + if ( ! isset( $this->field[ 'default' ][ $property ] ) ) { |
|
| 52 | 52 | continue; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -58,37 +58,37 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // Early exit if we use "choice" but not for this property. |
| 61 | - if ( isset( $output['choice'] ) && $output['choice'] !== $property ) { |
|
| 61 | + if ( isset( $output[ 'choice' ] ) && $output[ 'choice' ] !== $property ) { |
|
| 62 | 62 | continue; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // Take care of variants. |
| 66 | - if ( 'variant' == $property && isset( $value['variant'] ) && ! empty( $value['variant'] ) ) { |
|
| 66 | + if ( 'variant' == $property && isset( $value[ 'variant' ] ) && ! empty( $value[ 'variant' ] ) ) { |
|
| 67 | 67 | |
| 68 | 68 | // Get the font_weight. |
| 69 | - $font_weight = str_replace( 'italic', '', $value['variant'] ); |
|
| 69 | + $font_weight = str_replace( 'italic', '', $value[ 'variant' ] ); |
|
| 70 | 70 | $font_weight = ( in_array( $font_weight, array( '', 'regular' ) ) ) ? '400' : $font_weight; |
| 71 | 71 | |
| 72 | 72 | // Is this italic? |
| 73 | - $is_italic = ( false !== strpos( $value['variant'], 'italic' ) ); |
|
| 74 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight; |
|
| 73 | + $is_italic = ( false !== strpos( $value[ 'variant' ], 'italic' ) ); |
|
| 74 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ 'font-weight' ] = $font_weight; |
|
| 75 | 75 | if ( $is_italic ) { |
| 76 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic'; |
|
| 76 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ 'font-style' ] = 'italic'; |
|
| 77 | 77 | } |
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | $property_value = $this->process_property_value( $property, $value[ $property ] ); |
| 82 | 82 | if ( 'font-family' === $property ) { |
| 83 | - $value['font-backup'] = ( isset( $value['font-backup'] ) ) ? $value['font-backup'] : ''; |
|
| 83 | + $value[ 'font-backup' ] = ( isset( $value[ 'font-backup' ] ) ) ? $value[ 'font-backup' ] : ''; |
|
| 84 | 84 | $property_value = $this->process_property_value( $property, array( |
| 85 | - $value['font-family'], |
|
| 86 | - $value['font-backup'], |
|
| 85 | + $value[ 'font-family' ], |
|
| 86 | + $value[ 'font-backup' ], |
|
| 87 | 87 | ) ); |
| 88 | 88 | } |
| 89 | - $property = ( isset( $output['choice'] ) && isset( $output['property'] ) ) ? $output['property'] : $property; |
|
| 90 | - $property_value = ( is_array( $property_value ) && isset( $property_value[0] ) ) ? $property_value[0] : $property_value; |
|
| 91 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $property_value . $output['suffix']; |
|
| 89 | + $property = ( isset( $output[ 'choice' ] ) && isset( $output[ 'property' ] ) ) ? $output[ 'property' ] : $property; |
|
| 90 | + $property_value = ( is_array( $property_value ) && isset( $property_value[ 0 ] ) ) ? $property_value[ 0 ] : $property_value; |
|
| 91 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $property ] = $output[ 'prefix' ] . $property_value . $output[ 'suffix' ]; |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | // Set a default class name. |
| 67 | 67 | $class_name = 'WP_Customize_Control'; |
| 68 | 68 | // Get the classname from the array of control classnames. |
| 69 | - if ( array_key_exists( $args['type'], self::$control_types ) ) { |
|
| 70 | - $class_name = self::$control_types[ $args['type'] ]; |
|
| 69 | + if ( array_key_exists( $args[ 'type' ], self::$control_types ) ) { |
|
| 70 | + $class_name = self::$control_types[ $args[ 'type' ] ]; |
|
| 71 | 71 | } |
| 72 | 72 | return $class_name; |
| 73 | 73 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | // Get the name of the class we're going to use. |
| 85 | 85 | $class_name = $this->get_control_class_name( $args ); |
| 86 | 86 | // Add the control. |
| 87 | - $this->wp_customize->add_control( new $class_name( $this->wp_customize, $args['settings'], $args ) ); |
|
| 87 | + $this->wp_customize->add_control( new $class_name( $this->wp_customize, $args[ 'settings' ], $args ) ); |
|
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | |
@@ -59,11 +59,11 @@ 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 | 65 | |
| 66 | - switch ( $this->choices['language'] ) { |
|
| 66 | + switch ( $this->choices[ 'language' ] ) { |
|
| 67 | 67 | case 'css': |
| 68 | 68 | case 'html': |
| 69 | 69 | case 'htmlmixed': |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | case 'markdown': |
| 74 | 74 | case 'md': |
| 75 | 75 | case 'xml': |
| 76 | - if ( 'md' === $this->choices['language'] ) { |
|
| 77 | - $this->choices['language'] = 'markdown'; |
|
| 78 | - } elseif ( 'htm' === $this->choices['language'] || 'htmlmixed' === $this->choices['language'] ) { |
|
| 79 | - $this->choices['language'] = 'html'; |
|
| 76 | + if ( 'md' === $this->choices[ 'language' ] ) { |
|
| 77 | + $this->choices[ 'language' ] = 'markdown'; |
|
| 78 | + } elseif ( 'htm' === $this->choices[ 'language' ] || 'htmlmixed' === $this->choices[ 'language' ] ) { |
|
| 79 | + $this->choices[ 'language' ] = 'html'; |
|
| 80 | 80 | } |
| 81 | - $this->code_type = 'text/' . $this->choices['language']; |
|
| 82 | - if ( 'html' === $this->choices['language'] ) { |
|
| 83 | - $this->choices['language'] = 'htmlmixed'; |
|
| 81 | + $this->code_type = 'text/' . $this->choices[ 'language' ]; |
|
| 82 | + if ( 'html' === $this->choices[ 'language' ] ) { |
|
| 83 | + $this->choices[ 'language' ] = 'htmlmixed'; |
|
| 84 | 84 | } |
| 85 | 85 | break; |
| 86 | 86 | case 'http': |
@@ -93,12 +93,12 @@ discard block |
||
| 93 | 93 | case 'php5': |
| 94 | 94 | case 'php7': |
| 95 | 95 | case 'phps': |
| 96 | - if ( 'js' === $this->choices['language'] ) { |
|
| 97 | - $this->choices['language'] = 'javascript'; |
|
| 98 | - } elseif ( in_array( $this->choices['language'], array( 'phtml', 'php3', 'php4', 'php5', 'php7', 'phps' ), true ) ) { |
|
| 99 | - $this->choices['language'] = 'php'; |
|
| 96 | + if ( 'js' === $this->choices[ 'language' ] ) { |
|
| 97 | + $this->choices[ 'language' ] = 'javascript'; |
|
| 98 | + } elseif ( in_array( $this->choices[ 'language' ], array( 'phtml', 'php3', 'php4', 'php5', 'php7', 'phps' ), true ) ) { |
|
| 99 | + $this->choices[ 'language' ] = 'php'; |
|
| 100 | 100 | } |
| 101 | - $this->code_type = 'application/' . $this->choices['language']; |
|
| 101 | + $this->code_type = 'application/' . $this->choices[ 'language' ]; |
|
| 102 | 102 | break; |
| 103 | 103 | case 'svg': |
| 104 | 104 | $this->code_type = 'image/svg-xml'; |
@@ -107,14 +107,14 @@ discard block |
||
| 107 | 107 | $this->code_type = 'text/plain'; |
| 108 | 108 | break; |
| 109 | 109 | default: |
| 110 | - $this->code_type = 'text/x-' . $this->choices['language']; |
|
| 110 | + $this->code_type = 'text/x-' . $this->choices[ 'language' ]; |
|
| 111 | 111 | break; |
| 112 | 112 | } |
| 113 | - if ( ! isset( $this->editor_settings['codemirror'] ) ) { |
|
| 114 | - $this->editor_settings['codemirror'] = array(); |
|
| 113 | + if ( ! isset( $this->editor_settings[ 'codemirror' ] ) ) { |
|
| 114 | + $this->editor_settings[ 'codemirror' ] = array(); |
|
| 115 | 115 | } |
| 116 | - if ( ! isset( $this->editor_settings['codemirror']['mode'] ) ) { |
|
| 117 | - $this->editor_settings['codemirror']['mode'] = $this->choices['language']; |
|
| 116 | + if ( ! isset( $this->editor_settings[ 'codemirror' ][ 'mode' ] ) ) { |
|
| 117 | + $this->editor_settings[ 'codemirror' ][ 'mode' ] = $this->choices[ 'language' ]; |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | public function to_json() { |
| 54 | 54 | parent::to_json(); |
| 55 | 55 | |
| 56 | - $this->json['multiple'] = $this->multiple; |
|
| 57 | - $this->json['placeholder'] = $this->placeholder; |
|
| 56 | + $this->json[ 'multiple' ] = $this->multiple; |
|
| 57 | + $this->json[ 'placeholder' ] = $this->placeholder; |
|
| 58 | 58 | } |
| 59 | 59 | } |