Completed
Pull Request — master (#1728)
by Aristeides
04:20 queued 02:06
created
field/class-kirki-field-image.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 		if ( ! is_array( $this->choices ) ) {
61 61
 			$this->choices = (array) $this->choices;
62 62
 		}
63
-		if ( ! isset( $this->choices['save_as'] ) ) {
64
-			$this->choices['save_as'] = 'url';
63
+		if ( ! isset( $this->choices[ 'save_as' ] ) ) {
64
+			$this->choices[ 'save_as' ] = 'url';
65 65
 		}
66
-		if ( ! isset( $this->choices['labels'] ) ) {
67
-			$this->choices['labels'] = array();
66
+		if ( ! isset( $this->choices[ 'labels' ] ) ) {
67
+			$this->choices[ 'labels' ] = array();
68 68
 		}
69 69
 		$this->set_button_labels();
70
-		$this->choices['labels'] = wp_parse_args( $this->choices['labels'], $this->button_labels );
70
+		$this->choices[ 'labels' ] = wp_parse_args( $this->choices[ 'labels' ], $this->button_labels );
71 71
 	}
72 72
 
73 73
 	/**
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function sanitize( $value ) {
95 95
 
96
-		if ( isset( $this->choices['save_as'] ) && 'array' === $this->choices['save_as'] ) {
96
+		if ( isset( $this->choices[ 'save_as' ] ) && 'array' === $this->choices[ 'save_as' ] ) {
97 97
 			return array(
98
-				'id'     => ( isset( $value['id'] ) && '' !== $value['id'] ) ? (int) $value['id'] : '',
99
-				'url'    => ( isset( $value['url'] ) && '' !== $value['url'] ) ? esc_url_raw( $value['url'] ) : '',
100
-				'width'  => ( isset( $value['width'] ) && '' !== $value['width'] ) ? (int) $value['width'] : '',
101
-				'height' => ( isset( $value['height'] ) && '' !== $value['height'] ) ? (int) $value['height'] : '',
98
+				'id'     => ( isset( $value[ 'id' ] ) && '' !== $value[ 'id' ] ) ? (int) $value[ 'id' ] : '',
99
+				'url'    => ( isset( $value[ 'url' ] ) && '' !== $value[ 'url' ] ) ? esc_url_raw( $value[ 'url' ] ) : '',
100
+				'width'  => ( isset( $value[ 'width' ] ) && '' !== $value[ 'width' ] ) ? (int) $value[ 'width' ] : '',
101
+				'height' => ( isset( $value[ 'height' ] ) && '' !== $value[ 'height' ] ) ? (int) $value[ 'height' ] : '',
102 102
 			);
103 103
 		}
104
-		if ( isset( $this->choices['save_as'] ) && 'id' === $this->choices['save_as'] ) {
104
+		if ( isset( $this->choices[ 'save_as' ] ) && 'id' === $this->choices[ 'save_as' ] ) {
105 105
 			return absint( $value );
106 106
 		}
107 107
 		if ( is_string( $value ) ) {
Please login to merge, or discard this patch.
controls/php/class-kirki-control-upload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,6 +32,6 @@
 block discarded – undo
32 32
 	 */
33 33
 	public function to_json() {
34 34
 		parent::to_json();
35
-		$this->json['required'] = $this->required;
35
+		$this->json[ 'required' ] = $this->required;
36 36
 	}
37 37
 }
Please login to merge, or discard this patch.
controls/php/class-kirki-control-cropped-image.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,6 +32,6 @@
 block discarded – undo
32 32
 	 */
33 33
 	public function to_json() {
34 34
 		parent::to_json();
35
-		$this->json['required'] = $this->required;
35
+		$this->json[ 'required' ] = $this->required;
36 36
 	}
37 37
 }
Please login to merge, or discard this patch.
core/class-kirki.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 		$config                             = Kirki_Config::get_instance( $config_id, $args );
146 146
 		$config_args                        = $config->get_config();
147
-		self::$config[ $config_args['id'] ] = $config_args;
147
+		self::$config[ $config_args[ 'id' ] ] = $config_args;
148 148
 	}
149 149
 
150 150
 	/**
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public static function add_panel( $id = '', $args = array() ) {
159 159
 
160
-		$args['id']          = esc_attr( $id );
161
-		$args['description'] = ( isset( $args['description'] ) ) ? $args['description'] : '';
162
-		$args['priority']    = ( isset( $args['priority'] ) ) ? absint( $args['priority'] ) : 10;
163
-		$args['type']        = ( isset( $args['type'] ) ) ? $args['type'] : 'default';
164
-		$args['type']        = 'kirki-' . $args['type'];
160
+		$args[ 'id' ]          = esc_attr( $id );
161
+		$args[ 'description' ] = ( isset( $args[ 'description' ] ) ) ? $args[ 'description' ] : '';
162
+		$args[ 'priority' ]    = ( isset( $args[ 'priority' ] ) ) ? absint( $args[ 'priority' ] ) : 10;
163
+		$args[ 'type' ]        = ( isset( $args[ 'type' ] ) ) ? $args[ 'type' ] : 'default';
164
+		$args[ 'type' ]        = 'kirki-' . $args[ 'type' ];
165 165
 
166
-		self::$panels[ $args['id'] ] = $args;
166
+		self::$panels[ $args[ 'id' ] ] = $args;
167 167
 	}
168 168
 
169 169
 	/**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public static function remove_panel( $id = '' ) {
178 178
 		if ( ! in_array( $id, self::$panels_to_remove, true ) ) {
179
-			self::$panels_to_remove[] = $id;
179
+			self::$panels_to_remove[ ] = $id;
180 180
 		}
181 181
 	}
182 182
 
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public static function add_section( $id, $args ) {
192 192
 
193
-		$args['id']          = esc_attr( $id );
194
-		$args['panel']       = ( isset( $args['panel'] ) ) ? esc_attr( $args['panel'] ) : '';
195
-		$args['description'] = ( isset( $args['description'] ) ) ? $args['description'] : '';
196
-		$args['priority']    = ( isset( $args['priority'] ) ) ? absint( $args['priority'] ) : 10;
197
-		$args['type']        = ( isset( $args['type'] ) ) ? $args['type'] : 'default';
198
-		$args['type']        = 'kirki-' . $args['type'];
193
+		$args[ 'id' ]          = esc_attr( $id );
194
+		$args[ 'panel' ]       = ( isset( $args[ 'panel' ] ) ) ? esc_attr( $args[ 'panel' ] ) : '';
195
+		$args[ 'description' ] = ( isset( $args[ 'description' ] ) ) ? $args[ 'description' ] : '';
196
+		$args[ 'priority' ]    = ( isset( $args[ 'priority' ] ) ) ? absint( $args[ 'priority' ] ) : 10;
197
+		$args[ 'type' ]        = ( isset( $args[ 'type' ] ) ) ? $args[ 'type' ] : 'default';
198
+		$args[ 'type' ]        = 'kirki-' . $args[ 'type' ];
199 199
 
200
-		self::$sections[ $args['id'] ] = $args;
200
+		self::$sections[ $args[ 'id' ] ] = $args;
201 201
 	}
202 202
 
203 203
 	/**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public static function remove_section( $id = '' ) {
212 212
 		if ( ! in_array( $id, self::$sections_to_remove, true ) ) {
213
-			self::$sections_to_remove[] = $id;
213
+			self::$sections_to_remove[ ] = $id;
214 214
 		}
215 215
 	}
216 216
 
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
 		}
230 230
 
231 231
 		// Early exit if 'type' is not defined.
232
-		if ( ! isset( $args['type'] ) ) {
232
+		if ( ! isset( $args[ 'type' ] ) ) {
233 233
 			return;
234 234
 		}
235 235
 
236
-		$str       = str_replace( array( '-', '_' ), ' ', $args['type'] );
236
+		$str       = str_replace( array( '-', '_' ), ' ', $args[ 'type' ] );
237 237
 		$classname = 'Kirki_Field_' . str_replace( ' ', '_', ucwords( $str ) );
238 238
 		if ( class_exists( $classname ) ) {
239 239
 			new $classname( $config_id, $args );
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public static function remove_control( $id ) {
263 263
 		if ( ! in_array( $id, self::$controls_to_remove, true ) ) {
264
-			self::$controls_to_remove[] = $id;
264
+			self::$controls_to_remove[ ] = $id;
265 265
 		}
266 266
 	}
267 267
 
Please login to merge, or discard this patch.
controls/php/class-kirki-control-base.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -136,37 +136,37 @@
 block discarded – undo
136 136
 		// Get the basics from the parent class.
137 137
 		parent::to_json();
138 138
 		// Default.
139
-		$this->json['default'] = $this->setting->default;
139
+		$this->json[ 'default' ] = $this->setting->default;
140 140
 		if ( isset( $this->default ) ) {
141
-			$this->json['default'] = $this->default;
141
+			$this->json[ 'default' ] = $this->default;
142 142
 		}
143 143
 		// Required.
144
-		$this->json['required'] = $this->required;
144
+		$this->json[ 'required' ] = $this->required;
145 145
 		// Output.
146
-		$this->json['output'] = $this->output;
146
+		$this->json[ 'output' ] = $this->output;
147 147
 		// Value.
148
-		$this->json['value'] = $this->value();
148
+		$this->json[ 'value' ] = $this->value();
149 149
 		// Choices.
150
-		$this->json['choices'] = $this->choices;
150
+		$this->json[ 'choices' ] = $this->choices;
151 151
 		// The link.
152
-		$this->json['link'] = $this->get_link();
152
+		$this->json[ 'link' ] = $this->get_link();
153 153
 		// The ID.
154
-		$this->json['id'] = $this->id;
154
+		$this->json[ 'id' ] = $this->id;
155 155
 		// Translation strings.
156
-		$this->json['l10n'] = $this->l10n();
156
+		$this->json[ 'l10n' ] = $this->l10n();
157 157
 		// The ajaxurl in case we need it.
158
-		$this->json['ajaxurl'] = admin_url( 'admin-ajax.php' );
158
+		$this->json[ 'ajaxurl' ] = admin_url( 'admin-ajax.php' );
159 159
 		// Input attributes.
160
-		$this->json['inputAttrs'] = '';
160
+		$this->json[ 'inputAttrs' ] = '';
161 161
 		foreach ( $this->input_attrs as $attr => $value ) {
162
-			$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
162
+			$this->json[ 'inputAttrs' ] .= $attr . '="' . esc_attr( $value ) . '" ';
163 163
 		}
164 164
 		// The kirki-config.
165
-		$this->json['kirkiConfig'] = $this->kirki_config;
165
+		$this->json[ 'kirkiConfig' ] = $this->kirki_config;
166 166
 		// The option-type.
167
-		$this->json['kirkiOptionType'] = $this->option_type;
167
+		$this->json[ 'kirkiOptionType' ] = $this->option_type;
168 168
 		// The option-name.
169
-		$this->json['kirkiOptionName'] = $this->option_name;
169
+		$this->json[ 'kirkiOptionName' ] = $this->option_name;
170 170
 	}
171 171
 
172 172
 	/**
Please login to merge, or discard this patch.