From bc97fcb99c63693034378bc646aab83a60388bf0 Mon Sep 17 00:00:00 2001 From: Haris Zulfiqar Date: Wed, 19 Sep 2018 19:37:59 +0500 Subject: [PATCH] PHPCS Warnings and Error Fixes (#388) --- functions.php | 2 +- inc/acf.php | 6 +++--- inc/scaffolding.php | 17 ++++++++++------- inc/scripts.php | 4 ++-- .../scaffolding/scaffolding-globals.php | 6 +++--- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/functions.php b/functions.php index 6298538af..1e8756c10 100644 --- a/functions.php +++ b/functions.php @@ -105,7 +105,7 @@ function _s_widgets_init() { // Define sidebars. $sidebars = array( - 'sidebar-1' => esc_html__( 'Sidebar 1', '_s' ), + 'sidebar-1' => esc_html__( 'Sidebar 1', '_s' ), // 'sidebar-2' => esc_html__( 'Sidebar 2', '_s' ), // 'sidebar-3' => esc_html__( 'Sidebar 3', '_s' ), ); diff --git a/inc/acf.php b/inc/acf.php index 959de2528..ee115b1be 100644 --- a/inc/acf.php +++ b/inc/acf.php @@ -168,9 +168,9 @@ function _s_has_block_expired( $args = array() ) { $args = wp_parse_args( $args, $defaults ); // Get (Unix) times and convert to integer. - $now = (int) date( 'U' ); + $now = (int) date( 'U' ); $start = (int) $args['start_date']; - $end = (int) $args['end_date']; + $end = (int) $args['end_date']; // No dates? Cool, they're optional. if ( empty( $start ) || empty( $end ) ) { @@ -194,7 +194,7 @@ function _s_has_block_expired( $args = array() ) { function _s_acf_admin_scripts() { // If a SCRIPT_DEBUG constant is defined or there is a $_GET param of 'script_debug', load unminified files. - $suffix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) || isset( $_GET['script_debug'] ) ? '' : '.min'; + $suffix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) || isset( $_GET['script_debug'] ) ? '' : '.min'; // phpcs:ignore // Version assets using this value. Bump it to bust old, cached files. $version = '1.0.0'; diff --git a/inc/scaffolding.php b/inc/scaffolding.php index cd6576cba..57ab9fae8 100644 --- a/inc/scaffolding.php +++ b/inc/scaffolding.php @@ -105,7 +105,7 @@ function _s_scaffolding_allowed_html() { // Add additional HTML tags to the wp_kses() allowed html filter. $allowed_tags = array_merge( wp_kses_allowed_html( 'post' ), array( - 'svg' => array( + 'svg' => array( 'aria-hidden' => true, 'class' => true, 'id' => true, @@ -117,17 +117,17 @@ function _s_scaffolding_allowed_html() { 'use' => true, 'path' => true, ), - 'use' => array( + 'use' => array( 'xlink:href' => true, ), - 'title' => array( + 'title' => array( 'id' => true, ), - 'desc' => array( + 'desc' => array( 'id' => true, ), 'select' => array( - 'class' => true, + 'class' => true, ), 'option' => array( 'option' => true, @@ -135,7 +135,7 @@ function _s_scaffolding_allowed_html() { 'selected' => true, 'disabled' => true, ), - 'input' => array( + 'input' => array( 'type' => true, 'name' => true, 'value' => true, @@ -217,7 +217,10 @@ function _s_display_global_scaffolding_section( $args = array() ) {

:

- + diff --git a/inc/scripts.php b/inc/scripts.php index 7de7dc224..d8ed271a2 100644 --- a/inc/scripts.php +++ b/inc/scripts.php @@ -51,7 +51,7 @@ function _s_scripts() { /** * If WP is in script debug, or we pass ?script_debug in a URL - set debug to true. */ - $debug = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) || ( isset( $_GET['script_debug'] ) ) ? true : false; + $debug = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) || ( isset( $_GET['script_debug'] ) ) ? true : false; // phpcs:ignore /** * If we are debugging the site, use a unique version every page load so as to ensure no cache issues. @@ -105,7 +105,7 @@ function _s_customizer_scripts() { /** * If WP is in script debug, or we pass ?script_debug in a URL - set debug to true. */ - $debug = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) || ( isset( $_GET['script_debug'] ) ) ? true : false; + $debug = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) || ( isset( $_GET['script_debug'] ) ) ? true : false; // phpcs:ignore /** * If we are debugging the site, use a unique version every page load so as to ensure no cache issues. diff --git a/template-parts/scaffolding/scaffolding-globals.php b/template-parts/scaffolding/scaffolding-globals.php index c37b48481..b3f345e6d 100644 --- a/template-parts/scaffolding/scaffolding-globals.php +++ b/template-parts/scaffolding/scaffolding-globals.php @@ -27,9 +27,9 @@ // Theme fonts. _s_display_global_scaffolding_section( array( // WPCS: XSS OK. - 'global_type' => 'fonts', - 'title' => 'Fonts', - 'arguments' => array( + 'global_type' => 'fonts', + 'title' => 'Fonts', + 'arguments' => array( 'Sans' => '"Open Sans", sans-serif', 'Serif' => 'Roboto, Georgia, Times, "Times New Roman", serif', 'Code' => 'Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace',