@@ -43,7 +43,7 @@ |
||
43 | 43 | public function to_json() { |
44 | 44 | parent::to_json(); |
45 | 45 | |
46 | - $this->json['alpha'] = (bool) $this->alpha; |
|
46 | + $this->json[ 'alpha' ] = (bool) $this->alpha; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -37,7 +37,7 @@ |
||
37 | 37 | public function to_json() { |
38 | 38 | parent::to_json(); |
39 | 39 | |
40 | - $this->json['choices'] = wp_parse_args( $this->json['choices'], array( |
|
40 | + $this->json[ 'choices' ] = wp_parse_args( $this->json[ 'choices' ], array( |
|
41 | 41 | 'min' => '0', |
42 | 42 | 'max' => '100', |
43 | 43 | 'step' => '1', |
@@ -38,11 +38,11 @@ |
||
38 | 38 | parent::to_json(); |
39 | 39 | |
40 | 40 | // If no palette has been defined, use Material Design Palette. |
41 | - if ( ! isset( $this->json['choices']['colors'] ) || empty( $this->json['choices']['colors'] ) ) { |
|
42 | - $this->json['choices']['colors'] = Kirki_Helper::get_material_design_colors( 'primary' ); |
|
41 | + if ( ! isset( $this->json[ 'choices' ][ 'colors' ] ) || empty( $this->json[ 'choices' ][ 'colors' ] ) ) { |
|
42 | + $this->json[ 'choices' ][ 'colors' ] = Kirki_Helper::get_material_design_colors( 'primary' ); |
|
43 | 43 | } |
44 | - if ( ! isset( $this->json['choices']['size'] ) || empty( $this->json['choices']['size'] ) ) { |
|
45 | - $this->json['choices']['size'] = 20; |
|
44 | + if ( ! isset( $this->json[ 'choices' ][ 'size' ] ) || empty( $this->json[ 'choices' ][ 'size' ] ) ) { |
|
45 | + $this->json[ 'choices' ][ 'size' ] = 20; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 |
@@ -24,8 +24,8 @@ |
||
24 | 24 | if ( ! is_array( $this->choices ) ) { |
25 | 25 | $this->choices = array(); |
26 | 26 | } |
27 | - $this->choices['element'] = 'input'; |
|
28 | - $this->choices['type'] = 'text'; |
|
27 | + $this->choices[ 'element' ] = 'input'; |
|
28 | + $this->choices[ 'type' ] = 'text'; |
|
29 | 29 | |
30 | 30 | } |
31 | 31 |
@@ -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 |
@@ -97,15 +97,15 @@ discard block |
||
97 | 97 | unset( $value[ $row_id ][ $subfield_id ] ); |
98 | 98 | } |
99 | 99 | // Get the subfield-type. |
100 | - if ( ! isset( $this->fields[ $subfield_id ]['type'] ) ) { |
|
100 | + if ( ! isset( $this->fields[ $subfield_id ][ 'type' ] ) ) { |
|
101 | 101 | continue; |
102 | 102 | } |
103 | - $subfield_type = $this->fields[ $subfield_id ]['type']; |
|
103 | + $subfield_type = $this->fields[ $subfield_id ][ 'type' ]; |
|
104 | 104 | |
105 | 105 | // Allow using a sanitize-callback on a per-field basis. |
106 | - if ( isset( $this->fields[ $subfield_id ]['sanitize_callback'] ) ) { |
|
106 | + if ( isset( $this->fields[ $subfield_id ][ 'sanitize_callback' ] ) ) { |
|
107 | 107 | |
108 | - $subfield_value = call_user_func( $this->fields[ $subfield_id ]['sanitize_callback'], $subfield_value ); |
|
108 | + $subfield_value = call_user_func( $this->fields[ $subfield_id ][ 'sanitize_callback' ], $subfield_value ); |
|
109 | 109 | |
110 | 110 | } else { |
111 | 111 | |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | $subfield_value = (bool) $subfield_value; |
143 | 143 | break; |
144 | 144 | case 'select': |
145 | - if ( isset( $this->fields[ $subfield_id ]['multiple'] ) ) { |
|
146 | - if ( true === $this->fields[ $subfield_id ]['multiple'] ) { |
|
145 | + if ( isset( $this->fields[ $subfield_id ][ 'multiple' ] ) ) { |
|
146 | + if ( true === $this->fields[ $subfield_id ][ 'multiple' ] ) { |
|
147 | 147 | $multiple = 2; |
148 | 148 | } |
149 | - $multiple = (int) $this->fields[ $subfield_id ]['multiple']; |
|
149 | + $multiple = (int) $this->fields[ $subfield_id ][ 'multiple' ]; |
|
150 | 150 | if ( 1 < $multiple ) { |
151 | 151 | $subfield_value = (array) $subfield_value; |
152 | 152 | foreach ( $subfield_value as $sub_subfield_key => $sub_subfield_value ) { |
@@ -53,8 +53,8 @@ |
||
53 | 53 | public function to_json() { |
54 | 54 | parent::to_json(); |
55 | 55 | |
56 | - $this->json['palette'] = $this->palette; |
|
57 | - $this->json['choices']['alpha'] = ( isset( $this->choices['alpha'] ) && $this->choices['alpha'] ) ? 'true' : 'false'; |
|
58 | - $this->json['mode'] = $this->mode; |
|
56 | + $this->json[ 'palette' ] = $this->palette; |
|
57 | + $this->json[ 'choices' ][ 'alpha' ] = ( isset( $this->choices[ 'alpha' ] ) && $this->choices[ 'alpha' ] ) ? 'true' : 'false'; |
|
58 | + $this->json[ 'mode' ] = $this->mode; |
|
59 | 59 | } |
60 | 60 | } |
@@ -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 | } |
@@ -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' ), true ) ) ? '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 | } |