fix merge conflict

This commit is contained in:
Ron Rennick 2018-12-12 09:23:38 -06:00
commit 73de71d8d4
145 changed files with 2516 additions and 603 deletions

View File

@ -13,7 +13,6 @@ php:
- 5.6 - 5.6
- 7.0 - 7.0
- 7.1 - 7.1
- 7.3
env: env:
- WP_VERSION=latest WP_MULTISITE=0 - WP_VERSION=latest WP_MULTISITE=0
@ -31,9 +30,11 @@ matrix:
env: WP_VERSION=latest WP_MULTISITE=0 RUN_PHPCS=1 RUN_E2E=1 env: WP_VERSION=latest WP_MULTISITE=0 RUN_PHPCS=1 RUN_E2E=1
- php: 7.1 - php: 7.1
env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1 env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1
allow_failures:
- env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1
- php: 7.3 - php: 7.3
env: WP_VERSION=5.0-beta5 WP_MULTISITE=0
allow_failures:
- php: 7.1
env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1
before_script: before_script:
- | - |
@ -43,7 +44,7 @@ before_script:
else else
echo "xdebug.ini does not exist" echo "xdebug.ini does not exist"
fi fi
- export PATH="$HOME/.composer/vendor/bin:$PATH" - export PATH="$HOME/.config/composer/vendor/bin:$PATH"
- bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION - bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION
- bash tests/bin/travis.sh before - bash tests/bin/travis.sh before

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -215,7 +215,8 @@
} }
if ( variation.dimensions ) { if ( variation.dimensions ) {
$dimensions.wc_set_content( variation.dimensions_html ); // Decode HTML entities.
$dimensions.wc_set_content( $.parseHTML( variation.dimensions_html )[0].data );
} else { } else {
$dimensions.wc_reset_content(); $dimensions.wc_reset_content();
} }

View File

@ -10,15 +10,11 @@
"composer/installers": "~1.2" "composer/installers": "~1.2"
}, },
"require-dev": { "require-dev": {
"squizlabs/php_codesniffer": "*", "apigen/apigen": "^4",
"wp-coding-standards/wpcs": "^0.14", "nette/utils": "~2.3.0",
"phpunit/phpunit": "6.*", "phpunit/phpunit": "6.*",
"woocommerce/woocommerce-git-hooks": "*", "woocommerce/woocommerce-git-hooks": "*",
"woocommerce/woocommerce-sniffs": "*", "woocommerce/woocommerce-sniffs": "^0.0.5"
"wimg/php-compatibility": "^8.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3",
"apigen/apigen": "^4",
"nette/utils": "~2.3.0"
}, },
"scripts": { "scripts": {
"pre-update-cmd": [ "pre-update-cmd": [

419
composer.lock generated
View File

@ -1,23 +1,23 @@
{ {
"_readme": [ "_readme": [
"This file locks the dependencies of your project to a known state", "This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "bc2c57d2be29888a0e4c3a09ec26cbe3", "content-hash": "cb53f81a493f453b55e37363f7dc51a2",
"packages": [ "packages": [
{ {
"name": "composer/installers", "name": "composer/installers",
"version": "v1.5.0", "version": "v1.6.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/installers.git", "url": "https://github.com/composer/installers.git",
"reference": "049797d727261bf27f2690430d935067710049c2" "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/049797d727261bf27f2690430d935067710049c2", "url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b",
"reference": "049797d727261bf27f2690430d935067710049c2", "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -124,7 +124,7 @@
"zend", "zend",
"zikula" "zikula"
], ],
"time": "2017-12-29T09:13:20+00:00" "time": "2018-08-27T06:10:37+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@ -353,29 +353,27 @@
}, },
{ {
"name": "dealerdirect/phpcodesniffer-composer-installer", "name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v0.4.4", "version": "v0.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
"reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08" "reference": "e749410375ff6fb7a040a68878c656c2e610b132"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/2e41850d5f7797cbb1af7b030d245b3b24e63a08", "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132",
"reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08", "reference": "e749410375ff6fb7a040a68878c656c2e610b132",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"composer-plugin-api": "^1.0", "composer-plugin-api": "^1.0",
"php": "^5.3|^7", "php": "^5.3|^7",
"squizlabs/php_codesniffer": "*" "squizlabs/php_codesniffer": "^2|^3"
}, },
"require-dev": { "require-dev": {
"composer/composer": "*", "composer/composer": "*",
"wimg/php-compatibility": "^8.0" "phpcompatibility/php-compatibility": "^9.0",
}, "sensiolabs/security-checker": "^4.1.0"
"suggest": {
"dealerdirect/qa-tools": "All the PHP QA tools you'll need"
}, },
"type": "composer-plugin", "type": "composer-plugin",
"extra": { "extra": {
@ -393,13 +391,13 @@
"authors": [ "authors": [
{ {
"name": "Franck Nijhof", "name": "Franck Nijhof",
"email": "f.nijhof@dealerdirect.nl", "email": "franck.nijhof@dealerdirect.com",
"homepage": "http://workingatdealerdirect.eu", "homepage": "http://www.frenck.nl",
"role": "Developer" "role": "Developer / IT Manager"
} }
], ],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin", "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
"homepage": "http://workingatdealerdirect.eu", "homepage": "http://www.dealerdirect.com",
"keywords": [ "keywords": [
"PHPCodeSniffer", "PHPCodeSniffer",
"PHP_CodeSniffer", "PHP_CodeSniffer",
@ -417,7 +415,7 @@
"stylecheck", "stylecheck",
"tests" "tests"
], ],
"time": "2017-12-06T16:27:17+00:00" "time": "2018-10-26T13:21:45+00:00"
}, },
{ {
"name": "doctrine/instantiator", "name": "doctrine/instantiator",
@ -936,16 +934,16 @@
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
"version": "1.8.0", "version": "1.8.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/myclabs/DeepCopy.git", "url": "https://github.com/myclabs/DeepCopy.git",
"reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6" "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/478465659fd987669df0bd8a9bf22a8710e5f1b6", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8",
"reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6", "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -980,7 +978,7 @@
"object", "object",
"object graph" "object graph"
], ],
"time": "2018-05-29T17:25:09+00:00" "time": "2018-06-11T23:09:50+00:00"
}, },
{ {
"name": "nette/application", "name": "nette/application",
@ -1434,16 +1432,16 @@
}, },
{ {
"name": "nette/neon", "name": "nette/neon",
"version": "v2.4.2", "version": "v2.4.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nette/neon.git", "url": "https://github.com/nette/neon.git",
"reference": "9eacd50553b26b53a3977bfb2fea2166d4331622" "reference": "5e72b1dd3e2d34f0863c5561139a19df6a1ef398"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nette/neon/zipball/9eacd50553b26b53a3977bfb2fea2166d4331622", "url": "https://api.github.com/repos/nette/neon/zipball/5e72b1dd3e2d34f0863c5561139a19df6a1ef398",
"reference": "9eacd50553b26b53a3977bfb2fea2166d4331622", "reference": "5e72b1dd3e2d34f0863c5561139a19df6a1ef398",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1482,9 +1480,16 @@
"homepage": "https://nette.org/contributors" "homepage": "https://nette.org/contributors"
} }
], ],
"description": "Nette NEON: parser & generator for Nette Object Notation", "description": "🍸 Nette NEON: encodes and decodes NEON file format.",
"homepage": "http://ne-on.org", "homepage": "http://ne-on.org",
"time": "2017-07-11T18:29:08+00:00" "keywords": [
"export",
"import",
"neon",
"nette",
"yaml"
],
"time": "2018-03-21T12:12:21+00:00"
}, },
{ {
"name": "nette/php-generator", "name": "nette/php-generator",
@ -1913,6 +1918,164 @@
"description": "Library for handling version information and constraints", "description": "Library for handling version information and constraints",
"time": "2017-03-05T17:38:23+00:00" "time": "2017-03-05T17:38:23+00:00"
}, },
{
"name": "phpcompatibility/php-compatibility",
"version": "9.0.0",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
"reference": "e9f4047e5edf53c88f36f1dafc0d49454ce13e25"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/e9f4047e5edf53c88f36f1dafc0d49454ce13e25",
"reference": "e9f4047e5edf53c88f36f1dafc0d49454ce13e25",
"shasum": ""
},
"require": {
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
},
"conflict": {
"squizlabs/php_codesniffer": "2.6.2"
},
"require-dev": {
"phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS '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": "Contributors",
"homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
},
{
"name": "Wim Godden",
"homepage": "https://github.com/wimg",
"role": "lead"
},
{
"name": "Juliette Reinders Folmer",
"homepage": "https://github.com/jrfnl",
"role": "lead"
}
],
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
"keywords": [
"compatibility",
"phpcs",
"standards"
],
"time": "2018-10-07T17:38:02+00:00"
},
{
"name": "phpcompatibility/phpcompatibility-paragonie",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
"reference": "67d89dcef47f351144d24b247aa968f2269162f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/67d89dcef47f351144d24b247aa968f2269162f7",
"reference": "67d89dcef47f351144d24b247aa968f2269162f7",
"shasum": ""
},
"require": {
"phpcompatibility/php-compatibility": "^9.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4 || 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": "2018-10-07T17:59:30+00:00"
},
{
"name": "phpcompatibility/phpcompatibility-wp",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
"reference": "cb303f0067cd5b366a41d4fb0e254fb40ff02efd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/cb303f0067cd5b366a41d4fb0e254fb40ff02efd",
"reference": "cb303f0067cd5b366a41d4fb0e254fb40ff02efd",
"shasum": ""
},
"require": {
"phpcompatibility/php-compatibility": "^9.0",
"phpcompatibility/phpcompatibility-paragonie": "^1.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || 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": "2018-10-07T18:31:37+00:00"
},
{ {
"name": "phpdocumentor/reflection-common", "name": "phpdocumentor/reflection-common",
"version": "1.0.1", "version": "1.0.1",
@ -2067,16 +2230,16 @@
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",
"version": "1.7.6", "version": "1.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpspec/prophecy.git", "url": "https://github.com/phpspec/prophecy.git",
"reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06",
"reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2088,12 +2251,12 @@
}, },
"require-dev": { "require-dev": {
"phpspec/phpspec": "^2.5|^3.2", "phpspec/phpspec": "^2.5|^3.2",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.7.x-dev" "dev-master": "1.8.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -2126,7 +2289,7 @@
"spy", "spy",
"stub" "stub"
], ],
"time": "2018-04-18T13:57:24+00:00" "time": "2018-08-05T17:53:17+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@ -2379,16 +2542,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "6.5.8", "version": "6.5.13",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b" "reference": "0973426fb012359b2f18d3bd1e90ef1172839693"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4f21a3c6b97c42952fd5c2837bb354ec0199b97b", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0973426fb012359b2f18d3bd1e90ef1172839693",
"reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b", "reference": "0973426fb012359b2f18d3bd1e90ef1172839693",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2406,7 +2569,7 @@
"phpunit/php-file-iterator": "^1.4.3", "phpunit/php-file-iterator": "^1.4.3",
"phpunit/php-text-template": "^1.2.1", "phpunit/php-text-template": "^1.2.1",
"phpunit/php-timer": "^1.0.9", "phpunit/php-timer": "^1.0.9",
"phpunit/phpunit-mock-objects": "^5.0.5", "phpunit/phpunit-mock-objects": "^5.0.9",
"sebastian/comparator": "^2.1", "sebastian/comparator": "^2.1",
"sebastian/diff": "^2.0", "sebastian/diff": "^2.0",
"sebastian/environment": "^3.1", "sebastian/environment": "^3.1",
@ -2459,20 +2622,20 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2018-04-10T11:38:34+00:00" "time": "2018-09-08T15:10:43+00:00"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
"version": "5.0.7", "version": "5.0.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce" "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3eaf040f20154d27d6da59ca2c6e28ac8fd56dce", "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f",
"reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce", "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2485,7 +2648,7 @@
"phpunit/phpunit": "<6.0" "phpunit/phpunit": "<6.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^6.5" "phpunit/phpunit": "^6.5.11"
}, },
"suggest": { "suggest": {
"ext-soap": "*" "ext-soap": "*"
@ -2518,7 +2681,7 @@
"mock", "mock",
"xunit" "xunit"
], ],
"time": "2018-05-29T13:50:43+00:00" "time": "2018-08-09T05:50:03+00:00"
}, },
{ {
"name": "psr/log", "name": "psr/log",
@ -3177,16 +3340,16 @@
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
"version": "3.2.3", "version": "3.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "4842476c434e375f9d3182ff7b89059583aa8b27" "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/4842476c434e375f9d3182ff7b89059583aa8b27", "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e",
"reference": "4842476c434e375f9d3182ff7b89059583aa8b27", "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3224,20 +3387,20 @@
"phpcs", "phpcs",
"standards" "standards"
], ],
"time": "2018-02-20T21:35:23+00:00" "time": "2018-09-23T23:08:17+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v2.8.41", "version": "v2.8.47",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "e8e59b74ad1274714dad2748349b55e3e6e630c7" "reference": "48ed63767c4add573fb3e9e127d3426db27f78e8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/e8e59b74ad1274714dad2748349b55e3e6e630c7", "url": "https://api.github.com/repos/symfony/console/zipball/48ed63767c4add573fb3e9e127d3426db27f78e8",
"reference": "e8e59b74ad1274714dad2748349b55e3e6e630c7", "reference": "48ed63767c4add573fb3e9e127d3426db27f78e8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3285,7 +3448,7 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-05-15T21:17:45+00:00" "time": "2018-10-30T14:26:34+00:00"
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
@ -3401,25 +3564,28 @@
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
"version": "v1.8.0", "version": "v1.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git", "url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" "reference": "e3d826245268269cd66f8326bd8bc066687b4a19"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19",
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", "reference": "e3d826245268269cd66f8326bd8bc066687b4a19",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.8-dev" "dev-master": "1.9-dev"
} }
}, },
"autoload": { "autoload": {
@ -3452,20 +3618,20 @@
"polyfill", "polyfill",
"portable" "portable"
], ],
"time": "2018-04-30T19:57:29+00:00" "time": "2018-08-06T14:22:27+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.8.0", "version": "v1.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "3296adf6a6454a050679cde90f95350ad604b171" "reference": "c79c051f5b3a46be09205c73b80b346e4153e494"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
"reference": "3296adf6a6454a050679cde90f95350ad604b171", "reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3477,7 +3643,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.8-dev" "dev-master": "1.9-dev"
} }
}, },
"autoload": { "autoload": {
@ -3511,20 +3677,20 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2018-04-26T10:06:28+00:00" "time": "2018-09-21T13:07:52+00:00"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v2.8.41", "version": "v2.8.47",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff" "reference": "0e16589861f192dbffb19b06683ce3ef58f7f99d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff", "url": "https://api.github.com/repos/symfony/yaml/zipball/0e16589861f192dbffb19b06683ce3ef58f7f99d",
"reference": "51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff", "reference": "0e16589861f192dbffb19b06683ce3ef58f7f99d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3561,7 +3727,7 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-05-01T22:52:40+00:00" "time": "2018-10-02T16:27:16+00:00"
}, },
{ {
"name": "theseer/tokenizer", "name": "theseer/tokenizer",
@ -3605,16 +3771,16 @@
}, },
{ {
"name": "tracy/tracy", "name": "tracy/tracy",
"version": "v2.5.0", "version": "v2.5.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nette/tracy.git", "url": "https://github.com/nette/tracy.git",
"reference": "534d4e4f0f31da494026a3761fad020c20b8debf" "reference": "35fa649b483b28e16f61de07110ea0585fc8d6ea"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nette/tracy/zipball/534d4e4f0f31da494026a3761fad020c20b8debf", "url": "https://api.github.com/repos/nette/tracy/zipball/35fa649b483b28e16f61de07110ea0585fc8d6ea",
"reference": "534d4e4f0f31da494026a3761fad020c20b8debf", "reference": "35fa649b483b28e16f61de07110ea0585fc8d6ea",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3624,7 +3790,8 @@
}, },
"require-dev": { "require-dev": {
"nette/di": "~2.3", "nette/di": "~2.3",
"nette/tester": "~1.7" "nette/tester": "~1.7",
"nette/utils": "~2.3"
}, },
"suggest": { "suggest": {
"https://nette.org/donate": "Please support Tracy via a donation" "https://nette.org/donate": "Please support Tracy via a donation"
@ -3666,7 +3833,7 @@
"nette", "nette",
"profiler" "profiler"
], ],
"time": "2018-05-25T09:33:08+00:00" "time": "2018-11-05T15:10:59+00:00"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
@ -3718,58 +3885,6 @@
], ],
"time": "2018-01-29T19:49:41+00:00" "time": "2018-01-29T19:49:41+00:00"
}, },
{
"name": "wimg/php-compatibility",
"version": "8.1.0",
"source": {
"type": "git",
"url": "https://github.com/wimg/PHPCompatibility.git",
"reference": "4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wimg/PHPCompatibility/zipball/4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e",
"reference": "4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e",
"shasum": ""
},
"require": {
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2.2 || ^3.0.2"
},
"conflict": {
"squizlabs/php_codesniffer": "2.6.2"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3"
},
"type": "phpcodesniffer-standard",
"autoload": {
"psr-4": {
"PHPCompatibility\\": "PHPCompatibility/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Wim Godden",
"role": "lead"
}
],
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.",
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
"keywords": [
"compatibility",
"phpcs",
"standards"
],
"time": "2017-12-27T21:58:38+00:00"
},
{ {
"name": "woocommerce/woocommerce-git-hooks", "name": "woocommerce/woocommerce-git-hooks",
"version": "1.0.5", "version": "1.0.5",
@ -3805,24 +3920,23 @@
}, },
{ {
"name": "woocommerce/woocommerce-sniffs", "name": "woocommerce/woocommerce-sniffs",
"version": "0.0.2", "version": "0.0.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/woocommerce/woocommerce-sniffs.git", "url": "https://github.com/woocommerce/woocommerce-sniffs.git",
"reference": "2890fd5d98b318f62acb42f2b5cd6d02627cfd82" "reference": "f91f940ea0dca2b67be7a8a35c1ded41257b372f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/2890fd5d98b318f62acb42f2b5cd6d02627cfd82", "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/f91f940ea0dca2b67be7a8a35c1ded41257b372f",
"reference": "2890fd5d98b318f62acb42f2b5cd6d02627cfd82", "reference": "f91f940ea0dca2b67be7a8a35c1ded41257b372f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"php": ">=7.0", "php": ">=7.0",
"squizlabs/php_codesniffer": "^3.0.2" "phpcompatibility/phpcompatibility-wp": "2.0.0",
}, "wp-coding-standards/wpcs": "^1.2"
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3"
}, },
"type": "phpcodesniffer-standard", "type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -3842,28 +3956,31 @@
"woocommerce", "woocommerce",
"wordpress" "wordpress"
], ],
"time": "2018-03-22T18:39:19+00:00" "time": "2018-11-20T21:33:22+00:00"
}, },
{ {
"name": "wp-coding-standards/wpcs", "name": "wp-coding-standards/wpcs",
"version": "0.14.1", "version": "1.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git", "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
"reference": "cf6b310caad735816caef7573295f8a534374706" "reference": "7aa217ab38156c5cb4eae0f04ae376027c407a9b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/cf6b310caad735816caef7573295f8a534374706", "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/7aa217ab38156c5cb4eae0f04ae376027c407a9b",
"reference": "cf6b310caad735816caef7573295f8a534374706", "reference": "7aa217ab38156c5cb4eae0f04ae376027c407a9b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3", "php": ">=5.3",
"squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2" "squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2"
}, },
"require-dev": {
"phpcompatibility/php-compatibility": "^9.0"
},
"suggest": { "suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3" "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
}, },
"type": "phpcodesniffer-standard", "type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -3882,7 +3999,7 @@
"standards", "standards",
"wordpress" "wordpress"
], ],
"time": "2018-02-16T01:57:48+00:00" "time": "2018-11-12T10:13:12+00:00"
} }
], ],
"aliases": [], "aliases": [],

