Merge branch 'master' into locales

This commit is contained in:
Rodrigo Primo 2020-10-15 15:21:44 -03:00 committed by GitHub
commit 0656ad5e6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
505 changed files with 39524 additions and 12944 deletions

View File

@ -1,17 +1,14 @@
/** @format */
const baseConfig = require( '@woocommerce/e2e-environment' ).esLintConfig;
const { useE2EEsLintConfig } = require( '@woocommerce/e2e-environment' );
module.exports = {
...baseConfig,
module.exports = useE2EEsLintConfig( {
root: true,
env: {
...baseConfig.env,
browser: true,
es6: true,
node: true
},
globals: {
...baseConfig.globals,
wp: true,
wpApiSettings: true,
wcSettings: true,
@ -32,4 +29,4 @@ module.exports = {
jsx: true
}
},
};
} );

31
.gitattributes vendored
View File

@ -1,13 +1,20 @@
/.* export-ignore
bin export-ignore
# Set the default behavior, in case people don't have `core.autocrlf` set.
* text=auto
# Declare files that will always have LF line endings on checkout.
*.php text eol=lf
# Remove files for archives generated using `git archive`.
/.* export-ignore
bin export-ignore
CODE_OF_CONDUCT.md export-ignore
changelog.txt export-ignore
composer.* export-ignore
Gruntfile.js export-ignore
package.json export-ignore
package-lock.json export-ignore
phpcs.xml export-ignore
phpunit.* export-ignore
README.md export-ignore
tests export-ignore
renovate.json export-ignore
changelog.txt export-ignore
composer.* export-ignore
Gruntfile.js export-ignore
package.json export-ignore
package-lock.json export-ignore
phpcs.xml export-ignore
phpunit.* export-ignore
README.md export-ignore
renovate.json export-ignore
tests export-ignore

View File

@ -1,6 +1,6 @@
---
name: "\U0001F47D External issues"
about: Please report WooCommerce REST API, WooCommerce Admin or WooCommerce Gutenberg Products Blocks issues directly to their respective repositories.
about: Please report WooCommerce Admin, WooCommerce Gutenberg Products Blocks or Action Scheduler issues directly to their respective repositories.
title: ''
labels: ''
assignees: ''
@ -9,10 +9,12 @@ assignees: ''
Please report issues for the following features directly to their respective repositories.
WooCommerce REST API: https://github.com/woocommerce/woocommerce-rest-api
WooCommerce Admin: https://github.com/woocommerce/woocommerce-admin
WooCommerce Gutenberg Products Blocks: https://github.com/woocommerce/woocommerce-gutenberg-products-block
Action Scheduler: https://github.com/woocommerce/action-scheduler
WooCommerce REST API Docs: https://github.com/woocommerce/woocommerce-rest-api-docs
WooCommerce Code Reference: https://github.com/woocommerce/code-reference

View File

@ -11,9 +11,7 @@ jobs:
uses: actions/checkout@v2
- name: Build
id: build
uses: woocommerce/action-build@master
with:
generate-zip: true
uses: woocommerce/action-build@v2
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:

View File

@ -17,9 +17,7 @@ jobs:
ref: ${{ matrix.build }}
- name: Build
id: build
uses: woocommerce/action-build@master
with:
generate-zip: true
uses: woocommerce/action-build@v2
- name: Deploy nightly build
uses: WebFreak001/deploy-nightly@v1.0.3
env:

3
.gitignore vendored
View File

@ -45,6 +45,8 @@ tests/cli/vendor
/tests/bin/tmp
/tests/e2e/config/local-*.json
/tests/e2e/config/local.json
/tests/e2e/config/default.json
/tests/e2e/env/config/default.json
/tests/e2e/docker
/tests/e2e/env/docker/wp-cli/initialize.sh
/tests/e2e/env/build/
@ -57,6 +59,7 @@ tests/cli/vendor
# Composer
/vendor/
/bin/composer/**/vendor
contributors.md
contributors.html

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
v10

View File

@ -34,7 +34,6 @@ jobs:
env: WP_VERSION=latest WP_MULTISITE=0 RUN_E2E=1
script:
- npm run build:assets
- npm run build:packages
- npm install jest --global
- npm run docker:up
- npm run test:e2e
@ -43,15 +42,12 @@ jobs:
- name: "WP Nightly"
php: 7.4
env: WP_VERSION=nightly WP_MULTISITE=0
- name: "WP Latest"
php: 7.2
env: WP_VERSION=5.4 WP_MULTISITE=0
- name: "WP Latest - 1"
php: 7.2
env: WP_VERSION=5.3 WP_MULTISITE=0
env: WP_VERSION=5.4 WP_MULTISITE=0
- name: "WP Latest - 2"
php: 7.2
env: WP_VERSION=5.2 WP_MULTISITE=0
env: WP_VERSION=5.3 WP_MULTISITE=0
- name: "Code Standards"
php: 7.4
env: WP_VERSION=latest WP_MULTISITE=0 RUN_PHPCS=1
@ -71,9 +67,9 @@ install:
else
echo "xdebug.ini does not exist"
fi
- nvm install 10
- nvm install
- npm install
- composer install --no-dev
- composer install
- |
# Install WP Test suite, install PHPUnit globally:
if [[ ! -z "$WP_VERSION" ]]; then

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 KiB

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 KiB

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 KiB

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 KiB

After

Width:  |  Height:  |  Size: 303 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 KiB

After

Width:  |  Height:  |  Size: 279 KiB

38
SECURITY.md Normal file
View File

