@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | protected function process_output( $output, $value ) { |
25 | 25 | |
26 | - if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) { |
|
26 | + if ( ! isset( $output[ 'element' ] ) || ! isset( $output[ 'property' ] ) ) { |
|
27 | 27 | return; |
28 | 28 | } |
29 | 29 | $output = wp_parse_args( $output, array( |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | 'suffix' => '', |
34 | 34 | ) ); |
35 | 35 | if ( is_array( $value ) ) { |
36 | - if ( isset( $output['choice'] ) && $output['choice'] ) { |
|
37 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value[ $output['choice'] ] ) . $output['units'] . $output['suffix']; |
|
36 | + if ( isset( $output[ 'choice' ] ) && $output[ 'choice' ] ) { |
|
37 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value[ $output[ 'choice' ] ] ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
38 | 38 | return; |
39 | 39 | } |
40 | - if ( isset( $value['url'] ) ) { |
|
41 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix']; |
|
40 | + if ( isset( $value[ 'url' ] ) ) { |
|
41 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value[ 'url' ] ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | return; |
45 | 45 | } |
46 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
46 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
47 | 47 | } |
48 | 48 | } |
@@ -53,15 +53,15 @@ discard block |
||
53 | 53 | $upload_dir = wp_upload_dir(); |
54 | 54 | |
55 | 55 | $paths = array( |
56 | - 'file' => wp_normalize_path( $upload_dir['basedir'] . '/kirki-css/styles.css' ), |
|
57 | - 'folder' => wp_normalize_path( $upload_dir['basedir'] . '/kirki-css' ), |
|
56 | + 'file' => wp_normalize_path( $upload_dir[ 'basedir' ] . '/kirki-css/styles.css' ), |
|
57 | + 'folder' => wp_normalize_path( $upload_dir[ 'basedir' ] . '/kirki-css' ), |
|
58 | 58 | ); |
59 | 59 | |
60 | 60 | if ( 'file' === $context ) { |
61 | - return $paths['file']; |
|
61 | + return $paths[ 'file' ]; |
|
62 | 62 | } |
63 | 63 | if ( 'folder' === $context ) { |
64 | - return $paths['folder']; |
|
64 | + return $paths[ 'folder' ]; |
|
65 | 65 | } |
66 | 66 | return $paths; |
67 | 67 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function get_url() { |
78 | 78 | |
79 | 79 | $upload_dir = wp_upload_dir(); |
80 | - return esc_url_raw( $upload_dir['baseurl'] . '/kirki-css/styles.css' ); |
|
80 | + return esc_url_raw( $upload_dir[ 'baseurl' ] . '/kirki-css/styles.css' ); |
|
81 | 81 | |
82 | 82 | } |
83 | 83 |
@@ -126,12 +126,12 @@ |
||
126 | 126 | |
127 | 127 | $google_fonts = array(); |
128 | 128 | if ( is_array( $fonts ) ) { |
129 | - foreach ( $fonts['items'] as $font ) { |
|
130 | - $google_fonts[ $font['family'] ] = array( |
|
131 | - 'label' => $font['family'], |
|
132 | - 'variants' => $font['variants'], |
|
133 | - 'subsets' => $font['subsets'], |
|
134 | - 'category' => $font['category'], |
|
129 | + foreach ( $fonts[ 'items' ] as $font ) { |
|
130 | + $google_fonts[ $font[ 'family' ] ] = array( |
|
131 | + 'label' => $font[ 'family' ], |
|
132 | + 'variants' => $font[ 'variants' ], |
|
133 | + 'subsets' => $font[ 'subsets' ], |
|
134 | + 'category' => $font[ 'category' ], |
|
135 | 135 | ); |
136 | 136 | } |
137 | 137 | } |
@@ -89,15 +89,15 @@ |
||
89 | 89 | |
90 | 90 | // Parse sections and find ones with icons. |
91 | 91 | foreach ( $sections as $section ) { |
92 | - if ( isset( $section['icon'] ) ) { |
|
93 | - $this->add_icon( $section['id'], $section['icon'], 'section' ); |
|
92 | + if ( isset( $section[ 'icon' ] ) ) { |
|
93 | + $this->add_icon( $section[ 'id' ], $section[ 'icon' ], 'section' ); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | 97 | // Parse panels and find ones with icons. |
98 | 98 | foreach ( $panels as $panel ) { |
99 | - if ( isset( $panel['icon'] ) ) { |
|
100 | - $this->add_icon( $panel['id'], $panel['icon'], 'panel' ); |
|
99 | + if ( isset( $panel[ 'icon' ] ) ) { |
|
100 | + $this->add_icon( $panel[ 'id' ], $panel[ 'icon' ], 'panel' ); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 |
@@ -76,11 +76,11 @@ |
||
76 | 76 | |
77 | 77 | $fields = Kirki::$fields; |
78 | 78 | foreach ( $fields as $field ) { |
79 | - if ( isset( $field['tooltip'] ) && ! empty( $field['tooltip'] ) ) { |
|
80 | - $id = str_replace( '[', '-', str_replace( ']', '', $field['settings'] ) ); |
|
79 | + if ( isset( $field[ 'tooltip' ] ) && ! empty( $field[ 'tooltip' ] ) ) { |
|
80 | + $id = str_replace( '[', '-', str_replace( ']', '', $field[ 'settings' ] ) ); |
|
81 | 81 | $this->tooltips_content[ $id ] = array( |
82 | 82 | 'id' => $id, |
83 | - 'content' => wp_kses_post( $field['tooltip'] ), |
|
83 | + 'content' => wp_kses_post( $field[ 'tooltip' ] ), |
|
84 | 84 | ); |
85 | 85 | } |
86 | 86 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | public function to_json() { |
36 | 36 | parent::to_json(); |
37 | 37 | |
38 | - $this->json['icons'] = Kirki_Helper::get_dashicons(); |
|
38 | + $this->json[ 'icons' ] = Kirki_Helper::get_dashicons(); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -37,10 +37,10 @@ |
||
37 | 37 | |
38 | 38 | foreach ( $this->input_attrs as $attr => $value ) { |
39 | 39 | if ( 'style' !== $attr ) { |
40 | - $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
40 | + $this->json[ 'inputAttrs' ] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
41 | 41 | continue; |
42 | 42 | } |
43 | - $this->json['labelStyle'] = 'style="' . esc_attr( $value ) . '" '; |
|
43 | + $this->json[ 'labelStyle' ] = 'style="' . esc_attr( $value ) . '" '; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | } |
@@ -39,14 +39,14 @@ |
||
39 | 39 | if ( is_array( $this->choices ) ) { |
40 | 40 | foreach ( $this->choices as $choice => $value ) { |
41 | 41 | if ( 'labels' !== $choice && true === $value ) { |
42 | - $this->json['choices'][ $choice ] = true; |
|
42 | + $this->json[ 'choices' ][ $choice ] = true; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | - if ( is_array( $this->json['default'] ) ) { |
|
47 | - foreach ( $this->json['default'] as $key => $value ) { |
|
48 | - if ( isset( $this->json['choices'][ $key ] ) && ! isset( $this->json['value'][ $key ] ) ) { |
|
49 | - $this->json['value'][ $key ] = $value; |
|
46 | + if ( is_array( $this->json[ 'default' ] ) ) { |
|
47 | + foreach ( $this->json[ 'default' ] as $key => $value ) { |
|
48 | + if ( isset( $this->json[ 'choices' ][ $key ] ) && ! isset( $this->json[ 'value' ][ $key ] ) ) { |
|
49 | + $this->json[ 'value' ][ $key ] = $value; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
@@ -128,30 +128,30 @@ |
||
128 | 128 | // Get the basics from the parent class. |
129 | 129 | parent::to_json(); |
130 | 130 | // Default. |
131 | - $this->json['default'] = $this->setting->default; |
|
131 | + $this->json[ 'default' ] = $this->setting->default; |
|
132 | 132 | if ( isset( $this->default ) ) { |
133 | - $this->json['default'] = $this->default; |
|
133 | + $this->json[ 'default' ] = $this->default; |
|
134 | 134 | } |
135 | 135 | // Required. |
136 | - $this->json['required'] = $this->required; |
|
136 | + $this->json[ 'required' ] = $this->required; |
|
137 | 137 | // Output. |
138 | - $this->json['output'] = $this->output; |
|
138 | + $this->json[ 'output' ] = $this->output; |
|
139 | 139 | // Value. |
140 | - $this->json['value'] = $this->value(); |
|
140 | + $this->json[ 'value' ] = $this->value(); |
|
141 | 141 | // Choices. |
142 | - $this->json['choices'] = $this->choices; |
|
142 | + $this->json[ 'choices' ] = $this->choices; |
|
143 | 143 | // The link. |
144 | - $this->json['link'] = $this->get_link(); |
|
144 | + $this->json[ 'link' ] = $this->get_link(); |
|
145 | 145 | // The ID. |
146 | - $this->json['id'] = $this->id; |
|
146 | + $this->json[ 'id' ] = $this->id; |
|
147 | 147 | // Translation strings. |
148 | - $this->json['l10n'] = $this->l10n(); |
|
148 | + $this->json[ 'l10n' ] = $this->l10n(); |
|
149 | 149 | // The ajaxurl in case we need it. |
150 | - $this->json['ajaxurl'] = admin_url( 'admin-ajax.php' ); |
|
150 | + $this->json[ 'ajaxurl' ] = admin_url( 'admin-ajax.php' ); |
|
151 | 151 | // Input attributes. |
152 | - $this->json['inputAttrs'] = ''; |
|
152 | + $this->json[ 'inputAttrs' ] = ''; |
|
153 | 153 | foreach ( $this->input_attrs as $attr => $value ) { |
154 | - $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
154 | + $this->json[ 'inputAttrs' ] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 |