@@ -199,23 +199,32 @@ public function handle_ajax_object_selector_query() {
199
199
global $ wp_customize ;
200
200
201
201
// Close output buffering to ensure that _ajax_wp_die_handler doesn't clobber the status_header(). See <https://core.trac.wordpress.org/ticket/35666#comment:6>.
202
- while ( 0 !== ob_get_level () ) {
202
+ while ( 0 !== ob_get_level () ) {
203
203
ob_end_clean ();
204
204
}
205
205
206
206
$ nonce_query_var_name = 'customize_object_selector_query_nonce ' ;
207
207
if ( ! check_ajax_referer ( static ::OBJECT_SELECTOR_QUERY_AJAX_ACTION , $ nonce_query_var_name , false ) ) {
208
208
status_header ( 400 );
209
- wp_send_json_error ( array ( 'code ' => 'bad_nonce ' ), 400 ); // Note: The redundant 400 status is needed until #35666 is resolved.
209
+ wp_send_json_error (
210
+ array (
211
+ 'code ' => 'bad_nonce ' ,
212
+ ),
213
+ 400 // Note: The redundant 400 status is needed until #35666 is resolved.
214
+ );
210
215
}
211
216
if ( ! isset ( $ _POST ['post_query_args ' ] ) ) {
212
217
status_header ( 400 );
213
- wp_send_json_error ( array ( 'code ' => 'missing_post_query_args ' ), 400 );
218
+ wp_send_json_error ( array (
219
+ 'code ' => 'missing_post_query_args ' ,
220
+ ), 400 );
214
221
}
215
222
$ post_query_args = json_decode ( wp_unslash ( $ _POST ['post_query_args ' ] ), true );
216
223
if ( ! is_array ( $ post_query_args ) ) {
217
224
status_header ( 400 );
218
- wp_send_json_error ( array ( 'code ' => 'invalid_post_query_args ' ), 400 );
225
+ wp_send_json_error ( array (
226
+ 'code ' => 'invalid_post_query_args ' ,
227
+ ), 400 );
219
228
}
220
229
221
230
$ post_query_args = $ this ->process_post_query_vars ( $ post_query_args );
@@ -322,14 +331,18 @@ public function process_post_query_vars( $post_query_vars ) {
322
331
return new \WP_Error (
323
332
'disallowed_query_var ' ,
324
333
__ ( 'Disallowed query var ' , 'customize-object-selector ' ),
325
- array ( 'query_vars ' => array_values ( $ extra_query_vars ) )
334
+ array (
335
+ 'query_vars ' => array_values ( $ extra_query_vars ),
336
+ )
326
337
);
327
338
}
328
339
if ( ! empty ( $ post_query_vars ['meta_compare ' ] ) && ! in_array ( $ post_query_vars ['meta_compare ' ], $ allowed_meta_query_compare_values , true ) ) {
329
340
return new \WP_Error (
330
341
'disallowed_meta_compare_query_var ' ,
331
342
__ ( 'Disallowed meta_compare query var ' , 'customize-object-selector ' ),
332
- array ( 'query_var ' => $ post_query_vars ['meta_compare ' ] )
343
+ array (
344
+ 'query_var ' => $ post_query_vars ['meta_compare ' ],
345
+ )
333
346
);
334
347
}
335
348
@@ -341,7 +354,9 @@ public function process_post_query_vars( $post_query_vars ) {
341
354
return new \WP_Error (
342
355
'disallowed_meta_query_relation_var ' ,
343
356
__ ( 'Disallowed meta_query relation ' , 'customize-object-selector ' ),
344
- array ( 'query_vars ' => array_values ( $ val ) )
357
+ array (
358
+ 'query_vars ' => array_values ( $ val ),
359
+ )
345
360
);
346
361
}
347
362
continue ;
@@ -351,14 +366,18 @@ public function process_post_query_vars( $post_query_vars ) {
351
366
return new \WP_Error (
352
367
'disallowed_meta_query_var ' ,
353
368
__ ( 'Disallowed meta_query var ' , 'customize-object-selector ' ),
354
- array ( 'query_vars ' => array_values ( $ extra_meta_query_vars ) )
369
+ array (
370
+ 'query_vars ' => array_values ( $ extra_meta_query_vars ),
371
+ )
355
372
);
356
373
}
357
374
if ( ! empty ( $ val ['compare ' ] ) && ! in_array ( $ val ['compare ' ], $ allowed_meta_query_compare_values , true ) ) {
358
375
return new \WP_Error (
359
376
'disallowed_meta_compare_query_var ' ,
360
377
__ ( 'Disallowed meta_compare query var ' , 'customize-object-selector ' ),
361
- array ( 'query_vars ' => $ post_query_vars ['meta_query ' ]['compare ' ] )
378
+ array (
379
+ 'query_vars ' => $ post_query_vars ['meta_query ' ]['compare ' ],
380
+ )
362
381
);
363
382
}
364
383
}
@@ -379,7 +398,9 @@ public function process_post_query_vars( $post_query_vars ) {
379
398
return new \WP_Error (
380
399
'bad_post_status ' ,
381
400
__ ( 'Bad post status ' , 'customize-object-selector ' ),
382
- array ( 'post_status ' => $ post_status )
401
+ array (
402
+ 'post_status ' => $ post_status ,
403
+ )
383
404
);
384
405
}
385
406
if ( ! empty ( $ post_status_object ->publicly_queryable ) ) {
@@ -401,21 +422,27 @@ public function process_post_query_vars( $post_query_vars ) {
401
422
return new \WP_Error (
402
423
'bad_post_type ' ,
403
424
__ ( 'Bad post type ' , 'customize-object-selector ' ),
404
- array ( 'post_type ' => $ post_type )
425
+ array (
426
+ 'post_type ' => $ post_type ,
427
+ )
405
428
);
406
429
}
407
430
if ( ! current_user_can ( $ post_type_object ->cap ->read ) ) {
408
431
return new \WP_Error (
409
432
'cannot_query_posts ' ,
410
433
__ ( 'Cannot query posts ' , 'customize-object-selector ' ),
411
- array ( 'post_type ' => $ post_type )
434
+ array (
435
+ 'post_type ' => $ post_type ,
436
+ )
412
437
);
413
438
}
414
439
if ( $ has_private_status && ! current_user_can ( $ post_type_object ->cap ->read_private_posts ) ) {
415
440
return new \WP_Error (
416
441
'cannot_query_private_posts ' ,
417
442
__ ( 'Cannot query private posts ' , 'customize-object-selector ' ),
418
- array ( 'post_type ' => $ post_type )
443
+ array (
444
+ 'post_type ' => $ post_type ,
445
+ )
419
446
);
420
447
}
421
448
}
@@ -530,8 +557,11 @@ public function build_post_dropdown( $post_query_args ) {
530
557
if ( in_array ( $ key , $ unsupported_args , true ) ) {
531
558
return new \WP_Error (
532
559
'unsupported_dropdown_pages_arg ' ,
560
+ /* translators: placeholder is dropdown_pages argument */
533
561
sprintf ( __ ( 'Unsupported arg "%s" in dropdown_args or supplied by page_attributes_dropdown_pages_args filter ' , 'customize-object-selector ' ), $ key ),
534
- array ( 'arg ' => $ key )
562
+ array (
563
+ 'arg ' => $ key ,
564
+ )
535
565
);
536
566
}
537
567
}
0 commit comments