@ -0,0 +1,38 @@
# Security Policy
Full details of the Automattic Security Policy can be found on [automattic.com/security](https://automattic.com/security/).
## Supported Versions
Generally, *only the latest version of WooCommerce has continued support*. If a critical vulnerability is found in the current version of WooCommerce, we may opt to backport any patches to previous versions.
## Reporting a Vulnerability
[WooCommerce](https://wordpress.org/plugins/woocommerce) is an open-source plugin for WordPress. Our HackerOne program covers the plugin software, as well as a variety of related projects and infrastructure.
**For responsible disclosure of security issues and to be eligible for our bug bounty program, please submit your report based on instructions found on [automattic.com/security](https://automattic.com/security).**
Our most critical targets are:
* WooCommerce core (this repository)
* WooCommerce [Blocks](https://wordpress.org/plugins/woo-gutenberg-products-block/) and [Admin](https://wordpress.org/plugins/woocommerce-admin/) packages and plugins
* WooCommerce.com -- the primary marketplace and marketing site, and all of it subdomains, e.g. [developer.woocommerce.com](https://developer.woocommerce.com/)
* wordpress.com -- hosted WooCommerce for Business and eCommerce offering on WordPress.com.
For more targets, see the `In Scope` section on [HackerOne](https://hackerone.com/automattic).
_Please note that the **WordPress software is a separate entity** from Automattic. Please report vulnerabilities for WordPress through [the WordPress Foundation's HackerOne page](https://hackerone.com/wordpress)._
## Guidelines
We're committed to working with security researchers to resolve the vulnerabilities they discover. You can help us by following these guidelines:
* Follow [HackerOne's disclosure guidelines](https://www.hackerone.com/disclosure-guidelines).
* Pen-testing Production:
* Please **setup a local environment** instead whenever possible. Most of our code is open source (see above).
* If that's not possible, **limit any data access/modification** to the bare minimum necessary to reproduce a PoC.
* **_Don't_ automate form submissions!** That's very annoying for us, because it adds extra work for the volunteers who manage those systems, and reduces the signal/noise ratio in our communication channels.
* To be eligible for a bounty, please follow all of these guidelines.
* Be Patient - Give us a reasonable time to correct the issue before you disclose the vulnerability.
We also expect you to comply with all applicable laws. You're responsible to pay any taxes associated with your bounties.

View File

@ -5067,6 +5067,7 @@ img.help_tip {
.handlediv {
width: 27px;
float: right;
&::before {
content: "\f142" !important;

View File

@ -255,3 +255,18 @@ ul.woocommerce_stats {
font-family: "WooCommerce";
content: "\e01d";
}
#dashboard_activity {
#activity-widget {
#the-comment-list {
.review.comment-item {
.avatar {
margin-right: 12px;
position: relative;
top: 0;
float: left;
}
}
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

12
assets/css/photoswipe/photoswipe.css Executable file → Normal file
View File

@ -56,6 +56,18 @@ button.pswp__button--zoom:hover {
.pswp img {
max-width: none; }
/* adjust for admin bar */
.admin-bar .pswp {
height: calc(100% - 32px);
top: 32px;
}
@media screen and (max-width: 782px) {
.admin-bar .pswp {
height: calc(100% - 46px);
top: 46px;
}
}
/* style is added when JS option showHideOpacity is set to true */
.pswp--animate_opacity {
/* 0.001, because opacity:0 doesn't trigger Paint action, which causes lag at start of transition */

View File

@ -188,15 +188,24 @@ a.button {
.woocommerce-info {
margin-bottom: 5rem;
margin-left: 0;
padding: 1.5rem 3rem;
background: #eee;
font-size: 0.88889em;
font-family: $headings;
list-style: none;
overflow: hidden;
}
.woocommerce-message,
.woocommerce-error li,
.woocommerce-info {
padding: 1.5rem 3rem;
display: flex;
justify-content: space-between;
align-items: center;
.button {
order: 2;
}
}
.woocommerce-message {
@ -219,6 +228,10 @@ a.button {
background: #111;
}
}
> li {
margin: 0;
}
}
#site-content {
@ -1628,7 +1641,6 @@ a.reset_variations {
.woocommerce-checkout {
ul.woocommerce-error {
margin-left: 0;
flex-direction: column;
align-items: flex-start;

View File

@ -1,4 +1,6 @@
/* stylelint-disable no-descending-specificity */
/* @deprecated 4.6.0 */
body {
margin: 65px auto 24px;
box-shadow: none;

View File

@ -1315,6 +1315,7 @@ jQuery( function ( $ ) {
};
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
$( 'ul.order_notes .no-items' ).remove();
$( 'ul.order_notes' ).prepend( response );
$( '#woocommerce-order-notes' ).unblock();
$( '#add_order_note' ).val( '' );

View File

@ -1,6 +1,7 @@
/*global wc_setup_params */
/*global wc_setup_currencies */
/*global wc_base_state */
/* @deprecated 4.6.0 */
jQuery( function( $ ) {
function blockWizardUI() {
$('.wc-setup-content').block({

View File

@ -173,7 +173,7 @@ jQuery( function( $ ) {
// View cart text.
if ( fragments && ! wc_add_to_cart_params.is_cart && $button.parent().find( '.added_to_cart' ).length === 0 ) {
$button.after( ' <a href="' + wc_add_to_cart_params.cart_url + '" class="added_to_cart wc-forward" title="' +
$button.after( '<a href="' + wc_add_to_cart_params.cart_url + '" class="added_to_cart wc-forward" title="' +
wc_add_to_cart_params.i18n_view_cart + '">' + wc_add_to_cart_params.i18n_view_cart + '</a>' );
}

View File

@ -1,4 +1,4 @@
const e2eBabelConfig = require( '@woocommerce/e2e-environment' ).babelConfig;
const { e2eBabelConfig } = require( '@woocommerce/e2e-environment' );
module.exports = function( api ) {
api.cache( true );

View File

@ -0,0 +1,10 @@
{
"require-dev": {
"woocommerce/woocommerce-sniffs": "^0.1.0"
},
"config": {
"platform": {
"php": "7.1"
}
}
}

384
bin/composer/phpcs/composer.lock generated Normal file
View File

@ -0,0 +1,384 @@
{
"_readme": [
"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#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ee5c0c106a076ca3b426771807c3ffeb",
"packages": [],
"packages-dev": [
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v0.7.0",
"source": {
"type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
"reference": "e8d808670b8f882188368faaf1144448c169c0b7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e8d808670b8f882188368faaf1144448c169c0b7",
"reference": "e8d808670b8f882188368faaf1144448c169c0b7",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2 || ^3 || 4.0.x-dev"
},
"require-dev": {
"composer/composer": "*",
"phpcompatibility/php-compatibility": "^9.0",
"sensiolabs/security-checker": "^4.1.0"
},
"type": "composer-plugin",
"extra": {
"class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
},
"autoload": {
"psr-4": {
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Franck Nijhof",
"email": "franck.nijhof@dealerdirect.com",
"homepage": "http://www.frenck.nl",
"role": "Developer / IT Manager"
}
],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
"homepage": "http://www.dealerdirect.com",
"keywords": [
"PHPCodeSniffer",
"PHP_CodeSniffer",
"code quality",
"codesniffer",
"composer",
"installer",
"phpcs",
"plugin",
"qa",
"quality",
"standard",
"standards",
"style guide",
"stylecheck",
"tests"
],
"time": "2020-06-25T14:57:39+00:00"
},
{
"name": "phpcompatibility/php-compatibility",
"version": "9.3.5",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
"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.5 || 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": "Wim Godden",
"homepage": "https://github.com/wimg",
"role": "lead"
},
{
"name": "Juliette Reinders Folmer",
"homepage": "https://github.com/jrfnl",
"role": "lead"
},
{
"name": "Contributors",
"homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
}
],
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
"keywords": [
"compatibility",
"phpcs",
"standards"
],
"time": "2019-12-27T09:44:58+00:00"
},
{
"name": "phpcompatibility/phpcompatibility-paragonie",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
"reference": "b862bc32f7e860d0b164b199bd995e690b4b191c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/b862bc32f7e860d0b164b199bd995e690b4b191c",
"reference": "b862bc32f7e860d0b164b199bd995e690b4b191c",
"shasum": ""
},
"require": {
"phpcompatibility/php-compatibility": "^9.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5",
"paragonie/random_compat": "dev-master",
"paragonie/sodium_compat": "dev-master"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
},
"type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "Wim Godden",
"role": "lead"
},
{
"name": "Juliette Reinders Folmer",
"role": "lead"
}
],
"description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
"homepage": "http://phpcompatibility.com/",
"keywords": [
"compatibility",
"paragonie",
"phpcs",
"polyfill",
"standards"
],
"time": "2019-11-04T15:17:54+00:00"
},
{
"name": "phpcompatibility/phpcompatibility-wp",
"version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
"reference": "41bef18ba688af638b7310666db28e1ea9158b2f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/41bef18ba688af638b7310666db28e1ea9158b2f",
"reference": "41bef18ba688af638b7310666db28e1ea9158b2f",
"shasum": ""
},
"require": {
"phpcompatibility/php-compatibility": "^9.0",
"phpcompatibility/phpcompatibility-paragonie": "^1.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
},
"type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "Wim Godden",
"role": "lead"
},
{
"name": "Juliette Reinders Folmer",
"role": "lead"
}
],
"description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
"homepage": "http://phpcompatibility.com/",
"keywords": [
"compatibility",
"phpcs",
"standards",
"wordpress"
],
"time": "2019-08-28T14:22:28+00:00"
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.5.6",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "e97627871a7eab2f70e59166072a6b767d5834e0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0",
"reference": "e97627871a7eab2f70e59166072a6b767d5834e0",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"bin": [
"bin/phpcs",
"bin/phpcbf"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
"keywords": [
"phpcs",
"standards"
],
"time": "2020-08-10T04:50:15+00:00"
},
{
"name": "woocommerce/woocommerce-sniffs",
"version": "0.1.0",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-sniffs.git",
"reference": "b72b7dd2e70aa6aed16f80cdae5b1e6cce2e4c79"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/b72b7dd2e70aa6aed16f80cdae5b1e6cce2e4c79",
"reference": "b72b7dd2e70aa6aed16f80cdae5b1e6cce2e4c79",
"shasum": ""
},
"require": {
"dealerdirect/phpcodesniffer-composer-installer": "0.7.0",
"php": ">=7.0",
"phpcompatibility/phpcompatibility-wp": "2.1.0",
"wp-coding-standards/wpcs": "2.3.0"
},
"type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Claudio Sanches",
"email": "claudio@automattic.com"
}
],
"description": "WooCommerce sniffs",
"keywords": [
"phpcs",
"standards",
"woocommerce",
"wordpress"
],
"time": "2020-08-06T18:23:45+00:00"
},
{
"name": "wp-coding-standards/wpcs",
"version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
"reference": "7da1894633f168fe244afc6de00d141f27517b62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62",
"reference": "7da1894633f168fe244afc6de00d141f27517b62",
"shasum": ""
},
"require": {
"php": ">=5.4",
"squizlabs/php_codesniffer": "^3.3.1"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6",
"phpcompatibility/php-compatibility": "^9.0",
"phpcsstandards/phpcsdevtools": "^1.0",
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
},
"type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Contributors",
"homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors"
}
],
"description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
"keywords": [
"phpcs",
"standards",
"wordpress"
],
"time": "2020-05-13T23:57:56+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"platform-overrides": {
"php": "7.1"
}
}

View File

@ -0,0 +1,12 @@
{
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"phpunit/phpunit": "7.5.20"
},
"config": {
"platform": {
"php": "7.1"
}
}
}

1492
bin/composer/phpunit/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
{
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"wp-cli/i18n-command": "^2.2"
},
"config": {
"platform": {
"php": "7.1"
}
}
}

550
bin/composer/wp/composer.lock generated Normal file
View File

@ -0,0 +1,550 @@
{
"_readme": [
"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#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f89bceee93cc1d38e71a45e4cbf4f4aa",
"packages": [],
"packages-dev": [
{
"name": "gettext/gettext",
"version": "v4.8.2",
"source": {
"type": "git",
"url": "https://github.com/php-gettext/Gettext.git",
"reference": "e474f872f2c8636cf53fd283ec4ce1218f3d236a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-gettext/Gettext/zipball/e474f872f2c8636cf53fd283ec4ce1218f3d236a",
"reference": "e474f872f2c8636cf53fd283ec4ce1218f3d236a",
"shasum": ""
},
"require": {
"gettext/languages": "^2.3",
"php": ">=5.4.0"
},
"require-dev": {
"illuminate/view": "*",
"phpunit/phpunit": "^4.8|^5.7|^6.5",
"squizlabs/php_codesniffer": "^3.0",
"symfony/yaml": "~2",
"twig/extensions": "*",
"twig/twig": "^1.31|^2.0"
},
"suggest": {
"illuminate/view": "Is necessary if you want to use the Blade extractor",
"symfony/yaml": "Is necessary if you want to use the Yaml extractor/generator",
"twig/extensions": "Is necessary if you want to use the Twig extractor",
"twig/twig": "Is necessary if you want to use the Twig extractor"
},
"type": "library",
"autoload": {
"psr-4": {
"Gettext\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Oscar Otero",
"email": "oom@oscarotero.com",
"homepage": "http://oscarotero.com",
"role": "Developer"
}
],
"description": "PHP gettext manager",
"homepage": "https://github.com/oscarotero/Gettext",
"keywords": [
"JS",
"gettext",
"i18n",
"mo",
"po",
"translation"
],
"time": "2019-12-02T10:21:14+00:00"
},
{
"name": "gettext/languages",
"version": "2.6.0",
"source": {
"type": "git",
"url": "https://github.com/php-gettext/Languages.git",
"reference": "38ea0482f649e0802e475f0ed19fa993bcb7a618"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-gettext/Languages/zipball/38ea0482f649e0802e475f0ed19fa993bcb7a618",
"reference": "38ea0482f649e0802e475f0ed19fa993bcb7a618",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16.0",
"phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5 || ^8.4"
},
"bin": [
"bin/export-plural-rules"
],
"type": "library",
"autoload": {
"psr-4": {
"Gettext\\Languages\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michele Locati",
"email": "mlocati@gmail.com",
"role": "Developer"
}
],
"description": "gettext languages with plural rules",
"homepage": "https://github.com/php-gettext/Languages",
"keywords": [
"cldr",
"i18n",
"internationalization",
"l10n",
"language",
"languages",
"localization",
"php",
"plural",
"plural rules",
"plurals",
"translate",
"translations",
"unicode"
],
"time": "2019-11-13T10:30:21+00:00"
},
{
"name": "mck89/peast",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/mck89/peast.git",
"reference": "2a2bc6826114c46ff0bc1359208b7083a17f7a99"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mck89/peast/zipball/2a2bc6826114c46ff0bc1359208b7083a17f7a99",
"reference": "2a2bc6826114c46ff0bc1359208b7083a17f7a99",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.11.0-dev"
}
},
"autoload": {
"psr-4": {
"Peast\\": "lib/Peast/",
"Peast\\test\\": "test/Peast/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Marchiò",
"email": "marco.mm89@gmail.com"
}
],
"description": "Peast is PHP library that generates AST for JavaScript code",
"time": "2020-10-09T15:12:13+00:00"
},
{
"name": "mustache/mustache",
"version": "v2.13.0",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/mustache.php.git",
"reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/e95c5a008c23d3151d59ea72484d4f72049ab7f4",
"reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4",
"shasum": ""
},
"require": {
"php": ">=5.2.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~1.11",
"phpunit/phpunit": "~3.7|~4.0|~5.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Mustache": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Justin Hileman",
"email": "justin@justinhileman.info",
"homepage": "http://justinhileman.com"
}
],
"description": "A Mustache implementation in PHP.",
"homepage": "https://github.com/bobthecow/mustache.php",
"keywords": [
"mustache",
"templating"
],
"time": "2019-11-23T21:40:31+00:00"
},
{
"name": "rmccue/requests",
"version": "v1.7.0",
"source": {
"type": "git",
"url": "https://github.com/rmccue/Requests.git",
"reference": "87932f52ffad70504d93f04f15690cf16a089546"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rmccue/Requests/zipball/87932f52ffad70504d93f04f15690cf16a089546",
"reference": "87932f52ffad70504d93f04f15690cf16a089546",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"require-dev": {
"requests/test-server": "dev-master"
},
"type": "library",
"autoload": {
"psr-0": {
"Requests": "library/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"ISC"
],
"authors": [
{
"name": "Ryan McCue",
"homepage": "http://ryanmccue.info"
}
],
"description": "A HTTP library written in PHP, for human beings.",
"homepage": "http://github.com/rmccue/Requests",
"keywords": [
"curl",
"fsockopen",
"http",
"idna",
"ipv6",
"iri",
"sockets"
],
"time": "2016-10-13T00:11:37+00:00"
},
{
"name": "symfony/finder",
"version": "v3.4.45",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "52140652ed31cee3dabd0c481b5577201fa769b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/52140652ed31cee3dabd0c481b5577201fa769b4",
"reference": "52140652ed31cee3dabd0c481b5577201fa769b4",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2020-09-02T16:06:40+00:00"
},
{
"name": "wp-cli/i18n-command",
"version": "v2.2.5",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/i18n-command.git",
"reference": "b02ecdc9a57f9633740c254d19749118b7411f0f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/b02ecdc9a57f9633740c254d19749118b7411f0f",
"reference": "b02ecdc9a57f9633740c254d19749118b7411f0f",
"shasum": ""
},
"require": {
"gettext/gettext": "^4.8",
"mck89/peast": "^1.8",
"wp-cli/wp-cli": "^2"
},
"require-dev": {
"wp-cli/scaffold-command": "^1.2 || ^2",
"wp-cli/wp-cli-tests": "^2.1.3"
},
"type": "wp-cli-package",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
},
"bundled": true,
"commands": [
"i18n",
"i18n make-pot",
"i18n make-json"
]
},
"autoload": {
"psr-4": {
"WP_CLI\\I18n\\": "src/"
},
"files": [
"i18n-command.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Pascal Birchler",
"homepage": "https://pascalbirchler.com/"
}
],
"description": "Provides internationalization tools for WordPress projects.",
"homepage": "https://github.com/wp-cli/i18n-command",
"time": "2020-07-08T15:20:38+00:00"
},
{
"name": "wp-cli/mustangostang-spyc",
"version": "0.6.3",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/spyc.git",
"reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wp-cli/spyc/zipball/6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7",
"reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7",
"shasum": ""
},
"require": {
"php": ">=5.3.1"
},
"require-dev": {
"phpunit/phpunit": "4.3.*@dev"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.5.x-dev"
}
},
"autoload": {
"psr-4": {
"Mustangostang\\": "src/"
},
"files": [
"includes/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "mustangostang",
"email": "vlad.andersen@gmail.com"
}
],
"description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)",
"homepage": "https://github.com/mustangostang/spyc/",
"time": "2017-04-25T11:26:20+00:00"
},
{
"name": "wp-cli/php-cli-tools",
"version": "v0.11.11",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/php-cli-tools.git",
"reference": "fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f",
"reference": "fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f",
"shasum": ""
},
"require": {
"php": ">= 5.3.0"
},
"type": "library",
"autoload": {
"psr-0": {
"cli": "lib/"
},
"files": [
"lib/cli/cli.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "James Logsdon",
"email": "jlogsdon@php.net",
"role": "Developer"
},
{
"name": "Daniel Bachhuber",
"email": "daniel@handbuilt.co",
"role": "Maintainer"
}
],
"description": "Console utilities for PHP",
"homepage": "http://github.com/wp-cli/php-cli-tools",
"keywords": [
"cli",
"console"
],
"time": "2018-09-04T13:28:00+00:00"
},
{
"name": "wp-cli/wp-cli",
"version": "v2.4.1",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/wp-cli.git",
"reference": "ceb18598e79befa9b2a37a51efbb34910628988b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/ceb18598e79befa9b2a37a51efbb34910628988b",
"reference": "ceb18598e79befa9b2a37a51efbb34910628988b",
"shasum": ""
},
"require": {
"ext-curl": "*",
"mustache/mustache": "~2.13",
"php": "^5.4 || ^7.0",
"rmccue/requests": "~1.6",
"symfony/finder": ">2.7",
"wp-cli/mustangostang-spyc": "^0.6.3",
"wp-cli/php-cli-tools": "~0.11.2"
},
"require-dev": {
"roave/security-advisories": "dev-master",
"wp-cli/db-command": "^1.3 || ^2",
"wp-cli/entity-command": "^1.2 || ^2",
"wp-cli/extension-command": "^1.1 || ^2",
"wp-cli/package-command": "^1 || ^2",
"wp-cli/wp-cli-tests": "^2.1"
},
"suggest": {
"ext-readline": "Include for a better --prompt implementation",
"ext-zip": "Needed to support extraction of ZIP archives when doing downloads or updates"
},
"bin": [
"bin/wp",
"bin/wp.bat"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4.x-dev"
}
},
"autoload": {
"psr-0": {
"WP_CLI": "php"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "WP-CLI framework",
"homepage": "https://wp-cli.org",
"keywords": [
"cli",
"wordpress"
],
"time": "2020-02-18T08:15:37+00:00"
}
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"platform-overrides": {
"php": "7.1"
}
}

View File

@ -3,7 +3,7 @@
read -p 'What date (YYYY-MM-DD) should we get contributions since? (i.e. date of previous release): ' from_date
read -sp 'Provide a personal access token (you must): ' auth_token
ignored_users="renovate-bot,apps/renovate,renovate,renovate[bot]"
ignored_users="renovate-bot,apps/renovate,renovate,renovate[bot],github-actions[bot]"
output_file="contributors.html"
common_arguments="--owner woocommerce --fromDate $from_date --authToken $auth_token --cols 6 --sortBy contributions --format html --sortOrder desc --showlogin true --filter $ignored_users"
@ -25,8 +25,4 @@ echo "<h2>Action Scheduler</h2>" >> $output_file
echo "Generating contributor list for Action Scheduler since $from_date"
./node_modules/.bin/githubcontrib --repo action-scheduler $common_arguments >> $output_file
echo "<h2>REST API</h2>" >> $output_file
echo "Generating contributor list for REST API since $from_date"
./node_modules/.bin/githubcontrib --repo woocommerce-rest-api $common_arguments >> $output_file
echo "Output generated to $output_file."

View File

@ -3,7 +3,10 @@
changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
runOnChange() {
echo "$changedFiles" | grep -q "$1" && eval "$2"
if echo "$changedFiles" | grep -q "$1"
then
eval "$2"
fi
}
runOnChange "package-lock.json" "npm install"

View File

@ -4,8 +4,8 @@ PROTECTED_BRANCH="master"
REMOTE_REF=$(echo "$HUSKY_GIT_STDIN" | cut -d " " -f 3)
if [ -n "$REMOTE_REF" ]; then
if [ "refs/heads/${PROTECTED_BRANCH}" == "$REMOTE_REF" ]; then
if [ "$TERM" == "dumb" ]; then
if [ "refs/heads/${PROTECTED_BRANCH}" = "$REMOTE_REF" ]; then
if [ "$TERM" = "dumb" ]; then
>&2 echo "Sorry, you are unable to push to master using a GUI client! Please use git CLI."
exit 1
fi

29
bin/prefix-vendor-namespaces.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
# Output colorized strings
#
# Color codes:
# 0 - black
# 1 - red
# 2 - green
# 3 - yellow
# 4 - blue
# 5 - magenta
# 6 - cian
# 7 - white
output() {
echo "$(tput setaf "$1")$2$(tput sgr0)"
}
output 6 "Prefixing the appropriate vendor namespaces with Automattic\WooCommerce\Vendor"
# Replace "League\Container" in "use" and "namespace" with "Automattic\WooCommerce\Vendor\League\Container".
REGEX='s/^[[:space:]]*(use|namespace)[[:space:]]*(League\\Container)/\1 Automattic\\WooCommerce\\Vendor\\\2/g'
find ./vendor/league/container -iname '*.php' -exec sed -i '.bak' -E -e "$REGEX" {} \;
find ./vendor/league/container -name "*.php.bak" -type f -delete
# Replace too in the composer.json file for the package.
sed -i '.bak' -E -e "s/\"(League\\\\\\\Container)/\"Automattic\\\\\\\WooCommerce\\\\\\\Vendor\\\\\\\\\1/g" vendor/league/container/composer.json
rm -f vendor/league/container/composer.json.bak

View File

@ -1,11 +1,122 @@
== Changelog ==
= 4.6.0 - 2020-10-14 =
**WooCommerce**
* Tweak - Removed the "Features" settings page now that the WooCommerce Admin dashboard is enabled by default. #27047
* Tweak - Deprecate old setup wizard. #26853
* Tweak - Add WC pages when the plugin is activated now that the old setup wizard was deprecated. #26853
* Fix - When adding a grouped product to the cart, quantity is passed through the `woocommerce_stock_amount` filter like it's done for simple and variable products. #27219
* Fix - Several style improvements to notices in theme Twenty Twenty. #27387
* Fix - Fixed countries list sorting and added support to PHP internationalization functions. #27416
* Fix - Remove "There are no notes yet" after adding the first one by AJAX. #27449
* Fix - Fix PHP docblock summary to properly reflect the role of `wc_get_coupon_id_by_code` function. #27453
* Fix - Fix white space character in add-to-cart script. #27459
* Fix - Adding missing css property to email templates to ensure header background color is less likely to be overridden by email client. #27525
* Fix - Encapsulate scope of `c` variable to avoid polluting the global scope and potentially causing problems if other plugins use the same variable name. #27610
* Fix - Fix bug when using tax classes with some non-ASCII characters. #27615
* Fix - Paypal gateway: protect code against a fatal error if WooCommerce is unable to communicate with PayPal. #27616
* Fix - Added WP environment type to tracker. #27685
* Fix - Prevent fatal errors when trying to determine what is the product type taxonomy term. #27441
* Fix - Typo in the error message shown in the customizer. #27008
* Dev - Introduced `woocommerce_return_to_shop_text` filter. #25419
* Dev - Introduced `woocommerce_cart_item_required_stock_is_not_enough` filter. #26196
* Dev - Changed relative `include` paths to absolute `include` paths using `__DIR__`. #27433
* Dev - Fixed duplicated use of `woocommerce_add_$notice_type`. #27437
* Dev - Allow public access to core capabilities for other plugins. #26976
* Dev - Add `woocommerce_should_send_no_stock_notification` filter. #27634
* Dev - New action 'woocommerce_after_order_details' added in a order-details.php template. #26327
* Dev - Fix and improve documentation of wc_string_to_bool and wc_bool_to_string. #27662
* Localization - Remove duplicated entry for Cyprus when listing countries by continent. #27636
* Localization - Add Egypt regions. #27495
* Localization - Updated name for the Hungarian county called Csongrád-Csanád. #27075
* Localization - Adding states for Benin country. #27217
* Localization - Add KR locale info. #27496
* Localization - Fixed the name of the Spain state of `Biscay`. #27548
**WooCommerce Admin - 1.6.1**
- Dev: Reviews wp.data store #4941
- Dev: Notes wp.data store #4943
- Dev: Add woocommerce_analytics_update_order_stats_data filter #4934
- Dev: Remove unused lib/date #4987
- Dev: Exports wp.data store #4958
- Dev: Remove _experimentalResolveSelect usage #4949
- Dev: Items wp.data store #5009
- Dev: Import wp.data store #4982
- Dev: Remove `fresh-data` wc-api dependency #5075
- Dev: Add initial e2e test suite #5028
- Dev: Combine translation chunks when languages updated #5094
- Dev: Add filters for columns in reports #5134
- Dev: Don't include "min" suffix in build JS files for core build #5130
- Dev: Store Profiler - Industry step: reduced padding and removed industry #5157
- Dev: Remove product settings video note #5213
- Enhancement: Add free local shipping zone on profile complete #4857
- Enhancement: Add woocommerce/tracks pacakage #5107
- Enhancement: Add filter to allow modification of report columns #4984
- Enhancement: Add WooCommerce Mobile Banner #5037
- Enhancement: Add Product Attribute advanced filter #5038
- Enhancement: Add support for advanced filters with multiple instances #5050
- Enhancement: Automated taxes smart default #5076
- Enhancement: Add product attribute filter to Orders report #5068
- Tweak: Remove payment task actions #4917
- Tweak: Don't import from React, use @wordpress/element #4978
- Tweak: Use filtered headers array in onColumnsChange callback #4964
- Tweak: Orders panel get selectors form wc-api #4997
- Tweak: Group tasks by completion in setup checklist #5001
- Tweak: Replace useFilters with WP withFilters #4962
- Tweak: Refactor header component to function #5023
- Tweak: Refactor task list status to onboarding data store #4998
- Tweak: Add monthly pricing toggle in OBW #5015
- Tweak: OBW style updates #5059
- Tweak: Remove chevron icons from Fish Setup task list #5114
- Tweak: Add option to not charge sales tax in setup checklist #5111
- Tweak: Enable homescreen for all sites #5108
- Tweak: Enable remote inbox in all envs #5160
- Tweak: Add opt-out for remote inbox #5162
- Fix: Table componenbt onQueryChange default prop #4959
- Fix: Dependency declarations in woocommerce/components #4972
- Fix: Text domains in stock report #4980
- Fix: Typo in reports store action creators #4992
- Fix: Note data actions and consolidate query constants #4990
- Fix: Advanced filters screen reader text #5032
- Fix: Show full variation name in products report #5056
- Fix: Card to connect to woocommerce.com #5129
- Fix: Search all variation attribute values #5141
- Fix: Force float before addition in taxes #5149
- Fix: Enlarged store profiler text in two steps #5194
- Fix: Bug where sometimes the task list would not vanish after being completed #5205
**WooCommerce Blocks - 3.2.0, 3.3.0 and 3.4.0**
- Fix an undefined variable PHP notice related to Product REST API. [#2962](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/2962)
- Fixed an issue that was making some blocks not to render correctly in the Empty cart template. [#2904](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/2904)
- Fixes a styling issue in the Product Search block in the editor. [#3014](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3014)
- Improved focus styles of error states on form elements. [#2974](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/2974)
- Deprecate wc.wcSettings.setSetting function. [#3010](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3010)
- Improve behaviour of draft order cleanup to account for clobbered custom shop order status. [#2912](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/2912)
- Fixed styling options of the Product Title block (in All Products). [3095](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3095)
- Fix product reviews schema date fields to use new (WP 5.5) `date-time` format. ([3109](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3109))
- Use wp_login_url instead of hardcoding login path. ([3090](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3090))
- Create DebouncedValidatedTextInput component. ([3108](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3108))
- Merge ProductPrice atomic block and component. ([3065](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3065))
= 4.5.2 - 2020-09-14 =
* Fix - Revert the changes in filtering by attribute that were introduced in WooCommerce 4.4. #27625
* Fix - Adjusted validation to allow for variations with "0" as an attribute value. #27633
= 4.5.1 - 2020-09-09 =
* Fix - Check for state and postcode fields only if required in `show_shipping`. #27628
= 4.5.0 - 2020-09-08 =
**WooCommerce**
* Localization - Added postcode validation for Bosnia and Herzegovina. #27048
* Localization - Added the postcode validation for Liechtenstein. #27059
* Localization - Add i18n locale information for Liechtenstein, Switzerland and Austria. #27193
* Tweak - Increase priority of `admin_body_class` filter to avoid comflict with plugins that incorrectly remove all body classes from WP. #27426
* Tweak - Rename built-in PayPal payment method to PayPal Standard. #27468
* Fix - Remove whitespace within a link. #26897
* Fix - `get_review_count_for_product` return all comments count not only 'review' types #26928
* Fix - Hidden field type is now supported by `woocommerce_form_field`. #27023
@ -18,6 +129,10 @@
* Fix - Fixes Japan zip code format issue (dash is now optional). #27244
* Fix - Restore backward compatibility with WC 4.x and forward compatibility with WC 5.5. #27318
* Fix - Switch to site locale before translating refund reason. #27323
* Fix - Declare `WC_Post_Types::updated_term_messages` as a static method to remove PHP deprecation warning. #27436
* Fix - Allow HTML to be entered in product title for formatting purposes. #27465
* Fix - Filter by attribute widget not working properly for variations having attribute values of "Any...". #27508
* Fix - Fixed the layout of the variations and attributes sections in the product page in the admin when running WP >= 5.5. #27590
* Dev - Added additional stock-based cart filters including `woocommerce_cart_product_cannot_add_another_message`, `woocommerce_cart_product_out_of_stock_message`, and `woocommerce_cart_product_not_enough_stock_message`. #26439
* Dev - Changed text domain to `woocommerce` for REST API files. #27248
* Dev - Added file path to the `woocommerce_file_download_method` filter. #27152
@ -26,7 +141,7 @@
**WooCommerce Admin 1.5.0**
* Enhancement - Add eWAY to Payment Setup for AU/NZ Stores. #4947
* Fix - Use clipRule and fillRule props. #4889, part of #4864
* Tweak: Remove the Composite products option from the onboarding wizard #4703
* Fix - Admin order page shipping label prompt compatibility with WCS 1.24. #5025
* Dev - New notification: Don't forget to test your checkout. #4805
* Dev - Enable tax calculation before redirecting to standard tax rates page. #4878
* Dev - Added event recording to Orders, Stock, and Reviews panels. #4861
@ -869,7 +984,7 @@
* Tweak - Remove the left and right margin from the logo in emails. #23360
* Tweak - Use the high res version of the WP spinner in the coupon Block UI. #23364
* Tweak - Improve user registration validation messages. #23468
* Tweak - Auto generate a new username when a username is blacklisted by WordPress. #23672
* Tweak - Auto generate a new username when a username is blocked by WordPress. #23672
* Tweak - Guest cart sessions now gets deleted when a user logs in, preventing duplicate cart sessions. #23687
* Tweak - Include the store's base postcode and city when calculating order taxes. #23695
* Tweak - Update the generate username setting description label to reflect how the username is actually generated. #23911
@ -3965,7 +4080,7 @@
* Fix - Fix bulk editing variation sale price.
* Fix - Remove comment exclusion in order notes meta box.
* Fix - Sync min and max prices for regular and sale prices so prices are displayed correctly when sale price is lower than a regular price of another variation.
* Fix - Expanding line item_meta causes conflicts if attributes are named with things like 'name', 'type' or 'qty'. Added blacklist to exclude unsafe values.
* Fix - Expanding line item_meta causes conflicts if attributes are named with things like 'name', 'type' or 'qty'. Added blocklist to exclude unsafe values.
* Fix - Added support for clearing report transients when using object caching.
* Fix - encoding issues with attribute values.
* Fix - Escape the contents of the changelog when displayed.

View File

@ -13,15 +13,14 @@
"composer/installers": "1.7.0",
"maxmind-db/reader": "1.6.0",
"pelago/emogrifier": "3.1.0",
"psr/container": "^1.0",
"psr/container": "1.0.0",
"woocommerce/action-scheduler": "3.1.6",
"woocommerce/woocommerce-admin": "1.5.0-rc.1",
"woocommerce/woocommerce-blocks": "3.1.0"
"woocommerce/woocommerce-admin": "1.6.1",
"woocommerce/woocommerce-blocks": "3.4.0",
"league/container": "3.3.1"
},
"require-dev": {
"phpunit/phpunit": "7.5.20",
"woocommerce/woocommerce-sniffs": "^0.1.0",
"wp-cli/i18n-command": "^2.2"
"bamarni/composer-bin-plugin": "^1.4"
},
"config": {
"platform": {
@ -43,7 +42,8 @@
"includes/rest-api"
],
"psr-4": {
"Automattic\\WooCommerce\\": "src/"
"Automattic\\WooCommerce\\": "src/",
"Automattic\\WooCommerce\\Vendor\\League\\Container\\": "vendor/league/container/"
}
},
"autoload-dev": {
@ -57,9 +57,13 @@
},
"scripts": {
"post-install-cmd": [
"@composer bin all install --ansi",
"sh ./bin/prefix-vendor-namespaces.sh",
"sh ./bin/package-update.sh"
],
"post-update-cmd": [
"@composer bin all update --ansi",
"sh ./bin/prefix-vendor-namespaces.sh",
"sh ./bin/package-update.sh"
],
"test": [
@ -79,6 +83,9 @@
],
"makepot": [
"@makepot-audit --skip-audit"
],
"bin": [
"echo 'bin not installed'"
]
},
"extra": {
@ -94,6 +101,9 @@
"phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier",
"makepot-audit": "Generate i18n/languages/woocommerce.pot file and run audit",
"makepot": "Generate i18n/languages/woocommerce.pot file"
},
"bamarni-bin": {
"target-directory": "bin/composer"
}
}
}

2448
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +0,0 @@
version: '3.3'
services:
wordpress-www:
volumes:
# This path is relative to the first config file
# which is in tests/e2e/env or node_modules/@woocommerce/e2e-environment
- "../../../:/var/www/html/wp-content/plugins/woocommerce"
wordpress-cli:
volumes:
- "../../../:/var/www/html/wp-content/plugins/woocommerce"

View File

@ -154,7 +154,6 @@ return array(
'BG',
'BY',
'CH',
'CY',
'CZ',
'DE',
'DK',

View File

@ -162,7 +162,7 @@ return array(
'weight_unit' => 'kg',
'dimension_unit' => 'cm',
),
'KE' => array(
'KE' => array(
'currency_code' => 'KES',
'currency_pos' => 'left',
'thousand_sep' => ',',
@ -171,6 +171,15 @@ return array(
'weight_unit' => 'kg',
'dimension_unit' => 'cm',
),
'KR' => array(
'currency_code' => 'KRW',
'currency_pos' => 'right',
'thousand_sep' => ',',
'decimal_sep' => '.',
'num_decimals' => 0,
'weight_unit' => 'kg',
'dimension_unit' => 'cm',
),
'LI' => array(
'currency_code' => 'CHF',
'currency_pos' => 'left_space',

View File

@ -172,6 +172,20 @@ return array(
),
'BH' => array(),
'BI' => array(),
'BJ' => array( // Benin states.
'AL' => __( 'Alibori', 'woocommerce' ),
'AK' => __( 'Atakora', 'woocommerce' ),
'AQ' => __( 'Atlantique', 'woocommerce' ),
'BO' => __( 'Borgou', 'woocommerce' ),
'CO' => __( 'Collines', 'woocommerce' ),
'KO' => __( 'Kouffo', 'woocommerce' ),
'DO' => __( 'Donga', 'woocommerce' ),
'LI' => __( 'Littoral', 'woocommerce' ),
'MO' => __( 'Mono', 'woocommerce' ),
'OU' => __( 'Ouémé', 'woocommerce' ),
'PL' => __( 'Plateau', 'woocommerce' ),
'ZO' => __( 'Zou', 'woocommerce' ),
),
'BO' => array( // Bolivian states.
'B' => __( 'Chuquisaca', 'woocommerce' ),
'H' => __( 'Beni', 'woocommerce' ),
@ -343,6 +357,35 @@ return array(
'DZ-48' => __( 'Relizane', 'woocommerce' ),
),
'EE' => array(),
'EG' => array( // Egypt states.
'EGALX' => __( 'Alexandria', 'woocommerce' ),
'EGASN' => __( 'Aswan', 'woocommerce' ),
'EGAST' => __( 'Asyut', 'woocommerce' ),
'EGBA' => __( 'Red Sea', 'woocommerce' ),
'EGBH' => __( 'Beheira', 'woocommerce' ),
'EGBNS' => __( 'Beni Suef', 'woocommerce' ),
'EGC' => __( 'Cairo', 'woocommerce' ),
'EGDK' => __( 'Dakahlia', 'woocommerce' ),
'EGDT' => __( 'Damietta', 'woocommerce' ),
'EGFYM' => __( 'Faiyum', 'woocommerce' ),
'EGGH' => __( 'Gharbia', 'woocommerce' ),
'EGGZ' => __( 'Giza', 'woocommerce' ),
'EGIS' => __( 'Ismailia', 'woocommerce' ),
'EGJS' => __( 'South Sinai', 'woocommerce' ),
'EGKB' => __( 'Qalyubia', 'woocommerce' ),
'EGKFS' => __( 'Kafr el-Sheikh', 'woocommerce' ),
'EGKN' => __( 'Qena', 'woocommerce' ),
'EGLX' => __( 'Luxor', 'woocommerce' ),
'EGMN' => __( 'Minya', 'woocommerce' ),
'EGMNF' => __( 'Monufia', 'woocommerce' ),
'EGMT' => __( 'Matrouh', 'woocommerce' ),
'EGPTS' => __( 'Port Said', 'woocommerce' ),
'EGSHG' => __( 'Sohag', 'woocommerce' ),
'EGSHR' => __( 'Al Sharqia', 'woocommerce' ),
'EGSIN' => __( 'North Sinai', 'woocommerce' ),
'EGSUZ' => __( 'Suez', 'woocommerce' ),
'EGWAD' => __( 'New Valley', 'woocommerce' ),
),
'ES' => array( // Spanish states.
'C' => __( 'A Coruña', 'woocommerce' ),
'VI' => __( 'Araba/Álava', 'woocommerce' ),
@ -393,7 +436,7 @@ return array(
'TO' => __( 'Toledo', 'woocommerce' ),
'V' => __( 'Valencia', 'woocommerce' ),
'VA' => __( 'Valladolid', 'woocommerce' ),
'BI' => __( 'Bizkaia', 'woocommerce' ),
'BI' => __( 'Biscay', 'woocommerce' ),
'ZA' => __( 'Zamora', 'woocommerce' ),
'Z' => __( 'Zaragoza', 'woocommerce' ),
),
@ -446,7 +489,7 @@ return array(
'BA' => __( 'Baranya', 'woocommerce' ),
'BZ' => __( 'Borsod-Abaúj-Zemplén', 'woocommerce' ),
'BU' => __( 'Budapest', 'woocommerce' ),
'CS' => __( 'Csongrád', 'woocommerce' ),
'CS' => __( 'Csongrád-Csanád', 'woocommerce' ),
'FE' => __( 'Fejér', 'woocommerce' ),
'GS' => __( 'Győr-Moson-Sopron', 'woocommerce' ),
'HB' => __( 'Hajdú-Bihar', 'woocommerce' ),
@ -1442,6 +1485,40 @@ return array(
'TZ30' => __( 'Simiyu', 'woocommerce' ),
),
'LK' => array(),
'RS' => array( // Serbia districts. Ref: https://github.com/unicode-org/cldr/blob/release-37/common/subdivisions/en.xml#L4251-L4283
'RS00' => _x( 'Belgrade', 'district', 'woocommerce' ),
'RS14' => _x( 'Bor', 'district', 'woocommerce' ),
'RS11' => _x( 'Braničevo', 'district', 'woocommerce' ),
'RS02' => _x( 'Central Banat', 'district', 'woocommerce' ),
'RS10' => _x( 'Danube', 'district', 'woocommerce' ),
'RS23' => _x( 'Jablanica', 'district', 'woocommerce' ),
'RS09' => _x( 'Kolubara', 'district', 'woocommerce' ),
'RS08' => _x( 'Mačva', 'district', 'woocommerce' ),
'RS17' => _x( 'Morava', 'district', 'woocommerce' ),
'RS20' => _x( 'Nišava', 'district', 'woocommerce' ),
'RS01' => _x( 'North Bačka', 'district', 'woocommerce' ),
'RS03' => _x( 'North Banat', 'district', 'woocommerce' ),
'RS24' => _x( 'Pčinja', 'district', 'woocommerce' ),
'RS22' => _x( 'Pirot', 'district', 'woocommerce' ),
'RS13' => _x( 'Pomoravlje', 'district', 'woocommerce' ),
'RS19' => _x( 'Rasina', 'district', 'woocommerce' ),
'RS18' => _x( 'Raška', 'district', 'woocommerce' ),
'RS06' => _x( 'South Bačka', 'district', 'woocommerce' ),
'RS04' => _x( 'South Banat', 'district', 'woocommerce' ),
'RS07' => _x( 'Srem', 'district', 'woocommerce' ),
'RS12' => _x( 'Šumadija', 'district', 'woocommerce' ),
'RS21' => _x( 'Toplica', 'district', 'woocommerce' ),
'RS05' => _x( 'West Bačka', 'district', 'woocommerce' ),
'RS15' => _x( 'Zaječar', 'district', 'woocommerce' ),
'RS16' => _x( 'Zlatibor', 'district', 'woocommerce' ),
'RS25' => _x( 'Kosovo', 'district', 'woocommerce' ),
'RS26' => _x( 'Peć', 'district', 'woocommerce' ),
'RS27' => _x( 'Prizren', 'district', 'woocommerce' ),
'RS28' => _x( 'Kosovska Mitrovica', 'district', 'woocommerce' ),
'RS29' => _x( 'Kosovo-Pomoravlje', 'district', 'woocommerce' ),
'RSKM' => _x( 'Kosovo-Metohija', 'district', 'woocommerce' ),
'RSVO' => _x( 'Vojvodina', 'district', 'woocommerce' ),
),
'SE' => array(),
'UG' => array( // Uganda districts. Ref: https://en.wikipedia.org/wiki/ISO_3166-2:UG.
'UG314' => __( 'Abim', 'woocommerce' ),

View File

@ -10,6 +10,8 @@
* @package WooCommerce\Classes
*/
use Automattic\WooCommerce\Utilities\NumberUtil;
defined( 'ABSPATH' ) || exit;
require_once WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-order.php';
@ -428,7 +430,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
} else {
$total_discount = $this->get_discount_total() + $this->get_discount_tax();
}
return apply_filters( 'woocommerce_order_get_total_discount', round( $total_discount, WC_ROUNDING_PRECISION ), $this );
return apply_filters( 'woocommerce_order_get_total_discount', NumberUtil::round( $total_discount, WC_ROUNDING_PRECISION ), $this );
}
/**
@ -437,7 +439,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
* @return float
*/
public function get_subtotal() {
$subtotal = round( $this->get_cart_subtotal_for_order(), wc_get_price_decimals() );
$subtotal = NumberUtil::round( $this->get_cart_subtotal_for_order(), wc_get_price_decimals() );
return apply_filters( 'woocommerce_order_get_subtotal', (float) $subtotal, $this );
}
@ -672,7 +674,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
*/
protected function set_total_tax( $value ) {
// We round here because this is a total entry, as opposed to line items in other setters.
$this->set_prop( 'total_tax', wc_format_decimal( round( $value, wc_get_price_decimals() ) ) );
$this->set_prop( 'total_tax', wc_format_decimal( NumberUtil::round( $value, wc_get_price_decimals() ) ) );
}
/**
@ -1677,7 +1679,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
// Sum shipping costs.
foreach ( $this->get_shipping_methods() as $shipping ) {
$shipping_total += round( $shipping->get_total(), wc_get_price_decimals() );
$shipping_total += NumberUtil::round( $shipping->get_total(), wc_get_price_decimals() );
}
$this->set_shipping_total( $shipping_total );
@ -1687,7 +1689,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$fee_total = $item->get_total();
if ( 0 > $fee_total ) {
$max_discount = round( $cart_total + $fees_total + $shipping_total, wc_get_price_decimals() ) * -1;
$max_discount = NumberUtil::round( $cart_total + $fees_total + $shipping_total, wc_get_price_decimals() ) * -1;
if ( $fee_total < $max_discount && 0 > $max_discount ) {
$item->set_total( $max_discount );
@ -1714,9 +1716,9 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
}
}
$this->set_discount_total( round( $cart_subtotal - $cart_total, wc_get_price_decimals() ) );
$this->set_discount_total( NumberUtil::round( $cart_subtotal - $cart_total, wc_get_price_decimals() ) );
$this->set_discount_tax( wc_round_tax_total( $cart_subtotal_tax - $cart_total_tax ) );
$this->set_total( round( $cart_total + $fees_total + $this->get_shipping_total() + $this->get_cart_tax() + $this->get_shipping_tax(), wc_get_price_decimals() ) );
$this->set_total( NumberUtil::round( $cart_total + $fees_total + $this->get_shipping_total() + $this->get_cart_tax() + $this->get_shipping_tax(), wc_get_price_decimals() ) );
do_action( 'woocommerce_order_after_calculate_totals', $and_taxes, $this );
@ -1767,7 +1769,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$subtotal = $item->get_subtotal();
}
$subtotal = $round ? round( $subtotal, wc_get_price_decimals() ) : $subtotal;
$subtotal = $round ? NumberUtil::round( $subtotal, wc_get_price_decimals() ) : $subtotal;
}
return apply_filters( 'woocommerce_order_amount_line_subtotal', $subtotal, $this, $item, $inc_tax, $round );
@ -1791,7 +1793,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$total = floatval( $item->get_total() ) / $item->get_quantity();
}
$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
$total = $round ? NumberUtil::round( $total, wc_get_price_decimals() ) : $total;
}
return apply_filters( 'woocommerce_order_amount_item_total', $total, $this, $item, $inc_tax, $round );
@ -1813,7 +1815,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$total = $inc_tax ? $item->get_total() + $item->get_total_tax() : $item->get_total();
// Check if we need to round.
$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
$total = $round ? NumberUtil::round( $total, wc_get_price_decimals() ) : $total;
}
return apply_filters( 'woocommerce_order_amount_line_total', $total, $this, $item, $inc_tax, $round );

View File

@ -71,18 +71,6 @@ class WC_Admin_Help {
)
);
$screen->add_help_tab(
array(
'id' => 'woocommerce_onboard_tab',
'title' => __( 'Setup wizard', 'woocommerce' ),
'content' =>
'<h2>' . __( 'Setup wizard', 'woocommerce' ) . '</h2>' .
'<p>' . __( 'If you need to access the setup wizard again, please click on the button below.', 'woocommerce' ) . '</p>' .
'<p><a href="' . admin_url( 'index.php?page=wc-setup' ) . '" class="button button-primary">' . __( 'Setup wizard', 'woocommerce' ) . '</a></p>',
)
);
$screen->set_help_sidebar(
'<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></p>' .
'<p><a href="https://woocommerce.com/?utm_source=helptab&utm_medium=product&utm_content=about&utm_campaign=woocommerceplugin" target="_blank">' . __( 'About WooCommerce', 'woocommerce' ) . '</a></p>' .

View File

@ -28,7 +28,6 @@ class WC_Admin_Notices {
* @var array
*/
private static $core_notices = array(
'install' => 'install_notice',
'update' => 'update_notice',
'template_files' => 'template_file_check_notice',
'legacy_shipping' => 'legacy_shipping_notice',
@ -253,16 +252,17 @@ class WC_Admin_Notices {
include dirname( __FILE__ ) . '/views/html-notice-update.php';
}
} else {
WC_Install::update_db_version();
include dirname( __FILE__ ) . '/views/html-notice-updated.php';
}
}
/**
* If we have just installed, show a message with the install pages button.
*
* @deprecated 4.6.0
*/
public static function install_notice() {
include dirname( __FILE__ ) . '/views/html-notice-install.php';
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
}
/**

View File

@ -7,6 +7,7 @@
*/
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Utilities\NumberUtil;
if ( ! defined( 'ABSPATH' ) ) {
exit;
@ -28,10 +29,10 @@ class WC_Admin_Post_Types {
* Constructor.
*/
public function __construct() {
include_once dirname( __FILE__ ) . '/class-wc-admin-meta-boxes.php';
include_once __DIR__ . '/class-wc-admin-meta-boxes.php';
if ( ! function_exists( 'duplicate_post_plugin_activation' ) ) {
include_once 'class-wc-admin-duplicate-product.php';
include_once __DIR__ . '/class-wc-admin-duplicate-product.php';
}
// Load correct list table classes for current screen.
@ -94,15 +95,15 @@ class WC_Admin_Post_Types {
switch ( $screen_id ) {
case 'edit-shop_order':
include_once 'list-tables/class-wc-admin-list-table-orders.php';
include_once __DIR__ . '/list-tables/class-wc-admin-list-table-orders.php';
$wc_list_table = new WC_Admin_List_Table_Orders();
break;
case 'edit-shop_coupon':
include_once 'list-tables/class-wc-admin-list-table-coupons.php';
include_once __DIR__ . '/list-tables/class-wc-admin-list-table-coupons.php';
$wc_list_table = new WC_Admin_List_Table_Coupons();
break;
case 'edit-product':
include_once 'list-tables/class-wc-admin-list-table-products.php';
include_once __DIR__ . '/list-tables/class-wc-admin-list-table-products.php';
$wc_list_table = new WC_Admin_List_Table_Products();
break;
}
@ -137,8 +138,8 @@ class WC_Admin_Post_Types {
9 => sprintf(
/* translators: 1: date 2: product url */
__( 'Product scheduled for: %1$s. <a target="_blank" href="%2$s">Preview product</a>', 'woocommerce' ),
'<strong>' . date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $post->post_date ) ),
esc_url( get_permalink( $post->ID ) ) . '</strong>'
'<strong>' . date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $post->post_date ) ) . '</strong>',
esc_url( get_permalink( $post->ID ) )
),
/* translators: %s: product url */
10 => sprintf( __( 'Product draft updated. <a target="_blank" href="%s">Preview product</a>', 'woocommerce' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
@ -956,7 +957,7 @@ class WC_Admin_Post_Types {
$regular_price = $product->get_regular_price();
if ( $is_percentage ) {
$percent = $price / 100;
$new_price = max( 0, $regular_price - ( round( $regular_price * $percent, wc_get_price_decimals() ) ) );
$new_price = max( 0, $regular_price - ( NumberUtil::round( $regular_price * $percent, wc_get_price_decimals() ) ) );
} else {
$new_price = max( 0, $regular_price - $price );
}
@ -968,7 +969,7 @@ class WC_Admin_Post_Types {
if ( isset( $new_price ) && $new_price !== $old_price ) {
$price_changed = true;
$new_price = round( $new_price, wc_get_price_decimals() );
$new_price = NumberUtil::round( $new_price, wc_get_price_decimals() );
$product->{"set_{$price_type}_price"}( $new_price );
}

View File

@ -49,15 +49,15 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
include_once dirname( __FILE__ ) . '/settings/class-wc-settings-page.php';
$settings[] = include 'settings/class-wc-settings-general.php';
$settings[] = include 'settings/class-wc-settings-products.php';
$settings[] = include 'settings/class-wc-settings-tax.php';
$settings[] = include 'settings/class-wc-settings-shipping.php';
$settings[] = include 'settings/class-wc-settings-payment-gateways.php';
$settings[] = include 'settings/class-wc-settings-accounts.php';
$settings[] = include 'settings/class-wc-settings-emails.php';
$settings[] = include 'settings/class-wc-settings-integrations.php';
$settings[] = include 'settings/class-wc-settings-advanced.php';
$settings[] = include __DIR__ . '/settings/class-wc-settings-general.php';
$settings[] = include __DIR__ . '/settings/class-wc-settings-products.php';
$settings[] = include __DIR__ . '/settings/class-wc-settings-tax.php';
$settings[] = include __DIR__ . '/settings/class-wc-settings-shipping.php';
$settings[] = include __DIR__ . '/settings/class-wc-settings-payment-gateways.php';
$settings[] = include __DIR__ . '/settings/class-wc-settings-accounts.php';
$settings[] = include __DIR__ . '/settings/class-wc-settings-emails.php';
$settings[] = include __DIR__ . '/settings/class-wc-settings-integrations.php';
$settings[] = include __DIR__ . '/settings/class-wc-settings-advanced.php';
self::$settings = apply_filters( 'woocommerce_get_settings_pages', $settings );
}

File diff suppressed because it is too large Load Diff

View File

@ -19,14 +19,14 @@ class WC_Admin_Status {
* Handles output of the reports page in admin.
*/
public static function output() {
include_once dirname( __FILE__ ) . '/views/html-admin-page-status.php';
include_once __DIR__ . '/views/html-admin-page-status.php';
}
/**
* Handles output of report.
*/
public static function status_report() {
include_once dirname( __FILE__ ) . '/views/html-admin-page-status-report.php';
include_once __DIR__ . '/views/html-admin-page-status-report.php';
}
/**
@ -80,7 +80,7 @@ class WC_Admin_Status {
echo '<div class="updated inline"><p>' . esc_html__( 'Your changes have been saved.', 'woocommerce' ) . '</p></div>';
}
include_once dirname( __FILE__ ) . '/views/html-admin-page-status-tools.php';
include_once __DIR__ . '/views/html-admin-page-status-tools.php';
}
/**
@ -124,7 +124,7 @@ class WC_Admin_Status {
self::remove_log();
}
include_once 'views/html-admin-page-status-logs.php';
include_once __DIR__ . '/views/html-admin-page-status-logs.php';
}
/**
@ -142,7 +142,7 @@ class WC_Admin_Status {
$log_table_list = new WC_Admin_Log_Table_List();
$log_table_list->prepare_items();
include_once 'views/html-admin-page-status-logs-db.php';
include_once __DIR__ . '/views/html-admin-page-status-logs-db.php';
}
/**

View File

@ -208,7 +208,7 @@ class WC_Admin_Webhooks {
$webhook_id = absint( $_GET['edit-webhook'] ); // WPCS: input var okay, CSRF ok.
$webhook = new WC_Webhook( $webhook_id );
include 'settings/views/html-webhooks-edit.php';
include __DIR__ . '/settings/views/html-webhooks-edit.php';
return;
}

View File

@ -28,7 +28,6 @@ class WC_Admin {
add_action( 'admin_init', array( $this, 'admin_redirects' ) );
add_action( 'admin_footer', 'wc_print_js', 25 );
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
add_action( 'wp_ajax_setup_wizard_check_jetpack', array( $this, 'setup_wizard_check_jetpack' ) );
add_action( 'init', array( 'WC_Site_Tracking', 'init' ) );
// Disable WXR export of schedule action posts.
@ -49,19 +48,19 @@ class WC_Admin {
* Include any classes we need within admin.
*/
public function includes() {
include_once dirname( __FILE__ ) . '/wc-admin-functions.php';
include_once dirname( __FILE__ ) . '/wc-meta-box-functions.php';
include_once dirname( __FILE__ ) . '/class-wc-admin-post-types.php';
include_once dirname( __FILE__ ) . '/class-wc-admin-taxonomies.php';
include_once dirname( __FILE__ ) . '/class-wc-admin-menus.php';
include_once dirname( __FILE__ ) . '/class-wc-admin-customize.php';
include_once dirname( __FILE__ ) . '/class-wc-admin-notices.php';
include_once dirname( __FILE__ ) . '/class-wc-admin-assets.php';
include_once dirname( __FILE__ ) . '/class-wc-admin-api-keys.php';
include_once dirname( __FILE__ ) . '/class-wc-admin-webhooks.php';
include_once dirname( __FILE__ ) . '/class-wc-admin-pointers.php';
include_once dirname( __FILE__ ) . '/class-wc-admin-importers.php';
include_once dirname( __FILE__ ) . '/class-wc-admin-exporters.php';
include_once __DIR__ . '/wc-admin-functions.php';
include_once __DIR__ . '/wc-meta-box-functions.php';
include_once __DIR__ . '/class-wc-admin-post-types.php';
include_once __DIR__ . '/class-wc-admin-taxonomies.php';
include_once __DIR__ . '/class-wc-admin-menus.php';
include_once __DIR__ . '/class-wc-admin-customize.php';
include_once __DIR__ . '/class-wc-admin-notices.php';
include_once __DIR__ . '/class-wc-admin-assets.php';
include_once __DIR__ . '/class-wc-admin-api-keys.php';
include_once __DIR__ . '/class-wc-admin-webhooks.php';
include_once __DIR__ . '/class-wc-admin-pointers.php';
include_once __DIR__ . '/class-wc-admin-importers.php';
include_once __DIR__ . '/class-wc-admin-exporters.php';
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks.php';
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks-event.php';
@ -71,24 +70,15 @@ class WC_Admin {
// Help Tabs.
if ( apply_filters( 'woocommerce_enable_admin_help_tab', true ) ) {
include_once dirname( __FILE__ ) . '/class-wc-admin-help.php';
}
// Setup/welcome.
if ( ! empty( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
switch ( $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
case 'wc-setup':
include_once dirname( __FILE__ ) . '/class-wc-admin-setup-wizard.php';
break;
}
include_once __DIR__ . '/class-wc-admin-help.php';
}
// Helper.
include_once dirname( __FILE__ ) . '/helper/class-wc-helper.php';
include_once __DIR__ . '/helper/class-wc-helper.php';
// Marketplace suggestions & related REST API.
include_once dirname( __FILE__ ) . '/marketplace-suggestions/class-wc-marketplace-suggestions.php';
include_once dirname( __FILE__ ) . '/marketplace-suggestions/class-wc-marketplace-updater.php';
include_once __DIR__ . '/marketplace-suggestions/class-wc-marketplace-suggestions.php';
include_once __DIR__ . '/marketplace-suggestions/class-wc-marketplace-updater.php';
}
/**
@ -104,22 +94,22 @@ class WC_Admin {
switch ( $screen->id ) {
case 'dashboard':
case 'dashboard-network':
include 'class-wc-admin-dashboard.php';
include __DIR__ . '/class-wc-admin-dashboard.php';
break;
case 'options-permalink':
include 'class-wc-admin-permalink-settings.php';
include __DIR__ . '/class-wc-admin-permalink-settings.php';
break;
case 'plugins':
include 'plugin-updates/class-wc-plugins-screen-updates.php';
include __DIR__ . '/plugin-updates/class-wc-plugins-screen-updates.php';
break;
case 'update-core':
include 'plugin-updates/class-wc-updates-screen-updates.php';
include __DIR__ . '/plugin-updates/class-wc-updates-screen-updates.php';
break;
case 'users':
case 'user':
case 'profile':
case 'user-edit':
include 'class-wc-admin-profile.php';
include __DIR__ . '/class-wc-admin-profile.php';
break;
}
}
@ -127,7 +117,7 @@ class WC_Admin {
/**
* Handle redirects to setup/welcome page after install and updates.
*
* For setup wizard, transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters.
* The user must have access rights, and we must ignore the network/bulk plugin updaters.
*/
public function admin_redirects() {
// Don't run this fn from Action Scheduler requests, as it would clear _wc_activation_redirect transient.
@ -137,7 +127,7 @@ class WC_Admin {
}
// phpcs:disable WordPress.Security.NonceVerification.Recommended
// Nonced plugin install redirects (whitelisted).
// Nonced plugin install redirects.
if ( ! empty( $_GET['wc-install-plugin-redirect'] ) ) {
$plugin_slug = wc_clean( wp_unslash( $_GET['wc-install-plugin-redirect'] ) );
@ -152,28 +142,6 @@ class WC_Admin {
exit;
}
// Setup wizard redirect.
if ( get_transient( '_wc_activation_redirect' ) && apply_filters( 'woocommerce_enable_setup_wizard', true ) ) {
$do_redirect = true;
$current_page = isset( $_GET['page'] ) ? wc_clean( wp_unslash( $_GET['page'] ) ) : false;
// On these pages, or during these events, postpone the redirect.
if ( wp_doing_ajax() || is_network_admin() || ! current_user_can( 'manage_woocommerce' ) ) {
$do_redirect = false;
}
// On these pages, or during these events, disable the redirect.
if ( 'wc-setup' === $current_page || ! WC_Admin_Notices::has_notice( 'install' ) || apply_filters( 'woocommerce_prevent_automatic_wizard_redirect', false ) || isset( $_GET['activate-multi'] ) ) {
delete_transient( '_wc_activation_redirect' );
$do_redirect = false;
}
if ( $do_redirect ) {
delete_transient( '_wc_activation_redirect' );
wp_safe_redirect( admin_url( 'index.php?page=wc-setup' ) );
exit;
}
}
// phpcs:enable WordPress.Security.NonceVerification.Recommended
}
@ -223,7 +191,7 @@ class WC_Admin {
// get the preview email content.
ob_start();
include 'views/html-email-template-preview.php';
include __DIR__ . '/views/html-email-template-preview.php';
$message = ob_get_clean();
// create a new email.

View File

@ -1,9 +1,8 @@
<?php
/**
* WooCommerce Admin
* WooCommerce Admin Helper API
*
* @class WC_Helper_API
* @package WooCommerce\Admin
* @package WooCommerce\Admin\Helper
*/
if ( ! defined( 'ABSPATH' ) ) {

View File

@ -1,4 +1,10 @@
<?php
/**
* WooCommerce Admin Helper Compat
*
* @package WooCommerce\Admin\Helper
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

View File

@ -1,4 +1,10 @@
<?php
/**
* WooCommerce Admin Helper Options
*
* @package WooCommerce\Admin\Helper
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

View File

@ -1,4 +1,10 @@
<?php
/**
* WooCommerce Admin Helper Plugin Info
*
* @package WooCommerce\Admin\Helper
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

View File

@ -3,7 +3,7 @@
* The update helper for WooCommerce.com plugins.
*
* @class WC_Helper_Updater
* @package WooCommerce\Admin.
* @package WooCommerce\Admin\Helper
*/
if ( ! defined( 'ABSPATH' ) ) {

View File

@ -1,9 +1,8 @@
<?php
/**
* WooCommerce Admin
* WooCommerce Admin Helper
*
* @class WC_Helper
* @package WooCommerce\Admin
* @package WooCommerce\Admin\Helper
*/
use Automattic\Jetpack\Constants;

View File

@ -15,7 +15,7 @@ if ( class_exists( 'WC_Admin_List_Table_Coupons', false ) ) {
}
if ( ! class_exists( 'WC_Admin_List_Table', false ) ) {
include_once 'abstract-class-wc-admin-list-table.php';
include_once __DIR__ . '/abstract-class-wc-admin-list-table.php';
}
/**

View File

@ -15,7 +15,7 @@ if ( class_exists( 'WC_Admin_List_Table_Orders', false ) ) {
}
if ( ! class_exists( 'WC_Admin_List_Table', false ) ) {
include_once 'abstract-class-wc-admin-list-table.php';
include_once __DIR__ . '/abstract-class-wc-admin-list-table.php';
}
/**

View File

@ -15,7 +15,7 @@ if ( class_exists( 'WC_Admin_List_Table_Products', false ) ) {
}
if ( ! class_exists( 'WC_Admin_List_Table', false ) ) {
include_once 'abstract-class-wc-admin-list-table.php';
include_once __DIR__ . '/abstract-class-wc-admin-list-table.php';
}
/**

View File

@ -267,7 +267,7 @@ class WC_Meta_Box_Coupon_Data {
'id' => 'customer_email',
'label' => __( 'Allowed emails', 'woocommerce' ),
'placeholder' => __( 'No restrictions', 'woocommerce' ),
'description' => __( 'Whitelist of billing emails to check against when an order is placed. Separate email addresses with commas. You can also use an asterisk (*) to match parts of an email. For example "*@gmail.com" would match all gmail addresses.', 'woocommerce' ),
'description' => __( 'List of allowed billing emails to check against when an order is placed. Separate email addresses with commas. You can also use an asterisk (*) to match parts of an email. For example "*@gmail.com" would match all gmail addresses.', 'woocommerce' ),
'value' => implode( ', ', (array) $coupon->get_email_restrictions( 'edit' ) ),
'desc_tip' => true,
'type' => 'email',

View File

@ -56,7 +56,7 @@ class WC_Meta_Box_Order_Downloads {
$file = $product->get_file( $download->get_download_id() );
$file_count = isset( $file['name'] ) ? $file['name'] : sprintf( __( 'File %d', 'woocommerce' ), $file_counter );
include 'views/html-order-download-permission.php';
include __DIR__ . '/views/html-order-download-permission.php';
$loop++;
$file_counter++;

View File

@ -38,7 +38,7 @@ class WC_Meta_Box_Order_Items {
$order = $theorder;
$data = get_post_meta( $post->ID );
include 'views/html-order-items.php';
include __DIR__ . '/views/html-order-items.php';
}
/**

View File

@ -28,7 +28,7 @@ class WC_Meta_Box_Order_Notes {
$notes = wc_get_order_notes( $args );
include 'views/html-order-notes.php';
include __DIR__ . '/views/html-order-notes.php';
?>
<div class="add_note">
<p>

View File

@ -30,7 +30,7 @@ class WC_Meta_Box_Product_Data {
wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
include 'views/html-product-data-panel.php';
include __DIR__ . '/views/html-product-data-panel.php';
}
/**
@ -39,12 +39,12 @@ class WC_Meta_Box_Product_Data {
private static function output_tabs() {
global $post, $thepostid, $product_object;
include 'views/html-product-data-general.php';
include 'views/html-product-data-inventory.php';
include 'views/html-product-data-shipping.php';
include 'views/html-product-data-linked-products.php';
include 'views/html-product-data-attributes.php';
include 'views/html-product-data-advanced.php';
include __DIR__ . '/views/html-product-data-general.php';
include __DIR__ . '/views/html-product-data-inventory.php';
include __DIR__ . '/views/html-product-data-shipping.php';
include __DIR__ . '/views/html-product-data-linked-products.php';
include __DIR__ . '/views/html-product-data-attributes.php';
include __DIR__ . '/views/html-product-data-advanced.php';
}
/**
@ -177,7 +177,7 @@ class WC_Meta_Box_Product_Data {
$variations_per_page = absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_per_page', 15 ) );
$variations_total_pages = ceil( $variations_count / $variations_per_page );
include 'views/html-product-data-variations.php';
include __DIR__ . '/views/html-product-data-variations.php';
}
/**
@ -371,7 +371,7 @@ class WC_Meta_Box_Product_Data {
'featured' => isset( $_POST['_featured'] ),
'catalog_visibility' => isset( $_POST['_visibility'] ) ? wc_clean( wp_unslash( $_POST['_visibility'] ) ) : null,
'tax_status' => isset( $_POST['_tax_status'] ) ? wc_clean( wp_unslash( $_POST['_tax_status'] ) ) : null,
'tax_class' => isset( $_POST['_tax_class'] ) ? wc_clean( wp_unslash( $_POST['_tax_class'] ) ) : null,
'tax_class' => isset( $_POST['_tax_class'] ) ? sanitize_title( wp_unslash( $_POST['_tax_class'] ) ) : null,
'weight' => isset( $_POST['_weight'] ) ? wc_clean( wp_unslash( $_POST['_weight'] ) ) : null,
'length' => isset( $_POST['_length'] ) ? wc_clean( wp_unslash( $_POST['_length'] ) ) : null,
'width' => isset( $_POST['_width'] ) ? wc_clean( wp_unslash( $_POST['_width'] ) ) : null,

View File

@ -41,7 +41,7 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
<input type="hidden" name="order_item_tax_class[<?php echo absint( $item_id ); ?>]" value="<?php echo esc_attr( $item->get_tax_class() ); ?>" />
<?php do_action( 'woocommerce_before_order_itemmeta', $item_id, $item, $product ); ?>
<?php require 'html-order-item-meta.php'; ?>
<?php require __DIR__ . '/html-order-item-meta.php'; ?>
<?php do_action( 'woocommerce_after_order_itemmeta', $item_id, $item, $product ); ?>
</td>

View File

@ -59,7 +59,7 @@ if ( wc_tax_enabled() ) {
foreach ( $line_items as $item_id => $item ) {
do_action( 'woocommerce_before_order_item_' . $item->get_type() . '_html', $item_id, $item, $order );
include 'html-order-item.php';
include __DIR__ . '/html-order-item.php';
do_action( 'woocommerce_order_item_' . $item->get_type() . '_html', $item_id, $item, $order );
}
@ -69,7 +69,7 @@ if ( wc_tax_enabled() ) {
<tbody id="order_fee_line_items">
<?php
foreach ( $line_items_fee as $item_id => $item ) {
include 'html-order-fee.php';
include __DIR__ . '/html-order-fee.php';
}
do_action( 'woocommerce_admin_order_items_after_fees', $order->get_id() );
?>
@ -78,7 +78,7 @@ if ( wc_tax_enabled() ) {
<?php
$shipping_methods = WC()->shipping() ? WC()->shipping()->load_shipping_methods() : array();
foreach ( $line_items_shipping as $item_id => $item ) {
include 'html-order-shipping.php';
include __DIR__ . '/html-order-shipping.php';
}
do_action( 'woocommerce_admin_order_items_after_shipping', $order->get_id() );
?>
@ -89,7 +89,7 @@ if ( wc_tax_enabled() ) {
if ( $refunds ) {
foreach ( $refunds as $refund ) {
include 'html-order-refund.php';
include __DIR__ . '/html-order-refund.php';
}
do_action( 'woocommerce_admin_order_items_after_refunds', $order->get_id() );
}

View File

@ -41,7 +41,7 @@ defined( 'ABSPATH' ) || exit;
}
} else {
?>
<li><?php esc_html_e( 'There are no notes yet.', 'woocommerce' ); ?></li>
<li class="no-items"><?php esc_html_e( 'There are no notes yet.', 'woocommerce' ); ?></li>
<?php
}
?>

View File

@ -51,7 +51,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</div>
<?php do_action( 'woocommerce_before_order_itemmeta', $item_id, $item, null ); ?>
<?php require 'html-order-item-meta.php'; ?>
<?php require __DIR__ . '/html-order-item-meta.php'; ?>
<?php do_action( 'woocommerce_after_order_itemmeta', $item_id, $item, null ); ?>
</td>

View File

@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
$metabox_class[] = $attribute->get_name();
}
include 'html-product-attribute.php';
include __DIR__ . '/html-product-attribute.php';
}
?>
</div>

View File

@ -89,7 +89,7 @@ defined( 'ABSPATH' ) || exit;
$downloadable_files = $product_object->get_downloads( 'edit' );
if ( $downloadable_files ) {
foreach ( $downloadable_files as $key => $file ) {
include 'html-product-download.php';
include __DIR__ . '/html-product-download.php';
}
}
?>
@ -105,7 +105,7 @@ defined( 'ABSPATH' ) || exit;
'name' => '',
);
ob_start();
require 'html-product-download.php';
require __DIR__ . '/html-product-download.php';
echo esc_attr( ob_get_clean() );
?>
"><?php esc_html_e( 'Add File', 'woocommerce' ); ?></a>

View File

@ -378,7 +378,7 @@ defined( 'ABSPATH' ) || exit;
if ( $downloads ) {
foreach ( $downloads as $key => $file ) {
include 'html-product-variation-download.php';
include __DIR__ . '/html-product-variation-download.php';
}
}
?>
@ -394,7 +394,7 @@ defined( 'ABSPATH' ) || exit;
'name' => '',
);
ob_start();
require 'html-product-variation-download.php';
require __DIR__ . '/html-product-variation-download.php';
echo esc_attr( ob_get_clean() );
?>
"><?php esc_html_e( 'Add file', 'woocommerce' ); ?></a>

View File

@ -272,7 +272,6 @@ class WC_Notes_Run_Db_Update {
return;
} else {
// Db update not needed && notice is unactioned -> Thank you note.
\WC_Install::update_db_version();
self::update_done_notice( $note_id );
return;
}

View File

@ -115,7 +115,7 @@ class WC_Plugin_Updates {
$message = sprintf( __( "<strong>Heads up!</strong> The versions of the following plugins you're running haven't been tested with WooCommerce %s. Please update them or confirm compatibility before updating WooCommerce, or you may experience issues:", 'woocommerce' ), $new_version );
ob_start();
include 'views/html-notice-untested-extensions-inline.php';
include __DIR__ . '/views/html-notice-untested-extensions-inline.php';
return ob_get_clean();
}
@ -130,7 +130,7 @@ class WC_Plugin_Updates {
$plugins = $this->major_untested_plugins;
ob_start();
include 'views/html-notice-untested-extensions-modal.php';
include __DIR__ . '/views/html-notice-untested-extensions-modal.php';
return ob_get_clean();
}

View File

@ -42,7 +42,6 @@ class WC_Settings_Advanced extends WC_Settings_Page {
'webhooks' => __( 'Webhooks', 'woocommerce' ),
'legacy_api' => __( 'Legacy API', 'woocommerce' ),
'woocommerce_com' => __( 'WooCommerce.com', 'woocommerce' ),
'features' => __( 'Features', 'woocommerce' ),
);
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
@ -398,28 +397,6 @@ class WC_Settings_Advanced extends WC_Settings_Page {
),
)
);
} elseif ( 'features' === $current_section ) {
$settings = apply_filters(
'woocommerce_settings_features',
array(
array(
'title' => __( 'Features', 'woocommerce' ),
'type' => 'title',
'desc' => __( 'Start using new features that are being progressively rolled out to improve the store management experience.', 'woocommerce' ),
'id' => 'features_options',
),
array(
'title' => __( 'Home Screen', 'woocommerce' ),
'desc' => __( 'Displays analytical insights, inbox notifications, and handy shortcuts in a single screen', 'woocommerce' ),
'id' => 'woocommerce_homescreen_enabled',
'type' => 'checkbox',
),
array(
'type' => 'sectionend',
'id' => 'features_options',
),
)
);
}
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );

View File

@ -8,4 +8,4 @@
defined( 'ABSPATH' ) || exit;
return include 'class-wc-settings-payment-gateways.php';
return include __DIR__ . '/class-wc-settings-payment-gateways.php';

View File

@ -304,6 +304,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'id' => 'woocommerce_shop_page_id',
'type' => 'single_select_page',
'default' => '',
'args' => array( 'post_status' => 'publish,private' ),
'class' => 'wc-enhanced-select-nostd',
'css' => 'min-width:300px;',
'desc_tip' => __( 'This sets the base page of your shop - this is where your product archive will be.', 'woocommerce' ),

View File

@ -82,7 +82,7 @@ class WC_Settings_Tax extends WC_Settings_Page {
$settings = array();
if ( '' === $current_section ) {
$settings = include 'views/settings-tax.php';
$settings = include __DIR__ . '/views/settings-tax.php';
}
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );
}
@ -237,7 +237,7 @@ class WC_Settings_Tax extends WC_Settings_Page {
);
wp_enqueue_script( 'wc-settings-tax' );
include 'views/html-settings-tax.php';
include __DIR__ . '/views/html-settings-tax.php';
}
/**

View File

@ -8,4 +8,4 @@
defined( 'ABSPATH' ) || exit;
return include 'class-wc-settings-advanced.php';
return include __DIR__ . '/class-wc-settings-advanced.php';

View File

@ -1,6 +1,8 @@
<?php
/**
* Admin View: Notice - Install
*
* @deprecated 4.6.0
*/
if ( ! defined( 'ABSPATH' ) ) {

View File

@ -210,7 +210,7 @@ function wc_maybe_adjust_line_item_product_stock( $item, $item_quantity = -1 ) {
$item_quantity = wc_stock_amount( $item_quantity >= 0 ? $item_quantity : $item->get_quantity() );
$already_reduced_stock = wc_stock_amount( $item->get_meta( '_reduced_stock', true ) );
if ( ! $product || ! $product->managing_stock() || ! $already_reduced_stock || $item_quantity === $already_reduced_stock ) {
if ( ! $product || ! $product->managing_stock() ) {
return false;
}

View File

@ -7,6 +7,7 @@
*/
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Utilities\NumberUtil;
defined( 'ABSPATH' ) || exit;
@ -545,10 +546,10 @@ class WC_AJAX {
wp_die( -1 );
}
$order = wc_get_order( absint( $_GET['order_id'] ) ); // WPCS: sanitization ok.
$order = wc_get_order( absint( $_GET['order_id'] ) );
if ( $order ) {
include_once 'admin/list-tables/class-wc-admin-list-table-orders.php';
include_once __DIR__ . '/admin/list-tables/class-wc-admin-list-table-orders.php';
wp_send_json_success( WC_Admin_List_Table_Orders::order_preview_get_order_details( $order ) );
}
@ -581,7 +582,7 @@ class WC_AJAX {
$metabox_class[] = $attribute->get_name();
}
include 'admin/meta-boxes/views/html-product-attribute.php';
include __DIR__ . '/admin/meta-boxes/views/html-product-attribute.php';
wp_die();
}
@ -681,7 +682,7 @@ class WC_AJAX {
$metabox_class[] = $attribute->get_name();
}
include 'admin/meta-boxes/views/html-product-attribute.php';
include __DIR__ . '/admin/meta-boxes/views/html-product-attribute.php';
}
}
@ -716,7 +717,7 @@ class WC_AJAX {
$variation_id = $variation_object->save();
$variation = get_post( $variation_id );
$variation_data = array_merge( get_post_custom( $variation_id ), wc_get_product_variation_attributes( $variation_id ) ); // kept for BW compatibility.
include 'admin/meta-boxes/views/html-variation-admin.php';
include __DIR__ . '/admin/meta-boxes/views/html-variation-admin.php';
wp_die();
}
@ -816,7 +817,7 @@ class WC_AJAX {
/* translators: %d file count */
$file_count = sprintf( __( 'File %d', 'woocommerce' ), $file_counter );
}
include 'admin/meta-boxes/views/html-order-download-permission.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-download-permission.php';
}
}
}
@ -925,6 +926,7 @@ class WC_AJAX {
$validation_error = apply_filters( 'woocommerce_ajax_add_order_item_validation', $validation_error, $product, $order, $qty );
if ( $validation_error->get_error_code() ) {
/* translators: %s: error message */
throw new Exception( sprintf( __( 'Error: %s', 'woocommerce' ), $validation_error->get_error_message() ) );
}
$item_id = $order->add_product( $product, $qty );
@ -946,12 +948,12 @@ class WC_AJAX {
// Get HTML to return.
ob_start();
include 'admin/meta-boxes/views/html-order-items.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-items.php';
$items_html = ob_get_clean();
ob_start();
$notes = wc_get_order_notes( array( 'order_id' => $order_id ) );
include 'admin/meta-boxes/views/html-order-notes.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-notes.php';
$notes_html = ob_get_clean();
return array(
@ -1015,7 +1017,7 @@ class WC_AJAX {
$order->save();
ob_start();
include 'admin/meta-boxes/views/html-order-items.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-items.php';
$response['html'] = ob_get_clean();
} catch ( Exception $e ) {
wp_send_json_error( array( 'error' => $e->getMessage() ) );
@ -1057,7 +1059,7 @@ class WC_AJAX {
$item_id = $item->save();
ob_start();
include 'admin/meta-boxes/views/html-order-shipping.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-shipping.php';
$response['html'] = ob_get_clean();
} catch ( Exception $e ) {
wp_send_json_error( array( 'error' => $e->getMessage() ) );
@ -1104,7 +1106,7 @@ class WC_AJAX {
$item->save();
ob_start();
include 'admin/meta-boxes/views/html-order-items.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-items.php';
$response['html'] = ob_get_clean();
} catch ( Exception $e ) {
wp_send_json_error( array( 'error' => $e->getMessage() ) );
@ -1167,7 +1169,7 @@ class WC_AJAX {
$order->calculate_totals( false );
ob_start();
include 'admin/meta-boxes/views/html-order-items.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-items.php';
$response['html'] = ob_get_clean();
} catch ( Exception $e ) {
wp_send_json_error( array( 'error' => $e->getMessage() ) );
@ -1214,7 +1216,7 @@ class WC_AJAX {
$order->calculate_totals( false );
ob_start();
include 'admin/meta-boxes/views/html-order-items.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-items.php';
$response['html'] = ob_get_clean();
} catch ( Exception $e ) {
wp_send_json_error( array( 'error' => $e->getMessage() ) );
@ -1300,12 +1302,12 @@ class WC_AJAX {
// Get HTML to return.
ob_start();
include 'admin/meta-boxes/views/html-order-items.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-items.php';
$items_html = ob_get_clean();
ob_start();
$notes = wc_get_order_notes( array( 'order_id' => $order_id ) );
include 'admin/meta-boxes/views/html-order-notes.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-notes.php';
$notes_html = ob_get_clean();
wp_send_json_success(
@ -1352,7 +1354,7 @@ class WC_AJAX {
$order->calculate_totals( false );
ob_start();
include 'admin/meta-boxes/views/html-order-items.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-items.php';
$response['html'] = ob_get_clean();
} catch ( Exception $e ) {
wp_send_json_error( array( 'error' => $e->getMessage() ) );
@ -1391,7 +1393,7 @@ class WC_AJAX {
$order = wc_get_order( $order_id );
$order->calculate_taxes( $calculate_tax_args );
$order->calculate_totals( false );
include 'admin/meta-boxes/views/html-order-items.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-items.php';
wp_die();
}
@ -1420,12 +1422,12 @@ class WC_AJAX {
// Get HTML to return.
ob_start();
include 'admin/meta-boxes/views/html-order-items.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-items.php';
$items_html = ob_get_clean();
ob_start();
$notes = wc_get_order_notes( array( 'order_id' => $order_id ) );
include 'admin/meta-boxes/views/html-order-notes.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-notes.php';
$notes_html = ob_get_clean();
wp_send_json_success(
@ -1451,7 +1453,7 @@ class WC_AJAX {
// Return HTML items.
$order_id = absint( $_POST['order_id'] );
$order = wc_get_order( $order_id );
include 'admin/meta-boxes/views/html-order-items.php';
include __DIR__ . '/admin/meta-boxes/views/html-order-items.php';
wp_die();
}
@ -1582,7 +1584,7 @@ class WC_AJAX {
}
if ( $managing_stock && ! empty( $_GET['display_stock'] ) ) {
$stock_amount = $product_object->get_stock_quantity();
$stock_amount = $product_object->get_stock_quantity();
/* Translators: %d stock amount */
$formatted_name .= ' &ndash; ' . sprintf( __( 'Stock: %d', 'woocommerce' ), wc_format_stock_quantity_for_display( $stock_amount, $product_object ) );
}
@ -1861,8 +1863,8 @@ class WC_AJAX {
$response = array();
try {
$order = wc_get_order( $order_id );
$max_refund = wc_format_decimal( $order->get_total() - $order->get_total_refunded(), wc_get_price_decimals() );
$order = wc_get_order( $order_id );
$max_refund = wc_format_decimal( $order->get_total() - $order->get_total_refunded(), wc_get_price_decimals() );
if ( ! $refund_amount || $max_refund < $refund_amount || 0 > $refund_amount ) {
throw new Exception( __( 'Invalid refund amount', 'woocommerce' ) );
@ -2101,7 +2103,7 @@ class WC_AJAX {
$variation_id = $variation_object->get_id();
$variation = get_post( $variation_id );
$variation_data = array_merge( get_post_custom( $variation_id ), wc_get_product_variation_attributes( $variation_id ) ); // kept for BW compatibility.
include 'admin/meta-boxes/views/html-variation-admin.php';
include __DIR__ . '/admin/meta-boxes/views/html-variation-admin.php';
$loop++;
}
}
@ -2465,7 +2467,7 @@ class WC_AJAX {
if ( '%' === substr( $value, -1 ) ) {
$percent = wc_format_decimal( substr( $value, 0, -1 ) );
$field_value += round( ( $field_value / 100 ) * $percent, wc_get_price_decimals() ) * "{$operator}1";
$field_value += NumberUtil::round( ( $field_value / 100 ) * $percent, wc_get_price_decimals() ) * "{$operator}1";
} else {
$field_value += $value * "{$operator}1";
}

View File

@ -7,7 +7,7 @@
* - Legacy REST API - Deprecated in 2.6.0. @see class-wc-legacy-api.php
* - WP REST API - The main REST API in WooCommerce which is built on top of the WP REST API.
*
* @package WooCommerce\API
* @package WooCommerce\RestApi
* @since 2.0.0
*/

View File

@ -4,7 +4,7 @@
*
* Handles wc-auth endpoint requests.
*
* @package WooCommerce\API
* @package WooCommerce\RestApi
* @since 2.4.0
*/

View File

@ -349,8 +349,9 @@ class WC_Breadcrumb {
* Endpoints.
*/
protected function endpoint_trail() {
$action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
$endpoint = is_wc_endpoint_url() ? WC()->query->get_current_endpoint() : '';
$endpoint_title = $endpoint ? WC()->query->get_endpoint_title( $endpoint ) : '';
$endpoint_title = $endpoint ? WC()->query->get_endpoint_title( $endpoint, $action ) : '';
if ( $endpoint_title ) {
$this->add_crumb( $endpoint_title );

View File

@ -13,6 +13,8 @@
* @version 3.2.0
*/
use Automattic\WooCommerce\Utilities\NumberUtil;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -280,7 +282,7 @@ final class WC_Cart_Totals {
// Negative fees should not make the order total go negative.
if ( 0 > $fee->total ) {
$max_discount = round( $this->get_total( 'items_total', true ) + $fee_running_total + $this->get_total( 'shipping_total', true ) ) * -1;
$max_discount = NumberUtil::round( $this->get_total( 'items_total', true ) + $fee_running_total + $this->get_total( 'shipping_total', true ) ) * -1;
if ( $fee->total < $max_discount ) {
$fee->total = $max_discount;
@ -429,7 +431,7 @@ final class WC_Cart_Totals {
$taxes = WC_Tax::calc_tax( $item->price, $base_tax_rates, true );
// Now we have a new item price (excluding TAX).
$item->price = round( $item->price - array_sum( $taxes ) );
$item->price = NumberUtil::round( $item->price - array_sum( $taxes ) );
$item->price_includes_tax = false;
}
return $item;
@ -539,7 +541,7 @@ final class WC_Cart_Totals {
* @param string $key Total name you want to set.
* @param int $total Total to set.
*/
protected function set_total( $key = 'total', $total ) {
protected function set_total( $key, $total ) {
$this->totals[ $key ] = $total;
}
@ -748,7 +750,7 @@ final class WC_Cart_Totals {
$items_subtotal = $this->get_rounded_items_total( $this->get_values_for_total( 'subtotal' ) );
$this->set_total( 'items_subtotal', round( $items_subtotal ) );
$this->set_total( 'items_subtotal', NumberUtil::round( $items_subtotal ) );
$this->set_total( 'items_subtotal_tax', wc_round_tax_total( array_sum( $merged_subtotal_taxes ), 0 ) );
$this->cart->set_subtotal( $this->get_total( 'items_subtotal' ) );
@ -859,7 +861,7 @@ final class WC_Cart_Totals {
* @since 3.2.0
*/
protected function calculate_totals() {
$this->set_total( 'total', round( $this->get_total( 'items_total', true ) + $this->get_total( 'fees_total', true ) + $this->get_total( 'shipping_total', true ) + array_sum( $this->get_merged_taxes( true ) ), 0 ) );
$this->set_total( 'total', NumberUtil::round( $this->get_total( 'items_total', true ) + $this->get_total( 'fees_total', true ) + $this->get_total( 'shipping_total', true ) + array_sum( $this->get_merged_taxes( true ) ), 0 ) );
$this->cart->set_total_tax( array_sum( $this->get_merged_taxes( false ) ) );
// Allow plugins to hook and alter totals before final total is calculated.

View File

@ -9,6 +9,8 @@
* @version 2.1.0
*/
use Automattic\WooCommerce\Utilities\NumberUtil;
defined( 'ABSPATH' ) || exit;
require_once WC_ABSPATH . 'includes/legacy/class-wc-legacy-cart.php';
@ -776,7 +778,15 @@ class WC_Cart extends WC_Legacy_Cart {
$held_stock = wc_get_held_stock_quantity( $product, $current_session_order_id );
$required_stock = $product_qty_in_cart[ $product->get_stock_managed_by_id() ];
if ( $product->get_stock_quantity() < ( $held_stock + $required_stock ) ) {
/**
* Allows filter if product have enough stock to get added to the cart.
*
* @since 4.6.0
* @param bool $has_stock If have enough stock.
* @param WC_Product $product Product instance.
* @param array $values Cart item values.
*/
if ( apply_filters( 'woocommerce_cart_item_required_stock_is_not_enough', $product->get_stock_quantity() < ( $held_stock + $required_stock ), $product, $values ) ) {
/* translators: 1: product name 2: quantity in stock */
$error->add( 'out-of-stock', sprintf( __( 'Sorry, we do not have enough "%1$s" in stock to fulfill your order (%2$s available). We apologize for any inconvenience caused.', 'woocommerce' ), $product->get_name(), wc_format_stock_quantity_for_display( $product->get_stock_quantity() - $held_stock, $product ) ) );
return $error;
@ -850,8 +860,8 @@ class WC_Cart extends WC_Legacy_Cart {
*/
public function get_tax_totals() {
$shipping_taxes = $this->get_shipping_taxes(); // Shipping taxes are rounded differently, so we will subtract from all taxes, then round and then add them back.
$taxes = $this->get_taxes();
$tax_totals = array();
$taxes = $this->get_taxes();
$tax_totals = array();
foreach ( $taxes as $key => $tax ) {
$code = WC_Tax::get_rate_code( $key );
@ -869,7 +879,7 @@ class WC_Cart extends WC_Legacy_Cart {
if ( isset( $shipping_taxes[ $key ] ) ) {
$tax -= $shipping_taxes[ $key ];
$tax = wc_round_tax_total( $tax );
$tax += round( $shipping_taxes[ $key ], wc_get_price_decimals() );
$tax += NumberUtil::round( $shipping_taxes[ $key ], wc_get_price_decimals() );
unset( $shipping_taxes[ $key ] );
}
$tax_totals[ $code ]->amount += wc_round_tax_total( $tax );
@ -1032,7 +1042,6 @@ class WC_Cart extends WC_Legacy_Cart {
// Gather posted attributes.
$posted_attributes = array();
foreach ( $parent_data->get_attributes() as $attribute ) {
if ( ! $attribute['is_variation'] ) {
continue;
@ -1048,7 +1057,7 @@ class WC_Cart extends WC_Legacy_Cart {
}
// Don't include if it's empty.
if ( ! empty( $value ) ) {
if ( ! empty( $value ) || '0' === $value ) {
$posted_attributes[ $attribute_key ] = $value;
}
}
@ -1520,7 +1529,15 @@ class WC_Cart extends WC_Legacy_Cart {
}
if ( 'yes' === get_option( 'woocommerce_shipping_cost_requires_address' ) ) {
if ( ! $this->get_customer()->get_shipping_country() || ! $this->get_customer()->get_shipping_state() || ! $this->get_customer()->get_shipping_postcode() ) {
$country = $this->get_customer()->get_shipping_country();
if ( ! $country ) {
return false;
}
$country_fields = WC()->countries->get_address_fields( $country, 'shipping_' );
if ( isset( $country_fields['shipping_state'] ) && $country_fields['shipping_state']['required'] && ! $this->get_customer()->get_shipping_state() ) {
return false;
}
if ( isset( $country_fields['shipping_postcode'] ) && $country_fields['shipping_postcode']['required'] && ! $this->get_customer()->get_shipping_postcode() ) {
return false;
}
}

View File

@ -1155,7 +1155,7 @@ class WC_Checkout {
do_action( 'woocommerce_checkout_order_processed', $order_id, $posted_data, $order );
if ( WC()->cart->needs_payment() ) {
if ( $order->needs_payment() ) {
$this->process_order_payment( $order_id, $posted_data['payment_method'] );
} else {
$this->process_order_without_payment( $order_id );

View File

@ -50,7 +50,7 @@ class WC_Countries {
if ( empty( $this->countries ) ) {
$this->countries = apply_filters( 'woocommerce_countries', include WC()->plugin_path() . '/i18n/countries.php' );
if ( apply_filters( 'woocommerce_sort_countries', true ) ) {
uasort( $this->countries, 'wc_ascii_uasort_comparison' );
wc_asort_by_locale( $this->countries );
}
}
@ -1052,6 +1052,14 @@ class WC_Countries {
'required' => false,
),
),
'IN' => array(
'postcode' => array(
'label' => __( 'Pin code', 'woocommerce' ),
),
'state' => array(
'label' => __( 'State', 'woocommerce' ),
),
),
'IT' => array(
'postcode' => array(
'priority' => 65,
@ -1207,9 +1215,15 @@ class WC_Countries {
),
),
'RS' => array(
'state' => array(
'city' => array(
'required' => false,
),
'postcode' => array(
'required' => false,
),
'state' => array(
'label' => __( 'District', 'woocommerce' ),
'required' => false,
'hidden' => true,
),
),
'SG' => array(

View File

@ -8,6 +8,8 @@
* @version 3.0.0
*/
use Automattic\WooCommerce\Utilities\NumberUtil;
defined( 'ABSPATH' ) || exit;
require_once dirname( __FILE__ ) . '/legacy/class-wc-legacy-coupon.php';
@ -446,7 +448,14 @@ class WC_Coupon extends WC_Legacy_Coupon {
$discount = $single ? $discount : $discount * $cart_item_qty;
}
return apply_filters( 'woocommerce_coupon_get_discount_amount', round( min( $discount, $discounting_amount ), wc_get_rounding_precision() ), $discounting_amount, $cart_item, $single, $this );
return apply_filters(
'woocommerce_coupon_get_discount_amount',
NumberUtil::round( min( $discount, $discounting_amount ), wc_get_rounding_precision() ),
$discounting_amount,
$cart_item,
$single,
$this
);
}
/*

View File

@ -35,7 +35,7 @@ class WC_Customer extends WC_Legacy_Customer {
'company' => '',
'address_1' => '',
'address_2' => '',
'city' => '',
'city' => '',
'postcode' => '',
'country' => '',
'state' => '',
@ -48,7 +48,7 @@ class WC_Customer extends WC_Legacy_Customer {
'company' => '',
'address_1' => '',
'address_2' => '',
'city' => '',
'city' => '',
'postcode' => '',
'country' => '',
'state' => '',
@ -859,7 +859,7 @@ class WC_Customer extends WC_Legacy_Customer {
* @param string $address Name of address to set. billing or shipping.
* @param mixed $value Value of the prop.
*/
protected function set_address_prop( $prop, $address = 'billing', $value ) {
protected function set_address_prop( $prop, $address, $value ) {
if ( array_key_exists( $prop, $this->data[ $address ] ) ) {
if ( true === $this->object_read ) {
if ( $value !== $this->data[ $address ][ $prop ] || ( isset( $this->changes[ $address ] ) && array_key_exists( $prop, $this->changes[ $address ] ) ) ) {

View File

@ -6,6 +6,8 @@
* @since 3.2.0
*/
use Automattic\WooCommerce\Utilities\NumberUtil;
defined( 'ABSPATH' ) || exit;
/**
@ -230,7 +232,7 @@ class WC_Discounts {
* @return int
*/
public function get_discounted_price_in_cents( $item ) {
return absint( round( $item->price - $this->get_discount( $item->key, true ) ) );
return absint( NumberUtil::round( $item->price - $this->get_discount( $item->key, true ) ) );
}
/**
@ -359,7 +361,7 @@ class WC_Discounts {
$discounted_price = $this->get_discounted_price_in_cents( $item );
// Get the price we actually want to discount, based on settings.
$price_to_discount = ( 'yes' === get_option( 'woocommerce_calc_discounts_sequentially', 'no' ) ) ? $discounted_price : round( $item->price );
$price_to_discount = ( 'yes' === get_option( 'woocommerce_calc_discounts_sequentially', 'no' ) ) ? $discounted_price : NumberUtil::round( $item->price );
// See how many and what price to apply to.
$apply_quantity = $limit_usage_qty && ( $limit_usage_qty - $applied_count ) < $item->quantity ? $limit_usage_qty - $applied_count : $item->quantity;
@ -910,7 +912,7 @@ class WC_Discounts {
if ( $this->object->get_prices_include_tax() ) {
// Add tax to tax-exclusive subtotal.
$subtotal = $subtotal + wc_add_number_precision( round( $this->object->get_total_tax(), wc_get_price_decimals() ) );
$subtotal = $subtotal + wc_add_number_precision( NumberUtil::round( $this->object->get_total_tax(), wc_get_price_decimals() ) );
}
return $subtotal;

View File

@ -218,17 +218,17 @@ class WC_Emails {
// Include email classes.
include_once dirname( __FILE__ ) . '/emails/class-wc-email.php';
$this->emails['WC_Email_New_Order'] = include 'emails/class-wc-email-new-order.php';
$this->emails['WC_Email_Cancelled_Order'] = include 'emails/class-wc-email-cancelled-order.php';
$this->emails['WC_Email_Failed_Order'] = include 'emails/class-wc-email-failed-order.php';
$this->emails['WC_Email_Customer_On_Hold_Order'] = include 'emails/class-wc-email-customer-on-hold-order.php';
$this->emails['WC_Email_Customer_Processing_Order'] = include 'emails/class-wc-email-customer-processing-order.php';
$this->emails['WC_Email_Customer_Completed_Order'] = include 'emails/class-wc-email-customer-completed-order.php';
$this->emails['WC_Email_Customer_Refunded_Order'] = include 'emails/class-wc-email-customer-refunded-order.php';
$this->emails['WC_Email_Customer_Invoice'] = include 'emails/class-wc-email-customer-invoice.php';
$this->emails['WC_Email_Customer_Note'] = include 'emails/class-wc-email-customer-note.php';
$this->emails['WC_Email_Customer_Reset_Password'] = include 'emails/class-wc-email-customer-reset-password.php';
$this->emails['WC_Email_Customer_New_Account'] = include 'emails/class-wc-email-customer-new-account.php';
$this->emails['WC_Email_New_Order'] = include __DIR__ . '/emails/class-wc-email-new-order.php';
$this->emails['WC_Email_Cancelled_Order'] = include __DIR__ . '/emails/class-wc-email-cancelled-order.php';
$this->emails['WC_Email_Failed_Order'] = include __DIR__ . '/emails/class-wc-email-failed-order.php';
$this->emails['WC_Email_Customer_On_Hold_Order'] = include __DIR__ . '/emails/class-wc-email-customer-on-hold-order.php';
$this->emails['WC_Email_Customer_Processing_Order'] = include __DIR__ . '/emails/class-wc-email-customer-processing-order.php';
$this->emails['WC_Email_Customer_Completed_Order'] = include __DIR__ . '/emails/class-wc-email-customer-completed-order.php';
$this->emails['WC_Email_Customer_Refunded_Order'] = include __DIR__ . '/emails/class-wc-email-customer-refunded-order.php';
$this->emails['WC_Email_Customer_Invoice'] = include __DIR__ . '/emails/class-wc-email-customer-invoice.php';
$this->emails['WC_Email_Customer_Note'] = include __DIR__ . '/emails/class-wc-email-customer-note.php';
$this->emails['WC_Email_Customer_Reset_Password'] = include __DIR__ . '/emails/class-wc-email-customer-reset-password.php';
$this->emails['WC_Email_Customer_New_Account'] = include __DIR__ . '/emails/class-wc-email-customer-new-account.php';
$this->emails = apply_filters( 'woocommerce_email_classes', $this->emails );
}
@ -611,6 +611,17 @@ class WC_Emails {
return;
}
/**
* Determine if the current product should trigger a low stock notification
*
* @param int $product_id - The low stock product id
*
* @since 4.7.0
*/
if ( false === apply_filters( 'woocommerce_should_send_low_stock_notification', true, $product->get_id() ) ) {
return;
}
$subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product low in stock', 'woocommerce' ) );
$message = sprintf(
/* translators: 1: product name 2: items in stock */
@ -638,6 +649,17 @@ class WC_Emails {
return;
}
/**
* Determine if the current product should trigger a no stock notification
*
* @param int $product_id - The out of stock product id
*
* @since 4.6.0
*/
if ( false === apply_filters( 'woocommerce_should_send_no_stock_notification', true, $product->get_id() ) ) {
return;
}
$subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product out of stock', 'woocommerce' ) );
/* translators: %s: product name */
$message = sprintf( __( '%s is out of stock.', 'woocommerce' ), html_entity_decode( wp_strip_all_tags( $product->get_formatted_name() ), ENT_QUOTES, get_bloginfo( 'charset' ) ) );

View File

@ -49,9 +49,25 @@ class WC_Form_Handler {
$user_id = absint( $_GET['id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
}
$value = sprintf( '%d:%s', $user_id, wp_unslash( $_GET['key'] ) ); // phpcs:ignore
// If the reset token is not for the current user, ignore the reset request (don't redirect).
$logged_in_user_id = get_current_user_id();
if ( $logged_in_user_id && $logged_in_user_id !== $user_id ) {
wc_add_notice( __( 'This password reset key is for a different user account. Please log out and try again.', 'woocommerce' ), 'error' );
return;
}
$action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
$value = sprintf( '%d:%s', $user_id, wp_unslash( $_GET['key'] ) ); // phpcs:ignore
WC_Shortcode_My_Account::set_reset_password_cookie( $value );
wp_safe_redirect( add_query_arg( 'show-reset-form', 'true', wc_lostpassword_url() ) );
wp_safe_redirect(
add_query_arg(
array(
'show-reset-form' => 'true',
'action' => $action,
),
wc_lostpassword_url()
)
);
exit;
}
}
@ -826,6 +842,7 @@ class WC_Form_Handler {
$quantity_set = false;
foreach ( $items as $item => $quantity ) {
$quantity = wc_stock_amount( $quantity );
if ( $quantity <= 0 ) {
continue;
}

View File

@ -303,10 +303,10 @@ class WC_Install {
self::create_terms();
self::create_cron_jobs();
self::create_files();
self::maybe_enable_setup_wizard();
self::maybe_create_pages();
self::maybe_set_activation_transients();
self::update_wc_version();
self::maybe_update_db_version();
self::maybe_enable_homescreen();
delete_transient( 'wc_installing' );
@ -351,17 +351,6 @@ class WC_Install {
return $missing_tables;
}
/**
* Check if the homepage should be enabled and set the appropriate option if thats the case.
*
* @since 4.3.0
*/
private static function maybe_enable_homescreen() {
if ( self::is_new_install() && ! get_option( 'woocommerce_homescreen_enabled' ) ) {
add_option( 'woocommerce_homescreen_enabled', 'yes' );
}
}
/**
* Reset any notices added to admin.
*
@ -416,13 +405,12 @@ class WC_Install {
}
/**
* See if we need the wizard or not.
* See if we need to set redirect transients for activation or not.
*
* @since 3.2.0
* @since 4.6.0
*/
private static function maybe_enable_setup_wizard() {
if ( apply_filters( 'woocommerce_enable_setup_wizard', true ) && self::is_new_install() ) {
WC_Admin_Notices::add_notice( 'install', true );
private static function maybe_set_activation_transients() {
if ( self::is_new_install() ) {
set_transient( '_wc_activation_redirect', 1, 30 );
}
}
@ -448,8 +436,7 @@ class WC_Install {
* Update WC version to current.
*/
private static function update_wc_version() {
delete_option( 'woocommerce_version' );
add_option( 'woocommerce_version', WC()->version );
update_option( 'woocommerce_version', WC()->version );
}
/**
@ -492,8 +479,7 @@ class WC_Install {
* @param string|null $version New WooCommerce DB version or null.
*/
public static function update_db_version( $version = null ) {
delete_option( 'woocommerce_db_version' );
add_option( 'woocommerce_db_version', is_null( $version ) ? WC()->version : $version );
update_option( 'woocommerce_db_version', is_null( $version ) ? WC()->version : $version );
}
/**
@ -548,6 +534,15 @@ class WC_Install {
wp_schedule_event( time() + 10, apply_filters( 'woocommerce_tracker_event_recurrence', 'daily' ), 'woocommerce_tracker_send_event' );
}
/**
* Create pages on installation.
*/
public static function maybe_create_pages() {
if ( empty( get_option( 'woocommerce_db_version' ) ) ) {
self::create_pages();
}
}
/**
* Create pages that the plugin relies on, storing page IDs in variables.
*/
@ -753,7 +748,7 @@ class WC_Install {
// 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 ) {
$fk_result = $wpdb->get_row( "SHOW CREATE TABLE {$wpdb->prefix}wc_download_log" ); // WPCS: unprepared SQL ok.
$fk_result = $wpdb->get_row( "SHOW CREATE TABLE {$wpdb->prefix}wc_download_log" );
if ( false === strpos( $fk_result->{'Create Table'}, "fk_{$wpdb->prefix}wc_download_log_permission_id" ) ) {
$wpdb->query(
"ALTER TABLE `{$wpdb->prefix}wc_download_log`
@ -1177,7 +1172,7 @@ CREATE TABLE {$wpdb->prefix}wc_reserved_stock (
*
* @return array
*/
private static function get_core_capabilities() {
public static function get_core_capabilities() {
$capabilities = array();
$capabilities['core'] = array(

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