Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PHPCS #209

Merged
merged 4 commits into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions admin/class-fastcgi-purger.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function purge_url( $url, $feed = true ) {
$_url_purge_base = $parse['scheme'] . '://' . $parse['host'] . $parse['path'];
$_url_purge = $_url_purge_base;

if ( isset( $parse['query'] ) && $parse['query'] !== '' ) {
if ( isset( $parse['query'] ) && '' !== $parse['query'] ) {
thrijith marked this conversation as resolved.
Show resolved Hide resolved
$_url_purge .= '?' . $parse['query'];
}

Expand Down Expand Up @@ -131,9 +131,7 @@ public function custom_purge_urls() {
$this->delete_cache_file_for( $purge_url );

}

}

}
break;

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

}

}

}
break;

Expand Down
53 changes: 32 additions & 21 deletions admin/class-nginx-helper-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public function __construct( $plugin_name, $version ) {
* Define settings tabs
*/
$this->settings_tabs = apply_filters(
'rt_nginx_helper_settings_tabs', array(
'rt_nginx_helper_settings_tabs',
array(
'general' => array(
'menu_title' => __( 'General', 'nginx-helper' ),
'menu_slug' => 'general',
Expand Down Expand Up @@ -209,7 +210,7 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) {
$link_title = __( 'Purge Current Page', 'nginx-helper' );
}

$purge_url = add_query_arg(
$purge_url = add_query_arg(
array(
'nginx_helper_action' => 'purge',
'nginx_helper_urls' => $nginx_helper_urls,
Expand Down Expand Up @@ -237,7 +238,7 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) {
* @since 2.0.0
*/
public function nginx_helper_setting_page() {
include plugin_dir_path(__FILE__ ) . 'partials/nginx-helper-admin-display.php';
include plugin_dir_path( __FILE__ ) . 'partials/nginx-helper-admin-display.php';
}

/**
Expand Down Expand Up @@ -282,7 +283,14 @@ public function nginx_helper_default_settings() {
*/
public function nginx_helper_settings() {

$options = get_site_option( 'rt_wp_nginx_helper_options', array( 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', 'redis_prefix' => 'nginx-cache:' ) );
$options = get_site_option(
'rt_wp_nginx_helper_options',
array(
'redis_hostname' => '127.0.0.1',
'redis_port' => '6379',
'redis_prefix' => 'nginx-cache:',
)
);

$data = wp_parse_args(
$options,
Expand Down Expand Up @@ -399,15 +407,22 @@ public function nginx_helper_get_feeds() {
echo wp_kses(
sprintf(
'<a href="%1$s" title="%2$s">%3$s</a>',
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() )
esc_url( $item->get_permalink() ),
thrijith marked this conversation as resolved.
Show resolved Hide resolved
esc_attr__( 'Posted ', 'nginx-helper' ) . esc_attr( $item->get_date( 'j F Y | g:i a' ) ),
esc_html( $item->get_title() )
),
array( 'strong' => array(), 'a' => array( 'href' => array(), 'title' => array() ) )
array(
'strong' => array(),
'a' => array(
'href' => array(),
'title' => array(),
),
)
);
?>
</li>
<?php
}

}
?>
</ul>
Expand All @@ -421,13 +436,13 @@ public function nginx_helper_get_feeds() {
*/
public function add_timestamps() {

if ( is_admin() || (int) $this->options['enable_purge'] !== 1 || (int) $this->options['enable_stamp'] !== 1 ) {
if ( is_admin() || 1 !== (int) $this->options['enable_purge'] || 1 !== (int) $this->options['enable_stamp'] ) {
return;
}

foreach ( headers_list() as $header ) {
list( $key, $value ) = explode( ':', $header, 2 );
$key = strtolower( $key );
$key = strtolower( $key );
if ( 'content-type' === $key && strpos( trim( $value ), 'text/html' ) !== 0 ) {
return;
}
Expand Down Expand Up @@ -480,7 +495,7 @@ public function get_map() {

$rt_all_blogs = $wpdb->get_results(
$wpdb->prepare(
'SELECT blog_id, domain, path FROM ' . $wpdb->blogs . " WHERE site_id = %d AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0'",
'SELECT blog_id, domain, path FROM ' . $wpdb->blogs . " WHERE site_id = %d AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0'",
$wpdb->siteid
)
);
Expand All @@ -507,19 +522,15 @@ public function get_map() {
if ( 1 !== $blog->blog_id ) {
$rt_nginx_map_array[ $blog->path ] = $blog->blog_id;
}

}

}

}

if ( $rt_domain_map_sites ) {

foreach ( $rt_domain_map_sites as $site ) {
$rt_nginx_map_array[ $site->domain ] = $site->blog_id;
}

}

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

$rt_nginx_map = $this->get_map();

if ( $fp = fopen( $this->functional_asset_path() . 'map.conf', 'w+' ) ) {
$fp = fopen( $this->functional_asset_path() . 'map.conf', 'w+' );
if ( $fp ) {
fwrite( $fp, $rt_nginx_map );
fclose( $fp );
}

}

}
Expand Down Expand Up @@ -580,11 +591,11 @@ public function set_future_post_option_on_future_status( $new_status, $old_statu
if (
'future' === $new_status && $post && 'future' === $post->post_status &&
(
( 'post' === $post->post_type || 'page' === $post->post_type ) ||
(
isset( $this->options['custom_post_types_recognized'] ) &&
in_array( $post->post_type, $this->options['custom_post_types_recognized'], true )
)
( 'post' === $post->post_type || 'page' === $post->post_type ) ||
(
isset( $this->options['custom_post_types_recognized'] ) &&
in_array( $post->post_type, $this->options['custom_post_types_recognized'], true )
)
)
) {

Expand Down
4 changes: 0 additions & 4 deletions admin/class-phpredis-purger.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ public function custom_purge_urls() {
} else {
$this->log( '- Cache Not Found | ' . $purge_url, 'ERROR' );
}

} else {

$purge_url = $_url_purge_base . $purge_url;
Expand All @@ -181,11 +180,8 @@ public function custom_purge_urls() {
} else {
$this->log( '- Cache Not Found | ' . $purge_url, 'ERROR' );
}

}

}

}

}
Expand Down
6 changes: 1 addition & 5 deletions admin/class-predis-purger.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function purge_all() {

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

$parse = wp_parse_url( get_home_url() );
$parse = wp_parse_url( get_home_url() );
$parse['path'] = empty( $parse['path'] ) ? '/' : $parse['path'];
$this->delete_keys_by_wildcard( $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'] . '*' );
$this->log( '* ' . get_home_url() . ' Purged! * ' );
Expand Down Expand Up @@ -160,7 +160,6 @@ public function custom_purge_urls() {
} else {
$this->log( '- Not Found | ' . $purge_url, 'ERROR' );
}

} else {

$purge_url = $_url_purge_base . $purge_url;
Expand All @@ -171,11 +170,8 @@ public function custom_purge_urls() {
} else {
$this->log( '- Not Found | ' . $purge_url, 'ERROR' );
}

}

}

}

}
Expand Down
Loading