From 860d8c123a5c1d279aea2120c37d5f57fdd5b752 Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Sun, 19 Apr 2020 12:08:39 +0200 Subject: [PATCH] Fix WPCS errors and warnings + escaping Fixes many WPCS errors and warnings Also: * Partly removes excessive php opening/closing tags. * Uses printf for better readability in loop-templates/content-none.php. * Adds understrap_kses_title() to escape post titles. * Adds understrap_escape_the_archive_description() to escape the archive description. * Fixes missing '__' after esc_html in author.php. * Updates the phpcs.xml to reflect all the changes. * Updates composer dependencies and scripts. --- 404.php | 11 +- archive.php | 46 +- author.php | 52 +- composer.json | 23 +- composer.lock | 530 ++++++++++++++++-- functions.php | 2 +- global-templates/hero.php | 17 +- global-templates/left-sidebar-check.php | 8 +- global-templates/right-sidebar-check.php | 11 +- header.php | 13 +- inc/class-wp-bootstrap-navwalker.php | 6 +- inc/custom-header.php | 3 + inc/customizer.php | 2 +- inc/deprecated.php | 22 +- inc/editor.php | 2 +- inc/enqueue.php | 2 +- inc/extras.php | 107 +++- inc/hooks.php | 8 +- inc/jetpack.php | 29 +- inc/pagination.php | 2 +- inc/setup.php | 62 +- inc/template-tags.php | 62 +- inc/widgets.php | 7 +- inc/woocommerce.php | 39 +- inc/wpcom.php | 17 +- index.php | 29 +- loop-templates/content-none.php | 38 +- loop-templates/content-search.php | 2 +- loop-templates/content.php | 2 +- page-templates/blank.php | 13 +- page-templates/both-sidebarspage.php | 38 +- page-templates/fullwidthpage.php | 29 +- page-templates/left-sidebarpage.php | 23 +- page-templates/right-sidebarpage.php | 23 +- page.php | 20 +- phpcs.xml | 106 ++-- search.php | 15 +- sidebar-templates/sidebar-footerfull.php | 3 +- sidebar-templates/sidebar-hero.php | 3 +- sidebar-templates/sidebar-herocanvas.php | 11 +- sidebar-templates/sidebar-statichero.php | 3 +- single.php | 23 +- woocommerce/cart/cart-empty.php | 6 +- woocommerce/cart/cart.php | 15 +- woocommerce/cart/mini-cart.php | 3 +- .../cart/proceed-to-checkout-button.php | 2 +- woocommerce/checkout/form-checkout.php | 3 +- woocommerce/checkout/form-pay.php | 6 +- woocommerce/global/form-login.php | 9 +- woocommerce/loop/add-to-cart.php | 20 +- woocommerce/loop/orderby.php | 10 +- woocommerce/myaccount/downloads.php | 7 +- woocommerce/myaccount/form-edit-account.php | 3 +- woocommerce/myaccount/form-edit-address.php | 3 +- woocommerce/myaccount/form-login.php | 3 +- woocommerce/myaccount/my-address.php | 41 +- woocommerce/myaccount/my-orders.php | 59 +- woocommerce/myaccount/navigation.php | 5 +- woocommerce/myaccount/orders.php | 13 +- .../single-product/add-to-cart/simple.php | 17 +- .../variation-add-to-cart-button.php | 12 +- 61 files changed, 1165 insertions(+), 536 deletions(-) diff --git a/404.php b/404.php index 2298a86..8d28c1b 100644 --- a/404.php +++ b/404.php @@ -49,11 +49,11 @@ $container = get_theme_mod( 'understrap_container_type' ); 'count', - 'order' => 'DESC', + 'orderby' => 'count', + 'order' => 'DESC', 'show_count' => 1, - 'title_li' => '', - 'number' => 10, + 'title_li' => '', + 'number' => 10, ) ); ?> @@ -86,4 +86,5 @@ $container = get_theme_mod( 'understrap_container_type' ); - - - + - - - - - - - - - - - - - + } + } else { + get_template_part( 'loop-templates/content', 'none' ); + } + ?> - - + - - - - + - + - nickname ); ?> - ID ) ) : ?> - ID ); ?> - + ID ) ) { + echo get_avatar( $curauth->ID ); + } + ?> user_url ) || ! empty( $curauth->user_description ) ) : ?>
@@ -52,41 +54,38 @@ $container = get_theme_mod( 'understrap_container_type' ); user_description ) ) : ?>
-
user_description, 'understrap' ); ?>
+
user_description ); ?>
-

nickname ); ?>:

+

nickname ); ?>:

