@@ -82,7 +82,8 @@ public function __construct( $plugin_name, $version ) {
82
82
* Define settings tabs
83
83
*/
84
84
$ this ->settings_tabs = apply_filters (
85
- 'rt_nginx_helper_settings_tabs ' , array (
85
+ 'rt_nginx_helper_settings_tabs ' ,
86
+ array (
86
87
'general ' => array (
87
88
'menu_title ' => __ ( 'General ' , 'nginx-helper ' ),
88
89
'menu_slug ' => 'general ' ,
@@ -209,7 +210,7 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) {
209
210
$ link_title = __ ( 'Purge Current Page ' , 'nginx-helper ' );
210
211
}
211
212
212
- $ purge_url = add_query_arg (
213
+ $ purge_url = add_query_arg (
213
214
array (
214
215
'nginx_helper_action ' => 'purge ' ,
215
216
'nginx_helper_urls ' => $ nginx_helper_urls ,
@@ -237,7 +238,7 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) {
237
238
* @since 2.0.0
238
239
*/
239
240
public function nginx_helper_setting_page () {
240
- include plugin_dir_path (__FILE__ ) . 'partials/nginx-helper-admin-display.php ' ;
241
+ include plugin_dir_path ( __FILE__ ) . 'partials/nginx-helper-admin-display.php ' ;
241
242
}
242
243
243
244
/**
@@ -282,7 +283,14 @@ public function nginx_helper_default_settings() {
282
283
*/
283
284
public function nginx_helper_settings () {
284
285
285
- $ options = get_site_option ( 'rt_wp_nginx_helper_options ' , array ( 'redis_hostname ' => '127.0.0.1 ' , 'redis_port ' => '6379 ' , 'redis_prefix ' => 'nginx-cache: ' ) );
286
+ $ options = get_site_option (
287
+ 'rt_wp_nginx_helper_options ' ,
288
+ array (
289
+ 'redis_hostname ' => '127.0.0.1 ' ,
290
+ 'redis_port ' => '6379 ' ,
291
+ 'redis_prefix ' => 'nginx-cache: ' ,
292
+ )
293
+ );
286
294
287
295
$ data = wp_parse_args (
288
296
$ options ,
@@ -399,15 +407,22 @@ public function nginx_helper_get_feeds() {
399
407
echo wp_kses (
400
408
sprintf (
401
409
'<a href="%1$s" title="%2$s">%3$s</a> ' ,
402
- esc_url ( $ item ->get_permalink () ), esc_attr__ ( 'Posted ' , 'nginx-helper ' ) . esc_attr ( $ item ->get_date ( 'j F Y | g:i a ' ) ), esc_html ( $ item ->get_title () )
410
+ esc_url ( $ item ->get_permalink () ),
411
+ esc_attr__ ( 'Posted ' , 'nginx-helper ' ) . esc_attr ( $ item ->get_date ( 'j F Y | g:i a ' ) ),
412
+ esc_html ( $ item ->get_title () )
403
413
),
404
- array ( 'strong ' => array (), 'a ' => array ( 'href ' => array (), 'title ' => array () ) )
414
+ array (
415
+ 'strong ' => array (),
416
+ 'a ' => array (
417
+ 'href ' => array (),
418
+ 'title ' => array (),
419
+ ),
420
+ )
405
421
);
406
422
?>
407
423
</li>
408
424
<?php
409
425
}
410
-
411
426
}
412
427
?>
413
428
</ul>
@@ -421,13 +436,13 @@ public function nginx_helper_get_feeds() {
421
436
*/
422
437
public function add_timestamps () {
423
438
424
- if ( is_admin () || (int ) $ this ->options ['enable_purge ' ] !== 1 || (int ) $ this ->options ['enable_stamp ' ] !== 1 ) {
439
+ if ( is_admin () || 1 !== (int ) $ this ->options ['enable_purge ' ] || 1 !== (int ) $ this ->options ['enable_stamp ' ] ) {
425
440
return ;
426
441
}
427
442
428
443
foreach ( headers_list () as $ header ) {
429
444
list ( $ key , $ value ) = explode ( ': ' , $ header , 2 );
430
- $ key = strtolower ( $ key );
445
+ $ key = strtolower ( $ key );
431
446
if ( 'content-type ' === $ key && strpos ( trim ( $ value ), 'text/html ' ) !== 0 ) {
432
447
return ;
433
448
}
@@ -480,7 +495,7 @@ public function get_map() {
480
495
481
496
$ rt_all_blogs = $ wpdb ->get_results (
482
497
$ wpdb ->prepare (
483
- 'SELECT blog_id, domain, path FROM ' . $ wpdb ->blogs . " WHERE site_id = %d AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' " ,
498
+ 'SELECT blog_id, domain, path FROM ' . $ wpdb ->blogs . " WHERE site_id = %d AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' " ,
484
499
$ wpdb ->siteid
485
500
)
486
501
);
@@ -507,19 +522,15 @@ public function get_map() {
507
522
if ( 1 !== $ blog ->blog_id ) {
508
523
$ rt_nginx_map_array [ $ blog ->path ] = $ blog ->blog_id ;
509
524
}
510
-
511
525
}
512
-
513
526
}
514
-
515
527
}
516
528
517
529
if ( $ rt_domain_map_sites ) {
518
530
519
531
foreach ( $ rt_domain_map_sites as $ site ) {
520
532
$ rt_nginx_map_array [ $ site ->domain ] = $ site ->blog_id ;
521
533
}
522
-
523
534
}
524
535
525
536
foreach ( $ rt_nginx_map_array as $ domain => $ domain_id ) {
@@ -541,11 +552,11 @@ public function update_map() {
541
552
542
553
$ rt_nginx_map = $ this ->get_map ();
543
554
544
- if ( $ fp = fopen ( $ this ->functional_asset_path () . 'map.conf ' , 'w+ ' ) ) {
555
+ $ fp = fopen ( $ this ->functional_asset_path () . 'map.conf ' , 'w+ ' );
556
+ if ( $ fp ) {
545
557
fwrite ( $ fp , $ rt_nginx_map );
546
558
fclose ( $ fp );
547
559
}
548
-
549
560
}
550
561
551
562
}
@@ -580,11 +591,11 @@ public function set_future_post_option_on_future_status( $new_status, $old_statu
580
591
if (
581
592
'future ' === $ new_status && $ post && 'future ' === $ post ->post_status &&
582
593
(
583
- ( 'post ' === $ post ->post_type || 'page ' === $ post ->post_type ) ||
584
- (
585
- isset ( $ this ->options ['custom_post_types_recognized ' ] ) &&
586
- in_array ( $ post ->post_type , $ this ->options ['custom_post_types_recognized ' ], true )
587
- )
594
+ ( 'post ' === $ post ->post_type || 'page ' === $ post ->post_type ) ||
595
+ (
596
+ isset ( $ this ->options ['custom_post_types_recognized ' ] ) &&
597
+ in_array ( $ post ->post_type , $ this ->options ['custom_post_types_recognized ' ], true )
598
+ )
588
599
)
589
600
) {
590
601
0 commit comments