Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.
Closed
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
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ matrix:
dist: precise
# aliased to a recent 5.6.x version
- php: '5.6'
env: SNIFF=1
# aliased to a recent 7.0.x version
- php: '7.0'
# aliased to a recent 7.2.x version
- php: '7.2'
env: SNIFF=1
# bleeding edge PHP
- php: 'nightly'

Expand All @@ -52,15 +52,18 @@ before_script:
- export PHPCS_DIR=/tmp/phpcs
- export WPCS_DIR=/tmp/wpcs
- export PHPCOMPAT_DIR=/tmp/phpcompatibility
- export PHPCOMPATWP_DIR=/tmp/phpcompatibilitywp
# Install CodeSniffer for WordPress Coding Standards checks.
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi
# Install WordPress Coding Standards.
- if [[ "$SNIFF" == "1" ]]; then git clone -b 0.14.1 --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $WPCS_DIR; fi
- if [[ "$SNIFF" == "1" ]]; then git clone -b 1.0.0 --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $WPCS_DIR; fi
# Install PHP Compatibility sniffs.
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $PHPCOMPAT_DIR; fi
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/PHPCompatibility/PHPCompatibility.git $PHPCOMPAT_DIR; fi
# Install WP PHP Compatibility ruleset.
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/PHPCompatibility/PHPCompatibilityWP.git $PHPCOMPATWP_DIR; fi
# Set install path for PHPCS sniffs.
# @link https://github.com/squizlabs/PHP_CodeSniffer/blob/4237c2fc98cc838730b76ee9cee316f99286a2a7/CodeSniffer.php#L1941
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs --config-set installed_paths $WPCS_DIR,$PHPCOMPAT_DIR; fi
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs --config-set installed_paths $WPCS_DIR,$PHPCOMPAT_DIR,$PHPCOMPATWP_DIR; fi
# After CodeSniffer install you should refresh your path.
- if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi
# Install JSCS: JavaScript Code Style checker.
Expand Down
11 changes: 8 additions & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
* @package _s
*/

if ( ! defined( '_S_VERSION' ) ) {
// Replace #.# with the version number of the theme on each release.
define( '_S_VERSION', '#.#' );
}

if ( ! function_exists( '_s_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
Expand Down Expand Up @@ -120,11 +125,11 @@ function _s_widgets_init() {
* Enqueue scripts and styles.
*/
function _s_scripts() {
wp_enqueue_style( '_s-style', get_stylesheet_uri() );
wp_enqueue_style( '_s-style', get_stylesheet_uri(), array(), _S_VERSION );

wp_enqueue_script( '_s-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
wp_enqueue_script( '_s-navigation', get_template_directory_uri() . '/js/navigation.js', array(), _S_VERSION, true );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we leave the version as is? The script does not get changed with every theme version. This way we would not need the constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except that the scripts have been changed a couple of times already and people keep forgetting to update this cache-busting number, so I would strongly recommend leaving it as is (with the constant), as refreshing the script once on every new release is a minor slow-down, while serving an out-of-date script can break a site.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree but I don't want to stand in the way of this PR being merged. We might need a PR for https://github.com/Automattic/underscores.me/ too to search and replace _S.


wp_enqueue_script( '_s-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
wp_enqueue_script( '_s-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), _S_VERSION, true );

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
Expand Down
6 changes: 3 additions & 3 deletions inc/custom-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* You can add an optional custom header image to header.php like so ...
*
<?php the_header_image_tag(); ?>
* <?php the_header_image_tag(); ?>
*
* @link https://developer.wordpress.org/themes/functionality/custom-headers/
*
Expand Down Expand Up @@ -57,9 +57,9 @@ function _s_header_style() {
position: absolute;
clip: rect(1px, 1px, 1px, 1px);
}
<?php
// If the user has set a custom color for the text use that.
<?php
else :
// If the user has set a custom color for the text use that.
?>
.site-title a,
.site-description {
Expand Down
18 changes: 9 additions & 9 deletions inc/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function _s_woocommerce_setup() {
* @return void
*/
function _s_woocommerce_scripts() {
wp_enqueue_style( '_s-woocommerce-style', get_template_directory_uri() . '/woocommerce.css' );
wp_enqueue_style( '_s-woocommerce-style', get_template_directory_uri() . '/woocommerce.css', array(), _S_VERSION );

$font_path = WC()->plugin_url() . '/assets/fonts/';
$inline_font = '@font-face {
Expand Down Expand Up @@ -103,8 +103,8 @@ function _s_woocommerce_loop_columns() {
/**
* Related Products Args.
*
* @param array $args related products args.
* @return array $args related products args.
* @param array $args Related products args.
* @return array $args Related products args.
*/
function _s_woocommerce_related_products_args( $args ) {
$defaults = array(
Expand Down Expand Up @@ -175,7 +175,7 @@ function _s_woocommerce_wrapper_before() {
* @return void
*/
function _s_woocommerce_wrapper_after() {
?>
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
Expand All @@ -188,11 +188,11 @@ function _s_woocommerce_wrapper_after() {
*
* You can add the WooCommerce Mini Cart to header.php like so ...
*
<?php
if ( function_exists( '_s_woocommerce_header_cart' ) ) {
_s_woocommerce_header_cart();
}
?>
* <?php
* if ( function_exists( '_s_woocommerce_header_cart' ) ) {
* _s_woocommerce_header_cart();
* }
* ?>
*/

if ( ! function_exists( '_s_woocommerce_cart_link_fragment' ) ) {
Expand Down
33 changes: 2 additions & 31 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -97,36 +97,7 @@
#############################################################################
-->


<config name="testVersion" value="5.2-99.0"/>
<rule ref="PHPCompatibility">
<!-- Whitelist PHP native classes, interfaces, functions and constants which
are back-filled by WP.

Based on:
* /wp-includes/compat.php
* /wp-includes/random_compat/random.php
-->
<exclude name="PHPCompatibility.PHP.NewClasses.errorFound"/>
<exclude name="PHPCompatibility.PHP.NewClasses.typeerrorFound"/>

<exclude name="PHPCompatibility.PHP.NewConstants.json_pretty_printFound"/>
<exclude name="PHPCompatibility.PHP.NewConstants.php_version_idFound"/>

<exclude name="PHPCompatibility.PHP.NewFunctions.hash_equalsFound"/>
<exclude name="PHPCompatibility.PHP.NewFunctions.json_last_error_msgFound"/>
<exclude name="PHPCompatibility.PHP.NewFunctions.random_intFound"/>
<exclude name="PHPCompatibility.PHP.NewFunctions.random_bytesFound"/>
<exclude name="PHPCompatibility.PHP.NewFunctions.array_replace_recursiveFound"/>

<exclude name="PHPCompatibility.PHP.NewInterfaces.jsonserializableFound"/>
</rule>

<!-- Whitelist the WP Core mysql_to_rfc3339() function. -->
<rule ref="PHPCompatibility.PHP.RemovedExtensions">
<properties>
<property name="functionWhitelist" type="array" value="mysql_to_rfc3339"/>
</properties>
</rule>
<config name="testVersion" value="5.2-"/>
<rule ref="PHPCompatibilityWP"/>

</ruleset>