Completed
Push — trunk ( e1b1e7...167c89 )
by Justin
17:41 queued 04:12
created
includes/types/CMB2_Type_Base.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function __construct( CMB2_Types $types, $args = array() ) {
40 40
 		$this->types = $types;
41
-		$args['rendered'] = isset( $args['rendered'] ) ? (bool) $args['rendered'] : true;
41
+		$args[ 'rendered' ] = isset( $args[ 'rendered' ] ) ? (bool) $args[ 'rendered' ] : true;
42 42
 		$this->args = $args;
43 43
 	}
44 44
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @return string|CMB2_Type_Base           Rendered output or this object.
57 57
 	 */
58 58
 	public function rendered( $rendered ) {
59
-		if ( $this->args['rendered'] ) {
59
+		if ( $this->args[ 'rendered' ] ) {
60 60
 			return is_a( $rendered, __CLASS__ ) ? $rendered->rendered : $rendered;
61 61
 		}
62 62
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * Stores the rendered field output.
59 59
 	 *
60 60
 	 * @since  2.2.2
61
-	 * @param  string|CMB2_Type_Base $rendered Rendered output.
61
+	 * @param  string $rendered Rendered output.
62 62
 	 * @return string|CMB2_Type_Base           Rendered output or this object.
63 63
 	 */
64 64
 	public function rendered( $rendered ) {
@@ -117,7 +117,6 @@  discard block
 block discarded – undo
117 117
 	/**
118 118
 	 * Fall back to CMB2_Types methods
119 119
 	 *
120
-	 * @param string $field
121 120
 	 * @throws Exception Throws an exception if the field is invalid.
122 121
 	 * @return mixed
123 122
 	 */
@@ -139,7 +138,7 @@  discard block
 block discarded – undo
139 138
 	 *
140 139
 	 * @param string $field
141 140
 	 * @throws Exception Throws an exception if the field is invalid.
142
-	 * @return mixed
141
+	 * @return CMB2_Field
143 142
 	 */
144 143
 	public function __get( $field ) {
145 144
 		switch ( $field ) {
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Text.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@
 block discarded – undo
50 50
 			'js_dependencies' => array(),
51 51
 		), $args );
52 52
 
53
-		if ( ! empty( $a['js_dependencies'] ) ) {
54
-			$this->field->add_js_dependencies( $a['js_dependencies'] );
53
+		if ( ! empty( $a[ 'js_dependencies' ] ) ) {
54
+			$this->field->add_js_dependencies( $a[ 'js_dependencies' ] );
55 55
 		}
56 56
 
57 57
 		return $this->rendered(
58
-			sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc', 'js_dependencies' ) ), $a['desc'] )
58
+			sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc', 'js_dependencies' ) ), $a[ 'desc' ] )
59 59
 		);
60 60
 	}
61 61
 }
Please login to merge, or discard this patch.
includes/CMB2_Sanitize.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 		global $wp_locale;
174 174
 
175
-		$search = array( $wp_locale->number_format['thousands_sep'], $wp_locale->number_format['decimal_point'] );
175
+		$search = array( $wp_locale->number_format[ 'thousands_sep' ], $wp_locale->number_format[ 'decimal_point' ] );
176 176
 		$replace = array( '', '.' );
177 177
 
178 178
 		// for repeatable
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 			return $repeat_value;
216 216
 		}
217 217
 
218
-		if ( isset( $this->value['date'], $this->value['time'] ) ) {
219
-			$this->value = $this->field->get_timestamp_from_value( $this->value['date'] . ' ' . $this->value['time'] );
218
+		if ( isset( $this->value[ 'date' ], $this->value[ 'time' ] ) ) {
219
+			$this->value = $this->field->get_timestamp_from_value( $this->value[ 'date' ] . ' ' . $this->value[ 'time' ] );
220 220
 		}
221 221
 
222 222
 		if ( $tz_offset = $this->field->field_timezone_offset() ) {
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 		$tzstring = null;
255 255
 
256 256
 		if ( is_array( $this->value ) && array_key_exists( 'timezone', $this->value ) ) {
257
-			$tzstring = $this->value['timezone'];
257
+			$tzstring = $this->value[ 'timezone' ];
258 258
 		}
259 259
 
260 260
 		if ( empty( $tzstring ) ) {
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 			$tzstring = false !== $tzstring ? $tzstring : timezone_name_from_abbr( '', 0, 0 );
275 275
 		}
276 276
 
277
-		$full_format = $this->field->args['date_format'] . ' ' . $this->field->args['time_format'];
278
-		$full_date   = $this->value['date'] . ' ' . $this->value['time'];
277
+		$full_format = $this->field->args[ 'date_format' ] . ' ' . $this->field->args[ 'time_format' ];
278
+		$full_date   = $this->value[ 'date' ] . ' ' . $this->value[ 'time' ];
279 279
 
280 280
 		try {
281 281
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 			} else {
299 299
 				// Save the utc timestamp supporting field
300 300
 				if ( $repeat ) {
301
-					$utc_values[ $utc_key ][] = $utc_stamp;
301
+					$utc_values[ $utc_key ][ ] = $utc_stamp;
302 302
 				} else {
303 303
 					$this->_save_utc_value( $utc_key, $utc_stamp );
304 304
 				}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			if ( $this->value ) {
434 434
 				$val = $this->$method( true );
435 435
 				if ( ! empty( $val ) ) {
436
-					$new_value[] = $val;
436
+					$new_value[ ] = $val;
437 437
 				}
438 438
 			}
439 439
 		}
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -433,6 +433,7 @@  discard block
 block discarded – undo
433 433
 	 * Gets the values for the `file` field type from the data being saved.
434 434
 	 *
435 435
 	 * @since  2.2.0
436
+	 * @param string $id_key
436 437
 	 */
437 438
 	public function _get_group_file_value_array( $id_key ) {
438 439
 		$alldata = $this->field->group->data_to_save;
@@ -460,6 +461,7 @@  discard block
 block discarded – undo
460 461
 	 * Peforms saving of `file` attachement's ID
461 462
 	 *
462 463
 	 * @since  1.1.0
464
+	 * @param string $file_id_key
463 465
 	 */
464 466
 	public function _save_file_id_value( $file_id_key ) {
465 467
 		$id_field = $this->_new_supporting_field( $file_id_key );
@@ -481,6 +483,7 @@  discard block
 block discarded – undo
481 483
 	 * Peforms saving of `text_datetime_timestamp_timezone` utc timestamp
482 484
 	 *
483 485
 	 * @since  2.2.0
486
+	 * @param string $utc_key
484 487
 	 */
485 488
 	public function _save_utc_value( $utc_key, $utc_stamp ) {
486 489
 		return $this->_new_supporting_field( $utc_key )->save_field( $utc_stamp );
Please login to merge, or discard this patch.
includes/helper-functions.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -317,8 +317,8 @@
 block discarded – undo
317 317
 	 * Reimplementation of DateTime::createFromFormat for PHP < 5.3. :(
318 318
 	 * Borrowed from http://stackoverflow.com/questions/5399075/php-datetimecreatefromformat-in-5-2
319 319
 	 *
320
-	 * @param $date_format
321
-	 * @param $date_value
320
+	 * @param string $date_format
321
+	 * @param string $date_value
322 322
 	 *
323 323
 	 * @return DateTime
324 324
 	 */
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -96,18 +96,18 @@  discard block
 block discarded – undo
96 96
 	$oembed = cmb2_ajax()->get_oembed_no_edit( $args );
97 97
 
98 98
 	// Send back our embed
99
-	if ( $oembed['embed'] && $oembed['embed'] != $oembed['fallback'] ) {
100
-		return '<div class="cmb2-oembed">' . $oembed['embed'] . '</div>';
99
+	if ( $oembed[ 'embed' ] && $oembed[ 'embed' ] != $oembed[ 'fallback' ] ) {
100
+		return '<div class="cmb2-oembed">' . $oembed[ 'embed' ] . '</div>';
101 101
 	}
102 102
 
103 103
 	$error = sprintf(
104 104
 		/* translators: 1: results for. 2: link to codex.wordpress.org/Embeds */
105 105
 		esc_html__( 'No oEmbed Results Found for %1$s. View more info at %2$s.', 'cmb2' ),
106
-		$oembed['fallback'],
106
+		$oembed[ 'fallback' ],
107 107
 		'<a href="https://codex.wordpress.org/Embeds" target="_blank">codex.wordpress.org/Embeds</a>'
108 108
 	);
109 109
 
110
-	if ( isset( $args['wp_error'] ) && $args['wp_error'] ) {
110
+	if ( isset( $args[ 'wp_error' ] ) && $args[ 'wp_error' ] ) {
111 111
 		return new WP_Error( 'cmb2_get_oembed_result', $error, compact( 'oembed', 'args' ) );
112 112
 	}
113 113
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		$cmb = CMB2_Boxes::get( $meta_box );
230 230
 	} else {
231 231
 		// See if we already have an instance of this metabox
232
-		$cmb = CMB2_Boxes::get( $meta_box['id'] );
232
+		$cmb = CMB2_Boxes::get( $meta_box[ 'id' ] );
233 233
 		// If not, we'll initate a new metabox
234 234
 		$cmb = $cmb ? $cmb : new CMB2( $meta_box, $object_id );
235 235
 	}
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	) );
308 308
 
309 309
 	// Set object type explicitly (rather than trying to guess from context)
310
-	$cmb->object_type( $args['object_type'] );
310
+	$cmb->object_type( $args[ 'object_type' ] );
311 311
 
312 312
 	// Save the metabox if it's been submitted
313 313
 	// check permissions
@@ -315,32 +315,32 @@  discard block
 block discarded – undo
315 315
 	if (
316 316
 		$cmb->prop( 'save_fields' )
317 317
 		// check nonce
318
-		&& isset( $_POST['submit-cmb'], $_POST['object_id'], $_POST[ $cmb->nonce() ] )
318
+		&& isset( $_POST[ 'submit-cmb' ], $_POST[ 'object_id' ], $_POST[ $cmb->nonce() ] )
319 319
 		&& wp_verify_nonce( $_POST[ $cmb->nonce() ], $cmb->nonce() )
320
-		&& $object_id && $_POST['object_id'] == $object_id
320
+		&& $object_id && $_POST[ 'object_id' ] == $object_id
321 321
 	) {
322 322
 		$cmb->save_fields( $object_id, $cmb->object_type(), $_POST );
323 323
 	}
324 324
 
325 325
 	// Enqueue JS/CSS
326
-	if ( $args['cmb_styles'] ) {
326
+	if ( $args[ 'cmb_styles' ] ) {
327 327
 		CMB2_hookup::enqueue_cmb_css();
328 328
 	}
329 329
 
330
-	if ( $args['enqueue_js'] ) {
330
+	if ( $args[ 'enqueue_js' ] ) {
331 331
 		CMB2_hookup::enqueue_cmb_js();
332 332
 	}
333 333
 
334
-	$form_format = apply_filters( 'cmb2_get_metabox_form_format', $args['form_format'], $object_id, $cmb );
334
+	$form_format = apply_filters( 'cmb2_get_metabox_form_format', $args[ 'form_format' ], $object_id, $cmb );
335 335
 
336 336
 	$format_parts = explode( '%3$s', $form_format );
337 337
 
338 338
 	// Show cmb form
339
-	printf( $format_parts[0], $cmb->cmb_id, $object_id );
339
+	printf( $format_parts[ 0 ], $cmb->cmb_id, $object_id );
340 340
 	$cmb->show_form();
341 341
 
342
-	if ( isset( $format_parts[1] ) && $format_parts[1] ) {
343
-		printf( str_ireplace( '%4$s', '%1$s', $format_parts[1] ), $args['save_button'] );
342
+	if ( isset( $format_parts[ 1 ] ) && $format_parts[ 1 ] ) {
343
+		printf( str_ireplace( '%4$s', '%1$s', $format_parts[ 1 ] ), $args[ 'save_button' ] );
344 344
 	}
345 345
 
346 346
 }
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
  * @param  array $args      Optional arguments array
355 355
  */
356 356
 function cmb2_metabox_form( $meta_box, $object_id = 0, $args = array() ) {
357
-	if ( ! isset( $args['echo'] ) || $args['echo'] ) {
357
+	if ( ! isset( $args[ 'echo' ] ) || $args[ 'echo' ] ) {
358 358
 		cmb2_print_metabox_form( $meta_box, $object_id, $args );
359 359
 	} else {
360 360
 		return cmb2_get_metabox_form( $meta_box, $object_id, $args );
@@ -393,12 +393,12 @@  discard block
 block discarded – undo
393 393
 			 * 4 or 2 characters, as needed
394 394
 			 */
395 395
 			'%04d-%02d-%02d %02d:%02d:%02d',
396
-			$parsed_time['tm_year'] + 1900,  // This will be "111", so we need to add 1900.
397
-			$parsed_time['tm_mon'] + 1,      // This will be the month minus one, so we add one.
398
-			$parsed_time['tm_mday'],
399
-			$parsed_time['tm_hour'],
400
-			$parsed_time['tm_min'],
401
-			$parsed_time['tm_sec']
396
+			$parsed_time[ 'tm_year' ] + 1900, // This will be "111", so we need to add 1900.
397
+			$parsed_time[ 'tm_mon' ] + 1, // This will be the month minus one, so we add one.
398
+			$parsed_time[ 'tm_mday' ],
399
+			$parsed_time[ 'tm_hour' ],
400
+			$parsed_time[ 'tm_min' ],
401
+			$parsed_time[ 'tm_sec' ]
402 402
 		);
403 403
 
404 404
 		return new DateTime( $ymd );
Please login to merge, or discard this patch.
includes/CMB2_Ajax.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 	public function oembed_handler() {
60 60
 
61 61
 		// Verify our nonce
62
-		if ( ! ( isset( $_REQUEST['cmb2_ajax_nonce'], $_REQUEST['oembed_url'] ) && wp_verify_nonce( $_REQUEST['cmb2_ajax_nonce'], 'ajax_nonce' ) ) ) {
62
+		if ( ! ( isset( $_REQUEST[ 'cmb2_ajax_nonce' ], $_REQUEST[ 'oembed_url' ] ) && wp_verify_nonce( $_REQUEST[ 'cmb2_ajax_nonce' ], 'ajax_nonce' ) ) ) {
63 63
 			die();
64 64
 		}
65 65
 
66 66
 		// Sanitize our search string
67
-		$oembed_string = sanitize_text_field( $_REQUEST['oembed_url'] );
67
+		$oembed_string = sanitize_text_field( $_REQUEST[ 'oembed_url' ] );
68 68
 
69 69
 		// Send back error if empty
70 70
 		if ( empty( $oembed_string ) ) {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		}
73 73
 
74 74
 		// Set width of embed
75
-		$embed_width = isset( $_REQUEST['oembed_width'] ) && intval( $_REQUEST['oembed_width'] ) < 640 ? intval( $_REQUEST['oembed_width'] ) : '640';
75
+		$embed_width = isset( $_REQUEST[ 'oembed_width' ] ) && intval( $_REQUEST[ 'oembed_width' ] ) < 640 ? intval( $_REQUEST[ 'oembed_width' ] ) : '640';
76 76
 
77 77
 		// Set url
78 78
 		$oembed_url = esc_url( $oembed_string );
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 		// Get embed code (or fallback link)
86 86
 		$html = $this->get_oembed( array(
87 87
 			'url'         => $oembed_url,
88
-			'object_id'   => $_REQUEST['object_id'],
89
-			'object_type' => isset( $_REQUEST['object_type'] ) ? $_REQUEST['object_type'] : 'post',
88
+			'object_id'   => $_REQUEST[ 'object_id' ],
89
+			'object_type' => isset( $_REQUEST[ 'object_type' ] ) ? $_REQUEST[ 'object_type' ] : 'post',
90 90
 			'oembed_args' => $embed_args,
91
-			'field_id'    => $_REQUEST['field_id'],
91
+			'field_id'    => $_REQUEST[ 'field_id' ],
92 92
 		) );
93 93
 
94 94
 		wp_send_json_success( $html );
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 	public function get_oembed_no_edit( $args ) {
104 104
 		global $wp_embed;
105 105
 
106
-		$oembed_url = esc_url( $args['url'] );
106
+		$oembed_url = esc_url( $args[ 'url' ] );
107 107
 
108 108
 		// Sanitize object_id
109
-		$this->object_id = is_numeric( $args['object_id'] ) ? absint( $args['object_id'] ) : sanitize_text_field( $args['object_id'] );
109
+		$this->object_id = is_numeric( $args[ 'object_id' ] ) ? absint( $args[ 'object_id' ] ) : sanitize_text_field( $args[ 'object_id' ] );
110 110
 
111 111
 		$args = wp_parse_args( $args, array(
112 112
 			'object_type' => 'post',
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			'wp_error'    => false,
116 116
 		) );
117 117
 
118
-		$this->embed_args =& $args;
118
+		$this->embed_args = & $args;
119 119
 
120 120
 		/**
121 121
 		 * Set the post_ID so oEmbed won't fail
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 		$wp_embed->post_ID = $this->object_id;
125 125
 
126 126
 		// Special scenario if NOT a post object
127
-		if ( isset( $args['object_type'] ) && 'post' != $args['object_type'] ) {
127
+		if ( isset( $args[ 'object_type' ] ) && 'post' != $args[ 'object_type' ] ) {
128 128
 
129
-			if ( 'options-page' == $args['object_type'] ) {
129
+			if ( 'options-page' == $args[ 'object_type' ] ) {
130 130
 
131 131
 				// Bogus id to pass some numeric checks. Issue with a VERY large WP install?
132 132
 				$wp_embed->post_ID = 1987645321;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 			// Ok, we need to hijack the oembed cache system
136 136
 			$this->hijack = true;
137
-			$this->object_type = $args['object_type'];
137
+			$this->object_type = $args[ 'object_type' ];
138 138
 
139 139
 			// Gets ombed cache from our object's meta (vs postmeta)
140 140
 			add_filter( 'get_post_metadata', array( $this, 'hijack_oembed_cache_get' ), 10, 3 );
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
 		$embed_args = '';
148 148
 
149
-		foreach ( $args['oembed_args'] as $key => $val ) {
149
+		foreach ( $args[ 'oembed_args' ] as $key => $val ) {
150 150
 			$embed_args .= " $key=\"$val\"";
151 151
 		}
152 152
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 		$oembed = $this->get_oembed_no_edit( $args );
170 170
 
171 171
 		// Send back our embed
172
-		if ( $oembed['embed'] && $oembed['embed'] != $oembed['fallback'] ) {
173
-			return '<div class="cmb2-oembed embed-status">' . $oembed['embed'] . '<p class="cmb2-remove-wrapper"><a href="#" class="cmb2-remove-file-button" rel="' . $oembed['args']['field_id'] . '">' . esc_html__( 'Remove Embed', 'cmb2' ) . '</a></p></div>';
172
+		if ( $oembed[ 'embed' ] && $oembed[ 'embed' ] != $oembed[ 'fallback' ] ) {
173
+			return '<div class="cmb2-oembed embed-status">' . $oembed[ 'embed' ] . '<p class="cmb2-remove-wrapper"><a href="#" class="cmb2-remove-file-button" rel="' . $oembed[ 'args' ][ 'field_id' ] . '">' . esc_html__( 'Remove Embed', 'cmb2' ) . '</a></p></div>';
174 174
 		}
175 175
 
176 176
 		// Otherwise, send back error info that no oEmbeds were found
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 			sprintf(
180 180
 				/* translators: 1: results for. 2: link to codex.wordpress.org/Embeds */
181 181
 				esc_html__( 'No oEmbed Results Found for %1$s. View more info at %2$s.', 'cmb2' ),
182
-				$oembed['fallback'],
182
+				$oembed[ 'fallback' ],
183 183
 				'<a href="https://codex.wordpress.org/Embeds" target="_blank">codex.wordpress.org/Embeds</a>'
184 184
 			)
185 185
 		);
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	protected function cache_action( $meta_key ) {
246 246
 		$func_args = func_get_args();
247
-		$action    = isset( $func_args[1] ) ? 'update' : 'get';
247
+		$action    = isset( $func_args[ 1 ] ) ? 'update' : 'get';
248 248
 
249 249
 		if ( 'options-page' === $this->object_type ) {
250 250
 
251 251
 			$args = array( $meta_key );
252 252
 
253 253
 			if ( 'update' === $action ) {
254
-				$args[] = $func_args[1];
255
-				$args[] = true;
254
+				$args[ ] = $func_args[ 1 ];
255
+				$args[ ] = true;
256 256
 			}
257 257
 
258 258
 			// Cache the result to our options
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 		} else {
261 261
 
262 262
 			$args = array( $this->object_type, $this->object_id, $meta_key );
263
-			$args[] = 'update' === $action ? $func_args : true;
263
+			$args[ ] = 'update' === $action ? $func_args : true;
264 264
 
265 265
 			// Cache the result to our metadata
266 266
 			$status = call_user_func_array( $action . '_metadata', $args );
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Wysiwyg.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		) );
29 29
 
30 30
 		if ( ! $field->group ) {
31
-			return $this->rendered( $this->get_wp_editor( $a ) . $a['desc'] );
31
+			return $this->rendered( $this->get_wp_editor( $a ) . $a[ 'desc' ] );
32 32
 		}
33 33
 
34 34
 		// wysiwyg fields in a group need some special handling.
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	protected function get_wp_editor( $args ) {
54 54
 		ob_start();
55
-		wp_editor( $args['value'], $args['id'], $args['options'] );
55
+		wp_editor( $args[ 'value' ], $args[ 'id' ], $args[ 'options' ] );
56 56
 		return ob_get_clean();
57 57
 	}
58 58
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		$group_id = $this->field->group->id();
61 61
 		$field_id = $this->field->id( true );
62 62
 		$options  = $this->field->options();
63
-		$options['textarea_name'] = 'cmb2_n_' . $group_id . $field_id;
63
+		$options[ 'textarea_name' ] = 'cmb2_n_' . $group_id . $field_id;
64 64
 
65 65
 		// Initate the editor with special id/value/name so we can retrieve the options in JS.
66 66
 		$editor = $this->get_wp_editor( array(
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		// And put the editor instance in a JS template wrapper.
84 84
 		echo '<script type="text/template" id="tmpl-cmb2-wysiwyg-' . $group_id . '-' . $field_id . '">';
85 85
 		// Need to wrap the template in a wrapper div w/ specific data attributes which will be used when adding/removing rows.
86
-		echo '<div class="cmb2-wysiwyg-inner-wrap" data-iterator="{{ data.iterator }}" data-groupid="'. $group_id .'" data-id="'. $field_id .'">'. $editor .'</div>';
86
+		echo '<div class="cmb2-wysiwyg-inner-wrap" data-iterator="{{ data.iterator }}" data-groupid="' . $group_id . '" data-id="' . $field_id . '">' . $editor . '</div>';
87 87
 		echo '</script>';
88 88
 	}
89 89
 
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Title.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
 		return $this->rendered(
29 29
 			sprintf(
30 30
 				'<%1$s %2$s>%3$s</%1$s>%4$s',
31
-				$a['tag'],
31
+				$a[ 'tag' ],
32 32
 				$this->concat_attrs( $a, array( 'tag', 'name', 'desc' ) ),
33
-				$a['name'],
34
-				$a['desc']
33
+				$a[ 'name' ],
34
+				$a[ 'desc' ]
35 35
 			)
36 36
 		);
37 37
 	}
Please login to merge, or discard this patch.
includes/shim/WP_REST_Controller.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		}
167 167
 
168 168
 		if ( ! empty( $links ) ) {
169
-			$data['_links'] = $links;
169
+			$data[ '_links' ] = $links;
170 170
 		}
171 171
 
172 172
 		return $data;
@@ -183,21 +183,21 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$schema = $this->get_item_schema();
185 185
 		foreach ( $data as $key => $value ) {
186
-			if ( empty( $schema['properties'][ $key ] ) || empty( $schema['properties'][ $key ]['context'] ) ) {
186
+			if ( empty( $schema[ 'properties' ][ $key ] ) || empty( $schema[ 'properties' ][ $key ][ 'context' ] ) ) {
187 187
 				continue;
188 188
 			}
189 189
 
190
-			if ( ! in_array( $context, $schema['properties'][ $key ]['context'] ) ) {
190
+			if ( ! in_array( $context, $schema[ 'properties' ][ $key ][ 'context' ] ) ) {
191 191
 				unset( $data[ $key ] );
192 192
 				continue;
193 193
 			}
194 194
 
195
-			if ( 'object' === $schema['properties'][ $key ]['type'] && ! empty( $schema['properties'][ $key ]['properties'] ) ) {
196
-				foreach ( $schema['properties'][ $key ]['properties'] as $attribute => $details ) {
197
-					if ( empty( $details['context'] ) ) {
195
+			if ( 'object' === $schema[ 'properties' ][ $key ][ 'type' ] && ! empty( $schema[ 'properties' ][ $key ][ 'properties' ] ) ) {
196
+				foreach ( $schema[ 'properties' ][ $key ][ 'properties' ] as $attribute => $details ) {
197
+					if ( empty( $details[ 'context' ] ) ) {
198 198
 						continue;
199 199
 					}
200
-					if ( ! in_array( $context, $details['context'] ) ) {
200
+					if ( ! in_array( $context, $details[ 'context' ] ) ) {
201 201
 						if ( isset( $data[ $key ][ $attribute ] ) ) {
202 202
 							unset( $data[ $key ][ $attribute ] );
203 203
 						}
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$schema = $this->get_item_schema();
229 229
 
230
-		foreach ( $schema['properties'] as &$property ) {
231
-			if ( isset( $property['arg_options'] ) ) {
232
-				unset( $property['arg_options'] );
230
+		foreach ( $schema[ 'properties' ] as &$property ) {
231
+			if ( isset( $property[ 'arg_options' ] ) ) {
232
+				unset( $property[ 'arg_options' ] );
233 233
 			}
234 234
 		}
235 235
 
@@ -286,18 +286,18 @@  discard block
 block discarded – undo
286 286
 			'validate_callback'  => 'rest_validate_request_arg',
287 287
 		);
288 288
 		$schema = $this->get_item_schema();
289
-		if ( empty( $schema['properties'] ) ) {
289
+		if ( empty( $schema[ 'properties' ] ) ) {
290 290
 			return array_merge( $param_details, $args );
291 291
 		}
292 292
 		$contexts = array();
293
-		foreach ( $schema['properties'] as $attributes ) {
294
-			if ( ! empty( $attributes['context'] ) ) {
295
-				$contexts = array_merge( $contexts, $attributes['context'] );
293
+		foreach ( $schema[ 'properties' ] as $attributes ) {
294
+			if ( ! empty( $attributes[ 'context' ] ) ) {
295
+				$contexts = array_merge( $contexts, $attributes[ 'context' ] );
296 296
 			}
297 297
 		}
298 298
 		if ( ! empty( $contexts ) ) {
299
-			$param_details['enum'] = array_unique( $contexts );
300
-			rsort( $param_details['enum'] );
299
+			$param_details[ 'enum' ] = array_unique( $contexts );
300
+			rsort( $param_details[ 'enum' ] );
301 301
 		}
302 302
 		return array_merge( $param_details, $args );
303 303
 	}
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 
316 316
 		foreach ( $additional_fields as $field_name => $field_options ) {
317 317
 
318
-			if ( ! $field_options['get_callback'] ) {
318
+			if ( ! $field_options[ 'get_callback' ] ) {
319 319
 				continue;
320 320
 			}
321 321
 
322
-			$object[ $field_name ] = call_user_func( $field_options['get_callback'], $object, $field_name, $request, $this->get_object_type() );
322
+			$object[ $field_name ] = call_user_func( $field_options[ 'get_callback' ], $object, $field_name, $request, $this->get_object_type() );
323 323
 		}
324 324
 
325 325
 		return $object;
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 
338 338
 		foreach ( $additional_fields as $field_name => $field_options ) {
339 339
 
340
-			if ( ! $field_options['update_callback'] ) {
340
+			if ( ! $field_options[ 'update_callback' ] ) {
341 341
 				continue;
342 342
 			}
343 343
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 				continue;
347 347
 			}
348 348
 
349
-			call_user_func( $field_options['update_callback'], $request[ $field_name ], $object, $field_name, $request, $this->get_object_type() );
349
+			call_user_func( $field_options[ 'update_callback' ], $request[ $field_name ], $object, $field_name, $request, $this->get_object_type() );
350 350
 		}
351 351
 	}
352 352
 
@@ -358,23 +358,23 @@  discard block
 block discarded – undo
358 358
 	 * @param array $schema Schema array.
359 359
 	 */
360 360
 	protected function add_additional_fields_schema( $schema ) {
361
-		if ( empty( $schema['title'] ) ) {
361
+		if ( empty( $schema[ 'title' ] ) ) {
362 362
 			return $schema;
363 363
 		}
364 364
 
365 365
 		/**
366 366
 		 * Can't use $this->get_object_type otherwise we cause an inf loop.
367 367
 		 */
368
-		$object_type = $schema['title'];
368
+		$object_type = $schema[ 'title' ];
369 369
 
370 370
 		$additional_fields = $this->get_additional_fields( $object_type );
371 371
 
372 372
 		foreach ( $additional_fields as $field_name => $field_options ) {
373
-			if ( ! $field_options['schema'] ) {
373
+			if ( ! $field_options[ 'schema' ] ) {
374 374
 				continue;
375 375
 			}
376 376
 
377
-			$schema['properties'][ $field_name ] = $field_options['schema'];
377
+			$schema[ 'properties' ][ $field_name ] = $field_options[ 'schema' ];
378 378
 		}
379 379
 
380 380
 		return $schema;
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	protected function get_object_type() {
414 414
 		$schema = $this->get_item_schema();
415 415
 
416
-		if ( ! $schema || ! isset( $schema['title'] ) ) {
416
+		if ( ! $schema || ! isset( $schema[ 'title' ] ) ) {
417 417
 			return null;
418 418
 		}
419 419
 
420
-		return $schema['title'];
420
+		return $schema[ 'title' ];
421 421
 	}
422 422
 
423 423
 	/**
@@ -433,13 +433,13 @@  discard block
 block discarded – undo
433 433
 	public function get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ) {
434 434
 
435 435
 		$schema                = $this->get_item_schema();
436
-		$schema_properties     = ! empty( $schema['properties'] ) ? $schema['properties'] : array();
436
+		$schema_properties     = ! empty( $schema[ 'properties' ] ) ? $schema[ 'properties' ] : array();
437 437
 		$endpoint_args = array();
438 438
 
439 439
 		foreach ( $schema_properties as $field_id => $params ) {
440 440
 
441 441
 			// Arguments specified as `readonly` are not allowed to be set.
442
-			if ( ! empty( $params['readonly'] ) ) {
442
+			if ( ! empty( $params[ 'readonly' ] ) ) {
443 443
 				continue;
444 444
 			}
445 445
 
@@ -448,16 +448,16 @@  discard block
 block discarded – undo
448 448
 				'sanitize_callback' => 'rest_sanitize_request_arg',
449 449
 			);
450 450
 
451
-			if ( isset( $params['description'] ) ) {
452
-				$endpoint_args[ $field_id ]['description'] = $params['description'];
451
+			if ( isset( $params[ 'description' ] ) ) {
452
+				$endpoint_args[ $field_id ][ 'description' ] = $params[ 'description' ];
453 453
 			}
454 454
 
455
-			if ( WP_REST_Server::CREATABLE === $method && isset( $params['default'] ) ) {
456
-				$endpoint_args[ $field_id ]['default'] = $params['default'];
455
+			if ( WP_REST_Server::CREATABLE === $method && isset( $params[ 'default' ] ) ) {
456
+				$endpoint_args[ $field_id ][ 'default' ] = $params[ 'default' ];
457 457
 			}
458 458
 
459
-			if ( WP_REST_Server::CREATABLE === $method && ! empty( $params['required'] ) ) {
460
-				$endpoint_args[ $field_id ]['required'] = true;
459
+			if ( WP_REST_Server::CREATABLE === $method && ! empty( $params[ 'required' ] ) ) {
460
+				$endpoint_args[ $field_id ][ 'required' ] = true;
461 461
 			}
462 462
 
463 463
 			foreach ( array( 'type', 'format', 'enum' ) as $schema_prop ) {
@@ -467,14 +467,14 @@  discard block
 block discarded – undo
467 467
 			}
468 468
 
469 469
 			// Merge in any options provided by the schema property.
470
-			if ( isset( $params['arg_options'] ) ) {
470
+			if ( isset( $params[ 'arg_options' ] ) ) {
471 471
 
472 472
 				// Only use required / default from arg_options on CREATABLE endpoints.
473 473
 				if ( WP_REST_Server::CREATABLE !== $method ) {
474
-					$params['arg_options'] = array_diff_key( $params['arg_options'], array( 'required' => '', 'default' => '' ) );
474
+					$params[ 'arg_options' ] = array_diff_key( $params[ 'arg_options' ], array( 'required' => '', 'default' => '' ) );
475 475
 				}
476 476
 
477
-				$endpoint_args[ $field_id ] = array_merge( $endpoint_args[ $field_id ], $params['arg_options'] );
477
+				$endpoint_args[ $field_id ] = array_merge( $endpoint_args[ $field_id ], $params[ 'arg_options' ] );
478 478
 			}
479 479
 		}
480 480
 
Please login to merge, or discard this patch.
includes/CMB2_Hookup_Base.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@
 block discarded – undo
52 52
 
53 53
 		// Get object hash.. This bypasses issues with serializing closures.
54 54
 		if ( is_object( $hook ) ) {
55
-			$args[1] = spl_object_hash( $args[1] );
56
-		} elseif ( is_array( $hook ) && is_object( $hook[0] ) ) {
57
-			$args[1][0] = spl_object_hash( $hook[0] );
55
+			$args[ 1 ] = spl_object_hash( $args[ 1 ] );
56
+		} elseif ( is_array( $hook ) && is_object( $hook[ 0 ] ) ) {
57
+			$args[ 1 ][ 0 ] = spl_object_hash( $hook[ 0 ] );
58 58
 		}
59 59
 
60 60
 		$key = md5( serialize( $args ) );
Please login to merge, or discard this patch.