@@ -105,4 +104,5 @@ $container = get_theme_mod( 'understrap_container_type' ); -=5.6" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", - "wp-coding-standards/wpcs": "^2.1", - "phpcompatibility/php-compatibility": "^9.2" + "dealerdirect/phpcodesniffer-composer-installer": "^0.6", + "roave/security-advisories": "dev-master", + "wptrt/wpthemereview": "^0.2" }, "scripts": { - "test": ["vendor/bin/phpcs"], - "fix": ["vendor/bin/phpcbf"] + "check-cs": ["@php ./vendor/squizlabs/php_codesniffer/bin/phpcs -w"], + "fix-cs": ["@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf"] + }, + "support": { + "issues": "https://github.com/understrap/understrap/issues", + "source": "https://github.com/understrap/understrap" } -} +} \ No newline at end of file diff --git a/composer.lock b/composer.lock index 2441126..0fed94f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,32 +4,35 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6e38e340aaa610ed48211f151263555e", + "content-hash": "ad43b10fb1995d73959eae985e5b630c", "packages": [ { "name": "composer/installers", - "version": "v1.6.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/composer/installers.git", - "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b" + "reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b", - "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b", + "url": "https://api.github.com/repos/composer/installers/zipball/b93bcf0fa1fccb0b7d176b0967d969691cd74cca", + "reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0" + "composer-plugin-api": "^1.0 || ^2.0" }, "replace": { "roundcube/plugin-installer": "*", "shama/baton": "*" }, "require-dev": { - "composer/composer": "1.0.*@dev", - "phpunit/phpunit": "^4.8.36" + "composer/composer": "1.6.* || 2.0.*@dev", + "composer/semver": "1.0.* || 2.0.*@dev", + "phpunit/phpunit": "^4.8.36", + "sebastian/comparator": "^1.2.4", + "symfony/process": "^2.3" }, "type": "composer-plugin", "extra": { @@ -65,6 +68,7 @@ "Kanboard", "Lan Management System", "MODX Evo", + "MantisBT", "Mautic", "Maya", "OXID", @@ -73,6 +77,7 @@ "RadPHP", "SMF", "Thelia", + "Whmcs", "WolfCMS", "agl", "aimeos", @@ -95,6 +100,7 @@ "installer", "itop", "joomla", + "known", "kohana", "laravel", "lavalite", @@ -117,6 +123,7 @@ "shopware", "silverstripe", "sydes", + "sylius", "symfony", "typo3", "wordpress", @@ -124,22 +131,22 @@ "zend", "zikula" ], - "time": "2018-08-27T06:10:37+00:00" + "time": "2020-04-07T06:57:05+00:00" } ], "packages-dev": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.5.0", + "version": "v0.6.2", "source": { "type": "git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "e749410375ff6fb7a040a68878c656c2e610b132" + "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132", - "reference": "e749410375ff6fb7a040a68878c656c2e610b132", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/8001af8eb107fbfcedc31a8b51e20b07d85b457a", + "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a", "shasum": "" }, "require": { @@ -192,20 +199,20 @@ "stylecheck", "tests" ], - "time": "2018-10-26T13:21:45+00:00" + "time": "2020-01-29T20:22:20+00:00" }, { "name": "phpcompatibility/php-compatibility", - "version": "9.2.0", + "version": "9.3.5", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", - "reference": "3db1bf1e28123fd574a4ae2e9a84072826d51b5e" + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/3db1bf1e28123fd574a4ae2e9a84072826d51b5e", - "reference": "3db1bf1e28123fd574a4ae2e9a84072826d51b5e", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", "shasum": "" }, "require": { @@ -228,10 +235,6 @@ "LGPL-3.0-or-later" ], "authors": [ - { - "name": "Contributors", - "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" - }, { "name": "Wim Godden", "homepage": "https://github.com/wimg", @@ -241,6 +244,10 @@ "name": "Juliette Reinders Folmer", "homepage": "https://github.com/jrfnl", "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" } ], "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", @@ -250,20 +257,386 @@ "phpcs", "standards" ], - "time": "2019-06-27T19:58:56+00:00" + "time": "2019-12-27T09:44:58+00:00" }, { - "name": "squizlabs/php_codesniffer", - "version": "3.4.2", + "name": "phpcompatibility/phpcompatibility-paragonie", + "version": "1.3.0", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8" + "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", + "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", - "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/b862bc32f7e860d0b164b199bd995e690b4b191c", + "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5", + "paragonie/random_compat": "dev-master", + "paragonie/sodium_compat": "dev-master" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "paragonie", + "phpcs", + "polyfill", + "standards" + ], + "time": "2019-11-04T15:17:54+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-wp", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", + "reference": "41bef18ba688af638b7310666db28e1ea9158b2f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/41bef18ba688af638b7310666db28e1ea9158b2f", + "reference": "41bef18ba688af638b7310666db28e1ea9158b2f", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0", + "phpcompatibility/phpcompatibility-paragonie": "^1.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "phpcs", + "standards", + "wordpress" + ], + "time": "2019-08-28T14:22:28+00:00" + }, + { + "name": "roave/security-advisories", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/Roave/SecurityAdvisories.git", + "reference": "09afa996c68c18f49e6487b06adcb2ef27da61fa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/09afa996c68c18f49e6487b06adcb2ef27da61fa", + "reference": "09afa996c68c18f49e6487b06adcb2ef27da61fa", + "shasum": "" + }, + "conflict": { + "3f/pygmentize": "<1.2", + "adodb/adodb-php": "<5.20.12", + "alterphp/easyadmin-extension-bundle": ">=1.2,<1.2.11|>=1.3,<1.3.1", + "amphp/artax": "<1.0.6|>=2,<2.0.6", + "amphp/http": "<1.0.1", + "api-platform/core": ">=2.2,<2.2.10|>=2.3,<2.3.6", + "asymmetricrypt/asymmetricrypt": ">=0,<9.9.99", + "aws/aws-sdk-php": ">=3,<3.2.1", + "bagisto/bagisto": "<0.1.5", + "bolt/bolt": "<3.6.10", + "brightlocal/phpwhois": "<=4.2.5", + "buddypress/buddypress": "<5.1.2", + "bugsnag/bugsnag-laravel": ">=2,<2.0.2", + "cakephp/cakephp": ">=1.3,<1.3.18|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=2.7,<2.7.6|>=3,<3.5.18|>=3.6,<3.6.15|>=3.7,<3.7.7", + "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", + "cartalyst/sentry": "<=2.1.6", + "centreon/centreon": "<18.10.8|>=19,<19.4.5", + "cesnet/simplesamlphp-module-proxystatistics": "<3.1", + "codeigniter/framework": "<=3.0.6", + "composer/composer": "<=1-alpha.11", + "contao-components/mediaelement": ">=2.14.2,<2.21.1", + "contao/core": ">=2,<3.5.39", + "contao/core-bundle": ">=4,<4.4.46|>=4.5,<4.8.6", + "contao/listing-bundle": ">=4,<4.4.8", + "datadog/dd-trace": ">=0.30,<0.30.2", + "david-garcia/phpwhois": "<=4.3.1", + "doctrine/annotations": ">=1,<1.2.7", + "doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2", + "doctrine/common": ">=2,<2.4.3|>=2.5,<2.5.1", + "doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2", + "doctrine/doctrine-bundle": "<1.5.2", + "doctrine/doctrine-module": "<=0.7.1", + "doctrine/mongodb-odm": ">=1,<1.0.2", + "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", + "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", + "dolibarr/dolibarr": "<=10.0.6", + "dompdf/dompdf": ">=0.6,<0.6.2", + "drupal/core": ">=7,<7.69|>=8,<8.7.12|>=8.8,<8.8.4", + "drupal/drupal": ">=7,<7.69|>=8,<8.7.12|>=8.8,<8.8.4", + "endroid/qr-code-bundle": "<3.4.2", + "enshrined/svg-sanitize": "<0.13.1", + "erusev/parsedown": "<1.7.2", + "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1|>=5.4,<5.4.11.1|>=2017.12,<2017.12.0.1", + "ezsystems/ezplatform": ">=1.7,<1.7.9.1|>=1.13,<1.13.5.1|>=2.5,<2.5.4", + "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6", + "ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2", + "ezsystems/ezplatform-user": ">=1,<1.0.1", + "ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.14.1|>=6,<6.7.9.1|>=6.8,<6.13.6.2|>=7,<7.2.4.1|>=7.3,<7.3.2.1|>=7.5,<7.5.6.2", + "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.6|>=5.4,<5.4.14.1|>=2011,<2017.12.7.2|>=2018.6,<2018.6.1.4|>=2018.9,<2018.9.1.3|>=2019.3,<2019.3.4.2", + "ezsystems/repository-forms": ">=2.3,<2.3.2.1", + "ezyang/htmlpurifier": "<4.1.1", + "firebase/php-jwt": "<2", + "fooman/tcpdf": "<6.2.22", + "fossar/tcpdf-parser": "<6.2.22", + "friendsofsymfony/oauth2-php": "<1.3", + "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", + "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", + "fuel/core": "<1.8.1", + "getgrav/grav": "<1.7-beta.8", + "gree/jose": "<=2.2", + "gregwar/rst": "<1.0.3", + "guzzlehttp/guzzle": ">=4-rc.2,<4.2.4|>=5,<5.3.1|>=6,<6.2.1", + "illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10", + "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30", + "illuminate/database": ">=4,<4.0.99|>=4.1,<4.1.29", + "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", + "illuminate/view": ">=7,<7.1.2", + "ivankristianto/phpwhois": "<=4.3", + "james-heinrich/getid3": "<1.9.9", + "joomla/session": "<1.3.1", + "jsmitty12/phpwhois": "<5.1", + "kazist/phpwhois": "<=4.2.6", + "kreait/firebase-php": ">=3.2,<3.8.1", + "la-haute-societe/tcpdf": "<6.2.22", + "laravel/framework": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30|>=7,<7.1.2", + "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", + "league/commonmark": "<0.18.3", + "librenms/librenms": "<1.53", + "magento/community-edition": ">=2,<2.2.10|>=2.3,<2.3.3", + "magento/magento1ce": "<1.9.4.3", + "magento/magento1ee": ">=1,<1.14.4.3", + "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2", + "monolog/monolog": ">=1.8,<1.12", + "namshi/jose": "<2.2", + "onelogin/php-saml": "<2.10.4", + "oneup/uploader-bundle": "<1.9.3|>=2,<2.1.5", + "openid/php-openid": "<2.3", + "oro/crm": ">=1.7,<1.7.4", + "oro/platform": ">=1.7,<1.7.4", + "padraic/humbug_get_contents": "<1.1.2", + "pagarme/pagarme-php": ">=0,<3", + "paragonie/random_compat": "<2", + "paypal/merchant-sdk-php": "<3.12", + "pear/archive_tar": "<1.4.4", + "phpfastcache/phpfastcache": ">=5,<5.0.13", + "phpmailer/phpmailer": ">=5,<5.2.27|>=6,<6.0.6", + "phpmyadmin/phpmyadmin": "<4.9.2", + "phpoffice/phpexcel": "<1.8.2", + "phpoffice/phpspreadsheet": "<1.8", + "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", + "phpwhois/phpwhois": "<=4.2.5", + "phpxmlrpc/extras": "<0.6.1", + "pimcore/pimcore": "<6.3", + "prestashop/autoupgrade": ">=4,<4.10.1", + "prestashop/gamification": "<2.3.2", + "prestashop/ps_facetedsearch": "<3.4.1", + "privatebin/privatebin": "<1.2.2|>=1.3,<1.3.2", + "propel/propel": ">=2-alpha.1,<=2-alpha.7", + "propel/propel1": ">=1,<=1.7.1", + "pusher/pusher-php-server": "<2.2.1", + "robrichards/xmlseclibs": "<3.0.4", + "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", + "scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11", + "sensiolabs/connect": "<4.2.3", + "serluck/phpwhois": "<=4.2.6", + "shopware/shopware": "<5.3.7", + "silverstripe/admin": ">=1.0.3,<1.0.4|>=1.1,<1.1.1", + "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", + "silverstripe/cms": "<4.3.6|>=4.4,<4.4.4", + "silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1", + "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", + "silverstripe/framework": "<4.4.5|>=4.5,<4.5.2", + "silverstripe/graphql": ">=2,<2.0.5|>=3,<3.1.2", + "silverstripe/registry": ">=2.1,<2.1.2|>=2.2,<2.2.1", + "silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4", + "silverstripe/subsites": ">=2,<2.1.1", + "silverstripe/taxonomy": ">=1.3,<1.3.1|>=2,<2.0.1", + "silverstripe/userforms": "<3", + "simple-updates/phpwhois": "<=1", + "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4", + "simplesamlphp/simplesamlphp": "<1.18.4", + "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", + "simplito/elliptic-php": "<1.0.6", + "slim/slim": "<2.6", + "smarty/smarty": "<3.1.33", + "socalnick/scn-social-auth": "<1.15.2", + "spoonity/tcpdf": "<6.2.22", + "squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1", + "ssddanbrown/bookstack": "<0.25.3", + "stormpath/sdk": ">=0,<9.9.99", + "studio-42/elfinder": "<2.1.49", + "swiftmailer/swiftmailer": ">=4,<5.4.5", + "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", + "sylius/grid": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", + "sylius/grid-bundle": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", + "sylius/resource-bundle": "<1.3.13|>=1.4,<1.4.6|>=1.5,<1.5.1|>=1.6,<1.6.3", + "sylius/sylius": "<1.3.16|>=1.4,<1.4.12|>=1.5,<1.5.9|>=1.6,<1.6.5", + "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", + "symbiote/silverstripe-versionedfiles": "<=2.0.3", + "symfony/cache": ">=3.1,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8", + "symfony/dependency-injection": ">=2,<2.0.17|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", + "symfony/error-handler": ">=4.4,<4.4.4|>=5,<5.0.4", + "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", + "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", + "symfony/http-foundation": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", + "symfony/http-kernel": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8", + "symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", + "symfony/mime": ">=4.3,<4.3.8", + "symfony/phpunit-bridge": ">=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", + "symfony/polyfill": ">=1,<1.10", + "symfony/polyfill-php55": ">=1,<1.10", + "symfony/proxy-manager-bridge": ">=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", + "symfony/routing": ">=2,<2.0.19", + "symfony/security": ">=2,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7|>=4.4,<4.4.7|>=5,<5.0.7", + "symfony/security-bundle": ">=2,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", + "symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<2.8.37|>=3,<3.3.17|>=3.4,<3.4.7|>=4,<4.0.7", + "symfony/security-csrf": ">=2.4,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", + "symfony/security-guard": ">=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", + "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", + "symfony/serializer": ">=2,<2.0.11", + "symfony/symfony": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", + "symfony/translation": ">=2,<2.0.17", + "symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3", + "symfony/var-exporter": ">=4.2,<4.2.12|>=4.3,<4.3.8", + "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", + "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", + "tecnickcom/tcpdf": "<6.2.22", + "thelia/backoffice-default-template": ">=2.1,<2.1.2", + "thelia/thelia": ">=2.1-beta.1,<2.1.3", + "theonedemon/phpwhois": "<=4.2.5", + "titon/framework": ">=0,<9.9.99", + "truckersmp/phpwhois": "<=4.3.1", + "twig/twig": "<1.38|>=2,<2.7", + "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.30|>=9,<9.5.12|>=10,<10.2.1", + "typo3/cms-core": ">=8,<8.7.30|>=9,<9.5.12|>=10,<10.2.1", + "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5", + "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4", + "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", + "ua-parser/uap-php": "<3.8", + "usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2", + "verot/class.upload.php": "<=1.0.3|>=2,<=2.0.4", + "wallabag/tcpdf": "<6.2.22", + "willdurand/js-translation-bundle": "<2.1.1", + "yii2mod/yii2-cms": "<1.9.2", + "yiisoft/yii": ">=1.1.14,<1.1.15", + "yiisoft/yii2": "<2.0.15", + "yiisoft/yii2-bootstrap": "<2.0.4", + "yiisoft/yii2-dev": "<2.0.15", + "yiisoft/yii2-elasticsearch": "<2.0.5", + "yiisoft/yii2-gii": "<2.0.4", + "yiisoft/yii2-jui": "<2.0.4", + "yiisoft/yii2-redis": "<2.0.8", + "yourls/yourls": "<1.7.4", + "zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3", + "zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2", + "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2", + "zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5", + "zendframework/zend-developer-tools": ">=1.2.2,<1.2.3", + "zendframework/zend-diactoros": ">=1,<1.8.4", + "zendframework/zend-feed": ">=1,<2.10.3", + "zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-http": ">=1,<2.8.1", + "zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6", + "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3", + "zendframework/zend-mail": ">=2,<2.4.11|>=2.5,<2.7.2", + "zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4", + "zendframework/zend-validator": ">=2.3,<2.3.6", + "zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6", + "zendframework/zendframework": "<2.5.1", + "zendframework/zendframework1": "<1.12.20", + "zendframework/zendopenid": ">=2,<2.0.2", + "zendframework/zendxml": ">=1,<1.0.1", + "zetacomponents/mail": "<1.8.2", + "zf-commons/zfc-user": "<1.2.2", + "zfcampus/zf-apigility-doctrine": ">=1,<1.0.3", + "zfr/zfr-oauth2-server-module": "<0.1.2" + }, + "type": "metapackage", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "role": "maintainer" + }, + { + "name": "Ilya Tribusean", + "email": "slash3b@gmail.com", + "role": "maintainer" + } + ], + "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", + "time": "2020-04-15T04:56:51+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.5.5", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6", + "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6", "shasum": "" }, "require": { @@ -301,20 +674,20 @@ "phpcs", "standards" ], - "time": "2019-04-10T23:49:02+00:00" + "time": "2020-04-17T01:09:41+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "2.1.1", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "bd9c33152115e6741e3510ff7189605b35167908" + "reference": "b5a453203114cc2284b1a614c4953456fbe4f546" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/bd9c33152115e6741e3510ff7189605b35167908", - "reference": "bd9c33152115e6741e3510ff7189605b35167908", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b5a453203114cc2284b1a614c4953456fbe4f546", + "reference": "b5a453203114cc2284b1a614c4953456fbe4f546", "shasum": "" }, "require": { @@ -322,10 +695,58 @@ "squizlabs/php_codesniffer": "^3.3.1" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", "phpcompatibility/php-compatibility": "^9.0", "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", + "keywords": [ + "phpcs", + "standards", + "wordpress" + ], + "time": "2020-02-04T02:52:06+00:00" + }, + { + "name": "wptrt/wpthemereview", + "version": "0.2.1", + "source": { + "type": "git", + "url": "https://github.com/WPTRT/WPThemeReview.git", + "reference": "462e59020dad9399ed2fe8e61f2a21b5e206e420" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WPTRT/WPThemeReview/zipball/462e59020dad9399ed2fe8e61f2a21b5e206e420", + "reference": "462e59020dad9399ed2fe8e61f2a21b5e206e420", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcompatibility/phpcompatibility-wp": "^2.0", + "squizlabs/php_codesniffer": "^3.3.1", + "wp-coding-standards/wpcs": "^2.2.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", + "phpcompatibility/php-compatibility": "^9.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0", + "roave/security-advisories": "dev-master" + }, "suggest": { "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." }, @@ -335,25 +756,52 @@ "MIT" ], "authors": [ + { + "name": "Theme Review Team", + "homepage": "https://make.wordpress.org/themes/handbook/", + "role": "Strategy and rule setting" + }, + { + "name": "Ulrich Pogson", + "homepage": "https://github.com/grappler", + "role": "Lead developer" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "Lead developer" + }, + { + "name": "Denis Žoljom", + "homepage": "https://github.com/dingo-d", + "role": "Plugin integration lead" + }, { "name": "Contributors", - "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors" + "homepage": "https://github.com/WPTRT/WPThemeReview/graphs/contributors" } ], - "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", + "description": "PHP_CodeSniffer rules (sniffs) to verify theme compliance with the rules for theme hosting on wordpress.org", + "homepage": "https://make.wordpress.org/themes/handbook/review/", "keywords": [ "phpcs", "standards", + "themes", "wordpress" ], - "time": "2019-05-21T02:50:00+00:00" + "time": "2019-11-17T20:05:55+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "roave/security-advisories": 20 + }, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [] + "platform": { + "php": ">=5.6" + }, + "platform-dev": [], + "plugin-api-version": "1.1.0" } diff --git a/functions.php b/functions.php index 414df1f..c374e7d 100644 --- a/functions.php +++ b/functions.php @@ -20,7 +20,7 @@ $understrap_includes = array( '/customizer.php', // Customizer additions. '/custom-comments.php', // Custom Comments file. '/jetpack.php', // Load Jetpack compatibility file. - '/class-wp-bootstrap-navwalker.php', // Load custom WordPress nav walker. Trying to get deeper navigation? Check out: https://github.com/understrap/understrap/issues/567 + '/class-wp-bootstrap-navwalker.php', // Load custom WordPress nav walker. Trying to get deeper navigation? Check out: https://github.com/understrap/understrap/issues/567. '/woocommerce.php', // Load WooCommerce functions. '/editor.php', // Load Editor functions. '/deprecated.php', // Load deprecated functions. diff --git a/global-templates/hero.php b/global-templates/hero.php index 31ec82c..0962444 100644 --- a/global-templates/hero.php +++ b/global-templates/hero.php @@ -7,18 +7,19 @@ // Exit if accessed directly. defined( 'ABSPATH' ) || exit; -?> - +if ( is_active_sidebar( 'hero' ) || is_active_sidebar( 'statichero' ) || is_active_sidebar( 'herocanvas' ) ) : + ?>
- - - - - +
- - - - -
diff --git a/global-templates/right-sidebar-check.php b/global-templates/right-sidebar-check.php index 90af56e..b085e46 100644 --- a/global-templates/right-sidebar-check.php +++ b/global-templates/right-sidebar-check.php @@ -11,10 +11,9 @@ defined( 'ABSPATH' ) || exit;
- + - - - - - + } + ?> + - 'primary', 'container_class' => 'collapse navbar-collapse', @@ -73,7 +77,8 @@ $container = get_theme_mod( 'understrap_container_type' ); 'depth' => 2, 'walker' => new Understrap_WP_Bootstrap_Navwalker(), ) - ); ?> + ); + ?> diff --git a/inc/class-wp-bootstrap-navwalker.php b/inc/class-wp-bootstrap-navwalker.php index aee0413..139bff9 100644 --- a/inc/class-wp-bootstrap-navwalker.php +++ b/inc/class-wp-bootstrap-navwalker.php @@ -20,7 +20,7 @@ defined( 'ABSPATH' ) || exit; * GitHub Branch: master * License: GPL-3.0+ * License URI: http://www.gnu.org/licenses/gpl-3.0.txt -*/ + */ /* Check if Class Exists. */ if ( ! class_exists( 'Understrap_WP_Bootstrap_Navwalker' ) ) { @@ -182,7 +182,7 @@ if ( ! class_exists( 'Understrap_WP_Bootstrap_Navwalker' ) ) { } $atts['target'] = ! empty( $item->target ) ? $item->target : ''; - if ( '_blank' === $item->target && empty( $item->xfn ) ) { // Thanks to LukaszJaro, see https://github.com/understrap/understrap/issues/973 + if ( '_blank' === $item->target && empty( $item->xfn ) ) { // Thanks to LukaszJaro, see https://github.com/understrap/understrap/issues/973. $atts['rel'] = 'noopener noreferrer'; } else { $atts['rel'] = $item->xfn; @@ -381,7 +381,7 @@ if ( ! class_exists( 'Understrap_WP_Bootstrap_Navwalker' ) ) { // if $args has 'echo' key and it's true echo, otherwise return. if ( array_key_exists( 'echo', $args ) && $args['echo'] ) { - echo $fallback_output; // WPCS: XSS OK. + echo $fallback_output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } else { return $fallback_output; } diff --git a/inc/custom-header.php b/inc/custom-header.php index 06336e1..fd4e86c 100644 --- a/inc/custom-header.php +++ b/inc/custom-header.php @@ -11,6 +11,9 @@ defined( 'ABSPATH' ) || exit; add_action( 'after_setup_theme', 'understrap_custom_header_setup' ); if ( ! function_exists( 'understrap_custom_header_setup' ) ) { + /** + * Set up custom header feature. + */ function understrap_custom_header_setup() { /** diff --git a/inc/customizer.php b/inc/customizer.php index 25a9edb..46ee949 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -130,7 +130,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) { ) ); } -} // endif function_exists( 'understrap_theme_customize_register' ). +} // End of if function_exists( 'understrap_theme_customize_register' ). add_action( 'customize_register', 'understrap_theme_customize_register' ); /** diff --git a/inc/deprecated.php b/inc/deprecated.php index b9a5db6..6ccabb5 100644 --- a/inc/deprecated.php +++ b/inc/deprecated.php @@ -21,26 +21,26 @@ if ( ! function_exists( 'understrap_slbd_count_widgets' ) ) { // to see if wp_convert_widget_settings() has made manipulations in memory. global $_wp_sidebars_widgets; if ( empty( $_wp_sidebars_widgets ) ) : - $_wp_sidebars_widgets = get_option( 'sidebars_widgets', array() ); + $_wp_sidebars_widgets = get_option( 'sidebars_widgets', array() ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited endif; $sidebars_widgets_count = $_wp_sidebars_widgets; if ( isset( $sidebars_widgets_count[ $sidebar_id ] ) ) : - $widget_count = count( $sidebars_widgets_count[ $sidebar_id ] ); + $widget_count = count( $sidebars_widgets_count[ $sidebar_id ] ); $widget_classes = 'widget-count-' . count( $sidebars_widgets_count[ $sidebar_id ] ); - if ( 0 == $widget_count % 4 || $widget_count > 6 ) : - // Four widgets per row if there are exactly four or more than six + if ( 0 == $widget_count % 4 || $widget_count > 6 ) : // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + // Four widgets per row if there are exactly four or more than six. $widget_classes .= ' col-md-3'; - elseif ( 6 == $widget_count ) : - // If two widgets are published + elseif ( 6 == $widget_count ) : // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + // If two widgets are published. $widget_classes .= ' col-md-2'; elseif ( $widget_count >= 3 ) : - // Three widgets per row if there's three or more widgets + // Three widgets per row if there's three or more widgets. $widget_classes .= ' col-md-4'; - elseif ( 2 == $widget_count ) : - // If two widgets are published + elseif ( 2 == $widget_count ) : // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + // If two widgets are published. $widget_classes .= ' col-md-6'; - elseif ( 1 == $widget_count ) : - // If just on widget is active + elseif ( 1 == $widget_count ) : // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + // If just on widget is active. $widget_classes .= ' col-md-12'; endif; return $widget_classes; diff --git a/inc/editor.php b/inc/editor.php index f3c6599..c46fb61 100644 --- a/inc/editor.php +++ b/inc/editor.php @@ -24,7 +24,7 @@ add_filter( 'mce_buttons_2', 'understrap_tiny_mce_style_formats' ); if ( ! function_exists( 'understrap_tiny_mce_style_formats' ) ) { /** * Reveals TinyMCE's hidden Style dropdown. - * + * * @param array $buttons Array of Tiny MCE's button ids. * @return array */ diff --git a/inc/enqueue.php b/inc/enqueue.php index fdb6921..8bcc6ce 100644 --- a/inc/enqueue.php +++ b/inc/enqueue.php @@ -28,6 +28,6 @@ if ( ! function_exists( 'understrap_scripts' ) ) { wp_enqueue_script( 'comment-reply' ); } } -} // endif function_exists( 'understrap_scripts' ). +} // End of if function_exists( 'understrap_scripts' ). add_action( 'wp_enqueue_scripts', 'understrap_scripts' ); diff --git a/inc/extras.php b/inc/extras.php index 66f327f..e1a76fd 100644 --- a/inc/extras.php +++ b/inc/extras.php @@ -48,7 +48,7 @@ if ( ! function_exists( 'understrap_adjust_body_class' ) ) { function understrap_adjust_body_class( $classes ) { foreach ( $classes as $key => $value ) { - if ( 'tag' == $value ) { + if ( 'tag' === $value ) { unset( $classes[ $key ] ); } } @@ -147,3 +147,108 @@ if ( ! function_exists( 'understrap_default_body_attributes' ) ) { } } add_filter( 'understrap_body_attributes', 'understrap_default_body_attributes' ); + +// Escapes all occurances of 'the_archive_description'. +add_filter( 'get_the_archive_description', 'understrap_escape_the_archive_description' ); + +if ( ! function_exists( 'understrap_escape_the_archive_description' ) ) { + /** + * Escapes the description for an author or post type archive. + * + * @param string $description Archive description. + * @return string Maybe escaped $description. + */ + function understrap_escape_the_archive_description( $description ) { + if ( is_author() || is_post_type_archive() ) { + return wp_kses_post( $description ); + } else { + /* + * All other descriptions are retrieved via term_description() which returns + * a sanitized description. + */ + return $description; + } + } +} // End of if function_exists( 'understrap_escape_the_archive_description' ). + +// Escapes all occurances of 'the_title()' and 'get_the_title()'. +add_filter( 'the_title', 'understrap_kses_title' ); + +// Escapes all occurances of 'the_archive_title' and 'get_the_archive_title()'. +add_filter( 'get_the_archive_title', 'understrap_kses_title' ); + +if ( ! function_exists( 'understrap_kses_title' ) ) { + /** + * Sanitizes data for allowed HTML tags for post title. + * + * @param string $data Post title to filter. + * @return string Filtered post title with allowed HTML tags and attributes intact. + */ + function understrap_kses_title( $data ) { + // Tags not supported in HTML5 are not allowed. + $allowed_tags = array( + 'abbr' => array(), + 'aria-describedby' => true, + 'aria-details' => true, + 'aria-label' => true, + 'aria-labelledby' => true, + 'aria-hidden' => true, + 'b' => array(), + 'bdo' => array( + 'dir' => true, + ), + 'blockquote' => array( + 'cite' => true, + 'lang' => true, + 'xml:lang' => true, + ), + 'cite' => array( + 'dir' => true, + 'lang' => true, + ), + 'dfn' => array(), + 'em' => array(), + 'i' => array( + 'aria-describedby' => true, + 'aria-details' => true, + 'aria-label' => true, + 'aria-labelledby' => true, + 'aria-hidden' => true, + 'class' => true, + ), + 'code' => array(), + 'del' => array( + 'datetime' => true, + ), + 'ins' => array( + 'datetime' => true, + 'cite' => true, + ), + 'kbd' => array(), + 'mark' => array(), + 'pre' => array( + 'width' => true, + ), + 'q' => array( + 'cite' => true, + ), + 's' => array(), + 'samp' => array(), + 'span' => array( + 'dir' => true, + 'align' => true, + 'lang' => true, + 'xml:lang' => true, + ), + 'small' => array(), + 'strong' => array(), + 'sub' => array(), + 'sup' => array(), + 'u' => array(), + 'var' => array(), + ); + $allowed_tags = apply_filters( 'understrap_kses_title', $allowed_tags ); + + return wp_kses( $data, $allowed_tags ); + } +} // End of if function_exists( 'understrap_kses_title' ). diff --git a/inc/hooks.php b/inc/hooks.php index a3f854d..f91daee 100644 --- a/inc/hooks.php +++ b/inc/hooks.php @@ -29,23 +29,23 @@ if ( ! function_exists( 'understrap_add_site_info' ) ) { '%2$s | %3$s(%4$s)', esc_url( __( 'http://wordpress.org/', 'understrap' ) ), sprintf( - /* translators:*/ + /* translators: WordPress */ esc_html__( 'Proudly powered by %s', 'understrap' ), 'WordPress' ), sprintf( // WPCS: XSS ok. - /* translators:*/ + /* translators: 1: Theme name, 2: Theme author */ esc_html__( 'Theme: %1$s by %2$s.', 'understrap' ), $the_theme->get( 'Name' ), 'understrap.com' ), sprintf( // WPCS: XSS ok. - /* translators:*/ + /* translators: Theme version */ esc_html__( 'Version: %1$s', 'understrap' ), $the_theme->get( 'Version' ) ) ); - echo apply_filters( 'understrap_site_info_content', $site_info ); // WPCS: XSS ok. + echo apply_filters( 'understrap_site_info_content', $site_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } diff --git a/inc/jetpack.php b/inc/jetpack.php index f91982f..5d60333 100644 --- a/inc/jetpack.php +++ b/inc/jetpack.php @@ -10,16 +10,16 @@ // Exit if accessed directly. defined( 'ABSPATH' ) || exit; -/** - * Jetpack setup function. - * - * See: https://jetpack.me/support/infinite-scroll/ - * See: https://jetpack.me/support/responsive-videos/ - */ - add_action( 'after_setup_theme', 'understrap_components_jetpack_setup' ); if ( ! function_exists( 'understrap_components_jetpack_setup' ) ) { + /** + * Jetpack setup function. + * + * @link https://jetpack.me/support/infinite-scroll/ + * @link https://jetpack.me/support/responsive-videos/ + * @link https://jetpack.me/support/social-menu/ + */ function understrap_components_jetpack_setup() { // Add theme support for Infinite Scroll. add_theme_support( @@ -34,18 +34,16 @@ if ( ! function_exists( 'understrap_components_jetpack_setup' ) ) { // Add theme support for Responsive Videos. add_theme_support( 'jetpack-responsive-videos' ); - // Add theme support for Social Menus + // Add theme support for Social Menus. add_theme_support( 'jetpack-social-menu' ); } } - -/** - * Custom render function for Infinite Scroll. - */ - if ( ! function_exists( 'understrap_components_infinite_scroll_render' ) ) { + /** + * Custom render function for Infinite Scroll. + */ function understrap_components_infinite_scroll_render() { while ( have_posts() ) { the_post(); @@ -59,8 +57,13 @@ if ( ! function_exists( 'understrap_components_infinite_scroll_render' ) ) { } if ( ! function_exists( 'understrap_components_social_menu' ) ) { + /** + * Display Jetpack's social menu if available. + * Avoids fatal errors if Jetpack isn’t activated. + */ function understrap_components_social_menu() { if ( ! function_exists( 'jetpack_social_menu' ) ) { + // Return early if social menu is not available. return; } else { jetpack_social_menu(); diff --git a/inc/pagination.php b/inc/pagination.php index 1bfbcbb..7f5f212 100644 --- a/inc/pagination.php +++ b/inc/pagination.php @@ -77,7 +77,7 @@ if ( ! function_exists( 'understrap_pagination' ) ) { foreach ( $links as $key => $link ) { ?>
  • - +
  • __( 'Primary Menu', 'understrap' ), - ) ); + register_nav_menus( + array( + 'primary' => __( 'Primary Menu', 'understrap' ), + ) + ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ - add_theme_support( 'html5', array( - 'search-form', - 'comment-form', - 'comment-list', - 'gallery', - 'caption', - ) ); + add_theme_support( + 'html5', + array( + 'search-form', + 'comment-form', + 'comment-list', + 'gallery', + 'caption', + ) + ); /* * Adding Thumbnail basic support @@ -74,19 +79,28 @@ if ( ! function_exists( 'understrap_setup' ) ) { * Enable support for Post Formats. * See http://codex.wordpress.org/Post_Formats */ - add_theme_support( 'post-formats', array( - 'aside', - 'image', - 'video', - 'quote', - 'link', - ) ); + add_theme_support( + 'post-formats', + array( + 'aside', + 'image', + 'video', + 'quote', + 'link', + ) + ); // Set up the WordPress core custom background feature. - add_theme_support( 'custom-background', apply_filters( 'understrap_custom_background_args', array( - 'default-color' => 'ffffff', - 'default-image' => '', - ) ) ); + add_theme_support( + 'custom-background', + apply_filters( + 'understrap_custom_background_args', + array( + 'default-color' => 'ffffff', + 'default-image' => '', + ) + ) + ); // Set up the WordPress Theme logo feature. add_theme_support( 'custom-logo' ); @@ -131,8 +145,10 @@ if ( ! function_exists( 'understrap_all_excerpts_get_more_link' ) ) { */ function understrap_all_excerpts_get_more_link( $post_excerpt ) { if ( ! is_admin() ) { - $post_excerpt = $post_excerpt . ' [...]

    ' . __( 'Read More...', - 'understrap' ) . '

    '; + $post_excerpt = $post_excerpt . ' [...]

    ' . __( + 'Read More...', + 'understrap' + ) . '

    '; } return $post_excerpt; } diff --git a/inc/template-tags.php b/inc/template-tags.php index e8bba11..ef8a4ae 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -10,23 +10,25 @@ // Exit if accessed directly. defined( 'ABSPATH' ) || exit; -/** - * Prints HTML with meta information for the current post-date/time and author. - */ if ( ! function_exists( 'understrap_posted_on' ) ) { + /** + * Prints HTML with meta information for the current post-date/time and author. + */ function understrap_posted_on() { $time_string = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } - $time_string = sprintf( $time_string, + $time_string = sprintf( + $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); $posted_on = apply_filters( - 'understrap_posted_on', sprintf( + 'understrap_posted_on', + sprintf( '%1$s %3$s', esc_html_x( 'Posted on', 'post date', 'understrap' ), esc_url( get_permalink() ), @@ -34,21 +36,22 @@ if ( ! function_exists( 'understrap_posted_on' ) ) { ) ); $byline = apply_filters( - 'understrap_posted_by', sprintf( + 'understrap_posted_by', + sprintf( ' %1$s %3$s', $posted_on ? esc_html_x( 'by', 'post author', 'understrap' ) : esc_html_x( 'Posted by', 'post author', 'understrap' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_html( get_the_author() ) ) ); - echo $posted_on . $byline; // WPCS: XSS OK. + echo $posted_on . $byline; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } -/** - * Prints HTML with meta information for the categories, tags and comments. - */ if ( ! function_exists( 'understrap_entry_footer' ) ) { + /** + * Prints HTML with meta information for the categories, tags and comments. + */ function understrap_entry_footer() { // Hide category and tag text for pages. if ( 'post' === get_post_type() ) { @@ -56,13 +59,13 @@ if ( ! function_exists( 'understrap_entry_footer' ) ) { $categories_list = get_the_category_list( esc_html__( ', ', 'understrap' ) ); if ( $categories_list && understrap_categorized_blog() ) { /* translators: %s: Categories of current post */ - printf( '' . esc_html__( 'Posted in %s', 'understrap' ) . '', $categories_list ); // WPCS: XSS OK. + printf( '' . esc_html__( 'Posted in %s', 'understrap' ) . '', $categories_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', 'understrap' ) ); if ( $tags_list ) { /* translators: %s: Tags of current post */ - printf( '' . esc_html__( 'Tagged %s', 'understrap' ) . '', $tags_list ); // WPCS: XSS OK. + printf( '' . esc_html__( 'Tagged %s', 'understrap' ) . '', $tags_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { @@ -82,21 +85,24 @@ if ( ! function_exists( 'understrap_entry_footer' ) ) { } } -/** - * Returns true if a blog has more than 1 category. - * - * @return bool - */ if ( ! function_exists( 'understrap_categorized_blog' ) ) { + /** + * Returns true if a blog has more than 1 category. + * + * @return bool + */ function understrap_categorized_blog() { - if ( false === ( $all_the_cool_cats = get_transient( 'understrap_categories' ) ) ) { + $all_the_cool_cats = get_transient( 'understrap_categories' ); + if ( false === $all_the_cool_cats ) { // Create an array of all the categories that are attached to posts. - $all_the_cool_cats = get_categories( array( - 'fields' => 'ids', - 'hide_empty' => 1, - // We only need to know if there is more than one category. - 'number' => 2, - ) ); + $all_the_cool_cats = get_categories( + array( + 'fields' => 'ids', + 'hide_empty' => 1, + // We only need to know if there is more than one category. + 'number' => 2, + ) + ); // Count the number of categories that are attached to the posts. $all_the_cool_cats = count( $all_the_cool_cats ); set_transient( 'understrap_categories', $all_the_cool_cats ); @@ -111,13 +117,13 @@ if ( ! function_exists( 'understrap_categorized_blog' ) ) { } } -/** - * Flush out the transients used in understrap_categorized_blog. - */ add_action( 'edit_category', 'understrap_category_transient_flusher' ); -add_action( 'save_post', 'understrap_category_transient_flusher' ); +add_action( 'save_post', 'understrap_category_transient_flusher' ); if ( ! function_exists( 'understrap_category_transient_flusher' ) ) { + /** + * Flush out the transients used in understrap_categorized_blog. + */ function understrap_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; diff --git a/inc/widgets.php b/inc/widgets.php index b386a2a..f8a6842 100644 --- a/inc/widgets.php +++ b/inc/widgets.php @@ -17,6 +17,7 @@ defined( 'ABSPATH' ) || exit; add_filter( 'dynamic_sidebar_params', 'understrap_widget_classes' ); if ( ! function_exists( 'understrap_widget_classes' ) ) { + /** * Count number of visible widgets in a sidebar and add classes to widgets accordingly, * so widgets can be displayed one, two, three or four per row. @@ -24,6 +25,8 @@ if ( ! function_exists( 'understrap_widget_classes' ) ) { * @global array $sidebars_widgets * * @param array $params { + * Parameters passed to a widget’s display callback. + * * @type array $args { * An array of widget display arguments. * @@ -86,7 +89,7 @@ if ( ! function_exists( 'understrap_widget_classes' ) ) { return $params; } -} // endif function_exists( 'understrap_widget_classes' ). +} // End of if function_exists( 'understrap_widget_classes' ). add_action( 'widgets_init', 'understrap_widgets_init' ); @@ -168,4 +171,4 @@ if ( ! function_exists( 'understrap_widgets_init' ) ) { ); } -} // endif function_exists( 'understrap_widgets_init' ). +} // End of function_exists( 'understrap_widgets_init' ). diff --git a/inc/woocommerce.php b/inc/woocommerce.php index fe284d2..40c451b 100644 --- a/inc/woocommerce.php +++ b/inc/woocommerce.php @@ -26,18 +26,18 @@ if ( ! function_exists( 'understrap_woocommerce_support' ) ) { } } -/** - * First unhook the WooCommerce wrappers - */ +// First unhook the WooCommerce content wrappers. remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); -/** - * Then hook in your own functions to display the wrappers your theme requires - */ +// Then hook in your own functions to display the wrappers your theme requires. add_action( 'woocommerce_before_main_content', 'understrap_woocommerce_wrapper_start', 10 ); add_action( 'woocommerce_after_main_content', 'understrap_woocommerce_wrapper_end', 10 ); + if ( ! function_exists( 'understrap_woocommerce_wrapper_start' ) ) { + /** + * Display the theme specific start of the page wrapper. + */ function understrap_woocommerce_wrapper_start() { $container = get_theme_mod( 'understrap_container_type' ); echo '
    '; @@ -47,7 +47,11 @@ if ( ! function_exists( 'understrap_woocommerce_wrapper_start' ) ) { echo '
    '; } } + if ( ! function_exists( 'understrap_woocommerce_wrapper_end' ) ) { + /** + * Display the theme specific end of the page wrapper. + */ function understrap_woocommerce_wrapper_end() { echo '
    '; get_template_part( 'global-templates/right-sidebar-check' ); @@ -57,18 +61,17 @@ if ( ! function_exists( 'understrap_woocommerce_wrapper_end' ) ) { } } - -/** - * Filter hook function monkey patching form classes - * Author: Adriano Monecchi http://stackoverflow.com/a/36724593/307826 - * - * @param string $args Form attributes. - * @param string $key Not in use. - * @param null $value Not in use. - * - * @return mixed - */ if ( ! function_exists( 'understrap_wc_form_field_args' ) ) { + /** + * Filter hook function monkey patching form classes + * Author: Adriano Monecchi http://stackoverflow.com/a/36724593/307826 + * + * @param string $args Form attributes. + * @param string $key Not in use. + * @param null $value Not in use. + * + * @return mixed + */ function understrap_wc_form_field_args( $args, $key, $value = null ) { // Start field type switch case. switch ( $args['type'] ) { @@ -133,7 +136,7 @@ if ( ! function_exists( 'understrap_wc_form_field_args' ) ) { $args['input_class'] = array( 'form-control', 'input-lg' ); $args['label_class'] = array( 'control-label' ); break; - } // end switch ($args). + } // End of switch ( $args ). return $args; } } diff --git a/inc/wpcom.php b/inc/wpcom.php index 4f40f01..7a30ecb 100644 --- a/inc/wpcom.php +++ b/inc/wpcom.php @@ -10,14 +10,14 @@ // Exit if accessed directly. defined( 'ABSPATH' ) || exit; -/** - * Adds support for wp.com-specific theme functions. - * - * @global array $themecolors - */ add_action( 'after_setup_theme', 'understrap_wpcom_setup' ); if ( ! function_exists( 'understrap_wpcom_setup' ) ) { + /** + * Adds support for wp.com-specific theme functions. + * + * @global array $themecolors + */ function understrap_wpcom_setup() { global $themecolors; @@ -37,13 +37,12 @@ if ( ! function_exists( 'understrap_wpcom_setup' ) ) { } } - -/* - * WordPress.com-specific styles - */ add_action( 'wp_enqueue_scripts', 'understrap_wpcom_styles' ); if ( ! function_exists( 'understrap_wpcom_styles' ) ) { + /** + * WordPress.com-specific styles + */ function understrap_wpcom_styles() { wp_enqueue_style( 'understrap-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', array(), '20160411' ); } diff --git a/index.php b/index.php index f10d4c7..6de21f7 100644 --- a/index.php +++ b/index.php @@ -34,13 +34,11 @@ $container = get_theme_mod( 'understrap_container_type' );
    - - - - - - - - - - - - - - - + } + } else { + get_template_part( 'loop-templates/content', 'none' ); + } + ?>
    @@ -72,4 +66,5 @@ $container = get_theme_mod( 'understrap_container_type' );
    - + if ( is_home() && current_user_can( 'publish_posts' ) ) : -

    Get started here.', 'understrap' ), array( - 'a' => array( - 'href' => array(), - ), -) ), esc_url( admin_url( 'post-new.php' ) ) ); ?>

    + $kses = array( 'a' => array( 'href' => array() ) ); + printf( + /* translators: URL to create a new post. */ + '

    ' . wp_kses( __( 'Ready to publish your first post? Get started here.', 'understrap' ), $kses ) . '

    ', + esc_url( admin_url( 'post-new.php' ) ) + ); - + elseif ( is_search() ) : -

    - + printf( + '

    %s

    ', + esc_html__( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'understrap' ) + ); + get_search_form(); -

    - + else : + + printf( + '

    %s

    ', + esc_html__( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'understrap' ) + ); + get_search_form(); + + endif; + ?> diff --git a/loop-templates/content-search.php b/loop-templates/content-search.php index 48d25b9..71cf4af 100644 --- a/loop-templates/content-search.php +++ b/loop-templates/content-search.php @@ -20,7 +20,7 @@ defined( 'ABSPATH' ) || exit; ); ?> - +

    diff --git a/loop-templates/content.php b/loop-templates/content.php index 1bc0864..29bdc53 100644 --- a/loop-templates/content.php +++ b/loop-templates/content.php @@ -20,7 +20,7 @@ defined( 'ABSPATH' ) || exit; ); ?> - +
    diff --git a/page-templates/blank.php b/page-templates/blank.php index cb58a77..329305e 100644 --- a/page-templates/blank.php +++ b/page-templates/blank.php @@ -20,11 +20,12 @@ defined( 'ABSPATH' ) || exit; - - - - - - + diff --git a/page-templates/both-sidebarspage.php b/page-templates/both-sidebarspage.php index 8a79321..8f5677c 100644 --- a/page-templates/both-sidebarspage.php +++ b/page-templates/both-sidebarspage.php @@ -20,30 +20,33 @@ $container = get_theme_mod( 'understrap_container_type' );
    - + col-md-8col-md-4col-md-12 content-area" - id="primary"> + if ( is_active_sidebar( 'left-sidebar' ) xor is_active_sidebar( 'right-sidebar' ) ) { + $class = 'col-md-8'; + } elseif ( is_active_sidebar( 'left-sidebar' ) && is_active_sidebar( 'right-sidebar' ) ) { + $class = 'col-md-4'; + } else { + $class = 'col-md-12'; + } + ?> +
    - + + get_template_part( 'loop-templates/content', 'page' ); - - - + } + } + ?>
    @@ -57,4 +60,5 @@ $container = get_theme_mod( 'understrap_container_type' );
    - - - - - -
    @@ -29,18 +28,17 @@ $container = get_theme_mod( 'understrap_container_type' );
    - + - - - - + } + } + ?>
    @@ -52,4 +50,5 @@ $container = get_theme_mod( 'understrap_container_type' );
    - -
    +
    - + + get_template_part( 'loop-templates/content', 'page' ); - - - + } + } + ?>
    @@ -51,4 +49,5 @@ $container = get_theme_mod( 'understrap_container_type' );
    - -
    +
    - + + get_template_part( 'loop-templates/content', 'page' ); - - - + } + } + ?>
    @@ -51,4 +49,5 @@ $container = get_theme_mod( 'understrap_container_type' );
    - - + - - - - + } + } + ?> @@ -54,4 +53,5 @@ $container = get_theme_mod( 'understrap_container_type' );
    - - - A custom set of code standard rules for UnderStrap. + Apply WordPress Coding Standards to UnderStrap + + + + + + + + + @@ -13,44 +21,16 @@ - - - . - - */vendor/* - */node_modules/* + + /vendor/* + /node_modules/* + /dist/* - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + * + + + + + /inc/class-wp-bootstrap-navwalker\.php + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + *\.php$ - diff --git a/search.php b/search.php index 728fc44..dd3a1ec 100644 --- a/search.php +++ b/search.php @@ -42,18 +42,18 @@ $container = get_theme_mod( 'understrap_container_type' ); - + - - + endwhile; + ?> @@ -75,4 +75,5 @@ $container = get_theme_mod( 'understrap_container_type' );
    - - - - +if ( is_active_sidebar( 'herocanvas' ) ) { - + dynamic_sidebar( 'herocanvas' ); - - - - - + - - - - - - + } + } + ?> @@ -49,4 +47,5 @@ $container = get_theme_mod( 'understrap_container_type' );
    - 0 ) : ?> +if ( wc_get_page_id( 'shop' ) > 0 ) : + ?>

    - $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key ); if ( ! $product_permalink ) { - echo $thumbnail; // PHPCS: XSS ok. + echo $thumbnail; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } else { - printf( '%s', esc_url( $product_permalink ), $thumbnail ); // PHPCS: XSS ok. + printf( '%s', esc_url( $product_permalink ), $thumbnail ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } ?> @@ -85,7 +85,7 @@ do_action( 'woocommerce_before_cart' ); ?> do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key ); // Meta data. - echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok. + echo wc_get_formatted_cart_item_data( $cart_item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped // Backorder notification. if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) { @@ -96,7 +96,7 @@ do_action( 'woocommerce_before_cart' ); ?> cart->get_product_price( $_product ), $cart_item, $cart_item_key ); // PHPCS: XSS ok. + echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> @@ -118,13 +118,13 @@ do_action( 'woocommerce_before_cart' ); ?> ); } - echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // PHPCS: XSS ok. + echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); // PHPCS: XSS ok. + echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> @@ -173,4 +173,5 @@ do_action( 'woocommerce_before_cart' ); ?> ?>
    - + - + - + diff --git a/woocommerce/checkout/form-checkout.php b/woocommerce/checkout/form-checkout.php index 15beffb..8c2cd1f 100644 --- a/woocommerce/checkout/form-checkout.php +++ b/woocommerce/checkout/form-checkout.php @@ -61,4 +61,5 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir -get_order_item_totals(); +$item_totals = $order->get_order_item_totals(); ?>
    @@ -56,8 +56,8 @@ $totals = $order->get_order_item_totals(); - - + + diff --git a/woocommerce/global/form-login.php b/woocommerce/global/form-login.php index 6523868..0172de8 100644 --- a/woocommerce/global/form-login.php +++ b/woocommerce/global/form-login.php @@ -10,10 +10,9 @@ * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * - * @see https://docs.woocommerce.com/document/template-structure/ - * @package WooCommerce/Templates - - * @version 3.6.1 + * @see https://docs.woocommerce.com/document/template-structure/ + * @package WooCommerce/Templates + * @version 3.6.1 */ // Exit if accessed directly. @@ -47,7 +46,7 @@ if ( is_user_logged_in() ) { - +

    diff --git a/woocommerce/loop/add-to-cart.php b/woocommerce/loop/add-to-cart.php index ecd9133..aa12ef1 100644 --- a/woocommerce/loop/add-to-cart.php +++ b/woocommerce/loop/add-to-cart.php @@ -10,10 +10,10 @@ * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * - * @see https://docs.woocommerce.com/document/template-structure/ - * @author WooThemes - * @package WooCommerce/Templates - * @version 3.6.1 + * @see https://docs.woocommerce.com/document/template-structure/ + * @author WooThemes + * @package WooCommerce/Templates + * @version 3.6.1 */ if ( ! defined( 'ABSPATH' ) ) { @@ -22,14 +22,18 @@ if ( ! defined( 'ABSPATH' ) ) { global $product; -echo apply_filters( 'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok. - sprintf( '', +echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + 'woocommerce_loop_add_to_cart_link', + sprintf( + '', esc_url( $product->add_to_cart_url() ), esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', esc_attr( $product->get_type() ), - $product->get_type() == 'simple' ? 'ajax_add_to_cart' : '', + $product->get_type() === 'simple' ? 'ajax_add_to_cart' : '', isset( $args['attributes'] ) ? wc_implode_html_attributes( $args['attributes'] ) : '', esc_html( $product->add_to_cart_text() ) ), -$product, $args ); + $product, + $args +); diff --git a/woocommerce/loop/orderby.php b/woocommerce/loop/orderby.php index b31a8b6..09be8b0 100644 --- a/woocommerce/loop/orderby.php +++ b/woocommerce/loop/orderby.php @@ -10,9 +10,9 @@ * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * - * @see https://docs.woocommerce.com/document/template-structure/ - * @package WooCommerce/Templates - * @version 3.6.1 + * @see https://docs.woocommerce.com/document/template-structure/ + * @package WooCommerce/Templates + * @version 3.6.1 */ if ( ! defined( 'ABSPATH' ) ) { @@ -22,8 +22,8 @@ if ( ! defined( 'ABSPATH' ) ) { ?> diff --git a/woocommerce/myaccount/downloads.php b/woocommerce/myaccount/downloads.php index 0feac83..0f9cdb5 100644 --- a/woocommerce/myaccount/downloads.php +++ b/woocommerce/myaccount/downloads.php @@ -12,7 +12,7 @@ * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * - * @see https://docs.woocommerce.com/document/template-structure/ + * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates * @version 3.6.1 @@ -38,10 +38,11 @@ do_action( 'woocommerce_before_account_downloads', $has_downloads ); ?> -
    - -
    - __( 'Billing address', 'understrap' ), - 'shipping' => __( 'Shipping address', 'understrap' ), - ), $customer_id ); + $get_addresses = apply_filters( + 'woocommerce_my_account_get_addresses', + array( + 'billing' => __( 'Billing address', 'understrap' ), + 'shipping' => __( 'Shipping address', 'understrap' ), + ), + $customer_id + ); } else { - $get_addresses = apply_filters( 'woocommerce_my_account_get_addresses', array( - 'billing' => __( 'Billing address', 'understrap' ), - ), $customer_id ); + $get_addresses = apply_filters( + 'woocommerce_my_account_get_addresses', + array( + 'billing' => __( 'Billing address', 'understrap' ), + ), + $customer_id + ); } $oldcol = 1; @@ -38,28 +46,31 @@ $col = 1; ?>

    - +

    - $title ) : ?> + $address_title ) : ?>
    -

    - +

    +
    -
    +
    + ?> +
    - __( 'Order', 'understrap' ), - 'order-date' => __( 'Date', 'understrap' ), - 'order-status' => __( 'Status', 'understrap' ), - 'order-total' => __( 'Total', 'understrap' ), - 'order-actions' => ' ', -) ); +$my_orders_columns = apply_filters( + 'woocommerce_my_account_my_orders_columns', + array( + 'order-number' => esc_html__( 'Order', 'understrap' ), + 'order-date' => esc_html__( 'Date', 'understrap' ), + 'order-status' => esc_html__( 'Status', 'understrap' ), + 'order-total' => esc_html__( 'Total', 'understrap' ), + 'order-actions' => ' ', + ) +); -$customer_orders = get_posts( apply_filters( 'woocommerce_my_account_my_orders_query', array( - 'numberposts' => $order_count, - 'meta_key' => '_customer_user', - 'meta_value' => get_current_user_id(), - 'post_type' => wc_get_order_types( 'view-orders' ), - 'post_status' => array_keys( wc_get_order_statuses() ), -) ) ); +$customer_orders = get_posts( + apply_filters( + 'woocommerce_my_account_my_orders_query', + array( + 'numberposts' => $order_count, + 'meta_key' => '_customer_user', // phpcs:ignore WordPress.DB.SlowDBQuery + 'meta_value' => get_current_user_id(), // phpcs:ignore WordPress.DB.SlowDBQuery + 'post_type' => wc_get_order_types( 'view-orders' ), + 'post_status' => array_keys( wc_get_order_statuses() ), + ) + ) +); if ( $customer_orders ) : ?> -

    +

    @@ -40,8 +49,9 @@ if ( $customer_orders ) : ?> - get_item_count(); ?> @@ -52,7 +62,7 @@ if ( $customer_orders ) : ?> - get_order_number(); ?> + get_order_number(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> @@ -64,16 +74,16 @@ if ( $customer_orders ) : ?> get_formatted_order_total(), $item_count ); + printf( _n( '%1$s for %2$s item', '%1$s for %2$s items', $item_count, 'understrap' ), $order->get_formatted_order_total(), $item_count ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> $action ) { - echo '' . esc_html( $action['name'] ) . ''; + if ( ! empty( $orders_actions ) ) { + foreach ( $orders_actions as $key => $orders_action ) { + echo '' . esc_html( $orders_action['name'] ) . ''; } } ?> @@ -84,4 +94,5 @@ if ( $customer_orders ) : ?>
    - $label ) : ?> + class="list-group-item list-group-item-action">
    - orders as $customer_order ) { - $order = wc_get_order( $customer_order ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited + $order = wc_get_order( $customer_order ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Override $item_count = $order->get_item_count() - $order->get_item_count_refunded(); ?> @@ -63,11 +63,11 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?> $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited - echo '' . esc_html( $action['name'] ) . ''; + if ( ! empty( $orders_actions ) ) { + foreach ( $orders_actions as $key => $orders_action ) { + echo '' . esc_html( $orders_action['name'] ) . ''; } } ?> @@ -104,4 +104,5 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?> - +is_purchasable() ) { return; } -echo wc_get_stock_html( $product ); // WPCS: XSS ok. +echo wc_get_stock_html( $product ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped if ( $product->is_in_stock() ) : ?> @@ -35,11 +35,13 @@ if ( $product->is_in_stock() ) : ?> apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ), - 'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ), - 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( wp_unslash( $_POST['quantity'] ) ) : $product->get_min_purchase_quantity(), // WPCS: CSRF ok, input var ok. - ) ); + woocommerce_quantity_input( + array( + 'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ), + 'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ), + 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( wp_unslash( $_POST['quantity'] ) ) : $product->get_min_purchase_quantity(), // phpcs:ignore WordPress.Security.NonceVerification, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + ) + ); do_action( 'woocommerce_after_add_to_cart_quantity' ); ?> @@ -51,4 +53,5 @@ if ( $product->is_in_stock() ) : ?> - apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ), - 'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ), - 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( wp_unslash( $_POST['quantity'] ) ) : $product->get_min_purchase_quantity(), // WPCS: CSRF ok, input var ok. - ) ); + woocommerce_quantity_input( + array( + 'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ), + 'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ), + 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( wp_unslash( $_POST['quantity'] ) ) : $product->get_min_purchase_quantity(), // phpcs:ignore WordPress.Security.NonceVerification, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + ) + ); do_action( 'woocommerce_after_add_to_cart_quantity' ); ?>