Merge branch 'master' into update/18389-wizard-steps-improvements
This commit is contained in:
commit
1536d50824
|
@ -6,7 +6,7 @@ When contributing please ensure you follow the guidelines below to help us keep
|
||||||
|
|
||||||
__Please Note:__
|
__Please Note:__
|
||||||
|
|
||||||
GitHub is for _bug reports and contributions only_ - if you have a support question or a request for a customization this is not the right place to post it. Use [WooCommerce Support](https://support.woocommerce.com) for customer support, [WordPress.org](https://wordpress.org/support/plugin/woocommerce) for community support, and for customizations we recommend one of the following services:
|
GitHub is for _bug reports and contributions only_ - if you have a support question or a request for a customization this is not the right place to post it. Use [WooCommerce Support](https://woocommerce.com/contact-us/) for customer support, [WordPress.org](https://wordpress.org/support/plugin/woocommerce) for community support, and for customizations we recommend one of the following services:
|
||||||
|
|
||||||
- [WooExperts](https://woocommerce.com/experts/)
|
- [WooExperts](https://woocommerce.com/experts/)
|
||||||
- [Codeable](https://codeable.io/)
|
- [Codeable](https://codeable.io/)
|
||||||
|
|
|
@ -1,24 +1,22 @@
|
||||||
<!-- Hi there! This form is for reporting bugs and issues specific to the WooCommerce plugin. This is not a support portal. If you need technical support from a human being, please submit a ticket via the helpdesk instead: https://woocommerce.com/contact-us/ -->
|
<!-- This form is for reporting bugs and issues specific to the WooCommerce plugin. This is not a support portal. If you need technical support from a human being, please submit a ticket via the helpdesk instead: https://woocommerce.com/contact-us/ -->
|
||||||
|
|
||||||
<!-- Usage questions can also be directed to the public support forum here: https://wordpress.org/support/plugin/woocommerce, unless this is a question about a premium extension in which case you should use the helpdesk. -->
|
<!-- Usage questions can also be directed to the public support forum here: https://wordpress.org/support/plugin/woocommerce, unless this is a question about a premium extension in which case you should use the helpdesk. -->
|
||||||
|
|
||||||
<!-- If you have a feature request, submit it to: http://ideas.woocommerce.com/forums/133476-woocommerce -->
|
<!-- If you have a feature request, submit it to: http://ideas.woocommerce.com/forums/133476-woocommerce -->
|
||||||
|
|
||||||
|
<!-- If you are a developer who needs a new filter/hook raise a PR instead :) -->
|
||||||
|
|
||||||
<!-- Please be as descriptive as possible; issues lacking the below details, or for any other reason than to report a bug, may be closed without action. -->
|
<!-- Please be as descriptive as possible; issues lacking the below details, or for any other reason than to report a bug, may be closed without action. -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
<!-- Mark completed items with an [x] -->
|
<!-- MARK COMPLETED ITEMS WITH AN [x] -->
|
||||||
|
|
||||||
- [ ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate
|
- [ ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate
|
||||||
- [ ] The issue still exists against the latest `master` branch of WooCommerce on Github (this is **not** the same version as on WordPress.org!)
|
- [ ] The issue still exists against the latest `master` branch of WooCommerce on Github (this is **not** the same version as on WordPress.org!)
|
||||||
- [ ] I have attempted to find the simplest possible steps to reproduce the issue
|
- [ ] I have attempted to find the simplest possible steps to reproduce the issue
|
||||||
- [ ] I have included a failing test as a pull request (Optional)
|
- [ ] I have included a failing test as a pull request (Optional)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Steps to reproduce the issue
|
## Steps to reproduce the issue
|
||||||
|
|
||||||
<!-- We need to be able to reproduce the bug in order to fix it so please be descriptive! -->
|
<!-- We need to be able to reproduce the bug in order to fix it so please be descriptive! -->
|
||||||
|
@ -27,26 +25,20 @@
|
||||||
2.
|
2.
|
||||||
3.
|
3.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Expected/actual behavior
|
## Expected/actual behavior
|
||||||
|
|
||||||
When I follow those steps, I see...
|
When I follow those steps, I see...
|
||||||
|
|
||||||
I was expecting to see...
|
I was expecting to see...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Isolating the problem
|
## Isolating the problem
|
||||||
|
|
||||||
<!-- Mark completed items with an [x] -->
|
<!-- MARK COMPLETED ITEMS WITH AN [x] -->
|
||||||
|
|
||||||
- [ ] This bug happens with only WooCommerce plugin active
|
- [ ] This bug happens with only WooCommerce plugin active
|
||||||
- [ ] This bug happens with a default WordPress theme active, or [Storefront](https://woocommerce.com/storefront/)
|
- [ ] This bug happens with a default WordPress theme active, or [Storefront](https://woocommerce.com/storefront/)
|
||||||
- [ ] I can reproduce this bug consistently using the steps above
|
- [ ] I can reproduce this bug consistently using the steps above
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## WordPress Environment
|
## WordPress Environment
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
|
@ -1,5 +1,47 @@
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 3.3.3 - 2018-02-21 =
|
||||||
|
* Fix - Fixed is_numeric check which was affecting order subtotals/totals when using comma decimal separator.
|
||||||
|
* Fix - Add missing direct script access checks to loop templates.
|
||||||
|
* Fix - Added wp-post-image class to main image so variation images are swapped correctly.
|
||||||
|
* Fix - API - Adjusted schema for products shipping_class_id to integer.
|
||||||
|
* Fix - Made init tooltips event more specific to avoid conflict with Product Invoices extension.
|
||||||
|
|
||||||
|
= 3.3.2 - 2018-02-20 =
|
||||||
|
* Fix - Fixed admin product SKU searching and searching non-published products.
|
||||||
|
* Fix - PHP7.1 notice when image height is empty.
|
||||||
|
* Fix - Prevent repeated update_option calls on page load due to php type juggling.
|
||||||
|
* Fix - Only do unsupported template rendering in the loop to prevent conflicts with other shortcodes on the shop page.
|
||||||
|
* Fix - Don't prepend regular shortcodes with categories.
|
||||||
|
* Fix - If using get_catalog_ordering_args. remove the args when finished.
|
||||||
|
* Fix - Remove "Type" column on attributes table by default unless custom types are defined.
|
||||||
|
* Fix - Use verbose page rules when shop is in the URL, including shop base with category, to prevent 404s.
|
||||||
|
* Fix - Set woocommerce_hide_invisible_variations to true so disabled variation attributes are hidden on product pages.
|
||||||
|
* Fix - Help tip for webhook status.
|
||||||
|
* Fix - Shipping zone documentation help link was printing wrong.
|
||||||
|
* Fix - Stop background processing images when disabled via the filter.
|
||||||
|
* Fix - Only search when a search term is provided. Ignore empty strings.
|
||||||
|
* Fix - Fix check for external resources.
|
||||||
|
* Fix - Show full date for future orders.
|
||||||
|
* Fix - Prevent JS error is 'orders' row is disabled on order screen.
|
||||||
|
* Fix - Fix save of tax settings when no changes have been made.
|
||||||
|
* Fix - Add nonce to logout link on my account page so you do not need to confirm the action.
|
||||||
|
* Fix - Fix plain text entity replacement so currency symbols are included.
|
||||||
|
* Fix - API - Set status after order is created/updated so triggered emails are current.
|
||||||
|
* Fix - API - Fix single webhook endpoint.
|
||||||
|
* Tweak - Added help text for background image processing.
|
||||||
|
* Tweak - Added notice when background image processing is running, with cancel button.
|
||||||
|
* Tweak - Run background image processing less often by tracking changes.
|
||||||
|
* Tweak - Added system status tool to run background image processing manually.
|
||||||
|
* Tweak - If using Jetpack Photon, use that instead of background image processing.
|
||||||
|
* Tweak - Gallery thumbnail image size to handle small, square cropped images.
|
||||||
|
* Tweak - Helper function (and template version bump for image templates) to render gallery images.
|
||||||
|
* Tweak - Add help text for the default category to explain usage.
|
||||||
|
* Tweak - Allow changing the default product category.
|
||||||
|
* Tweak - Tweak mobile view of order preview to improve layout in non-english.
|
||||||
|
* Tweak - If selecting text, don't link to order on row click.
|
||||||
|
* Localization - Remove isle of man state.
|
||||||
|
|
||||||
= 3.3.1 - 2018-02-06 =
|
= 3.3.1 - 2018-02-06 =
|
||||||
* Fix - Added `woocommerce_output_product_categories` to replace `woocommerce_product_subcategories` function to prevent outdated theme template files from outputting categories on the shop and category pages in err.
|
* Fix - Added `woocommerce_output_product_categories` to replace `woocommerce_product_subcategories` function to prevent outdated theme template files from outputting categories on the shop and category pages in err.
|
||||||
* Fix - Prevented columns from being set to anything lower than 1.
|
* Fix - Prevented columns from being set to anything lower than 1.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
div.woocommerce-message{overflow:hidden;position:relative;border-right-color:#cc99c2!important}div.woocommerce-message p{max-width:700px}.woocommerce-message .button-primary,p.woocommerce-actions .button-primary{background:#bb77ae;border-color:#a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,-1px 0 1px #a36597,0 1px 1px #a36597,1px 0 1px #a36597}.woocommerce-message .button-primary:active,.woocommerce-message .button-primary:focus,.woocommerce-message .button-primary:hover,p.woocommerce-actions .button-primary:active,p.woocommerce-actions .button-primary:focus,p.woocommerce-actions .button-primary:hover{background:#a36597;border-color:#a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597}.woocommerce-message a.woocommerce-message-close,p.woocommerce-actions a.woocommerce-message-close{position:absolute;top:0;left:0;padding:10px 21px 10px 15px;font-size:13px;line-height:1.23076923;text-decoration:none}.woocommerce-message a.woocommerce-message-close::before,p.woocommerce-actions a.woocommerce-message-close::before{position:absolute;top:8px;right:0;-webkit-transition:all .1s ease-in-out;transition:all .1s ease-in-out}.woocommerce-message .button-primary,.woocommerce-message .button-secondary,p.woocommerce-actions .button-primary,p.woocommerce-actions .button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-right:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}div.woocommerce-legacy-shipping-notice,div.woocommerce-no-shipping-methods-notice{overflow:hidden;padding:1px 12px}div.woocommerce-legacy-shipping-notice p,div.woocommerce-no-shipping-methods-notice p{position:relative;z-index:1;max-width:700px;line-height:1.5em;margin:12px 0}div.woocommerce-legacy-shipping-notice p.main,div.woocommerce-no-shipping-methods-notice p.main{font-size:1.1em}div.woocommerce-legacy-shipping-notice::before,div.woocommerce-no-shipping-methods-notice::before{content:'\e01b';font-family:WooCommerce;text-align:center;line-height:1;color:#f7f1f6;display:block;width:1em;font-size:20em;top:36px;left:12px;position:absolute}
|
div.woocommerce-message{overflow:hidden;position:relative;border-right-color:#cc99c2!important}div.woocommerce-message p{max-width:700px}div.woocommerce-message p:last-child{max-width:inherit}.woocommerce-message .button-primary,p.woocommerce-actions .button-primary{background:#bb77ae;border-color:#a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,-1px 0 1px #a36597,0 1px 1px #a36597,1px 0 1px #a36597}.woocommerce-message .button-primary:active,.woocommerce-message .button-primary:focus,.woocommerce-message .button-primary:hover,p.woocommerce-actions .button-primary:active,p.woocommerce-actions .button-primary:focus,p.woocommerce-actions .button-primary:hover{background:#a36597;border-color:#a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597}.woocommerce-message a.woocommerce-message-close,p.woocommerce-actions a.woocommerce-message-close{position:absolute;top:0;left:0;padding:10px 21px 10px 15px;font-size:13px;line-height:1.23076923;text-decoration:none}.woocommerce-message a.woocommerce-message-close::before,p.woocommerce-actions a.woocommerce-message-close::before{position:absolute;top:8px;right:0;-webkit-transition:all .1s ease-in-out;transition:all .1s ease-in-out}.woocommerce-message .button-primary,.woocommerce-message .button-secondary,p.woocommerce-actions .button-primary,p.woocommerce-actions .button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-right:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}div.woocommerce-legacy-shipping-notice,div.woocommerce-no-shipping-methods-notice{overflow:hidden;padding:1px 12px}div.woocommerce-legacy-shipping-notice p,div.woocommerce-no-shipping-methods-notice p{position:relative;z-index:1;max-width:700px;line-height:1.5em;margin:12px 0}div.woocommerce-legacy-shipping-notice p.main,div.woocommerce-no-shipping-methods-notice p.main{font-size:1.1em}div.woocommerce-legacy-shipping-notice::before,div.woocommerce-no-shipping-methods-notice::before{content:'\e01b';font-family:WooCommerce;text-align:center;line-height:1;color:#f7f1f6;display:block;width:1em;font-size:20em;top:36px;left:12px;position:absolute}
|
|
@ -1 +1 @@
|
||||||
div.woocommerce-message{overflow:hidden;position:relative;border-left-color:#cc99c2!important}div.woocommerce-message p{max-width:700px}.woocommerce-message .button-primary,p.woocommerce-actions .button-primary{background:#bb77ae;border-color:#a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,1px 0 1px #a36597,0 1px 1px #a36597,-1px 0 1px #a36597}.woocommerce-message .button-primary:active,.woocommerce-message .button-primary:focus,.woocommerce-message .button-primary:hover,p.woocommerce-actions .button-primary:active,p.woocommerce-actions .button-primary:focus,p.woocommerce-actions .button-primary:hover{background:#a36597;border-color:#a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597}.woocommerce-message a.woocommerce-message-close,p.woocommerce-actions a.woocommerce-message-close{position:absolute;top:0;right:0;padding:10px 15px 10px 21px;font-size:13px;line-height:1.23076923;text-decoration:none}.woocommerce-message a.woocommerce-message-close::before,p.woocommerce-actions a.woocommerce-message-close::before{position:absolute;top:8px;left:0;-webkit-transition:all .1s ease-in-out;transition:all .1s ease-in-out}.woocommerce-message .button-primary,.woocommerce-message .button-secondary,p.woocommerce-actions .button-primary,p.woocommerce-actions .button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-left:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}div.woocommerce-legacy-shipping-notice,div.woocommerce-no-shipping-methods-notice{overflow:hidden;padding:1px 12px}div.woocommerce-legacy-shipping-notice p,div.woocommerce-no-shipping-methods-notice p{position:relative;z-index:1;max-width:700px;line-height:1.5em;margin:12px 0}div.woocommerce-legacy-shipping-notice p.main,div.woocommerce-no-shipping-methods-notice p.main{font-size:1.1em}div.woocommerce-legacy-shipping-notice::before,div.woocommerce-no-shipping-methods-notice::before{content:'\e01b';font-family:WooCommerce;text-align:center;line-height:1;color:#f7f1f6;display:block;width:1em;font-size:20em;top:36px;right:12px;position:absolute}
|
div.woocommerce-message{overflow:hidden;position:relative;border-left-color:#cc99c2!important}div.woocommerce-message p{max-width:700px}div.woocommerce-message p:last-child{max-width:inherit}.woocommerce-message .button-primary,p.woocommerce-actions .button-primary{background:#bb77ae;border-color:#a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,1px 0 1px #a36597,0 1px 1px #a36597,-1px 0 1px #a36597}.woocommerce-message .button-primary:active,.woocommerce-message .button-primary:focus,.woocommerce-message .button-primary:hover,p.woocommerce-actions .button-primary:active,p.woocommerce-actions .button-primary:focus,p.woocommerce-actions .button-primary:hover{background:#a36597;border-color:#a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597}.woocommerce-message a.woocommerce-message-close,p.woocommerce-actions a.woocommerce-message-close{position:absolute;top:0;right:0;padding:10px 15px 10px 21px;font-size:13px;line-height:1.23076923;text-decoration:none}.woocommerce-message a.woocommerce-message-close::before,p.woocommerce-actions a.woocommerce-message-close::before{position:absolute;top:8px;left:0;-webkit-transition:all .1s ease-in-out;transition:all .1s ease-in-out}.woocommerce-message .button-primary,.woocommerce-message .button-secondary,p.woocommerce-actions .button-primary,p.woocommerce-actions .button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-left:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}div.woocommerce-legacy-shipping-notice,div.woocommerce-no-shipping-methods-notice{overflow:hidden;padding:1px 12px}div.woocommerce-legacy-shipping-notice p,div.woocommerce-no-shipping-methods-notice p{position:relative;z-index:1;max-width:700px;line-height:1.5em;margin:12px 0}div.woocommerce-legacy-shipping-notice p.main,div.woocommerce-no-shipping-methods-notice p.main{font-size:1.1em}div.woocommerce-legacy-shipping-notice::before,div.woocommerce-no-shipping-methods-notice::before{content:'\e01b';font-family:WooCommerce;text-align:center;line-height:1;color:#f7f1f6;display:block;width:1em;font-size:20em;top:36px;right:12px;position:absolute}
|
|
@ -13,6 +13,9 @@ div.woocommerce-message {
|
||||||
p {
|
p {
|
||||||
max-width: 700px;
|
max-width: 700px;
|
||||||
}
|
}
|
||||||
|
p:last-child {
|
||||||
|
max-width: inherit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.woocommerce-actions,
|
p.woocommerce-actions,
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1152,6 +1152,7 @@ ul.wc_coupon_list_block {
|
||||||
.wc-customer-user, .wc-order-status {
|
.wc-customer-user, .wc-order-status {
|
||||||
label a {
|
label a {
|
||||||
float: right;
|
float: right;
|
||||||
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2208,7 +2209,6 @@ ul.wc_coupon_list_block {
|
||||||
.wc-order-preview-table {
|
.wc-order-preview-table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border-bottom: 1px solid #ccc;
|
|
||||||
th, td {
|
th, td {
|
||||||
padding: 1em 1.5em;
|
padding: 1em 1.5em;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
@ -2247,11 +2247,14 @@ ul.wc_coupon_list_block {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.wc-order-preview-addresses {
|
.wc-order-preview-addresses {
|
||||||
overflow:hidden;
|
overflow: hidden;
|
||||||
.wc-order-preview-address {
|
padding-bottom: 1.5em;
|
||||||
|
|
||||||
|
.wc-order-preview-address,
|
||||||
|
.wc-order-preview-note {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
float: left;
|
float: left;
|
||||||
padding: 1.5em;
|
padding: 1.5em 1.5em 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
|
||||||
|
@ -2260,51 +2263,63 @@ ul.wc_coupon_list_block {
|
||||||
}
|
}
|
||||||
strong {
|
strong {
|
||||||
display: block;
|
display: block;
|
||||||
margin-top: 1em;
|
margin-top: 1.5em;
|
||||||
|
}
|
||||||
|
strong:first-child {
|
||||||
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.wc-action-button,
|
footer {
|
||||||
.wc-action-button-group {
|
.wc-action-button-group {
|
||||||
|
display: inline-block;
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 4px;
|
|
||||||
}
|
}
|
||||||
}
|
.button.button-large {
|
||||||
|
margin-left: 10px;
|
||||||
@media screen and (max-width: 782px) {
|
padding: 0 10px !important;
|
||||||
.wc-action-button-group {
|
line-height: 28px;
|
||||||
label {
|
height: auto;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.wc-action-button-group label {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.wc-action-button-group {
|
.wc-action-button-group {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
line-height: 26px;
|
line-height: 26px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
margin-bottom: 4px;
|
|
||||||
label {
|
label {
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
line-height: 28px;
|
||||||
}
|
}
|
||||||
.wc-action-button-group__items {
|
.wc-action-button-group__items {
|
||||||
white-space: nowrap;
|
display: inline-flex;
|
||||||
|
flex-flow: row wrap;
|
||||||
|
align-content: flex-start;
|
||||||
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
.wc-action-button {
|
.wc-action-button {
|
||||||
margin: 0 0 0 -1px !important;
|
margin: 0 0 0 -1px !important;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
padding: 1px 10px !important;
|
padding: 0 10px !important;
|
||||||
border-radius: 0 !important;
|
border-radius: 0 !important;
|
||||||
float: none;
|
float: none;
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
height: auto;
|
height: auto;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
position:relative;
|
position:relative;
|
||||||
max-width: 175px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
flex: 1 0 auto;
|
||||||
|
box-sizing: border-box;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.wc-action-button:hover,
|
.wc-action-button:hover,
|
||||||
.wc-action-button:focus {
|
.wc-action-button:focus {
|
||||||
|
@ -2321,6 +2336,42 @@ ul.wc_coupon_list_block {
|
||||||
border-bottom-right-radius: 3px !important;
|
border-bottom-right-radius: 3px !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@media screen and (max-width: 782px) {
|
||||||
|
.wc-order-preview footer {
|
||||||
|
.wc-action-button-group .wc-action-button-group__items {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.wc-action-button-group {
|
||||||
|
float: none;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
.button.button-large {
|
||||||
|
width: 100%;
|
||||||
|
float: none;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-type-shop_order .wp-list-table {
|
||||||
|
td.column-order_number {
|
||||||
|
padding-bottom: .5em;
|
||||||
|
}
|
||||||
|
td.column-order_status,
|
||||||
|
td.column-order_date {
|
||||||
|
display: inline-block !important;
|
||||||
|
padding: 0 1em 1em 1em !important;
|
||||||
|
&:before {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
td.column-order_status {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.column-customer_message .note-on {
|
.column-customer_message .note-on {
|
||||||
@include ir();
|
@include ir();
|
||||||
|
@ -5712,7 +5763,8 @@ table.bar_chart {
|
||||||
left: 50%;
|
left: 50%;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
width: 500px;
|
max-width: 100%;
|
||||||
|
min-width: 500px;
|
||||||
article {
|
article {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -646,6 +646,8 @@ body {
|
||||||
|
|
||||||
// Toggle display a list of services.
|
// Toggle display a list of services.
|
||||||
.wc-wizard-services-list-toggle {
|
.wc-wizard-services-list-toggle {
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
.wc-wizard-service-enable::before {
|
.wc-wizard-service-enable::before {
|
||||||
content: "\f343"; // up chevron
|
content: "\f343"; // up chevron
|
||||||
font-family: "dashicons";
|
font-family: "dashicons";
|
||||||
|
@ -665,7 +667,6 @@ body {
|
||||||
.wc-wizard-service-enable input {
|
.wc-wizard-service-enable input {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2114,6 +2114,13 @@ button.pswp__button--zoom:hover {
|
||||||
background: rgba(0,0,0,.05);
|
background: rgba(0,0,0,.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.woocommerce-invalid {
|
||||||
|
#terms {
|
||||||
|
outline: 2px solid red;
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password strength meter
|
* Password strength meter
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -882,7 +882,7 @@ jQuery( function ( $ ) {
|
||||||
var index = $items.find('tr').length + 1;
|
var index = $items.find('tr').length + 1;
|
||||||
var $row = '<tr data-meta_id="0">' +
|
var $row = '<tr data-meta_id="0">' +
|
||||||
'<td>' +
|
'<td>' +
|
||||||
'<input type="text" placeholder="' + woocommerce_admin_meta_boxes_order.placeholder_name + '" name="meta_key[' + $item.attr( 'data-order_item_id' ) + '][new-' + index + ']" />' +
|
'<input type="text" maxlength="255" placeholder="' + woocommerce_admin_meta_boxes_order.placeholder_name + '" name="meta_key[' + $item.attr( 'data-order_item_id' ) + '][new-' + index + ']" />' +
|
||||||
'<textarea placeholder="' + woocommerce_admin_meta_boxes_order.placeholder_value + '" name="meta_value[' + $item.attr( 'data-order_item_id' ) + '][new-' + index + ']"></textarea>' +
|
'<textarea placeholder="' + woocommerce_admin_meta_boxes_order.placeholder_value + '" name="meta_value[' + $item.attr( 'data-order_item_id' ) + '][new-' + index + ']"></textarea>' +
|
||||||
'</td>' +
|
'</td>' +
|
||||||
'<td width="1%"><button class="remove_order_item_meta button">×</button></td>' +
|
'<td width="1%"><button class="remove_order_item_meta button">×</button></td>' +
|
||||||
|
@ -918,9 +918,10 @@ jQuery( function ( $ ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var $rows = $table.find( 'tr.selected' );
|
var $rows = $table.find( 'tr.selected' );
|
||||||
|
var $bulk_edit_wraper = $( 'div.wc-order-item-bulk-edit' );
|
||||||
|
|
||||||
if ( $rows.length ) {
|
if ( $rows.length && $bulk_edit_wraper.children().length > 0 ) {
|
||||||
$( 'div.wc-order-item-bulk-edit' ).slideDown();
|
$bulk_edit_wraper.slideDown();
|
||||||
|
|
||||||
var selected_product = false;
|
var selected_product = false;
|
||||||
|
|
||||||
|
@ -1006,10 +1007,18 @@ jQuery( function ( $ ) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
do_increase_stock: function( e ) {
|
modify_stock: function( e, action ) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
wc_meta_boxes_order_items.block();
|
wc_meta_boxes_order_items.block();
|
||||||
|
|
||||||
|
$( '#woocommerce-order-notes' ).block({
|
||||||
|
message: null,
|
||||||
|
overlayCSS: {
|
||||||
|
background: '#fff',
|
||||||
|
opacity: 0.6
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var $table = $( 'table.woocommerce_order_items' );
|
var $table = $( 'table.woocommerce_order_items' );
|
||||||
var $rows = $table.find( 'tr.selected' );
|
var $rows = $table.find( 'tr.selected' );
|
||||||
var quantities = {};
|
var quantities = {};
|
||||||
|
@ -1027,7 +1036,7 @@ jQuery( function ( $ ) {
|
||||||
order_id: woocommerce_admin_meta_boxes.post_id,
|
order_id: woocommerce_admin_meta_boxes.post_id,
|
||||||
order_item_ids: item_ids,
|
order_item_ids: item_ids,
|
||||||
order_item_qty: quantities,
|
order_item_qty: quantities,
|
||||||
action: 'woocommerce_increase_order_item_stock',
|
action: action,
|
||||||
security: woocommerce_admin_meta_boxes.order_item_nonce
|
security: woocommerce_admin_meta_boxes.order_item_nonce
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1036,46 +1045,42 @@ jQuery( function ( $ ) {
|
||||||
data: data,
|
data: data,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function( response ) {
|
success: function( response ) {
|
||||||
window.alert( response );
|
|
||||||
wc_meta_boxes_order_items.unblock();
|
wc_meta_boxes_order_items.unblock();
|
||||||
|
|
||||||
|
if ( true === response.success ) {
|
||||||
|
$.map( response.data, function( item ) {
|
||||||
|
|
||||||
|
// No items were updated.
|
||||||
|
if ( ! item.success ) {
|
||||||
|
window.alert( item.note );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var order_note_data = {
|
||||||
|
action: 'woocommerce_add_order_note',
|
||||||
|
post_id: woocommerce_admin_meta_boxes.post_id,
|
||||||
|
note: item.note,
|
||||||
|
note_type: '',
|
||||||
|
security: woocommerce_admin_meta_boxes.add_order_note_nonce
|
||||||
|
};
|
||||||
|
|
||||||
|
$.post( woocommerce_admin_meta_boxes.ajax_url, order_note_data, function( response ) {
|
||||||
|
$( 'ul.order_notes' ).prepend( response );
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$( '#woocommerce-order-notes' ).unblock();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
do_increase_stock: function( e ) {
|
||||||
|
wc_meta_boxes_order_items.bulk_actions.modify_stock( e, 'woocommerce_increase_order_item_stock' );
|
||||||
|
},
|
||||||
|
|
||||||
do_reduce_stock: function( e ) {
|
do_reduce_stock: function( e ) {
|
||||||
e.preventDefault();
|
wc_meta_boxes_order_items.bulk_actions.modify_stock( e, 'woocommerce_reduce_order_item_stock' );
|
||||||
wc_meta_boxes_order_items.block();
|
|
||||||
|
|
||||||
var $table = $( 'table.woocommerce_order_items' );
|
|
||||||
var $rows = $table.find( 'tr.selected' );
|
|
||||||
var quantities = {};
|
|
||||||
var item_ids = $.map( $rows, function( $row ) {
|
|
||||||
return parseInt( $( $row ).data( 'order_item_id' ), 10 );
|
|
||||||
});
|
|
||||||
|
|
||||||
$rows.each(function() {
|
|
||||||
if ( $( this ).find( 'input.quantity' ).length ) {
|
|
||||||
quantities[ $( this ).attr( 'data-order_item_id' ) ] = $( this ).find( 'input.quantity' ).val();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var data = {
|
|
||||||
order_id: woocommerce_admin_meta_boxes.post_id,
|
|
||||||
order_item_ids: item_ids,
|
|
||||||
order_item_qty: quantities,
|
|
||||||
action: 'woocommerce_reduce_order_item_stock',
|
|
||||||
security: woocommerce_admin_meta_boxes.order_item_nonce
|
|
||||||
};
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: woocommerce_admin_meta_boxes.ajax_url,
|
|
||||||
data: data,
|
|
||||||
type: 'POST',
|
|
||||||
success: function( response ) {
|
|
||||||
window.alert( response );
|
|
||||||
wc_meta_boxes_order_items.unblock();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -17,7 +17,7 @@
|
||||||
paginationTemplate = wp.template( 'wc-tax-table-pagination' ),
|
paginationTemplate = wp.template( 'wc-tax-table-pagination' ),
|
||||||
$table = $( '.wc_tax_rates' ),
|
$table = $( '.wc_tax_rates' ),
|
||||||
$tbody = $( '#rates' ),
|
$tbody = $( '#rates' ),
|
||||||
$save_button = $( 'input[name="save"]' ),
|
$save_button = $( ':input[name="save"]' ),
|
||||||
$pagination = $( '#rates-pagination' ),
|
$pagination = $( '#rates-pagination' ),
|
||||||
$search_field = $( '#rates-search .wc-tax-rates-search-field' ),
|
$search_field = $( '#rates-search .wc-tax-rates-search-field' ),
|
||||||
$submit = $( '.submit .button-primary[type=submit]' ),
|
$submit = $( '.submit .button-primary[type=submit]' ),
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
changes: self.changes
|
changes: self.changes
|
||||||
},
|
},
|
||||||
success: function( response, textStatus ) {
|
success: function( response, textStatus ) {
|
||||||
if ( 'success' === textStatus ) {
|
if ( 'success' === textStatus && response.success ) {
|
||||||
WCTaxTableModelInstance.set( 'rates', response.data.rates );
|
WCTaxTableModelInstance.set( 'rates', response.data.rates );
|
||||||
WCTaxTableModelInstance.trigger( 'change:rates' );
|
WCTaxTableModelInstance.trigger( 'change:rates' );
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
$pagination.on( 'change', 'input', { view: this }, this.onPageChange );
|
$pagination.on( 'change', 'input', { view: this }, this.onPageChange );
|
||||||
$( window ).on( 'beforeunload', { view: this }, this.unloadConfirmation );
|
$( window ).on( 'beforeunload', { view: this }, this.unloadConfirmation );
|
||||||
$submit.on( 'click', { view: this }, this.onSubmit );
|
$submit.on( 'click', { view: this }, this.onSubmit );
|
||||||
$save_button.attr( 'disabled','disabled' );
|
$save_button.prop( 'disabled', true );
|
||||||
|
|
||||||
// Can bind these directly to the buttons, as they won't get overwritten.
|
// Can bind these directly to the buttons, as they won't get overwritten.
|
||||||
$table.find( '.insert' ).on( 'click', { view: this }, this.onAddNewRow );
|
$table.find( '.insert' ).on( 'click', { view: this }, this.onAddNewRow );
|
||||||
|
@ -319,11 +319,11 @@
|
||||||
},
|
},
|
||||||
setUnloadConfirmation: function() {
|
setUnloadConfirmation: function() {
|
||||||
this.needsUnloadConfirm = true;
|
this.needsUnloadConfirm = true;
|
||||||
$save_button.removeAttr( 'disabled' );
|
$save_button.prop( 'disabled', false );
|
||||||
},
|
},
|
||||||
clearUnloadConfirmation: function() {
|
clearUnloadConfirmation: function() {
|
||||||
this.needsUnloadConfirm = false;
|
this.needsUnloadConfirm = false;
|
||||||
$save_button.attr( 'disabled', 'disabled' );
|
$save_button.prop( 'disabled', true );
|
||||||
},
|
},
|
||||||
unloadConfirmation: function( event ) {
|
unloadConfirmation: function( event ) {
|
||||||
if ( event.data.view.needsUnloadConfirm ) {
|
if ( event.data.view.needsUnloadConfirm ) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -15,8 +15,11 @@ jQuery( function( $ ) {
|
||||||
|
|
||||||
$( table_selector ).find( '.column-handle' ).show();
|
$( table_selector ).find( '.column-handle' ).show();
|
||||||
|
|
||||||
$( document ).ajaxComplete( function() {
|
$( document ).ajaxComplete( function( event, request, options ) {
|
||||||
|
if ( request && 4 === request.readyState && 200 === request.status && options.data && 0 <= options.data.indexOf( '_inline_edit' ) ) {
|
||||||
$( table_selector ).find( '.column-handle' ).show();
|
$( table_selector ).find( '.column-handle' ).show();
|
||||||
|
$( document.body ).trigger( 'init_tooltips' );
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
$( table_selector ).sortable({
|
$( table_selector ).sortable({
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
jQuery(function(e){var t="table.wp-list-table",n='.column-handle input[name="term_id"]';0===e(t).find(".column-handle").length&&(e(t).find("tr:not(.inline-edit-row)").append('<td class="column-handle"></td>'),n=".check-column input"),e(t).find(".column-handle").show(),e(document).ajaxComplete(function(){e(t).find(".column-handle").show()}),e(t).sortable({items:"tbody tr:not(.inline-edit-row)",cursor:"move",handle:".column-handle",axis:"y",forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"product-cat-placeholder",scrollSensitivity:40,start:function(e,t){t.item.hasClass("alternate")||t.item.css("background-color","#ffffff"),t.item.children("td, th").css("border-bottom-width","0"),t.item.css("outline","1px solid #aaa")},stop:function(e,t){t.item.removeAttr("style"),t.item.children("td, th").css("border-bottom-width","1px")},update:function(i,d){var o,a,l=d.item.find(n).val(),c=d.item.find(".parent").html(),r=d.item.prev().find(n).val(),m=d.item.next().find(n).val();r!==undefined&&(o=d.item.prev().find(".parent").html())!==c&&(r=undefined),m!==undefined&&(a=d.item.next().find(".parent").html())!==c&&(m=undefined),r===undefined&&m===undefined||m===undefined&&a===r||m!==undefined&&o===l?e(t).sortable("cancel"):(d.item.find(".check-column input").hide(),d.item.find(".check-column").append('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),e.post(ajaxurl,{action:"woocommerce_term_ordering",id:l,nextid:m,thetaxonomy:woocommerce_term_ordering_params.taxonomy},function(e){"children"===e?window.location.reload():(d.item.find(".check-column input").show(),d.item.find(".check-column").find("img").remove())}),e("table.widefat tbody tr").each(function(){jQuery("table.widefat tbody tr").index(this)%2==0?jQuery(this).addClass("alternate"):jQuery(this).removeClass("alternate")}))}})});
|
jQuery(function(e){var t="table.wp-list-table",n='.column-handle input[name="term_id"]';0===e(t).find(".column-handle").length&&(e(t).find("tr:not(.inline-edit-row)").append('<td class="column-handle"></td>'),n=".check-column input"),e(t).find(".column-handle").show(),e(document).ajaxComplete(function(n,i,d){i&&4===i.readyState&&200===i.status&&d.data&&0<=d.data.indexOf("_inline_edit")&&(e(t).find(".column-handle").show(),e(document.body).trigger("init_tooltips"))}),e(t).sortable({items:"tbody tr:not(.inline-edit-row)",cursor:"move",handle:".column-handle",axis:"y",forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"product-cat-placeholder",scrollSensitivity:40,start:function(e,t){t.item.hasClass("alternate")||t.item.css("background-color","#ffffff"),t.item.children("td, th").css("border-bottom-width","0"),t.item.css("outline","1px solid #aaa")},stop:function(e,t){t.item.removeAttr("style"),t.item.children("td, th").css("border-bottom-width","1px")},update:function(i,d){var o,a,l=d.item.find(n).val(),r=d.item.find(".parent").html(),c=d.item.prev().find(n).val(),m=d.item.next().find(n).val();c!==undefined&&(o=d.item.prev().find(".parent").html())!==r&&(c=undefined),m!==undefined&&(a=d.item.next().find(".parent").html())!==r&&(m=undefined),c===undefined&&m===undefined||m===undefined&&a===c||m!==undefined&&o===l?e(t).sortable("cancel"):(d.item.find(".check-column input").hide(),d.item.find(".check-column").append('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),e.post(ajaxurl,{action:"woocommerce_term_ordering",id:l,nextid:m,thetaxonomy:woocommerce_term_ordering_params.taxonomy},function(e){"children"===e?window.location.reload():(d.item.find(".check-column input").show(),d.item.find(".check-column").find("img").remove())}),e("table.widefat tbody tr").each(function(){jQuery("table.widefat tbody tr").index(this)%2==0?jQuery(this).addClass("alternate"):jQuery(this).removeClass("alternate")}))}})});
|
|
@ -22,10 +22,14 @@ jQuery( function( $ ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( window.getSelection && window.getSelection().toString().length ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
var $row = $( this ).closest( 'tr' ),
|
var $row = $( this ).closest( 'tr' ),
|
||||||
href = $row.find( 'a.order-view' ).attr( 'href' );
|
href = $row.find( 'a.order-view' ).attr( 'href' );
|
||||||
|
|
||||||
if ( href.length ) {
|
if ( href && href.length ) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ( e.metaKey || e.ctrlKey ) {
|
if ( e.metaKey || e.ctrlKey ) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
jQuery(function(e){if("undefined"==typeof wc_orders_params)return!1;var r=function(){e(document).on("click",".post-type-shop_order .wp-list-table tbody td",this.onRowClick).on("click",".order-preview:not(.disabled)",this.onPreview)};r.prototype.onRowClick=function(r){if(e(r.target).filter("a, a *, .no-link, .no-link *").length)return!0;var a=e(this).closest("tr").find("a.order-view").attr("href");a.length&&(r.preventDefault(),r.metaKey||r.ctrlKey?window.open(a,"_blank"):window.location=a)},r.prototype.onPreview=function(){var r=e(this),a=r.data("order-id");return r.data("order-data")?e(this).WCBackboneModal({template:"wc-modal-view-order",variable:r.data("order-data")}):(r.addClass("disabled"),e.ajax({url:wc_orders_params.ajax_url,data:{order_id:a,action:"woocommerce_get_order_details",security:wc_orders_params.preview_nonce},type:"GET",success:function(a){e(".order-preview").removeClass("disabled"),a.success&&(r.data("order-data",a.data),e(this).WCBackboneModal({template:"wc-modal-view-order",variable:a.data}))}})),!1},new r});
|
jQuery(function(e){if("undefined"==typeof wc_orders_params)return!1;var t=function(){e(document).on("click",".post-type-shop_order .wp-list-table tbody td",this.onRowClick).on("click",".order-preview:not(.disabled)",this.onPreview)};t.prototype.onRowClick=function(t){if(e(t.target).filter("a, a *, .no-link, .no-link *").length)return!0;if(window.getSelection&&window.getSelection().toString().length)return!0;var r=e(this).closest("tr").find("a.order-view").attr("href");r&&r.length&&(t.preventDefault(),t.metaKey||t.ctrlKey?window.open(r,"_blank"):window.location=r)},t.prototype.onPreview=function(){var t=e(this),r=t.data("order-id");return t.data("order-data")?e(this).WCBackboneModal({template:"wc-modal-view-order",variable:t.data("order-data")}):(t.addClass("disabled"),e.ajax({url:wc_orders_params.ajax_url,data:{order_id:r,action:"woocommerce_get_order_details",security:wc_orders_params.preview_nonce},type:"GET",success:function(r){e(".order-preview").removeClass("disabled"),r.success&&(t.data("order-data",r.data),e(this).WCBackboneModal({template:"wc-modal-view-order",variable:r.data}))}})),!1},new t});
|
|
@ -48,7 +48,7 @@ jQuery( function( $ ) {
|
||||||
$checkbox.prop( 'checked', ! $checkbox.prop( 'checked' ) ).change();
|
$checkbox.prop( 'checked', ! $checkbox.prop( 'checked' ) ).change();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
$( '.wc-wizard-services-list-toggle' ).on( 'change', '.wc-wizard-service-enable input', function() {
|
$( '.wc-wizard-services-list-toggle' ).on( 'click', function() {
|
||||||
$( this ).closest( '.wc-wizard-services-list-toggle' ).toggleClass( 'closed' );
|
$( this ).closest( '.wc-wizard-services-list-toggle' ).toggleClass( 'closed' );
|
||||||
$( this ).closest( '.wc-wizard-services' ).find( '.wc-wizard-service-item' )
|
$( this ).closest( '.wc-wizard-services' ).find( '.wc-wizard-service-item' )
|
||||||
.slideToggle()
|
.slideToggle()
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
jQuery(function(e){function i(){e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}function s(){e("form.activate-jetpack").submit()}function t(){wp.ajax.post("setup_wizard_check_jetpack").then(function(e){if(!e||!e.is_active||"yes"===e.is_active)return s();setTimeout(t,3e3)}).fail(function(){s()})}e(".button-next").on("click",function(){var s=e(this).parents("form").get(0);return("function"!=typeof s.checkValidity||s.checkValidity())&&i(),!0}),e(".wc-wizard-services").on("change",".wc-wizard-service-enable input",function(){e(this).is(":checked")?(e(this).closest(".wc-wizard-service-toggle").removeClass("disabled"),e(this).closest(".wc-wizard-service-item").addClass("checked"),e(this).closest(".wc-wizard-service-item").find(".wc-wizard-service-settings").removeClass("hide")):(e(this).closest(".wc-wizard-service-toggle").addClass("disabled"),e(this).closest(".wc-wizard-service-item").removeClass("checked"),e(this).closest(".wc-wizard-service-item").find(".wc-wizard-service-settings").addClass("hide"))}),e(".wc-wizard-services").on("click",".wc-wizard-service-enable",function(i){if(e(i.target).is("input"))i.stopPropagation();else{var s=e(this).find('input[type="checkbox"]');s.prop("checked",!s.prop("checked")).change()}}),e(".wc-wizard-services-list-toggle").on("change",".wc-wizard-service-enable input",function(){e(this).closest(".wc-wizard-services-list-toggle").toggleClass("closed"),e(this).closest(".wc-wizard-services").find(".wc-wizard-service-item").slideToggle().css("display","flex")}),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-select .method",function(i){var s=e(this).closest(".wc-wizard-service-description"),t=i.target.value,c=s.find(".shipping-method-descriptions");c.find(".shipping-method-description").addClass("hide"),c.find("."+t).removeClass("hide");var r=s.find(".shipping-method-settings");r.find(".shipping-method-setting").addClass("hide").find(".shipping-method-required-field").prop("required",!1),r.find("."+t).removeClass("hide").find(".shipping-method-required-field").prop("required",!0)}).find(".wc-wizard-shipping-method-select .method").change(),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-enable",function(){var i=e(this).is(":checked");e(this).closest(".wc-wizard-service-item").find(".shipping-method-required-field").prop("required",i)}),e(".activate-jetpack").on("click",".button-primary",function(e){if(i(),"no"===wc_setup_params.pending_jetpack_install)return!0;e.preventDefault(),t()}),e(".wc-wizard-services").on("change","input#stripe_create_account, input#ppec_paypal_reroute_requests",function(){e(this).is(":checked")?(e(this).closest(".wc-wizard-service-settings").find("input.payment-email-input").prop("required",!0),e(this).closest(".wc-wizard-service-settings").find(".wc-wizard-service-setting-stripe_email, .wc-wizard-service-setting-ppec_paypal_email").show()):(e(this).closest(".wc-wizard-service-settings").find("input.payment-email-input").prop("required",!1),e(this).closest(".wc-wizard-service-settings").find(".wc-wizard-service-setting-stripe_email, .wc-wizard-service-setting-ppec_paypal_email").hide())}).find("input#stripe_create_account, input#ppec_paypal_reroute_requests").change(),e("select#store_country_state").on("change",function(){var i=this.value.split(":")[0];e("select#currency_code").val(wc_setup_currencies[i]).change()})});
|
jQuery(function(e){function i(){e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}function s(){e("form.activate-jetpack").submit()}function t(){wp.ajax.post("setup_wizard_check_jetpack").then(function(e){if(!e||!e.is_active||"yes"===e.is_active)return s();setTimeout(t,3e3)}).fail(function(){s()})}e(".button-next").on("click",function(){var s=e(this).parents("form").get(0);return("function"!=typeof s.checkValidity||s.checkValidity())&&i(),!0}),e(".wc-wizard-services").on("change",".wc-wizard-service-enable input",function(){e(this).is(":checked")?(e(this).closest(".wc-wizard-service-toggle").removeClass("disabled"),e(this).closest(".wc-wizard-service-item").addClass("checked"),e(this).closest(".wc-wizard-service-item").find(".wc-wizard-service-settings").removeClass("hide")):(e(this).closest(".wc-wizard-service-toggle").addClass("disabled"),e(this).closest(".wc-wizard-service-item").removeClass("checked"),e(this).closest(".wc-wizard-service-item").find(".wc-wizard-service-settings").addClass("hide"))}),e(".wc-wizard-services").on("click",".wc-wizard-service-enable",function(i){if(e(i.target).is("input"))i.stopPropagation();else{var s=e(this).find('input[type="checkbox"]');s.prop("checked",!s.prop("checked")).change()}}),e(".wc-wizard-services-list-toggle").on("click",function(){e(this).closest(".wc-wizard-services-list-toggle").toggleClass("closed"),e(this).closest(".wc-wizard-services").find(".wc-wizard-service-item").slideToggle().css("display","flex")}),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-select .method",function(i){var s=e(this).closest(".wc-wizard-service-description"),t=i.target.value,c=s.find(".shipping-method-descriptions");c.find(".shipping-method-description").addClass("hide"),c.find("."+t).removeClass("hide");var r=s.find(".shipping-method-settings");r.find(".shipping-method-setting").addClass("hide").find(".shipping-method-required-field").prop("required",!1),r.find("."+t).removeClass("hide").find(".shipping-method-required-field").prop("required",!0)}).find(".wc-wizard-shipping-method-select .method").change(),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-enable",function(){var i=e(this).is(":checked");e(this).closest(".wc-wizard-service-item").find(".shipping-method-required-field").prop("required",i)}),e(".activate-jetpack").on("click",".button-primary",function(e){if(i(),"no"===wc_setup_params.pending_jetpack_install)return!0;e.preventDefault(),t()}),e(".wc-wizard-services").on("change","input#stripe_create_account, input#ppec_paypal_reroute_requests",function(){e(this).is(":checked")?(e(this).closest(".wc-wizard-service-settings").find("input.payment-email-input").prop("required",!0),e(this).closest(".wc-wizard-service-settings").find(".wc-wizard-service-setting-stripe_email, .wc-wizard-service-setting-ppec_paypal_email").show()):(e(this).closest(".wc-wizard-service-settings").find("input.payment-email-input").prop("required",!1),e(this).closest(".wc-wizard-service-settings").find(".wc-wizard-service-setting-stripe_email, .wc-wizard-service-setting-ppec_paypal_email").hide())}).find("input#stripe_create_account, input#ppec_paypal_reroute_requests").change(),e("select#store_country_state").on("change",function(){var i=this.value.split(":")[0];e("select#currency_code").val(wc_setup_currencies[i]).change()})});
|
|
@ -160,10 +160,6 @@ jQuery( function ( $ ) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tooltips
|
// Tooltips
|
||||||
$( document ).ajaxComplete( function() {
|
|
||||||
$( document.body ).trigger( 'init_tooltips' );
|
|
||||||
} );
|
|
||||||
|
|
||||||
$( document.body ).trigger( 'init_tooltips' );
|
$( document.body ).trigger( 'init_tooltips' );
|
||||||
|
|
||||||
// wc_input_table tables
|
// wc_input_table tables
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* jQuery FlexSlider v2.6.1
|
* jQuery FlexSlider v2.7.0
|
||||||
* Copyright 2012 WooThemes
|
* Copyright 2012 WooThemes
|
||||||
* Contributing Author: Tyler Smith
|
* Contributing Author: Tyler Smith
|
||||||
*/
|
*/
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
var namespace = slider.vars.namespace,
|
var namespace = slider.vars.namespace,
|
||||||
msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
|
msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
|
||||||
touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
|
touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
|
||||||
// depricating this idea, as devices are being released with both of these events
|
// deprecating this idea, as devices are being released with both of these events
|
||||||
eventType = "click touchend MSPointerUp keyup",
|
eventType = "click touchend MSPointerUp keyup",
|
||||||
watchedEvent = "",
|
watchedEvent = "",
|
||||||
watchedEventClearTimer,
|
watchedEventClearTimer,
|
||||||
|
@ -792,12 +792,8 @@
|
||||||
}
|
}
|
||||||
} else { // FADE:
|
} else { // FADE:
|
||||||
if (!touch) {
|
if (!touch) {
|
||||||
//slider.slides.eq(slider.currentSlide).fadeOut(slider.vars.animationSpeed, slider.vars.easing);
|
|
||||||
//slider.slides.eq(target).fadeIn(slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
|
|
||||||
|
|
||||||
slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
|
slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
|
||||||
slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
|
slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
|
slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
|
||||||
slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
|
slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
|
||||||
|
@ -894,7 +890,7 @@
|
||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
|
|
||||||
return (posCalc * -1) + "px";
|
return (posCalc * ((slider.vars.rtl)?1:-1)) + "px";
|
||||||
}());
|
}());
|
||||||
|
|
||||||
if (slider.transitions) {
|
if (slider.transitions) {
|
||||||
|
@ -954,7 +950,7 @@
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
slider.doMath();
|
slider.doMath();
|
||||||
if(slider.vars.rtl){
|
if(slider.vars.rtl){
|
||||||
slider.newSlides.css({"width": slider.computedW, "marginLeft" : slider.computedM, "float": "right", "display": "block"});
|
slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
|
slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1742,7 +1742,10 @@ S2.define('select2/selection/multiple',[
|
||||||
var selection = data[d];
|
var selection = data[d];
|
||||||
|
|
||||||
var $selection = this.selectionContainer();
|
var $selection = this.selectionContainer();
|
||||||
var formatted = this.display(selection, $selection).trim();
|
var formatted = this.display(selection, $selection);
|
||||||
|
if ('string' === typeof formatted) {
|
||||||
|
formatted = formatted.trim();
|
||||||
|
}
|
||||||
|
|
||||||
$selection.append(formatted);
|
$selection.append(formatted);
|
||||||
$selection.prop('title', selection.title || selection.text);
|
$selection.prop('title', selection.title || selection.text);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1742,7 +1742,10 @@ S2.define('select2/selection/multiple',[
|
||||||
var selection = data[d];
|
var selection = data[d];
|
||||||
|
|
||||||
var $selection = this.selectionContainer();
|
var $selection = this.selectionContainer();
|
||||||
var formatted = this.display(selection, $selection).trim();
|
var formatted = this.display(selection, $selection);
|
||||||
|
if ('string' === typeof formatted) {
|
||||||
|
formatted = formatted.trim();
|
||||||
|
}
|
||||||
|
|
||||||
$selection.append(formatted);
|
$selection.append(formatted);
|
||||||
$selection.prop('title', selection.title || selection.text);
|
$selection.prop('title', selection.title || selection.text);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,7 +12,7 @@
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"squizlabs/php_codesniffer": "*",
|
"squizlabs/php_codesniffer": "*",
|
||||||
"wp-coding-standards/wpcs": "^0.14",
|
"wp-coding-standards/wpcs": "^0.14",
|
||||||
"phpunit/phpunit": "6.2.3",
|
"phpunit/phpunit": "6.*",
|
||||||
"woocommerce/woocommerce-git-hooks": "*",
|
"woocommerce/woocommerce-git-hooks": "*",
|
||||||
"woocommerce/woocommerce-sniffs": "*",
|
"woocommerce/woocommerce-sniffs": "*",
|
||||||
"wimg/php-compatibility": "^8.0",
|
"wimg/php-compatibility": "^8.0",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "b01e9a575ecf7723e10f3068ea39350a",
|
"content-hash": "bc2c57d2be29888a0e4c3a09ec26cbe3",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "composer/installers",
|
"name": "composer/installers",
|
||||||
|
@ -2064,16 +2064,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpspec/prophecy",
|
"name": "phpspec/prophecy",
|
||||||
"version": "1.7.3",
|
"version": "1.7.5",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpspec/prophecy.git",
|
"url": "https://github.com/phpspec/prophecy.git",
|
||||||
"reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf"
|
"reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
|
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/dfd6be44111a7c41c2e884a336cc4f461b3b2401",
|
||||||
"reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
|
"reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -2085,7 +2085,7 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpspec/phpspec": "^2.5|^3.2",
|
"phpspec/phpspec": "^2.5|^3.2",
|
||||||
"phpunit/phpunit": "^4.8.35 || ^5.7"
|
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
|
@ -2123,7 +2123,7 @@
|
||||||
"spy",
|
"spy",
|
||||||
"stub"
|
"stub"
|
||||||
],
|
],
|
||||||
"time": "2017-11-24T13:59:53+00:00"
|
"time": "2018-02-19T10:16:54+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
|
@ -2376,16 +2376,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "6.2.3",
|
"version": "6.5.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "fa5711d0559fc4b64deba0702be52d41434cbcb7"
|
"reference": "6bd77b57707c236833d2b57b968e403df060c9d9"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa5711d0559fc4b64deba0702be52d41434cbcb7",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6bd77b57707c236833d2b57b968e403df060c9d9",
|
||||||
"reference": "fa5711d0559fc4b64deba0702be52d41434cbcb7",
|
"reference": "6bd77b57707c236833d2b57b968e403df060c9d9",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -2394,24 +2394,24 @@
|
||||||
"ext-libxml": "*",
|
"ext-libxml": "*",
|
||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"myclabs/deep-copy": "^1.3",
|
"myclabs/deep-copy": "^1.6.1",
|
||||||
"phar-io/manifest": "^1.0.1",
|
"phar-io/manifest": "^1.0.1",
|
||||||
"phar-io/version": "^1.0",
|
"phar-io/version": "^1.0",
|
||||||
"php": "^7.0",
|
"php": "^7.0",
|
||||||
"phpspec/prophecy": "^1.7",
|
"phpspec/prophecy": "^1.7",
|
||||||
"phpunit/php-code-coverage": "^5.2",
|
"phpunit/php-code-coverage": "^5.3",
|
||||||
"phpunit/php-file-iterator": "^1.4",
|
"phpunit/php-file-iterator": "^1.4.3",
|
||||||
"phpunit/php-text-template": "^1.2",
|
"phpunit/php-text-template": "^1.2.1",
|
||||||
"phpunit/php-timer": "^1.0.6",
|
"phpunit/php-timer": "^1.0.9",
|
||||||
"phpunit/phpunit-mock-objects": "^4.0",
|
"phpunit/phpunit-mock-objects": "^5.0.5",
|
||||||
"sebastian/comparator": "^2.0",
|
"sebastian/comparator": "^2.1",
|
||||||
"sebastian/diff": "^1.4.3 || ^2.0",
|
"sebastian/diff": "^2.0",
|
||||||
"sebastian/environment": "^3.0.2",
|
"sebastian/environment": "^3.1",
|
||||||
"sebastian/exporter": "^3.1",
|
"sebastian/exporter": "^3.1",
|
||||||
"sebastian/global-state": "^1.1 || ^2.0",
|
"sebastian/global-state": "^2.0",
|
||||||
"sebastian/object-enumerator": "^3.0.2",
|
"sebastian/object-enumerator": "^3.0.3",
|
||||||
"sebastian/resource-operations": "^1.0",
|
"sebastian/resource-operations": "^1.0",
|
||||||
"sebastian/version": "^2.0"
|
"sebastian/version": "^2.0.1"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"phpdocumentor/reflection-docblock": "3.0.2",
|
"phpdocumentor/reflection-docblock": "3.0.2",
|
||||||
|
@ -2430,7 +2430,7 @@
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "6.2.x-dev"
|
"dev-master": "6.5.x-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -2456,33 +2456,33 @@
|
||||||
"testing",
|
"testing",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2017-07-03T15:54:24+00:00"
|
"time": "2018-02-26T07:01:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit-mock-objects",
|
"name": "phpunit/phpunit-mock-objects",
|
||||||
"version": "4.0.4",
|
"version": "5.0.6",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
||||||
"reference": "2f789b59ab89669015ad984afa350c4ec577ade0"
|
"reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/2f789b59ab89669015ad984afa350c4ec577ade0",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/33fd41a76e746b8fa96d00b49a23dadfa8334cdf",
|
||||||
"reference": "2f789b59ab89669015ad984afa350c4ec577ade0",
|
"reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"doctrine/instantiator": "^1.0.5",
|
"doctrine/instantiator": "^1.0.5",
|
||||||
"php": "^7.0",
|
"php": "^7.0",
|
||||||
"phpunit/php-text-template": "^1.2.1",
|
"phpunit/php-text-template": "^1.2.1",
|
||||||
"sebastian/exporter": "^3.0"
|
"sebastian/exporter": "^3.1"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"phpunit/phpunit": "<6.0"
|
"phpunit/phpunit": "<6.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^6.0"
|
"phpunit/phpunit": "^6.5"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"ext-soap": "*"
|
"ext-soap": "*"
|
||||||
|
@ -2490,7 +2490,7 @@
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "4.0.x-dev"
|
"dev-master": "5.0.x-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -2505,7 +2505,7 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Sebastian Bergmann",
|
"name": "Sebastian Bergmann",
|
||||||
"email": "sb@sebastian-bergmann.de",
|
"email": "sebastian@phpunit.de",
|
||||||
"role": "lead"
|
"role": "lead"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -2515,7 +2515,7 @@
|
||||||
"mock",
|
"mock",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2017-08-03T14:08:16+00:00"
|
"time": "2018-01-06T05:45:45+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psr/log",
|
"name": "psr/log",
|
||||||
|
@ -3174,16 +3174,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "squizlabs/php_codesniffer",
|
"name": "squizlabs/php_codesniffer",
|
||||||
"version": "3.2.2",
|
"version": "3.2.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
||||||
"reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1"
|
"reference": "4842476c434e375f9d3182ff7b89059583aa8b27"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d7c00c3000ac0ce79c96fcbfef86b49a71158cd1",
|
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/4842476c434e375f9d3182ff7b89059583aa8b27",
|
||||||
"reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1",
|
"reference": "4842476c434e375f9d3182ff7b89059583aa8b27",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -3193,7 +3193,7 @@
|
||||||
"php": ">=5.4.0"
|
"php": ">=5.4.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0"
|
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
||||||
},
|
},
|
||||||
"bin": [
|
"bin": [
|
||||||
"bin/phpcs",
|
"bin/phpcs",
|
||||||
|
@ -3221,20 +3221,20 @@
|
||||||
"phpcs",
|
"phpcs",
|
||||||
"standards"
|
"standards"
|
||||||
],
|
],
|
||||||
"time": "2017-12-19T21:44:46+00:00"
|
"time": "2018-02-20T21:35:23+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/console",
|
"name": "symfony/console",
|
||||||
"version": "v2.8.34",
|
"version": "v2.8.35",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/console.git",
|
"url": "https://github.com/symfony/console.git",
|
||||||
"reference": "162ca7d0ea597599967aa63b23418e747da0896b"
|
"reference": "a6ff8b2ffa4eb43046828b303af2e3fedadacc27"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/console/zipball/162ca7d0ea597599967aa63b23418e747da0896b",
|
"url": "https://api.github.com/repos/symfony/console/zipball/a6ff8b2ffa4eb43046828b303af2e3fedadacc27",
|
||||||
"reference": "162ca7d0ea597599967aa63b23418e747da0896b",
|
"reference": "a6ff8b2ffa4eb43046828b303af2e3fedadacc27",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -3282,7 +3282,7 @@
|
||||||
],
|
],
|
||||||
"description": "Symfony Console Component",
|
"description": "Symfony Console Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2018-01-29T08:54:45+00:00"
|
"time": "2018-02-26T15:33:21+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/debug",
|
"name": "symfony/debug",
|
||||||
|
@ -3457,7 +3457,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/yaml",
|
"name": "symfony/yaml",
|
||||||
"version": "v2.8.34",
|
"version": "v2.8.35",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/yaml.git",
|
"url": "https://github.com/symfony/yaml.git",
|
||||||
|
@ -3546,16 +3546,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "tracy/tracy",
|
"name": "tracy/tracy",
|
||||||
"version": "v2.4.11",
|
"version": "v2.4.12",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/nette/tracy.git",
|
"url": "https://github.com/nette/tracy.git",
|
||||||
"reference": "bcb93a9d4347be8779c83b200b64ea6f52d6f9ed"
|
"reference": "4182ce7b92f67002509b7fa2fc34bd84deea0b24"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/nette/tracy/zipball/bcb93a9d4347be8779c83b200b64ea6f52d6f9ed",
|
"url": "https://api.github.com/repos/nette/tracy/zipball/4182ce7b92f67002509b7fa2fc34bd84deea0b24",
|
||||||
"reference": "bcb93a9d4347be8779c83b200b64ea6f52d6f9ed",
|
"reference": "4182ce7b92f67002509b7fa2fc34bd84deea0b24",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -3607,7 +3607,7 @@
|
||||||
"nette",
|
"nette",
|
||||||
"profiler"
|
"profiler"
|
||||||
],
|
],
|
||||||
"time": "2018-02-01T18:11:38+00:00"
|
"time": "2018-02-28T00:49:47+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "webmozart/assert",
|
"name": "webmozart/assert",
|
||||||
|
@ -3787,16 +3787,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "wp-coding-standards/wpcs",
|
"name": "wp-coding-standards/wpcs",
|
||||||
"version": "0.14.0",
|
"version": "0.14.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
|
"url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
|
||||||
"reference": "8cadf48fa1c70b2381988e0a79e029e011a8f41c"
|
"reference": "cf6b310caad735816caef7573295f8a534374706"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/8cadf48fa1c70b2381988e0a79e029e011a8f41c",
|
"url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/cf6b310caad735816caef7573295f8a534374706",
|
||||||
"reference": "8cadf48fa1c70b2381988e0a79e029e011a8f41c",
|
"reference": "cf6b310caad735816caef7573295f8a534374706",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -3823,7 +3823,7 @@
|
||||||
"standards",
|
"standards",
|
||||||
"wordpress"
|
"wordpress"
|
||||||
],
|
],
|
||||||
"time": "2017-11-01T15:10:46+00:00"
|
"time": "2018-02-16T01:57:48+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
|
|
|
@ -4,15 +4,11 @@
|
||||||
*
|
*
|
||||||
* Returns an array of continents.
|
* Returns an array of continents.
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.5.0
|
* @version 2.5.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'AF' => array(
|
'AF' => array(
|
||||||
|
|
|
@ -4,15 +4,11 @@
|
||||||
*
|
*
|
||||||
* Returns an array of countries and codes.
|
* Returns an array of countries and codes.
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.5.0
|
* @version 2.5.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'AF' => __( 'Afghanistan', 'woocommerce' ),
|
'AF' => __( 'Afghanistan', 'woocommerce' ),
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
/**
|
||||||
exit;
|
* Locales information
|
||||||
}
|
*
|
||||||
|
* @package WooCommerce/i18n
|
||||||
|
* @version 3.4.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'AU' => array(
|
'AU' => array(
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Angola states
|
* Angola states
|
||||||
*
|
*
|
||||||
* @author Marcio Zebedeu
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['AO'] = array(
|
$states['AO'] = array(
|
||||||
'BGO' => __( 'Bengo', 'woocommerce' ),
|
'BGO' => __( 'Bengo', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Argentinian provinces
|
* Argentinian provinces
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.4.0
|
* @version 2.4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['AR'] = array(
|
$states['AR'] = array(
|
||||||
'C' => __( 'Ciudad Autónoma de Buenos Aires', 'woocommerce' ),
|
'C' => __( 'Ciudad Autónoma de Buenos Aires', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Australian states
|
* Australian states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['AU'] = array(
|
$states['AU'] = array(
|
||||||
'ACT' => __( 'Australian Capital Territory', 'woocommerce' ),
|
'ACT' => __( 'Australian Capital Territory', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Bangladeshi states (districts)
|
* Bangladeshi states (districts)
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['BD'] = array(
|
$states['BD'] = array(
|
||||||
'BAG' => __( 'Bagerhat', 'woocommerce' ),
|
'BAG' => __( 'Bagerhat', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Bulgarian states
|
* Bulgarian states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['BG'] = array(
|
$states['BG'] = array(
|
||||||
'BG-01' => __( 'Blagoevgrad', 'woocommerce' ),
|
'BG-01' => __( 'Blagoevgrad', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Bolivian states
|
* Bolivian states
|
||||||
*
|
*
|
||||||
* @author Roman Random
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 3.1.0
|
* @version 3.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['BO'] = array(
|
$states['BO'] = array(
|
||||||
'B' => __( 'Chuquisaca', 'woocommerce' ),
|
'B' => __( 'Chuquisaca', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Brazillian states
|
* Brazillian states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['BR'] = array(
|
$states['BR'] = array(
|
||||||
'AC' => __( 'Acre', 'woocommerce' ),
|
'AC' => __( 'Acre', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Canadian states
|
* Canadian states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['CA'] = array(
|
$states['CA'] = array(
|
||||||
'AB' => __( 'Alberta', 'woocommerce' ),
|
'AB' => __( 'Alberta', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Cantons of Switzerland
|
* Cantons of Switzerland
|
||||||
*
|
*
|
||||||
* @author WooCommerce
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 3.2.0
|
* @version 3.2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['CH'] = array(
|
$states['CH'] = array(
|
||||||
'AG' => __( 'Aargau', 'woocommerce' ),
|
'AG' => __( 'Aargau', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Chinese states
|
* Chinese states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['CN'] = array(
|
$states['CN'] = array(
|
||||||
'CN1' => __( 'Yunnan / 云南', 'woocommerce' ),
|
'CN1' => __( 'Yunnan / 云南', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Spain states
|
* Spain states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.11
|
* @version 2.0.11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['ES'] = array(
|
$states['ES'] = array(
|
||||||
'C' => __( 'A Coruña', 'woocommerce' ),
|
'C' => __( 'A Coruña', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Greek Regions
|
* Greek Regions
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.3.0
|
* @version 2.3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['GR'] = array(
|
$states['GR'] = array(
|
||||||
'I' => __( 'Αττική', 'woocommerce' ),
|
'I' => __( 'Αττική', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Hong Kong states
|
* Hong Kong states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['HK'] = array(
|
$states['HK'] = array(
|
||||||
'HONG KONG' => __( 'Hong Kong Island', 'woocommerce' ),
|
'HONG KONG' => __( 'Hong Kong Island', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Hungary states
|
* Hungary states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['HU'] = array(
|
$states['HU'] = array(
|
||||||
'BK' => __( 'Bács-Kiskun', 'woocommerce' ),
|
'BK' => __( 'Bács-Kiskun', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Indonesia Provinces
|
* Indonesia Provinces
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['ID'] = array(
|
$states['ID'] = array(
|
||||||
'AC' => __( 'Daerah Istimewa Aceh', 'woocommerce' ),
|
'AC' => __( 'Daerah Istimewa Aceh', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Republic of Ireland
|
* Republic of Ireland
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 3.0.0
|
* @version 3.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['IE'] = array(
|
$states['IE'] = array(
|
||||||
'CW' => __( 'Carlow', 'woocommerce' ),
|
'CW' => __( 'Carlow', 'woocommerce' ),
|
||||||
|
@ -39,5 +36,5 @@ $states['IE'] = array(
|
||||||
'WD' => __( 'Waterford', 'woocommerce' ),
|
'WD' => __( 'Waterford', 'woocommerce' ),
|
||||||
'WH' => __( 'Westmeath', 'woocommerce' ),
|
'WH' => __( 'Westmeath', 'woocommerce' ),
|
||||||
'WX' => __( 'Wexford', 'woocommerce' ),
|
'WX' => __( 'Wexford', 'woocommerce' ),
|
||||||
'WW' => __( 'Wicklow', 'woocommerce' )
|
'WW' => __( 'Wicklow', 'woocommerce' ),
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Indian states
|
* Indian states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['IN'] = array(
|
$states['IN'] = array(
|
||||||
'AP' => __( 'Andhra Pradesh', 'woocommerce' ),
|
'AP' => __( 'Andhra Pradesh', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Iran States
|
* Iran States
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.2.3
|
* @version 2.2.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['IR'] = array(
|
$states['IR'] = array(
|
||||||
'KHZ' => __( 'Khuzestan (خوزستان)', 'woocommerce' ),
|
'KHZ' => __( 'Khuzestan (خوزستان)', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Italy Provinces
|
* Italy Provinces
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['IT'] = array(
|
$states['IT'] = array(
|
||||||
'AG' => __( 'Agrigento', 'woocommerce' ),
|
'AG' => __( 'Agrigento', 'woocommerce' ),
|
||||||
|
|
|
@ -2,19 +2,16 @@
|
||||||
/**
|
/**
|
||||||
* Japan States
|
* Japan States
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*
|
*
|
||||||
* English notation of prefectures conform to the notation of Japan Post.
|
* English notation of prefectures conform to the notation of Japan Post.
|
||||||
* The suffix corresponds with the Japanese translation file.
|
* The suffix corresponds with the Japanese translation file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['JP'] = array(
|
$states['JP'] = array(
|
||||||
'JP01' => __( 'Hokkaido', 'woocommerce' ),
|
'JP01' => __( 'Hokkaido', 'woocommerce' ),
|
||||||
|
|
|
@ -14,9 +14,7 @@
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['MD'] = array(
|
$states['MD'] = array(
|
||||||
'C' => __( 'Chișinău', 'woocommerce' ),
|
'C' => __( 'Chișinău', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Mexico States
|
* Mexico States
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.2.9
|
* @version 2.2.9
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['MX'] = array(
|
$states['MX'] = array(
|
||||||
'DF' => __( 'Ciudad de México', 'woocommerce' ),
|
'DF' => __( 'Ciudad de México', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Malaysian states
|
* Malaysian states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['MY'] = array(
|
$states['MY'] = array(
|
||||||
'JHR' => __( 'Johor', 'woocommerce' ),
|
'JHR' => __( 'Johor', 'woocommerce' ),
|
||||||
|
|
|
@ -2,17 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Nigerian provinces
|
* Nigerian provinces
|
||||||
*
|
*
|
||||||
* @author hoshomoh
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 3.0.0
|
* @version 3.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['NG'] = array(
|
$states['NG'] = array(
|
||||||
'AB' => __( 'Abia', 'woocommerce' ),
|
'AB' => __( 'Abia', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Nepal states (Zones)
|
* Nepal states (Zones)
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.2.5
|
* @version 2.2.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['NP'] = array(
|
$states['NP'] = array(
|
||||||
'BAG' => __( 'Bagmati', 'woocommerce' ),
|
'BAG' => __( 'Bagmati', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* New Zealand States
|
* New Zealand States
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.3.0
|
* @version 2.3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['NZ'] = array(
|
$states['NZ'] = array(
|
||||||
'NL' => __( 'Northland', 'woocommerce' ),
|
'NL' => __( 'Northland', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Peru states
|
* Peru states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.1.0
|
* @version 2.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['PE'] = array(
|
$states['PE'] = array(
|
||||||
'CAL' => __( 'El Callao', 'woocommerce' ),
|
'CAL' => __( 'El Callao', 'woocommerce' ),
|
||||||
|
|
|
@ -2,15 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Philippines Provinces
|
* Philippines Provinces
|
||||||
*
|
*
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.4.0
|
* @version 2.4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['PH'] = array(
|
$states['PH'] = array(
|
||||||
'ABR' => __( 'Abra', 'woocommerce' ),
|
'ABR' => __( 'Abra', 'woocommerce' ),
|
||||||
|
@ -42,7 +40,7 @@ $states['PH'] = array(
|
||||||
'NCO' => __( 'Cotabato', 'woocommerce' ),
|
'NCO' => __( 'Cotabato', 'woocommerce' ),
|
||||||
'DAV' => __( 'Davao del Norte', 'woocommerce' ),
|
'DAV' => __( 'Davao del Norte', 'woocommerce' ),
|
||||||
'DAS' => __( 'Davao del Sur', 'woocommerce' ),
|
'DAS' => __( 'Davao del Sur', 'woocommerce' ),
|
||||||
'DAC' => __( 'Davao Occidental', 'woocommerce' ), // TODO: Needs to be updated when ISO code is assigned
|
'DAC' => __( 'Davao Occidental', 'woocommerce' ), // TODO: Needs to be updated when ISO code is assigned.
|
||||||
'DAO' => __( 'Davao Oriental', 'woocommerce' ),
|
'DAO' => __( 'Davao Oriental', 'woocommerce' ),
|
||||||
'DIN' => __( 'Dinagat Islands', 'woocommerce' ),
|
'DIN' => __( 'Dinagat Islands', 'woocommerce' ),
|
||||||
'EAS' => __( 'Eastern Samar', 'woocommerce' ),
|
'EAS' => __( 'Eastern Samar', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Pakistan's states
|
* Pakistan's states
|
||||||
*
|
*
|
||||||
* @author WooCommerce
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 3.0.0
|
* @version 3.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['PK'] = array(
|
$states['PK'] = array(
|
||||||
'JK' => __( 'Azad Kashmir', 'woocommerce' ),
|
'JK' => __( 'Azad Kashmir', 'woocommerce' ),
|
||||||
|
|
|
@ -11,9 +11,7 @@
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['RO'] = array(
|
$states['RO'] = array(
|
||||||
'AB' => __( 'Alba', 'woocommerce' ),
|
'AB' => __( 'Alba', 'woocommerce' ),
|
||||||
|
|
|
@ -2,93 +2,90 @@
|
||||||
/**
|
/**
|
||||||
* Thailand states
|
* Thailand states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 3.4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['TH'] = array(
|
$states['TH'] = array(
|
||||||
'TH-37' => __( 'Amnat Charoen (อำนาจเจริญ)', 'woocommerce' ),
|
'TH-37' => __( 'Amnat Charoen', 'woocommerce' ),
|
||||||
'TH-15' => __( 'Ang Thong (อ่างทอง)', 'woocommerce' ),
|
'TH-15' => __( 'Ang Thong', 'woocommerce' ),
|
||||||
'TH-14' => __( 'Ayutthaya (พระนครศรีอยุธยา)', 'woocommerce' ),
|
'TH-14' => __( 'Ayutthaya', 'woocommerce' ),
|
||||||
'TH-10' => __( 'Bangkok (กรุงเทพมหานคร)', 'woocommerce' ),
|
'TH-10' => __( 'Bangkok', 'woocommerce' ),
|
||||||
'TH-38' => __( 'Bueng Kan (บึงกาฬ)', 'woocommerce' ),
|
'TH-38' => __( 'Bueng Kan', 'woocommerce' ),
|
||||||
'TH-31' => __( 'Buri Ram (บุรีรัมย์)', 'woocommerce' ),
|
'TH-31' => __( 'Buri Ram', 'woocommerce' ),
|
||||||
'TH-24' => __( 'Chachoengsao (ฉะเชิงเทรา)', 'woocommerce' ),
|
'TH-24' => __( 'Chachoengsao', 'woocommerce' ),
|
||||||
'TH-18' => __( 'Chai Nat (ชัยนาท)', 'woocommerce' ),
|
'TH-18' => __( 'Chai Nat', 'woocommerce' ),
|
||||||
'TH-36' => __( 'Chaiyaphum (ชัยภูมิ)', 'woocommerce' ),
|
'TH-36' => __( 'Chaiyaphum', 'woocommerce' ),
|
||||||
'TH-22' => __( 'Chanthaburi (จันทบุรี)', 'woocommerce' ),
|
'TH-22' => __( 'Chanthaburi', 'woocommerce' ),
|
||||||
'TH-50' => __( 'Chiang Mai (เชียงใหม่)', 'woocommerce' ),
|
'TH-50' => __( 'Chiang Mai', 'woocommerce' ),
|
||||||
'TH-57' => __( 'Chiang Rai (เชียงราย)', 'woocommerce' ),
|
'TH-57' => __( 'Chiang Rai', 'woocommerce' ),
|
||||||
'TH-20' => __( 'Chonburi (ชลบุรี)', 'woocommerce' ),
|
'TH-20' => __( 'Chonburi', 'woocommerce' ),
|
||||||
'TH-86' => __( 'Chumphon (ชุมพร)', 'woocommerce' ),
|
'TH-86' => __( 'Chumphon', 'woocommerce' ),
|
||||||
'TH-46' => __( 'Kalasin (กาฬสินธุ์)', 'woocommerce' ),
|
'TH-46' => __( 'Kalasin', 'woocommerce' ),
|
||||||
'TH-62' => __( 'Kamphaeng Phet (กำแพงเพชร)', 'woocommerce' ),
|
'TH-62' => __( 'Kamphaeng Phet', 'woocommerce' ),
|
||||||
'TH-71' => __( 'Kanchanaburi (กาญจนบุรี)', 'woocommerce' ),
|
'TH-71' => __( 'Kanchanaburi', 'woocommerce' ),
|
||||||
'TH-40' => __( 'Khon Kaen (ขอนแก่น)', 'woocommerce' ),
|
'TH-40' => __( 'Khon Kaen', 'woocommerce' ),
|
||||||
'TH-81' => __( 'Krabi (กระบี่)', 'woocommerce' ),
|
'TH-81' => __( 'Krabi', 'woocommerce' ),
|
||||||
'TH-52' => __( 'Lampang (ลำปาง)', 'woocommerce' ),
|
'TH-52' => __( 'Lampang', 'woocommerce' ),
|
||||||
'TH-51' => __( 'Lamphun (ลำพูน)', 'woocommerce' ),
|
'TH-51' => __( 'Lamphun', 'woocommerce' ),
|
||||||
'TH-42' => __( 'Loei (เลย)', 'woocommerce' ),
|
'TH-42' => __( 'Loei', 'woocommerce' ),
|
||||||
'TH-16' => __( 'Lopburi (ลพบุรี)', 'woocommerce' ),
|
'TH-16' => __( 'Lopburi', 'woocommerce' ),
|
||||||
'TH-58' => __( 'Mae Hong Son (แม่ฮ่องสอน)', 'woocommerce' ),
|
'TH-58' => __( 'Mae Hong Son', 'woocommerce' ),
|
||||||
'TH-44' => __( 'Maha Sarakham (มหาสารคาม)', 'woocommerce' ),
|
'TH-44' => __( 'Maha Sarakham', 'woocommerce' ),
|
||||||
'TH-49' => __( 'Mukdahan (มุกดาหาร)', 'woocommerce' ),
|
'TH-49' => __( 'Mukdahan', 'woocommerce' ),
|
||||||
'TH-26' => __( 'Nakhon Nayok (นครนายก)', 'woocommerce' ),
|
'TH-26' => __( 'Nakhon Nayok', 'woocommerce' ),
|
||||||
'TH-73' => __( 'Nakhon Pathom (นครปฐม)', 'woocommerce' ),
|
'TH-73' => __( 'Nakhon Pathom', 'woocommerce' ),
|
||||||
'TH-48' => __( 'Nakhon Phanom (นครพนม)', 'woocommerce' ),
|
'TH-48' => __( 'Nakhon Phanom', 'woocommerce' ),
|
||||||
'TH-30' => __( 'Nakhon Ratchasima (นครราชสีมา)', 'woocommerce' ),
|
'TH-30' => __( 'Nakhon Ratchasima', 'woocommerce' ),
|
||||||
'TH-60' => __( 'Nakhon Sawan (นครสวรรค์)', 'woocommerce' ),
|
'TH-60' => __( 'Nakhon Sawan', 'woocommerce' ),
|
||||||
'TH-80' => __( 'Nakhon Si Thammarat (นครศรีธรรมราช)', 'woocommerce' ),
|
'TH-80' => __( 'Nakhon Si Thammarat', 'woocommerce' ),
|
||||||
'TH-55' => __( 'Nan (น่าน)', 'woocommerce' ),
|
'TH-55' => __( 'Nan', 'woocommerce' ),
|
||||||
'TH-96' => __( 'Narathiwat (นราธิวาส)', 'woocommerce' ),
|
'TH-96' => __( 'Narathiwat', 'woocommerce' ),
|
||||||
'TH-39' => __( 'Nong Bua Lam Phu (หนองบัวลำภู)', 'woocommerce' ),
|
'TH-39' => __( 'Nong Bua Lam Phu', 'woocommerce' ),
|
||||||
'TH-43' => __( 'Nong Khai (หนองคาย)', 'woocommerce' ),
|
'TH-43' => __( 'Nong Khai', 'woocommerce' ),
|
||||||
'TH-12' => __( 'Nonthaburi (นนทบุรี)', 'woocommerce' ),
|
'TH-12' => __( 'Nonthaburi', 'woocommerce' ),
|
||||||
'TH-13' => __( 'Pathum Thani (ปทุมธานี)', 'woocommerce' ),
|
'TH-13' => __( 'Pathum Thani', 'woocommerce' ),
|
||||||
'TH-94' => __( 'Pattani (ปัตตานี)', 'woocommerce' ),
|
'TH-94' => __( 'Pattani', 'woocommerce' ),
|
||||||
'TH-82' => __( 'Phang Nga (พังงา)', 'woocommerce' ),
|
'TH-82' => __( 'Phang Nga', 'woocommerce' ),
|
||||||
'TH-93' => __( 'Phatthalung (พัทลุง)', 'woocommerce' ),
|
'TH-93' => __( 'Phatthalung', 'woocommerce' ),
|
||||||
'TH-56' => __( 'Phayao (พะเยา)', 'woocommerce' ),
|
'TH-56' => __( 'Phayao', 'woocommerce' ),
|
||||||
'TH-67' => __( 'Phetchabun (เพชรบูรณ์)', 'woocommerce' ),
|
'TH-67' => __( 'Phetchabun', 'woocommerce' ),
|
||||||
'TH-76' => __( 'Phetchaburi (เพชรบุรี)', 'woocommerce' ),
|
'TH-76' => __( 'Phetchaburi', 'woocommerce' ),
|
||||||
'TH-66' => __( 'Phichit (พิจิตร)', 'woocommerce' ),
|
'TH-66' => __( 'Phichit', 'woocommerce' ),
|
||||||
'TH-65' => __( 'Phitsanulok (พิษณุโลก)', 'woocommerce' ),
|
'TH-65' => __( 'Phitsanulok', 'woocommerce' ),
|
||||||
'TH-54' => __( 'Phrae (แพร่)', 'woocommerce' ),
|
'TH-54' => __( 'Phrae', 'woocommerce' ),
|
||||||
'TH-83' => __( 'Phuket (ภูเก็ต)', 'woocommerce' ),
|
'TH-83' => __( 'Phuket', 'woocommerce' ),
|
||||||
'TH-25' => __( 'Prachin Buri (ปราจีนบุรี)', 'woocommerce' ),
|
'TH-25' => __( 'Prachin Buri', 'woocommerce' ),
|
||||||
'TH-77' => __( 'Prachuap Khiri Khan (ประจวบคีรีขันธ์)', 'woocommerce' ),
|
'TH-77' => __( 'Prachuap Khiri Khan', 'woocommerce' ),
|
||||||
'TH-85' => __( 'Ranong (ระนอง)', 'woocommerce' ),
|
'TH-85' => __( 'Ranong', 'woocommerce' ),
|
||||||
'TH-70' => __( 'Ratchaburi (ราชบุรี)', 'woocommerce' ),
|
'TH-70' => __( 'Ratchaburi', 'woocommerce' ),
|
||||||
'TH-21' => __( 'Rayong (ระยอง)', 'woocommerce' ),
|
'TH-21' => __( 'Rayong', 'woocommerce' ),
|
||||||
'TH-45' => __( 'Roi Et (ร้อยเอ็ด)', 'woocommerce' ),
|
'TH-45' => __( 'Roi Et', 'woocommerce' ),
|
||||||
'TH-27' => __( 'Sa Kaeo (สระแก้ว)', 'woocommerce' ),
|
'TH-27' => __( 'Sa Kaeo', 'woocommerce' ),
|
||||||
'TH-47' => __( 'Sakon Nakhon (สกลนคร)', 'woocommerce' ),
|
'TH-47' => __( 'Sakon Nakhon', 'woocommerce' ),
|
||||||
'TH-11' => __( 'Samut Prakan (สมุทรปราการ)', 'woocommerce' ),
|
'TH-11' => __( 'Samut Prakan', 'woocommerce' ),
|
||||||
'TH-74' => __( 'Samut Sakhon (สมุทรสาคร)', 'woocommerce' ),
|
'TH-74' => __( 'Samut Sakhon', 'woocommerce' ),
|
||||||
'TH-75' => __( 'Samut Songkhram (สมุทรสงคราม)', 'woocommerce' ),
|
'TH-75' => __( 'Samut Songkhram', 'woocommerce' ),
|
||||||
'TH-19' => __( 'Saraburi (สระบุรี)', 'woocommerce' ),
|
'TH-19' => __( 'Saraburi', 'woocommerce' ),
|
||||||
'TH-91' => __( 'Satun (สตูล)', 'woocommerce' ),
|
'TH-91' => __( 'Satun', 'woocommerce' ),
|
||||||
'TH-17' => __( 'Sing Buri (สิงห์บุรี)', 'woocommerce' ),
|
'TH-17' => __( 'Sing Buri', 'woocommerce' ),
|
||||||
'TH-33' => __( 'Sisaket (ศรีสะเกษ)', 'woocommerce' ),
|
'TH-33' => __( 'Sisaket', 'woocommerce' ),
|
||||||
'TH-90' => __( 'Songkhla (สงขลา)', 'woocommerce' ),
|
'TH-90' => __( 'Songkhla', 'woocommerce' ),
|
||||||
'TH-64' => __( 'Sukhothai (สุโขทัย)', 'woocommerce' ),
|
'TH-64' => __( 'Sukhothai', 'woocommerce' ),
|
||||||
'TH-72' => __( 'Suphan Buri (สุพรรณบุรี)', 'woocommerce' ),
|
'TH-72' => __( 'Suphan Buri', 'woocommerce' ),
|
||||||
'TH-84' => __( 'Surat Thani (สุราษฎร์ธานี)', 'woocommerce' ),
|
'TH-84' => __( 'Surat Thani', 'woocommerce' ),
|
||||||
'TH-32' => __( 'Surin (สุรินทร์)', 'woocommerce' ),
|
'TH-32' => __( 'Surin', 'woocommerce' ),
|
||||||
'TH-63' => __( 'Tak (ตาก)', 'woocommerce' ),
|
'TH-63' => __( 'Tak', 'woocommerce' ),
|
||||||
'TH-92' => __( 'Trang (ตรัง)', 'woocommerce' ),
|
'TH-92' => __( 'Trang', 'woocommerce' ),
|
||||||
'TH-23' => __( 'Trat (ตราด)', 'woocommerce' ),
|
'TH-23' => __( 'Trat', 'woocommerce' ),
|
||||||
'TH-34' => __( 'Ubon Ratchathani (อุบลราชธานี)', 'woocommerce' ),
|
'TH-34' => __( 'Ubon Ratchathani', 'woocommerce' ),
|
||||||
'TH-41' => __( 'Udon Thani (อุดรธานี)', 'woocommerce' ),
|
'TH-41' => __( 'Udon Thani', 'woocommerce' ),
|
||||||
'TH-61' => __( 'Uthai Thani (อุทัยธานี)', 'woocommerce' ),
|
'TH-61' => __( 'Uthai Thani', 'woocommerce' ),
|
||||||
'TH-53' => __( 'Uttaradit (อุตรดิตถ์)', 'woocommerce' ),
|
'TH-53' => __( 'Uttaradit', 'woocommerce' ),
|
||||||
'TH-95' => __( 'Yala (ยะลา)', 'woocommerce' ),
|
'TH-95' => __( 'Yala', 'woocommerce' ),
|
||||||
'TH-35' => __( 'Yasothon (ยโสธร)', 'woocommerce' ),
|
'TH-35' => __( 'Yasothon', 'woocommerce' ),
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* Turkey States
|
* Turkey States
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['TR'] = array(
|
$states['TR'] = array(
|
||||||
'TR01' => __( 'Adana', 'woocommerce' ),
|
'TR01' => __( 'Adana', 'woocommerce' ),
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
/**
|
/**
|
||||||
* Tanzania States
|
* Tanzania States
|
||||||
*
|
*
|
||||||
* @author Lev and Mohsin @ Extreme Web Technologies Ltd
|
* Based on English names published at https://en.wikipedia.org/wiki/ISO_3166-2:TZ
|
||||||
* @category i18n
|
*
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
* @notes Based on English names published at https://en.wikipedia.org/wiki/ISO_3166-2:TZ
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
$states['TZ'] = array(
|
$states['TZ'] = array(
|
||||||
|
@ -40,5 +40,5 @@ $states['TZ'] = array(
|
||||||
'TZ27' => __( 'Geita', 'woocommerce' ),
|
'TZ27' => __( 'Geita', 'woocommerce' ),
|
||||||
'TZ28' => __( 'Katavi', 'woocommerce' ),
|
'TZ28' => __( 'Katavi', 'woocommerce' ),
|
||||||
'TZ29' => __( 'Njombe', 'woocommerce' ),
|
'TZ29' => __( 'Njombe', 'woocommerce' ),
|
||||||
'TZ30' => __( 'Simiyu', 'woocommerce' )
|
'TZ30' => __( 'Simiyu', 'woocommerce' ),
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* United States
|
* United States
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['US'] = array(
|
$states['US'] = array(
|
||||||
'AL' => __( 'Alabama', 'woocommerce' ),
|
'AL' => __( 'Alabama', 'woocommerce' ),
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* South African states
|
* South African states
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category i18n
|
|
||||||
* @package WooCommerce/i18n
|
* @package WooCommerce/i18n
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $states;
|
global $states;
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$states['ZA'] = array(
|
$states['ZA'] = array(
|
||||||
'EC' => __( 'Eastern Cape', 'woocommerce' ),
|
'EC' => __( 'Eastern Cape', 'woocommerce' ),
|
||||||
|
|
|
@ -1,4 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Abstract Data.
|
||||||
|
*
|
||||||
|
* Handles generic data interaction which is implemented by
|
||||||
|
* the different data store classes.
|
||||||
|
*
|
||||||
|
* @class WC_Data
|
||||||
|
* @version 3.0.0
|
||||||
|
* @package WooCommerce/Classes
|
||||||
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -10,8 +21,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
*
|
*
|
||||||
* @version 2.6.0
|
* @version 2.6.0
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @category Abstract Class
|
|
||||||
* @author WooThemes
|
|
||||||
*/
|
*/
|
||||||
abstract class WC_Data {
|
abstract class WC_Data {
|
||||||
|
|
||||||
|
@ -172,7 +181,7 @@ abstract class WC_Data {
|
||||||
* Delete an object, set the ID to 0, and return result.
|
* Delete an object, set the ID to 0, and return result.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param bool $force_delete
|
* @param bool $force_delete Should the date be deleted permanently.
|
||||||
* @return bool result
|
* @return bool result
|
||||||
*/
|
*/
|
||||||
public function delete( $force_delete = false ) {
|
public function delete( $force_delete = false ) {
|
||||||
|
@ -295,8 +304,8 @@ abstract class WC_Data {
|
||||||
* Get Meta Data by Key.
|
* Get Meta Data by Key.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $key
|
* @param string $key Meta Key.
|
||||||
* @param bool $single return first found meta with key, or all with $key
|
* @param bool $single return first found meta with key, or all with $key.
|
||||||
* @param string $context What the value is for. Valid values are view and edit.
|
* @param string $context What the value is for. Valid values are view and edit.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
@ -315,7 +324,7 @@ abstract class WC_Data {
|
||||||
$value = $single ? '' : array();
|
$value = $single ? '' : array();
|
||||||
|
|
||||||
if ( ! empty( $array_keys ) ) {
|
if ( ! empty( $array_keys ) ) {
|
||||||
// We don't use the $this->meta_data property directly here because we don't want meta with a null value (i.e. meta which has been deleted via $this->delete_meta_data())
|
// We don't use the $this->meta_data property directly here because we don't want meta with a null value (i.e. meta which has been deleted via $this->delete_meta_data()).
|
||||||
if ( $single ) {
|
if ( $single ) {
|
||||||
$value = $meta_data[ current( $array_keys ) ]->value;
|
$value = $meta_data[ current( $array_keys ) ]->value;
|
||||||
} else {
|
} else {
|
||||||
|
@ -334,7 +343,7 @@ abstract class WC_Data {
|
||||||
* See if meta data exists, since get_meta always returns a '' or array().
|
* See if meta data exists, since get_meta always returns a '' or array().
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param string $key
|
* @param string $key Meta Key.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function meta_exists( $key = '' ) {
|
public function meta_exists( $key = '' ) {
|
||||||
|
@ -347,7 +356,7 @@ abstract class WC_Data {
|
||||||
* Set all meta data from array.
|
* Set all meta data from array.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param array $data Key/Value pairs
|
* @param array $data Key/Value pairs.
|
||||||
*/
|
*/
|
||||||
public function set_meta_data( $data ) {
|
public function set_meta_data( $data ) {
|
||||||
if ( ! empty( $data ) && is_array( $data ) ) {
|
if ( ! empty( $data ) && is_array( $data ) ) {
|
||||||
|
@ -369,9 +378,9 @@ abstract class WC_Data {
|
||||||
* Add meta data.
|
* Add meta data.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $key Meta key
|
* @param string $key Meta key.
|
||||||
* @param string $value Meta value
|
* @param string $value Meta value.
|
||||||
* @param bool $unique Should this be a unique key?
|
* @param bool $unique Should this be a unique key?.
|
||||||
*/
|
*/
|
||||||
public function add_meta_data( $key, $value, $unique = false ) {
|
public function add_meta_data( $key, $value, $unique = false ) {
|
||||||
if ( $this->is_internal_meta_key( $key ) ) {
|
if ( $this->is_internal_meta_key( $key ) ) {
|
||||||
|
@ -394,11 +403,11 @@ abstract class WC_Data {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update meta data by key or ID, if provided.
|
* Update meta data by key or ID, if provided.
|
||||||
* @since 2.6.0
|
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @since 2.6.0
|
||||||
* @param string $value
|
* @param string $key Meta key.
|
||||||
* @param int $meta_id
|
* @param string $value Meta value.
|
||||||
|
* @param int $meta_id Meta ID.
|
||||||
*/
|
*/
|
||||||
public function update_meta_data( $key, $value, $meta_id = 0 ) {
|
public function update_meta_data( $key, $value, $meta_id = 0 ) {
|
||||||
if ( $this->is_internal_meta_key( $key ) ) {
|
if ( $this->is_internal_meta_key( $key ) ) {
|
||||||
|
@ -426,7 +435,7 @@ abstract class WC_Data {
|
||||||
* Delete meta data.
|
* Delete meta data.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $key Meta key
|
* @param string $key Meta key.
|
||||||
*/
|
*/
|
||||||
public function delete_meta_data( $key ) {
|
public function delete_meta_data( $key ) {
|
||||||
$this->maybe_read_meta_data();
|
$this->maybe_read_meta_data();
|
||||||
|
@ -443,7 +452,7 @@ abstract class WC_Data {
|
||||||
* Delete meta data.
|
* Delete meta data.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param int $mid Meta ID
|
* @param int $mid Meta ID.
|
||||||
*/
|
*/
|
||||||
public function delete_meta_data_by_mid( $mid ) {
|
public function delete_meta_data_by_mid( $mid ) {
|
||||||
$this->maybe_read_meta_data();
|
$this->maybe_read_meta_data();
|
||||||
|
@ -549,7 +558,7 @@ abstract class WC_Data {
|
||||||
* Set ID.
|
* Set ID.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param int $id
|
* @param int $id ID.
|
||||||
*/
|
*/
|
||||||
public function set_id( $id ) {
|
public function set_id( $id ) {
|
||||||
$this->id = absint( $id );
|
$this->id = absint( $id );
|
||||||
|
@ -570,7 +579,7 @@ abstract class WC_Data {
|
||||||
* Set object read property.
|
* Set object read property.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param boolean $read
|
* @param boolean $read Should read?.
|
||||||
*/
|
*/
|
||||||
public function set_object_read( $read = true ) {
|
public function set_object_read( $read = true ) {
|
||||||
$this->object_read = (bool) $read;
|
$this->object_read = (bool) $read;
|
||||||
|
@ -593,7 +602,7 @@ abstract class WC_Data {
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param array $props Key value pairs to set. Key is the prop and should map to a setter function name.
|
* @param array $props Key value pairs to set. Key is the prop and should map to a setter function name.
|
||||||
* @param string $context
|
* @param string $context In what context to run this.
|
||||||
*
|
*
|
||||||
* @return bool|WP_Error
|
* @return bool|WP_Error
|
||||||
*/
|
*/
|
||||||
|
@ -618,7 +627,7 @@ abstract class WC_Data {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sizeof( $errors->get_error_codes() ) ? $errors : true;
|
return count( $errors->get_error_codes() ) ? $errors : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -659,7 +668,7 @@ abstract class WC_Data {
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
public function apply_changes() {
|
public function apply_changes() {
|
||||||
$this->data = array_replace_recursive( $this->data, $this->changes );
|
$this->data = array_replace_recursive( $this->data, $this->changes ); // @codingStandardsIgnoreLine
|
||||||
$this->changes = array();
|
$this->changes = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,13 +745,13 @@ abstract class WC_Data {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->set_prop( $prop, $datetime );
|
$this->set_prop( $prop, $datetime );
|
||||||
} catch ( Exception $e ) {}
|
} catch ( Exception $e ) {} // @codingStandardsIgnoreLine.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When invalid data is found, throw an exception unless reading from the DB.
|
* When invalid data is found, throw an exception unless reading from the DB.
|
||||||
*
|
*
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Data Exception.
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param string $code Error code.
|
* @param string $code Error code.
|
||||||
* @param string $message Error message.
|
* @param string $message Error message.
|
||||||
|
|
|
@ -1,4 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Abstract Integration class
|
||||||
|
*
|
||||||
|
* Extension of the Settings API which in turn gets extended
|
||||||
|
* by individual integrations to offer additional functionality.
|
||||||
|
*
|
||||||
|
* @class WC_Settings_API
|
||||||
|
* @version 2.6.0
|
||||||
|
* @package WooCommerce/Abstracts
|
||||||
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
|
@ -13,31 +23,33 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
* @extends WC_Settings_API
|
* @extends WC_Settings_API
|
||||||
* @version 2.6.0
|
* @version 2.6.0
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @category Abstract Class
|
|
||||||
* @author WooThemes
|
|
||||||
*/
|
*/
|
||||||
abstract class WC_Integration extends WC_Settings_API {
|
abstract class WC_Integration extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* yes or no based on whether the integration is enabled.
|
* Yes or no based on whether the integration is enabled.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $enabled = 'yes';
|
public $enabled = 'yes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration title.
|
* Integration title.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $method_title = '';
|
public $method_title = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration description.
|
* Integration description.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $method_description = '';
|
public $method_description = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the title for admin screens.
|
* Return the title for admin screens.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_method_title() {
|
public function get_method_title() {
|
||||||
|
@ -46,6 +58,7 @@ abstract class WC_Integration extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the description for admin screens.
|
* Return the description for admin screens.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_method_description() {
|
public function get_method_description() {
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Log handling functionality.
|
||||||
|
*
|
||||||
|
* @class WC_Log_Handler
|
||||||
|
* @package WooCommerce/Abstracts
|
||||||
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit; // Exit if accessed directly
|
exit; // Exit if accessed directly.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,8 +15,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
*
|
*
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @category Abstract Class
|
|
||||||
* @author WooThemes
|
|
||||||
*/
|
*/
|
||||||
abstract class WC_Log_Handler implements WC_Log_Handler_Interface {
|
abstract class WC_Log_Handler implements WC_Log_Handler_Interface {
|
||||||
|
|
||||||
|
@ -27,7 +32,7 @@ abstract class WC_Log_Handler implements WC_Log_Handler_Interface {
|
||||||
* Builds a log entry text from level, timestamp and message.
|
* Builds a log entry text from level, timestamp and message.
|
||||||
*
|
*
|
||||||
* @param int $timestamp Log timestamp.
|
* @param int $timestamp Log timestamp.
|
||||||
* @param string $level emergency|alert|critical|error|warning|notice|info|debug
|
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
|
||||||
* @param string $message Log message.
|
* @param string $message Log message.
|
||||||
* @param array $context Additional information for log handlers.
|
* @param array $context Additional information for log handlers.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Query abstraction layer functionality.
|
||||||
|
*
|
||||||
|
* @package WooCommerce/Abstracts
|
||||||
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -10,19 +16,19 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
*
|
*
|
||||||
* @version 3.1.0
|
* @version 3.1.0
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @category Abstract Class
|
|
||||||
* @author Automattic
|
|
||||||
*/
|
*/
|
||||||
abstract class WC_Object_Query {
|
abstract class WC_Object_Query {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores query data.
|
* Stores query data.
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $query_vars = array();
|
protected $query_vars = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new query.
|
* Create a new query.
|
||||||
|
*
|
||||||
* @param array $args Criteria to query on in a format similar to WP_Query.
|
* @param array $args Criteria to query on in a format similar to WP_Query.
|
||||||
*/
|
*/
|
||||||
public function __construct( $args = array() ) {
|
public function __construct( $args = array() ) {
|
||||||
|
@ -31,6 +37,7 @@ abstract class WC_Object_Query {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current query vars.
|
* Get the current query vars.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_query_vars() {
|
public function get_query_vars() {
|
||||||
|
@ -39,6 +46,7 @@ abstract class WC_Object_Query {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of a query variable.
|
* Get the value of a query variable.
|
||||||
|
*
|
||||||
* @param string $query_var Query variable to get value for.
|
* @param string $query_var Query variable to get value for.
|
||||||
* @param mixed $default Default value if query variable is not set.
|
* @param mixed $default Default value if query variable is not set.
|
||||||
* @return mixed Query variable value if set, otherwise default.
|
* @return mixed Query variable value if set, otherwise default.
|
||||||
|
@ -52,6 +60,7 @@ abstract class WC_Object_Query {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a query variable.
|
* Set a query variable.
|
||||||
|
*
|
||||||
* @param string $query_var Query variable to set.
|
* @param string $query_var Query variable to set.
|
||||||
* @param mixed $value Value to set for query variable.
|
* @param mixed $value Value to set for query variable.
|
||||||
*/
|
*/
|
||||||
|
@ -61,6 +70,7 @@ abstract class WC_Object_Query {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default allowed query vars.
|
* Get the default allowed query vars.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function get_default_query_vars() {
|
protected function get_default_query_vars() {
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-order.php' );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract Order
|
* Abstract Order
|
||||||
*
|
*
|
||||||
|
@ -14,8 +8,14 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-order.php' );
|
||||||
* @class WC_Abstract_Order
|
* @class WC_Abstract_Order
|
||||||
* @version 3.0.0
|
* @version 3.0.0
|
||||||
* @package WooCommerce/Classes
|
* @package WooCommerce/Classes
|
||||||
* @category Class
|
*/
|
||||||
* @author WooThemes
|
|
||||||
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
|
require_once WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-order.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WC_Abstract_Order class.
|
||||||
*/
|
*/
|
||||||
abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* Stores meta in cache for future reads.
|
* Stores meta in cache for future reads.
|
||||||
*
|
*
|
||||||
* A group must be set to to enable caching.
|
* A group must be set to to enable caching.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $cache_group = 'orders';
|
protected $cache_group = 'orders';
|
||||||
|
@ -78,6 +79,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the name of this object type.
|
* This is the name of this object type.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $object_type = 'order';
|
protected $object_type = 'order';
|
||||||
|
@ -181,8 +183,11 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* Save all order items which are part of this order.
|
* Save all order items which are part of this order.
|
||||||
*/
|
*/
|
||||||
protected function save_items() {
|
protected function save_items() {
|
||||||
|
$items_changed = false;
|
||||||
|
|
||||||
foreach ( $this->items_to_delete as $item ) {
|
foreach ( $this->items_to_delete as $item ) {
|
||||||
$item->delete();
|
$item->delete();
|
||||||
|
$items_changed = true;
|
||||||
}
|
}
|
||||||
$this->items_to_delete = array();
|
$this->items_to_delete = array();
|
||||||
|
|
||||||
|
@ -200,10 +205,16 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
$this->items[ $item_group ][ $item_id ] = $item;
|
$this->items[ $item_group ][ $item_id ] = $item;
|
||||||
|
|
||||||
unset( $this->items[ $item_group ][ $item_key ] );
|
unset( $this->items[ $item_group ][ $item_key ] );
|
||||||
|
|
||||||
|
$items_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $items_changed ) {
|
||||||
|
delete_transient( 'wc_order_' . $this->get_id() . '_needs_processing' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -216,7 +227,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* Get parent order ID.
|
* Get parent order ID.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function get_parent_id( $context = 'view' ) {
|
public function get_parent_id( $context = 'view' ) {
|
||||||
|
@ -226,7 +237,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Gets order currency.
|
* Gets order currency.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_currency( $context = 'view' ) {
|
public function get_currency( $context = 'view' ) {
|
||||||
|
@ -236,7 +247,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get order_version.
|
* Get order_version.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_version( $context = 'view' ) {
|
public function get_version( $context = 'view' ) {
|
||||||
|
@ -246,7 +257,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get prices_include_tax.
|
* Get prices_include_tax.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function get_prices_include_tax( $context = 'view' ) {
|
public function get_prices_include_tax( $context = 'view' ) {
|
||||||
|
@ -256,7 +267,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get date_created.
|
* Get date_created.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return WC_DateTime|NULL object if the date is set or null if there is no date.
|
* @return WC_DateTime|NULL object if the date is set or null if there is no date.
|
||||||
*/
|
*/
|
||||||
public function get_date_created( $context = 'view' ) {
|
public function get_date_created( $context = 'view' ) {
|
||||||
|
@ -266,7 +277,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get date_modified.
|
* Get date_modified.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return WC_DateTime|NULL object if the date is set or null if there is no date.
|
* @return WC_DateTime|NULL object if the date is set or null if there is no date.
|
||||||
*/
|
*/
|
||||||
public function get_date_modified( $context = 'view' ) {
|
public function get_date_modified( $context = 'view' ) {
|
||||||
|
@ -276,7 +287,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Return the order statuses without wc- internal prefix.
|
* Return the order statuses without wc- internal prefix.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_status( $context = 'view' ) {
|
public function get_status( $context = 'view' ) {
|
||||||
|
@ -292,7 +303,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get discount_total.
|
* Get discount_total.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_discount_total( $context = 'view' ) {
|
public function get_discount_total( $context = 'view' ) {
|
||||||
|
@ -302,7 +313,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get discount_tax.
|
* Get discount_tax.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_discount_tax( $context = 'view' ) {
|
public function get_discount_tax( $context = 'view' ) {
|
||||||
|
@ -312,7 +323,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get shipping_total.
|
* Get shipping_total.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_shipping_total( $context = 'view' ) {
|
public function get_shipping_total( $context = 'view' ) {
|
||||||
|
@ -322,7 +333,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get shipping_tax.
|
* Get shipping_tax.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_shipping_tax( $context = 'view' ) {
|
public function get_shipping_tax( $context = 'view' ) {
|
||||||
|
@ -332,7 +343,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Gets cart tax amount.
|
* Gets cart tax amount.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function get_cart_tax( $context = 'view' ) {
|
public function get_cart_tax( $context = 'view' ) {
|
||||||
|
@ -342,7 +353,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Gets order grand total. incl. taxes. Used in gateways.
|
* Gets order grand total. incl. taxes. Used in gateways.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function get_total( $context = 'view' ) {
|
public function get_total( $context = 'view' ) {
|
||||||
|
@ -352,7 +363,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get total tax amount. Alias for get_order_tax().
|
* Get total tax amount. Alias for get_order_tax().
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function get_total_tax( $context = 'view' ) {
|
public function get_total_tax( $context = 'view' ) {
|
||||||
|
@ -382,6 +393,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets order subtotal.
|
* Gets order subtotal.
|
||||||
|
*
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function get_subtotal() {
|
public function get_subtotal() {
|
||||||
|
@ -439,7 +451,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get user ID. Used by orders, not other order types like refunds.
|
* Get user ID. Used by orders, not other order types like refunds.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* @param string $context View or edit context.
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function get_user_id( $context = 'view' ) {
|
public function get_user_id( $context = 'view' ) {
|
||||||
|
@ -470,8 +482,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* Set parent order ID.
|
* Set parent order ID.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param int $value
|
* @param int $value Value to set.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception thrown if parent ID does not exist or is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_parent_id( $value ) {
|
public function set_parent_id( $value ) {
|
||||||
if ( $value && ( $value === $this->get_id() || ! wc_get_order( $value ) ) ) {
|
if ( $value && ( $value === $this->get_id() || ! wc_get_order( $value ) ) ) {
|
||||||
|
@ -493,13 +505,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
|
|
||||||
// If setting the status, ensure it's set to a valid status.
|
// If setting the status, ensure it's set to a valid status.
|
||||||
if ( true === $this->object_read ) {
|
if ( true === $this->object_read ) {
|
||||||
// Only allow valid new status
|
// Only allow valid new status.
|
||||||
if ( ! in_array( 'wc-' . $new_status, $this->get_valid_statuses() ) && 'trash' !== $new_status ) {
|
if ( ! in_array( 'wc-' . $new_status, $this->get_valid_statuses(), true ) && 'trash' !== $new_status ) {
|
||||||
$new_status = 'pending';
|
$new_status = 'pending';
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
|
// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
|
||||||
if ( $old_status && ! in_array( 'wc-' . $old_status, $this->get_valid_statuses() ) && 'trash' !== $old_status ) {
|
if ( $old_status && ! in_array( 'wc-' . $old_status, $this->get_valid_statuses(), true ) && 'trash' !== $old_status ) {
|
||||||
$old_status = 'pending';
|
$old_status = 'pending';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -515,8 +527,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Set order_version.
|
* Set order_version.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value Value to set.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_version( $value ) {
|
public function set_version( $value ) {
|
||||||
$this->set_prop( 'version', $value );
|
$this->set_prop( 'version', $value );
|
||||||
|
@ -525,11 +537,11 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Set order_currency.
|
* Set order_currency.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value Value to set.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_currency( $value ) {
|
public function set_currency( $value ) {
|
||||||
if ( $value && ! in_array( $value, array_keys( get_woocommerce_currencies() ) ) ) {
|
if ( $value && ! in_array( $value, array_keys( get_woocommerce_currencies() ), true ) ) {
|
||||||
$this->error( 'order_invalid_currency', __( 'Invalid currency code', 'woocommerce' ) );
|
$this->error( 'order_invalid_currency', __( 'Invalid currency code', 'woocommerce' ) );
|
||||||
}
|
}
|
||||||
$this->set_prop( 'currency', $value ? $value : get_woocommerce_currency() );
|
$this->set_prop( 'currency', $value ? $value : get_woocommerce_currency() );
|
||||||
|
@ -538,8 +550,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Set prices_include_tax.
|
* Set prices_include_tax.
|
||||||
*
|
*
|
||||||
* @param bool $value
|
* @param bool $value Value to set.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_prices_include_tax( $value ) {
|
public function set_prices_include_tax( $value ) {
|
||||||
$this->set_prop( 'prices_include_tax', (bool) $value );
|
$this->set_prop( 'prices_include_tax', (bool) $value );
|
||||||
|
@ -549,7 +561,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* Set date_created.
|
* Set date_created.
|
||||||
*
|
*
|
||||||
* @param string|integer|null $date UTC timestamp, or ISO 8601 DateTime. If the DateTime string has no timezone or offset, WordPress site timezone will be assumed. Null if there is no date.
|
* @param string|integer|null $date UTC timestamp, or ISO 8601 DateTime. If the DateTime string has no timezone or offset, WordPress site timezone will be assumed. Null if there is no date.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_date_created( $date = null ) {
|
public function set_date_created( $date = null ) {
|
||||||
$this->set_date_prop( 'date_created', $date );
|
$this->set_date_prop( 'date_created', $date );
|
||||||
|
@ -559,7 +571,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* Set date_modified.
|
* Set date_modified.
|
||||||
*
|
*
|
||||||
* @param string|integer|null $date UTC timestamp, or ISO 8601 DateTime. If the DateTime string has no timezone or offset, WordPress site timezone will be assumed. Null if there is no date.
|
* @param string|integer|null $date UTC timestamp, or ISO 8601 DateTime. If the DateTime string has no timezone or offset, WordPress site timezone will be assumed. Null if there is no date.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_date_modified( $date = null ) {
|
public function set_date_modified( $date = null ) {
|
||||||
$this->set_date_prop( 'date_modified', $date );
|
$this->set_date_prop( 'date_modified', $date );
|
||||||
|
@ -568,8 +580,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Set discount_total.
|
* Set discount_total.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value Value to set.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_discount_total( $value ) {
|
public function set_discount_total( $value ) {
|
||||||
$this->set_prop( 'discount_total', wc_format_decimal( $value ) );
|
$this->set_prop( 'discount_total', wc_format_decimal( $value ) );
|
||||||
|
@ -578,8 +590,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Set discount_tax.
|
* Set discount_tax.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value Value to set.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_discount_tax( $value ) {
|
public function set_discount_tax( $value ) {
|
||||||
$this->set_prop( 'discount_tax', wc_format_decimal( $value ) );
|
$this->set_prop( 'discount_tax', wc_format_decimal( $value ) );
|
||||||
|
@ -588,8 +600,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Set shipping_total.
|
* Set shipping_total.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value Value to set.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_shipping_total( $value ) {
|
public function set_shipping_total( $value ) {
|
||||||
$this->set_prop( 'shipping_total', wc_format_decimal( $value ) );
|
$this->set_prop( 'shipping_total', wc_format_decimal( $value ) );
|
||||||
|
@ -598,8 +610,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Set shipping_tax.
|
* Set shipping_tax.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value Value to set.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_shipping_tax( $value ) {
|
public function set_shipping_tax( $value ) {
|
||||||
$this->set_prop( 'shipping_tax', wc_format_decimal( $value ) );
|
$this->set_prop( 'shipping_tax', wc_format_decimal( $value ) );
|
||||||
|
@ -609,8 +621,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Set cart tax.
|
* Set cart tax.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value Value to set.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_cart_tax( $value ) {
|
public function set_cart_tax( $value ) {
|
||||||
$this->set_prop( 'cart_tax', wc_format_decimal( $value ) );
|
$this->set_prop( 'cart_tax', wc_format_decimal( $value ) );
|
||||||
|
@ -620,8 +632,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Sets order tax (sum of cart and shipping tax). Used internally only.
|
* Sets order tax (sum of cart and shipping tax). Used internally only.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value Value to set.
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
protected function set_total_tax( $value ) {
|
protected function set_total_tax( $value ) {
|
||||||
$this->set_prop( 'total_tax', wc_format_decimal( $value ) );
|
$this->set_prop( 'total_tax', wc_format_decimal( $value ) );
|
||||||
|
@ -630,11 +642,11 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Set total.
|
* Set total.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value Value to set.
|
||||||
* @param string $deprecated Function used to set different totals based on this.
|
* @param string $deprecated Function used to set different totals based on this.
|
||||||
*
|
*
|
||||||
* @return bool|void
|
* @return bool|void
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception may be thrown if value is invalid.
|
||||||
*/
|
*/
|
||||||
public function set_total( $value, $deprecated = '' ) {
|
public function set_total( $value, $deprecated = '' ) {
|
||||||
if ( $deprecated ) {
|
if ( $deprecated ) {
|
||||||
|
@ -662,7 +674,9 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
if ( ! empty( $type ) ) {
|
if ( ! empty( $type ) ) {
|
||||||
$this->data_store->delete_items( $this, $type );
|
$this->data_store->delete_items( $this, $type );
|
||||||
|
|
||||||
if ( $group = $this->type_to_group( $type ) ) {
|
$group = $this->type_to_group( $type );
|
||||||
|
|
||||||
|
if ( $group ) {
|
||||||
unset( $this->items[ $group ] );
|
unset( $this->items[ $group ] );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -674,8 +688,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Convert a type to a types group.
|
* Convert a type to a types group.
|
||||||
*
|
*
|
||||||
* @param string $type
|
* @param string $type type to lookup.
|
||||||
* @return string group
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function type_to_group( $type ) {
|
protected function type_to_group( $type ) {
|
||||||
$type_to_group = apply_filters( 'woocommerce_order_type_to_group', array(
|
$type_to_group = apply_filters( 'woocommerce_order_type_to_group', array(
|
||||||
|
@ -699,11 +713,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
$types = array_filter( (array) $types );
|
$types = array_filter( (array) $types );
|
||||||
|
|
||||||
foreach ( $types as $type ) {
|
foreach ( $types as $type ) {
|
||||||
if ( $group = $this->type_to_group( $type ) ) {
|
$group = $this->type_to_group( $type );
|
||||||
|
|
||||||
|
if ( $group ) {
|
||||||
if ( ! isset( $this->items[ $group ] ) ) {
|
if ( ! isset( $this->items[ $group ] ) ) {
|
||||||
$this->items[ $group ] = array_filter( $this->data_store->read_items( $this, $type ) );
|
$this->items[ $group ] = array_filter( $this->data_store->read_items( $this, $type ) );
|
||||||
}
|
}
|
||||||
// Don't use array_merge here because keys are numeric
|
// Don't use array_merge here because keys are numeric.
|
||||||
$items = $items + $this->items[ $group ];
|
$items = $items + $this->items[ $group ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -758,7 +774,9 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
*/
|
*/
|
||||||
public function get_used_coupons() {
|
public function get_used_coupons() {
|
||||||
$coupon_codes = array();
|
$coupon_codes = array();
|
||||||
if ( $coupons = $this->get_items( 'coupon' ) ) {
|
$coupons = $this->get_items( 'coupon' );
|
||||||
|
|
||||||
|
if ( $coupons ) {
|
||||||
foreach ( $coupons as $coupon ) {
|
foreach ( $coupons as $coupon ) {
|
||||||
$coupon_codes[] = $coupon->get_code();
|
$coupon_codes[] = $coupon->get_code();
|
||||||
}
|
}
|
||||||
|
@ -769,7 +787,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Gets the count of order items of a certain type.
|
* Gets the count of order items of a certain type.
|
||||||
*
|
*
|
||||||
* @param string $item_type
|
* @param string $item_type Item type to lookup.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_item_count( $item_type = '' ) {
|
public function get_item_count( $item_type = '' ) {
|
||||||
|
@ -821,7 +839,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* Get key for where a certain item type is stored in _items.
|
* Get key for where a certain item type is stored in _items.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param $item object Order item (product, shipping, fee, coupon, tax)
|
* @param string $item object Order item (product, shipping, fee, coupon, tax).
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function get_items_key( $item ) {
|
protected function get_items_key( $item ) {
|
||||||
|
@ -847,8 +865,9 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
*/
|
*/
|
||||||
public function remove_item( $item_id ) {
|
public function remove_item( $item_id ) {
|
||||||
$item = $this->get_item( $item_id, false );
|
$item = $this->get_item( $item_id, false );
|
||||||
|
$items_key = $item ? $this->get_items_key( $item ) : false;
|
||||||
|
|
||||||
if ( ! $item || ! ( $items_key = $this->get_items_key( $item ) ) ) {
|
if ( ! $items_key ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,12 +880,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* Adds an order item to this order. The order item will not persist until save.
|
* Adds an order item to this order. The order item will not persist until save.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param WC_Order_Item Order item object (product, shipping, fee, coupon, tax)
|
* @param WC_Order_Item $item Order item object (product, shipping, fee, coupon, tax).
|
||||||
*
|
|
||||||
* @return false|void
|
* @return false|void
|
||||||
*/
|
*/
|
||||||
public function add_item( $item ) {
|
public function add_item( $item ) {
|
||||||
if ( ! $items_key = $this->get_items_key( $item ) ) {
|
$items_key = $this->get_items_key( $item );
|
||||||
|
|
||||||
|
if ( ! $items_key ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,10 +899,12 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
$item->set_order_id( $this->get_id() );
|
$item->set_order_id( $this->get_id() );
|
||||||
|
|
||||||
// Append new row with generated temporary ID.
|
// Append new row with generated temporary ID.
|
||||||
if ( $item_id = $item->get_id() ) {
|
$item_id = $item->get_id();
|
||||||
|
|
||||||
|
if ( $item_id ) {
|
||||||
$this->items[ $items_key ][ $item_id ] = $item;
|
$this->items[ $items_key ][ $item_id ] = $item;
|
||||||
} else {
|
} else {
|
||||||
$this->items[ $items_key ][ 'new:' . $items_key . sizeof( $this->items[ $items_key ] ) ] = $item;
|
$this->items[ $items_key ][ 'new:' . $items_key . count( $this->items[ $items_key ] ) ] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -936,7 +958,9 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
$this->calculate_totals( true );
|
$this->calculate_totals( true );
|
||||||
|
|
||||||
// Record usage so counts and validation is correct.
|
// Record usage so counts and validation is correct.
|
||||||
if ( ! $used_by = $this->get_user_id() ) {
|
$used_by = $this->get_user_id();
|
||||||
|
|
||||||
|
if ( ! $used_by ) {
|
||||||
$used_by = $this->get_billing_email();
|
$used_by = $this->get_billing_email();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1044,7 +1068,9 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* @param WC_Discounts $discounts Discounts class.
|
* @param WC_Discounts $discounts Discounts class.
|
||||||
*/
|
*/
|
||||||
protected function set_item_discount_amounts( $discounts ) {
|
protected function set_item_discount_amounts( $discounts ) {
|
||||||
if ( $item_discounts = $discounts->get_discounts_by_item() ) {
|
$item_discounts = $discounts->get_discounts_by_item();
|
||||||
|
|
||||||
|
if ( $item_discounts ) {
|
||||||
foreach ( $item_discounts as $item_id => $amount ) {
|
foreach ( $item_discounts as $item_id => $amount ) {
|
||||||
$item = $this->get_item( $item_id, false );
|
$item = $this->get_item( $item_id, false );
|
||||||
|
|
||||||
|
@ -1110,11 +1136,11 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* Add a product line item to the order. This is the only line item type with
|
* Add a product line item to the order. This is the only line item type with
|
||||||
* it's own method because it saves looking up order amounts (costs are added up for you).
|
* it's own method because it saves looking up order amounts (costs are added up for you).
|
||||||
*
|
*
|
||||||
* @param \WC_Product $product
|
* @param WC_Product $product Product object.
|
||||||
* @param int $qty
|
* @param int $qty Quantity to add.
|
||||||
* @param array $args
|
* @param array $args Args for the added product.
|
||||||
* @return int order item ID
|
* @return int
|
||||||
* @throws WC_Data_Exception
|
* @throws WC_Data_Exception Exception thrown if the item cannot be added to the cart.
|
||||||
*/
|
*/
|
||||||
public function add_product( $product, $qty = 1, $args = array() ) {
|
public function add_product( $product, $qty = 1, $args = array() ) {
|
||||||
if ( $product ) {
|
if ( $product ) {
|
||||||
|
@ -1136,7 +1162,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
|
|
||||||
$args = wp_parse_args( $args, $default_args );
|
$args = wp_parse_args( $args, $default_args );
|
||||||
|
|
||||||
// BW compatibility with old args
|
// BW compatibility with old args.
|
||||||
if ( isset( $args['totals'] ) ) {
|
if ( isset( $args['totals'] ) ) {
|
||||||
foreach ( $args['totals'] as $key => $value ) {
|
foreach ( $args['totals'] as $key => $value ) {
|
||||||
if ( 'tax' === $key ) {
|
if ( 'tax' === $key ) {
|
||||||
|
@ -1172,7 +1198,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* Add a payment token to an order
|
* Add a payment token to an order
|
||||||
*
|
*
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
* @param WC_Payment_Token $token Payment token object
|
* @param WC_Payment_Token $token Payment token object.
|
||||||
* @return boolean|int The new token ID or false if it failed.
|
* @return boolean|int The new token ID or false if it failed.
|
||||||
*/
|
*/
|
||||||
public function add_payment_token( $token ) {
|
public function add_payment_token( $token ) {
|
||||||
|
@ -1248,7 +1274,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
* Get tax location for this order.
|
* Get tax location for this order.
|
||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
* @param $args array Override the location.
|
* @param array $args array Override the location.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function get_tax_location( $args = array() ) {
|
protected function get_tax_location( $args = array() ) {
|
||||||
|
@ -1265,7 +1291,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
'city' => 'billing' === $tax_based_on ? $this->get_billing_city() : $this->get_shipping_city(),
|
'city' => 'billing' === $tax_based_on ? $this->get_billing_city() : $this->get_shipping_city(),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Default to base
|
// Default to base.
|
||||||
if ( 'base' === $tax_based_on || empty( $args['country'] ) ) {
|
if ( 'base' === $tax_based_on || empty( $args['country'] ) ) {
|
||||||
$default = wc_get_base_location();
|
$default = wc_get_base_location();
|
||||||
$args['country'] = $default['country'];
|
$args['country'] = $default['country'];
|
||||||
|
@ -1294,8 +1320,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
$shipping_tax_class = get_option( 'woocommerce_shipping_tax_class' );
|
$shipping_tax_class = get_option( 'woocommerce_shipping_tax_class' );
|
||||||
|
|
||||||
if ( 'inherit' === $shipping_tax_class ) {
|
if ( 'inherit' === $shipping_tax_class ) {
|
||||||
$found_classes = array_intersect( array_merge( array( '' ), WC_Tax :: get_tax_class_slugs() ), $this->get_items_tax_classes() );
|
$found_classes = array_intersect( array_merge( array( '' ), WC_Tax::get_tax_class_slugs() ), $this->get_items_tax_classes() );
|
||||||
$shipping_tax_class = count( $found_classes ) ? current( $found_classes ): false;
|
$shipping_tax_class = count( $found_classes ) ? current( $found_classes ) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_vat_exempt = apply_filters( 'woocommerce_order_is_vat_exempt', 'yes' === $this->get_meta( 'is_vat_exempt' ) );
|
$is_vat_exempt = apply_filters( 'woocommerce_order_is_vat_exempt', 'yes' === $this->get_meta( 'is_vat_exempt' ) );
|
||||||
|
@ -1345,7 +1371,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
|
|
||||||
foreach ( $existing_taxes as $tax ) {
|
foreach ( $existing_taxes as $tax ) {
|
||||||
// Remove taxes which no longer exist for cart/shipping.
|
// Remove taxes which no longer exist for cart/shipping.
|
||||||
if ( ( ! array_key_exists( $tax->get_rate_id(), $cart_taxes ) && ! array_key_exists( $tax->get_rate_id(), $shipping_taxes ) ) || in_array( $tax->get_rate_id(), $saved_rate_ids ) ) {
|
if ( ( ! array_key_exists( $tax->get_rate_id(), $cart_taxes ) && ! array_key_exists( $tax->get_rate_id(), $shipping_taxes ) ) || in_array( $tax->get_rate_id(), $saved_rate_ids, true ) ) {
|
||||||
$this->remove_item( $tax->get_id() );
|
$this->remove_item( $tax->get_id() );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1423,7 +1449,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
$fee_total += $item->get_total();
|
$fee_total += $item->get_total();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate taxes for items, shipping, discounts.
|
// Calculate taxes for items, shipping, discounts. Note; this also triggers save().
|
||||||
if ( $and_taxes ) {
|
if ( $and_taxes ) {
|
||||||
$this->calculate_taxes();
|
$this->calculate_taxes();
|
||||||
}
|
}
|
||||||
|
@ -1448,7 +1474,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get item subtotal - this is the cost before discount.
|
* Get item subtotal - this is the cost before discount.
|
||||||
*
|
*
|
||||||
* @param object $item
|
* @param object $item Item to get total from.
|
||||||
* @param bool $inc_tax (default: false).
|
* @param bool $inc_tax (default: false).
|
||||||
* @param bool $round (default: true).
|
* @param bool $round (default: true).
|
||||||
* @return float
|
* @return float
|
||||||
|
@ -1472,7 +1498,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get line subtotal - this is the cost before discount.
|
* Get line subtotal - this is the cost before discount.
|
||||||
*
|
*
|
||||||
* @param object $item
|
* @param object $item Item to get total from.
|
||||||
* @param bool $inc_tax (default: false).
|
* @param bool $inc_tax (default: false).
|
||||||
* @param bool $round (default: true).
|
* @param bool $round (default: true).
|
||||||
* @return float
|
* @return float
|
||||||
|
@ -1496,7 +1522,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Calculate item cost - useful for gateways.
|
* Calculate item cost - useful for gateways.
|
||||||
*
|
*
|
||||||
* @param object $item
|
* @param object $item Item to get total from.
|
||||||
* @param bool $inc_tax (default: false).
|
* @param bool $inc_tax (default: false).
|
||||||
* @param bool $round (default: true).
|
* @param bool $round (default: true).
|
||||||
* @return float
|
* @return float
|
||||||
|
@ -1520,7 +1546,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Calculate line total - useful for gateways.
|
* Calculate line total - useful for gateways.
|
||||||
*
|
*
|
||||||
* @param object $item
|
* @param object $item Item to get total from.
|
||||||
* @param bool $inc_tax (default: false).
|
* @param bool $inc_tax (default: false).
|
||||||
* @param bool $round (default: true).
|
* @param bool $round (default: true).
|
||||||
* @return float
|
* @return float
|
||||||
|
@ -1542,7 +1568,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get item tax - useful for gateways.
|
* Get item tax - useful for gateways.
|
||||||
*
|
*
|
||||||
* @param mixed $item
|
* @param mixed $item Item to get total from.
|
||||||
* @param bool $round (default: true).
|
* @param bool $round (default: true).
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
|
@ -1560,7 +1586,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get line tax - useful for gateways.
|
* Get line tax - useful for gateways.
|
||||||
*
|
*
|
||||||
* @param mixed $item
|
* @param mixed $item Item to get total from.
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function get_line_tax( $item ) {
|
public function get_line_tax( $item ) {
|
||||||
|
@ -1570,17 +1596,20 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Gets line subtotal - formatted for display.
|
* Gets line subtotal - formatted for display.
|
||||||
*
|
*
|
||||||
* @param array $item
|
* @param array $item Item to get total from.
|
||||||
* @param string $tax_display
|
* @param string $tax_display Incl or excl tax display mode.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_formatted_line_subtotal( $item, $tax_display = '' ) {
|
public function get_formatted_line_subtotal( $item, $tax_display = '' ) {
|
||||||
$tax_display = $tax_display ? $tax_display : get_option( 'woocommerce_tax_display_cart' );
|
$tax_display = $tax_display ? $tax_display : get_option( 'woocommerce_tax_display_cart' );
|
||||||
|
|
||||||
if ( 'excl' == $tax_display ) {
|
if ( 'excl' === $tax_display ) {
|
||||||
$ex_tax_label = $this->get_prices_include_tax() ? 1 : 0;
|
$ex_tax_label = $this->get_prices_include_tax() ? 1 : 0;
|
||||||
|
|
||||||
$subtotal = wc_price( $this->get_line_subtotal( $item ), array( 'ex_tax_label' => $ex_tax_label, 'currency' => $this->get_currency() ) );
|
$subtotal = wc_price( $this->get_line_subtotal( $item ), array(
|
||||||
|
'ex_tax_label' => $ex_tax_label,
|
||||||
|
'currency' => $this->get_currency(),
|
||||||
|
) );
|
||||||
} else {
|
} else {
|
||||||
$subtotal = wc_price( $this->get_line_subtotal( $item, true ), array( 'currency' => $this->get_currency() ) );
|
$subtotal = wc_price( $this->get_line_subtotal( $item, true ), array( 'currency' => $this->get_currency() ) );
|
||||||
}
|
}
|
||||||
|
@ -1590,6 +1619,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets order total - formatted for display.
|
* Gets order total - formatted for display.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_formatted_order_total() {
|
public function get_formatted_order_total() {
|
||||||
|
@ -1619,7 +1649,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
|
|
||||||
$subtotal = wc_price( $subtotal, array( 'currency' => $this->get_currency() ) );
|
$subtotal = wc_price( $subtotal, array( 'currency' => $this->get_currency() ) );
|
||||||
|
|
||||||
if ( 'excl' === $tax_display && $this->get_prices_include_tax() ) {
|
if ( 'excl' === $tax_display && $this->get_prices_include_tax() && wc_tax_enabled() ) {
|
||||||
$subtotal .= ' <small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>';
|
$subtotal .= ' <small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1653,21 +1683,20 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Gets shipping (formatted).
|
* Gets shipping (formatted).
|
||||||
*
|
*
|
||||||
* @param string $tax_display
|
* @param string $tax_display Excl or incl tax display mode.
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_shipping_to_display( $tax_display = '' ) {
|
public function get_shipping_to_display( $tax_display = '' ) {
|
||||||
$tax_display = $tax_display ? $tax_display : get_option( 'woocommerce_tax_display_cart' );
|
$tax_display = $tax_display ? $tax_display : get_option( 'woocommerce_tax_display_cart' );
|
||||||
|
|
||||||
if ( $this->get_shipping_total() != 0 ) {
|
if ( $this->get_shipping_total() !== 0 ) {
|
||||||
|
|
||||||
if ( 'excl' === $tax_display ) {
|
if ( 'excl' === $tax_display ) {
|
||||||
|
|
||||||
// Show shipping excluding tax.
|
// Show shipping excluding tax.
|
||||||
$shipping = wc_price( $this->get_shipping_total(), array( 'currency' => $this->get_currency() ) );
|
$shipping = wc_price( $this->get_shipping_total(), array( 'currency' => $this->get_currency() ) );
|
||||||
|
|
||||||
if ( $this->get_shipping_tax() != 0 && $this->get_prices_include_tax() ) {
|
if ( $this->get_shipping_tax() !== 0 && $this->get_prices_include_tax() ) {
|
||||||
$shipping .= apply_filters( 'woocommerce_order_shipping_to_display_tax_label', ' <small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>', $this, $tax_display );
|
$shipping .= apply_filters( 'woocommerce_order_shipping_to_display_tax_label', ' <small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>', $this, $tax_display );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1675,7 +1704,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
// Show shipping including tax.
|
// Show shipping including tax.
|
||||||
$shipping = wc_price( $this->get_shipping_total() + $this->get_shipping_tax(), array( 'currency' => $this->get_currency() ) );
|
$shipping = wc_price( $this->get_shipping_total() + $this->get_shipping_tax(), array( 'currency' => $this->get_currency() ) );
|
||||||
|
|
||||||
if ( $this->get_shipping_tax() != 0 && ! $this->get_prices_include_tax() ) {
|
if ( $this->get_shipping_tax() !== 0 && ! $this->get_prices_include_tax() ) {
|
||||||
$shipping .= apply_filters( 'woocommerce_order_shipping_to_display_tax_label', ' <small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>', $this, $tax_display );
|
$shipping .= apply_filters( 'woocommerce_order_shipping_to_display_tax_label', ' <small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>', $this, $tax_display );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1694,10 +1723,9 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the discount amount (formatted).
|
* Get the discount amount (formatted).
|
||||||
|
*
|
||||||
* @since 2.3.0
|
* @since 2.3.0
|
||||||
*
|
* @param string $tax_display Excl or incl tax display mode.
|
||||||
* @param string $tax_display
|
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_discount_to_display( $tax_display = '' ) {
|
public function get_discount_to_display( $tax_display = '' ) {
|
||||||
|
@ -1708,11 +1736,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Add total row for subtotal.
|
* Add total row for subtotal.
|
||||||
*
|
*
|
||||||
* @param array $total_rows
|
* @param array $total_rows Reference to total rows array.
|
||||||
* @param string $tax_display
|
* @param string $tax_display Excl or incl tax display mode.
|
||||||
*/
|
*/
|
||||||
protected function add_order_item_totals_subtotal_row( &$total_rows, $tax_display ) {
|
protected function add_order_item_totals_subtotal_row( &$total_rows, $tax_display ) {
|
||||||
if ( $subtotal = $this->get_subtotal_to_display( false, $tax_display ) ) {
|
$subtotal = $this->get_subtotal_to_display( false, $tax_display );
|
||||||
|
|
||||||
|
if ( $subtotal ) {
|
||||||
$total_rows['cart_subtotal'] = array(
|
$total_rows['cart_subtotal'] = array(
|
||||||
'label' => __( 'Subtotal:', 'woocommerce' ),
|
'label' => __( 'Subtotal:', 'woocommerce' ),
|
||||||
'value' => $subtotal,
|
'value' => $subtotal,
|
||||||
|
@ -1723,8 +1753,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Add total row for discounts.
|
* Add total row for discounts.
|
||||||
*
|
*
|
||||||
* @param array $total_rows
|
* @param array $total_rows Reference to total rows array.
|
||||||
* @param string $tax_display
|
* @param string $tax_display Excl or incl tax display mode.
|
||||||
*/
|
*/
|
||||||
protected function add_order_item_totals_discount_row( &$total_rows, $tax_display ) {
|
protected function add_order_item_totals_discount_row( &$total_rows, $tax_display ) {
|
||||||
if ( $this->get_total_discount() > 0 ) {
|
if ( $this->get_total_discount() > 0 ) {
|
||||||
|
@ -1738,8 +1768,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Add total row for shipping.
|
* Add total row for shipping.
|
||||||
*
|
*
|
||||||
* @param array $total_rows
|
* @param array $total_rows Reference to total rows array.
|
||||||
* @param string $tax_display
|
* @param string $tax_display Excl or incl tax display mode.
|
||||||
*/
|
*/
|
||||||
protected function add_order_item_totals_shipping_row( &$total_rows, $tax_display ) {
|
protected function add_order_item_totals_shipping_row( &$total_rows, $tax_display ) {
|
||||||
if ( $this->get_shipping_method() ) {
|
if ( $this->get_shipping_method() ) {
|
||||||
|
@ -1753,11 +1783,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Add total row for fees.
|
* Add total row for fees.
|
||||||
*
|
*
|
||||||
* @param array $total_rows
|
* @param array $total_rows Reference to total rows array.
|
||||||
* @param string $tax_display
|
* @param string $tax_display Excl or incl tax display mode.
|
||||||
*/
|
*/
|
||||||
protected function add_order_item_totals_fee_rows( &$total_rows, $tax_display ) {
|
protected function add_order_item_totals_fee_rows( &$total_rows, $tax_display ) {
|
||||||
if ( $fees = $this->get_fees() ) {
|
$fees = $this->get_fees();
|
||||||
|
|
||||||
|
if ( $fees ) {
|
||||||
foreach ( $fees as $id => $fee ) {
|
foreach ( $fees as $id => $fee ) {
|
||||||
if ( apply_filters( 'woocommerce_get_order_item_totals_excl_free_fees', empty( $fee['line_total'] ) && empty( $fee['line_tax'] ), $id ) ) {
|
if ( apply_filters( 'woocommerce_get_order_item_totals_excl_free_fees', empty( $fee['line_total'] ) && empty( $fee['line_tax'] ), $id ) ) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1773,8 +1805,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Add total row for taxes.
|
* Add total row for taxes.
|
||||||
*
|
*
|
||||||
* @param array $total_rows
|
* @param array $total_rows Reference to total rows array.
|
||||||
* @param string $tax_display
|
* @param string $tax_display Excl or incl tax display mode.
|
||||||
*/
|
*/
|
||||||
protected function add_order_item_totals_tax_rows( &$total_rows, $tax_display ) {
|
protected function add_order_item_totals_tax_rows( &$total_rows, $tax_display ) {
|
||||||
// Tax for tax exclusive prices.
|
// Tax for tax exclusive prices.
|
||||||
|
@ -1798,8 +1830,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Add total row for grand total.
|
* Add total row for grand total.
|
||||||
*
|
*
|
||||||
* @param array $total_rows
|
* @param array $total_rows Reference to total rows array.
|
||||||
* @param string $tax_display
|
* @param string $tax_display Excl or incl tax display mode.
|
||||||
*/
|
*/
|
||||||
protected function add_order_item_totals_total_row( &$total_rows, $tax_display ) {
|
protected function add_order_item_totals_total_row( &$total_rows, $tax_display ) {
|
||||||
$total_rows['order_total'] = array(
|
$total_rows['order_total'] = array(
|
||||||
|
@ -1811,7 +1843,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Get totals for display on pages and in emails.
|
* Get totals for display on pages and in emails.
|
||||||
*
|
*
|
||||||
* @param mixed $tax_display
|
* @param mixed $tax_display Excl or incl tax display mode.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_order_item_totals( $tax_display = '' ) {
|
public function get_order_item_totals( $tax_display = '' ) {
|
||||||
|
@ -1840,18 +1872,17 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
/**
|
/**
|
||||||
* Checks the order status against a passed in status.
|
* Checks the order status against a passed in status.
|
||||||
*
|
*
|
||||||
* @param array|string $status
|
* @param array|string $status Status to check.
|
||||||
*
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has_status( $status ) {
|
public function has_status( $status ) {
|
||||||
return apply_filters( 'woocommerce_order_has_status', ( is_array( $status ) && in_array( $this->get_status(), $status ) ) || $this->get_status() === $status ? true : false, $this, $status );
|
return apply_filters( 'woocommerce_order_has_status', ( is_array( $status ) && in_array( $this->get_status(), $status, true ) ) || $this->get_status() === $status ? true : false, $this, $status );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether this order has a specific shipping method or not.
|
* Check whether this order has a specific shipping method or not.
|
||||||
*
|
*
|
||||||
* @param string $method_id
|
* @param string $method_id Method ID to check.
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has_shipping_method( $method_id ) {
|
public function has_shipping_method( $method_id ) {
|
||||||
|
@ -1865,6 +1896,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the order contains a free product.
|
* Returns true if the order contains a free product.
|
||||||
|
*
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Abstract payment gateway
|
||||||
|
*
|
||||||
|
* Hanldes generic payment gateway functionality which is extended by idividual payment gateways.
|
||||||
|
*
|
||||||
|
* @class WC_Payment_Gateway
|
||||||
|
* @version 2.1.0
|
||||||
|
* @package WooCommerce/Abstracts
|
||||||
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
|
@ -13,91 +22,103 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
* @extends WC_Settings_API
|
* @extends WC_Settings_API
|
||||||
* @version 2.1.0
|
* @version 2.1.0
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @category Abstract Class
|
|
||||||
* @author WooThemes
|
|
||||||
*/
|
*/
|
||||||
abstract class WC_Payment_Gateway extends WC_Settings_API {
|
abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set if the place order button should be renamed on selection.
|
* Set if the place order button should be renamed on selection.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $order_button_text;
|
public $order_button_text;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* yes or no based on whether the method is enabled.
|
* Yes or no based on whether the method is enabled.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $enabled = 'yes';
|
public $enabled = 'yes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment method title for the frontend.
|
* Payment method title for the frontend.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $title;
|
public $title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment method description for the frontend.
|
* Payment method description for the frontend.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $description;
|
public $description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chosen payment method id.
|
* Chosen payment method id.
|
||||||
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $chosen;
|
public $chosen;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gateway title.
|
* Gateway title.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $method_title = '';
|
public $method_title = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gateway description.
|
* Gateway description.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $method_description = '';
|
public $method_description = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the gateway shows fields on the checkout.
|
* True if the gateway shows fields on the checkout.
|
||||||
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $has_fields;
|
public $has_fields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Countries this gateway is allowed for.
|
* Countries this gateway is allowed for.
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $countries;
|
public $countries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Available for all counties or specific.
|
* Available for all counties or specific.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $availability;
|
public $availability;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Icon for the gateway.
|
* Icon for the gateway.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $icon;
|
public $icon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supported features such as 'default_credit_card_form', 'refunds'.
|
* Supported features such as 'default_credit_card_form', 'refunds'.
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $supports = array( 'products' );
|
public $supports = array( 'products' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum transaction amount, zero does not define a maximum.
|
* Maximum transaction amount, zero does not define a maximum.
|
||||||
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $max_amount = 0;
|
public $max_amount = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional URL to view a transaction.
|
* Optional URL to view a transaction.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $view_transaction_url = '';
|
public $view_transaction_url = '';
|
||||||
|
@ -105,23 +126,26 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Optional label to show for "new payment method" in the payment
|
* Optional label to show for "new payment method" in the payment
|
||||||
* method/token selection radio selection.
|
* method/token selection radio selection.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $new_method_label = '';
|
public $new_method_label = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains a users saved tokens for this gateway.
|
* Contains a users saved tokens for this gateway.
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $tokens = array();
|
protected $tokens = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a users saved tokens for this gateway.
|
* Returns a users saved tokens for this gateway.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_tokens() {
|
public function get_tokens() {
|
||||||
if ( sizeof( $this->tokens ) > 0 ) {
|
if ( count( $this->tokens ) > 0 ) {
|
||||||
return $this->tokens;
|
return $this->tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,6 +158,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the title for admin screens.
|
* Return the title for admin screens.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_method_title() {
|
public function get_method_title() {
|
||||||
|
@ -142,6 +167,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the description for admin screens.
|
* Return the description for admin screens.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_method_description() {
|
public function get_method_description() {
|
||||||
|
@ -168,7 +194,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Get the return url (thank you page).
|
* Get the return url (thank you page).
|
||||||
*
|
*
|
||||||
* @param WC_Order $order
|
* @param WC_Order $order Order object.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_return_url( $order = null ) {
|
public function get_return_url( $order = null ) {
|
||||||
|
@ -300,7 +326,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
* 'redirect' => $this->get_return_url( $order )
|
* 'redirect' => $this->get_return_url( $order )
|
||||||
* );
|
* );
|
||||||
*
|
*
|
||||||
* @param int $order_id
|
* @param int $order_id Order ID.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function process_payment( $order_id ) {
|
public function process_payment( $order_id ) {
|
||||||
|
@ -313,9 +339,9 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
* If the gateway declares 'refunds' support, this will allow it to refund.
|
* If the gateway declares 'refunds' support, this will allow it to refund.
|
||||||
* a passed in amount.
|
* a passed in amount.
|
||||||
*
|
*
|
||||||
* @param int $order_id
|
* @param int $order_id Order ID.
|
||||||
* @param float $amount
|
* @param float $amount Refund amount.
|
||||||
* @param string $reason
|
* @param string $reason Refund reason.
|
||||||
* @return boolean True or false based on success, or a WP_Error object.
|
* @return boolean True or false based on success, or a WP_Error object.
|
||||||
*/
|
*/
|
||||||
public function process_refund( $order_id, $amount = null, $reason = '' ) {
|
public function process_refund( $order_id, $amount = null, $reason = '' ) {
|
||||||
|
@ -329,15 +355,18 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function validate_fields() { return true; }
|
public function validate_fields() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If There are no payment fields show the description if set.
|
* If There are no payment fields show the description if set.
|
||||||
* Override this in your gateway if you have some.
|
* Override this in your gateway if you have some.
|
||||||
*/
|
*/
|
||||||
public function payment_fields() {
|
public function payment_fields() {
|
||||||
if ( $description = $this->get_description() ) {
|
$description = $this->get_description();
|
||||||
echo wpautop( wptexturize( $description ) );
|
if ( $description ) {
|
||||||
|
echo wpautop( wptexturize( $description ) ); // @codingStandardsIgnoreLine.
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $this->supports( 'default_credit_card_form' ) ) {
|
if ( $this->supports( 'default_credit_card_form' ) ) {
|
||||||
|
@ -361,12 +390,13 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Core credit card form which gateways can used if needed. Deprecated - inherit WC_Payment_Gateway_CC instead.
|
* Core credit card form which gateways can used if needed. Deprecated - inherit WC_Payment_Gateway_CC instead.
|
||||||
* @param array $args
|
*
|
||||||
* @param array $fields
|
* @param array $args Arguments.
|
||||||
|
* @param array $fields Fields.
|
||||||
*/
|
*/
|
||||||
public function credit_card_form( $args = array(), $fields = array() ) {
|
public function credit_card_form( $args = array(), $fields = array() ) {
|
||||||
wc_deprecated_function( 'credit_card_form', '2.6', 'WC_Payment_Gateway_CC->form' );
|
wc_deprecated_function( 'credit_card_form', '2.6', 'WC_Payment_Gateway_CC->form' );
|
||||||
$cc_form = new WC_Payment_Gateway_CC;
|
$cc_form = new WC_Payment_Gateway_CC();
|
||||||
$cc_form->id = $this->id;
|
$cc_form->id = $this->id;
|
||||||
$cc_form->supports = $this->supports;
|
$cc_form->supports = $this->supports;
|
||||||
$cc_form->form();
|
$cc_form->form();
|
||||||
|
@ -374,6 +404,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueues our tokenization script to handle some of the new form options.
|
* Enqueues our tokenization script to handle some of the new form options.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
*/
|
*/
|
||||||
public function tokenization_script() {
|
public function tokenization_script() {
|
||||||
|
@ -387,6 +418,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grab and display our saved payment methods.
|
* Grab and display our saved payment methods.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
*/
|
*/
|
||||||
public function saved_payment_methods() {
|
public function saved_payment_methods() {
|
||||||
|
@ -399,13 +431,14 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
$html .= $this->get_new_payment_method_option_html();
|
$html .= $this->get_new_payment_method_option_html();
|
||||||
$html .= '</ul>';
|
$html .= '</ul>';
|
||||||
|
|
||||||
echo apply_filters( 'wc_payment_gateway_form_saved_payment_methods_html', $html, $this );
|
echo apply_filters( 'wc_payment_gateway_form_saved_payment_methods_html', $html, $this ); // @codingStandardsIgnoreLine
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets saved payment method HTML from a token.
|
* Gets saved payment method HTML from a token.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param WC_Payment_Token $token Payment Token
|
* @param WC_Payment_Token $token Payment Token.
|
||||||
* @return string Generated payment method HTML
|
* @return string Generated payment method HTML
|
||||||
*/
|
*/
|
||||||
public function get_saved_payment_method_option_html( $token ) {
|
public function get_saved_payment_method_option_html( $token ) {
|
||||||
|
@ -426,6 +459,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Displays a radio button for entering a new payment method (new CC details) instead of using a saved method.
|
* Displays a radio button for entering a new payment method (new CC details) instead of using a saved method.
|
||||||
* Only displayed when a gateway supports tokenization.
|
* Only displayed when a gateway supports tokenization.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
*/
|
*/
|
||||||
public function get_new_payment_method_option_html() {
|
public function get_new_payment_method_option_html() {
|
||||||
|
@ -444,6 +478,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs a checkbox for saving a new payment method to the database.
|
* Outputs a checkbox for saving a new payment method to the database.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
*/
|
*/
|
||||||
public function save_payment_method_checkbox() {
|
public function save_payment_method_checkbox() {
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Abstract payment tokens
|
||||||
|
*
|
||||||
|
* Generic payment tokens functionality which can be extended by idividual types of payment tokens.
|
||||||
|
*
|
||||||
|
* @class WC_Payment_Token
|
||||||
|
* @package WooCommerce/Abstracts
|
||||||
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php' );
|
require_once WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WooCommerce Payment Token.
|
* WooCommerce Payment Token.
|
||||||
|
@ -15,13 +24,12 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
* @version 3.0.0
|
* @version 3.0.0
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @category Abstract Class
|
|
||||||
* @author WooThemes
|
|
||||||
*/
|
*/
|
||||||
abstract class WC_Payment_Token extends WC_Legacy_Payment_Token {
|
abstract class WC_Payment_Token extends WC_Legacy_Payment_Token {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token Data (stored in the payment_tokens table).
|
* Token Data (stored in the payment_tokens table).
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $data = array(
|
protected $data = array(
|
||||||
|
@ -35,6 +43,8 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
/**
|
/**
|
||||||
* Token Type (CC, eCheck, or a custom type added by an extension).
|
* Token Type (CC, eCheck, or a custom type added by an extension).
|
||||||
* Set by child classes.
|
* Set by child classes.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $type = '';
|
protected $type = '';
|
||||||
|
|
||||||
|
@ -48,7 +58,7 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
* user_id - int Optional - ID for the user this token is associated with. 0 if this token is not associated with a user
|
* user_id - int Optional - ID for the user this token is associated with. 0 if this token is not associated with a user
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param mixed $token
|
* @param mixed $token Token.
|
||||||
*/
|
*/
|
||||||
public function __construct( $token = '' ) {
|
public function __construct( $token = '' ) {
|
||||||
parent::__construct( $token );
|
parent::__construct( $token );
|
||||||
|
@ -71,16 +81,16 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
*--------------------------------------------------------------------------
|
||||||
| Getters
|
* Getters
|
||||||
|--------------------------------------------------------------------------
|
*--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the raw payment token.
|
* Returns the raw payment token.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $context
|
* @param string $context Context in which to call this.
|
||||||
* @return string Raw token
|
* @return string Raw token
|
||||||
*/
|
*/
|
||||||
public function get_token( $context = 'view' ) {
|
public function get_token( $context = 'view' ) {
|
||||||
|
@ -92,7 +102,7 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
* Overwritten by child classes.
|
* Overwritten by child classes.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $deprecated Deprecated since WooCommerce 3.0
|
* @param string $deprecated Deprecated since WooCommerce 3.0.
|
||||||
* @return string Payment Token Type (CC, eCheck)
|
* @return string Payment Token Type (CC, eCheck)
|
||||||
*/
|
*/
|
||||||
public function get_type( $deprecated = '' ) {
|
public function get_type( $deprecated = '' ) {
|
||||||
|
@ -104,7 +114,7 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
* Get's overwritten by child classes.
|
* Get's overwritten by child classes.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $deprecated Deprecated since WooCommerce 3.0
|
* @param string $deprecated Deprecated since WooCommerce 3.0.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_display_name( $deprecated = '' ) {
|
public function get_display_name( $deprecated = '' ) {
|
||||||
|
@ -115,7 +125,7 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
* Returns the user ID associated with the token or false if this token is not associated.
|
* Returns the user ID associated with the token or false if this token is not associated.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $context
|
* @param string $context In what context to execute this.
|
||||||
* @return int User ID if this token is associated with a user or 0 if no user is associated
|
* @return int User ID if this token is associated with a user or 0 if no user is associated
|
||||||
*/
|
*/
|
||||||
public function get_user_id( $context = 'view' ) {
|
public function get_user_id( $context = 'view' ) {
|
||||||
|
@ -126,7 +136,7 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
* Returns the ID of the gateway associated with this payment token.
|
* Returns the ID of the gateway associated with this payment token.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $context
|
* @param string $context In what context to execute this.
|
||||||
* @return string Gateway ID
|
* @return string Gateway ID
|
||||||
*/
|
*/
|
||||||
public function get_gateway_id( $context = 'view' ) {
|
public function get_gateway_id( $context = 'view' ) {
|
||||||
|
@ -137,7 +147,7 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
* Returns the ID of the gateway associated with this payment token.
|
* Returns the ID of the gateway associated with this payment token.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $context
|
* @param string $context In what context to execute this.
|
||||||
* @return string Gateway ID
|
* @return string Gateway ID
|
||||||
*/
|
*/
|
||||||
public function get_is_default( $context = 'view' ) {
|
public function get_is_default( $context = 'view' ) {
|
||||||
|
@ -154,7 +164,7 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
* Set the raw payment token.
|
* Set the raw payment token.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $token
|
* @param string $token Payment token.
|
||||||
*/
|
*/
|
||||||
public function set_token( $token ) {
|
public function set_token( $token ) {
|
||||||
$this->set_prop( 'token', $token );
|
$this->set_prop( 'token', $token );
|
||||||
|
@ -164,7 +174,7 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
* Set the user ID for the user associated with this order.
|
* Set the user ID for the user associated with this order.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param int $user_id
|
* @param int $user_id User ID.
|
||||||
*/
|
*/
|
||||||
public function set_user_id( $user_id ) {
|
public function set_user_id( $user_id ) {
|
||||||
$this->set_prop( 'user_id', absint( $user_id ) );
|
$this->set_prop( 'user_id', absint( $user_id ) );
|
||||||
|
@ -174,7 +184,7 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
* Set the gateway ID.
|
* Set the gateway ID.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $gateway_id
|
* @param string $gateway_id Gateway ID.
|
||||||
*/
|
*/
|
||||||
public function set_gateway_id( $gateway_id ) {
|
public function set_gateway_id( $gateway_id ) {
|
||||||
$this->set_prop( 'gateway_id', $gateway_id );
|
$this->set_prop( 'gateway_id', $gateway_id );
|
||||||
|
@ -182,8 +192,9 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the payment as default or non-default.
|
* Marks the payment as default or non-default.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param boolean $is_default True or false
|
* @param boolean $is_default True or false.
|
||||||
*/
|
*/
|
||||||
public function set_default( $is_default ) {
|
public function set_default( $is_default ) {
|
||||||
$this->set_prop( 'is_default', (bool) $is_default );
|
$this->set_prop( 'is_default', (bool) $is_default );
|
||||||
|
@ -207,6 +218,7 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate basic token info (token and type are required).
|
* Validate basic token info (token and type are required).
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @return boolean True if the passed data is valid
|
* @return boolean True if the passed data is valid
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* WooCommerce product base class.
|
* WooCommerce product base class.
|
||||||
*
|
*
|
||||||
* @package WooCommerce/Classes
|
* @package WooCommerce/Abstracts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
* Legacy product contains all deprecated methods for this class and can be
|
* Legacy product contains all deprecated methods for this class and can be
|
||||||
* removed in the future.
|
* removed in the future.
|
||||||
*/
|
*/
|
||||||
include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-product.php' );
|
require_once WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-product.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract Product Class
|
* Abstract Product Class
|
||||||
|
@ -22,8 +22,6 @@ include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-product.php' );
|
||||||
*
|
*
|
||||||
* @version 3.0.0
|
* @version 3.0.0
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @category Abstract Class
|
|
||||||
* @author WooThemes
|
|
||||||
*/
|
*/
|
||||||
class WC_Product extends WC_Abstract_Legacy_Product {
|
class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
|
|
||||||
|
@ -1192,6 +1190,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
// Validate the file extension.
|
// Validate the file extension.
|
||||||
if ( ! $download_object->is_allowed_filetype() ) {
|
if ( ! $download_object->is_allowed_filetype() ) {
|
||||||
if ( $this->get_object_read() ) {
|
if ( $this->get_object_read() ) {
|
||||||
|
/* translators: %1$s: Downloadable file */
|
||||||
$errors[] = sprintf( __( 'The downloadable file %1$s cannot be used as it does not have an allowed file type. Allowed types include: %2$s', 'woocommerce' ), '<code>' . basename( $download_object->get_file() ) . '</code>', '<code>' . implode( ', ', array_keys( $download_object->get_allowed_mime_types() ) ) . '</code>' );
|
$errors[] = sprintf( __( 'The downloadable file %1$s cannot be used as it does not have an allowed file type. Allowed types include: %2$s', 'woocommerce' ), '<code>' . basename( $download_object->get_file() ) . '</code>', '<code>' . implode( ', ', array_keys( $download_object->get_allowed_mime_types() ) ) . '</code>' );
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -1200,6 +1199,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
// Validate the file exists.
|
// Validate the file exists.
|
||||||
if ( ! $download_object->file_exists() ) {
|
if ( ! $download_object->file_exists() ) {
|
||||||
if ( $this->get_object_read() ) {
|
if ( $this->get_object_read() ) {
|
||||||
|
/* translators: %s: Downloadable file */
|
||||||
$errors[] = sprintf( __( 'The downloadable file %s cannot be used as it does not exist on the server.', 'woocommerce' ), '<code>' . $download_object->get_file() . '</code>' );
|
$errors[] = sprintf( __( 'The downloadable file %s cannot be used as it does not exist on the server.', 'woocommerce' ), '<code>' . $download_object->get_file() . '</code>' );
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -1801,14 +1801,15 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
public function get_image( $size = 'woocommerce_thumbnail', $attr = array(), $placeholder = true ) {
|
public function get_image( $size = 'woocommerce_thumbnail', $attr = array(), $placeholder = true ) {
|
||||||
if ( has_post_thumbnail( $this->get_id() ) ) {
|
if ( has_post_thumbnail( $this->get_id() ) ) {
|
||||||
$image = get_the_post_thumbnail( $this->get_id(), $size, $attr );
|
$image = get_the_post_thumbnail( $this->get_id(), $size, $attr );
|
||||||
} elseif ( ( $parent_id = wp_get_post_parent_id( $this->get_id() ) ) && has_post_thumbnail( $parent_id ) ) {
|
} elseif ( ( $parent_id = wp_get_post_parent_id( $this->get_id() ) ) && has_post_thumbnail( $parent_id ) ) { // @phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.Found
|
||||||
$image = get_the_post_thumbnail( $parent_id, $size, $attr );
|
$image = get_the_post_thumbnail( $parent_id, $size, $attr );
|
||||||
} elseif ( $placeholder ) {
|
} elseif ( $placeholder ) {
|
||||||
$image = wc_placeholder_img( $size );
|
$image = wc_placeholder_img( $size );
|
||||||
} else {
|
} else {
|
||||||
$image = '';
|
$image = '';
|
||||||
}
|
}
|
||||||
return apply_filters( 'woocommerce_product_get_image', wc_get_relative_url( $image ), $this, $size, $attr, $placeholder );
|
|
||||||
|
return apply_filters( 'woocommerce_product_get_image', wc_get_relative_url( $image ), $this, $size, $attr, $placeholder, $image );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1817,7 +1818,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_shipping_class() {
|
public function get_shipping_class() {
|
||||||
if ( $class_id = $this->get_shipping_class_id() ) {
|
if ( $class_id = $this->get_shipping_class_id() ) { // @phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.Found
|
||||||
$term = get_term_by( 'id', $class_id, 'product_shipping_class' );
|
$term = get_term_by( 'id', $class_id, 'product_shipping_class' );
|
||||||
|
|
||||||
if ( $term && ! is_wp_error( $term ) ) {
|
if ( $term && ! is_wp_error( $term ) ) {
|
||||||
|
@ -1909,13 +1910,13 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
public function get_price_suffix( $price = '', $qty = 1 ) {
|
public function get_price_suffix( $price = '', $qty = 1 ) {
|
||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
if ( ( $suffix = get_option( 'woocommerce_price_display_suffix' ) ) && wc_tax_enabled() && 'taxable' === $this->get_tax_status() ) {
|
if ( ( $suffix = get_option( 'woocommerce_price_display_suffix' ) ) && wc_tax_enabled() && 'taxable' === $this->get_tax_status() ) { // @phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.Found
|
||||||
if ( '' === $price ) {
|
if ( '' === $price ) {
|
||||||
$price = $this->get_price();
|
$price = $this->get_price();
|
||||||
}
|
}
|
||||||
$replacements = array(
|
$replacements = array(
|
||||||
'{price_including_tax}' => wc_price( wc_get_price_including_tax( $this, array( 'qty' => $qty, 'price' => $price ) ) ),
|
'{price_including_tax}' => wc_price( wc_get_price_including_tax( $this, array( 'qty' => $qty, 'price' => $price ) ) ), // @phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine, WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
|
||||||
'{price_excluding_tax}' => wc_price( wc_get_price_excluding_tax( $this, array( 'qty' => $qty, 'price' => $price ) ) ),
|
'{price_excluding_tax}' => wc_price( wc_get_price_excluding_tax( $this, array( 'qty' => $qty, 'price' => $price ) ) ), // @phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
|
||||||
);
|
);
|
||||||
$html = str_replace( array_keys( $replacements ), array_values( $replacements ), ' <small class="woocommerce-price-suffix">' . wp_kses_post( $suffix ) . '</small>' );
|
$html = str_replace( array_keys( $replacements ), array_values( $replacements ), ' <small class="woocommerce-price-suffix">' . wp_kses_post( $suffix ) . '</small>' );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* REST Controller
|
||||||
|
*
|
||||||
|
* @class WC_REST_Controller
|
||||||
|
* @package WooCommerce/Abstracts
|
||||||
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
|
@ -7,8 +13,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
/**
|
/**
|
||||||
* Abstract Rest Controller Class
|
* Abstract Rest Controller Class
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category API
|
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @extends WP_REST_Controller
|
* @extends WP_REST_Controller
|
||||||
* @version 2.6.0
|
* @version 2.6.0
|
||||||
|
@ -109,7 +113,11 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
* @return array Of WP_Error or WP_REST_Response.
|
* @return array Of WP_Error or WP_REST_Response.
|
||||||
*/
|
*/
|
||||||
public function batch_items( $request ) {
|
public function batch_items( $request ) {
|
||||||
/** @var WP_REST_Server $wp_rest_server */
|
/**
|
||||||
|
* REST Server
|
||||||
|
*
|
||||||
|
* @var WP_REST_Server $wp_rest_server
|
||||||
|
*/
|
||||||
global $wp_rest_server;
|
global $wp_rest_server;
|
||||||
|
|
||||||
// Get the request params.
|
// Get the request params.
|
||||||
|
@ -143,7 +151,11 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
if ( is_wp_error( $_response ) ) {
|
if ( is_wp_error( $_response ) ) {
|
||||||
$response['create'][] = array(
|
$response['create'][] = array(
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'error' => array( 'code' => $_response->get_error_code(), 'message' => $_response->get_error_message(), 'data' => $_response->get_error_data() ),
|
'error' => array(
|
||||||
|
'code' => $_response->get_error_code(),
|
||||||
|
'message' => $_response->get_error_message(),
|
||||||
|
'data' => $_response->get_error_data(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$response['create'][] = $wp_rest_server->response_to_data( $_response, '' );
|
$response['create'][] = $wp_rest_server->response_to_data( $_response, '' );
|
||||||
|
@ -160,7 +172,11 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
if ( is_wp_error( $_response ) ) {
|
if ( is_wp_error( $_response ) ) {
|
||||||
$response['update'][] = array(
|
$response['update'][] = array(
|
||||||
'id' => $item['id'],
|
'id' => $item['id'],
|
||||||
'error' => array( 'code' => $_response->get_error_code(), 'message' => $_response->get_error_message(), 'data' => $_response->get_error_data() ),
|
'error' => array(
|
||||||
|
'code' => $_response->get_error_code(),
|
||||||
|
'message' => $_response->get_error_message(),
|
||||||
|
'data' => $_response->get_error_data(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$response['update'][] = $wp_rest_server->response_to_data( $_response, '' );
|
$response['update'][] = $wp_rest_server->response_to_data( $_response, '' );
|
||||||
|
@ -177,13 +193,20 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
$_item = new WP_REST_Request( 'DELETE' );
|
$_item = new WP_REST_Request( 'DELETE' );
|
||||||
$_item->set_query_params( array( 'id' => $id, 'force' => true ) );
|
$_item->set_query_params( array(
|
||||||
|
'id' => $id,
|
||||||
|
'force' => true,
|
||||||
|
) );
|
||||||
$_response = $this->delete_item( $_item );
|
$_response = $this->delete_item( $_item );
|
||||||
|
|
||||||
if ( is_wp_error( $_response ) ) {
|
if ( is_wp_error( $_response ) ) {
|
||||||
$response['delete'][] = array(
|
$response['delete'][] = array(
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'error' => array( 'code' => $_response->get_error_code(), 'message' => $_response->get_error_message(), 'data' => $_response->get_error_data() ),
|
'error' => array(
|
||||||
|
'code' => $_response->get_error_code(),
|
||||||
|
'message' => $_response->get_error_message(),
|
||||||
|
'data' => $_response->get_error_data(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$response['delete'][] = $wp_rest_server->response_to_data( $_response, '' );
|
$response['delete'][] = $wp_rest_server->response_to_data( $_response, '' );
|
||||||
|
@ -198,8 +221,8 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
* Validate a text value for a text based setting.
|
* Validate a text value for a text based setting.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param string $value
|
* @param string $value Value.
|
||||||
* @param array $setting
|
* @param array $setting Setting.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function validate_setting_text_field( $value, $setting ) {
|
public function validate_setting_text_field( $value, $setting ) {
|
||||||
|
@ -211,8 +234,8 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
* Validate select based settings.
|
* Validate select based settings.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param string $value
|
* @param string $value Value.
|
||||||
* @param array $setting
|
* @param array $setting Setting.
|
||||||
* @return string|WP_Error
|
* @return string|WP_Error
|
||||||
*/
|
*/
|
||||||
public function validate_setting_select_field( $value, $setting ) {
|
public function validate_setting_select_field( $value, $setting ) {
|
||||||
|
@ -227,8 +250,8 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
* Validate multiselect based settings.
|
* Validate multiselect based settings.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param array $values
|
* @param array $values Values.
|
||||||
* @param array $setting
|
* @param array $setting Setting.
|
||||||
* @return array|WP_Error
|
* @return array|WP_Error
|
||||||
*/
|
*/
|
||||||
public function validate_setting_multiselect_field( $values, $setting ) {
|
public function validate_setting_multiselect_field( $values, $setting ) {
|
||||||
|
@ -254,8 +277,8 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
* Validate image_width based settings.
|
* Validate image_width based settings.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param array $values
|
* @param array $values Values.
|
||||||
* @param array $setting
|
* @param array $setting Setting.
|
||||||
* @return string|WP_Error
|
* @return string|WP_Error
|
||||||
*/
|
*/
|
||||||
public function validate_setting_image_width_field( $values, $setting ) {
|
public function validate_setting_image_width_field( $values, $setting ) {
|
||||||
|
@ -280,8 +303,8 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
* Validate radio based settings.
|
* Validate radio based settings.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param string $value
|
* @param string $value Value.
|
||||||
* @param array $setting
|
* @param array $setting Setting.
|
||||||
* @return string|WP_Error
|
* @return string|WP_Error
|
||||||
*/
|
*/
|
||||||
public function validate_setting_radio_field( $value, $setting ) {
|
public function validate_setting_radio_field( $value, $setting ) {
|
||||||
|
@ -292,8 +315,8 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
* Validate checkbox based settings.
|
* Validate checkbox based settings.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param string $value
|
* @param string $value Value.
|
||||||
* @param array $setting
|
* @param array $setting Setting.
|
||||||
* @return string|WP_Error
|
* @return string|WP_Error
|
||||||
*/
|
*/
|
||||||
public function validate_setting_checkbox_field( $value, $setting ) {
|
public function validate_setting_checkbox_field( $value, $setting ) {
|
||||||
|
@ -311,8 +334,8 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
* Validate textarea based settings.
|
* Validate textarea based settings.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @param string $value
|
* @param string $value Value.
|
||||||
* @param array $setting
|
* @param array $setting Setting.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function validate_setting_textarea_field( $value, $setting ) {
|
public function validate_setting_textarea_field( $value, $setting ) {
|
||||||
|
@ -320,7 +343,12 @@ abstract class WC_REST_Controller extends WP_REST_Controller {
|
||||||
return wp_kses( trim( stripslashes( $value ) ),
|
return wp_kses( trim( stripslashes( $value ) ),
|
||||||
array_merge(
|
array_merge(
|
||||||
array(
|
array(
|
||||||
'iframe' => array( 'src' => true, 'style' => true, 'id' => true, 'class' => true ),
|
'iframe' => array(
|
||||||
|
'src' => true,
|
||||||
|
'style' => true,
|
||||||
|
'id' => true,
|
||||||
|
'class' => true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
wp_kses_allowed_html( 'post' )
|
wp_kses_allowed_html( 'post' )
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* Abstract Rest CRUD Controller Class
|
* Abstract Rest CRUD Controller Class
|
||||||
*
|
*
|
||||||
* @author Automattic
|
* @class WC_REST_CRUD_Controller
|
||||||
* @category API
|
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @version 3.0.0
|
* @version 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -40,6 +39,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
|
||||||
* @return object WC_Data object or WP_Error object.
|
* @return object WC_Data object or WP_Error object.
|
||||||
*/
|
*/
|
||||||
protected function get_object( $id ) {
|
protected function get_object( $id ) {
|
||||||
|
// translators: %s: Class method name.
|
||||||
return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
|
return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
|
||||||
/**
|
/**
|
||||||
* Get object permalink.
|
* Get object permalink.
|
||||||
*
|
*
|
||||||
* @param object $object
|
* @param object $object Object.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function get_permalink( $object ) {
|
protected function get_permalink( $object ) {
|
||||||
|
@ -110,6 +110,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
|
||||||
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
|
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
|
||||||
*/
|
*/
|
||||||
protected function prepare_object_for_response( $object, $request ) {
|
protected function prepare_object_for_response( $object, $request ) {
|
||||||
|
// translators: %s: Class method name.
|
||||||
return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
|
return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +123,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
|
||||||
* @return WP_Error|WC_Data The prepared item, or WP_Error object on failure.
|
* @return WP_Error|WC_Data The prepared item, or WP_Error object on failure.
|
||||||
*/
|
*/
|
||||||
protected function prepare_object_for_database( $request, $creating = false ) {
|
protected function prepare_object_for_database( $request, $creating = false ) {
|
||||||
|
// translators: %s: Class method name.
|
||||||
return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
|
return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Abstract Rest Posts Controller Class
|
||||||
|
*
|
||||||
|
* @class WC_REST_Posts_Controller
|
||||||
|
* @package WooCommerce/Abstracts
|
||||||
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract Rest Posts Controller Class
|
* WC_REST_Posts_Controller
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category API
|
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @version 2.6.0
|
* @version 2.6.0
|
||||||
*/
|
*/
|
||||||
|
@ -223,8 +227,8 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
||||||
/**
|
/**
|
||||||
* Add post meta fields.
|
* Add post meta fields.
|
||||||
*
|
*
|
||||||
* @param WP_Post $post
|
* @param WP_Post $post Post Object.
|
||||||
* @param WP_REST_Request $request
|
* @param WP_REST_Request $request WP_REST_Request Object.
|
||||||
* @return bool|WP_Error
|
* @return bool|WP_Error
|
||||||
*/
|
*/
|
||||||
protected function add_post_meta_fields( $post, $request ) {
|
protected function add_post_meta_fields( $post, $request ) {
|
||||||
|
@ -234,7 +238,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
||||||
/**
|
/**
|
||||||
* Delete post.
|
* Delete post.
|
||||||
*
|
*
|
||||||
* @param WP_Post $post
|
* @param WP_Post $post Post object.
|
||||||
*/
|
*/
|
||||||
protected function delete_post( $post ) {
|
protected function delete_post( $post ) {
|
||||||
wp_delete_post( $post->ID, true );
|
wp_delete_post( $post->ID, true );
|
||||||
|
@ -364,7 +368,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
||||||
$total_posts = $posts_query->found_posts;
|
$total_posts = $posts_query->found_posts;
|
||||||
|
|
||||||
if ( $total_posts < 1 ) {
|
if ( $total_posts < 1 ) {
|
||||||
// Out-of-bounds, run the query again without LIMIT for total count
|
// Out-of-bounds, run the query again without LIMIT for total count.
|
||||||
unset( $query_args['paged'] );
|
unset( $query_args['paged'] );
|
||||||
$count_query = new WP_Query();
|
$count_query = new WP_Query();
|
||||||
$count_query->query( $query_args );
|
$count_query->query( $query_args );
|
||||||
|
@ -499,8 +503,8 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
||||||
* Determine the allowed query_vars for a get_items() response and
|
* Determine the allowed query_vars for a get_items() response and
|
||||||
* prepare for WP_Query.
|
* prepare for WP_Query.
|
||||||
*
|
*
|
||||||
* @param array $prepared_args
|
* @param array $prepared_args Prepared arguments.
|
||||||
* @param WP_REST_Request $request
|
* @param WP_REST_Request $request Request object.
|
||||||
* @return array $query_args
|
* @return array $query_args
|
||||||
*/
|
*/
|
||||||
protected function prepare_items_query( $prepared_args = array(), $request = null ) {
|
protected function prepare_items_query( $prepared_args = array(), $request = null ) {
|
||||||
|
@ -515,7 +519,6 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
||||||
* The dynamic portion of the hook name, $var, refers to the query_var key.
|
* The dynamic portion of the hook name, $var, refers to the query_var key.
|
||||||
*
|
*
|
||||||
* @param mixed $prepared_args[ $var ] The query_var value.
|
* @param mixed $prepared_args[ $var ] The query_var value.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
$query_args[ $var ] = apply_filters( "woocommerce_rest_query_var-{$var}", $prepared_args[ $var ] );
|
$query_args[ $var ] = apply_filters( "woocommerce_rest_query_var-{$var}", $prepared_args[ $var ] );
|
||||||
}
|
}
|
||||||
|
@ -526,7 +529,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
||||||
if ( 'include' === $query_args['orderby'] ) {
|
if ( 'include' === $query_args['orderby'] ) {
|
||||||
$query_args['orderby'] = 'post__in';
|
$query_args['orderby'] = 'post__in';
|
||||||
} elseif ( 'id' === $query_args['orderby'] ) {
|
} elseif ( 'id' === $query_args['orderby'] ) {
|
||||||
$query_args['orderby'] = 'ID'; // ID must be capitalized
|
$query_args['orderby'] = 'ID'; // ID must be capitalized.
|
||||||
}
|
}
|
||||||
|
|
||||||
return $query_args;
|
return $query_args;
|
||||||
|
@ -708,8 +711,8 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
||||||
/**
|
/**
|
||||||
* Update post meta fields.
|
* Update post meta fields.
|
||||||
*
|
*
|
||||||
* @param WP_Post $post
|
* @param WP_Post $post Post object.
|
||||||
* @param WP_REST_Request $request
|
* @param WP_REST_Request $request Request object.
|
||||||
* @return bool|WP_Error
|
* @return bool|WP_Error
|
||||||
*/
|
*/
|
||||||
protected function update_post_meta_fields( $post, $request ) {
|
protected function update_post_meta_fields( $post, $request ) {
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
*
|
*
|
||||||
* Houses common functionality between Shipping Zones and Locations.
|
* Houses common functionality between Shipping Zones and Locations.
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
* @package WooCommerce/Abstracts
|
||||||
* @category API
|
|
||||||
* @package WooCommerce/API
|
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
<?php // @codingStandardsIgnoreLine.
|
<?php
|
||||||
/**
|
/**
|
||||||
* Handle data for the current customers session
|
* Handle data for the current customers session
|
||||||
*
|
*
|
||||||
* @class WC_Session
|
* @class WC_Session
|
||||||
* @version 2.0.0
|
* @version 2.0.0
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @category Abstract Class
|
|
||||||
* @author Automattic
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
|
|
@ -1,60 +1,64 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract Settings API Class
|
* Abstract Settings API Class
|
||||||
*
|
*
|
||||||
* Admin Settings API used by Integrations, Shipping Methods, and Payment Gateways.
|
* Admin Settings API used by Integrations, Shipping Methods, and Payment Gateways.
|
||||||
*
|
*
|
||||||
* @class WC_Settings_API
|
|
||||||
* @version 2.6.0
|
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @category Abstract Class
|
*/
|
||||||
* @author WooThemes
|
|
||||||
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WC_Settings_API class.
|
||||||
*/
|
*/
|
||||||
abstract class WC_Settings_API {
|
abstract class WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The plugin ID. Used for option names.
|
* The plugin ID. Used for option names.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $plugin_id = 'woocommerce_';
|
public $plugin_id = 'woocommerce_';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the class extending the settings API. Used in option names.
|
* ID of the class extending the settings API. Used in option names.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $id = '';
|
public $id = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation errors.
|
* Validation errors.
|
||||||
|
*
|
||||||
* @var array of strings
|
* @var array of strings
|
||||||
*/
|
*/
|
||||||
public $errors = array();
|
public $errors = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting values.
|
* Setting values.
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $settings = array();
|
public $settings = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form option fields.
|
* Form option fields.
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $form_fields = array();
|
public $form_fields = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The posted settings data. When empty, $_POST data will be used.
|
* The posted settings data. When empty, $_POST data will be used.
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $data = array();
|
protected $data = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the form fields after they are initialized.
|
* Get the form fields after they are initialized.
|
||||||
|
*
|
||||||
* @return array of options
|
* @return array of options
|
||||||
*/
|
*/
|
||||||
public function get_form_fields() {
|
public function get_form_fields() {
|
||||||
|
@ -64,8 +68,7 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Set default required properties for each field.
|
* Set default required properties for each field.
|
||||||
*
|
*
|
||||||
* @param array $field
|
* @param array $field Setting field array.
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function set_defaults( $field ) {
|
protected function set_defaults( $field ) {
|
||||||
|
@ -79,14 +82,13 @@ abstract class WC_Settings_API {
|
||||||
* Output the admin options table.
|
* Output the admin options table.
|
||||||
*/
|
*/
|
||||||
public function admin_options() {
|
public function admin_options() {
|
||||||
echo '<table class="form-table">' . $this->generate_settings_html( $this->get_form_fields(), false ) . '</table>';
|
echo '<table class="form-table">' . $this->generate_settings_html( $this->get_form_fields(), false ) . '</table>'; // WPCS: XSS ok.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise settings form fields.
|
* Initialise settings form fields.
|
||||||
*
|
*
|
||||||
* Add an array of fields to be displayed
|
* Add an array of fields to be displayed on the gateway's settings screen.
|
||||||
* on the gateway's settings screen.
|
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -94,6 +96,7 @@ abstract class WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the name of the option in the WP DB.
|
* Return the name of the option in the WP DB.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -103,7 +106,8 @@ abstract class WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a fields type. Defaults to "text" if not set.
|
* Get a fields type. Defaults to "text" if not set.
|
||||||
* @param array $field
|
*
|
||||||
|
* @param array $field Field key.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_field_type( $field ) {
|
public function get_field_type( $field ) {
|
||||||
|
@ -112,7 +116,8 @@ abstract class WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a fields default value. Defaults to "" if not set.
|
* Get a fields default value. Defaults to "" if not set.
|
||||||
* @param array $field
|
*
|
||||||
|
* @param array $field Field key.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_field_default( $field ) {
|
public function get_field_default( $field ) {
|
||||||
|
@ -121,35 +126,40 @@ abstract class WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a field's posted and validated value.
|
* Get a field's posted and validated value.
|
||||||
* @param string $key
|
*
|
||||||
* @param array $field
|
* @param string $key Field key.
|
||||||
* @param array $post_data
|
* @param array $field Field array.
|
||||||
|
* @param array $post_data Posted data.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_field_value( $key, $field, $post_data = array() ) {
|
public function get_field_value( $key, $field, $post_data = array() ) {
|
||||||
$type = $this->get_field_type( $field );
|
$type = $this->get_field_type( $field );
|
||||||
$field_key = $this->get_field_key( $key );
|
$field_key = $this->get_field_key( $key );
|
||||||
$post_data = empty( $post_data ) ? $_POST : $post_data;
|
$post_data = empty( $post_data ) ? $_POST : $post_data; // WPCS: CSRF ok, input var ok.
|
||||||
$value = isset( $post_data[ $field_key ] ) ? $post_data[ $field_key ] : null;
|
$value = isset( $post_data[ $field_key ] ) ? $post_data[ $field_key ] : null;
|
||||||
|
|
||||||
// Look for a validate_FIELDID_field method for special handling
|
if ( isset( $field['sanitize_callback'] ) && is_callable( $field['sanitize_callback'] ) ) {
|
||||||
|
return call_user_func( $field['sanitize_callback'], $value );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look for a validate_FIELDID_field method for special handling.
|
||||||
if ( is_callable( array( $this, 'validate_' . $key . '_field' ) ) ) {
|
if ( is_callable( array( $this, 'validate_' . $key . '_field' ) ) ) {
|
||||||
return $this->{'validate_' . $key . '_field'}( $key, $value );
|
return $this->{'validate_' . $key . '_field'}( $key, $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for a validate_FIELDTYPE_field method
|
// Look for a validate_FIELDTYPE_field method.
|
||||||
if ( is_callable( array( $this, 'validate_' . $type . '_field' ) ) ) {
|
if ( is_callable( array( $this, 'validate_' . $type . '_field' ) ) ) {
|
||||||
return $this->{'validate_' . $type . '_field'}( $key, $value );
|
return $this->{'validate_' . $type . '_field'}( $key, $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback to text
|
// Fallback to text.
|
||||||
return $this->validate_text_field( $key, $value );
|
return $this->validate_text_field( $key, $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the POSTed data. This method can be used to set specific data, instead
|
* Sets the POSTed data. This method can be used to set specific data, instead of taking it from the $_POST array.
|
||||||
* of taking it from the $_POST array.
|
*
|
||||||
* @param array data
|
* @param array $data Posted data.
|
||||||
*/
|
*/
|
||||||
public function set_post_data( $data = array() ) {
|
public function set_post_data( $data = array() ) {
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
|
@ -157,18 +167,20 @@ abstract class WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the POSTed data, to be used to save the settings.
|
* Returns the POSTed data, to be used to save the settings.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_post_data() {
|
public function get_post_data() {
|
||||||
if ( ! empty( $this->data ) && is_array( $this->data ) ) {
|
if ( ! empty( $this->data ) && is_array( $this->data ) ) {
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
return $_POST;
|
return $_POST; // WPCS: CSRF ok, input var ok.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes and saves options.
|
* Processes and saves options.
|
||||||
* If there is an error thrown, will continue to save and validate fields, but will leave the erroring field out.
|
* If there is an error thrown, will continue to save and validate fields, but will leave the erroring field out.
|
||||||
|
*
|
||||||
* @return bool was anything saved?
|
* @return bool was anything saved?
|
||||||
*/
|
*/
|
||||||
public function process_admin_options() {
|
public function process_admin_options() {
|
||||||
|
@ -191,7 +203,8 @@ abstract class WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an error message for display in admin on save.
|
* Add an error message for display in admin on save.
|
||||||
* @param string $error
|
*
|
||||||
|
* @param string $error Error message.
|
||||||
*/
|
*/
|
||||||
public function add_error( $error ) {
|
public function add_error( $error ) {
|
||||||
$this->errors[] = $error;
|
$this->errors[] = $error;
|
||||||
|
@ -238,12 +251,12 @@ abstract class WC_Settings_API {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_option function.
|
* Get option from DB.
|
||||||
*
|
*
|
||||||
* Gets an option from the settings API, using defaults if necessary to prevent undefined notices.
|
* Gets an option from the settings API, using defaults if necessary to prevent undefined notices.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key Option key.
|
||||||
* @param mixed $empty_value
|
* @param mixed $empty_value Value when empty.
|
||||||
* @return string The value specified for the option or a default value for the option.
|
* @return string The value specified for the option or a default value for the option.
|
||||||
*/
|
*/
|
||||||
public function get_option( $key, $empty_value = null ) {
|
public function get_option( $key, $empty_value = null ) {
|
||||||
|
@ -267,7 +280,7 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Prefix key for settings.
|
* Prefix key for settings.
|
||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param string $key Field key.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_field_key( $key ) {
|
public function get_field_key( $key ) {
|
||||||
|
@ -279,9 +292,8 @@ abstract class WC_Settings_API {
|
||||||
*
|
*
|
||||||
* Generate the HTML for the fields on the "settings" screen.
|
* Generate the HTML for the fields on the "settings" screen.
|
||||||
*
|
*
|
||||||
* @param array $form_fields (default: array())
|
* @param array $form_fields (default: array()) Array of form fields.
|
||||||
* @param bool $echo
|
* @param bool $echo Echo or return.
|
||||||
*
|
|
||||||
* @return string the html for the settings
|
* @return string the html for the settings
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @uses method_exists()
|
* @uses method_exists()
|
||||||
|
@ -303,7 +315,7 @@ abstract class WC_Settings_API {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $echo ) {
|
if ( $echo ) {
|
||||||
echo $html;
|
echo $html; // WPCS: XSS ok.
|
||||||
} else {
|
} else {
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
@ -312,7 +324,7 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Get HTML for tooltips.
|
* Get HTML for tooltips.
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data Data for the tooltip.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_tooltip_html( $data ) {
|
public function get_tooltip_html( $data ) {
|
||||||
|
@ -330,7 +342,7 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Get HTML for descriptions.
|
* Get HTML for descriptions.
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data Data for the description.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_description_html( $data ) {
|
public function get_description_html( $data ) {
|
||||||
|
@ -350,7 +362,7 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Get custom attributes.
|
* Get custom attributes.
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data Field data.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_custom_attribute_html( $data ) {
|
public function get_custom_attribute_html( $data ) {
|
||||||
|
@ -368,8 +380,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Generate Text Input HTML.
|
* Generate Text Input HTML.
|
||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param string $key Field key.
|
||||||
* @param mixed $data
|
* @param array $data Field data.
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -393,14 +405,14 @@ abstract class WC_Settings_API {
|
||||||
?>
|
?>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row" class="titledesc">
|
<th scope="row" class="titledesc">
|
||||||
<?php echo $this->get_tooltip_html( $data ); ?>
|
<?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?>
|
||||||
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
||||||
</th>
|
</th>
|
||||||
<td class="forminp">
|
<td class="forminp">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
||||||
<input class="input-text regular-input <?php echo esc_attr( $data['class'] ); ?>" type="<?php echo esc_attr( $data['type'] ); ?>" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo esc_attr( $this->get_option( $key ) ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); ?> />
|
<input class="input-text regular-input <?php echo esc_attr( $data['class'] ); ?>" type="<?php echo esc_attr( $data['type'] ); ?>" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo esc_attr( $this->get_option( $key ) ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?> />
|
||||||
<?php echo $this->get_description_html( $data ); ?>
|
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -412,8 +424,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Generate Price Input HTML.
|
* Generate Price Input HTML.
|
||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param string $key Field key.
|
||||||
* @param mixed $data
|
* @param array $data Field data.
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -437,14 +449,14 @@ abstract class WC_Settings_API {
|
||||||
?>
|
?>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row" class="titledesc">
|
<th scope="row" class="titledesc">
|
||||||
<?php echo $this->get_tooltip_html( $data ); ?>
|
<?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?>
|
||||||
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
||||||
</th>
|
</th>
|
||||||
<td class="forminp">
|
<td class="forminp">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
||||||
<input class="wc_input_price input-text regular-input <?php echo esc_attr( $data['class'] ); ?>" type="text" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo esc_attr( wc_format_localized_price( $this->get_option( $key ) ) ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); ?> />
|
<input class="wc_input_price input-text regular-input <?php echo esc_attr( $data['class'] ); ?>" type="text" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo esc_attr( wc_format_localized_price( $this->get_option( $key ) ) ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?> />
|
||||||
<?php echo $this->get_description_html( $data ); ?>
|
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -456,8 +468,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Generate Decimal Input HTML.
|
* Generate Decimal Input HTML.
|
||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param string $key Field key.
|
||||||
* @param mixed $data
|
* @param array $data Field data.
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -481,14 +493,14 @@ abstract class WC_Settings_API {
|
||||||
?>
|
?>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row" class="titledesc">
|
<th scope="row" class="titledesc">
|
||||||
<?php echo $this->get_tooltip_html( $data ); ?>
|
<?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?>
|
||||||
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
||||||
</th>
|
</th>
|
||||||
<td class="forminp">
|
<td class="forminp">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
||||||
<input class="wc_input_decimal input-text regular-input <?php echo esc_attr( $data['class'] ); ?>" type="text" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo esc_attr( wc_format_localized_decimal( $this->get_option( $key ) ) ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); ?> />
|
<input class="wc_input_decimal input-text regular-input <?php echo esc_attr( $data['class'] ); ?>" type="text" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo esc_attr( wc_format_localized_decimal( $this->get_option( $key ) ) ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?> />
|
||||||
<?php echo $this->get_description_html( $data ); ?>
|
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -500,8 +512,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Generate Password Input HTML.
|
* Generate Password Input HTML.
|
||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param string $key Field key.
|
||||||
* @param mixed $data
|
* @param array $data Field data.
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -513,8 +525,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Generate Color Picker Input HTML.
|
* Generate Color Picker Input HTML.
|
||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param string $key Field key.
|
||||||
* @param mixed $data
|
* @param array $data Field data.
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -537,16 +549,16 @@ abstract class WC_Settings_API {
|
||||||
?>
|
?>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row" class="titledesc">
|
<th scope="row" class="titledesc">
|
||||||
<?php echo $this->get_tooltip_html( $data ); ?>
|
<?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?>
|
||||||
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
||||||
</th>
|
</th>
|
||||||
<td class="forminp">
|
<td class="forminp">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
||||||
<span class="colorpickpreview" style="background:<?php echo esc_attr( $this->get_option( $key ) ); ?>;"></span>
|
<span class="colorpickpreview" style="background:<?php echo esc_attr( $this->get_option( $key ) ); ?>;"></span>
|
||||||
<input class="colorpick <?php echo esc_attr( $data['class'] ); ?>" type="text" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo esc_attr( $this->get_option( $key ) ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); ?> />
|
<input class="colorpick <?php echo esc_attr( $data['class'] ); ?>" type="text" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo esc_attr( $this->get_option( $key ) ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?> />
|
||||||
<div id="colorPickerDiv_<?php echo esc_attr( $field_key ); ?>" class="colorpickdiv" style="z-index: 100; background: #eee; border: 1px solid #ccc; position: absolute; display: none;"></div>
|
<div id="colorPickerDiv_<?php echo esc_attr( $field_key ); ?>" class="colorpickdiv" style="z-index: 100; background: #eee; border: 1px solid #ccc; position: absolute; display: none;"></div>
|
||||||
<?php echo $this->get_description_html( $data ); ?>
|
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -558,8 +570,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Generate Textarea HTML.
|
* Generate Textarea HTML.
|
||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param string $key Field key.
|
||||||
* @param mixed $data
|
* @param array $data Field data.
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -583,14 +595,14 @@ abstract class WC_Settings_API {
|
||||||
?>
|
?>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row" class="titledesc">
|
<th scope="row" class="titledesc">
|
||||||
<?php echo $this->get_tooltip_html( $data ); ?>
|
<?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?>
|
||||||
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
||||||
</th>
|
</th>
|
||||||
<td class="forminp">
|
<td class="forminp">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
||||||
<textarea rows="3" cols="20" class="input-text wide-input <?php echo esc_attr( $data['class'] ); ?>" type="<?php echo esc_attr( $data['type'] ); ?>" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); ?>><?php echo esc_textarea( $this->get_option( $key ) ); ?></textarea>
|
<textarea rows="3" cols="20" class="input-text wide-input <?php echo esc_attr( $data['class'] ); ?>" type="<?php echo esc_attr( $data['type'] ); ?>" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?>><?php echo esc_textarea( $this->get_option( $key ) ); ?></textarea>
|
||||||
<?php echo $this->get_description_html( $data ); ?>
|
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -602,8 +614,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Generate Checkbox HTML.
|
* Generate Checkbox HTML.
|
||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param string $key Field key.
|
||||||
* @param mixed $data
|
* @param array $data Field data.
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -631,15 +643,15 @@ abstract class WC_Settings_API {
|
||||||
?>
|
?>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row" class="titledesc">
|
<th scope="row" class="titledesc">
|
||||||
<?php echo $this->get_tooltip_html( $data ); ?>
|
<?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?>
|
||||||
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
||||||
</th>
|
</th>
|
||||||
<td class="forminp">
|
<td class="forminp">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
||||||
<label for="<?php echo esc_attr( $field_key ); ?>">
|
<label for="<?php echo esc_attr( $field_key ); ?>">
|
||||||
<input <?php disabled( $data['disabled'], true ); ?> class="<?php echo esc_attr( $data['class'] ); ?>" type="checkbox" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="1" <?php checked( $this->get_option( $key ), 'yes' ); ?> <?php echo $this->get_custom_attribute_html( $data ); ?> /> <?php echo wp_kses_post( $data['label'] ); ?></label><br/>
|
<input <?php disabled( $data['disabled'], true ); ?> class="<?php echo esc_attr( $data['class'] ); ?>" type="checkbox" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="1" <?php checked( $this->get_option( $key ), 'yes' ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?> /> <?php echo wp_kses_post( $data['label'] ); ?></label><br/>
|
||||||
<?php echo $this->get_description_html( $data ); ?>
|
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -651,8 +663,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Generate Select HTML.
|
* Generate Select HTML.
|
||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param string $key Field key.
|
||||||
* @param mixed $data
|
* @param array $data Field data.
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -677,18 +689,18 @@ abstract class WC_Settings_API {
|
||||||
?>
|
?>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row" class="titledesc">
|
<th scope="row" class="titledesc">
|
||||||
<?php echo $this->get_tooltip_html( $data ); ?>
|
<?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?>
|
||||||
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
||||||
</th>
|
</th>
|
||||||
<td class="forminp">
|
<td class="forminp">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
||||||
<select class="select <?php echo esc_attr( $data['class'] ); ?>" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); ?>>
|
<select class="select <?php echo esc_attr( $data['class'] ); ?>" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?>>
|
||||||
<?php foreach ( (array) $data['options'] as $option_key => $option_value ) : ?>
|
<?php foreach ( (array) $data['options'] as $option_key => $option_value ) : ?>
|
||||||
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, esc_attr( $this->get_option( $key ) ) ); ?>><?php echo esc_attr( $option_value ); ?></option>
|
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, esc_attr( $this->get_option( $key ) ) ); ?>><?php echo esc_attr( $option_value ); ?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
<?php echo $this->get_description_html( $data ); ?>
|
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -700,8 +712,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Generate Multiselect HTML.
|
* Generate Multiselect HTML.
|
||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param string $key Field key.
|
||||||
* @param mixed $data
|
* @param array $data Field data.
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -728,20 +740,20 @@ abstract class WC_Settings_API {
|
||||||
?>
|
?>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row" class="titledesc">
|
<th scope="row" class="titledesc">
|
||||||
<?php echo $this->get_tooltip_html( $data ); ?>
|
<?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?>
|
||||||
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
||||||
</th>
|
</th>
|
||||||
<td class="forminp">
|
<td class="forminp">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
||||||
<select multiple="multiple" class="multiselect <?php echo esc_attr( $data['class'] ); ?>" name="<?php echo esc_attr( $field_key ); ?>[]" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); ?>>
|
<select multiple="multiple" class="multiselect <?php echo esc_attr( $data['class'] ); ?>" name="<?php echo esc_attr( $field_key ); ?>[]" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?>>
|
||||||
<?php foreach ( (array) $data['options'] as $option_key => $option_value ) : ?>
|
<?php foreach ( (array) $data['options'] as $option_key => $option_value ) : ?>
|
||||||
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( in_array( $option_key, $value ), true ); ?>><?php echo esc_attr( $option_value ); ?></option>
|
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( in_array( $option_key, $value, true ), true ); ?>><?php echo esc_attr( $option_value ); ?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
<?php echo $this->get_description_html( $data ); ?>
|
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
|
||||||
<?php if ( $data['select_buttons'] ) : ?>
|
<?php if ( $data['select_buttons'] ) : ?>
|
||||||
<br/><a class="select_all button" href="#"><?php _e( 'Select all', 'woocommerce' ); ?></a> <a class="select_none button" href="#"><?php _e( 'Select none', 'woocommerce' ); ?></a>
|
<br/><a class="select_all button" href="#"><?php esc_html_e( 'Select all', 'woocommerce' ); ?></a> <a class="select_none button" href="#"><?php esc_html_e( 'Select none', 'woocommerce' ); ?></a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
|
@ -754,8 +766,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Generate Title HTML.
|
* Generate Title HTML.
|
||||||
*
|
*
|
||||||
* @param mixed $key
|
* @param string $key Field key.
|
||||||
* @param mixed $data
|
* @param array $data Field data.
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -786,8 +798,8 @@ abstract class WC_Settings_API {
|
||||||
*
|
*
|
||||||
* Make sure the data is escaped correctly, etc.
|
* Make sure the data is escaped correctly, etc.
|
||||||
*
|
*
|
||||||
* @param string $key Field key
|
* @param string $key Field key.
|
||||||
* @param string|null $value Posted Value
|
* @param string $value Posted Value.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function validate_text_field( $key, $value ) {
|
public function validate_text_field( $key, $value ) {
|
||||||
|
@ -800,8 +812,8 @@ abstract class WC_Settings_API {
|
||||||
*
|
*
|
||||||
* Make sure the data is escaped correctly, etc.
|
* Make sure the data is escaped correctly, etc.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key Field key.
|
||||||
* @param string|null $value Posted Value
|
* @param string $value Posted Value.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function validate_price_field( $key, $value ) {
|
public function validate_price_field( $key, $value ) {
|
||||||
|
@ -814,8 +826,8 @@ abstract class WC_Settings_API {
|
||||||
*
|
*
|
||||||
* Make sure the data is escaped correctly, etc.
|
* Make sure the data is escaped correctly, etc.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key Field key.
|
||||||
* @param string|null $value Posted Value
|
* @param string $value Posted Value.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function validate_decimal_field( $key, $value ) {
|
public function validate_decimal_field( $key, $value ) {
|
||||||
|
@ -826,8 +838,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Validate Password Field. No input sanitization is used to avoid corrupting passwords.
|
* Validate Password Field. No input sanitization is used to avoid corrupting passwords.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key Field key.
|
||||||
* @param string|null $value Posted Value
|
* @param string $value Posted Value.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function validate_password_field( $key, $value ) {
|
public function validate_password_field( $key, $value ) {
|
||||||
|
@ -838,8 +850,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Validate Textarea Field.
|
* Validate Textarea Field.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key Field key.
|
||||||
* @param string|null $value Posted Value
|
* @param string $value Posted Value.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function validate_textarea_field( $key, $value ) {
|
public function validate_textarea_field( $key, $value ) {
|
||||||
|
@ -847,7 +859,12 @@ abstract class WC_Settings_API {
|
||||||
return wp_kses( trim( stripslashes( $value ) ),
|
return wp_kses( trim( stripslashes( $value ) ),
|
||||||
array_merge(
|
array_merge(
|
||||||
array(
|
array(
|
||||||
'iframe' => array( 'src' => true, 'style' => true, 'id' => true, 'class' => true ),
|
'iframe' => array(
|
||||||
|
'src' => true,
|
||||||
|
'style' => true,
|
||||||
|
'id' => true,
|
||||||
|
'class' => true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
wp_kses_allowed_html( 'post' )
|
wp_kses_allowed_html( 'post' )
|
||||||
)
|
)
|
||||||
|
@ -859,8 +876,8 @@ abstract class WC_Settings_API {
|
||||||
*
|
*
|
||||||
* If not set, return "no", otherwise return "yes".
|
* If not set, return "no", otherwise return "yes".
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key Field key.
|
||||||
* @param string|null $value Posted Value
|
* @param string $value Posted Value.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function validate_checkbox_field( $key, $value ) {
|
public function validate_checkbox_field( $key, $value ) {
|
||||||
|
@ -870,8 +887,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Validate Select Field.
|
* Validate Select Field.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key Field key.
|
||||||
* @param string $value Posted Value
|
* @param string $value Posted Value.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function validate_select_field( $key, $value ) {
|
public function validate_select_field( $key, $value ) {
|
||||||
|
@ -882,8 +899,8 @@ abstract class WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Validate Multiselect Field.
|
* Validate Multiselect Field.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key Field key.
|
||||||
* @param string $value Posted Value
|
* @param string $value Posted Value.
|
||||||
* @return string|array
|
* @return string|array
|
||||||
*/
|
*/
|
||||||
public function validate_multiselect_field( $key, $value ) {
|
public function validate_multiselect_field( $key, $value ) {
|
||||||
|
@ -892,9 +909,9 @@ abstract class WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate the data on the "Settings" form.
|
* Validate the data on the "Settings" form.
|
||||||
* @deprecated 2.6.0 No longer used
|
|
||||||
*
|
*
|
||||||
* @param array $form_fields
|
* @deprecated 2.6.0 No longer used.
|
||||||
|
* @param array $form_fields Array of fields.
|
||||||
*/
|
*/
|
||||||
public function validate_settings_fields( $form_fields = array() ) {
|
public function validate_settings_fields( $form_fields = array() ) {
|
||||||
wc_deprecated_function( 'validate_settings_fields', '2.6' );
|
wc_deprecated_function( 'validate_settings_fields', '2.6' );
|
||||||
|
@ -902,8 +919,9 @@ abstract class WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format settings if needed.
|
* Format settings if needed.
|
||||||
* @deprecated 2.6.0 Unused
|
*
|
||||||
* @param array $value
|
* @deprecated 2.6.0 Unused.
|
||||||
|
* @param array $value Value to format.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function format_settings( $value ) {
|
public function format_settings( $value ) {
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Abstract shipping method
|
||||||
|
*
|
||||||
|
* @class WC_Shipping_Method
|
||||||
|
* @package WooCommerce/Abstracts
|
||||||
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
|
@ -12,8 +18,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
* @class WC_Shipping_Method
|
* @class WC_Shipping_Method
|
||||||
* @version 3.0.0
|
* @version 3.0.0
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @category Abstract Class
|
|
||||||
* @author WooThemes
|
|
||||||
*/
|
*/
|
||||||
abstract class WC_Shipping_Method extends WC_Settings_API {
|
abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
|
@ -23,78 +27,91 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
* - instance-settings Instance settings screens.
|
* - instance-settings Instance settings screens.
|
||||||
* - settings Non-instance settings screens. Enabled by default for BW compatibility with methods before instances existed.
|
* - settings Non-instance settings screens. Enabled by default for BW compatibility with methods before instances existed.
|
||||||
* - instance-settings-modal Allows the instance settings to be loaded within a modal in the zones UI.
|
* - instance-settings-modal Allows the instance settings to be loaded within a modal in the zones UI.
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $supports = array( 'settings' );
|
public $supports = array( 'settings' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique ID for the shipping method - must be set.
|
* Unique ID for the shipping method - must be set.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $id = '';
|
public $id = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method title.
|
* Method title.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $method_title = '';
|
public $method_title = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description.
|
* Method description.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $method_description = '';
|
public $method_description = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* yes or no based on whether the method is enabled.
|
* Yes or no based on whether the method is enabled.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $enabled = 'yes';
|
public $enabled = 'yes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shipping method title for the frontend.
|
* Shipping method title for the frontend.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $title;
|
public $title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is an array of rates - methods must populate this array to register shipping costs.
|
* This is an array of rates - methods must populate this array to register shipping costs.
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $rates = array();
|
public $rates = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If 'taxable' tax will be charged for this method (if applicable).
|
* If 'taxable' tax will be charged for this method (if applicable).
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $tax_status = 'taxable';
|
public $tax_status = 'taxable';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fee for the method (if applicable).
|
* Fee for the method (if applicable).
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $fee = null;
|
public $fee = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimum fee for the method (if applicable).
|
* Minimum fee for the method (if applicable).
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $minimum_fee = null;
|
public $minimum_fee = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance ID if used.
|
* Instance ID if used.
|
||||||
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $instance_id = 0;
|
public $instance_id = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance form fields.
|
* Instance form fields.
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $instance_form_fields = array();
|
public $instance_form_fields = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance settings.
|
* Instance settings.
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $instance_settings = array();
|
public $instance_settings = array();
|
||||||
|
@ -102,6 +119,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Availability - legacy. Used for method Availability.
|
* Availability - legacy. Used for method Availability.
|
||||||
* No longer useful for instance based shipping methods.
|
* No longer useful for instance based shipping methods.
|
||||||
|
*
|
||||||
* @deprecated 2.6.0
|
* @deprecated 2.6.0
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -110,6 +128,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Availability countries - legacy. Used for method Availability.
|
* Availability countries - legacy. Used for method Availability.
|
||||||
* No longer useful for instance based shipping methods.
|
* No longer useful for instance based shipping methods.
|
||||||
|
*
|
||||||
* @deprecated 2.6.0
|
* @deprecated 2.6.0
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
@ -117,7 +136,8 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param int $instance_id
|
*
|
||||||
|
* @param int $instance_id Instance ID.
|
||||||
*/
|
*/
|
||||||
public function __construct( $instance_id = 0 ) {
|
public function __construct( $instance_id = 0 ) {
|
||||||
$this->instance_id = absint( $instance_id );
|
$this->instance_id = absint( $instance_id );
|
||||||
|
@ -128,7 +148,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
*
|
*
|
||||||
* Methods should override this to declare support (or lack of support) for a feature.
|
* Methods should override this to declare support (or lack of support) for a feature.
|
||||||
*
|
*
|
||||||
* @param $feature string The name of a feature to test support for.
|
* @param string $feature The name of a feature to test support for.
|
||||||
* @return bool True if the shipping method supports the feature, false otherwise.
|
* @return bool True if the shipping method supports the feature, false otherwise.
|
||||||
*/
|
*/
|
||||||
public function supports( $feature ) {
|
public function supports( $feature ) {
|
||||||
|
@ -138,12 +158,13 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Called to calculate shipping rates for this method. Rates can be added using the add_rate() method.
|
* Called to calculate shipping rates for this method. Rates can be added using the add_rate() method.
|
||||||
*
|
*
|
||||||
* @param array $package
|
* @param array $package Package array.
|
||||||
*/
|
*/
|
||||||
public function calculate_shipping( $package = array() ) {}
|
public function calculate_shipping( $package = array() ) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not we need to calculate tax on top of the shipping rate.
|
* Whether or not we need to calculate tax on top of the shipping rate.
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function is_taxable() {
|
public function is_taxable() {
|
||||||
|
@ -152,6 +173,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not this method is enabled in settings.
|
* Whether or not this method is enabled in settings.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
@ -161,6 +183,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the shipping method instance ID.
|
* Return the shipping method instance ID.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
@ -170,6 +193,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the shipping method title.
|
* Return the shipping method title.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -179,6 +203,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the shipping method description.
|
* Return the shipping method description.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -197,8 +222,9 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return calculated rates for a package.
|
* Return calculated rates for a package.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param object $package
|
* @param object $package Package array.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_rates_for_package( $package ) {
|
public function get_rates_for_package( $package ) {
|
||||||
|
@ -212,8 +238,9 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Returns a rate ID based on this methods ID and instance, with an optional
|
* Returns a rate ID based on this methods ID and instance, with an optional
|
||||||
* suffix if distinguishing between multiple rates.
|
* suffix if distinguishing between multiple rates.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @param string $suffix
|
* @param string $suffix Suffix.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_rate_id( $suffix = '' ) {
|
public function get_rate_id( $suffix = '' ) {
|
||||||
|
@ -232,25 +259,26 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a shipping rate. If taxes are not set they will be calculated based on cost.
|
* Add a shipping rate. If taxes are not set they will be calculated based on cost.
|
||||||
* @param array $args (default: array())
|
*
|
||||||
|
* @param array $args Arguments (default: array()).
|
||||||
*/
|
*/
|
||||||
public function add_rate( $args = array() ) {
|
public function add_rate( $args = array() ) {
|
||||||
$args = wp_parse_args( $args, array(
|
$args = wp_parse_args( $args, array(
|
||||||
'id' => $this->get_rate_id(), // ID for the rate. If not passed, this id:instance default will be used.
|
'id' => $this->get_rate_id(), // ID for the rate. If not passed, this id:instance default will be used.
|
||||||
'label' => '', // Label for the rate
|
'label' => '', // Label for the rate.
|
||||||
'cost' => '0', // Amount or array of costs (per item shipping)
|
'cost' => '0', // Amount or array of costs (per item shipping).
|
||||||
'taxes' => '', // Pass taxes, or leave empty to have it calculated for you, or 'false' to disable calculations
|
'taxes' => '', // Pass taxes, or leave empty to have it calculated for you, or 'false' to disable calculations.
|
||||||
'calc_tax' => 'per_order', // Calc tax per_order or per_item. Per item needs an array of costs
|
'calc_tax' => 'per_order', // Calc tax per_order or per_item. Per item needs an array of costs.
|
||||||
'meta_data' => array(), // Array of misc meta data to store along with this rate - key value pairs.
|
'meta_data' => array(), // Array of misc meta data to store along with this rate - key value pairs.
|
||||||
'package' => false, // Package array this rate was generated for @since 2.6.0
|
'package' => false, // Package array this rate was generated for @since 2.6.0.
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// ID and label are required
|
// ID and label are required.
|
||||||
if ( ! $args['id'] || ! $args['label'] ) {
|
if ( ! $args['id'] || ! $args['label'] ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total up the cost
|
// Total up the cost.
|
||||||
$total_cost = is_array( $args['cost'] ) ? array_sum( $args['cost'] ) : $args['cost'];
|
$total_cost = is_array( $args['cost'] ) ? array_sum( $args['cost'] ) : $args['cost'];
|
||||||
$taxes = $args['taxes'];
|
$taxes = $args['taxes'];
|
||||||
|
|
||||||
|
@ -262,7 +290,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
// Round the total cost after taxes have been calculated.
|
// Round the total cost after taxes have been calculated.
|
||||||
$total_cost = wc_format_decimal( $total_cost, wc_get_price_decimals() );
|
$total_cost = wc_format_decimal( $total_cost, wc_get_price_decimals() );
|
||||||
|
|
||||||
// Create rate object
|
// Create rate object.
|
||||||
$rate = new WC_Shipping_Rate();
|
$rate = new WC_Shipping_Rate();
|
||||||
$rate->set_id( $args['id'] );
|
$rate->set_id( $args['id'] );
|
||||||
$rate->set_method_id( $this->id );
|
$rate->set_method_id( $this->id );
|
||||||
|
@ -277,7 +305,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store package data
|
// Store package data.
|
||||||
if ( $args['package'] ) {
|
if ( $args['package'] ) {
|
||||||
$items_in_package = array();
|
$items_in_package = array();
|
||||||
foreach ( $args['package']['contents'] as $item ) {
|
foreach ( $args['package']['contents'] as $item ) {
|
||||||
|
@ -292,15 +320,16 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calc taxes per item being shipping in costs array.
|
* Calc taxes per item being shipping in costs array.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @access protected
|
* @access protected
|
||||||
* @param array $costs
|
* @param array $costs Costs.
|
||||||
* @return array of taxes
|
* @return array of taxes
|
||||||
*/
|
*/
|
||||||
protected function get_taxes_per_item( $costs ) {
|
protected function get_taxes_per_item( $costs ) {
|
||||||
$taxes = array();
|
$taxes = array();
|
||||||
|
|
||||||
// If we have an array of costs we can look up each items tax class and add tax accordingly
|
// If we have an array of costs we can look up each items tax class and add tax accordingly.
|
||||||
if ( is_array( $costs ) ) {
|
if ( is_array( $costs ) ) {
|
||||||
|
|
||||||
$cart = WC()->cart->get_cart();
|
$cart = WC()->cart->get_cart();
|
||||||
|
@ -312,17 +341,17 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
$item_taxes = WC_Tax::calc_shipping_tax( $amount, WC_Tax::get_shipping_tax_rates( $cart[ $cost_key ]['data']->get_tax_class() ) );
|
$item_taxes = WC_Tax::calc_shipping_tax( $amount, WC_Tax::get_shipping_tax_rates( $cart[ $cost_key ]['data']->get_tax_class() ) );
|
||||||
|
|
||||||
// Sum the item taxes
|
// Sum the item taxes.
|
||||||
foreach ( array_keys( $taxes + $item_taxes ) as $key ) {
|
foreach ( array_keys( $taxes + $item_taxes ) as $key ) {
|
||||||
$taxes[ $key ] = ( isset( $item_taxes[ $key ] ) ? $item_taxes[ $key ] : 0 ) + ( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 );
|
$taxes[ $key ] = ( isset( $item_taxes[ $key ] ) ? $item_taxes[ $key ] : 0 ) + ( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add any cost for the order - order costs are in the key 'order'
|
// Add any cost for the order - order costs are in the key 'order'.
|
||||||
if ( isset( $costs['order'] ) ) {
|
if ( isset( $costs['order'] ) ) {
|
||||||
$item_taxes = WC_Tax::calc_shipping_tax( $costs['order'], WC_Tax::get_shipping_tax_rates() );
|
$item_taxes = WC_Tax::calc_shipping_tax( $costs['order'], WC_Tax::get_shipping_tax_rates() );
|
||||||
|
|
||||||
// Sum the item taxes
|
// Sum the item taxes.
|
||||||
foreach ( array_keys( $taxes + $item_taxes ) as $key ) {
|
foreach ( array_keys( $taxes + $item_taxes ) as $key ) {
|
||||||
$taxes[ $key ] = ( isset( $item_taxes[ $key ] ) ? $item_taxes[ $key ] : 0 ) + ( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 );
|
$taxes[ $key ] = ( isset( $item_taxes[ $key ] ) ? $item_taxes[ $key ] : 0 ) + ( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 );
|
||||||
}
|
}
|
||||||
|
@ -334,25 +363,26 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this method available?
|
* Is this method available?
|
||||||
* @param array $package
|
*
|
||||||
|
* @param array $package Package.
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function is_available( $package ) {
|
public function is_available( $package ) {
|
||||||
$available = $this->is_enabled();
|
$available = $this->is_enabled();
|
||||||
|
|
||||||
// Country availability (legacy, for non-zone based methods)
|
// Country availability (legacy, for non-zone based methods).
|
||||||
if ( ! $this->instance_id && $available ) {
|
if ( ! $this->instance_id && $available ) {
|
||||||
$countries = is_array( $this->countries ) ? $this->countries : array();
|
$countries = is_array( $this->countries ) ? $this->countries : array();
|
||||||
|
|
||||||
switch ( $this->availability ) {
|
switch ( $this->availability ) {
|
||||||
case 'specific' :
|
case 'specific':
|
||||||
case 'including' :
|
case 'including':
|
||||||
$available = in_array( $package['destination']['country'], array_intersect( $countries, array_keys( WC()->countries->get_shipping_countries() ) ) );
|
$available = in_array( $package['destination']['country'], array_intersect( $countries, array_keys( WC()->countries->get_shipping_countries() ) ) );
|
||||||
break;
|
break;
|
||||||
case 'excluding' :
|
case 'excluding':
|
||||||
$available = in_array( $package['destination']['country'], array_diff( array_keys( WC()->countries->get_shipping_countries() ), $countries ) );
|
$available = in_array( $package['destination']['country'], array_diff( array_keys( WC()->countries->get_shipping_countries() ), $countries ) );
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
$available = in_array( $package['destination']['country'], array_keys( WC()->countries->get_shipping_countries() ) );
|
$available = in_array( $package['destination']['country'], array_keys( WC()->countries->get_shipping_countries() ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -363,8 +393,9 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get fee to add to shipping cost.
|
* Get fee to add to shipping cost.
|
||||||
* @param string|float $fee
|
*
|
||||||
* @param float $total
|
* @param string|float $fee Fee.
|
||||||
|
* @param float $total Total.
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function get_fee( $fee, $total ) {
|
public function get_fee( $fee, $total ) {
|
||||||
|
@ -379,6 +410,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this method have a settings page?
|
* Does this method have a settings page?
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has_settings() {
|
public function has_settings() {
|
||||||
|
@ -387,6 +419,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return admin options as a html string.
|
* Return admin options as a html string.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_admin_options_html() {
|
public function get_admin_options_html() {
|
||||||
|
@ -407,33 +440,33 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
echo '<h2>' . esc_html( $this->get_method_title() ) . '</h2>';
|
echo '<h2>' . esc_html( $this->get_method_title() ) . '</h2>';
|
||||||
}
|
}
|
||||||
echo wp_kses_post( wpautop( $this->get_method_description() ) );
|
echo wp_kses_post( wpautop( $this->get_method_description() ) );
|
||||||
echo $this->get_admin_options_html();
|
echo $this->get_admin_options_html(); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_option function.
|
* Get_option function.
|
||||||
*
|
*
|
||||||
* Gets and option from the settings API, using defaults if necessary to prevent undefined notices.
|
* Gets and option from the settings API, using defaults if necessary to prevent undefined notices.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key Key.
|
||||||
* @param mixed $empty_value
|
* @param mixed $empty_value Empty value.
|
||||||
* @return mixed The value specified for the option or a default value for the option.
|
* @return mixed The value specified for the option or a default value for the option.
|
||||||
*/
|
*/
|
||||||
public function get_option( $key, $empty_value = null ) {
|
public function get_option( $key, $empty_value = null ) {
|
||||||
// Instance options take priority over global options
|
// Instance options take priority over global options.
|
||||||
if ( $this->instance_id && array_key_exists( $key, $this->get_instance_form_fields() ) ) {
|
if ( $this->instance_id && array_key_exists( $key, $this->get_instance_form_fields() ) ) {
|
||||||
return $this->get_instance_option( $key, $empty_value );
|
return $this->get_instance_option( $key, $empty_value );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return global option
|
// Return global option.
|
||||||
return parent::get_option( $key, $empty_value );
|
return parent::get_option( $key, $empty_value );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an option from the settings API, using defaults if necessary to prevent undefined notices.
|
* Gets an option from the settings API, using defaults if necessary to prevent undefined notices.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key Key.
|
||||||
* @param mixed $empty_value
|
* @param mixed $empty_value Empty value.
|
||||||
* @return mixed The value specified for the option or a default value for the option.
|
* @return mixed The value specified for the option or a default value for the option.
|
||||||
*/
|
*/
|
||||||
public function get_instance_option( $key, $empty_value = null ) {
|
public function get_instance_option( $key, $empty_value = null ) {
|
||||||
|
@ -457,6 +490,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Get settings fields for instances of this shipping method (within zones).
|
* Get settings fields for instances of this shipping method (within zones).
|
||||||
* Should be overridden by shipping methods to add options.
|
* Should be overridden by shipping methods to add options.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -466,6 +500,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the name of the option in the WP DB.
|
* Return the name of the option in the WP DB.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -475,6 +510,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise Settings for instances.
|
* Initialise Settings for instances.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
*/
|
*/
|
||||||
public function init_instance_settings() {
|
public function init_instance_settings() {
|
||||||
|
@ -490,6 +526,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
||||||
/**
|
/**
|
||||||
* Processes and saves options.
|
* Processes and saves options.
|
||||||
* If there is an error thrown, will continue to save and validate fields, but will leave the erroring field out.
|
* If there is an error thrown, will continue to save and validate fields, but will leave the erroring field out.
|
||||||
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
* @return bool was anything saved?
|
* @return bool was anything saved?
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Abstract widget class
|
||||||
|
*
|
||||||
|
* @class WC_Widget
|
||||||
|
* @package WooCommerce/Abstracts
|
||||||
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract Widget Class
|
* WC_Widget
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
|
||||||
* @category Widgets
|
|
||||||
* @package WooCommerce/Abstracts
|
* @package WooCommerce/Abstracts
|
||||||
* @version 2.5.0
|
* @version 2.5.0
|
||||||
* @extends WP_Widget
|
* @extends WP_Widget
|
||||||
|
@ -69,7 +74,7 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
/**
|
/**
|
||||||
* Get cached widget.
|
* Get cached widget.
|
||||||
*
|
*
|
||||||
* @param array $args
|
* @param array $args Arguments.
|
||||||
* @return bool true if the widget is cached otherwise false
|
* @return bool true if the widget is cached otherwise false
|
||||||
*/
|
*/
|
||||||
public function get_cached_widget( $args ) {
|
public function get_cached_widget( $args ) {
|
||||||
|
@ -80,7 +85,7 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $cache[ $args['widget_id'] ] ) ) {
|
if ( isset( $cache[ $args['widget_id'] ] ) ) {
|
||||||
echo $cache[ $args['widget_id'] ];
|
echo $cache[ $args['widget_id'] ]; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +95,8 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
/**
|
/**
|
||||||
* Cache the widget.
|
* Cache the widget.
|
||||||
*
|
*
|
||||||
* @param array $args
|
* @param array $args Arguments.
|
||||||
* @param string $content
|
* @param string $content Content.
|
||||||
* @return string the content that was cached
|
* @return string the content that was cached
|
||||||
*/
|
*/
|
||||||
public function cache_widget( $args, $content ) {
|
public function cache_widget( $args, $content ) {
|
||||||
|
@ -118,32 +123,32 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
/**
|
/**
|
||||||
* Output the html at the start of a widget.
|
* Output the html at the start of a widget.
|
||||||
*
|
*
|
||||||
* @param array $args
|
* @param array $args Arguments.
|
||||||
* @param array $instance
|
* @param array $instance Instance.
|
||||||
*/
|
*/
|
||||||
public function widget_start( $args, $instance ) {
|
public function widget_start( $args, $instance ) {
|
||||||
echo $args['before_widget'];
|
echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
||||||
|
|
||||||
if ( $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ) ) {
|
if ( $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ) ) { // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.Found, WordPress.CodeAnalysis.AssignmentInCondition.Found
|
||||||
echo $args['before_title'] . $title . $args['after_title'];
|
echo $args['before_title'] . $title . $args['after_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output the html at the end of a widget.
|
* Output the html at the end of a widget.
|
||||||
*
|
*
|
||||||
* @param array $args
|
* @param array $args Arguments.
|
||||||
*/
|
*/
|
||||||
public function widget_end( $args ) {
|
public function widget_end( $args ) {
|
||||||
echo $args['after_widget'];
|
echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a particular instance of a widget.
|
* Updates a particular instance of a widget.
|
||||||
*
|
*
|
||||||
* @see WP_Widget->update
|
* @see WP_Widget->update
|
||||||
* @param array $new_instance
|
* @param array $new_instance New instance.
|
||||||
* @param array $old_instance
|
* @param array $old_instance Old instance.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function update( $new_instance, $old_instance ) {
|
public function update( $new_instance, $old_instance ) {
|
||||||
|
@ -162,7 +167,7 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
|
|
||||||
// Format the value based on settings type.
|
// Format the value based on settings type.
|
||||||
switch ( $setting['type'] ) {
|
switch ( $setting['type'] ) {
|
||||||
case 'number' :
|
case 'number':
|
||||||
$instance[ $key ] = absint( $new_instance[ $key ] );
|
$instance[ $key ] = absint( $new_instance[ $key ] );
|
||||||
|
|
||||||
if ( isset( $setting['min'] ) && '' !== $setting['min'] ) {
|
if ( isset( $setting['min'] ) && '' !== $setting['min'] ) {
|
||||||
|
@ -173,10 +178,10 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
$instance[ $key ] = min( $instance[ $key ], $setting['max'] );
|
$instance[ $key ] = min( $instance[ $key ], $setting['max'] );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'textarea' :
|
case 'textarea':
|
||||||
$instance[ $key ] = wp_kses( trim( wp_unslash( $new_instance[ $key ] ) ), wp_kses_allowed_html( 'post' ) );
|
$instance[ $key ] = wp_kses( trim( wp_unslash( $new_instance[ $key ] ) ), wp_kses_allowed_html( 'post' ) );
|
||||||
break;
|
break;
|
||||||
case 'checkbox' :
|
case 'checkbox':
|
||||||
$instance[ $key ] = empty( $new_instance[ $key ] ) ? 0 : 1;
|
$instance[ $key ] = empty( $new_instance[ $key ] ) ? 0 : 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -200,7 +205,7 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
*
|
*
|
||||||
* @see WP_Widget->form
|
* @see WP_Widget->form
|
||||||
*
|
*
|
||||||
* @param array $instance
|
* @param array $instance Instance.
|
||||||
*/
|
*/
|
||||||
public function form( $instance ) {
|
public function form( $instance ) {
|
||||||
|
|
||||||
|
@ -215,29 +220,29 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
|
|
||||||
switch ( $setting['type'] ) {
|
switch ( $setting['type'] ) {
|
||||||
|
|
||||||
case 'text' :
|
case 'text':
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id( $key ); ?>"><?php echo $setting['label']; ?></label>
|
<label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo $setting['label']; ?></label><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
|
||||||
<input class="widefat <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo $this->get_field_name( $key ); ?>" type="text" value="<?php echo esc_attr( $value ); ?>" />
|
<input class="widefat <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>" type="text" value="<?php echo esc_attr( $value ); ?>" />
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'number' :
|
case 'number':
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id( $key ); ?>"><?php echo $setting['label']; ?></label>
|
<label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo $setting['label']; /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></label>
|
||||||
<input class="widefat <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo $this->get_field_name( $key ); ?>" type="number" step="<?php echo esc_attr( $setting['step'] ); ?>" min="<?php echo esc_attr( $setting['min'] ); ?>" max="<?php echo esc_attr( $setting['max'] ); ?>" value="<?php echo esc_attr( $value ); ?>" />
|
<input class="widefat <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>" type="number" step="<?php echo esc_attr( $setting['step'] ); ?>" min="<?php echo esc_attr( $setting['min'] ); ?>" max="<?php echo esc_attr( $setting['max'] ); ?>" value="<?php echo esc_attr( $value ); ?>" />
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'select' :
|
case 'select':
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id( $key ); ?>"><?php echo $setting['label']; ?></label>
|
<label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo $setting['label']; /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></label>
|
||||||
<select class="widefat <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo $this->get_field_name( $key ); ?>">
|
<select class="widefat <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>">
|
||||||
<?php foreach ( $setting['options'] as $option_key => $option_value ) : ?>
|
<?php foreach ( $setting['options'] as $option_key => $option_value ) : ?>
|
||||||
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $value ); ?>><?php echo esc_html( $option_value ); ?></option>
|
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $value ); ?>><?php echo esc_html( $option_value ); ?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
@ -246,11 +251,11 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'textarea' :
|
case 'textarea':
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id( $key ); ?>"><?php echo $setting['label']; ?></label>
|
<label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo $setting['label']; /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></label>
|
||||||
<textarea class="widefat <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo $this->get_field_name( $key ); ?>" cols="20" rows="3"><?php echo esc_textarea( $value ); ?></textarea>
|
<textarea class="widefat <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>" cols="20" rows="3"><?php echo esc_textarea( $value ); ?></textarea>
|
||||||
<?php if ( isset( $setting['desc'] ) ) : ?>
|
<?php if ( isset( $setting['desc'] ) ) : ?>
|
||||||
<small><?php echo esc_html( $setting['desc'] ); ?></small>
|
<small><?php echo esc_html( $setting['desc'] ); ?></small>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -258,17 +263,17 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'checkbox' :
|
case 'checkbox':
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<input class="checkbox <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>" type="checkbox" value="1" <?php checked( $value, 1 ); ?> />
|
<input class="checkbox <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>" type="checkbox" value="1" <?php checked( $value, 1 ); ?> />
|
||||||
<label for="<?php echo $this->get_field_id( $key ); ?>"><?php echo $setting['label']; ?></label>
|
<label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo $setting['label']; /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></label>
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Default: run an action
|
// Default: run an action.
|
||||||
default :
|
default:
|
||||||
do_action( 'woocommerce_widget_field_' . $setting['type'], $key, $value, $setting, $instance );
|
do_action( 'woocommerce_widget_field_' . $setting['type'], $key, $value, $setting, $instance );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -328,13 +333,13 @@ abstract class WC_Widget extends WP_Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
// All current filters.
|
// All current filters.
|
||||||
if ( $_chosen_attributes = WC_Query::get_layered_nav_chosen_attributes() ) {
|
if ( $_chosen_attributes = WC_Query::get_layered_nav_chosen_attributes() ) { // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.Found, WordPress.CodeAnalysis.AssignmentInCondition.Found
|
||||||
foreach ( $_chosen_attributes as $name => $data ) {
|
foreach ( $_chosen_attributes as $name => $data ) {
|
||||||
$filter_name = sanitize_title( str_replace( 'pa_', '', $name ) );
|
$filter_name = sanitize_title( str_replace( 'pa_', '', $name ) );
|
||||||
if ( ! empty( $data['terms'] ) ) {
|
if ( ! empty( $data['terms'] ) ) {
|
||||||
$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
|
$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
|
||||||
}
|
}
|
||||||
if ( 'or' == $data['query_type'] ) {
|
if ( 'or' === $data['query_type'] ) {
|
||||||
$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
|
$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,12 +166,14 @@ class WC_Admin_Addons {
|
||||||
$utm_content = 'nostorefront';
|
$utm_content = 'nostorefront';
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = add_query_arg( array(
|
$url = add_query_arg(
|
||||||
|
array(
|
||||||
'utm_source' => 'addons',
|
'utm_source' => 'addons',
|
||||||
'utm_medium' => 'product',
|
'utm_medium' => 'product',
|
||||||
'utm_campaign' => 'woocommerceplugin',
|
'utm_campaign' => 'woocommerceplugin',
|
||||||
'utm_content' => $utm_content,
|
'utm_content' => $utm_content,
|
||||||
), $url );
|
), $url
|
||||||
|
);
|
||||||
|
|
||||||
echo '<a href="' . esc_url( $url ) . '" class="add-new-h2">' . esc_html( $text ) . '</a>' . "\n";
|
echo '<a href="' . esc_url( $url ) . '" class="add-new-h2">' . esc_html( $text ) . '</a>' . "\n";
|
||||||
}
|
}
|
||||||
|
@ -284,7 +286,7 @@ class WC_Admin_Addons {
|
||||||
public static function output_small_light_block( $block ) {
|
public static function output_small_light_block( $block ) {
|
||||||
?>
|
?>
|
||||||
<div class="addons-small-light-block">
|
<div class="addons-small-light-block">
|
||||||
<img class="addons-img" src="<?php echo esc_url( $block->image ) ?>" />
|
<img class="addons-img" src="<?php echo esc_url( $block->image ); ?>" />
|
||||||
<div class="addons-small-light-block-content">
|
<div class="addons-small-light-block-content">
|
||||||
<h1><?php echo esc_html( $block->title ); ?></h1>
|
<h1><?php echo esc_html( $block->title ); ?></h1>
|
||||||
<p><?php echo esc_html( $block->description ); ?></p>
|
<p><?php echo esc_html( $block->description ); ?></p>
|
||||||
|
@ -355,9 +357,11 @@ class WC_Admin_Addons {
|
||||||
}
|
}
|
||||||
|
|
||||||
$button_url = wp_nonce_url(
|
$button_url = wp_nonce_url(
|
||||||
add_query_arg( array(
|
add_query_arg(
|
||||||
|
array(
|
||||||
'install-addon' => 'woocommerce-services',
|
'install-addon' => 'woocommerce-services',
|
||||||
) ),
|
)
|
||||||
|
),
|
||||||
'install-addon_woocommerce-services'
|
'install-addon_woocommerce-services'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -377,22 +381,26 @@ class WC_Admin_Addons {
|
||||||
'image' => WC()->plugin_url() . '/assets/images/wcs-truck-banner-3x.png',
|
'image' => WC()->plugin_url() . '/assets/images/wcs-truck-banner-3x.png',
|
||||||
'title' => __( 'Show Canada Post shipping rates', 'woocommerce' ),
|
'title' => __( 'Show Canada Post shipping rates', 'woocommerce' ),
|
||||||
'description' => __( 'Display live rates from Canada Post at checkout to make shipping a breeze. Powered by WooCommerce Services.', 'woocommerce' ),
|
'description' => __( 'Display live rates from Canada Post at checkout to make shipping a breeze. Powered by WooCommerce Services.', 'woocommerce' ),
|
||||||
'logos' => array_merge( $defaults['logos'], array(
|
'logos' => array_merge(
|
||||||
|
$defaults['logos'], array(
|
||||||
array(
|
array(
|
||||||
'link' => WC()->plugin_url() . '/assets/images/wcs-canada-post-logo.jpg',
|
'link' => WC()->plugin_url() . '/assets/images/wcs-canada-post-logo.jpg',
|
||||||
'alt' => 'Canada Post logo',
|
'alt' => 'Canada Post logo',
|
||||||
),
|
),
|
||||||
) ),
|
)
|
||||||
|
),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'US':
|
case 'US':
|
||||||
$local_defaults = array(
|
$local_defaults = array(
|
||||||
'logos' => array_merge( $defaults['logos'], array(
|
'logos' => array_merge(
|
||||||
|
$defaults['logos'], array(
|
||||||
array(
|
array(
|
||||||
'link' => WC()->plugin_url() . '/assets/images/wcs-usps-logo.png',
|
'link' => WC()->plugin_url() . '/assets/images/wcs-usps-logo.png',
|
||||||
'alt' => 'USPS logo',
|
'alt' => 'USPS logo',
|
||||||
),
|
),
|
||||||
) ),
|
)
|
||||||
|
),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -523,7 +531,7 @@ class WC_Admin_Addons {
|
||||||
* @uses $theme
|
* @uses $theme
|
||||||
* @uses $current_section
|
* @uses $current_section
|
||||||
*/
|
*/
|
||||||
include_once( dirname( __FILE__ ) . '/views/html-admin-page-addons.php' );
|
include_once dirname( __FILE__ ) . '/views/html-admin-page-addons.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,31 +2,39 @@
|
||||||
/**
|
/**
|
||||||
* WooCommerce API Keys Table List
|
* WooCommerce API Keys Table List
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
* @package WooCommerce\Admin
|
||||||
* @category Admin
|
|
||||||
* @package WooCommerce/Admin
|
|
||||||
* @version 2.4.0
|
* @version 2.4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! class_exists( 'WP_List_Table' ) ) {
|
if ( ! class_exists( 'WP_List_Table' ) ) {
|
||||||
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API Keys table list class.
|
||||||
|
*/
|
||||||
class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the webhook table list.
|
* Initialize the API key table list.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct( array(
|
parent::__construct(
|
||||||
|
array(
|
||||||
'singular' => 'key',
|
'singular' => 'key',
|
||||||
'plural' => 'keys',
|
'plural' => 'keys',
|
||||||
'ajax' => false,
|
'ajax' => false,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No items found text.
|
||||||
|
*/
|
||||||
|
public function no_items() {
|
||||||
|
esc_html_e( 'No keys found.', 'woocommerce' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +45,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||||
public function get_columns() {
|
public function get_columns() {
|
||||||
return array(
|
return array(
|
||||||
'cb' => '<input type="checkbox" />',
|
'cb' => '<input type="checkbox" />',
|
||||||
'description' => __( 'Description', 'woocommerce' ),
|
'title' => __( 'Description', 'woocommerce' ),
|
||||||
'truncated_key' => __( 'Consumer key ending in', 'woocommerce' ),
|
'truncated_key' => __( 'Consumer key ending in', 'woocommerce' ),
|
||||||
'user' => __( 'User', 'woocommerce' ),
|
'user' => __( 'User', 'woocommerce' ),
|
||||||
'permissions' => __( 'Permissions', 'woocommerce' ),
|
'permissions' => __( 'Permissions', 'woocommerce' ),
|
||||||
|
@ -48,7 +56,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||||
/**
|
/**
|
||||||
* Column cb.
|
* Column cb.
|
||||||
*
|
*
|
||||||
* @param array $key
|
* @param array $key Key data.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function column_cb( $key ) {
|
public function column_cb( $key ) {
|
||||||
|
@ -56,12 +64,12 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return description column.
|
* Return title column.
|
||||||
*
|
*
|
||||||
* @param array $key
|
* @param array $key Key data.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function column_description( $key ) {
|
public function column_title( $key ) {
|
||||||
$url = admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys&edit-key=' . $key['key_id'] );
|
$url = admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys&edit-key=' . $key['key_id'] );
|
||||||
|
|
||||||
$output = '<strong>';
|
$output = '<strong>';
|
||||||
|
@ -74,11 +82,20 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||||
$output .= '</a>';
|
$output .= '</a>';
|
||||||
$output .= '</strong>';
|
$output .= '</strong>';
|
||||||
|
|
||||||
// Get actions
|
// Get actions.
|
||||||
$actions = array(
|
$actions = array(
|
||||||
|
/* translators: %s: API key ID. */
|
||||||
'id' => sprintf( __( 'ID: %d', 'woocommerce' ), $key['key_id'] ),
|
'id' => sprintf( __( 'ID: %d', 'woocommerce' ), $key['key_id'] ),
|
||||||
'edit' => '<a href="' . esc_url( $url ) . '">' . __( 'View/Edit', 'woocommerce' ) . '</a>',
|
'edit' => '<a href="' . esc_url( $url ) . '">' . __( 'View/Edit', 'woocommerce' ) . '</a>',
|
||||||
'trash' => '<a class="submitdelete" aria-label="' . esc_attr__( 'Revoke API key', 'woocommerce' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'revoke-key' => $key['key_id'] ), admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys' ) ), 'revoke' ) ) . '">' . __( 'Revoke', 'woocommerce' ) . '</a>',
|
'trash' => '<a class="submitdelete" aria-label="' . esc_attr__( 'Revoke API key', 'woocommerce' ) . '" href="' . esc_url(
|
||||||
|
wp_nonce_url(
|
||||||
|
add_query_arg(
|
||||||
|
array(
|
||||||
|
'revoke-key' => $key['key_id'],
|
||||||
|
), admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys' )
|
||||||
|
), 'revoke'
|
||||||
|
)
|
||||||
|
) . '">' . esc_html__( 'Revoke', 'woocommerce' ) . '</a>',
|
||||||
);
|
);
|
||||||
|
|
||||||
$row_actions = array();
|
$row_actions = array();
|
||||||
|
@ -95,7 +112,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||||
/**
|
/**
|
||||||
* Return truncated consumer key column.
|
* Return truncated consumer key column.
|
||||||
*
|
*
|
||||||
* @param array $key
|
* @param array $key Key data.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function column_truncated_key( $key ) {
|
public function column_truncated_key( $key ) {
|
||||||
|
@ -105,7 +122,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||||
/**
|
/**
|
||||||
* Return user column.
|
* Return user column.
|
||||||
*
|
*
|
||||||
* @param array $key
|
* @param array $key Key data.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function column_user( $key ) {
|
public function column_user( $key ) {
|
||||||
|
@ -125,7 +142,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||||
/**
|
/**
|
||||||
* Return permissions column.
|
* Return permissions column.
|
||||||
*
|
*
|
||||||
* @param array $key
|
* @param array $key Key data.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function column_permissions( $key ) {
|
public function column_permissions( $key ) {
|
||||||
|
@ -146,7 +163,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||||
/**
|
/**
|
||||||
* Return last access column.
|
* Return last access column.
|
||||||
*
|
*
|
||||||
* @param array $key
|
* @param array $key Key data.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function column_last_access( $key ) {
|
public function column_last_access( $key ) {
|
||||||
|
@ -177,15 +194,9 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||||
public function prepare_items() {
|
public function prepare_items() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$per_page = apply_filters( 'woocommerce_api_keys_settings_items_per_page', 10 );
|
$per_page = $this->get_items_per_page( 'woocommerce_keys_per_page' );
|
||||||
$columns = $this->get_columns();
|
|
||||||
$hidden = array();
|
|
||||||
$sortable = $this->get_sortable_columns();
|
|
||||||
|
|
||||||
// Column headers
|
|
||||||
$this->_column_headers = array( $columns, $hidden, $sortable );
|
|
||||||
|
|
||||||
$current_page = $this->get_pagenum();
|
$current_page = $this->get_pagenum();
|
||||||
|
|
||||||
if ( 1 < $current_page ) {
|
if ( 1 < $current_page ) {
|
||||||
$offset = $per_page * ( $current_page - 1 );
|
$offset = $per_page * ( $current_page - 1 );
|
||||||
} else {
|
} else {
|
||||||
|
@ -194,25 +205,27 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||||
|
|
||||||
$search = '';
|
$search = '';
|
||||||
|
|
||||||
if ( ! empty( $_REQUEST['s'] ) ) {
|
if ( ! empty( $_REQUEST['s'] ) ) { // WPCS: input var okay, CSRF ok.
|
||||||
$search = "AND description LIKE '%" . esc_sql( $wpdb->esc_like( wc_clean( $_REQUEST['s'] ) ) ) . "%' ";
|
$search = "AND description LIKE '%" . esc_sql( $wpdb->esc_like( wc_clean( wp_unslash( $_REQUEST['s'] ) ) ) ) . "%' "; // WPCS: input var okay, CSRF ok.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the API keys
|
// Get the API keys.
|
||||||
$keys = $wpdb->get_results(
|
$keys = $wpdb->get_results(
|
||||||
"SELECT key_id, user_id, description, permissions, truncated_key, last_access FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1 {$search}" .
|
"SELECT key_id, user_id, description, permissions, truncated_key, last_access FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1 {$search}" .
|
||||||
$wpdb->prepare( "ORDER BY key_id DESC LIMIT %d OFFSET %d;", $per_page, $offset ), ARRAY_A
|
$wpdb->prepare( 'ORDER BY key_id DESC LIMIT %d OFFSET %d;', $per_page, $offset ), ARRAY_A
|
||||||
);
|
); // WPCS: unprepared SQL ok.
|
||||||
|
|
||||||
$count = $wpdb->get_var( "SELECT COUNT(key_id) FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1 {$search};" );
|
$count = $wpdb->get_var( "SELECT COUNT(key_id) FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1 {$search};" ); // WPCS: unprepared SQL ok.
|
||||||
|
|
||||||
$this->items = $keys;
|
$this->items = $keys;
|
||||||
|
|
||||||
// Set the pagination
|
// Set the pagination.
|
||||||
$this->set_pagination_args( array(
|
$this->set_pagination_args(
|
||||||
|
array(
|
||||||
'total_items' => $count,
|
'total_items' => $count,
|
||||||
'per_page' => $per_page,
|
'per_page' => $per_page,
|
||||||
'total_pages' => ceil( $count / $per_page ),
|
'total_pages' => ceil( $count / $per_page ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* WooCommerce Admin API Keys Class
|
* WooCommerce Admin API Keys Class
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
* @package WooCommerce\Admin
|
||||||
* @category Admin
|
|
||||||
* @package WooCommerce/Admin
|
|
||||||
* @version 2.4.0
|
* @version 2.4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
defined( 'ABSPATH' ) || exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WC_Admin_API_Keys.
|
* WC_Admin_API_Keys.
|
||||||
|
@ -22,52 +18,66 @@ class WC_Admin_API_Keys {
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
add_action( 'admin_init', array( $this, 'actions' ) );
|
add_action( 'admin_init', array( $this, 'actions' ) );
|
||||||
|
add_action( 'woocommerce_settings_page_init', array( $this, 'screen_option' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if is API Keys settings page.
|
* Check if is API Keys settings page.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function is_api_keys_settings_page() {
|
private function is_api_keys_settings_page() {
|
||||||
return isset( $_GET['page'] )
|
return isset( $_GET['page'], $_GET['tab'], $_GET['section'] ) && 'wc-settings' === $_GET['page'] && 'api' === $_GET['tab'] && 'keys' === $_GET['section']; // WPCS: input var okay, CSRF ok.
|
||||||
&& 'wc-settings' === $_GET['page']
|
|
||||||
&& isset( $_GET['tab'] )
|
|
||||||
&& 'api' === $_GET['tab']
|
|
||||||
&& isset( $_GET['section'] )
|
|
||||||
&& 'keys' === $_GET['section'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page output.
|
* Page output.
|
||||||
*/
|
*/
|
||||||
public static function page_output() {
|
public static function page_output() {
|
||||||
// Hide the save button
|
// Hide the save button.
|
||||||
$GLOBALS['hide_save_button'] = true;
|
$GLOBALS['hide_save_button'] = true;
|
||||||
|
|
||||||
if ( isset( $_GET['create-key'] ) || isset( $_GET['edit-key'] ) ) {
|
if ( isset( $_GET['create-key'] ) || isset( $_GET['edit-key'] ) ) {
|
||||||
$key_id = isset( $_GET['edit-key'] ) ? absint( $_GET['edit-key'] ) : 0;
|
$key_id = isset( $_GET['edit-key'] ) ? absint( $_GET['edit-key'] ) : 0; // WPCS: input var okay, CSRF ok.
|
||||||
$key_data = self::get_key_data( $key_id );
|
$key_data = self::get_key_data( $key_id );
|
||||||
|
|
||||||
include( 'settings/views/html-keys-edit.php' );
|
include 'settings/views/html-keys-edit.php';
|
||||||
} else {
|
} else {
|
||||||
self::table_list_output();
|
self::table_list_output();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add screen option.
|
||||||
|
*/
|
||||||
|
public function screen_option() {
|
||||||
|
global $keys_table_list;
|
||||||
|
|
||||||
|
if ( ! isset( $_GET['create-key'] ) && ! isset( $_GET['edit-key'] ) && $this->is_api_keys_settings_page() ) { // WPCS: input var okay, CSRF ok.
|
||||||
|
$keys_table_list = new WC_Admin_API_Keys_Table_List();
|
||||||
|
|
||||||
|
// Add screen option.
|
||||||
|
add_screen_option(
|
||||||
|
'per_page', array(
|
||||||
|
'default' => 10,
|
||||||
|
'option' => 'woocommerce_keys_per_page',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table list output.
|
* Table list output.
|
||||||
*/
|
*/
|
||||||
private static function table_list_output() {
|
private static function table_list_output() {
|
||||||
|
global $wpdb, $keys_table_list;
|
||||||
|
|
||||||
global $wpdb;
|
echo '<h2>' . esc_html__( 'Keys/Apps', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys&create-key=1' ) ) . '" class="add-new-h2">' . esc_html__( 'Add key', 'woocommerce' ) . '</a></h2>';
|
||||||
|
|
||||||
echo '<h2>' . __( 'Keys/Apps', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys&create-key=1' ) ) . '" class="add-new-h2">' . __( 'Add key', 'woocommerce' ) . '</a></h2>';
|
// Get the API keys count.
|
||||||
|
|
||||||
// Get the API keys count
|
|
||||||
$count = $wpdb->get_var( "SELECT COUNT(key_id) FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1;" );
|
$count = $wpdb->get_var( "SELECT COUNT(key_id) FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1;" );
|
||||||
|
|
||||||
if ( absint( $count ) && $count > 0 ) {
|
if ( absint( $count ) && $count > 0 ) {
|
||||||
$keys_table_list = new WC_Admin_API_Keys_Table_List();
|
|
||||||
$keys_table_list->prepare_items();
|
$keys_table_list->prepare_items();
|
||||||
|
|
||||||
echo '<input type="hidden" name="page" value="wc-settings" />';
|
echo '<input type="hidden" name="page" value="wc-settings" />';
|
||||||
|
@ -80,17 +90,17 @@ class WC_Admin_API_Keys {
|
||||||
} else {
|
} else {
|
||||||
echo '<div class="woocommerce-BlankState woocommerce-BlankState--api">';
|
echo '<div class="woocommerce-BlankState woocommerce-BlankState--api">';
|
||||||
?>
|
?>
|
||||||
<h2 class="woocommerce-BlankState-message"><?php _e( 'The WooCommerce REST API allows external apps to view and manage store data. Access is granted only to those with valid API keys.', 'woocommerce' ); ?></h2>
|
<h2 class="woocommerce-BlankState-message"><?php esc_html_e( 'The WooCommerce REST API allows external apps to view and manage store data. Access is granted only to those with valid API keys.', 'woocommerce' ); ?></h2>
|
||||||
<a class="woocommerce-BlankState-cta button-primary button" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys&create-key=1' ) ); ?>"><?php _e( 'Create an API key', 'woocommerce' ); ?></a>
|
<a class="woocommerce-BlankState-cta button-primary button" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys&create-key=1' ) ); ?>"><?php esc_html_e( 'Create an API key', 'woocommerce' ); ?></a>
|
||||||
|
<style type="text/css">#posts-filter .wp-list-table, #posts-filter .tablenav.top, .tablenav.bottom .actions { display: none; }</style>
|
||||||
<?php echo '<style type="text/css">#posts-filter .wp-list-table, #posts-filter .tablenav.top, .tablenav.bottom .actions { display: none; } </style></div>';
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get key data.
|
* Get key data.
|
||||||
*
|
*
|
||||||
* @param int $key_id
|
* @param int $key_id API Key ID.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private static function get_key_data( $key_id ) {
|
private static function get_key_data( $key_id ) {
|
||||||
|
@ -105,15 +115,18 @@ class WC_Admin_API_Keys {
|
||||||
'last_access' => '',
|
'last_access' => '',
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( 0 == $key_id ) {
|
if ( 0 === $key_id ) {
|
||||||
return $empty;
|
return $empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = $wpdb->get_row( $wpdb->prepare( "
|
$key = $wpdb->get_row(
|
||||||
SELECT key_id, user_id, description, permissions, truncated_key, last_access
|
$wpdb->prepare(
|
||||||
|
"SELECT key_id, user_id, description, permissions, truncated_key, last_access
|
||||||
FROM {$wpdb->prefix}woocommerce_api_keys
|
FROM {$wpdb->prefix}woocommerce_api_keys
|
||||||
WHERE key_id = %d
|
WHERE key_id = %d",
|
||||||
", $key_id ), ARRAY_A );
|
$key_id
|
||||||
|
), ARRAY_A
|
||||||
|
);
|
||||||
|
|
||||||
if ( is_null( $key ) ) {
|
if ( is_null( $key ) ) {
|
||||||
return $empty;
|
return $empty;
|
||||||
|
@ -127,13 +140,13 @@ class WC_Admin_API_Keys {
|
||||||
*/
|
*/
|
||||||
public function actions() {
|
public function actions() {
|
||||||
if ( $this->is_api_keys_settings_page() ) {
|
if ( $this->is_api_keys_settings_page() ) {
|
||||||
// Revoke key
|
// Revoke key.
|
||||||
if ( isset( $_GET['revoke-key'] ) ) {
|
if ( isset( $_GET['revoke-key'] ) ) { // WPCS: input var okay, CSRF ok.
|
||||||
$this->revoke_key();
|
$this->revoke_key();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bulk actions
|
// Bulk actions.
|
||||||
if ( isset( $_GET['action'] ) && isset( $_GET['key'] ) ) {
|
if ( isset( $_GET['action'] ) && isset( $_GET['key'] ) ) { // WPCS: input var okay, CSRF ok.
|
||||||
$this->bulk_actions();
|
$this->bulk_actions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +156,7 @@ class WC_Admin_API_Keys {
|
||||||
* Notices.
|
* Notices.
|
||||||
*/
|
*/
|
||||||
public static function notices() {
|
public static function notices() {
|
||||||
if ( isset( $_GET['revoked'] ) && 1 == $_GET['revoked'] ) {
|
if ( isset( $_GET['revoked'] ) && 1 === $_GET['revoked'] ) { // WPCS: input var okay, CSRF ok.
|
||||||
WC_Admin_Settings::add_message( __( 'API key revoked successfully.', 'woocommerce' ) );
|
WC_Admin_Settings::add_message( __( 'API key revoked successfully.', 'woocommerce' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,12 +165,15 @@ class WC_Admin_API_Keys {
|
||||||
* Revoke key.
|
* Revoke key.
|
||||||
*/
|
*/
|
||||||
private function revoke_key() {
|
private function revoke_key() {
|
||||||
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'revoke' ) ) {
|
check_admin_referer( 'revoke' );
|
||||||
wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
$key_id = absint( $_GET['revoke-key'] );
|
if ( isset( $_GET['revoke-key'] ) ) { // WPCS: input var okay, CSRF ok.
|
||||||
|
$key_id = absint( $_GET['revoke-key'] ); // WPCS: input var okay, CSRF ok.
|
||||||
|
|
||||||
|
if ( $key_id ) {
|
||||||
$this->remove_key( $key_id );
|
$this->remove_key( $key_id );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wp_redirect( esc_url_raw( add_query_arg( array( 'revoked' => 1 ), admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys' ) ) ) );
|
wp_redirect( esc_url_raw( add_query_arg( array( 'revoked' => 1 ), admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys' ) ) ) );
|
||||||
exit();
|
exit();
|
||||||
|
@ -167,21 +183,26 @@ class WC_Admin_API_Keys {
|
||||||
* Bulk actions.
|
* Bulk actions.
|
||||||
*/
|
*/
|
||||||
private function bulk_actions() {
|
private function bulk_actions() {
|
||||||
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-settings' ) ) {
|
check_admin_referer( 'woocommerce-settings' );
|
||||||
wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
|
||||||
|
if ( ! current_user_can( 'manage_woocommerce' ) ) {
|
||||||
|
wp_die( esc_html__( 'You do not have permission to edit API Keys', 'woocommerce' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$keys = array_map( 'absint', (array) $_GET['key'] );
|
if ( isset( $_GET['action'] ) ) { // WPCS: input var okay, CSRF ok.
|
||||||
|
$action = sanitize_text_field( wp_unslash( $_GET['action'] ) ); // WPCS: input var okay, CSRF ok.
|
||||||
|
$keys = isset( $_GET['key'] ) ? array_map( 'absint', (array) $_GET['key'] ) : array(); // WPCS: input var okay, CSRF ok.
|
||||||
|
|
||||||
if ( 'revoke' == $_GET['action'] ) {
|
if ( 'revoke' === $action ) {
|
||||||
$this->bulk_revoke_key( $keys );
|
$this->bulk_revoke_key( $keys );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bulk revoke key.
|
* Bulk revoke key.
|
||||||
*
|
*
|
||||||
* @param array $keys
|
* @param array $keys API Keys.
|
||||||
*/
|
*/
|
||||||
private function bulk_revoke_key( $keys ) {
|
private function bulk_revoke_key( $keys ) {
|
||||||
foreach ( $keys as $key_id ) {
|
foreach ( $keys as $key_id ) {
|
||||||
|
@ -192,7 +213,7 @@ class WC_Admin_API_Keys {
|
||||||
/**
|
/**
|
||||||
* Remove key.
|
* Remove key.
|
||||||
*
|
*
|
||||||
* @param int $key_id
|
* @param int $key_id API Key ID.
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function remove_key( $key_id ) {
|
private function remove_key( $key_id ) {
|
||||||
|
|
|
@ -14,10 +14,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
|
||||||
if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WC_Admin_Assets Class.
|
* WC_Admin_Assets Class.
|
||||||
*/
|
*/
|
||||||
class WC_Admin_Assets {
|
class WC_Admin_Assets {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook in tabs.
|
* Hook in tabs.
|
||||||
|
@ -35,12 +35,11 @@ class WC_Admin_Assets {
|
||||||
|
|
||||||
$screen = get_current_screen();
|
$screen = get_current_screen();
|
||||||
$screen_id = $screen ? $screen->id : '';
|
$screen_id = $screen ? $screen->id : '';
|
||||||
$jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.11.4';
|
|
||||||
|
|
||||||
// Register admin styles
|
// Register admin styles
|
||||||
wp_register_style( 'woocommerce_admin_menu_styles', WC()->plugin_url() . '/assets/css/menu.css', array(), WC_VERSION );
|
wp_register_style( 'woocommerce_admin_menu_styles', WC()->plugin_url() . '/assets/css/menu.css', array(), WC_VERSION );
|
||||||
wp_register_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION );
|
wp_register_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION );
|
||||||
wp_register_style( 'jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.min.css', array(), $jquery_version );
|
wp_register_style( 'jquery-ui-style', WC()->plugin_url() . '/assets/css/jquery-ui.min.css', array(), WC_VERSION );
|
||||||
wp_register_style( 'woocommerce_admin_dashboard_styles', WC()->plugin_url() . '/assets/css/dashboard.css', array(), WC_VERSION );
|
wp_register_style( 'woocommerce_admin_dashboard_styles', WC()->plugin_url() . '/assets/css/dashboard.css', array(), WC_VERSION );
|
||||||
wp_register_style( 'woocommerce_admin_print_reports_styles', WC()->plugin_url() . '/assets/css/reports-print.css', array(), WC_VERSION, 'print' );
|
wp_register_style( 'woocommerce_admin_print_reports_styles', WC()->plugin_url() . '/assets/css/reports-print.css', array(), WC_VERSION, 'print' );
|
||||||
|
|
||||||
|
@ -111,9 +110,12 @@ class WC_Admin_Assets {
|
||||||
wp_register_script( 'wc-shipping-classes', WC()->plugin_url() . '/assets/js/admin/wc-shipping-classes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone' ), WC_VERSION );
|
wp_register_script( 'wc-shipping-classes', WC()->plugin_url() . '/assets/js/admin/wc-shipping-classes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone' ), WC_VERSION );
|
||||||
wp_register_script( 'wc-clipboard', WC()->plugin_url() . '/assets/js/admin/wc-clipboard' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
|
wp_register_script( 'wc-clipboard', WC()->plugin_url() . '/assets/js/admin/wc-clipboard' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
|
||||||
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
|
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
|
||||||
wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.2' );
|
wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.3' );
|
||||||
wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWoo' ), WC_VERSION );
|
wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWoo' ), WC_VERSION );
|
||||||
wp_localize_script( 'wc-enhanced-select', 'wc_enhanced_select_params', array(
|
wp_localize_script(
|
||||||
|
'wc-enhanced-select',
|
||||||
|
'wc_enhanced_select_params',
|
||||||
|
array(
|
||||||
'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'woocommerce' ),
|
'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'woocommerce' ),
|
||||||
'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'woocommerce' ),
|
'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'woocommerce' ),
|
||||||
'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'woocommerce' ),
|
'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'woocommerce' ),
|
||||||
|
@ -128,18 +130,27 @@ class WC_Admin_Assets {
|
||||||
'search_products_nonce' => wp_create_nonce( 'search-products' ),
|
'search_products_nonce' => wp_create_nonce( 'search-products' ),
|
||||||
'search_customers_nonce' => wp_create_nonce( 'search-customers' ),
|
'search_customers_nonce' => wp_create_nonce( 'search-customers' ),
|
||||||
'search_categories_nonce' => wp_create_nonce( 'search-categories' ),
|
'search_categories_nonce' => wp_create_nonce( 'search-categories' ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
wp_register_script( 'accounting', WC()->plugin_url() . '/assets/js/accounting/accounting' . $suffix . '.js', array( 'jquery' ), '0.4.2' );
|
wp_register_script( 'accounting', WC()->plugin_url() . '/assets/js/accounting/accounting' . $suffix . '.js', array( 'jquery' ), '0.4.2' );
|
||||||
wp_localize_script( 'accounting', 'accounting_params', array(
|
wp_localize_script(
|
||||||
|
'accounting',
|
||||||
|
'accounting_params',
|
||||||
|
array(
|
||||||
'mon_decimal_point' => wc_get_price_decimal_separator(),
|
'mon_decimal_point' => wc_get_price_decimal_separator(),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
wp_register_script( 'wc-orders', WC()->plugin_url() . '/assets/js/admin/wc-orders' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-blockui' ), WC_VERSION );
|
wp_register_script( 'wc-orders', WC()->plugin_url() . '/assets/js/admin/wc-orders' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-blockui' ), WC_VERSION );
|
||||||
wp_localize_script( 'wc-orders', 'wc_orders_params', array(
|
wp_localize_script(
|
||||||
|
'wc-orders',
|
||||||
|
'wc_orders_params',
|
||||||
|
array(
|
||||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||||
'preview_nonce' => wp_create_nonce( 'woocommerce-preview-order' ),
|
'preview_nonce' => wp_create_nonce( 'woocommerce-preview-order' ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// WooCommerce admin pages.
|
// WooCommerce admin pages.
|
||||||
if ( in_array( $screen_id, wc_get_screen_ids() ) ) {
|
if ( in_array( $screen_id, wc_get_screen_ids() ) ) {
|
||||||
|
@ -221,9 +232,9 @@ class WC_Admin_Assets {
|
||||||
'i18n_last_warning' => esc_js( __( 'Last warning, are you sure?', 'woocommerce' ) ),
|
'i18n_last_warning' => esc_js( __( 'Last warning, are you sure?', 'woocommerce' ) ),
|
||||||
'i18n_choose_image' => esc_js( __( 'Choose an image', 'woocommerce' ) ),
|
'i18n_choose_image' => esc_js( __( 'Choose an image', 'woocommerce' ) ),
|
||||||
'i18n_set_image' => esc_js( __( 'Set variation image', 'woocommerce' ) ),
|
'i18n_set_image' => esc_js( __( 'Set variation image', 'woocommerce' ) ),
|
||||||
'i18n_variation_added' => esc_js( __( "variation added", 'woocommerce' ) ),
|
'i18n_variation_added' => esc_js( __( 'variation added', 'woocommerce' ) ),
|
||||||
'i18n_variations_added' => esc_js( __( "variations added", 'woocommerce' ) ),
|
'i18n_variations_added' => esc_js( __( 'variations added', 'woocommerce' ) ),
|
||||||
'i18n_no_variations_added' => esc_js( __( "No variations added", 'woocommerce' ) ),
|
'i18n_no_variations_added' => esc_js( __( 'No variations added', 'woocommerce' ) ),
|
||||||
'i18n_remove_variation' => esc_js( __( 'Are you sure you want to remove this variation?', 'woocommerce' ) ),
|
'i18n_remove_variation' => esc_js( __( 'Are you sure you want to remove this variation?', 'woocommerce' ) ),
|
||||||
'i18n_scheduled_sale_start' => esc_js( __( 'Sale start date (YYYY-MM-DD format or leave blank)', 'woocommerce' ) ),
|
'i18n_scheduled_sale_start' => esc_js( __( 'Sale start date (YYYY-MM-DD format or leave blank)', 'woocommerce' ) ),
|
||||||
'i18n_scheduled_sale_end' => esc_js( __( 'Sale end date (YYYY-MM-DD format or leave blank)', 'woocommerce' ) ),
|
'i18n_scheduled_sale_end' => esc_js( __( 'Sale end date (YYYY-MM-DD format or leave blank)', 'woocommerce' ) ),
|
||||||
|
@ -239,14 +250,18 @@ class WC_Admin_Assets {
|
||||||
$default_location = wc_get_customer_default_location();
|
$default_location = wc_get_customer_default_location();
|
||||||
|
|
||||||
wp_enqueue_script( 'wc-admin-order-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-order' . $suffix . '.js', array( 'wc-admin-meta-boxes', 'wc-backbone-modal', 'selectWoo', 'wc-clipboard' ), WC_VERSION );
|
wp_enqueue_script( 'wc-admin-order-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-order' . $suffix . '.js', array( 'wc-admin-meta-boxes', 'wc-backbone-modal', 'selectWoo', 'wc-clipboard' ), WC_VERSION );
|
||||||
wp_localize_script( 'wc-admin-order-meta-boxes', 'woocommerce_admin_meta_boxes_order', array(
|
wp_localize_script(
|
||||||
|
'wc-admin-order-meta-boxes',
|
||||||
|
'woocommerce_admin_meta_boxes_order',
|
||||||
|
array(
|
||||||
'countries' => json_encode( array_merge( WC()->countries->get_allowed_country_states(), WC()->countries->get_shipping_country_states() ) ),
|
'countries' => json_encode( array_merge( WC()->countries->get_allowed_country_states(), WC()->countries->get_shipping_country_states() ) ),
|
||||||
'i18n_select_state_text' => esc_attr__( 'Select an option…', 'woocommerce' ),
|
'i18n_select_state_text' => esc_attr__( 'Select an option…', 'woocommerce' ),
|
||||||
'default_country' => isset( $default_location['country'] ) ? $default_location['country'] : '',
|
'default_country' => isset( $default_location['country'] ) ? $default_location['country'] : '',
|
||||||
'default_state' => isset( $default_location['state'] ) ? $default_location['state'] : '',
|
'default_state' => isset( $default_location['state'] ) ? $default_location['state'] : '',
|
||||||
'placeholder_name' => esc_attr__( 'Name (required)', 'woocommerce' ),
|
'placeholder_name' => esc_attr__( 'Name (required)', 'woocommerce' ),
|
||||||
'placeholder_value' => esc_attr__( 'Value (required)', 'woocommerce' ),
|
'placeholder_value' => esc_attr__( 'Value (required)', 'woocommerce' ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ( in_array( $screen_id, array( 'shop_coupon', 'edit-shop_coupon' ) ) ) {
|
if ( in_array( $screen_id, array( 'shop_coupon', 'edit-shop_coupon' ) ) ) {
|
||||||
wp_enqueue_script( 'wc-admin-coupon-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-coupon' . $suffix . '.js', array( 'wc-admin-meta-boxes' ), WC_VERSION );
|
wp_enqueue_script( 'wc-admin-coupon-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-coupon' . $suffix . '.js', array( 'wc-admin-meta-boxes' ), WC_VERSION );
|
||||||
|
@ -392,7 +407,7 @@ class WC_Admin_Assets {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,13 @@ class WC_Admin_Attributes {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( $action ) {
|
switch ( $action ) {
|
||||||
case 'add' :
|
case 'add':
|
||||||
$result = self::process_add_attribute();
|
$result = self::process_add_attribute();
|
||||||
break;
|
break;
|
||||||
case 'edit' :
|
case 'edit':
|
||||||
$result = self::process_edit_attribute();
|
$result = self::process_edit_attribute();
|
||||||
break;
|
break;
|
||||||
case 'delete' :
|
case 'delete':
|
||||||
$result = self::process_delete_attribute();
|
$result = self::process_delete_attribute();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -166,11 +166,11 @@ class WC_Admin_Attributes {
|
||||||
|
|
||||||
$edit = absint( $_GET['edit'] );
|
$edit = absint( $_GET['edit'] );
|
||||||
|
|
||||||
$attribute_to_edit = $wpdb->get_row( "SELECT attribute_type, attribute_label, attribute_name, attribute_orderby, attribute_public FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = '$edit'" );
|
$attribute_to_edit = $wpdb->get_row( 'SELECT attribute_type, attribute_label, attribute_name, attribute_orderby, attribute_public FROM ' . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = '$edit'" );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="wrap woocommerce">
|
<div class="wrap woocommerce">
|
||||||
<h1><?php esc_html_e( 'Edit attribute', 'woocommerce' ) ?></h1>
|
<h1><?php esc_html_e( 'Edit attribute', 'woocommerce' ); ?></h1>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ( ! $attribute_to_edit ) {
|
if ( ! $attribute_to_edit ) {
|
||||||
|
@ -221,9 +221,7 @@ class WC_Admin_Attributes {
|
||||||
* `product_attributes_type_selector` filter. If there is only the default type registered,
|
* `product_attributes_type_selector` filter. If there is only the default type registered,
|
||||||
* this setting will be hidden.
|
* this setting will be hidden.
|
||||||
*/
|
*/
|
||||||
$attribute_types = wc_get_attribute_types();
|
if ( wc_has_custom_attribute_types() ) {
|
||||||
|
|
||||||
if ( 1 < count( $attribute_types ) || ! array_key_exists( 'select', $attribute_types ) ) {
|
|
||||||
?>
|
?>
|
||||||
<tr class="form-field form-required">
|
<tr class="form-field form-required">
|
||||||
<th scope="row" valign="top">
|
<th scope="row" valign="top">
|
||||||
|
@ -264,7 +262,7 @@ class WC_Admin_Attributes {
|
||||||
<p class="description"><?php esc_html_e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p>
|
<p class="description"><?php esc_html_e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php do_action( 'woocommerce_after_edit_attribute_fields' ) ?>
|
<?php do_action( 'woocommerce_after_edit_attribute_fields' ); ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p class="submit"><button type="submit" name="save_attribute" id="submit" class="button-primary" value="<?php esc_attr_e( 'Update', 'woocommerce' ); ?>"><?php esc_html_e( 'Update', 'woocommerce' ); ?></button></p>
|
<p class="submit"><button type="submit" name="save_attribute" id="submit" class="button-primary" value="<?php esc_attr_e( 'Update', 'woocommerce' ); ?>"><?php esc_html_e( 'Update', 'woocommerce' ); ?></button></p>
|
||||||
|
@ -294,7 +292,9 @@ class WC_Admin_Attributes {
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col"><?php esc_html_e( 'Name', 'woocommerce' ); ?></th>
|
<th scope="col"><?php esc_html_e( 'Name', 'woocommerce' ); ?></th>
|
||||||
<th scope="col"><?php esc_html_e( 'Slug', 'woocommerce' ); ?></th>
|
<th scope="col"><?php esc_html_e( 'Slug', 'woocommerce' ); ?></th>
|
||||||
|
<?php if ( wc_has_custom_attribute_types() ) : ?>
|
||||||
<th scope="col"><?php esc_html_e( 'Type', 'woocommerce' ); ?></th>
|
<th scope="col"><?php esc_html_e( 'Type', 'woocommerce' ); ?></th>
|
||||||
|
<?php endif; ?>
|
||||||
<th scope="col"><?php esc_html_e( 'Order by', 'woocommerce' ); ?></th>
|
<th scope="col"><?php esc_html_e( 'Order by', 'woocommerce' ); ?></th>
|
||||||
<th scope="col"><?php esc_html_e( 'Terms', 'woocommerce' ); ?></th>
|
<th scope="col"><?php esc_html_e( 'Terms', 'woocommerce' ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -303,23 +303,27 @@ class WC_Admin_Attributes {
|
||||||
<?php
|
<?php
|
||||||
if ( $attribute_taxonomies = wc_get_attribute_taxonomies() ) :
|
if ( $attribute_taxonomies = wc_get_attribute_taxonomies() ) :
|
||||||
foreach ( $attribute_taxonomies as $tax ) :
|
foreach ( $attribute_taxonomies as $tax ) :
|
||||||
?><tr>
|
?>
|
||||||
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<strong><a href="edit-tags.php?taxonomy=<?php echo esc_html( wc_attribute_taxonomy_name( $tax->attribute_name ) ); ?>&post_type=product"><?php echo esc_html( $tax->attribute_label ); ?></a></strong>
|
<strong><a href="edit-tags.php?taxonomy=<?php echo esc_html( wc_attribute_taxonomy_name( $tax->attribute_name ) ); ?>&post_type=product"><?php echo esc_html( $tax->attribute_label ); ?></a></strong>
|
||||||
|
|
||||||
<div class="row-actions"><span class="edit"><a href="<?php echo esc_url( add_query_arg( 'edit', $tax->attribute_id, 'edit.php?post_type=product&page=product_attributes' ) ); ?>"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'delete', $tax->attribute_id, 'edit.php?post_type=product&page=product_attributes' ), 'woocommerce-delete-attribute_' . $tax->attribute_id ) ); ?>"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a></span></div>
|
<div class="row-actions"><span class="edit"><a href="<?php echo esc_url( add_query_arg( 'edit', $tax->attribute_id, 'edit.php?post_type=product&page=product_attributes' ) ); ?>"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'delete', $tax->attribute_id, 'edit.php?post_type=product&page=product_attributes' ), 'woocommerce-delete-attribute_' . $tax->attribute_id ) ); ?>"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a></span></div>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo esc_html( $tax->attribute_name ); ?></td>
|
<td><?php echo esc_html( $tax->attribute_name ); ?></td>
|
||||||
|
<?php if ( wc_has_custom_attribute_types() ) : ?>
|
||||||
<td><?php echo esc_html( wc_get_attribute_type_label( $tax->attribute_type ) ); ?> <?php echo $tax->attribute_public ? esc_html__( '(Public)', 'woocommerce' ) : ''; ?></td>
|
<td><?php echo esc_html( wc_get_attribute_type_label( $tax->attribute_type ) ); ?> <?php echo $tax->attribute_public ? esc_html__( '(Public)', 'woocommerce' ) : ''; ?></td>
|
||||||
<td><?php
|
<?php endif; ?>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
switch ( $tax->attribute_orderby ) {
|
switch ( $tax->attribute_orderby ) {
|
||||||
case 'name' :
|
case 'name':
|
||||||
esc_html_e( 'Name', 'woocommerce' );
|
esc_html_e( 'Name', 'woocommerce' );
|
||||||
break;
|
break;
|
||||||
case 'name_num' :
|
case 'name_num':
|
||||||
esc_html_e( 'Name (numeric)', 'woocommerce' );
|
esc_html_e( 'Name (numeric)', 'woocommerce' );
|
||||||
break;
|
break;
|
||||||
case 'id' :
|
case 'id':
|
||||||
esc_html_e( 'Term ID', 'woocommerce' );
|
esc_html_e( 'Term ID', 'woocommerce' );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -340,10 +344,10 @@ class WC_Admin_Attributes {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( $tax->attribute_orderby ) {
|
switch ( $tax->attribute_orderby ) {
|
||||||
case 'name_num' :
|
case 'name_num':
|
||||||
usort( $terms, '_wc_get_product_terms_name_num_usort_callback' );
|
usort( $terms, '_wc_get_product_terms_name_num_usort_callback' );
|
||||||
break;
|
break;
|
||||||
case 'parent' :
|
case 'parent':
|
||||||
usort( $terms, '_wc_get_product_terms_parent_usort_callback' );
|
usort( $terms, '_wc_get_product_terms_parent_usort_callback' );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -364,7 +368,11 @@ class WC_Admin_Attributes {
|
||||||
<?php
|
<?php
|
||||||
endforeach;
|
endforeach;
|
||||||
else :
|
else :
|
||||||
?><tr><td colspan="6"><?php esc_html_e( 'No attributes currently exist.', 'woocommerce' ) ?></td></tr><?php
|
?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="6"><?php esc_html_e( 'No attributes currently exist.', 'woocommerce' ); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -377,7 +385,7 @@ class WC_Admin_Attributes {
|
||||||
<h2><?php esc_html_e( 'Add new attribute', 'woocommerce' ); ?></h2>
|
<h2><?php esc_html_e( 'Add new attribute', 'woocommerce' ); ?></h2>
|
||||||
<p><?php esc_html_e( 'Attributes let you define extra product data, such as size or color. You can use these attributes in the shop sidebar using the "layered nav" widgets.', 'woocommerce' ); ?></p>
|
<p><?php esc_html_e( 'Attributes let you define extra product data, such as size or color. You can use these attributes in the shop sidebar using the "layered nav" widgets.', 'woocommerce' ); ?></p>
|
||||||
<form action="edit.php?post_type=product&page=product_attributes" method="post">
|
<form action="edit.php?post_type=product&page=product_attributes" method="post">
|
||||||
<?php do_action( 'woocommerce_before_add_attribute_fields' ) ?>
|
<?php do_action( 'woocommerce_before_add_attribute_fields' ); ?>
|
||||||
|
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="attribute_label"><?php esc_html_e( 'Name', 'woocommerce' ); ?></label>
|
<label for="attribute_label"><?php esc_html_e( 'Name', 'woocommerce' ); ?></label>
|
||||||
|
@ -405,9 +413,7 @@ class WC_Admin_Attributes {
|
||||||
* `product_attributes_type_selector` filter. If there is only the default type registered,
|
* `product_attributes_type_selector` filter. If there is only the default type registered,
|
||||||
* this setting will be hidden.
|
* this setting will be hidden.
|
||||||
*/
|
*/
|
||||||
$attribute_types = wc_get_attribute_types();
|
if ( wc_has_custom_attribute_types() ) {
|
||||||
|
|
||||||
if ( 1 < count( $attribute_types ) || ! array_key_exists( 'select', $attribute_types ) ) {
|
|
||||||
?>
|
?>
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="attribute_type"><?php esc_html_e( 'Type', 'woocommerce' ); ?></label>
|
<label for="attribute_type"><?php esc_html_e( 'Type', 'woocommerce' ); ?></label>
|
||||||
|
@ -442,7 +448,7 @@ class WC_Admin_Attributes {
|
||||||
<p class="description"><?php esc_html_e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p>
|
<p class="description"><?php esc_html_e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php do_action( 'woocommerce_after_add_attribute_fields' ) ?>
|
<?php do_action( 'woocommerce_after_add_attribute_fields' ); ?>
|
||||||
|
|
||||||
<p class="submit"><button type="submit" name="add_new_attribute" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Add attribute', 'woocommerce' ); ?>"><?php esc_html_e( 'Add attribute', 'woocommerce' ); ?></button></p>
|
<p class="submit"><button type="submit" name="add_new_attribute" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Add attribute', 'woocommerce' ); ?>"><?php esc_html_e( 'Add attribute', 'woocommerce' ); ?></button></p>
|
||||||
<?php wp_nonce_field( 'woocommerce-add-new_attribute' ); ?>
|
<?php wp_nonce_field( 'woocommerce-add-new_attribute' ); ?>
|
||||||
|
|
|
@ -14,10 +14,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
|
||||||
if ( ! class_exists( 'WC_Admin_Customize', false ) ) :
|
if ( ! class_exists( 'WC_Admin_Customize', false ) ) :
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WC_Admin_Customize Class.
|
* WC_Admin_Customize Class.
|
||||||
*/
|
*/
|
||||||
class WC_Admin_Customize {
|
class WC_Admin_Customize {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize customize actions.
|
* Initialize customize actions.
|
||||||
|
@ -91,7 +91,7 @@ class WC_Admin_Customize {
|
||||||
|
|
||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
|
||||||
if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
|
if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WC_Admin_Dashboard Class.
|
* WC_Admin_Dashboard Class.
|
||||||
*/
|
*/
|
||||||
class WC_Admin_Dashboard {
|
class WC_Admin_Dashboard {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook in tabs.
|
* Hook in tabs.
|
||||||
|
@ -58,6 +58,7 @@ class WC_Admin_Dashboard {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get top seller from DB.
|
* Get top seller from DB.
|
||||||
|
*
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
private function get_top_seller() {
|
private function get_top_seller() {
|
||||||
|
@ -75,19 +76,20 @@ class WC_Admin_Dashboard {
|
||||||
$query['where'] .= "AND order_item_meta_2.meta_key = '_product_id' ";
|
$query['where'] .= "AND order_item_meta_2.meta_key = '_product_id' ";
|
||||||
$query['where'] .= "AND posts.post_date >= '" . date( 'Y-m-01', current_time( 'timestamp' ) ) . "' ";
|
$query['where'] .= "AND posts.post_date >= '" . date( 'Y-m-01', current_time( 'timestamp' ) ) . "' ";
|
||||||
$query['where'] .= "AND posts.post_date <= '" . date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ) . "' ";
|
$query['where'] .= "AND posts.post_date <= '" . date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ) . "' ";
|
||||||
$query['groupby'] = "GROUP BY product_id";
|
$query['groupby'] = 'GROUP BY product_id';
|
||||||
$query['orderby'] = "ORDER BY qty DESC";
|
$query['orderby'] = 'ORDER BY qty DESC';
|
||||||
$query['limits'] = "LIMIT 1";
|
$query['limits'] = 'LIMIT 1';
|
||||||
|
|
||||||
return $wpdb->get_row( implode( ' ', apply_filters( 'woocommerce_dashboard_status_widget_top_seller_query', $query ) ) );
|
return $wpdb->get_row( implode( ' ', apply_filters( 'woocommerce_dashboard_status_widget_top_seller_query', $query ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get sales report data.
|
* Get sales report data.
|
||||||
|
*
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
private function get_sales_report_data() {
|
private function get_sales_report_data() {
|
||||||
include_once( dirname( __FILE__ ) . '/reports/class-wc-report-sales-by-date.php' );
|
include_once dirname( __FILE__ ) . '/reports/class-wc-report-sales-by-date.php';
|
||||||
|
|
||||||
$sales_by_date = new WC_Report_Sales_By_Date();
|
$sales_by_date = new WC_Report_Sales_By_Date();
|
||||||
$sales_by_date->start_date = strtotime( date( 'Y-m-01', current_time( 'timestamp' ) ) );
|
$sales_by_date->start_date = strtotime( date( 'Y-m-01', current_time( 'timestamp' ) ) );
|
||||||
|
@ -102,7 +104,7 @@ class WC_Admin_Dashboard {
|
||||||
* Show status widget.
|
* Show status widget.
|
||||||
*/
|
*/
|
||||||
public function status_widget() {
|
public function status_widget() {
|
||||||
include_once( dirname( __FILE__ ) . '/reports/class-wc-admin-report.php' );
|
include_once dirname( __FILE__ ) . '/reports/class-wc-admin-report.php';
|
||||||
|
|
||||||
$reports = new WC_Admin_Report();
|
$reports = new WC_Admin_Report();
|
||||||
|
|
||||||
|
@ -203,7 +205,9 @@ class WC_Admin_Dashboard {
|
||||||
$transient_name = 'wc_low_stock_count';
|
$transient_name = 'wc_low_stock_count';
|
||||||
|
|
||||||
if ( false === ( $lowinstock_count = get_transient( $transient_name ) ) ) {
|
if ( false === ( $lowinstock_count = get_transient( $transient_name ) ) ) {
|
||||||
$query_from = apply_filters( 'woocommerce_report_low_in_stock_query_from', "FROM {$wpdb->posts} as posts
|
$query_from = apply_filters(
|
||||||
|
'woocommerce_report_low_in_stock_query_from',
|
||||||
|
"FROM {$wpdb->posts} as posts
|
||||||
INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id
|
INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id
|
||||||
INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id
|
INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
|
@ -211,8 +215,8 @@ class WC_Admin_Dashboard {
|
||||||
AND posts.post_status = 'publish'
|
AND posts.post_status = 'publish'
|
||||||
AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes'
|
AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes'
|
||||||
AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$stock}'
|
AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$stock}'
|
||||||
AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) > '{$nostock}'
|
AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) > '{$nostock}'"
|
||||||
" );
|
);
|
||||||
$lowinstock_count = absint( $wpdb->get_var( "SELECT COUNT( DISTINCT posts.ID ) {$query_from};" ) );
|
$lowinstock_count = absint( $wpdb->get_var( "SELECT COUNT( DISTINCT posts.ID ) {$query_from};" ) );
|
||||||
set_transient( $transient_name, $lowinstock_count, DAY_IN_SECONDS * 30 );
|
set_transient( $transient_name, $lowinstock_count, DAY_IN_SECONDS * 30 );
|
||||||
}
|
}
|
||||||
|
@ -220,15 +224,17 @@ class WC_Admin_Dashboard {
|
||||||
$transient_name = 'wc_outofstock_count';
|
$transient_name = 'wc_outofstock_count';
|
||||||
|
|
||||||
if ( false === ( $outofstock_count = get_transient( $transient_name ) ) ) {
|
if ( false === ( $outofstock_count = get_transient( $transient_name ) ) ) {
|
||||||
$query_from = apply_filters( 'woocommerce_report_out_of_stock_query_from', "FROM {$wpdb->posts} as posts
|
$query_from = apply_filters(
|
||||||
|
'woocommerce_report_out_of_stock_query_from',
|
||||||
|
"FROM {$wpdb->posts} as posts
|
||||||
INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id
|
INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id
|
||||||
INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id
|
INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
AND posts.post_type IN ( 'product', 'product_variation' )
|
AND posts.post_type IN ( 'product', 'product_variation' )
|
||||||
AND posts.post_status = 'publish'
|
AND posts.post_status = 'publish'
|
||||||
AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes'
|
AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes'
|
||||||
AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$nostock}'
|
AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$nostock}'"
|
||||||
" );
|
);
|
||||||
$outofstock_count = absint( $wpdb->get_var( "SELECT COUNT( DISTINCT posts.ID ) {$query_from};" ) );
|
$outofstock_count = absint( $wpdb->get_var( "SELECT COUNT( DISTINCT posts.ID ) {$query_from};" ) );
|
||||||
set_transient( $transient_name, $outofstock_count, DAY_IN_SECONDS * 30 );
|
set_transient( $transient_name, $outofstock_count, DAY_IN_SECONDS * 30 );
|
||||||
}
|
}
|
||||||
|
@ -264,7 +270,9 @@ class WC_Admin_Dashboard {
|
||||||
public function recent_reviews() {
|
public function recent_reviews() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$query_from = apply_filters( 'woocommerce_report_recent_reviews_query_from', "FROM {$wpdb->comments} comments
|
$query_from = apply_filters(
|
||||||
|
'woocommerce_report_recent_reviews_query_from',
|
||||||
|
"FROM {$wpdb->comments} comments
|
||||||
LEFT JOIN {$wpdb->posts} posts ON (comments.comment_post_ID = posts.ID)
|
LEFT JOIN {$wpdb->posts} posts ON (comments.comment_post_ID = posts.ID)
|
||||||
WHERE comments.comment_approved = '1'
|
WHERE comments.comment_approved = '1'
|
||||||
AND comments.comment_type = ''
|
AND comments.comment_type = ''
|
||||||
|
@ -272,13 +280,12 @@ class WC_Admin_Dashboard {
|
||||||
AND posts.post_type = 'product'
|
AND posts.post_type = 'product'
|
||||||
AND comments.comment_parent = 0
|
AND comments.comment_parent = 0
|
||||||
ORDER BY comments.comment_date_gmt DESC
|
ORDER BY comments.comment_date_gmt DESC
|
||||||
LIMIT 5
|
LIMIT 5"
|
||||||
" );
|
);
|
||||||
|
|
||||||
$comments = $wpdb->get_results( "
|
$comments = $wpdb->get_results(
|
||||||
SELECT posts.ID, posts.post_title, comments.comment_author, comments.comment_ID, comments.comment_content
|
"SELECT posts.ID, posts.post_title, comments.comment_author, comments.comment_ID, comments.comment_content {$query_from};"
|
||||||
{$query_from};
|
);
|
||||||
" );
|
|
||||||
|
|
||||||
if ( $comments ) {
|
if ( $comments ) {
|
||||||
echo '<ul>';
|
echo '<ul>';
|
||||||
|
@ -318,11 +325,13 @@ class WC_Admin_Dashboard {
|
||||||
$blogs = get_blogs_of_user( $user->ID );
|
$blogs = get_blogs_of_user( $user->ID );
|
||||||
$blog_ids = wp_list_pluck( $blogs, 'userblog_id' );
|
$blog_ids = wp_list_pluck( $blogs, 'userblog_id' );
|
||||||
|
|
||||||
wp_localize_script( 'wc-network-orders', 'woocommerce_network_orders', array(
|
wp_localize_script(
|
||||||
|
'wc-network-orders', 'woocommerce_network_orders', array(
|
||||||
'nonce' => wp_create_nonce( 'wp_rest' ),
|
'nonce' => wp_create_nonce( 'wp_rest' ),
|
||||||
'sites' => array_values( $blog_ids ),
|
'sites' => array_values( $blog_ids ),
|
||||||
'order_endpoint' => get_rest_url( null, 'wc/v2/orders/network' ),
|
'order_endpoint' => get_rest_url( null, 'wc/v2/orders/network' ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
?>
|
?>
|
||||||
<div class="post-type-shop_order">
|
<div class="post-type-shop_order">
|
||||||
<div id="woocommerce-network-order-table-loading" class="woocommerce-network-order-table-loading is-active">
|
<div id="woocommerce-network-order-table-loading" class="woocommerce-network-order-table-loading is-active">
|
||||||
|
@ -369,7 +378,7 @@ class WC_Admin_Dashboard {
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ class WC_Admin_Duplicate_Product {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_GET['post'] ) ) {
|
if ( isset( $_GET['post'] ) ) {
|
||||||
$notify_url = wp_nonce_url( admin_url( "edit.php?post_type=product&action=duplicate_product&post=" . absint( $_GET['post'] ) ), 'woocommerce-duplicate-product_' . $_GET['post'] );
|
$notify_url = wp_nonce_url( admin_url( 'edit.php?post_type=product&action=duplicate_product&post=' . absint( $_GET['post'] ) ), 'woocommerce-duplicate-product_' . $_GET['post'] );
|
||||||
?>
|
?>
|
||||||
<div id="duplicate-action"><a class="submitduplicate duplication" href="<?php echo esc_url( $notify_url ); ?>"><?php _e( 'Copy to a new draft', 'woocommerce' ); ?></a></div>
|
<div id="duplicate-action"><a class="submitduplicate duplication" href="<?php echo esc_url( $notify_url ); ?>"><?php _e( 'Copy to a new draft', 'woocommerce' ); ?></a></div>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -73,17 +73,21 @@ class WC_Admin_Exporters {
|
||||||
public function admin_scripts() {
|
public function admin_scripts() {
|
||||||
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||||
wp_register_script( 'wc-product-export', WC()->plugin_url() . '/assets/js/admin/wc-product-export' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
|
wp_register_script( 'wc-product-export', WC()->plugin_url() . '/assets/js/admin/wc-product-export' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
|
||||||
wp_localize_script( 'wc-product-export', 'wc_product_export_params', array(
|
wp_localize_script(
|
||||||
|
'wc-product-export',
|
||||||
|
'wc_product_export_params',
|
||||||
|
array(
|
||||||
'export_nonce' => wp_create_nonce( 'wc-product-export' ),
|
'export_nonce' => wp_create_nonce( 'wc-product-export' ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export page UI.
|
* Export page UI.
|
||||||
*/
|
*/
|
||||||
public function product_exporter() {
|
public function product_exporter() {
|
||||||
include_once( WC_ABSPATH . 'includes/export/class-wc-product-csv-exporter.php' );
|
include_once WC_ABSPATH . 'includes/export/class-wc-product-csv-exporter.php';
|
||||||
include_once( dirname( __FILE__ ) . '/views/html-admin-page-product-export.php' );
|
include_once dirname( __FILE__ ) . '/views/html-admin-page-product-export.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +95,7 @@ class WC_Admin_Exporters {
|
||||||
*/
|
*/
|
||||||
public function download_export_file() {
|
public function download_export_file() {
|
||||||
if ( isset( $_GET['action'], $_GET['nonce'] ) && wp_verify_nonce( wp_unslash( $_GET['nonce'] ), 'product-csv' ) && 'download_product_csv' === wp_unslash( $_GET['action'] ) ) { // WPCS: input var ok, sanitization ok.
|
if ( isset( $_GET['action'], $_GET['nonce'] ) && wp_verify_nonce( wp_unslash( $_GET['nonce'] ), 'product-csv' ) && 'download_product_csv' === wp_unslash( $_GET['action'] ) ) { // WPCS: input var ok, sanitization ok.
|
||||||
include_once( WC_ABSPATH . 'includes/export/class-wc-product-csv-exporter.php' );
|
include_once WC_ABSPATH . 'includes/export/class-wc-product-csv-exporter.php';
|
||||||
$exporter = new WC_Product_CSV_Exporter();
|
$exporter = new WC_Product_CSV_Exporter();
|
||||||
|
|
||||||
if ( ! empty( $_GET['filename'] ) ) { // WPCS: input var ok.
|
if ( ! empty( $_GET['filename'] ) ) { // WPCS: input var ok.
|
||||||
|
@ -112,7 +116,7 @@ class WC_Admin_Exporters {
|
||||||
wp_die( -1 );
|
wp_die( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once( WC_ABSPATH . 'includes/export/class-wc-product-csv-exporter.php' );
|
include_once WC_ABSPATH . 'includes/export/class-wc-product-csv-exporter.php';
|
||||||
|
|
||||||
$step = isset( $_POST['step'] ) ? absint( $_POST['step'] ) : 1; // WPCS: input var ok, sanitization ok.
|
$step = isset( $_POST['step'] ) ? absint( $_POST['step'] ) : 1; // WPCS: input var ok, sanitization ok.
|
||||||
$exporter = new WC_Product_CSV_Exporter();
|
$exporter = new WC_Product_CSV_Exporter();
|
||||||
|
@ -140,20 +144,31 @@ class WC_Admin_Exporters {
|
||||||
$exporter->set_page( $step );
|
$exporter->set_page( $step );
|
||||||
$exporter->generate_file();
|
$exporter->generate_file();
|
||||||
|
|
||||||
$query_args = apply_filters( 'woocommerce_export_get_ajax_query_args', array( 'nonce' => wp_create_nonce( 'product-csv' ), 'action' => 'download_product_csv', 'filename' => $exporter->get_filename() ) );
|
$query_args = apply_filters(
|
||||||
|
'woocommerce_export_get_ajax_query_args',
|
||||||
|
array(
|
||||||
|
'nonce' => wp_create_nonce( 'product-csv' ),
|
||||||
|
'action' => 'download_product_csv',
|
||||||
|
'filename' => $exporter->get_filename(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if ( 100 === $exporter->get_percent_complete() ) {
|
if ( 100 === $exporter->get_percent_complete() ) {
|
||||||
wp_send_json_success( array(
|
wp_send_json_success(
|
||||||
|
array(
|
||||||
'step' => 'done',
|
'step' => 'done',
|
||||||
'percentage' => 100,
|
'percentage' => 100,
|
||||||
'url' => add_query_arg( $query_args, admin_url( 'edit.php?post_type=product&page=product_exporter' ) ),
|
'url' => add_query_arg( $query_args, admin_url( 'edit.php?post_type=product&page=product_exporter' ) ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
wp_send_json_success( array(
|
wp_send_json_success(
|
||||||
|
array(
|
||||||
'step' => ++$step,
|
'step' => ++$step,
|
||||||
'percentage' => $exporter->get_percent_complete(),
|
'percentage' => $exporter->get_percent_complete(),
|
||||||
'columns' => $exporter->get_column_names(),
|
'columns' => $exporter->get_column_names(),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ class WC_Admin_Help {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$screen->add_help_tab( array(
|
$screen->add_help_tab(
|
||||||
|
array(
|
||||||
'id' => 'woocommerce_support_tab',
|
'id' => 'woocommerce_support_tab',
|
||||||
'title' => __( 'Help & Support', 'woocommerce' ),
|
'title' => __( 'Help & Support', 'woocommerce' ),
|
||||||
'content' =>
|
'content' =>
|
||||||
|
@ -54,9 +55,11 @@ class WC_Admin_Help {
|
||||||
) . '</p>' .
|
) . '</p>' .
|
||||||
'<p>' . __( 'Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce' ) . '</p>' .
|
'<p>' . __( 'Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce' ) . '</p>' .
|
||||||
'<p><a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button button-primary">' . __( 'System status', 'woocommerce' ) . '</a> <a href="https://wordpress.org/support/plugin/woocommerce" class="button">' . __( 'Community forum', 'woocommerce' ) . '</a> <a href="https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin" class="button">' . __( 'WooCommerce helpdesk', 'woocommerce' ) . '</a></p>',
|
'<p><a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button button-primary">' . __( 'System status', 'woocommerce' ) . '</a> <a href="https://wordpress.org/support/plugin/woocommerce" class="button">' . __( 'Community forum', 'woocommerce' ) . '</a> <a href="https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin" class="button">' . __( 'WooCommerce helpdesk', 'woocommerce' ) . '</a></p>',
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$screen->add_help_tab( array(
|
$screen->add_help_tab(
|
||||||
|
array(
|
||||||
'id' => 'woocommerce_bugs_tab',
|
'id' => 'woocommerce_bugs_tab',
|
||||||
'title' => __( 'Found a bug?', 'woocommerce' ),
|
'title' => __( 'Found a bug?', 'woocommerce' ),
|
||||||
'content' =>
|
'content' =>
|
||||||
|
@ -65,18 +68,22 @@ class WC_Admin_Help {
|
||||||
'<p>' . sprintf( __( 'If you find a bug within WooCommerce core you can create a ticket via <a href="%1$s">Github issues</a>. Ensure you read the <a href="%2$s">contribution guide</a> prior to submitting your report. To help us solve your issue, please be as descriptive as possible and include your <a href="%3$s">system status report</a>.', 'woocommerce' ), 'https://github.com/woocommerce/woocommerce/issues?state=open', 'https://github.com/woocommerce/woocommerce/blob/master/.github/CONTRIBUTING.md', admin_url( 'admin.php?page=wc-status' ) ) . '</p>' .
|
'<p>' . sprintf( __( 'If you find a bug within WooCommerce core you can create a ticket via <a href="%1$s">Github issues</a>. Ensure you read the <a href="%2$s">contribution guide</a> prior to submitting your report. To help us solve your issue, please be as descriptive as possible and include your <a href="%3$s">system status report</a>.', 'woocommerce' ), 'https://github.com/woocommerce/woocommerce/issues?state=open', 'https://github.com/woocommerce/woocommerce/blob/master/.github/CONTRIBUTING.md', admin_url( 'admin.php?page=wc-status' ) ) . '</p>' .
|
||||||
'<p><a href="https://github.com/woocommerce/woocommerce/issues?state=open" class="button button-primary">' . __( 'Report a bug', 'woocommerce' ) . '</a> <a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button">' . __( 'System status', 'woocommerce' ) . '</a></p>',
|
'<p><a href="https://github.com/woocommerce/woocommerce/issues?state=open" class="button button-primary">' . __( 'Report a bug', 'woocommerce' ) . '</a> <a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button">' . __( 'System status', 'woocommerce' ) . '</a></p>',
|
||||||
|
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$screen->add_help_tab( array(
|
$screen->add_help_tab(
|
||||||
|
array(
|
||||||
'id' => 'woocommerce_education_tab',
|
'id' => 'woocommerce_education_tab',
|
||||||
'title' => __( 'Education', 'woocommerce' ),
|
'title' => __( 'Education', 'woocommerce' ),
|
||||||
'content' =>
|
'content' =>
|
||||||
'<h2>' . __( 'Education', 'woocommerce' ) . '</h2>' .
|
'<h2>' . __( 'Education', 'woocommerce' ) . '</h2>' .
|
||||||
'<p>' . __( 'If you would like to learn about using WooCommerce from an expert, consider following a WooCommerce course offered by one of our educational partners.', 'woocommerce' ) . '</p>' .
|
'<p>' . __( 'If you would like to learn about using WooCommerce from an expert, consider following a WooCommerce course offered by one of our educational partners.', 'woocommerce' ) . '</p>' .
|
||||||
'<p><a href="https://woocommerce.com/educational-partners/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin" class="button button-primary">' . __( 'View education partners', 'woocommerce' ) . '</a></p>',
|
'<p><a href="https://woocommerce.com/educational-partners/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin" class="button button-primary">' . __( 'View education partners', 'woocommerce' ) . '</a></p>',
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$screen->add_help_tab( array(
|
$screen->add_help_tab(
|
||||||
|
array(
|
||||||
'id' => 'woocommerce_onboard_tab',
|
'id' => 'woocommerce_onboard_tab',
|
||||||
'title' => __( 'Setup wizard', 'woocommerce' ),
|
'title' => __( 'Setup wizard', 'woocommerce' ),
|
||||||
'content' =>
|
'content' =>
|
||||||
|
@ -84,7 +91,8 @@ class WC_Admin_Help {
|
||||||
'<p>' . __( 'If you need to access the setup wizard again, please click on the button below.', 'woocommerce' ) . '</p>' .
|
'<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>',
|
'<p><a href="' . admin_url( 'index.php?page=wc-setup' ) . '" class="button button-primary">' . __( 'Setup wizard', 'woocommerce' ) . '</a></p>',
|
||||||
|
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$screen->set_help_sidebar(
|
$screen->set_help_sidebar(
|
||||||
'<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></p>' .
|
'<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></p>' .
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue