Completed
Pull Request — develop (#1975)
by Juliette
07:09
created
field/class-kirki-field-spacing.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,10 +68,10 @@
 block discarded – undo
68 68
 
69 69
 		$default_args = array(
70 70
 			'controls' => array(
71
-				'top'    => ( isset( $this->default['top'] ) ),
72
-				'bottom' => ( isset( $this->default['top'] ) ),
73
-				'left'   => ( isset( $this->default['top'] ) ),
74
-				'right'  => ( isset( $this->default['top'] ) ),
71
+				'top'    => ( isset( $this->default[ 'top' ] ) ),
72
+				'bottom' => ( isset( $this->default[ 'top' ] ) ),
73
+				'left'   => ( isset( $this->default[ 'top' ] ) ),
74
+				'right'  => ( isset( $this->default[ 'top' ] ) ),
75 75
 			),
76 76
 			'labels'   => array(
77 77
 				'top'    => esc_attr__( 'Top', 'kirki' ),
Please login to merge, or discard this patch.
kirki.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/class-kirki-section.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,16 +49,16 @@
 block discarded – undo
49 49
 		// The default class to be used when creating a section.
50 50
 		$section_classname = 'WP_Customize_Section';
51 51
 
52
-		if ( isset( $args['type'] ) && array_key_exists( $args['type'], $this->section_types ) ) {
53
-			$section_classname = $this->section_types[ $args['type'] ];
52
+		if ( isset( $args[ 'type' ] ) && array_key_exists( $args[ 'type' ], $this->section_types ) ) {
53
+			$section_classname = $this->section_types[ $args[ 'type' ] ];
54 54
 		}
55
-		if ( isset( $args['type'] ) && 'kirki-outer' === $args['type'] ) {
56
-			$args['type']      = 'outer';
55
+		if ( isset( $args[ 'type' ] ) && 'kirki-outer' === $args[ 'type' ] ) {
56
+			$args[ 'type' ]      = 'outer';
57 57
 			$section_classname = 'WP_Customize_Section';
58 58
 		}
59 59
 
60 60
 		// Add the section.
61
-		$wp_customize->add_section( new $section_classname( $wp_customize, sanitize_key( $args['id'] ), $args ) );
61
+		$wp_customize->add_section( new $section_classname( $wp_customize, sanitize_key( $args[ 'id' ] ), $args ) );
62 62
 
63 63
 	}
64 64
 }
Please login to merge, or discard this patch.
core/class-kirki-settings.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -67,28 +67,28 @@
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.
class-kirki-autoload.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -89,23 +89,23 @@  discard block
 block discarded – undo
89 89
 		$name_parts = explode( '_', str_replace( 'Kirki_', '', $class_name ) );
90 90
 
91 91
 		// Handle modules loading.
92
-		if ( isset( $name_parts[0] ) && 'Modules' === $name_parts[0] ) {
92
+		if ( isset( $name_parts[ 0 ] ) && 'Modules' === $name_parts[ 0 ] ) {
93 93
 			$path    = dirname( __FILE__ ) . '/modules/';
94 94
 			$path   .= strtolower( str_replace( '_', '-', str_replace( 'Kirki_Modules_', '', $class_name ) ) ) . '/';
95
-			$paths[] = $path . $filename;
95
+			$paths[ ] = $path . $filename;
96 96
 		}
97 97
 
98
-		if ( isset( $name_parts[0] ) ) {
98
+		if ( isset( $name_parts[ 0 ] ) ) {
99 99
 
100 100
 			// Handle controls loading.
101
-			if ( 'Control' === $name_parts[0] || 'Settings' === $name_parts[0] ) {
101
+			if ( 'Control' === $name_parts[ 0 ] || 'Settings' === $name_parts[ 0 ] ) {
102 102
 				$path    = dirname( __FILE__ ) . '/controls/php/';
103
-				$paths[] = $path . $filename;
103
+				$paths[ ] = $path . $filename;
104 104
 			}
105 105
 		}
106 106
 
107
-		$paths[] = dirname( __FILE__ ) . '/core/' . $filename;
108
-		$paths[] = dirname( __FILE__ ) . '/lib/' . $filename;
107
+		$paths[ ] = dirname( __FILE__ ) . '/core/' . $filename;
108
+		$paths[ ] = dirname( __FILE__ ) . '/lib/' . $filename;
109 109
 
110 110
 		$substr   = str_replace( 'Kirki_', '', $class_name );
111 111
 		$exploded = explode( '_', $substr );
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$previous_path = '';
115 115
 		for ( $i = 0; $i < $levels; $i++ ) {
116
-			$paths[]        = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename;
116
+			$paths[ ]        = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename;
117 117
 			$previous_path .= strtolower( $exploded[ $i ] ) . '/';
118 118
 		}
119 119
 		return $paths;
Please login to merge, or discard this patch.
core/class-kirki-values.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function typography_field_tweaks( $value, $field_id ) {
42 42
 
43
-		if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) ) {
44
-			if ( 'kirki-typography' === Kirki::$fields[ $field_id ]['type'] ) {
43
+		if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'type' ] ) ) {
44
+			if ( 'kirki-typography' === Kirki::$fields[ $field_id ][ 'type' ] ) {
45 45
 
46 46
 				// Sanitize the value.
47 47
 				// This also adds font-weight if it doesn't already exist.
48 48
 				$value = Kirki_Field_Typography::sanitize( $value );
49 49
 
50 50
 				// Combine font-family and font-backup.
51
-				if ( isset( $value['font-family'] ) && isset( $value['font-backup'] ) ) {
52
-					$value['font-family'] .= ', ' . $value['font-backup'];
53
-					unset( $value['font-backup'] );
51
+				if ( isset( $value[ 'font-family' ] ) && isset( $value[ 'font-backup' ] ) ) {
52
+					$value[ 'font-family' ] .= ', ' . $value[ 'font-backup' ];
53
+					unset( $value[ 'font-backup' ] );
54 54
 				}
55 55
 			}
56 56
 		}
@@ -87,39 +87,39 @@  discard block
 block discarded – undo
87 87
 			$config_id = 'global';
88 88
 		}
89 89
 
90
-		if ( 'theme_mod' === Kirki::$config[ $config_id ]['option_type'] ) {
90
+		if ( 'theme_mod' === Kirki::$config[ $config_id ][ 'option_type' ] ) {
91 91
 
92 92
 			// We're using theme_mods so just get the value using get_theme_mod.
93 93
 			$default_value = null;
94
-			if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) {
95
-				$default_value = Kirki::$fields[ $field_id ]['default'];
94
+			if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) {
95
+				$default_value = Kirki::$fields[ $field_id ][ 'default' ];
96 96
 			}
97 97
 			$value = get_theme_mod( $field_id, $default_value );
98 98
 			return apply_filters( 'kirki_values_get_value', $value, $field_id );
99 99
 		}
100 100
 
101
-		if ( 'option' === Kirki::$config[ $config_id ]['option_type'] ) {
101
+		if ( 'option' === Kirki::$config[ $config_id ][ 'option_type' ] ) {
102 102
 
103 103
 			// We're using options.
104
-			if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) {
104
+			if ( '' !== Kirki::$config[ $config_id ][ 'option_name' ] ) {
105 105
 
106 106
 				// Options are serialized as a single option in the db.
107 107
 				// We'll have to get the option and then get the item from the array.
108
-				$options = get_option( Kirki::$config[ $config_id ]['option_name'] );
108
+				$options = get_option( Kirki::$config[ $config_id ][ 'option_name' ] );
109 109
 
110
-				if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) {
111
-					$field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']';
110
+				if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']' ] ) ) {
111
+					$field_id = Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']';
112 112
 				}
113
-				$setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) );
113
+				$setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ][ 'option_name' ] . '[', '', $field_id ) );
114 114
 