View File

@ -374,7 +374,7 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
* @return array * @return array
*/ */
protected function add_meta_query( $args, $meta_query ) { protected function add_meta_query( $args, $meta_query ) {
if ( ! empty( $args['meta_query'] ) ) { if ( empty( $args['meta_query'] ) ) {
$args['meta_query'] = array(); $args['meta_query'] = array();
} }

View File

@ -173,7 +173,7 @@ class WC_Admin_Attributes {
echo '<div id="woocommerce_errors" class="error"><p>' . esc_html__( 'Error: non-existing attribute ID.', 'woocommerce' ) . '</p></div>'; echo '<div id="woocommerce_errors" class="error"><p>' . esc_html__( 'Error: non-existing attribute ID.', 'woocommerce' ) . '</p></div>';
} else { } else {
$att_type = $attribute_to_edit->attribute_type; $att_type = $attribute_to_edit->attribute_type;
$att_label = $attribute_to_edit->attribute_label; $att_label = format_to_edit( $attribute_to_edit->attribute_label );
$att_name = $attribute_to_edit->attribute_name; $att_name = $attribute_to_edit->attribute_name;
$att_orderby = $attribute_to_edit->attribute_orderby; $att_orderby = $attribute_to_edit->attribute_orderby;
$att_public = $attribute_to_edit->attribute_public; $att_public = $attribute_to_edit->attribute_public;

View File

@ -39,9 +39,9 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
*/ */
public function init() { public function init() {
if ( current_user_can( 'publish_shop_orders' ) && post_type_supports( 'product', 'comments' ) ) { if ( current_user_can( 'publish_shop_orders' ) && post_type_supports( 'product', 'comments' ) ) {
wp_add_dashboard_widget( 'woocommerce_dashboard_recent_reviews', __( 'WooCommerce recent reviews', 'woocommerce' ), array( $this, 'recent_reviews' ) ); wp_add_dashboard_widget( 'woocommerce_dashboard_recent_reviews', __( 'WooCommerce Recent Reviews', 'woocommerce' ), array( $this, 'recent_reviews' ) );
} }
wp_add_dashboard_widget( 'woocommerce_dashboard_status', __( 'WooCommerce status', 'woocommerce' ), array( $this, 'status_widget' ) ); wp_add_dashboard_widget( 'woocommerce_dashboard_status', __( 'WooCommerce Status', 'woocommerce' ), array( $this, 'status_widget' ) );
// Network Order Widget. // Network Order Widget.
if ( is_multisite() ) { if ( is_multisite() ) {
@ -53,7 +53,7 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
* Register the network order dashboard widget. * Register the network order dashboard widget.
*/ */
public function register_network_order_widget() { public function register_network_order_widget() {
wp_add_dashboard_widget( 'woocommerce_network_orders', __( 'WooCommerce network orders', 'woocommerce' ), array( $this, 'network_orders' ) ); wp_add_dashboard_widget( 'woocommerce_network_orders', __( 'WooCommerce Network Orders', 'woocommerce' ), array( $this, 'network_orders' ) );
} }
/** /**

View File

@ -83,17 +83,16 @@ class WC_Admin_Notices {
public static function reset_admin_notices() { public static function reset_admin_notices() {
$simplify_options = get_option( 'woocommerce_simplify_commerce_settings', array() ); $simplify_options = get_option( 'woocommerce_simplify_commerce_settings', array() );
$location = wc_get_base_location(); $location = wc_get_base_location();
$shop_page = 0 < wc_get_page_id( 'shop' ) ? get_permalink( wc_get_page_id( 'shop' ) ) : get_home_url();
if ( ! class_exists( 'WC_Gateway_Simplify_Commerce_Loader' ) && ! empty( $simplify_options['enabled'] ) && 'yes' === $simplify_options['enabled'] && in_array( $location['country'], apply_filters( 'woocommerce_gateway_simplify_commerce_supported_countries', array( 'US', 'IE' ) ), true ) ) { if ( ! class_exists( 'WC_Gateway_Simplify_Commerce_Loader' ) && ! empty( $simplify_options['enabled'] ) && 'yes' === $simplify_options['enabled'] && in_array( $location['country'], apply_filters( 'woocommerce_gateway_simplify_commerce_supported_countries', array( 'US', 'IE' ) ), true ) ) {
WC_Admin_Notices::add_notice( 'simplify_commerce' ); self::add_notice( 'simplify_commerce' );
} }
if ( ! is_ssl() || 'https' !== substr( $shop_page, 0, 5 ) ) { if ( ! self::is_ssl() ) {
WC_Admin_Notices::add_notice( 'no_secure_connection' ); self::add_notice( 'no_secure_connection' );
} }
WC_Admin_Notices::add_wootenberg_feature_plugin_notice(); self::add_wootenberg_feature_plugin_notice();
self::add_notice( 'template_files' ); self::add_notice( 'template_files' );
} }
@ -120,6 +119,7 @@ class WC_Admin_Notices {
* See if a notice is being shown. * See if a notice is being shown.
* *
* @param string $name Notice name. * @param string $name Notice name.
*
* @return boolean * @return boolean
*/ */
public static function has_notice( $name ) { public static function has_notice( $name ) {
@ -354,7 +354,7 @@ class WC_Admin_Notices {
* Notice about secure connection. * Notice about secure connection.
*/ */
public static function secure_connection_notice() { public static function secure_connection_notice() {
if ( get_user_meta( get_current_user_id(), 'dismissed_no_secure_connection_notice', true ) ) { if ( self::is_ssl() || get_user_meta( get_current_user_id(), 'dismissed_no_secure_connection_notice', true ) ) {
return; return;
} }
@ -368,7 +368,7 @@ class WC_Admin_Notices {
* @todo Remove this notice and associated code once the feature plugin has been merged into core. * @todo Remove this notice and associated code once the feature plugin has been merged into core.
*/ */
public static function add_wootenberg_feature_plugin_notice() { public static function add_wootenberg_feature_plugin_notice() {
if ( is_plugin_active( 'gutenberg/gutenberg.php' ) && ! is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ) { if ( ( is_plugin_active( 'gutenberg/gutenberg.php' ) || version_compare( get_bloginfo( 'version' ), '5.0', '>=' ) ) && ! is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ) {
self::add_notice( 'wootenberg' ); self::add_notice( 'wootenberg' );
} }
} }
@ -380,7 +380,7 @@ class WC_Admin_Notices {
* @todo Remove this notice and associated code once the feature plugin has been merged into core. * @todo Remove this notice and associated code once the feature plugin has been merged into core.
*/ */
public static function add_wootenberg_feature_plugin_notice_on_gutenberg_activate() { public static function add_wootenberg_feature_plugin_notice_on_gutenberg_activate() {
if ( ! is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ) { if ( ! is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) && version_compare( get_bloginfo( 'version' ), '5.0', '<' ) ) {
self::add_notice( 'wootenberg' ); self::add_notice( 'wootenberg' );
} }
} }
@ -396,6 +396,19 @@ class WC_Admin_Notices {
include dirname( __FILE__ ) . '/views/html-notice-wootenberg.php'; include dirname( __FILE__ ) . '/views/html-notice-wootenberg.php';
} }
/**
* Determine if the store is running SSL.
*
* @return bool Flag SSL enabled.
* @since 3.5.1
*/
protected static function is_ssl() {
$shop_page = 0 < wc_get_page_id( 'shop' ) ? get_permalink( wc_get_page_id( 'shop' ) ) : get_home_url();
return ( is_ssl() && 'https' === substr( $shop_page, 0, 5 ) );
}
} }
WC_Admin_Notices::init(); WC_Admin_Notices::init();

View File

@ -1080,10 +1080,11 @@ class WC_Admin_Setup_Wizard {
if ( $setup_shipstation ) { if ( $setup_shipstation ) {
$this->install_plugin( $this->install_plugin(
'woocommerce-shipstation', 'woocommerce-shipstation-integration',
array( array(
'name' => __( 'ShipStation', 'woocommerce' ), 'name' => __( 'ShipStation', 'woocommerce' ),
'repo-slug' => 'woocommerce-shipstation', 'repo-slug' => 'woocommerce-shipstation-integration',
'file' => 'woocommerce-shipstation.php',
) )
); );
} }

View File

@ -22,6 +22,7 @@ class WC_Admin {
* Constructor. * Constructor.
*/ */
public function __construct() { public function __construct() {
add_action( 'plugins_loaded', array( $this, 'preload_helper' ), 9 );
add_action( 'init', array( $this, 'includes' ) ); add_action( 'init', array( $this, 'includes' ) );
add_action( 'current_screen', array( $this, 'conditional_includes' ) ); add_action( 'current_screen', array( $this, 'conditional_includes' ) );
add_action( 'admin_init', array( $this, 'buffer' ), 1 ); add_action( 'admin_init', array( $this, 'buffer' ), 1 );
@ -86,6 +87,13 @@ class WC_Admin {
include_once dirname( __FILE__ ) . '/helper/class-wc-helper.php'; include_once dirname( __FILE__ ) . '/helper/class-wc-helper.php';
} }
/**
* Preloads some functionality of the Helper to be loaded on the `plugins_loaded` hook
*/
public function preload_helper() {
include_once dirname( __FILE__ ) . '/helper/class-wc-helper-file-headers.php';
}
/** /**
* Include admin files conditionally. * Include admin files conditionally.
*/ */

View File

@ -0,0 +1,44 @@
<?php
/**
* WooCommerce Admin
*
* @class WC_Admin
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin
* @version 3.5.2
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* WC_Helper_File_Headers Class
*
* Adds some filters to be able to parse the `Woo` header from locally
* installed Woo plugins and themes
*/
class WC_Helper_File_Headers {
/**
* Load functions adds the `extra_headers` filter on the `extra_plugin_headers`
* and `extra_theme_headers` hooks.
*/
public static function load() {
add_filter( 'extra_plugin_headers', array( __CLASS__, 'extra_headers' ) );
add_filter( 'extra_theme_headers', array( __CLASS__, 'extra_headers' ) );
}
/**
* Additional theme style.css and plugin file headers.
*
* Format: Woo: product_id:file_id
*/
public static function extra_headers( $headers ) {
$headers[] = 'Woo';
return $headers;
}
}
WC_Helper_File_Headers::load();

View File

@ -32,8 +32,6 @@ class WC_Helper {
add_action( 'current_screen', array( __CLASS__, 'current_screen' ) ); add_action( 'current_screen', array( __CLASS__, 'current_screen' ) );
add_action( 'woocommerce_helper_output', array( __CLASS__, 'render_helper_output' ) ); add_action( 'woocommerce_helper_output', array( __CLASS__, 'render_helper_output' ) );
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) ); add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) );
add_filter( 'extra_plugin_headers', array( __CLASS__, 'extra_headers' ) );
add_filter( 'extra_theme_headers', array( __CLASS__, 'extra_headers' ) );
// Attempt to toggle subscription state upon plugin activation/deactivation // Attempt to toggle subscription state upon plugin activation/deactivation
add_action( 'activated_plugin', array( __CLASS__, 'activated_plugin' ) ); add_action( 'activated_plugin', array( __CLASS__, 'activated_plugin' ) );
@ -1008,16 +1006,6 @@ class WC_Helper {
return false; return false;
} }
/**
* Additional theme style.css and plugin file headers.
*
* Format: Woo: product_id:file_id
*/
public static function extra_headers( $headers ) {
$headers[] = 'Woo';
return $headers;
}
/** /**
* Obtain a list of locally installed Woo extensions. * Obtain a list of locally installed Woo extensions.
*/ */

View File

@ -111,7 +111,8 @@ class WC_Product_CSV_Importer_Controller {
*/ */
protected static function get_valid_csv_filetypes() { protected static function get_valid_csv_filetypes() {
return apply_filters( return apply_filters(
'woocommerce_csv_product_import_valid_filetypes', array( 'woocommerce_csv_product_import_valid_filetypes',
array(
'csv' => 'text/csv', 'csv' => 'text/csv',
'txt' => 'text/plain', 'txt' => 'text/plain',
) )
@ -147,7 +148,7 @@ class WC_Product_CSV_Importer_Controller {
$this->steps = apply_filters( 'woocommerce_product_csv_importer_steps', $default_steps ); $this->steps = apply_filters( 'woocommerce_product_csv_importer_steps', $default_steps );
// phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
$this->step = isset( $_REQUEST['step'] ) ? sanitize_key( $_REQUEST['step'] ) : current( array_keys( $this->steps ) ); $this->step = isset( $_REQUEST['step'] ) ? sanitize_key( $_REQUEST['step'] ) : current( array_keys( $this->steps ) );
$this->file = isset( $_REQUEST['file'] ) ? wc_clean( wp_unslash( $_REQUEST['file'] ) ) : ''; $this->file = isset( $_REQUEST['file'] ) ? wc_clean( wp_unslash( $_REQUEST['file'] ) ) : '';
$this->update_existing = isset( $_REQUEST['update_existing'] ) ? (bool) $_REQUEST['update_existing'] : false; $this->update_existing = isset( $_REQUEST['update_existing'] ) ? (bool) $_REQUEST['update_existing'] : false;
@ -258,7 +259,7 @@ class WC_Product_CSV_Importer_Controller {
* Dispatch current step and show correct view. * Dispatch current step and show correct view.
*/ */
public function dispatch() { public function dispatch() {
// phpcs:ignore WordPress.CSRF.NonceVerification.NoNonceVerification // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
if ( ! empty( $_POST['save_step'] ) && ! empty( $this->steps[ $this->step ]['handler'] ) ) { if ( ! empty( $_POST['save_step'] ) && ! empty( $this->steps[ $this->step ]['handler'] ) ) {
call_user_func( $this->steps[ $this->step ]['handler'], $this ); call_user_func( $this->steps[ $this->step ]['handler'], $this );
} }
@ -306,7 +307,7 @@ class WC_Product_CSV_Importer_Controller {
* @return string|WP_Error * @return string|WP_Error
*/ */
public function handle_upload() { public function handle_upload() {
// phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification -- Nonce already verified in WC_Product_CSV_Importer_Controller::upload_form_handler() // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification -- Nonce already verified in WC_Product_CSV_Importer_Controller::upload_form_handler()
$file_url = isset( $_POST['file_url'] ) ? wc_clean( wp_unslash( $_POST['file_url'] ) ) : ''; $file_url = isset( $_POST['file_url'] ) ? wc_clean( wp_unslash( $_POST['file_url'] ) ) : '';
if ( empty( $file_url ) ) { if ( empty( $file_url ) ) {
@ -410,7 +411,7 @@ class WC_Product_CSV_Importer_Controller {
return; return;
} }
// phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification -- Nonce already verified in WC_Admin_Importers::do_ajax_product_import() // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification -- Nonce already verified in WC_Admin_Importers::do_ajax_product_import()
if ( ! empty( $_POST['map_from'] ) && ! empty( $_POST['map_to'] ) ) { if ( ! empty( $_POST['map_from'] ) && ! empty( $_POST['map_to'] ) ) {
$mapping_from = wc_clean( wp_unslash( $_POST['map_from'] ) ); $mapping_from = wc_clean( wp_unslash( $_POST['map_from'] ) );
$mapping_to = wc_clean( wp_unslash( $_POST['map_to'] ) ); $mapping_to = wc_clean( wp_unslash( $_POST['map_to'] ) );
@ -424,7 +425,9 @@ class WC_Product_CSV_Importer_Controller {
// phpcs:enable // phpcs:enable
wp_localize_script( wp_localize_script(
'wc-product-import', 'wc_product_import_params', array( 'wc-product-import',
'wc_product_import_params',
array(
'import_nonce' => wp_create_nonce( 'wc-product-import' ), 'import_nonce' => wp_create_nonce( 'wc-product-import' ),
'mapping' => array( 'mapping' => array(
'from' => $mapping_from, 'from' => $mapping_from,
@ -444,7 +447,7 @@ class WC_Product_CSV_Importer_Controller {
* Done step. * Done step.
*/ */
protected function done() { protected function done() {
// phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
$imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0; $imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0;
$updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0; $updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0;
$failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0; $failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0;
@ -491,7 +494,8 @@ class WC_Product_CSV_Importer_Controller {
*/ */
$default_columns = $this->normalize_columns_names( $default_columns = $this->normalize_columns_names(
apply_filters( apply_filters(
'woocommerce_csv_product_import_mapping_default_columns', array( 'woocommerce_csv_product_import_mapping_default_columns',
array(
__( 'ID', 'woocommerce' ) => 'id', __( 'ID', 'woocommerce' ) => 'id',
__( 'Type', 'woocommerce' ) => 'type', __( 'Type', 'woocommerce' ) => 'type',
__( 'SKU', 'woocommerce' ) => 'sku', __( 'SKU', 'woocommerce' ) => 'sku',

View File

@ -101,7 +101,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
*/ */
private function import_start() { private function import_start() {
if ( function_exists( 'gc_enable' ) ) { if ( function_exists( 'gc_enable' ) ) {
gc_enable(); // phpcs:ignore PHPCompatibility.PHP.NewFunctions.gc_enableFound gc_enable(); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.gc_enableFound
} }
wc_set_time_limit( 0 ); wc_set_time_limit( 0 );
@ob_flush(); @ob_flush();
@ -200,7 +200,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
* @return bool False if error uploading or invalid file, true otherwise * @return bool False if error uploading or invalid file, true otherwise
*/ */
public function handle_upload() { public function handle_upload() {
// phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification -- Nonce already verified in WC_Tax_Rate_Importer::dispatch() // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification -- Nonce already verified in WC_Tax_Rate_Importer::dispatch()
$file_url = isset( $_POST['file_url'] ) ? wc_clean( wp_unslash( $_POST['file_url'] ) ) : ''; $file_url = isset( $_POST['file_url'] ) ? wc_clean( wp_unslash( $_POST['file_url'] ) ) : '';
if ( empty( $file_url ) ) { if ( empty( $file_url ) ) {

View File

@ -289,11 +289,14 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
* Render any custom filters and search inputs for the list table. * Render any custom filters and search inputs for the list table.
*/ */
protected function render_filters() { protected function render_filters() {
$filters = apply_filters( 'woocommerce_products_admin_list_table_filters', array( $filters = apply_filters(
'woocommerce_products_admin_list_table_filters',
array(
'product_category' => array( $this, 'render_products_category_filter' ), 'product_category' => array( $this, 'render_products_category_filter' ),
'product_type' => array( $this, 'render_products_type_filter' ), 'product_type' => array( $this, 'render_products_type_filter' ),
'stock_status' => array( $this, 'render_products_stock_status_filter' ), 'stock_status' => array( $this, 'render_products_stock_status_filter' ),
) ); )
);
ob_start(); ob_start();
foreach ( $filters as $filter_callback ) { foreach ( $filters as $filter_callback ) {
@ -389,18 +392,24 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
protected function query_filters( $query_vars ) { protected function query_filters( $query_vars ) {
if ( isset( $query_vars['orderby'] ) ) { if ( isset( $query_vars['orderby'] ) ) {
if ( 'price' === $query_vars['orderby'] ) { if ( 'price' === $query_vars['orderby'] ) {
$query_vars = array_merge( $query_vars, array( $query_vars = array_merge(
$query_vars,
array(
// phpcs:ignore WordPress.VIP.SlowDBQuery.slow_db_query_meta_key // phpcs:ignore WordPress.VIP.SlowDBQuery.slow_db_query_meta_key
'meta_key' => '_price', 'meta_key' => '_price',
'orderby' => 'meta_value_num', 'orderby' => 'meta_value_num',
) ); )
);
} }
if ( 'sku' === $query_vars['orderby'] ) { if ( 'sku' === $query_vars['orderby'] ) {
$query_vars = array_merge( $query_vars, array( $query_vars = array_merge(
$query_vars,
array(
// phpcs:ignore WordPress.VIP.SlowDBQuery.slow_db_query_meta_key // phpcs:ignore WordPress.VIP.SlowDBQuery.slow_db_query_meta_key
'meta_key' => '_sku', 'meta_key' => '_sku',
'orderby' => 'meta_value', 'orderby' => 'meta_value',
) ); )
);
} }
} }
@ -512,7 +521,7 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
$replaced_where = str_replace( ".post_type = 'product'", ".post_type = 'product_variation'", $pieces['where'] ); $replaced_where = str_replace( ".post_type = 'product'", ".post_type = 'product_variation'", $pieces['where'] );
$pieces['where'] .= " OR {$wpdb->posts}.ID in ( $pieces['where'] .= " OR {$wpdb->posts}.ID in (
SELECT {$wpdb->posts}.post_parent FROM SELECT {$wpdb->posts}.post_parent FROM
wp_posts LEFT JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id) {$wpdb->posts} LEFT JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)
WHERE 1=1 $replaced_where WHERE 1=1 $replaced_where
)"; )";
return $pieces; return $pieces;

View File

@ -19,7 +19,7 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
</td> </td>
<td class="name" data-sort-value="<?php echo esc_attr( $item->get_name() ); ?>"> <td class="name" data-sort-value="<?php echo esc_attr( $item->get_name() ); ?>">
<?php <?php
echo $product_link ? '<a href="' . esc_url( $product_link ) . '" class="wc-order-item-name">' . esc_html( $item->get_name() ) . '</a>' : '<div class="wc-order-item-name">' . esc_html( $item->get_name() ) . '</div>'; echo $product_link ? '<a href="' . esc_url( $product_link ) . '" class="wc-order-item-name">' . wp_kses_post( $item->get_name() ) . '</a>' : '<div class="wc-order-item-name">' . wp_kses_post( $item->get_name() ) . '</div>';
if ( $product && $product->get_sku() ) { if ( $product && $product->get_sku() ) {
echo '<div class="wc-order-item-sku"><strong>' . esc_html__( 'SKU:', 'woocommerce' ) . '</strong> ' . esc_html( $product->get_sku() ) . '</div>'; echo '<div class="wc-order-item-sku"><strong>' . esc_html__( 'SKU:', 'woocommerce' ) . '</strong> ' . esc_html( $product->get_sku() ) . '</div>';

View File

@ -10,11 +10,6 @@ if ( ! defined( 'ABSPATH' ) ) {
} }
?> ?>
<?php if ( 'publish' === get_post_status() ) : ?>
<style type="text/css">
#post-preview { display:none }
</style>
<?php endif; ?>
<div class="panel-wrap product_data"> <div class="panel-wrap product_data">
<span class="type_box hidden"> &mdash; <span class="type_box hidden"> &mdash;

View File

@ -129,7 +129,7 @@ class WC_Admin_Report {
$get_key = "order_items.{$key}"; $get_key = "order_items.{$key}";
break; break;
default: default:
continue; break;
} }
if ( $value['function'] ) { if ( $value['function'] ) {

View File

@ -47,7 +47,7 @@ defined( 'ABSPATH' ) || exit;
); );
?> ?>
<select class="wc-customer-search" id="key_user" data-placeholder="<?php esc_attr_e( 'Search for a user&hellip;', 'woocommerce' ); ?>" data-allow_clear="true"> <select class="wc-customer-search" id="key_user" data-placeholder="<?php esc_attr_e( 'Search for a user&hellip;', 'woocommerce' ); ?>" data-allow_clear="true">
<option value="<?php echo esc_attr( $user_id ); ?>" selected="selected"><?php echo esc_html( $user_string ); ?><option> <option value="<?php echo esc_attr( $user_id ); ?>" selected="selected"><?php echo esc_html( $user_string ); ?></option>
</select> </select>
</td> </td>
</tr> </tr>

View File

@ -12,11 +12,11 @@ if ( ! defined( 'ABSPATH' ) ) {
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'wootenberg' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'woocommerce' ); ?></a> <a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'wootenberg' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'woocommerce' ); ?></a>
<p> <p>
<?php echo wp_kses_post( __( "We noticed you're experimenting with Gutenberg: Try the WooCommerce Gutenberg Products Block for a powerful new way to feature products in posts.", 'woocommerce' ) ); ?> <?php echo wp_kses_post( __( "We noticed you have the block editor available: Try the WooCommerce Products Block for a powerful new way to feature products in posts.", 'woocommerce' ) ); ?>
</p> </p>
<?php if ( file_exists( WP_PLUGIN_DIR . '/woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) && ! is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) && current_user_can( 'activate_plugin', 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ) : ?> <?php if ( file_exists( WP_PLUGIN_DIR . '/woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) && ! is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) && current_user_can( 'activate_plugin', 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ) : ?>
<p> <p>
<a href="<?php echo esc_url( wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php&plugin_status=active' ), 'activate-plugin_woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Activate the Gutenberg Products Block', 'woocommerce' ); ?></a> <a href="<?php echo esc_url( wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php&plugin_status=active' ), 'activate-plugin_woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Activate the Products Block', 'woocommerce' ); ?></a>
</p> </p>
<?php else : ?> <?php else : ?>
<?php <?php
@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
} }
?> ?>
<p> <p>
<a href="<?php echo esc_url( $url ); ?>" class="button button-primary"><?php esc_html_e( 'Install the WooCommerce Gutenberg Products Block', 'woocommerce' ); ?></a> <a href="<?php echo esc_url( $url ); ?>" class="button button-primary"><?php esc_html_e( 'Install the WooCommerce Products Block', 'woocommerce' ); ?></a>
</p> </p>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

@ -39,7 +39,7 @@ class WC_REST_Authentication {
*/ */
public function __construct() { public function __construct() {
add_filter( 'determine_current_user', array( $this, 'authenticate' ), 15 ); add_filter( 'determine_current_user', array( $this, 'authenticate' ), 15 );
add_filter( 'rest_authentication_errors', array( $this, 'check_authentication_error' ) ); add_filter( 'rest_authentication_errors', array( $this, 'check_authentication_error' ), 15 );
add_filter( 'rest_post_dispatch', array( $this, 'send_unauthorized_headers' ), 50 ); add_filter( 'rest_post_dispatch', array( $this, 'send_unauthorized_headers' ), 50 );
add_filter( 'rest_pre_dispatch', array( $this, 'check_user_permissions' ), 10, 3 ); add_filter( 'rest_pre_dispatch', array( $this, 'check_user_permissions' ), 10, 3 );
} }
@ -140,15 +140,15 @@ class WC_REST_Authentication {
$consumer_secret = ''; $consumer_secret = '';
// If the $_GET parameters are present, use those first. // If the $_GET parameters are present, use those first.
if ( ! empty( $_GET['consumer_key'] ) && ! empty( $_GET['consumer_secret'] ) ) { if ( ! empty( $_GET['consumer_key'] ) && ! empty( $_GET['consumer_secret'] ) ) { // WPCS: CSRF ok.
$consumer_key = $_GET['consumer_key']; // WPCS: sanitization ok. $consumer_key = $_GET['consumer_key']; // WPCS: CSRF ok, sanitization ok.
$consumer_secret = $_GET['consumer_secret']; // WPCS: sanitization ok. $consumer_secret = $_GET['consumer_secret']; // WPCS: CSRF ok, sanitization ok.
} }
// If the above is not present, we will do full basic auth. // If the above is not present, we will do full basic auth.
if ( ! $consumer_key && ! empty( $_SERVER['PHP_AUTH_USER'] ) && ! empty( $_SERVER['PHP_AUTH_PW'] ) ) { if ( ! $consumer_key && ! empty( $_SERVER['PHP_AUTH_USER'] ) && ! empty( $_SERVER['PHP_AUTH_PW'] ) ) {
$consumer_key = $_SERVER['PHP_AUTH_USER']; // WPCS: sanitization ok. $consumer_key = $_SERVER['PHP_AUTH_USER']; // WPCS: CSRF ok, sanitization ok.
$consumer_secret = $_SERVER['PHP_AUTH_PW']; // WPCS: sanitization ok. $consumer_secret = $_SERVER['PHP_AUTH_PW']; // WPCS: CSRF ok, sanitization ok.
} }
// Stop if don't have any key. // Stop if don't have any key.
@ -353,7 +353,7 @@ class WC_REST_Authentication {
*/ */
private function check_oauth_signature( $user, $params ) { private function check_oauth_signature( $user, $params ) {
$http_method = isset( $_SERVER['REQUEST_METHOD'] ) ? strtoupper( $_SERVER['REQUEST_METHOD'] ) : ''; // WPCS: sanitization ok. $http_method = isset( $_SERVER['REQUEST_METHOD'] ) ? strtoupper( $_SERVER['REQUEST_METHOD'] ) : ''; // WPCS: sanitization ok.
$request_path = isset( $_SERVER['REQUEST_URI'] ) ? parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ) : ''; // WPCS: sanitization ok. $request_path = isset( $_SERVER['REQUEST_URI'] ) ? wp_parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ) : ''; // WPCS: sanitization ok.
$wp_base = get_home_url( null, '/', 'relative' ); $wp_base = get_home_url( null, '/', 'relative' );
if ( substr( $request_path, 0, strlen( $wp_base ) ) === $wp_base ) { if ( substr( $request_path, 0, strlen( $wp_base ) ) === $wp_base ) {
$request_path = substr( $request_path, strlen( $wp_base ) ); $request_path = substr( $request_path, strlen( $wp_base ) );
@ -468,7 +468,7 @@ class WC_REST_Authentication {
$used_nonces = array(); $used_nonces = array();
} }
if ( in_array( $nonce, $used_nonces ) ) { if ( in_array( $nonce, $used_nonces, true ) ) {
return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid nonce - nonce has already been used.', 'woocommerce' ), array( 'status' => 401 ) ); return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid nonce - nonce has already been used.', 'woocommerce' ), array( 'status' => 401 ) );
} }
@ -510,7 +510,8 @@ class WC_REST_Authentication {
SELECT key_id, user_id, permissions, consumer_key, consumer_secret, nonces SELECT key_id, user_id, permissions, consumer_key, consumer_secret, nonces
FROM {$wpdb->prefix}woocommerce_api_keys FROM {$wpdb->prefix}woocommerce_api_keys
WHERE consumer_key = %s WHERE consumer_key = %s
", $consumer_key ",
$consumer_key
) )
); );

View File

@ -61,7 +61,7 @@ class WC_REST_Settings_Controller extends WC_REST_Settings_V2_Controller {
* @return WP_Error|WP_REST_Response * @return WP_Error|WP_REST_Response
*/ */
public function update_item( $request ) { public function update_item( $request ) {
$options_controller = new WC_REST_Dev_Setting_Options_Controller(); $options_controller = new WC_REST_Setting_Options_Controller();
$response = $options_controller->update_item( $request ); $response = $options_controller->update_item( $request );
return $response; return $response;

View File

@ -433,7 +433,7 @@ class WC_API_Orders extends WC_API_Resource {
} }
update_post_meta( $order->get_id(), '_payment_method', $data['payment_details']['method_id'] ); update_post_meta( $order->get_id(), '_payment_method', $data['payment_details']['method_id'] );
update_post_meta( $order->get_id(), '_payment_method_title', $data['payment_details']['method_title'] ); update_post_meta( $order->get_id(), '_payment_method_title', sanitize_text_field( $data['payment_details']['method_title'] ) );
// mark as paid if set // mark as paid if set
if ( isset( $data['payment_details']['paid'] ) && true === $data['payment_details']['paid'] ) { if ( isset( $data['payment_details']['paid'] ) && true === $data['payment_details']['paid'] ) {
@ -585,7 +585,7 @@ class WC_API_Orders extends WC_API_Resource {
// Method title. // Method title.
if ( isset( $data['payment_details']['method_title'] ) ) { if ( isset( $data['payment_details']['method_title'] ) ) {
update_post_meta( $order->get_id(), '_payment_method_title', $data['payment_details']['method_title'] ); update_post_meta( $order->get_id(), '_payment_method_title', sanitize_text_field( $data['payment_details']['method_title'] ) );
} }
// Mark as paid if set. // Mark as paid if set.

View File

@ -473,7 +473,7 @@ class WC_API_Orders extends WC_API_Resource {
} }
update_post_meta( $order->get_id(), '_payment_method', $data['payment_details']['method_id'] ); update_post_meta( $order->get_id(), '_payment_method', $data['payment_details']['method_id'] );
update_post_meta( $order->get_id(), '_payment_method_title', $data['payment_details']['method_title'] ); update_post_meta( $order->get_id(), '_payment_method_title', sanitize_text_field( $data['payment_details']['method_title'] ) );
// mark as paid if set // mark as paid if set
if ( isset( $data['payment_details']['paid'] ) && true === $data['payment_details']['paid'] ) { if ( isset( $data['payment_details']['paid'] ) && true === $data['payment_details']['paid'] ) {
@ -622,7 +622,7 @@ class WC_API_Orders extends WC_API_Resource {
// Method title. // Method title.
if ( isset( $data['payment_details']['method_title'] ) ) { if ( isset( $data['payment_details']['method_title'] ) ) {
update_post_meta( $order->get_id(), '_payment_method_title', $data['payment_details']['method_title'] ); update_post_meta( $order->get_id(), '_payment_method_title', sanitize_text_field( $data['payment_details']['method_title'] ) );
} }
// Mark as paid if set. // Mark as paid if set.

View File

@ -1148,6 +1148,9 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller {
'description' => __( 'Payment method title.', 'woocommerce' ), 'description' => __( 'Payment method title.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'arg_options' => array(
'sanitize_callback' => 'sanitize_text_field',
),
), ),
'set_paid' => array( 'set_paid' => array(
'description' => __( 'Define if the order is paid. It will set the status to processing and reduce stock items.', 'woocommerce' ), 'description' => __( 'Define if the order is paid. It will set the status to processing and reduce stock items.', 'woocommerce' ),

View File

@ -1103,6 +1103,9 @@ class WC_REST_Orders_V2_Controller extends WC_REST_Legacy_Orders_Controller {
'description' => __( 'Payment method title.', 'woocommerce' ), 'description' => __( 'Payment method title.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'arg_options' => array(
'sanitize_callback' => 'sanitize_text_field',
),
), ),
'transaction_id' => array( 'transaction_id' => array(
'description' => __( 'Unique transaction ID.', 'woocommerce' ), 'description' => __( 'Unique transaction ID.', 'woocommerce' ),

View File

@ -191,6 +191,15 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
'button' => __( 'Regenerate', 'woocommerce' ), 'button' => __( 'Regenerate', 'woocommerce' ),
'desc' => __( 'This will regenerate all shop thumbnails to match your theme and/or image settings.', 'woocommerce' ), 'desc' => __( 'This will regenerate all shop thumbnails to match your theme and/or image settings.', 'woocommerce' ),
), ),
'db_update_routine' => array(
'name' => __( 'Update database', 'woocommerce' ),
'button' => __( 'Update database', 'woocommerce' ),
'desc' => sprintf(
'<strong class="red">%1$s</strong> %2$s',
__( 'Note:', 'woocommerce' ),
__( 'This tool will update your WooCommerce database to the latest version. Please ensure you make sufficient backups before proceeding.', 'woocommerce' )
),
)
); );
// Jetpack does the image resizing heavy lifting so you don't have to. // Jetpack does the image resizing heavy lifting so you don't have to.
@ -536,6 +545,14 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
$message = __( 'Thumbnail regeneration has been scheduled to run in the background.', 'woocommerce' ); $message = __( 'Thumbnail regeneration has been scheduled to run in the background.', 'woocommerce' );
break; break;
case 'db_update_routine':
$blog_id = get_current_blog_id();
// Used to fire an action added in WP_Background_Process::_construct() that calls WP_Background_Process::handle_cron_healthcheck().
// This method will make sure the database updates are executed even if cron is disabled. Nothing will happen if the updates are already running.
do_action( 'wp_' . $blog_id . '_wc_updater_cron' );
$message = __( 'Database upgrade routine has been scheduled to run in the background.', 'woocommerce' );
break;
default: default:
$tools = $this->get_tools(); $tools = $this->get_tools();
if ( isset( $tools[ $tool ]['callback'] ) ) { if ( isset( $tools[ $tool ]['callback'] ) ) {

View File

@ -37,7 +37,8 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
*/ */
public function register_routes() { public function register_routes() {
register_rest_route( register_rest_route(
$this->namespace, '/' . $this->rest_base, $this->namespace,
'/' . $this->rest_base,
array( array(
array( array(
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
@ -721,10 +722,11 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
'index' => 0, 'index' => 0,
); );
$site_tables = $wpdb->tables( 'all', true ); $site_tables_prefix = $wpdb->get_blog_prefix( get_current_blog_id() );
$global_tables = $wpdb->tables( 'global', true );
foreach ( $database_table_sizes as $table ) { foreach ( $database_table_sizes as $table ) {
// Only include tables matching the prefix of the current site, this is to prevent displaying all tables on a MS install not relating to the current. // Only include tables matching the prefix of the current site, this is to prevent displaying all tables on a MS install not relating to the current.
if ( is_multisite() && ! in_array( $table->name, $site_tables, true ) ) { if ( is_multisite() && 0 !== strpos( $table->name, $site_tables_prefix ) && ! in_array( $table->name, $global_tables, true ) ) {
continue; continue;
} }
$table_type = in_array( $table->name, $core_tables ) ? 'woocommerce' : 'other'; $table_type = in_array( $table->name, $core_tables ) ? 'woocommerce' : 'other';
@ -834,7 +836,6 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
'changelog' => $body->sections['changelog'], 'changelog' => $body->sections['changelog'],
); );
set_transient( md5( $plugin ) . '_version_data', $version_data, DAY_IN_SECONDS ); set_transient( md5( $plugin ) . '_version_data', $version_data, DAY_IN_SECONDS );
break;
} }
} }
} }

View File

@ -327,7 +327,7 @@ final class WC_Cart_Session {
$cart_id = WC()->cart->generate_cart_id( $product_id, $variation_id, $variations, $cart_item_data ); $cart_id = WC()->cart->generate_cart_id( $product_id, $variation_id, $variations, $cart_item_data );
$product_data = wc_get_product( $variation_id ? $variation_id : $product_id ); $product_data = wc_get_product( $variation_id ? $variation_id : $product_id );
$cart[ $cart_id ] = apply_filters( $cart[ $cart_id ] = apply_filters(
'woocommerce_add_cart_item', array_merge( 'woocommerce_add_order_again_cart_item', array_merge(
$cart_item_data, array( $cart_item_data, array(
'key' => $cart_id, 'key' => $cart_id,
'product_id' => $product_id, 'product_id' => $product_id,
@ -341,7 +341,7 @@ final class WC_Cart_Session {
); );
} }
do_action( 'woocommerce_ordered_again', $order->get_id() ); do_action( 'woocommerce_ordered_again', $order->get_id(), $order_items, $cart );
$num_items_in_cart = count( $cart ); $num_items_in_cart = count( $cart );
$num_items_in_original_order = count( $order_items ); $num_items_in_original_order = count( $order_items );

View File

@ -778,7 +778,7 @@ class WC_Cart extends WC_Legacy_Cart {
} }
// Check stock based on all items in the cart and consider any held stock within pending orders. // Check stock based on all items in the cart and consider any held stock within pending orders.
$held_stock = wc_get_held_stock_quantity( $product, $current_session_order_id ); $held_stock = ( $hold_stock_minutes > 0 ) ? wc_get_held_stock_quantity( $product, $current_session_order_id ) : 0;
$required_stock = $product_qty_in_cart[ $product->get_stock_managed_by_id() ]; $required_stock = $product_qty_in_cart[ $product->get_stock_managed_by_id() ];
if ( $product->get_stock_quantity() < ( $held_stock + $required_stock ) ) { if ( $product->get_stock_quantity() < ( $held_stock + $required_stock ) ) {

View File

@ -473,7 +473,8 @@ class WC_Countries {
public function get_address_formats() { public function get_address_formats() {
if ( empty( $this->address_formats ) ) { if ( empty( $this->address_formats ) ) {
$this->address_formats = apply_filters( $this->address_formats = apply_filters(
'woocommerce_localisation_address_formats', array( 'woocommerce_localisation_address_formats',
array(
'default' => "{name}\n{company}\n{address_1}\n{address_2}\n{city}\n{state}\n{postcode}\n{country}", 'default' => "{name}\n{company}\n{address_1}\n{address_2}\n{city}\n{state}\n{postcode}\n{country}",
'AU' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {state} {postcode}\n{country}", 'AU' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {state} {postcode}\n{country}",
'AT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'AT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
@ -548,7 +549,7 @@ class WC_Countries {
$full_country = ( isset( $this->countries[ $country ] ) ) ? $this->countries[ $country ] : $country; $full_country = ( isset( $this->countries[ $country ] ) ) ? $this->countries[ $country ] : $country;
// Country is not needed if the same as base. // Country is not needed if the same as base.
if ( $country === $this->get_base_country() && ! apply_filters( 'woocommerce_formatted_address_force_country_display', true ) ) { if ( $country === $this->get_base_country() && ! apply_filters( 'woocommerce_formatted_address_force_country_display', false ) ) {
$format = str_replace( '{country}', '', $format ); $format = str_replace( '{country}', '', $format );
} }
@ -557,8 +558,10 @@ class WC_Countries {
// Substitute address parts into the string. // Substitute address parts into the string.
$replace = array_map( $replace = array_map(
'esc_html', apply_filters( 'esc_html',
'woocommerce_formatted_address_replacements', array( apply_filters(
'woocommerce_formatted_address_replacements',
array(
'{first_name}' => $args['first_name'], '{first_name}' => $args['first_name'],
'{last_name}' => $args['last_name'], '{last_name}' => $args['last_name'],
'{name}' => $args['first_name'] . ' ' . $args['last_name'], '{name}' => $args['first_name'] . ' ' . $args['last_name'],
@ -580,7 +583,8 @@ class WC_Countries {
'{state_code}' => strtoupper( $state ), '{state_code}' => strtoupper( $state ),
'{postcode_upper}' => strtoupper( $args['postcode'] ), '{postcode_upper}' => strtoupper( $args['postcode'] ),
'{country_upper}' => strtoupper( $full_country ), '{country_upper}' => strtoupper( $full_country ),
), $args ),
$args
) )
); );
@ -737,7 +741,8 @@ class WC_Countries {
public function get_country_locale() { public function get_country_locale() {
if ( empty( $this->locale ) ) { if ( empty( $this->locale ) ) {
$this->locale = apply_filters( $this->locale = apply_filters(
'woocommerce_get_country_locale', array( 'woocommerce_get_country_locale',
array(
'AE' => array( 'AE' => array(
'postcode' => array( 'postcode' => array(
'required' => false, 'required' => false,
@ -752,6 +757,15 @@ class WC_Countries {
'required' => false, 'required' => false,
), ),
), ),
'AO' => array(
'postcode' => array(
'required' => false,
'hidden' => true,
),
'state' => array(
'label' => __( 'Province', 'woocommerce' ),
),
),
'AT' => array( 'AT' => array(
'postcode' => array( 'postcode' => array(
'priority' => 65, 'priority' => 65,
@ -1169,6 +1183,15 @@ class WC_Countries {
'required' => false, 'required' => false,
), ),
), ),
'ST' => array(
'postcode' => array(
'required' => false,
'hidden' => true,
),
'state' => array(
'label' => __( 'District', 'woocommerce' ),
),
),
'VN' => array( 'VN' => array(
'state' => array( 'state' => array(
'required' => false, 'required' => false,

View File

@ -55,7 +55,7 @@ class WC_Geolite_Integration {
$iso_code = ''; $iso_code = '';
try { try {
$reader = new MaxMind\Db\Reader( $this->database ); // phpcs:ignore PHPCompatibility.PHP.NewLanguageConstructs.t_ns_separatorFound $reader = new MaxMind\Db\Reader( $this->database ); // phpcs:ignore PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound
$data = $reader->get( $ip_address ); $data = $reader->get( $ip_address );
if ( isset( $data['country']['iso_code'] ) ) { if ( isset( $data['country']['iso_code'] ) ) {

View File

@ -265,7 +265,7 @@ class WC_Geolocation {
$dest_path = trailingslashit( $upload_dir['basedir'] ) . $database; $dest_path = trailingslashit( $upload_dir['basedir'] ) . $database;
// Extract files with PharData. Tool built into PHP since 5.3. // Extract files with PharData. Tool built into PHP since 5.3.
$file = new PharData( $tmp_database_path ); // phpcs:ignore PHPCompatibility.PHP.NewClasses.phardataFound $file = new PharData( $tmp_database_path ); // phpcs:ignore PHPCompatibility.Classes.NewClasses.phardataFound
$file_path = trailingslashit( $file->current()->getFileName() ) . $database; $file_path = trailingslashit( $file->current()->getFileName() ) . $database;
// Extract under uploads directory. // Extract under uploads directory.

View File

@ -117,6 +117,9 @@ class WC_Install {
'wc_update_350_reviews_comment_type', 'wc_update_350_reviews_comment_type',
'wc_update_350_db_version', 'wc_update_350_db_version',
), ),
'3.5.2' => array(
'wc_update_352_drop_download_log_fk',
),
); );
/** /**
@ -355,6 +358,7 @@ class WC_Install {
* Add more cron schedules. * Add more cron schedules.
* *
* @param array $schedules List of WP scheduled cron jobs. * @param array $schedules List of WP scheduled cron jobs.
*
* @return array * @return array
*/ */
public static function cron_schedules( $schedules ) { public static function cron_schedules( $schedules ) {
@ -404,7 +408,8 @@ class WC_Install {
include_once dirname( __FILE__ ) . '/admin/wc-admin-functions.php'; include_once dirname( __FILE__ ) . '/admin/wc-admin-functions.php';
$pages = apply_filters( $pages = apply_filters(
'woocommerce_create_pages', array( 'woocommerce_create_pages',
array(
'shop' => array( 'shop' => array(
'name' => _x( 'shop', 'Page slug', 'woocommerce' ), 'name' => _x( 'shop', 'Page slug', 'woocommerce' ),
'title' => _x( 'Shop', 'Page title', 'woocommerce' ), 'title' => _x( 'Shop', 'Page title', 'woocommerce' ),
@ -593,21 +598,21 @@ class WC_Install {
// Add constraint to download logs if the columns matches. // Add constraint to download logs if the columns matches.
if ( ! empty( $download_permissions_column_type ) && ! empty( $download_log_column_type ) && $download_permissions_column_type === $download_log_column_type ) { if ( ! empty( $download_permissions_column_type ) && ! empty( $download_log_column_type ) && $download_permissions_column_type === $download_log_column_type ) {
$fk_result = $wpdb->get_row( " $fk_result = $wpdb->get_row(
SELECT COUNT(*) AS fk_count "SELECT COUNT(*) AS fk_count
FROM information_schema.TABLE_CONSTRAINTS FROM information_schema.TABLE_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA = '{$wpdb->dbname}' WHERE CONSTRAINT_SCHEMA = '{$wpdb->dbname}'
AND CONSTRAINT_NAME = 'fk_wc_download_log_permission_id' AND CONSTRAINT_NAME = 'fk_{$wpdb->prefix}wc_download_log_permission_id'
AND CONSTRAINT_TYPE = 'FOREIGN KEY' AND CONSTRAINT_TYPE = 'FOREIGN KEY'
AND TABLE_NAME = '{$wpdb->prefix}wc_download_log' AND TABLE_NAME = '{$wpdb->prefix}wc_download_log'"
" ); ); // WPCS: unprepared SQL ok.
if ( 0 === (int) $fk_result->fk_count ) { if ( 0 === (int) $fk_result->fk_count ) {
$wpdb->query( " $wpdb->query(
ALTER TABLE `{$wpdb->prefix}wc_download_log` "ALTER TABLE `{$wpdb->prefix}wc_download_log`
ADD CONSTRAINT `fk_wc_download_log_permission_id` ADD CONSTRAINT `fk_{$wpdb->prefix}wc_download_log_permission_id`
FOREIGN KEY (`permission_id`) FOREIGN KEY (`permission_id`)
REFERENCES `{$wpdb->prefix}woocommerce_downloadable_product_permissions` (`permission_id`) ON DELETE CASCADE; REFERENCES `{$wpdb->prefix}woocommerce_downloadable_product_permissions` (`permission_id`) ON DELETE CASCADE;"
" ); ); // WPCS: unprepared SQL ok.
} }
} }
} }
@ -888,7 +893,7 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
$tables = self::get_tables(); $tables = self::get_tables();
foreach ( $tables as $table ) { foreach ( $tables as $table ) {
$wpdb->query( "DROP TABLE IF EXISTS {$table}" ); // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared $wpdb->query( "DROP TABLE IF EXISTS {$table}" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
} }
} }
@ -896,6 +901,7 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
* Uninstall tables when MU blog is deleted. * Uninstall tables when MU blog is deleted.
* *
* @param array $tables List of tables that will be deleted by WP. * @param array $tables List of tables that will be deleted by WP.
*
* @return string[] * @return string[]
*/ */
public static function wpmu_drop_tables( $tables ) { public static function wpmu_drop_tables( $tables ) {
@ -1166,6 +1172,7 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
* Show action links on the plugin screen. * Show action links on the plugin screen.
* *
* @param mixed $links Plugin Action links. * @param mixed $links Plugin Action links.
*
* @return array * @return array
*/ */
public static function plugin_action_links( $links ) { public static function plugin_action_links( $links ) {
@ -1181,6 +1188,7 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
* *
* @param mixed $links Plugin Row Meta. * @param mixed $links Plugin Row Meta.
* @param mixed $file Plugin Base file. * @param mixed $file Plugin Base file.
*
* @return array * @return array
*/ */
public static function plugin_row_meta( $links, $file ) { public static function plugin_row_meta( $links, $file ) {
@ -1216,12 +1224,14 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
* *
* @param string $plugin_to_install_id Plugin ID. * @param string $plugin_to_install_id Plugin ID.
* @param array $plugin_to_install Plugin information. * @param array $plugin_to_install Plugin information.
*
* @throws Exception If unable to proceed with plugin installation. * @throws Exception If unable to proceed with plugin installation.
* @since 2.6.0 * @since 2.6.0
*/ */
public static function background_installer( $plugin_to_install_id, $plugin_to_install ) { public static function background_installer( $plugin_to_install_id, $plugin_to_install ) {
// Explicitly clear the event. // Explicitly clear the event.
wp_clear_scheduled_hook( 'woocommerce_plugin_background_installer', func_get_args() ); $args = func_get_args();
wp_clear_scheduled_hook( 'woocommerce_plugin_background_installer', $args );
if ( ! empty( $plugin_to_install['repo-slug'] ) ) { if ( ! empty( $plugin_to_install['repo-slug'] ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/file.php';
@ -1233,7 +1243,10 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
$skin = new Automatic_Upgrader_Skin(); $skin = new Automatic_Upgrader_Skin();
$upgrader = new WP_Upgrader( $skin ); $upgrader = new WP_Upgrader( $skin );
$installed_plugins = array_reduce( array_keys( get_plugins() ), array( __CLASS__, 'associate_plugin_file' ), array() ); $installed_plugins = array_reduce( array_keys( get_plugins() ), array( __CLASS__, 'associate_plugin_file' ) );
if ( empty( $installed_plugins ) ) {
$installed_plugins = array();
}
$plugin_slug = $plugin_to_install['repo-slug']; $plugin_slug = $plugin_to_install['repo-slug'];
$plugin_file = isset( $plugin_to_install['file'] ) ? $plugin_to_install['file'] : $plugin_slug . '.php'; $plugin_file = isset( $plugin_to_install['file'] ) ? $plugin_to_install['file'] : $plugin_slug . '.php';
$installed = false; $installed = false;
@ -1371,12 +1384,14 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
* Install a theme from .org in the background via a cron job (used by installer - opt in). * Install a theme from .org in the background via a cron job (used by installer - opt in).
* *
* @param string $theme_slug Theme slug. * @param string $theme_slug Theme slug.
*
* @throws Exception If unable to proceed with theme installation. * @throws Exception If unable to proceed with theme installation.
* @since 3.1.0 * @since 3.1.0
*/ */
public static function theme_background_installer( $theme_slug ) { public static function theme_background_installer( $theme_slug ) {
// Explicitly clear the event. // Explicitly clear the event.
wp_clear_scheduled_hook( 'woocommerce_theme_background_installer', func_get_args() ); $args = func_get_args();
wp_clear_scheduled_hook( 'woocommerce_theme_background_installer', $args );
if ( ! empty( $theme_slug ) ) { if ( ! empty( $theme_slug ) ) {
// Suppress feedback. // Suppress feedback.
@ -1395,7 +1410,8 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
$skin = new Automatic_Upgrader_Skin(); $skin = new Automatic_Upgrader_Skin();
$upgrader = new Theme_Upgrader( $skin ); $upgrader = new Theme_Upgrader( $skin );
$api = themes_api( $api = themes_api(
'theme_information', array( 'theme_information',
array(
'slug' => $theme_slug, 'slug' => $theme_slug,
'fields' => array( 'sections' => false ), 'fields' => array( 'sections' => false ),
) )

View File

@ -99,10 +99,14 @@ class WC_Logger implements WC_Logger_Interface {
*/ */
public function add( $handle, $message, $level = WC_Log_Levels::NOTICE ) { public function add( $handle, $message, $level = WC_Log_Levels::NOTICE ) {
$message = apply_filters( 'woocommerce_logger_add_message', $message, $handle ); $message = apply_filters( 'woocommerce_logger_add_message', $message, $handle );
$this->log( $level, $message, array( $this->log(
$level,
$message,
array(
'source' => $handle, 'source' => $handle,
'_legacy' => true, '_legacy' => true,
) ); )
);
wc_do_deprecated_action( 'woocommerce_log_add', array( $handle, $message ), '3.0', 'This action has been deprecated with no alternative.' ); wc_do_deprecated_action( 'woocommerce_log_add', array( $handle, $message ), '3.0', 'This action has been deprecated with no alternative.' );
return true; return true;
} }
@ -129,7 +133,7 @@ class WC_Logger implements WC_Logger_Interface {
} }
if ( $this->should_handle( $level ) ) { if ( $this->should_handle( $level ) ) {
$timestamp = current_time( 'timestamp' ); $timestamp = current_time( 'timestamp', 1 );
$message = apply_filters( 'woocommerce_logger_log_message', $message, $level, $context ); $message = apply_filters( 'woocommerce_logger_log_message', $message, $level, $context );
foreach ( $this->handlers as $handler ) { foreach ( $this->handlers as $handler ) {

View File

@ -85,7 +85,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
*/ */
public function apply_changes() { public function apply_changes() {
if ( function_exists( 'array_replace' ) ) { if ( function_exists( 'array_replace' ) ) {
$this->data = array_replace( $this->data, $this->changes ); // phpcs:ignore PHPCompatibility.PHP.NewFunctions.array_replaceFound $this->data = array_replace( $this->data, $this->changes ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.array_replaceFound
} else { // PHP 5.2 compatibility. } else { // PHP 5.2 compatibility.
foreach ( $this->changes as $key => $change ) { foreach ( $this->changes as $key => $change ) {
$this->data[ $key ] = $change; $this->data[ $key ] = $change;

View File

@ -20,7 +20,7 @@ class WC_Product_Factory {
* *
* @param mixed $product_id WC_Product|WP_Post|int|bool $product Product instance, post instance, numeric or false to use global $post. * @param mixed $product_id WC_Product|WP_Post|int|bool $product Product instance, post instance, numeric or false to use global $post.
* @param array $deprecated Previously used to pass arguments to the factory, e.g. to force a type. * @param array $deprecated Previously used to pass arguments to the factory, e.g. to force a type.
* @return WC_Product|bool Product object or null if the product cannot be loaded. * @return WC_Product|bool Product object or false if the product cannot be loaded.
*/ */
public function get_product( $product_id = false, $deprecated = array() ) { public function get_product( $product_id = false, $deprecated = array() ) {
$product_id = $this->get_product_id( $product_id ); $product_id = $this->get_product_id( $product_id );

View File

@ -285,7 +285,7 @@ class WC_Webhook extends WC_Legacy_Webhook {
*/ */
private function get_wp_api_payload( $resource, $resource_id, $event ) { private function get_wp_api_payload( $resource, $resource_id, $event ) {
$rest_api_versions = wc_get_webhook_rest_api_versions(); $rest_api_versions = wc_get_webhook_rest_api_versions();
$version_suffix = end( $rest_api_versions ) === $this->get_api_version() ? strtoupper( str_replace( 'wp_api', '', $this->get_api_version() ) ) : ''; $version_suffix = end( $rest_api_versions ) !== $this->get_api_version() ? strtoupper( str_replace( 'wp_api', '', $this->get_api_version() ) ) : '';
switch ( $resource ) { switch ( $resource ) {
case 'coupon': case 'coupon':

View File

@ -405,7 +405,7 @@ final class WooCommerce {
* @since 3.3.0 * @since 3.3.0
*/ */
private function theme_support_includes() { private function theme_support_includes() {
if ( wc_is_active_theme( array( 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' ) ) ) { if ( wc_is_active_theme( array( 'twentynineteen', 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' ) ) ) {
switch ( get_template() ) { switch ( get_template() ) {
case 'twentyten': case 'twentyten':
include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-ten.php'; include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-ten.php';
@ -431,6 +431,9 @@ final class WooCommerce {
case 'twentyseventeen': case 'twentyseventeen':
include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-seventeen.php'; include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-seventeen.php';
break; break;
case 'twentynineteen':
include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-nineteen.php';
break;
} }
} }
} }

View File

@ -76,7 +76,8 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
'post_date' => gmdate( 'Y-m-d H:i:s', $coupon->get_date_created()->getOffsetTimestamp() ), 'post_date' => gmdate( 'Y-m-d H:i:s', $coupon->get_date_created()->getOffsetTimestamp() ),
'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $coupon->get_date_created()->getTimestamp() ), 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $coupon->get_date_created()->getTimestamp() ),
) )
), true ),
true
); );
if ( $coupon_id ) { if ( $coupon_id ) {
@ -191,7 +192,8 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
*/ */
public function delete( &$coupon, $args = array() ) { public function delete( &$coupon, $args = array() ) {
$args = wp_parse_args( $args = wp_parse_args(
$args, array( $args,
array(
'force_delete' => false, 'force_delete' => false,
) )
); );
@ -343,7 +345,8 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
add_post_meta( $id, 'usage_count', $coupon->get_usage_count( 'edit' ), true ); add_post_meta( $id, 'usage_count', $coupon->get_usage_count( 'edit' ), true );
$wpdb->query( $wpdb->query(
$wpdb->prepare( $wpdb->prepare(
"UPDATE $wpdb->postmeta SET meta_value = meta_value {$operator} 1 WHERE meta_key = 'usage_count' AND post_id = %d;", // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
"UPDATE $wpdb->postmeta SET meta_value = meta_value {$operator} 1 WHERE meta_key = 'usage_count' AND post_id = %d;",
$id $id
) )
); );

View File

@ -117,11 +117,13 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
wp_update_user( wp_update_user(
apply_filters( apply_filters(
'woocommerce_update_customer_args', array( 'woocommerce_update_customer_args',
array(
'ID' => $customer->get_id(), 'ID' => $customer->get_id(),
'role' => $customer->get_role(), 'role' => $customer->get_role(),
'display_name' => $customer->get_display_name(), 'display_name' => $customer->get_display_name(),
), $customer ),
$customer
) )
); );
$wp_user = new WP_User( $customer->get_id() ); $wp_user = new WP_User( $customer->get_id() );
@ -156,7 +158,7 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
// Load meta but exclude deprecated props. // Load meta but exclude deprecated props.
$user_meta = array_diff_key( $user_meta = array_diff_key(
array_map( 'wc_flatten_meta_callback', get_user_meta( $customer_id ) ), array_change_key_case( array_map( 'wc_flatten_meta_callback', get_user_meta( $customer_id ) ) ),
array_flip( array( 'country', 'state', 'postcode', 'city', 'address', 'address_2', 'default', 'location' ) ) array_flip( array( 'country', 'state', 'postcode', 'city', 'address', 'address_2', 'default', 'location' ) )
); );
@ -186,11 +188,13 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
public function update( &$customer ) { public function update( &$customer ) {
wp_update_user( wp_update_user(
apply_filters( apply_filters(
'woocommerce_update_customer_args', array( 'woocommerce_update_customer_args',
array(
'ID' => $customer->get_id(), 'ID' => $customer->get_id(),
'user_email' => $customer->get_email(), 'user_email' => $customer->get_email(),
'display_name' => $customer->get_display_name(), 'display_name' => $customer->get_display_name(),
), $customer ),
$customer
) )
); );
@ -225,7 +229,8 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
} }
$args = wp_parse_args( $args = wp_parse_args(
$args, array( $args,
array(
'reassign' => 0, 'reassign' => 0,
) )
); );
@ -326,7 +331,7 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
global $wpdb; global $wpdb;
$last_order = $wpdb->get_var( $last_order = $wpdb->get_var(
// phpcs:disable WordPress.WP.PreparedSQL.NotPrepared // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
"SELECT posts.ID "SELECT posts.ID
FROM $wpdb->posts AS posts FROM $wpdb->posts AS posts
LEFT JOIN {$wpdb->postmeta} AS meta on posts.ID = meta.post_id LEFT JOIN {$wpdb->postmeta} AS meta on posts.ID = meta.post_id
@ -359,7 +364,7 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
global $wpdb; global $wpdb;
$count = $wpdb->get_var( $count = $wpdb->get_var(
// phpcs:disable WordPress.WP.PreparedSQL.NotPrepared // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
"SELECT COUNT(*) "SELECT COUNT(*)
FROM $wpdb->posts as posts FROM $wpdb->posts as posts
LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id
@ -394,7 +399,7 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
$statuses = array_map( 'esc_sql', wc_get_is_paid_statuses() ); $statuses = array_map( 'esc_sql', wc_get_is_paid_statuses() );
$spent = $wpdb->get_var( $spent = $wpdb->get_var(
// phpcs:disable WordPress.WP.PreparedSQL.NotPrepared // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
apply_filters( apply_filters(
'woocommerce_customer_get_total_spent_query', 'woocommerce_customer_get_total_spent_query',
"SELECT SUM(meta2.meta_value) "SELECT SUM(meta2.meta_value)
@ -437,18 +442,23 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
$query = new WP_User_Query( $query = new WP_User_Query(
apply_filters( apply_filters(
'woocommerce_customer_search_customers', array( 'woocommerce_customer_search_customers',
array(
'search' => '*' . esc_attr( $term ) . '*', 'search' => '*' . esc_attr( $term ) . '*',
'search_columns' => array( 'user_login', 'user_url', 'user_email', 'user_nicename', 'display_name' ), 'search_columns' => array( 'user_login', 'user_url', 'user_email', 'user_nicename', 'display_name' ),
'fields' => 'ID', 'fields' => 'ID',
'number' => $limit, 'number' => $limit,
), $term, $limit, 'main_query' ),
$term,
$limit,
'main_query'
) )
); );
$query2 = new WP_User_Query( $query2 = new WP_User_Query(
apply_filters( apply_filters(
'woocommerce_customer_search_customers', array( 'woocommerce_customer_search_customers',
array(
'fields' => 'ID', 'fields' => 'ID',
'number' => $limit, 'number' => $limit,
'meta_query' => array( 'meta_query' => array(
@ -464,7 +474,10 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
'compare' => 'LIKE', 'compare' => 'LIKE',
), ),
), ),
), $term, $limit, 'meta_query' ),
$term,
$limit,
'meta_query'
) )
); );

View File

@ -281,7 +281,8 @@ class WC_Customer_Download_Data_Store implements WC_Customer_Download_Data_Store
global $wpdb; global $wpdb;
$args = wp_parse_args( $args = wp_parse_args(
$args, array( $args,
array(
'user_email' => '', 'user_email' => '',
'user_id' => '', 'user_id' => '',
'order_id' => '', 'order_id' => '',
@ -345,7 +346,7 @@ class WC_Customer_Download_Data_Store implements WC_Customer_Download_Data_Store
$query[] = $wpdb->prepare( 'LIMIT %d, %d', absint( $args['limit'] ) * absint( $args['page'] - 1 ), absint( $args['limit'] ) ); $query[] = $wpdb->prepare( 'LIMIT %d, %d', absint( $args['limit'] ) * absint( $args['page'] - 1 ), absint( $args['limit'] ) );
} }
// phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
$results = $wpdb->get_results( implode( ' ', $query ), $get_results_output ); $results = $wpdb->get_results( implode( ' ', $query ), $get_results_output );
switch ( $args['return'] ) { switch ( $args['return'] ) {

View File

@ -75,7 +75,7 @@ class WC_Data_Store_WP {
$db_info = $this->get_db_info(); $db_info = $this->get_db_info();
$raw_meta_data = $wpdb->get_results( $raw_meta_data = $wpdb->get_results(
$wpdb->prepare( $wpdb->prepare(
// phpcs:disable WordPress.WP.PreparedSQL.NotPrepared // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
"SELECT {$db_info['meta_id_field']} as meta_id, meta_key, meta_value "SELECT {$db_info['meta_id_field']} as meta_id, meta_key, meta_value
FROM {$db_info['table']} FROM {$db_info['table']}
WHERE {$db_info['object_id_field']} = %d WHERE {$db_info['object_id_field']} = %d
@ -495,9 +495,12 @@ class WC_Data_Store_WP {
protected function get_search_stopwords() { protected function get_search_stopwords() {
// Translators: This is a comma-separated list of very common words that should be excluded from a search, like a, an, and the. These are usually called "stopwords". You should not simply translate these individual words into your language. Instead, look for and provide commonly accepted stopwords in your language. // Translators: This is a comma-separated list of very common words that should be excluded from a search, like a, an, and the. These are usually called "stopwords". You should not simply translate these individual words into your language. Instead, look for and provide commonly accepted stopwords in your language.
$stopwords = array_map( $stopwords = array_map(
'wc_strtolower', array_map( 'wc_strtolower',
'trim', explode( array_map(
',', _x( 'trim',
explode(
',',
_x(
'about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www', 'about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www',
'Comma-separated list of search stopwords in your language', 'Comma-separated list of search stopwords in your language',
'woocommerce' 'woocommerce'

View File

@ -235,7 +235,8 @@ class WC_Payment_Token_Data_Store extends WC_Data_Store_WP implements WC_Payment
public function get_tokens( $args ) { public function get_tokens( $args ) {
global $wpdb; global $wpdb;
$args = wp_parse_args( $args = wp_parse_args(
$args, array( $args,
array(
'token_id' => '', 'token_id' => '',
'user_id' => '', 'user_id' => '',
'gateway_id' => '', 'gateway_id' => '',
@ -275,7 +276,7 @@ class WC_Payment_Token_Data_Store extends WC_Data_Store_WP implements WC_Payment
$where[] = $wpdb->prepare( 'type = %s', $args['type'] ); $where[] = $wpdb->prepare( 'type = %s', $args['type'] );
} }
// phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
$token_results = $wpdb->get_results( $sql . ' WHERE ' . implode( ' AND ', $where ) . ' ' . $limits ); $token_results = $wpdb->get_results( $sql . ' WHERE ' . implode( ' AND ', $where ) . ' ' . $limits );
return $token_results; return $token_results;

View File

@ -99,7 +99,8 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
$id = wp_insert_post( $id = wp_insert_post(
apply_filters( apply_filters(
'woocommerce_new_product_data', array( 'woocommerce_new_product_data',
array(
'post_type' => 'product', 'post_type' => 'product',
'post_status' => $product->get_status() ? $product->get_status() : 'publish', 'post_status' => $product->get_status() ? $product->get_status() : 'publish',
'post_author' => get_current_user_id(), 'post_author' => get_current_user_id(),
@ -114,7 +115,8 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $product->get_date_created( 'edit' )->getTimestamp() ), 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $product->get_date_created( 'edit' )->getTimestamp() ),
'post_name' => $product->get_slug( 'edit' ), 'post_name' => $product->get_slug( 'edit' ),
) )
), true ),
true
); );
if ( $id && ! is_wp_error( $id ) ) { if ( $id && ! is_wp_error( $id ) ) {
@ -262,7 +264,8 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
$post_type = $product->is_type( 'variation' ) ? 'product_variation' : 'product'; $post_type = $product->is_type( 'variation' ) ? 'product_variation' : 'product';
$args = wp_parse_args( $args = wp_parse_args(
$args, array( $args,
array(
'force_delete' => false, 'force_delete' => false,
) )
); );
@ -429,7 +432,8 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
'is_visible' => 0, 'is_visible' => 0,
'is_variation' => 0, 'is_variation' => 0,
'is_taxonomy' => 0, 'is_taxonomy' => 0,
), (array) $meta_attribute_value ),
(array) $meta_attribute_value
); );
// Check if is a taxonomy attribute. // Check if is a taxonomy attribute.
@ -872,7 +876,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
} }
return $wpdb->get_results( return $wpdb->get_results(
// phpcs:disable WordPress.WP.PreparedSQL.NotPrepared // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
$wpdb->prepare( $wpdb->prepare(
"SELECT post.ID as id, post.post_parent as parent_id FROM `$wpdb->posts` AS post "SELECT post.ID as id, post.post_parent as parent_id FROM `$wpdb->posts` AS post
LEFT JOIN `$wpdb->postmeta` AS meta ON post.ID = meta.post_id LEFT JOIN `$wpdb->postmeta` AS meta ON post.ID = meta.post_id
@ -953,7 +957,8 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
AND $wpdb->postmeta.meta_key = '_sku' AND $wpdb->postmeta.meta_value = %s AND $wpdb->postmeta.meta_key = '_sku' AND $wpdb->postmeta.meta_value = %s
AND $wpdb->postmeta.post_id <> %d AND $wpdb->postmeta.post_id <> %d
LIMIT 1", LIMIT 1",
wp_slash( $sku ), $product_id wp_slash( $sku ),
$product_id
) )
); );
} }
@ -1150,7 +1155,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
$related_product_query = (array) apply_filters( 'woocommerce_product_related_posts_query', $this->get_related_products_query( $cats_array, $tags_array, $exclude_ids, $limit + 10 ), $product_id, $args ); $related_product_query = (array) apply_filters( 'woocommerce_product_related_posts_query', $this->get_related_products_query( $cats_array, $tags_array, $exclude_ids, $limit + 10 ), $product_id, $args );
// phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery, WordPress.WP.PreparedSQL.NotPrepared // phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.NotPrepared
return $wpdb->get_col( implode( ' ', $related_product_query ) ); return $wpdb->get_col( implode( ' ', $related_product_query ) );
} }
@ -1233,7 +1238,9 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
// phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery // phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery
$wpdb->query( $wpdb->query(
$wpdb->prepare( $wpdb->prepare(
"UPDATE {$wpdb->postmeta} SET meta_value = meta_value + %f WHERE post_id = %d AND meta_key='_stock'", $stock_quantity, $product_id_with_stock "UPDATE {$wpdb->postmeta} SET meta_value = meta_value + %f WHERE post_id = %d AND meta_key='_stock'",
$stock_quantity,
$product_id_with_stock
) )
); );
break; break;
@ -1241,7 +1248,9 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
// phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery // phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery
$wpdb->query( $wpdb->query(
$wpdb->prepare( $wpdb->prepare(
"UPDATE {$wpdb->postmeta} SET meta_value = meta_value - %f WHERE post_id = %d AND meta_key='_stock'", $stock_quantity, $product_id_with_stock "UPDATE {$wpdb->postmeta} SET meta_value = meta_value - %f WHERE post_id = %d AND meta_key='_stock'",
$stock_quantity,
$product_id_with_stock
) )
); );
break; break;
@ -1249,7 +1258,9 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
// phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery // phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery
$wpdb->query( $wpdb->query(
$wpdb->prepare( $wpdb->prepare(
"UPDATE {$wpdb->postmeta} SET meta_value = %f WHERE post_id = %d AND meta_key='_stock'", $stock_quantity, $product_id_with_stock "UPDATE {$wpdb->postmeta} SET meta_value = %f WHERE post_id = %d AND meta_key='_stock'",
$stock_quantity,
$product_id_with_stock
) )
); );
break; break;
@ -1278,7 +1289,9 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
// phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery // phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery
$wpdb->query( $wpdb->query(
$wpdb->prepare( $wpdb->prepare(
"UPDATE {$wpdb->postmeta} SET meta_value = meta_value + %f WHERE post_id = %d AND meta_key='total_sales'", $quantity, $product_id "UPDATE {$wpdb->postmeta} SET meta_value = meta_value + %f WHERE post_id = %d AND meta_key='total_sales'",
$quantity,
$product_id
) )
); );
break; break;
@ -1286,7 +1299,9 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
// phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery // phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery
$wpdb->query( $wpdb->query(
$wpdb->prepare( $wpdb->prepare(
"UPDATE {$wpdb->postmeta} SET meta_value = meta_value - %f WHERE post_id = %d AND meta_key='total_sales'", $quantity, $product_id "UPDATE {$wpdb->postmeta} SET meta_value = meta_value - %f WHERE post_id = %d AND meta_key='total_sales'",
$quantity,
$product_id
) )
); );
break; break;
@ -1294,7 +1309,9 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
// phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery // phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery
$wpdb->query( $wpdb->query(
$wpdb->prepare( $wpdb->prepare(
"UPDATE {$wpdb->postmeta} SET meta_value = %f WHERE post_id = %d AND meta_key='total_sales'", $quantity, $product_id "UPDATE {$wpdb->postmeta} SET meta_value = %f WHERE post_id = %d AND meta_key='total_sales'",
$quantity,
$product_id
) )
); );
break; break;

View File

@ -43,7 +43,8 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
'is_visible' => 0, 'is_visible' => 0,
'is_variation' => 0, 'is_variation' => 0,
'is_taxonomy' => 0, 'is_taxonomy' => 0,
), (array) $meta_attribute_value ),
(array) $meta_attribute_value
); );
// Maintain data integrity. 4.9 changed sanitization functions - update the values here so variations function correctly. // Maintain data integrity. 4.9 changed sanitization functions - update the values here so variations function correctly.
@ -184,7 +185,8 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
$values = array_unique( $values = array_unique(
$wpdb->get_col( $wpdb->get_col(
$wpdb->prepare( $wpdb->prepare(
"SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key = %s AND post_id IN (" . implode( ',', array_map( 'absint', $child_ids ) ) . ')', // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
"SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key = %s AND post_id IN (" . implode( ',', array_map( 'absint', $child_ids ) ) . ')',
wc_variation_attribute_name( $attribute['name'] ) wc_variation_attribute_name( $attribute['name'] )
) )
) )
@ -286,38 +288,44 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
if ( $for_display ) { if ( $for_display ) {
if ( 'incl' === get_option( 'woocommerce_tax_display_shop' ) ) { if ( 'incl' === get_option( 'woocommerce_tax_display_shop' ) ) {
$price = '' === $price ? '' : wc_get_price_including_tax( $price = '' === $price ? '' : wc_get_price_including_tax(
$variation, array( $variation,
array(
'qty' => 1, 'qty' => 1,
'price' => $price, 'price' => $price,
) )
); );
$regular_price = '' === $regular_price ? '' : wc_get_price_including_tax( $regular_price = '' === $regular_price ? '' : wc_get_price_including_tax(
$variation, array( $variation,
array(
'qty' => 1, 'qty' => 1,
'price' => $regular_price, 'price' => $regular_price,
) )
); );
$sale_price = '' === $sale_price ? '' : wc_get_price_including_tax( $sale_price = '' === $sale_price ? '' : wc_get_price_including_tax(
$variation, array( $variation,
array(
'qty' => 1, 'qty' => 1,
'price' => $sale_price, 'price' => $sale_price,
) )
); );
} else { } else {
$price = '' === $price ? '' : wc_get_price_excluding_tax( $price = '' === $price ? '' : wc_get_price_excluding_tax(
$variation, array( $variation,
array(
'qty' => 1, 'qty' => 1,
'price' => $price, 'price' => $price,
) )
); );
$regular_price = '' === $regular_price ? '' : wc_get_price_excluding_tax( $regular_price = '' === $regular_price ? '' : wc_get_price_excluding_tax(
$variation, array( $variation,
array(
'qty' => 1, 'qty' => 1,
'price' => $regular_price, 'price' => $regular_price,
) )
); );
$sale_price = '' === $sale_price ? '' : wc_get_price_excluding_tax( $sale_price = '' === $sale_price ? '' : wc_get_price_excluding_tax(
$variation, array( $variation,
array(
'qty' => 1, 'qty' => 1,
'price' => $sale_price, 'price' => $sale_price,
) )
@ -394,7 +402,7 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
public function child_has_weight( $product ) { public function child_has_weight( $product ) {
global $wpdb; global $wpdb;
$children = $product->get_visible_children(); $children = $product->get_visible_children();
return $children ? null !== $wpdb->get_var( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_weight' AND meta_value > 0 AND post_id IN ( " . implode( ',', array_map( 'absint', $children ) ) . ' )' ) : false; // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared return $children ? null !== $wpdb->get_var( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_weight' AND meta_value > 0 AND post_id IN ( " . implode( ',', array_map( 'absint', $children ) ) . ' )' ) : false; // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
} }
/** /**
@ -407,7 +415,7 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
public function child_has_dimensions( $product ) { public function child_has_dimensions( $product ) {
global $wpdb; global $wpdb;
$children = $product->get_visible_children(); $children = $product->get_visible_children();
return $children ? null !== $wpdb->get_var( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key IN ( '_length', '_width', '_height' ) AND meta_value > 0 AND post_id IN ( " . implode( ',', array_map( 'absint', $children ) ) . ' )' ) : false; // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared return $children ? null !== $wpdb->get_var( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key IN ( '_length', '_width', '_height' ) AND meta_value > 0 AND post_id IN ( " . implode( ',', array_map( 'absint', $children ) ) . ' )' ) : false; // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
} }
/** /**
@ -437,7 +445,8 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
if ( $children ) { if ( $children ) {
$children_with_status = $wpdb->get_var( $children_with_status = $wpdb->get_var(
$wpdb->prepare( $wpdb->prepare(
"SELECT COUNT( post_id ) FROM $wpdb->postmeta WHERE meta_key = '_stock_status' AND meta_value = %s AND post_id IN ( " . implode( ',', array_map( 'absint', $children ) ) . ' )', // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
"SELECT COUNT( post_id ) FROM $wpdb->postmeta WHERE meta_key = '_stock_status' AND meta_value = %s AND post_id IN ( " . implode( ',', array_map( 'absint', $children ) ) . ' )',
$status $status
) )
); );
@ -487,7 +496,7 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
if ( $product->get_manage_stock() ) { if ( $product->get_manage_stock() ) {
$status = $product->get_stock_status(); $status = $product->get_stock_status();
$children = $product->get_children(); $children = $product->get_children();
$managed_children = $children ? array_unique( $wpdb->get_col( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_manage_stock' AND meta_value != 'yes' AND post_id IN ( " . implode( ',', array_map( 'absint', $children ) ) . ' )' ) ) : array(); // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared $managed_children = $children ? array_unique( $wpdb->get_col( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_manage_stock' AND meta_value != 'yes' AND post_id IN ( " . implode( ',', array_map( 'absint', $children ) ) . ' )' ) ) : array(); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
$changed = false; $changed = false;
foreach ( $managed_children as $managed_child ) { foreach ( $managed_children as $managed_child ) {
if ( update_post_meta( $managed_child, '_stock_status', $status ) ) { if ( update_post_meta( $managed_child, '_stock_status', $status ) ) {
@ -512,7 +521,7 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
global $wpdb; global $wpdb;
$children = $product->get_visible_children(); $children = $product->get_visible_children();
$prices = $children ? array_unique( $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_price' AND post_id IN ( " . implode( ',', array_map( 'absint', $children ) ) . ' )' ) ) : array(); // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared $prices = $children ? array_unique( $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_price' AND post_id IN ( " . implode( ',', array_map( 'absint', $children ) ) . ' )' ) ) : array(); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
delete_post_meta( $product->get_id(), '_price' ); delete_post_meta( $product->get_id(), '_price' );
delete_post_meta( $product->get_id(), '_sale_price' ); delete_post_meta( $product->get_id(), '_sale_price' );

View File

@ -113,7 +113,8 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
$id = wp_insert_post( $id = wp_insert_post(
apply_filters( apply_filters(
'woocommerce_new_product_variation_data', array( 'woocommerce_new_product_variation_data',
array(
'post_type' => 'product_variation', 'post_type' => 'product_variation',
'post_status' => $product->get_status() ? $product->get_status() : 'publish', 'post_status' => $product->get_status() ? $product->get_status() : 'publish',
'post_author' => get_current_user_id(), 'post_author' => get_current_user_id(),
@ -127,7 +128,8 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $product->get_date_created( 'edit' )->getTimestamp() ), 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $product->get_date_created( 'edit' )->getTimestamp() ),
'post_name' => $product->get_slug( 'edit' ), 'post_name' => $product->get_slug( 'edit' ),
) )
), true ),
true
); );
if ( $id && ! is_wp_error( $id ) ) { if ( $id && ! is_wp_error( $id ) ) {
@ -432,7 +434,8 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
// Remove old taxonomies attributes so data is kept up to date - first get attribute key names. // Remove old taxonomies attributes so data is kept up to date - first get attribute key names.
$delete_attribute_keys = $wpdb->get_col( $delete_attribute_keys = $wpdb->get_col(
$wpdb->prepare( $wpdb->prepare(
"SELECT meta_key FROM {$wpdb->postmeta} WHERE meta_key LIKE %s AND meta_key NOT IN ( '" . implode( "','", array_map( 'esc_sql', $updated_attribute_keys ) ) . "' ) AND post_id = %d", // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.QuotedDynamicPlaceholderGeneration // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.QuotedDynamicPlaceholderGeneration
"SELECT meta_key FROM {$wpdb->postmeta} WHERE meta_key LIKE %s AND meta_key NOT IN ( '" . implode( "','", array_map( 'esc_sql', $updated_attribute_keys ) ) . "' ) AND post_id = %d",
$wpdb->esc_like( 'attribute_' ) . '%', $wpdb->esc_like( 'attribute_' ) . '%',
$product->get_id() $product->get_id()
) )

View File

@ -25,7 +25,8 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin
public function create( &$zone ) { public function create( &$zone ) {
global $wpdb; global $wpdb;
$wpdb->insert( $wpdb->insert(
$wpdb->prefix . 'woocommerce_shipping_zones', array( $wpdb->prefix . 'woocommerce_shipping_zones',
array(
'zone_name' => $zone->get_zone_name(), 'zone_name' => $zone->get_zone_name(),
'zone_order' => $zone->get_zone_order(), 'zone_order' => $zone->get_zone_order(),
) )
@ -48,10 +49,12 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin
global $wpdb; global $wpdb;
if ( $zone->get_id() ) { if ( $zone->get_id() ) {
$wpdb->update( $wpdb->update(
$wpdb->prefix . 'woocommerce_shipping_zones', array( $wpdb->prefix . 'woocommerce_shipping_zones',
array(
'zone_name' => $zone->get_zone_name(), 'zone_name' => $zone->get_zone_name(),
'zone_order' => $zone->get_zone_order(), 'zone_order' => $zone->get_zone_order(),
), array( 'zone_id' => $zone->get_id() ) ),
array( 'zone_id' => $zone->get_id() )
); );
} }
$zone->save_meta_data(); $zone->save_meta_data();
@ -140,7 +143,7 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin
$raw_methods_sql = "SELECT method_id, method_order, instance_id, is_enabled FROM {$wpdb->prefix}woocommerce_shipping_zone_methods WHERE zone_id = %d"; $raw_methods_sql = "SELECT method_id, method_order, instance_id, is_enabled FROM {$wpdb->prefix}woocommerce_shipping_zone_methods WHERE zone_id = %d";
} }
return $wpdb->get_results( $wpdb->prepare( $raw_methods_sql, $zone_id ) ); // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared return $wpdb->get_results( $wpdb->prepare( $raw_methods_sql, $zone_id ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
} }
/** /**
@ -245,7 +248,7 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin
return $wpdb->get_var( return $wpdb->get_var(
"SELECT zones.zone_id FROM {$wpdb->prefix}woocommerce_shipping_zones as zones "SELECT zones.zone_id FROM {$wpdb->prefix}woocommerce_shipping_zones as zones
LEFT OUTER JOIN {$wpdb->prefix}woocommerce_shipping_zone_locations as locations ON zones.zone_id = locations.zone_id AND location_type != 'postcode' LEFT OUTER JOIN {$wpdb->prefix}woocommerce_shipping_zone_locations as locations ON zones.zone_id = locations.zone_id AND location_type != 'postcode'
WHERE " . implode( ' ', $criteria ) // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared WHERE " . implode( ' ', $criteria ) // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
. ' ORDER BY zone_order ASC, zone_id ASC LIMIT 1' . ' ORDER BY zone_order ASC, zone_id ASC LIMIT 1'
); );
} }
@ -317,7 +320,8 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin
foreach ( $zone->get_zone_locations( 'edit' ) as $location ) { foreach ( $zone->get_zone_locations( 'edit' ) as $location ) {
$wpdb->insert( $wpdb->insert(
$wpdb->prefix . 'woocommerce_shipping_zone_locations', array( $wpdb->prefix . 'woocommerce_shipping_zone_locations',
array(
'zone_id' => $zone->get_id(), 'zone_id' => $zone->get_id(),
'location_code' => $location->code, 'location_code' => $location->code,
'location_type' => $location->type, 'location_type' => $location->type,

View File

@ -171,7 +171,7 @@ abstract class WC_CSV_Exporter {
*/ */
public function send_headers() { public function send_headers() {
if ( function_exists( 'gc_enable' ) ) { if ( function_exists( 'gc_enable' ) ) {
gc_enable(); // phpcs:ignore PHPCompatibility.PHP.NewFunctions.gc_enableFound gc_enable(); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.gc_enableFound
} }
if ( function_exists( 'apache_setenv' ) ) { if ( function_exists( 'apache_setenv' ) ) {
@apache_setenv( 'no-gzip', 1 ); // @codingStandardsIgnoreLine @apache_setenv( 'no-gzip', 1 ); // @codingStandardsIgnoreLine
@ -379,7 +379,6 @@ abstract class WC_CSV_Exporter {
} }
$use_mb = function_exists( 'mb_convert_encoding' ); $use_mb = function_exists( 'mb_convert_encoding' );
$data = (string) urldecode( $data );
if ( $use_mb ) { if ( $use_mb ) {
$encoding = mb_detect_encoding( $data, 'UTF-8, ISO-8859-1', true ); $encoding = mb_detect_encoding( $data, 'UTF-8, ISO-8859-1', true );

View File

@ -205,7 +205,7 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
$accounts = array(); $accounts = array();
// phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification -- Nonce verification already handled in WC_Admin_Settings::save() // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification -- Nonce verification already handled in WC_Admin_Settings::save()
if ( isset( $_POST['bacs_account_name'] ) && isset( $_POST['bacs_account_number'] ) && isset( $_POST['bacs_bank_name'] ) if ( isset( $_POST['bacs_account_name'] ) && isset( $_POST['bacs_account_number'] ) && isset( $_POST['bacs_bank_name'] )
&& isset( $_POST['bacs_sort_code'] ) && isset( $_POST['bacs_iban'] ) && isset( $_POST['bacs_bic'] ) ) { && isset( $_POST['bacs_sort_code'] ) && isset( $_POST['bacs_iban'] ) && isset( $_POST['bacs_bic'] ) ) {
@ -306,7 +306,8 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
// BACS account fields shown on the thanks page and in emails. // BACS account fields shown on the thanks page and in emails.
$account_fields = apply_filters( $account_fields = apply_filters(
'woocommerce_bacs_account_fields', array( 'woocommerce_bacs_account_fields',
array(
'bank_name' => array( 'bank_name' => array(
'label' => __( 'Bank', 'woocommerce' ), 'label' => __( 'Bank', 'woocommerce' ),
'value' => $bacs_account->bank_name, 'value' => $bacs_account->bank_name,
@ -327,7 +328,8 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
'label' => __( 'BIC', 'woocommerce' ), 'label' => __( 'BIC', 'woocommerce' ),
'value' => $bacs_account->bic, 'value' => $bacs_account->bic,
), ),
), $order_id ),
$order_id
); );
foreach ( $account_fields as $field_key => $field ) { foreach ( $account_fields as $field_key => $field ) {
@ -386,7 +388,8 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
// Locale information to be used - only those that are not 'Sort Code'. // Locale information to be used - only those that are not 'Sort Code'.
$this->locale = apply_filters( $this->locale = apply_filters(
'woocommerce_get_bacs_locale', array( 'woocommerce_get_bacs_locale',
array(
'AU' => array( 'AU' => array(
'sortcode' => array( 'sortcode' => array(
'label' => __( 'BSB', 'woocommerce' ), 'label' => __( 'BSB', 'woocommerce' ),

View File

@ -205,9 +205,9 @@ class Simplify_PaymentsApi
$url = $this->fixUrl($url) . urlencode(lcfirst($object->getClazz())) . '/'; $url = $this->fixUrl($url) . urlencode(lcfirst($object->getClazz())) . '/';
$queryParams = array(); $queryParams = array();
if ($action == "show") { if ( 'show' == $action ) {
$url .= urlencode($object->id); $url .= urlencode($object->id);
} elseif ($action == "list") { } elseif ( 'list' == $action ) {
$queryParams = array_merge($queryParams, array('max' => $object->max, 'offset' => $object->offset)); $queryParams = array_merge($queryParams, array('max' => $object->max, 'offset' => $object->offset));
if (is_array($object->filter) && count(array_keys($object->filter))) { if (is_array($object->filter) && count(array_keys($object->filter))) {
foreach ($object->filter as $key => $value) { foreach ($object->filter as $key => $value) {
@ -225,11 +225,11 @@ class Simplify_PaymentsApi
$url .= $query; $url .= $query;
} }
} elseif ($action == "delete") { } elseif ( 'delete' == $action ) {
$url .= urlencode($object->id); $url .= urlencode($object->id);
} elseif ($action == "update") { } elseif ( 'update' == $action ) {
$url .= urlencode($object->id); $url .= urlencode($object->id);
} elseif ($action == "create") { } elseif ( 'create' == $action ) {
} }
return $url; return $url;
} }

View File

@ -162,15 +162,15 @@ class Emogrifier
// type and attribute exact value // type and attribute exact value
'/(\\w)\\[(\\w+)\\=[\'"]?([\\w\\s]+)[\'"]?\\]/' => '\\1[@\\2="\\3"]', '/(\\w)\\[(\\w+)\\=[\'"]?([\\w\\s]+)[\'"]?\\]/' => '\\1[@\\2="\\3"]',
// type and attribute value with ~ (one word within a whitespace-separated list of words) // type and attribute value with ~ (one word within a whitespace-separated list of words)
'/([\\w\\*]+)\\[(\\w+)[\\s]*\\~\\=[\\s]*[\'"]?([\\w-_\\/]+)[\'"]?\\]/' '/([\\w\\*]+)\\[(\\w+)[\\s]*\\~\\=[\\s]*[\'"]?([\\w\\-_\\/]+)[\'"]?\\]/'
=> '\\1[contains(concat(" ", @\\2, " "), concat(" ", "\\3", " "))]', => '\\1[contains(concat(" ", @\\2, " "), concat(" ", "\\3", " "))]',
// type and attribute value with | (either exact value match or prefix followed by a hyphen) // type and attribute value with | (either exact value match or prefix followed by a hyphen)
'/([\\w\\*]+)\\[(\\w+)[\\s]*\\|\\=[\\s]*[\'"]?([\\w-_\\s\\/]+)[\'"]?\\]/' '/([\\w\\*]+)\\[(\\w+)[\\s]*\\|\\=[\\s]*[\'"]?([\\w\\-_\\s\\/]+)[\'"]?\\]/'
=> '\\1[@\\2="\\3" or starts-with(@\\2, concat("\\3", "-"))]', => '\\1[@\\2="\\3" or starts-with(@\\2, concat("\\3", "-"))]',
// type and attribute value with ^ (prefix match) // type and attribute value with ^ (prefix match)
'/([\\w\\*]+)\\[(\\w+)[\\s]*\\^\\=[\\s]*[\'"]?([\\w-_\\/]+)[\'"]?\\]/' => '\\1[starts-with(@\\2, "\\3")]', '/([\\w\\*]+)\\[(\\w+)[\\s]*\\^\\=[\\s]*[\'"]?([\\w\\-_\\/]+)[\'"]?\\]/' => '\\1[starts-with(@\\2, "\\3")]',
// type and attribute value with * (substring match) // type and attribute value with * (substring match)
'/([\\w\\*]+)\\[(\\w+)[\\s]*\\*\\=[\\s]*[\'"]?([\\w-_\\s\\/:;]+)[\'"]?\\]/' => '\\1[contains(@\\2, "\\3")]', '/([\\w\\*]+)\\[(\\w+)[\\s]*\\*\\=[\\s]*[\'"]?([\\w\\-_\\s\\/:;]+)[\'"]?\\]/' => '\\1[contains(@\\2, "\\3")]',
// adjacent sibling // adjacent sibling
'/\\s+\\+\\s+/' => '/following-sibling::*[1]/self::', '/\\s+\\+\\s+/' => '/following-sibling::*[1]/self::',
// child // child
@ -185,7 +185,7 @@ class Emogrifier
// The following matcher will break things if it is placed before the adjacent matcher. // The following matcher will break things if it is placed before the adjacent matcher.
// So one of the matchers matches either too much or not enough. // So one of the matchers matches either too much or not enough.
// type and attribute value with $ (suffix match) // type and attribute value with $ (suffix match)
'/([\\w\\*]+)\\[(\\w+)[\\s]*\\$\\=[\\s]*[\'"]?([\\w-_\\s\\/]+)[\'"]?\\]/' '/([\\w\\*]+)\\[(\\w+)[\\s]*\\$\\=[\\s]*[\'"]?([\\w\\-_\\s\\/]+)[\'"]?\\]/'
=> '\\1[substring(@\\2, string-length(@\\2) - string-length("\\3") + 1) = "\\3"]', => '\\1[substring(@\\2, string-length(@\\2) - string-length("\\3") + 1) = "\\3"]',
]; ];

View File

@ -125,10 +125,8 @@ class WC_Log_Handler_DB extends WC_Log_Handler {
} }
$format = array_fill( 0, count( $log_ids ), '%d' ); $format = array_fill( 0, count( $log_ids ), '%d' );
$query_in = '(' . implode( ',', $format ) . ')'; $query_in = '(' . implode( ',', $format ) . ')';
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_log WHERE log_id IN {$query_in}", $log_ids ) ); // @codingStandardsIgnoreLine.
return $wpdb->query( "DELETE FROM {$wpdb->prefix}woocommerce_log WHERE log_id IN {$query_in}" ); // @codingStandardsIgnoreLine.
} }
/** /**
@ -168,7 +166,7 @@ class WC_Log_Handler_DB extends WC_Log_Handler {
* @see http://php.net/manual/en/function.debug-backtrace.php#refsect1-function.debug-backtrace-parameters * @see http://php.net/manual/en/function.debug-backtrace.php#refsect1-function.debug-backtrace-parameters
*/ */
if ( defined( 'DEBUG_BACKTRACE_IGNORE_ARGS' ) ) { if ( defined( 'DEBUG_BACKTRACE_IGNORE_ARGS' ) ) {
$debug_backtrace_arg = DEBUG_BACKTRACE_IGNORE_ARGS; // phpcs:ignore PHPCompatibility.PHP.NewConstants.debug_backtrace_ignore_argsFound $debug_backtrace_arg = DEBUG_BACKTRACE_IGNORE_ARGS; // phpcs:ignore PHPCompatibility.Constants.NewConstants.debug_backtrace_ignore_argsFound
} else { } else {
$debug_backtrace_arg = false; $debug_backtrace_arg = false;
} }

View File

@ -86,6 +86,7 @@ class WC_Shortcode_Checkout {
try { try {
$order_key = isset( $_GET['key'] ) ? wc_clean( wp_unslash( $_GET['key'] ) ) : ''; // WPCS: input var ok, CSRF ok. $order_key = isset( $_GET['key'] ) ? wc_clean( wp_unslash( $_GET['key'] ) ) : ''; // WPCS: input var ok, CSRF ok.
$order = wc_get_order( $order_id ); $order = wc_get_order( $order_id );
$hold_stock_minutes = (int) get_option( 'woocommerce_hold_stock_minutes', 0 );
// Order or payment link is invalid. // Order or payment link is invalid.
if ( ! $order || $order->get_id() !== $order_id || $order->get_order_key() !== $order_key ) { if ( ! $order || $order->get_id() !== $order_id || $order->get_order_key() !== $order_key ) {
@ -143,8 +144,13 @@ class WC_Shortcode_Checkout {
throw new Exception( sprintf( __( 'Sorry, "%s" is no longer in stock so this order cannot be paid for. We apologize for any inconvenience caused.', 'woocommerce' ), $product->get_name() ) ); throw new Exception( sprintf( __( 'Sorry, "%s" is no longer in stock so this order cannot be paid for. We apologize for any inconvenience caused.', 'woocommerce' ), $product->get_name() ) );
} }
// We only need to check products managing stock, with a limited stock qty.
if ( ! $product->managing_stock() || $product->backorders_allowed() ) {
continue;
}
// Check stock based on all items in the cart and consider any held stock within pending orders. // Check stock based on all items in the cart and consider any held stock within pending orders.
$held_stock = wc_get_held_stock_quantity( $product, $order->get_id() ); $held_stock = ( $hold_stock_minutes > 0 ) ? wc_get_held_stock_quantity( $product, $order->get_id() ) : 0;
$required_stock = $quantities[ $product->get_stock_managed_by_id() ]; $required_stock = $quantities[ $product->get_stock_managed_by_id() ];
if ( $product->get_stock_quantity() < ( $held_stock + $required_stock ) ) { if ( $product->get_stock_quantity() < ( $held_stock + $required_stock ) ) {

View File

@ -0,0 +1,127 @@
<?php
/**
* Twenty Nineteen support.
*
* @since 3.5.X
* @package WooCommerce/Classes
*/
defined( 'ABSPATH' ) || exit;
/**
* WC_Twenty_Nineteen class.
*/
class WC_Twenty_Nineteen {
/**
* Theme init.
*/
public static function init() {
// Change WooCommerce wrappers.
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ), 10 );
add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ), 10 );
// This theme doesn't have a traditional sidebar.
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
// Enqueue theme compatibility styles.
add_filter( 'woocommerce_enqueue_styles', array( __CLASS__, 'enqueue_styles' ) );
// Register theme features.
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
add_theme_support( 'woocommerce', array(
'thumbnail_image_width' => 300,
'single_image_width' => 450,
) );
// Tweak Twenty Nineteen features.
add_action( 'wp', array( __CLASS__, 'tweak_theme_features' ) );
// Color scheme CSS
add_filter( 'twentynineteen_custom_colors_css', array( __CLASS__, 'custom_colors_css' ), 10, 3 );
}
/**
* Open the Twenty Nineteen wrapper.
*/
public static function output_content_wrapper() {
echo '<section id="primary" class="content-area">';
echo '<main id="main" class="site-main">';
}
/**
* Close the Twenty Nineteen wrapper.
*/
public static function output_content_wrapper_end() {
echo '</main>';
echo '</section>';
}
/**
* Enqueue CSS for this theme.
*
* @param array $styles Array of registered styles.
* @return array
*/
public static function enqueue_styles( $styles ) {
unset( $styles['woocommerce-general'] );
$styles['woocommerce-general'] = array(
'src' => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/twenty-nineteen.css',
'deps' => '',
'version' => WC_VERSION,
'media' => 'all',
'has_rtl' => true,
);
return apply_filters( 'woocommerce_twenty_nineteen_styles', $styles );
}
/**
* Tweak Twenty Nineteen features.
*/
public static function tweak_theme_features() {
if ( is_woocommerce() ) {
add_filter( 'twentynineteen_can_show_post_thumbnail', '__return_false' );
}
}
/**
* Filters Twenty Nineteen custom colors CSS.
*
* @param string $css Base theme colors CSS.
* @param int $primary_color The user's selected color hue.
* @param string $saturation Filtered theme color saturation level.
*/
public static function custom_colors_css( $css, $primary_color, $saturation ) {
if ( function_exists( 'register_block_type' ) && is_admin() ) {
return $css;
}
$lightness = absint( apply_filters( 'twentynineteen_custom_colors_lightness', 33 ) );
$lightness = $lightness . '%';
$css .= '
.onsale,
.woocommerce-info,
.woocommerce-store-notice {
background-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' );
}
.woocommerce-tabs ul li.active a {
color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' );
box-shadow: 0 2px 0 hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' );
}
';
return $css;
}
}
WC_Twenty_Nineteen::init();

View File

@ -473,7 +473,8 @@ function get_woocommerce_currency_symbol( $currency = '' ) {
} }
$symbols = apply_filters( $symbols = apply_filters(
'woocommerce_currency_symbols', array( 'woocommerce_currency_symbols',
array(
'AED' => '&#x62f;.&#x625;', 'AED' => '&#x62f;.&#x625;',
'AFN' => '&#x60b;', 'AFN' => '&#x60b;',
'ALL' => 'L', 'ALL' => 'L',
@ -533,7 +534,7 @@ function get_woocommerce_currency_symbol( $currency = '' ) {
'GYD' => '&#36;', 'GYD' => '&#36;',
'HKD' => '&#36;', 'HKD' => '&#36;',
'HNL' => 'L', 'HNL' => 'L',
'HRK' => 'Kn', 'HRK' => 'kn',
'HTG' => 'G', 'HTG' => 'G',
'HUF' => '&#70;&#116;', 'HUF' => '&#70;&#116;',
'IDR' => 'Rp', 'IDR' => 'Rp',
@ -1079,7 +1080,8 @@ function wc_get_customer_default_location() {
$location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) ); $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) );
break; break;
default: default:
$location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', '' ) ); $countries = WC()->countries->get_allowed_countries();
$location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', 1 === count( $countries ) ? key( $countries ) : '' ) );
break; break;
} }
@ -1314,7 +1316,8 @@ function wc_get_credit_card_type_label( $type ) {
$type = str_replace( '_', ' ', $type ); $type = str_replace( '_', ' ', $type );
$labels = apply_filters( $labels = apply_filters(
'woocommerce_credit_card_type_labels', array( 'woocommerce_credit_card_type_labels',
array(
'mastercard' => __( 'MasterCard', 'woocommerce' ), 'mastercard' => __( 'MasterCard', 'woocommerce' ),
'visa' => __( 'Visa', 'woocommerce' ), 'visa' => __( 'Visa', 'woocommerce' ),
'discover' => __( 'Discover', 'woocommerce' ), 'discover' => __( 'Discover', 'woocommerce' ),
@ -1475,7 +1478,7 @@ function wc_get_shipping_method_count( $include_legacy = false ) {
* @param int $limit Time limit. * @param int $limit Time limit.
*/ */
function wc_set_time_limit( $limit = 0 ) { function wc_set_time_limit( $limit = 0 ) {
if ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { // phpcs:ignore PHPCompatibility.PHP.DeprecatedIniDirectives.safe_modeDeprecatedRemoved if ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
@set_time_limit( $limit ); // @codingStandardsIgnoreLine @set_time_limit( $limit ); // @codingStandardsIgnoreLine
} }
} }
@ -1835,7 +1838,8 @@ function wc_list_pluck( $list, $callback_or_field, $index_key = null ) {
function wc_get_permalink_structure() { function wc_get_permalink_structure() {
$saved_permalinks = (array) get_option( 'woocommerce_permalinks', array() ); $saved_permalinks = (array) get_option( 'woocommerce_permalinks', array() );
$permalinks = wp_parse_args( $permalinks = wp_parse_args(
array_filter( $saved_permalinks ), array( array_filter( $saved_permalinks ),
array(
'product_base' => _x( 'product', 'slug', 'woocommerce' ), 'product_base' => _x( 'product', 'slug', 'woocommerce' ),
'category_base' => _x( 'product-category', 'slug', 'woocommerce' ), 'category_base' => _x( 'product-category', 'slug', 'woocommerce' ),
'tag_base' => _x( 'product-tag', 'slug', 'woocommerce' ), 'tag_base' => _x( 'product-tag', 'slug', 'woocommerce' ),
@ -2112,7 +2116,7 @@ function wc_decimal_to_fraction( $decimal ) {
*/ */
function wc_round_discount( $value, $precision ) { function wc_round_discount( $value, $precision ) {
if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) { if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) {
return round( $value, $precision, WC_DISCOUNT_ROUNDING_MODE ); // phpcs:ignore PHPCompatibility.PHP.NewFunctionParameters.round_modeFound return round( $value, $precision, WC_DISCOUNT_ROUNDING_MODE ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctionParameters.round_modeFound
} }
if ( 2 === WC_DISCOUNT_ROUNDING_MODE ) { if ( 2 === WC_DISCOUNT_ROUNDING_MODE ) {

View File

@ -228,7 +228,7 @@ function wc_round_tax_total( $value, $precision = null ) {
$precision = is_null( $precision ) ? wc_get_price_decimals() : intval( $precision ); $precision = is_null( $precision ) ? wc_get_price_decimals() : intval( $precision );
if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) { if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) {
$rounded_tax = round( $value, $precision, wc_get_tax_rounding_mode() ); // phpcs:ignore PHPCompatibility.PHP.NewFunctionParameters.round_modeFound $rounded_tax = round( $value, $precision, wc_get_tax_rounding_mode() ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctionParameters.round_modeFound
} elseif ( 2 === wc_get_tax_rounding_mode() ) { } elseif ( 2 === wc_get_tax_rounding_mode() ) {
$rounded_tax = wc_legacy_round_half_down( $value, $precision ); $rounded_tax = wc_legacy_round_half_down( $value, $precision );
} else { } else {
@ -412,7 +412,8 @@ function wc_sanitize_textarea( $var ) {
function wc_sanitize_tooltip( $var ) { function wc_sanitize_tooltip( $var ) {
return htmlspecialchars( return htmlspecialchars(
wp_kses( wp_kses(
html_entity_decode( $var ), array( html_entity_decode( $var ),
array(
'br' => array(), 'br' => array(),
'em' => array(), 'em' => array(),
'strong' => array(), 'strong' => array(),
@ -541,8 +542,10 @@ function wc_get_price_decimals() {
*/ */
function wc_price( $price, $args = array() ) { function wc_price( $price, $args = array() ) {
$args = apply_filters( $args = apply_filters(
'wc_price_args', wp_parse_args( 'wc_price_args',
$args, array( wp_parse_args(
$args,
array(
'ex_tax_label' => false, 'ex_tax_label' => false,
'currency' => '', 'currency' => '',
'decimal_separator' => wc_get_price_decimal_separator(), 'decimal_separator' => wc_get_price_decimal_separator(),
@ -1032,7 +1035,8 @@ function wc_format_product_short_description( $content ) {
return wpautop( return wpautop(
$markdown->transform( $markdown->transform(
$content, array( $content,
array(
'unslash' => false, 'unslash' => false,
) )
) )
@ -1380,10 +1384,13 @@ function wc_parse_relative_date_option( $raw_value ) {
'years' => __( 'Year(s)', 'woocommerce' ), 'years' => __( 'Year(s)', 'woocommerce' ),
); );
$value = wp_parse_args( (array) $raw_value, array( $value = wp_parse_args(
(array) $raw_value,
array(
'number' => '', 'number' => '',
'unit' => 'days', 'unit' => 'days',
) ); )
);
$value['number'] = ! empty( $value['number'] ) ? absint( $value['number'] ) : ''; $value['number'] = ! empty( $value['number'] ) ? absint( $value['number'] ) : '';

View File

@ -247,6 +247,8 @@ function wc_increase_stock_levels( $order_id ) {
return; return;
} }
$changes = array();
// Loop over all items. // Loop over all items.
foreach ( $order->get_items() as $item ) { foreach ( $order->get_items() as $item ) {
if ( ! $item->is_type( 'line_item' ) ) { if ( ! $item->is_type( 'line_item' ) ) {

View File

@ -1588,6 +1588,7 @@ if ( ! function_exists( 'woocommerce_quantity_input' ) ) {
'step' => apply_filters( 'woocommerce_quantity_input_step', 1, $product ), 'step' => apply_filters( 'woocommerce_quantity_input_step', 1, $product ),
'pattern' => apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ), 'pattern' => apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ),
'inputmode' => apply_filters( 'woocommerce_quantity_input_inputmode', has_filter( 'woocommerce_stock_amount', 'intval' ) ? 'numeric' : '' ), 'inputmode' => apply_filters( 'woocommerce_quantity_input_inputmode', has_filter( 'woocommerce_stock_amount', 'intval' ) ? 'numeric' : '' ),
'product_name' => $product ? $product->get_title() : '',
); );
$args = apply_filters( 'woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ), $product ); $args = apply_filters( 'woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ), $product );

View File

@ -300,4 +300,5 @@ add_action( 'woocommerce_before_cart', 'woocommerce_output_all_notices', 10 );
add_action( 'woocommerce_before_checkout_form', 'woocommerce_output_all_notices', 10 ); add_action( 'woocommerce_before_checkout_form', 'woocommerce_output_all_notices', 10 );
add_action( 'woocommerce_account_content', 'woocommerce_output_all_notices', 10 ); add_action( 'woocommerce_account_content', 'woocommerce_output_all_notices', 10 );
add_action( 'woocommerce_before_customer_login_form', 'woocommerce_output_all_notices', 10 ); add_action( 'woocommerce_before_customer_login_form', 'woocommerce_output_all_notices', 10 );
add_action( 'woocommerce_before_lost_password_form', 'woocommerce_output_all_notices', 10 );
add_action( 'before_woocommerce_pay', 'woocommerce_output_all_notices', 10 ); add_action( 'before_woocommerce_pay', 'woocommerce_output_all_notices', 10 );

View File

@ -317,7 +317,8 @@ function wc_update_200_line_items() {
} }
$item_id = wc_add_order_item( $item_id = wc_add_order_item(
$order_tax_row->post_id, array( $order_tax_row->post_id,
array(
'order_item_name' => $order_tax['label'], 'order_item_name' => $order_tax['label'],
'order_item_type' => 'tax', 'order_item_type' => 'tax',
) )
@ -1087,7 +1088,8 @@ function wc_update_260_zone_methods() {
// Move data. // Move data.
foreach ( $old_methods as $old_method ) { foreach ( $old_methods as $old_method ) {
$wpdb->insert( $wpdb->insert(
$wpdb->prefix . 'woocommerce_shipping_zone_methods', array( $wpdb->prefix . 'woocommerce_shipping_zone_methods',
array(
'zone_id' => $old_method->zone_id, 'zone_id' => $old_method->zone_id,
'method_id' => $old_method->shipping_method_type, 'method_id' => $old_method->shipping_method_type,
'method_order' => $old_method->shipping_method_order, 'method_order' => $old_method->shipping_method_order,
@ -1422,7 +1424,8 @@ function wc_update_320_mexican_states() {
SET meta_value = %s SET meta_value = %s
WHERE meta_key IN ( '_billing_state', '_shipping_state' ) WHERE meta_key IN ( '_billing_state', '_shipping_state' )
AND meta_value = %s", AND meta_value = %s",
$new, $old $new,
$old
) )
); );
$wpdb->update( $wpdb->update(
@ -1511,11 +1514,13 @@ function wc_update_330_webhooks() {
'pending' => 'disabled', 'pending' => 'disabled',
); );
$posts = get_posts( array( $posts = get_posts(
array(
'posts_per_page' => -1, 'posts_per_page' => -1,
'post_type' => 'shop_webhook', 'post_type' => 'shop_webhook',
'post_status' => 'any', 'post_status' => 'any',
) ); )
);
foreach ( $posts as $post ) { foreach ( $posts as $post ) {
$webhook = new WC_Webhook(); $webhook = new WC_Webhook();
@ -1544,8 +1549,9 @@ function wc_update_330_set_default_product_cat() {
$default_category = get_option( 'default_product_cat', 0 ); $default_category = get_option( 'default_product_cat', 0 );
if ( $default_category ) { if ( $default_category ) {
$result = $wpdb->query( $wpdb->prepare( " $result = $wpdb->query(
INSERT INTO {$wpdb->term_relationships} (object_id, term_taxonomy_id) $wpdb->prepare(
"INSERT INTO {$wpdb->term_relationships} (object_id, term_taxonomy_id)
SELECT DISTINCT posts.ID, %s FROM {$wpdb->posts} posts SELECT DISTINCT posts.ID, %s FROM {$wpdb->posts} posts
LEFT JOIN LEFT JOIN
( (
@ -1555,8 +1561,10 @@ function wc_update_330_set_default_product_cat() {
) AS tax_query ) AS tax_query
ON posts.ID = tax_query.object_id ON posts.ID = tax_query.object_id
WHERE posts.post_type = 'product' WHERE posts.post_type = 'product'
AND tax_query.object_id IS NULL AND tax_query.object_id IS NULL",
", $default_category ) ); $default_category
)
);
wp_cache_flush(); wp_cache_flush();
delete_transient( 'wc_term_counts' ); delete_transient( 'wc_term_counts' );
wp_update_term_count_now( array( $default_category ), 'product_cat' ); wp_update_term_count_now( array( $default_category ), 'product_cat' );
@ -1576,16 +1584,19 @@ function wc_update_330_product_stock_status() {
$min_stock_amount = (int) get_option( 'woocommerce_notify_no_stock_amount', 0 ); $min_stock_amount = (int) get_option( 'woocommerce_notify_no_stock_amount', 0 );
// Get all products that have stock management enabled, stock less than or equal to min stock amount, and backorders enabled. // Get all products that have stock management enabled, stock less than or equal to min stock amount, and backorders enabled.
$post_ids = $wpdb->get_col( $wpdb->prepare( " $post_ids = $wpdb->get_col(
SELECT t1.post_id FROM $wpdb->postmeta t1 $wpdb->prepare(
"SELECT t1.post_id FROM $wpdb->postmeta t1
INNER JOIN $wpdb->postmeta t2 INNER JOIN $wpdb->postmeta t2
ON t1.post_id = t2.post_id ON t1.post_id = t2.post_id
AND t1.meta_key = '_manage_stock' AND t1.meta_value = 'yes' AND t1.meta_key = '_manage_stock' AND t1.meta_value = 'yes'
AND t2.meta_key = '_stock' AND t2.meta_value <= %d AND t2.meta_key = '_stock' AND t2.meta_value <= %d
INNER JOIN $wpdb->postmeta t3 INNER JOIN $wpdb->postmeta t3
ON t2.post_id = t3.post_id ON t2.post_id = t3.post_id
AND t3.meta_key = '_backorders' AND ( t3.meta_value = 'yes' OR t3.meta_value = 'notify' ) AND t3.meta_key = '_backorders' AND ( t3.meta_value = 'yes' OR t3.meta_value = 'notify' )",
", $min_stock_amount ) ); // WPCS: db call ok, unprepared SQL ok, cache ok. $min_stock_amount
)
); // WPCS: db call ok, unprepared SQL ok, cache ok.
if ( empty( $post_ids ) ) { if ( empty( $post_ids ) ) {
return; return;
@ -1594,11 +1605,11 @@ function wc_update_330_product_stock_status() {
$post_ids = array_map( 'absint', $post_ids ); $post_ids = array_map( 'absint', $post_ids );
// Set the status to onbackorder for those products. // Set the status to onbackorder for those products.
$wpdb->query( " $wpdb->query(
UPDATE $wpdb->postmeta "UPDATE $wpdb->postmeta
SET meta_value = 'onbackorder' SET meta_value = 'onbackorder'
WHERE meta_key = '_stock_status' AND post_id IN ( " . implode( ',', $post_ids ) . ' ) WHERE meta_key = '_stock_status' AND post_id IN ( " . implode( ',', $post_ids ) . ' )'
' ); // WPCS: db call ok, unprepared SQL ok, cache ok. ); // WPCS: db call ok, unprepared SQL ok, cache ok.
} }
/** /**
@ -1737,7 +1748,8 @@ function wc_update_340_state() {
SET meta_value = %s SET meta_value = %s
WHERE meta_key IN ( '_billing_state', '_shipping_state' ) WHERE meta_key IN ( '_billing_state', '_shipping_state' )
AND meta_value = %s", AND meta_value = %s",
$new, $old $new,
$old
) )
); );
$wpdb->update( $wpdb->update(
@ -1811,18 +1823,18 @@ function wc_update_340_db_version() {
function wc_update_343_cleanup_foreign_keys() { function wc_update_343_cleanup_foreign_keys() {
global $wpdb; global $wpdb;
$results = $wpdb->get_results( " $results = $wpdb->get_results(
SELECT CONSTRAINT_NAME "SELECT CONSTRAINT_NAME
FROM information_schema.TABLE_CONSTRAINTS FROM information_schema.TABLE_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA = '{$wpdb->dbname}' WHERE CONSTRAINT_SCHEMA = '{$wpdb->dbname}'
AND CONSTRAINT_NAME LIKE '%wc_download_log_ib%' AND CONSTRAINT_NAME LIKE '%wc_download_log_ib%'
AND CONSTRAINT_TYPE = 'FOREIGN KEY' AND CONSTRAINT_TYPE = 'FOREIGN KEY'
AND TABLE_NAME = '{$wpdb->prefix}wc_download_log' AND TABLE_NAME = '{$wpdb->prefix}wc_download_log'"
" ); );
if ( $results ) { if ( $results ) {
foreach ( $results as $fk ) { foreach ( $results as $fk ) {
$wpdb->query( "ALTER TABLE {$wpdb->prefix}wc_download_log DROP FOREIGN KEY {$fk->CONSTRAINT_NAME}" ); // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared $wpdb->query( "ALTER TABLE {$wpdb->prefix}wc_download_log DROP FOREIGN KEY {$fk->CONSTRAINT_NAME}" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
} }
} }
} }
@ -1872,3 +1884,25 @@ function wc_update_350_reviews_comment_type() {
function wc_update_350_db_version() { function wc_update_350_db_version() {
WC_Install::update_db_version( '3.5.0' ); WC_Install::update_db_version( '3.5.0' );
} }
/**
* Drop the fk_wc_download_log_permission_id FK as we use a new one with the table and blog prefix for MS compatability.
*
* @return void
*/
function wc_update_352_drop_download_log_fk() {
global $wpdb;
$results = $wpdb->get_results(
"SELECT CONSTRAINT_NAME
FROM information_schema.TABLE_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA = '{$wpdb->dbname}'
AND CONSTRAINT_NAME = 'fk_wc_download_log_permission_id'
AND CONSTRAINT_TYPE = 'FOREIGN KEY'
AND TABLE_NAME = '{$wpdb->prefix}wc_download_log'"
);
// We only need to drop the old key as WC_Install::create_tables() takes care of creating the new FK.
if ( $results ) {
$wpdb->query( "ALTER TABLE {$wpdb->prefix}wc_download_log DROP FOREIGN KEY fk_wc_download_log_permission_id" ); // phpcs:ignore WordPress.WP.PreparedSQL.NotPrepared
}
}

View File

@ -121,7 +121,14 @@ class WC_Widget_Rating_Filter extends WC_Widget {
$class = in_array( $rating, $rating_filter, true ) ? 'wc-layered-nav-rating chosen' : 'wc-layered-nav-rating'; $class = in_array( $rating, $rating_filter, true ) ? 'wc-layered-nav-rating chosen' : 'wc-layered-nav-rating';
$link = apply_filters( 'woocommerce_rating_filter_link', $link_ratings ? add_query_arg( 'rating_filter', $link_ratings ) : remove_query_arg( 'rating_filter' ) ); $link = apply_filters( 'woocommerce_rating_filter_link', $link_ratings ? add_query_arg( 'rating_filter', $link_ratings ) : remove_query_arg( 'rating_filter' ) );
$rating_html = wc_get_star_rating_html( $rating ); $rating_html = wc_get_star_rating_html( $rating );
$count_html = esc_html( apply_filters( 'woocommerce_rating_filter_count', "({$count})", $count, $rating ) ); $count_html = wp_kses(
apply_filters( 'woocommerce_rating_filter_count', "({$count})", $count, $rating ),
array(
'em' => array(),
'span' => array(),
'strong' => array(),
)
);
printf( '<li class="%s"><a href="%s"><span class="star-rating">%s</span> %s</a></li>', esc_attr( $class ), esc_url( $link ), $rating_html, $count_html ); // WPCS: XSS ok. printf( '<li class="%s"><a href="%s"><span class="star-rating">%s</span> %s</a></li>', esc_attr( $class ), esc_url( $link ), $rating_html, $count_html ); // WPCS: XSS ok.
} }

View File

@ -1,8 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<ruleset name="WordPress Coding Standards"> <ruleset name="WordPress Coding Standards">
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Core/ruleset.xml -->
<description>WooCommerce dev PHP_CodeSniffer ruleset.</description> <description>WooCommerce dev PHP_CodeSniffer ruleset.</description>
<!-- Exclude paths --> <!-- Exclude paths -->
@ -24,69 +21,30 @@
<!-- Rules --> <!-- Rules -->
<rule ref="WooCommerce-Core" /> <rule ref="WooCommerce-Core" />
<rule ref="PHPCompatibility">
<exclude name="PHPCompatibility.PHP.NewFunctions.hash_equalsFound" />
<exclude name="PHPCompatibility.PHP.NewInterfaces.jsonserializableFound" />
<exclude name="PHPCompatibility.PHP.NewKeywords.t_namespaceFound" />
<exclude-pattern>tests/</exclude-pattern>
</rule>
<rule ref="WordPress">
<exclude name="WordPress.VIP.DirectDatabaseQuery.NoCaching" />
<exclude name="WordPress.VIP.DirectDatabaseQuery.DirectQuery" />
<exclude name="WordPress.VIP.DirectDatabaseQuery.SchemaChange" />
<exclude name="WordPress.VIP.FileSystemWritesDisallow.file_ops_fwrite" />
<exclude name="WordPress.VIP.OrderByRand" />
<exclude name="WordPress.VIP.RestrictedFunctions" />
<exclude name="WordPress.VIP.RestrictedVariables.user_meta__wpdb__usermeta" />
<exclude name="WordPress.VIP.PostsPerPage.posts_per_page_posts_per_page" />
<exclude name="WordPress.VIP.RestrictedVariables.cache_constraints___COOKIE" />
<exclude name="WordPress.VIP.RestrictedVariables.cache_constraints___SERVER__REMOTE_ADDR__" />
</rule>
<rule ref="WordPress.VIP.ValidatedSanitizedInput">
<properties>
<property name="customSanitizingFunctions" type="array" value="wc_clean,wc_sanitize_tooltip,wc_format_decimal,wc_stock_amount,wc_sanitize_permalink,wc_sanitize_textarea" />
</properties>
</rule>
<rule ref="WordPress.XSS.EscapeOutput">
<properties>
<property name="customEscapingFunctions" type="array" value="wc_help_tip,wc_sanitize_tooltip,wc_selected,wc_kses_notice" />
</properties>
</rule>
<rule ref="WordPress.WP.I18n"> <rule ref="WordPress.WP.I18n">
<properties> <properties>
<property name="text_domain" type="array" value="woocommerce" /> <property name="text_domain" type="array" value="woocommerce" />
</properties> </properties>
</rule> </rule>
<rule ref="PHPCompatibility">
<exclude-pattern>tests/</exclude-pattern>
</rule>
<rule ref="WordPress.Files.FileName.InvalidClassFileName"> <rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>includes/**/abstract-*.php</exclude-pattern> <exclude-pattern>includes/**/abstract-*.php</exclude-pattern>
<exclude-pattern>tests/*</exclude-pattern> <exclude-pattern>tests/*</exclude-pattern>
</rule> </rule>
<rule ref="Generic.Commenting"> <rule ref="Generic.Commenting">
<exclude-pattern>tests/</exclude-pattern> <exclude-pattern>tests/</exclude-pattern>
</rule> </rule>
<rule ref="Squiz.Commenting">
<exclude-pattern>tests/</exclude-pattern>
<exclude name="Squiz.Commenting.LongConditionClosingComment" />
<exclude name="Squiz.Commenting.PostStatementComment" />
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine"> <rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
<exclude-pattern>tests/e2e-tests/</exclude-pattern> <exclude-pattern>tests/e2e-tests/</exclude-pattern>
</rule> </rule>
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude-pattern>i18n/</exclude-pattern>
</rule>
<!-- CLI commands require PHP >= 5.5 instead of 5.2 -->
<rule ref="PHPCompatibility.PHP.NewLanguageConstructs.t_ns_separatorFound">
<exclude-pattern>includes/cli/</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.PHP.NewFunctions.array_columnFound">
<exclude-pattern>includes/cli/</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.PHP.NewClosure.Found">
<exclude-pattern>includes/cli/</exclude-pattern>
</rule>
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase"> <rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude-pattern>i18n/</exclude-pattern> <exclude-pattern>i18n/</exclude-pattern>
</rule> </rule>

View File

@ -2,7 +2,7 @@
Contributors: automattic, mikejolley, jameskoster, claudiosanches, claudiulodro, kloon, rodrigosprimo, jshreve, coderkevin Contributors: automattic, mikejolley, jameskoster, claudiosanches, claudiulodro, kloon, rodrigosprimo, jshreve, coderkevin
Tags: ecommerce, e-commerce, store, sales, sell, shop, cart, checkout, downloadable, downloads, paypal, storefront, woo commerce Tags: ecommerce, e-commerce, store, sales, sell, shop, cart, checkout, downloadable, downloads, paypal, storefront, woo commerce
Requires at least: 4.7 Requires at least: 4.7
Tested up to: 4.9 Tested up to: 5.0
Stable tag: 3.5.0 Stable tag: 3.5.0
License: GPLv3 License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html License URI: https://www.gnu.org/licenses/gpl-3.0.html

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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/Auth * @package WooCommerce/Templates/Auth
* @version 2.4.0 * @version 2.4.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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/Auth * @package WooCommerce/Templates/Auth
* @version 2.4.0 * @version 2.4.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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/Auth * @package WooCommerce/Templates/Auth
* @version 2.4.0 * @version 2.4.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 2.4.0 * @version 2.4.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 2.3.6 * @version 2.3.6
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 3.0.0 * @version 3.0.0
*/ */

View File

@ -13,7 +13,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 3.5.0 * @version 3.5.0
*/ */

View File

@ -13,7 +13,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 2.4.0 * @version 2.4.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 3.0.9 * @version 3.0.9
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 3.0.9 * @version 3.0.9
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 3.2.0 * @version 3.2.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.3.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 3.2.0 * @version 3.2.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 2.6.1 * @version 2.6.1
*/ */

View File

@ -11,7 +11,7 @@
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.5.0 * @version 3.5.2
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -29,15 +29,15 @@ if ( ! is_a( $product, 'WC_Product' ) ) {
<?php do_action( 'woocommerce_widget_product_item_start', $args ); ?> <?php do_action( 'woocommerce_widget_product_item_start', $args ); ?>
<a href="<?php echo esc_url( $product->get_permalink() ); ?>"> <a href="<?php echo esc_url( $product->get_permalink() ); ?>">
<?php echo wp_kses_post( $product->get_image() ); ?> <?php echo $product->get_image(); ?>
<span class="product-title"><?php echo esc_html( $product->get_name() ); ?></span> <span class="product-title"><?php echo wp_kses_post( $product->get_name() ); ?></span>
</a> </a>
<?php if ( ! empty( $show_rating ) ) : ?> <?php if ( ! empty( $show_rating ) ) : ?>
<?php echo wp_kses_post( wc_get_rating_html( $product->get_average_rating() ) ); ?> <?php echo wp_kses_post( wc_get_rating_html( $product->get_average_rating() ) ); ?>
<?php endif; ?> <?php endif; ?>
<?php echo wp_kses_post( $product->get_price_html() ); ?> <?php echo $product->get_price_html(); ?>
<?php do_action( 'woocommerce_widget_product_item_end', $args ); ?> <?php do_action( 'woocommerce_widget_product_item_end', $args ); ?>
</li> </li>

View File

@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
*/ */
do_action( 'woocommerce_email_header', $email_heading, $email ); ?> do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php /* translators: %1$s: Customer full name. %2$s: Order numer */ ?> <?php /* translators: %1$s: Customer full name. %2$s: Order number */ ?>
<p><?php printf( esc_html__( 'Alas. Just to let you know &mdash; %1$s has cancelled order #%2$s:', 'woocommerce' ), esc_html( $order->get_formatted_billing_full_name() ), esc_html( $order->get_order_number() ) ); ?></p> <p><?php printf( esc_html__( 'Alas. Just to let you know &mdash; %1$s has cancelled order #%2$s:', 'woocommerce' ), esc_html( $order->get_formatted_billing_full_name() ), esc_html( $order->get_order_number() ) ); ?></p>
<?php <?php

View File

@ -12,7 +12,7 @@
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates/Emails * @package WooCommerce/Templates/Emails
* @version 3.5.0 * @version 3.5.2
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -23,10 +23,10 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php do_action( 'woocommerce_email_header', $email_heading, $email ); ?> <?php do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php /* translators: %s Customer first name */ ?> <?php /* translators: %s Customer username */ ?>
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $user_login ) ); ?></p> <p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $user_login ) ); ?></p>
<?php /* translators: %1$s: Site title, %2$s: Username, %3$s: My account link */ ?> <?php /* translators: %1$s: Site title, %2$s: Username, %3$s: My account link */ ?>
<p><?php printf( __( 'Thanks for creating an account on %1$s. As a reminder, the username you chose is %2$s. You can access your account area to view orders, change your password, and more at: %3$s', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_login ) . '</strong>', make_clickable( esc_url( wc_get_page_permalink( 'myaccount' ) ) ) ); ?></p><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?> <p><?php printf( __( 'Thanks for creating an account on %1$s. Your username is %2$s. You can access your account area to view orders, change your password, and more at: %3$s', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_login ) . '</strong>', make_clickable( esc_url( wc_get_page_permalink( 'myaccount' ) ) ) ); ?></p><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
<?php if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) : ?> <?php if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) : ?>
<?php /* translators: %s Auto generated password */ ?> <?php /* translators: %s Auto generated password */ ?>

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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/Emails * @package WooCommerce/Templates/Emails
* @version 3.2.1 * @version 3.2.1
*/ */

View File

@ -13,7 +13,6 @@
* the readme will list any important changes. * 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/Emails * @package WooCommerce/Templates/Emails
* @version 2.5.0 * @version 2.5.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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/Emails * @package WooCommerce/Templates/Emails
* @version 2.3.0 * @version 2.3.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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/Emails * @package WooCommerce/Templates/Emails
* @version 2.4.0 * @version 2.4.0
*/ */

View File

@ -34,7 +34,7 @@ if ( $order->has_status( 'pending' ) ) {
} else { } else {
/* translators: %s Order date */ /* translators: %s Order date */
echo sprintf( esc_html__( 'Here are the details of your order placed on %s:', 'woocommerce' ), esc_html( wc_format_datetime( $this->object->get_date_created() ) ) ) . "\n\n"; echo sprintf( esc_html__( 'Here are the details of your order placed on %s:', 'woocommerce' ), esc_html( wc_format_datetime( $order->get_date_created() ) ) ) . "\n\n";
} }
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";

View File

@ -12,7 +12,7 @@
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates/Emails/Plain * @package WooCommerce/Templates/Emails/Plain
* @version 3.5.0 * @version 3.5.2
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -24,7 +24,7 @@ echo '= ' . esc_html( $email_heading ) . " =\n\n";
/* translators: %s Customer first name */ /* translators: %s Customer first name */
echo sprintf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $user_login ) ) . "\n\n"; echo sprintf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $user_login ) ) . "\n\n";
/* translators: %1$s: Site title, %2$s: Username, %3$s: My account link */ /* translators: %1$s: Site title, %2$s: Username, %3$s: My account link */
echo sprintf( esc_html__( 'Thanks for creating an account on %1$s. As a reminder, the username you chose is %2$s. You can access your account area to view orders, change your password, and more at: %3$s', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_login ) . '</strong>', esc_html( wc_get_page_permalink( 'myaccount' ) ) ) . "\n\n"; echo sprintf( esc_html__( 'Thanks for creating an account on %1$s. Your username is %2$s. You can access your account area to view orders, change your password, and more at: %3$s', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_login ) . '</strong>', esc_html( wc_get_page_permalink( 'myaccount' ) ) ) . "\n\n";
if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) { if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) {
/* translators: %s Auto generated password */ /* translators: %s Auto generated password */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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/Emails/Plain * @package WooCommerce/Templates/Emails/Plain
* @version 3.2.0 * @version 3.2.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 2.3.0 * @version 2.3.0
* @see woocommerce_breadcrumb() * @see woocommerce_breadcrumb()

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.3.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 1.6.4 * @version 1.6.4
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.3.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.3.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.3.0
*/ */

View File

@ -11,7 +11,6 @@
* the readme will list any important changes. * 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 * @package WooCommerce/Templates
* @version 2.0.0 * @version 2.0.0
*/ */

Some files were not shown because too many files have changed in this diff Show More