Skip to content

Commit 32ee025

Browse files
committed
Fix phpcs
1 parent 7a530db commit 32ee025

15 files changed

+447
-356
lines changed

admin/class-fastcgi-purger.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function purge_url( $url, $feed = true ) {
5151
$_url_purge_base = $parse['scheme'] . '://' . $parse['host'] . $parse['path'];
5252
$_url_purge = $_url_purge_base;
5353

54-
if ( isset( $parse['query'] ) && $parse['query'] !== '' ) {
54+
if ( isset( $parse['query'] ) && '' !== $parse['query'] ) {
5555
$_url_purge .= '?' . $parse['query'];
5656
}
5757

@@ -131,9 +131,7 @@ public function custom_purge_urls() {
131131
$this->delete_cache_file_for( $purge_url );
132132

133133
}
134-
135134
}
136-
137135
}
138136
break;
139137

@@ -155,9 +153,7 @@ public function custom_purge_urls() {
155153
$this->do_remote_get( $purge_url );
156154

157155
}
158-
159156
}
160-
161157
}
162158
break;
163159

admin/class-nginx-helper-admin.php

+32-21
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ public function __construct( $plugin_name, $version ) {
8282
* Define settings tabs
8383
*/
8484
$this->settings_tabs = apply_filters(
85-
'rt_nginx_helper_settings_tabs', array(
85+
'rt_nginx_helper_settings_tabs',
86+
array(
8687
'general' => array(
8788
'menu_title' => __( 'General', 'nginx-helper' ),
8889
'menu_slug' => 'general',
@@ -209,7 +210,7 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) {
209210
$link_title = __( 'Purge Current Page', 'nginx-helper' );
210211
}
211212

212-
$purge_url = add_query_arg(
213+
$purge_url = add_query_arg(
213214
array(
214215
'nginx_helper_action' => 'purge',
215216
'nginx_helper_urls' => $nginx_helper_urls,
@@ -237,7 +238,7 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) {
237238
* @since 2.0.0
238239
*/
239240
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';
241242
}
242243

243244
/**
@@ -282,7 +283,14 @@ public function nginx_helper_default_settings() {
282283
*/
283284
public function nginx_helper_settings() {
284285

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+
);
286294

287295
$data = wp_parse_args(
288296
$options,
@@ -399,15 +407,22 @@ public function nginx_helper_get_feeds() {
399407
echo wp_kses(
400408
sprintf(
401409
'<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() )
403413
),
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+
)
405421
);
406422
?>
407423
</li>
408424
<?php
409425
}
410-
411426
}
412427
?>
413428
</ul>
@@ -421,13 +436,13 @@ public function nginx_helper_get_feeds() {
421436
*/
422437
public function add_timestamps() {
423438

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'] ) {
425440
return;
426441
}
427442

428443
foreach ( headers_list() as $header ) {
429444
list( $key, $value ) = explode( ':', $header, 2 );
430-
$key = strtolower( $key );
445+
$key = strtolower( $key );
431446
if ( 'content-type' === $key && strpos( trim( $value ), 'text/html' ) !== 0 ) {
432447
return;
433448
}
@@ -480,7 +495,7 @@ public function get_map() {
480495

481496
$rt_all_blogs = $wpdb->get_results(
482497
$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'",
484499
$wpdb->siteid
485500
)
486501
);
@@ -507,19 +522,15 @@ public function get_map() {
507522
if ( 1 !== $blog->blog_id ) {
508523
$rt_nginx_map_array[ $blog->path ] = $blog->blog_id;
509524
}
510-
511525
}
512-
513526
}
514-
515527
}
516528

517529
if ( $rt_domain_map_sites ) {
518530

519531
foreach ( $rt_domain_map_sites as $site ) {
520532
$rt_nginx_map_array[ $site->domain ] = $site->blog_id;
521533
}
522-
523534
}
524535

525536
foreach ( $rt_nginx_map_array as $domain => $domain_id ) {
@@ -541,11 +552,11 @@ public function update_map() {
541552

542553
$rt_nginx_map = $this->get_map();
543554

544-
if ( $fp = fopen( $this->functional_asset_path() . 'map.conf', 'w+' ) ) {
555+
$fp = fopen( $this->functional_asset_path() . 'map.conf', 'w+' );
556+
if ( $fp ) {
545557
fwrite( $fp, $rt_nginx_map );
546558
fclose( $fp );
547559
}
548-
549560
}
550561

551562
}
@@ -580,11 +591,11 @@ public function set_future_post_option_on_future_status( $new_status, $old_statu
580591
if (
581592
'future' === $new_status && $post && 'future' === $post->post_status &&
582593
(
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+
)
588599
)
589600
) {
590601

admin/class-phpredis-purger.php

-4
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ public function custom_purge_urls() {
170170
} else {
171171
$this->log( '- Cache Not Found | ' . $purge_url, 'ERROR' );
172172
}
173-
174173
} else {
175174

176175
$purge_url = $_url_purge_base . $purge_url;
@@ -181,11 +180,8 @@ public function custom_purge_urls() {
181180
} else {
182181
$this->log( '- Cache Not Found | ' . $purge_url, 'ERROR' );
183182
}
184-
185183
}
186-
187184
}
188-
189185
}
190186

191187
}

admin/class-predis-purger.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function purge_all() {
7373

7474
} else { // Else purge only site specific cache.
7575

76-
$parse = wp_parse_url( get_home_url() );
76+
$parse = wp_parse_url( get_home_url() );
7777
$parse['path'] = empty( $parse['path'] ) ? '/' : $parse['path'];
7878
$this->delete_keys_by_wildcard( $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'] . '*' );
7979
$this->log( '* ' . get_home_url() . ' Purged! * ' );
@@ -160,7 +160,6 @@ public function custom_purge_urls() {
160160
} else {
161161
$this->log( '- Not Found | ' . $purge_url, 'ERROR' );
162162
}
163-
164163
} else {
165164

166165
$purge_url = $_url_purge_base . $purge_url;
@@ -171,11 +170,8 @@ public function custom_purge_urls() {
171170
} else {
172171
$this->log( '- Not Found | ' . $purge_url, 'ERROR' );
173172
}
174-
175173
}
176-
177174
}
178-
179175
}
180176

181177
}

0 commit comments

Comments
 (0)