115
-				$default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) ? Kirki::$fields[ $field_id ]['default'] : '';
115
+				$default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) ? Kirki::$fields[ $field_id ][ 'default' ] : '';
116 116
 				$value         = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value;
117 117
 				$value         = maybe_unserialize( $value );
118 118
 				return apply_filters( 'kirki_values_get_value', $value, $field_id );
119 119
 			}
120 120
 
121 121
 			// Each option separately saved in the db.
122
-			$value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] );
122
+			$value = get_option( $field_id, Kirki::$fields[ $field_id ][ 'default' ] );
123 123
 			return apply_filters( 'kirki_values_get_value', $value, $field_id );
124 124
 
125 125
 		} // End if().
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
 	 * @return string|array
138 138
 	 */
139 139
 	public static function get_sanitized_field_value( $field ) {
140
-		$value = $field['default'];
141
-		if ( isset( $field['option_type'] ) && 'theme_mod' === $field['option_type'] ) {
142
-			$value = get_theme_mod( $field['settings'], $field['default'] );
143
-		} elseif ( isset( $field['option_type'] ) && 'option' === $field['option_type'] ) {
144
-			if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) {
145
-				$all_values     = get_option( $field['option_name'], array() );
146
-				$sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] );
140
+		$value = $field[ 'default' ];
141
+		if ( isset( $field[ 'option_type' ] ) && 'theme_mod' === $field[ 'option_type' ] ) {
142
+			$value = get_theme_mod( $field[ 'settings' ], $field[ 'default' ] );
143
+		} elseif ( isset( $field[ 'option_type' ] ) && 'option' === $field[ 'option_type' ] ) {
144
+			if ( isset( $field[ 'option_name' ] ) && '' !== $field[ 'option_name' ] ) {
145
+				$all_values     = get_option( $field[ 'option_name' ], array() );
146
+				$sub_setting_id = str_replace( array( ']', $field[ 'option_name' ] . '[' ), '', $field[ 'settings' ] );
147 147
 				if ( isset( $all_values[ $sub_setting_id ] ) ) {
148 148
 					$value = $all_values[ $sub_setting_id ];
149 149
 				}
150 150
 			} else {
151
-				$value = get_option( $field['settings'], $field['default'] );
151
+				$value = get_option( $field[ 'settings' ], $field[ 'default' ] );
152 152
 			}
153 153
 		}
154 154
 
Please login to merge, or discard this patch.
core/class-kirki-config.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
modules/loading/class-kirki-modules-loading.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-modules-webfonts.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -169,18 +169,18 @@
 block discarded – undo
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
 						}
Please login to merge, or discard this patch.