Skip to content

Fixes phpcs errors and warnings #225

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

Merged
merged 4 commits into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions admin/class-fastcgi-purger.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ private function purge_base_url() {
*
* @since 2.2.0
*/
$path = apply_filters( 'rt_nginx_helper_fastcgi_purge_suffix', 'purge' );
$path = apply_filters( 'rt_nginx_helper_fastcgi_purge_suffix', 'purge' );

// Prevent users from inserting a trailing '/' that could break the url purging.
$path = trim( $path, '/' );
$path = trim( $path, '/' );

$purge_url_base = $parse['scheme'] . '://' . $parse['host'] . '/' . $path;

Expand Down
4 changes: 2 additions & 2 deletions admin/class-nginx-helper-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function enqueue_scripts( $hook ) {
return;
}

wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/nginx-helper-admin.js', array( 'jquery' ), $this->version );
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/nginx-helper-admin.js', array( 'jquery' ), $this->version, false );

$do_localize = array(
'purge_confirm_string' => esc_html__( 'Purging entire cache is not recommended. Would you like to continue?', 'nginx-helper' ),
Expand Down Expand Up @@ -434,7 +434,7 @@ public function add_timestamps() {

global $pagenow;

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;
}

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

} else {

$status = $this->delete_keys_by_wildcard( $_url_purge_base );
Expand All @@ -157,7 +156,6 @@ public function purge_url( $url, $feed = true ) {
} else {
$this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
}

}

$this->log( '* * * * *' );
Expand Down
2 changes: 0 additions & 2 deletions admin/class-predis-purger.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ public function purge_url( $url, $feed = true ) {
} else {
$this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
}

} else {

$status = $this->delete_keys_by_wildcard( $_url_purge_base );
Expand All @@ -156,7 +155,6 @@ public function purge_url( $url, $feed = true ) {
} else {
$this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
}

}

}
Expand Down
4 changes: 2 additions & 2 deletions admin/class-purger.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function purge_post_on_comment_change( $newstatus, $oldstatus, $comment )
switch ( $newstatus ) {

case 'approved':
if ( 1 === (int)$nginx_helper_admin->options['purge_page_on_new_comment'] ) {
if ( 1 === (int) $nginx_helper_admin->options['purge_page_on_new_comment'] ) {

$this->log( '* Comment ( ' . $_comment_id . ' ) approved. Post ( ' . $_post_id . ' ) purging...' );
$this->log( '* * * * *' );
Expand Down Expand Up @@ -1243,7 +1243,7 @@ public function unlink_recursive( $dir, $delete_root_too ) {
continue;
}

if ( ! @unlink( $dir . '/' . $obj ) ) {
if ( ! @unlink( $dir . '/' . $obj ) ) { // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
$this->unlink_recursive( $dir . '/' . $obj, false );
}
}
Expand Down
2 changes: 1 addition & 1 deletion admin/icons/css/nginx-fontello.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
/*
/* // phpcs:ignore Squiz.PHP.CommentedOutCode.Found
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'nginx-fontello';
Expand Down
11 changes: 9 additions & 2 deletions admin/js/nginx-helper-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,15 @@
ajaxurl,
args,
function( data ) {
news_section.find( '.inside' ).empty();
news_section.find( '.inside' ).append( data );
/**
* Received markup is safe and escaped appropriately.
*
* File: admin/class-nginx-helper-admin.php
* Method: nginx_helper_get_feeds();
*/

// phpcs:ignore -- WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
news_section.find( '.inside' ).empty().append( data );
}
);

Expand Down
Loading