🔖 CS: whitelist two global variable overrides

The one in `functions.php` can be considered a bug in WPCS and has been reported as such.
Once that issue is fixed, the whitelisting can be removed.

The one in `inc/wpcom.php` will need to remain as WPCS does not keep track of globals introduced by wpcom.
This commit is contained in:
jrfnl 2018-02-27 14:14:41 +01:00
parent 7c24fc751d
commit 54ad32a598
2 changed files with 5 additions and 0 deletions

View File

@ -91,6 +91,9 @@ add_action( 'after_setup_theme', '_s_setup' );
* @global int $content_width
*/
function _s_content_width() {
// This variable is intended to be overruled from themes.
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$GLOBALS['content_width'] = apply_filters( '_s_content_width', 640 );
}
add_action( 'after_setup_theme', '_s_content_width', 0 );

View File

@ -17,6 +17,8 @@ function _s_wpcom_setup() {
// Set theme colors for third party services.
if ( ! isset( $themecolors ) ) {
// Whitelist wpcom specific variable intended to be overruled.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$themecolors = array(
'bg' => '',
'border' => '',