@@ -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 | } |
@@ -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 |
@@ -66,8 +66,8 @@ |
||
66 | 66 | $fields = Kirki::$fields; |
67 | 67 | $data = array(); |
68 | 68 | foreach ( $fields as $field ) { |
69 | - if ( isset( $field['transport'] ) && 'postMessage' === $field['transport'] && isset( $field['js_vars'] ) && ! empty( $field['js_vars'] ) && is_array( $field['js_vars'] ) && isset( $field['settings'] ) ) { |
|
70 | - $data[] = $field; |
|
69 | + if ( isset( $field[ 'transport' ] ) && 'postMessage' === $field[ 'transport' ] && isset( $field[ 'js_vars' ] ) && ! empty( $field[ 'js_vars' ] ) && is_array( $field[ 'js_vars' ] ) && isset( $field[ 'settings' ] ) ) { |
|
70 | + $data[ ] = $field; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | wp_localize_script( 'kirki_auto_postmessage', 'kirkiPostMessageFields', $data ); |
@@ -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 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
44 | 44 | } |
45 | 45 | $data = get_plugin_data( KIRKI_PLUGIN_FILE ); |
46 | - $version = ( isset( $data['Version'] ) ) ? $data['Version'] : false; |
|
46 | + $version = ( isset( $data[ 'Version' ] ) ) ? $data[ 'Version' ] : false; |
|
47 | 47 | define( 'KIRKI_VERSION', $version ); |
48 | 48 | } |
49 | 49 |
@@ -67,28 +67,28 @@ |
||
67 | 67 | |
68 | 68 | // Get the classname we'll be using to create our setting(s). |
69 | 69 | $classname = false; |
70 | - if ( isset( $args['option_type'] ) && array_key_exists( $args['option_type'], $this->setting_types ) ) { |
|
71 | - $classname = $this->setting_types[ $args['option_type'] ]; |
|
70 | + if ( isset( $args[ 'option_type' ] ) && array_key_exists( $args[ 'option_type' ], $this->setting_types ) ) { |
|
71 | + $classname = $this->setting_types[ $args[ 'option_type' ] ]; |
|
72 | 72 | } |
73 | - if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->setting_types ) ) { |
|
74 | - $args['type'] = 'default'; |
|
73 | + if ( ! isset( $args[ 'type' ] ) || ! array_key_exists( $args[ 'type' ], $this->setting_types ) ) { |
|
74 | + $args[ 'type' ] = 'default'; |
|
75 | 75 | } |
76 | - $classname = ! $classname ? $this->setting_types[ $args['type'] ] : $classname; |
|
76 | + $classname = ! $classname ? $this->setting_types[ $args[ 'type' ] ] : $classname; |
|
77 | 77 | |
78 | 78 | // If settings are defined as an array, then we need to go through them |
79 | 79 | // and call add_setting for each one of them separately. |
80 | - if ( isset( $args['settings'] ) && is_array( $args['settings'] ) ) { |
|
80 | + if ( isset( $args[ 'settings' ] ) && is_array( $args[ 'settings' ] ) ) { |
|
81 | 81 | |
82 | 82 | // Make sure defaults have been defined. |
83 | - if ( ! isset( $args['default'] ) || ! is_array( $args['default'] ) ) { |
|
84 | - $args['default'] = array(); |
|
83 | + if ( ! isset( $args[ 'default' ] ) || ! is_array( $args[ 'default' ] ) ) { |
|
84 | + $args[ 'default' ] = array(); |
|
85 | 85 | } |
86 | - foreach ( $args['settings'] as $key => $value ) { |
|
86 | + foreach ( $args[ 'settings' ] as $key => $value ) { |
|
87 | 87 | $default = ( isset( $defaults[ $key ] ) ) ? $defaults[ $key ] : ''; |
88 | - $this->add_setting( $classname, $value, $default, $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback'] ); |
|
88 | + $this->add_setting( $classname, $value, $default, $args[ 'option_type' ], $args[ 'capability' ], $args[ 'transport' ], $args[ 'sanitize_callback' ] ); |
|
89 | 89 | } |
90 | 90 | } |
91 | - $this->add_setting( $classname, $args['settings'], $args['default'], $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback'] ); |
|
91 | + $this->add_setting( $classname, $args[ 'settings' ], $args[ 'default' ], $args[ 'option_type' ], $args[ 'capability' ], $args[ 'transport' ], $args[ 'sanitize_callback' ] ); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | // Get defaults from the class. |
93 | 93 | $defaults = get_class_vars( __CLASS__ ); |
94 | 94 | // Skip what we don't need in this context. |
95 | - unset( $defaults['config_final'] ); |
|
96 | - unset( $defaults['instances'] ); |
|
95 | + unset( $defaults[ 'config_final' ] ); |
|
96 | + unset( $defaults[ 'instances' ] ); |
|
97 | 97 | // Apply any kirki_config global filters. |
98 | 98 | $defaults = apply_filters( 'kirki_config', $defaults ); |
99 | 99 | // Merge our args with the defaults. |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | public static function get_config_ids() { |
162 | 162 | $configs = array(); |
163 | 163 | foreach ( self::$instances as $instance ) { |
164 | - $configs[] = $instance->id; |
|
164 | + $configs[ ] = $instance->id; |
|
165 | 165 | } |
166 | 166 | return array_unique( $configs ); |
167 | 167 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | } |
64 | 64 | // Allow disabling the custom loader using the kirki_config filter. |
65 | 65 | $config = apply_filters( 'kirki_config', array() ); |
66 | - if ( isset( $config['disable_loader'] ) && true === $config['disable_loader'] ) { |
|
66 | + if ( isset( $config[ 'disable_loader' ] ) && true === $config[ 'disable_loader' ] ) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | // Add the "loading" icon. |
@@ -169,18 +169,18 @@ |
||
169 | 169 | */ |
170 | 170 | public function loop_fields( $config_id ) { |
171 | 171 | foreach ( Kirki::$fields as $field ) { |
172 | - if ( isset( $field['kirki_config'] ) && $config_id !== $field['kirki_config'] ) { |
|
172 | + if ( isset( $field[ 'kirki_config' ] ) && $config_id !== $field[ 'kirki_config' ] ) { |
|
173 | 173 | continue; |
174 | 174 | } |
175 | 175 | if ( true === apply_filters( "kirki_{$config_id}_webfonts_skip_hidden", true ) ) { |
176 | 176 | // Only continue if field dependencies are met. |
177 | - if ( ! empty( $field['required'] ) ) { |
|
177 | + if ( ! empty( $field[ 'required' ] ) ) { |
|
178 | 178 | $valid = true; |
179 | 179 | |
180 | - foreach ( $field['required'] as $requirement ) { |
|
181 | - if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) { |
|
182 | - $controller_value = Kirki_Values::get_value( $config_id, $requirement['setting'] ); |
|
183 | - if ( ! Kirki_Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) { |
|
180 | + foreach ( $field[ 'required' ] as $requirement ) { |
|
181 | + if ( isset( $requirement[ 'setting' ] ) && isset( $requirement[ 'value' ] ) && isset( $requirement[ 'operator' ] ) ) { |
|
182 | + $controller_value = Kirki_Values::get_value( $config_id, $requirement[ 'setting' ] ); |
|
183 | + if ( ! Kirki_Helper::compare_values( $controller_value, $requirement[ 'value' ], $requirement[ 'operator' ] ) ) { |
|
184 | 184 | $valid = false; |
185 | 185 | } |
186 | 186 | } |