Merge branch 'master' into feature/product-custom-tables-supporting-changes
This commit is contained in:
commit
597033ca6f
|
@ -0,0 +1,33 @@
|
|||
### All Submissions:
|
||||
|
||||
* [ ] Have you followed the [WooCommerce Contributing guideline](https://github.com/woocommerce/woocommerce/blob/master/.github/CONTRIBUTING.md)?
|
||||
* [ ] Does your code follow the [WordPress' coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/)?
|
||||
* [ ] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change?
|
||||
|
||||
<!-- Mark completed items with an [x] -->
|
||||
|
||||
<!-- You can erase any parts of this template not applicable to your Pull Request. -->
|
||||
|
||||
### Changes proposed in this Pull Request:
|
||||
|
||||
<!-- Describe the changes made to this Pull Request, and the reason for such changes. -->
|
||||
|
||||
Closes # .
|
||||
|
||||
### How to test the changes in this Pull Request:
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
### Other information:
|
||||
|
||||
* [ ] Have you added an explanation of what your changes do and why you'd like us to include them?
|
||||
* [ ] Have you written new tests for your changes, as applicable?
|
||||
* [ ] Have you successfully ran tests with your changes locally?
|
||||
|
||||
<!-- Mark completed items with an [x] -->
|
||||
|
||||
### Changelog entry
|
||||
|
||||
> Enter a short summary of all changes on this Pull Request. This will appear in the changelog if accepted.
|
|
@ -1,5 +1,49 @@
|
|||
== Changelog ==
|
||||
|
||||
= 3.3.5 - 2018-04-10 =
|
||||
* Fix - Shop page notice should not appear when editing the "Hello World!" page.
|
||||
* Fix - Inconsistent order item refund sign.
|
||||
* Fix - Change `wc_get_price_excluding_tax` to not round the return value so calculations in admin are not pre-rounded.
|
||||
* Fix - Use minimum price instead of maximum price when ordering variable products from low to high on term archives.
|
||||
* Fix - `order` and `orderby` on shop page when using rewrite rules.
|
||||
* Fix - Ajax loading spinner when using twentyseventeen theme.
|
||||
* Fix - Out of Stock products change stock to On Backorder when imported to update existing products.
|
||||
* Fix - Visibility dropdown not responding in quick edit when stock management is disabled.
|
||||
* Fix - Featured paramenter in products endpoint on REST API.
|
||||
* Fix - Linebreaks in order item meta.
|
||||
* Fix - Product rating count when updated by admin.
|
||||
* Tweak - Define array before attempting to append to it.
|
||||
* Tweak - Change WC WP-CLI commands default per_page value to 100.
|
||||
* Tweak - Ensure background process class returns `data` as an array.
|
||||
* Tweak - Increase orders table checkbox column size on small devices.
|
||||
* Tweak - Better support for infinite scroll in Jetpack.
|
||||
|
||||
= 3.3.4 - 2018-03-20 =
|
||||
* Fix - Fixed undefined index after running setup wizard two times on fresh install.
|
||||
* Fix - wc_get_loop_class; force columns to be a minimum of 1.
|
||||
* Fix - Added loading spinner to WC panels in menu admin.
|
||||
* Fix - Use relative scheme for AJAX endpoint to avoid errors when using a mix of HTTP and HTTPS.
|
||||
* Fix - Fix SelectWoo templateSelection property.
|
||||
* Fix - Layered nav support on unsupported theme archives.
|
||||
* Fix - Prevent full refresh when editing store notice in the customizer.
|
||||
* Fix - Only append tax label in email content if taxes are enabled.
|
||||
* Fix - More reliable Jetpack detection.
|
||||
* Fix - Check if product has weight before calculate weight total in cart.
|
||||
* Fix - Correctly handle default ordering on the search page.
|
||||
* Fix - Fix default product category handling in installer.
|
||||
* Fix - Properly check slugs when updating attributes.
|
||||
* Fix - Use gallery thumbnail size for variation image switcher.
|
||||
* Fix - Clear subcategory cache when updating product categories.
|
||||
* Fix - Round fractional cents when out of base.
|
||||
* Fix - Inherit 'is variation' from existing attribute during csv import.
|
||||
* Fix - Set is_shortcode loop prop when outputting subcategories.
|
||||
* Fix - Reload gateways after updating the order.
|
||||
* Tweak - Use wc_get_default_products_per_row as the default for product shortcodes.
|
||||
* Tweak - Add post_excerpt to product search.
|
||||
* Tweak - Update the description of the user tracking notice in the onboarding wizard.
|
||||
* Tweak - Add extra data in order mobile view (status and date).
|
||||
* Tweak - Add profile link to order screen.
|
||||
|
||||
= 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.
|
||||
|
|
|
@ -1 +1 @@
|
|||
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;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #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;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #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:static;float:left;top:0;left:0;padding:0 28px 10px 15px;margin-top:-10px;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:relative;top:18px;right:-20px;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}div.woocommerce-message p:last-child{max-width:inherit}.woocommerce-message .button-primary,p.woocommerce-actions .button-primary{background:#bb77ae;border-color:#a36597;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #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;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #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:static;float:right;top:0;right:0;padding:0 15px 10px 28px;margin-top:-10px;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:relative;top:18px;left:-20px;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}
|
|
@ -35,17 +35,19 @@ p.woocommerce-actions,
|
|||
}
|
||||
|
||||
a.woocommerce-message-close {
|
||||
position: absolute;
|
||||
position: static;
|
||||
float: right;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 10px 15px 10px 21px;
|
||||
padding: 0px 15px 10px 28px;
|
||||
margin-top: -10px;
|
||||
font-size: 13px;
|
||||
line-height: 1.23076923;
|
||||
text-decoration: none;
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 0;
|
||||
position: relative;
|
||||
top: 18px;
|
||||
left: -20px;
|
||||
transition: all 0.1s ease-in-out;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -543,17 +543,17 @@
|
|||
}
|
||||
|
||||
a.woocommerce-message-close {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
padding: 10px 15px 10px 21px;
|
||||
position: static;
|
||||
float: right;
|
||||
padding: 0px 15px 10px 28px;
|
||||
margin-top: -10px;
|
||||
font-size: 13px;
|
||||
line-height: 1.23076923;
|
||||
text-decoration: none;
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 0;
|
||||
position: relative;
|
||||
top: 18px;
|
||||
left: -20px;
|
||||
transition: all 0.1s ease-in-out;
|
||||
}
|
||||
}
|
||||
|
@ -826,6 +826,11 @@ table.wc_status_table--tools {
|
|||
margin-left: 10px;
|
||||
}
|
||||
|
||||
label.stock_status_field {
|
||||
clear: both;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.dimensions div {
|
||||
display: block;
|
||||
margin: 0.2em 0;
|
||||
|
@ -2357,7 +2362,11 @@ ul.wc_coupon_list_block {
|
|||
}
|
||||
|
||||
.post-type-shop_order .wp-list-table {
|
||||
td.check-column {
|
||||
width: 1em;
|
||||
}
|
||||
td.column-order_number {
|
||||
padding-left: 0;
|
||||
padding-bottom: .5em;
|
||||
}
|
||||
td.column-order_status,
|
||||
|
@ -2368,6 +2377,9 @@ ul.wc_coupon_list_block {
|
|||
display: none !important;
|
||||
}
|
||||
}
|
||||
td.column-order_date {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
td.column-order_status {
|
||||
float: right;
|
||||
}
|
||||
|
@ -2627,37 +2639,6 @@ table.wp-list-table {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
span.product-type {
|
||||
@include ir();
|
||||
font-size: 1.6em;
|
||||
margin: 0 auto;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
|
||||
&::before {
|
||||
@include icon( '\e006' );
|
||||
}
|
||||
|
||||
&.grouped::before {
|
||||
content: '\e002';
|
||||
}
|
||||
|
||||
&.external::before {
|
||||
content: '\e034';
|
||||
}
|
||||
|
||||
&.variable::before {
|
||||
content: '\e003';
|
||||
}
|
||||
|
||||
&.downloadable::before {
|
||||
content: '\e001';
|
||||
}
|
||||
|
||||
&.virtual::before {
|
||||
content: '\e000';
|
||||
}
|
||||
}
|
||||
|
||||
mark {
|
||||
&.instock,
|
||||
&.outofstock,
|
||||
|
@ -2906,23 +2887,19 @@ table.wc_shipping {
|
|||
|
||||
th, td {
|
||||
display: table-cell !important;
|
||||
padding: 1em !important;
|
||||
vertical-align: top;
|
||||
line-height: 1.75em;
|
||||
}
|
||||
|
||||
td {
|
||||
&.wc_emails td {
|
||||
vertical-align: middle;
|
||||
padding: 7px;
|
||||
line-height: 2em;
|
||||
}
|
||||
|
||||
tr:nth-child( odd ) td {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
|
||||
th {
|
||||
padding: 9px 7px !important;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
td.name {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
@ -2944,16 +2921,10 @@ table.wc_shipping {
|
|||
margin: 0;
|
||||
}
|
||||
}
|
||||
th.sort {
|
||||
width: 28px;
|
||||
padding: 0;
|
||||
}
|
||||
td.sort {
|
||||
padding: 0 7px;
|
||||
cursor: move;
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
|
||||
&::before {
|
||||
content: '\f333';
|
||||
|
@ -2965,8 +2936,12 @@ table.wc_shipping {
|
|||
width: 17px;
|
||||
float: left;
|
||||
height: 100%;
|
||||
line-height: 24px;
|
||||
}
|
||||
}
|
||||
.wc-payment-gateway-method-name {
|
||||
display: block;
|
||||
}
|
||||
.wc-email-settings-table-name {
|
||||
font-weight: 700;
|
||||
span {
|
||||
|
@ -2982,18 +2957,6 @@ table.wc_shipping {
|
|||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
.wc-email-settings-table-actions a {
|
||||
@include ir();
|
||||
padding: 0 !important;
|
||||
height: 2em !important;
|
||||
width: 2em;
|
||||
|
||||
&::after {
|
||||
@include icon('\f111');
|
||||
font-family: 'Dashicons';
|
||||
line-height: 1.85;
|
||||
}
|
||||
}
|
||||
}
|
||||
.wc-shipping-zone-settings {
|
||||
th {
|
||||
|
@ -3083,9 +3046,6 @@ table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-class
|
|||
text-align: center;
|
||||
}
|
||||
}
|
||||
tbody td {
|
||||
padding: 1.5em 1em !important;
|
||||
}
|
||||
td.wc-shipping-zones-blank-state, td.wc-shipping-zone-method-blank-state {
|
||||
background: #f7f1f6 !important;
|
||||
overflow: hidden;
|
||||
|
@ -3322,6 +3282,8 @@ table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-class
|
|||
text-indent: -9999px;
|
||||
border-radius: 10em;
|
||||
position: relative;
|
||||
margin-top: -1px;
|
||||
vertical-align: text-top;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
|
@ -3514,12 +3476,16 @@ img.help_tip {
|
|||
margin: 0;
|
||||
padding: 6px;
|
||||
box-sizing: border-box;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
select {
|
||||
width: 400px;
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
input[size] {
|
||||
|
@ -3561,6 +3527,11 @@ img.help_tip {
|
|||
padding-right: 24px;
|
||||
}
|
||||
|
||||
th label {
|
||||
position: relative;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.select2-container {
|
||||
vertical-align: top;
|
||||
margin-bottom: 3px;
|
||||
|
@ -3572,8 +3543,10 @@ img.help_tip {
|
|||
|
||||
th img.help_tip,
|
||||
th .woocommerce-help-tip {
|
||||
margin: 2px -24px 0 0;
|
||||
float: right;
|
||||
margin: -8px -24px 0 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
.wp-list-table .woocommerce-help-tip {
|
||||
|
@ -3649,6 +3622,7 @@ img.help_tip {
|
|||
}
|
||||
}
|
||||
|
||||
.wc_payment_gateways_wrapper,
|
||||
.wc_emails_wrapper {
|
||||
padding: 0 15px 10px 0;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,35 @@
|
|||
/**
|
||||
* WooCommerce Photoswipe styles.
|
||||
* 1. These styles are required to overwrite default theme button styles (Twenty Twelve adds gradients via background-image).
|
||||
* 2. For zooming on mobile.
|
||||
*/
|
||||
.woocommerce img.pswp__img,
|
||||
.woocommerce-page img.pswp__img {
|
||||
max-width: none; /* 2 */
|
||||
}
|
||||
button.pswp__button {
|
||||
box-shadow: none !important;
|
||||
background-image: url('default-skin/default-skin.png') !important;
|
||||
}
|
||||
button.pswp__button,
|
||||
button.pswp__button:hover,
|
||||
button.pswp__button--arrow--left::before,
|
||||
button.pswp__button--arrow--right::before {
|
||||
background-color: transparent !important; /* 1 */
|
||||
}
|
||||
button.pswp__button--arrow--left,
|
||||
button.pswp__button--arrow--right,
|
||||
button.pswp__button--arrow--left:hover,
|
||||
button.pswp__button--arrow--right:hover {
|
||||
background-image: none !important; /* 1 */
|
||||
}
|
||||
button.pswp__button--close:hover {
|
||||
background-position: 0 -44px;
|
||||
}
|
||||
button.pswp__button--zoom:hover {
|
||||
background-position: -88px 0;
|
||||
}
|
||||
|
||||
/*! PhotoSwipe main CSS by Dmitry Semenov | photoswipe.com | MIT license */
|
||||
/*
|
||||
Styles for basic PhotoSwipe functionality (sliding area, open/close transitions)
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -139,12 +139,18 @@
|
|||
|
||||
.required {
|
||||
color: firebrick;
|
||||
text-decoration: none;
|
||||
visibility: hidden; // Only show optional by default.
|
||||
|
||||
&[title] {
|
||||
border-bottom: none;
|
||||
border: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.optional {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.woocommerce-message,
|
||||
.woocommerce-error,
|
||||
.woocommerce-info {
|
||||
|
@ -564,30 +570,6 @@ table.variations {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Photoswipe
|
||||
* 1. These styles are required to overwrite default theme button styles (Twenty Twelve adds gradients via background-image).
|
||||
*/
|
||||
|
||||
button.pswp__button,
|
||||
button.pswp__button:hover,
|
||||
button.pswp__button--arrow--left::before,
|
||||
button.pswp__button--arrow--right::before {
|
||||
background-color: transparent !important; /* 1 */
|
||||
}
|
||||
|
||||
button.pswp__button--close:hover {
|
||||
background-position: 0 -44px;
|
||||
}
|
||||
|
||||
button.pswp__button--zoom:hover {
|
||||
background-position: -88px 0;
|
||||
}
|
||||
|
||||
.pswp img {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Widgets
|
||||
*/
|
||||
|
@ -936,7 +918,59 @@ button.pswp__button--zoom:hover {
|
|||
background: rgba(0,0,0,.05);
|
||||
}
|
||||
|
||||
.woocommerce-terms-and-conditions-link {
|
||||
display: inline-block;
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
border-style: solid;
|
||||
margin-bottom: 2px;
|
||||
margin-left: .25em;
|
||||
border-width: 6px 6px 0 6px;
|
||||
border-color: #111 transparent transparent transparent;
|
||||
}
|
||||
&.woocommerce-terms-and-conditions-link--open:after {
|
||||
border-width: 0 6px 6px 6px;
|
||||
border-color: transparent transparent #111 transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.woocommerce-checkout {
|
||||
.woocommerce-input-wrapper {
|
||||
.description {
|
||||
background: royalblue;
|
||||
color: #fff;
|
||||
border-radius: 3px;
|
||||
padding: 1em;
|
||||
margin: .5em 0 0;
|
||||
clear: both;
|
||||
display: none;
|
||||
position: relative;
|
||||
|
||||
a {
|
||||
color: #fff;
|
||||
text-decoration: underline;
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: 50%;
|
||||
top: 0%;
|
||||
margin-top: -4px;
|
||||
transform: translatex(-50%) rotate(180deg);
|
||||
content: "";
|
||||
position: absolute;
|
||||
border-width: 4px 6px 0 6px;
|
||||
border-style: solid;
|
||||
border-color: royalblue transparent transparent transparent;
|
||||
z-index: 100;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.select2-choice,
|
||||
.select2-choice:hover {
|
||||
box-shadow: none !important;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -15,6 +15,13 @@ body {
|
|||
}
|
||||
.wc-setup {
|
||||
text-align: center;
|
||||
|
||||
.select2-container {
|
||||
text-align: left;
|
||||
}
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.wc-setup-content {
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
|
||||
|
@ -484,7 +491,7 @@ body {
|
|||
|
||||
.wc-setup-footer-links {
|
||||
font-size: 0.85em;
|
||||
color: #b5b5b5;
|
||||
color: #7b7b7b;
|
||||
margin: 1.18em auto;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
|
@ -627,6 +634,14 @@ body {
|
|||
}
|
||||
}
|
||||
|
||||
&.eway-logo .wc-wizard-service-name img {
|
||||
max-width: 87px;
|
||||
}
|
||||
|
||||
&.payfast-logo .wc-wizard-service-name img {
|
||||
max-width: 140px;
|
||||
}
|
||||
|
||||
.wc-wizard-service-description {
|
||||
flex-grow: 1;
|
||||
padding: 20px;
|
||||
|
@ -966,8 +981,6 @@ h3.jetpack-reasons {
|
|||
}
|
||||
|
||||
.store-address-container {
|
||||
margin-top: 4px;
|
||||
|
||||
.city-and-postcode {
|
||||
display: flex;
|
||||
|
||||
|
@ -980,9 +993,11 @@ h3.jetpack-reasons {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.store-currency-container {
|
||||
margin-top: 10px;
|
||||
input[type="text"],
|
||||
select,
|
||||
.select2-container {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
.product-type-container {
|
||||
margin-top: 14px;
|
||||
|
@ -1193,3 +1208,64 @@ p.jetpack-terms {
|
|||
margin-left: 1.5em;
|
||||
}
|
||||
}
|
||||
|
||||
.recommended-step {
|
||||
border: 1px solid #ebebeb;
|
||||
border-radius: 4px;
|
||||
padding: 2.5em;
|
||||
|
||||
li {
|
||||
list-style: none;
|
||||
|
||||
&:last-child .recommended-item {
|
||||
margin-bottom: 0; // Avoid extra space at the end of the list.
|
||||
}
|
||||
}
|
||||
|
||||
.recommended-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
.recommended-item-icon {
|
||||
border: 1px solid #fff;
|
||||
border-radius: 7px;
|
||||
height: 3.5em;
|
||||
margin-right: 1em;
|
||||
margin-left: 1em;
|
||||
|
||||
&.recommended-item-icon-storefront_theme {
|
||||
background-color: #f4a224;
|
||||
max-height: 3em;
|
||||
max-width: 3em;
|
||||
padding: ( 3.5em - 3em ) / 2;
|
||||
}
|
||||
|
||||
&.recommended-item-icon-automated_taxes {
|
||||
background-color: #d0011b;
|
||||
max-height: 1.75em;
|
||||
padding: ( 3.5em - 1.75em ) / 2;
|
||||
}
|
||||
|
||||
&.recommended-item-icon-mailchimp {
|
||||
background-color: #209bbb;
|
||||
height: 2em;
|
||||
padding: ( 3.5em - 2em ) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
.recommended-item-description-container {
|
||||
h3 {
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
letter-spacing: 0.5px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1276,6 +1276,40 @@ p.demo_store,
|
|||
display: inline;
|
||||
}
|
||||
|
||||
.woocommerce-input-wrapper {
|
||||
.description {
|
||||
background: #1e85be;
|
||||
color: #fff;
|
||||
border-radius: 3px;
|
||||
padding: 1em;
|
||||
margin: .5em 0 0;
|
||||
clear: both;
|
||||
display: none;
|
||||
position: relative;
|
||||
|
||||
a {
|
||||
color: #fff;
|
||||
text-decoration: underline;
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: 50%;
|
||||
top: 0%;
|
||||
margin-top: -4px;
|
||||
transform: translatex(-50%) rotate(180deg);
|
||||
content: "";
|
||||
position: absolute;
|
||||
border-width: 4px 6px 0 6px;
|
||||
border-style: solid;
|
||||
border-color: #1e85be transparent transparent transparent;
|
||||
z-index: 100;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
|
@ -1284,9 +1318,15 @@ p.demo_store,
|
|||
.required {
|
||||
color: red;
|
||||
font-weight: 700;
|
||||
border: 0;
|
||||
border: 0 !important;
|
||||
text-decoration: none;
|
||||
visibility: hidden; // Only show optional by default.
|
||||
}
|
||||
|
||||
.optional {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.input-checkbox {
|
||||
display: inline;
|
||||
margin: -2px 8px 0 0;
|
||||
|
@ -1633,47 +1673,6 @@ p.demo_store,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Photoswipe
|
||||
* 1. These styles are required to overwrite default theme button styles (Twenty Twelve adds gradients via background-image).
|
||||
* 2. For zooming on mobile.
|
||||
*/
|
||||
.pswp {
|
||||
z-index: 999999;
|
||||
}
|
||||
|
||||
.woocommerce img.pswp__img,
|
||||
.woocommerce-page img.pswp__img {
|
||||
max-width: none; /* 2 */
|
||||
}
|
||||
|
||||
button.pswp__button {
|
||||
box-shadow: none !important;
|
||||
background-image: url('photoswipe/default-skin/default-skin.png') !important;
|
||||
}
|
||||
|
||||
button.pswp__button,
|
||||
button.pswp__button:hover,
|
||||
button.pswp__button--arrow--left::before,
|
||||
button.pswp__button--arrow--right::before {
|
||||
background-color: transparent !important; /* 1 */
|
||||
}
|
||||
|
||||
button.pswp__button--arrow--left,
|
||||
button.pswp__button--arrow--right,
|
||||
button.pswp__button--arrow--left:hover,
|
||||
button.pswp__button--arrow--right:hover {
|
||||
background-image: none !important; /* 1 */
|
||||
}
|
||||
|
||||
button.pswp__button--close:hover {
|
||||
background-position: 0 -44px;
|
||||
}
|
||||
|
||||
button.pswp__button--zoom:hover {
|
||||
background-position: -88px 0;
|
||||
}
|
||||
|
||||
.woocommerce-message,
|
||||
.woocommerce-error,
|
||||
.woocommerce-info {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 7.0 KiB |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 367 300"><path fill="#FFF" d="M251 135.1c-6.4 4.9-14.4 7.8-23 7.8-8.9 0-17-3.1-23.5-8.1-6.5 5.1-14.6 8.1-23.5 8.1s-17.1-3.1-23.6-8.2c-6.5 5.1-14.7 8.2-23.6 8.2-8.9 0-17-3.1-23.5-8.1-6.5 5.1-14.6 8.1-23.5 8.1-2 0-4-.2-6-.5v73.4c0 6.3 5.7 12 12 12h54.8c6.3 0 10.9-5.7 10.9-12V185.1c6.9 2.2 14.1 3.5 22.8 3.5s17.1-1.3 22.8-3.5V215.8c0 6.3 5.7 12 12 12h54.8c6.3 0 10.9-5.7 10.9-12V142c-2.6.6-5.3.9-8 .9-8.4-.1-16.4-3-22.8-7.8zm-115.5 49.8c0 5-4.1 9.1-9.1 9.1h-14.1c-5 0-9.1-4.1-9.1-9.1v-14.1c0-5 4.1-9.1 9.1-9.1h14.1c5 0 9.1 4.1 9.1 9.1v14.1zm123.3 0c0 5-4.1 9.1-9.1 9.1h-14.1c-5 0-9.1-4.1-9.1-9.1v-14.1c0-5 4.1-9.1 9.1-9.1h14.1c5 0 9.1 4.1 9.1 9.1v14.1zM294.9 99.9l-30.1-30.1c-3.9-3.9-11.6-7.1-17.1-7.1H113.3c-5.5 0-13.2 3.2-17.1 7.1L66.1 99.9l-7 7c.9 12.5 10 22.7 21.9 25.3h.1c.4.1.9.2 1.3.3h.1c.4.1.8.1 1.3.2h.2c.4 0 .8.1 1.2.1H87c.7 0 1.4 0 2-.1.2 0 .4 0 .6-.1.5 0 .9-.1 1.4-.2.2 0 .5-.1.7-.1.4-.1.8-.1 1.2-.2.2-.1.5-.1.7-.2l1.2-.3c.2-.1.4-.1.6-.2.5-.2 1-.3 1.5-.5.1 0 .2-.1.4-.1.6-.2 1.2-.5 1.7-.8.2-.1.4-.2.5-.3.4-.2.8-.4 1.1-.6.2-.1.4-.3.7-.4l.9-.6c.1-.1.2-.1.3-.2 3.1-2.1 5.7-4.8 7.7-7.9 5 7.7 13.6 12.7 23.5 12.7s18.6-5.1 23.6-12.9c2 3.2 4.7 5.9 7.8 8.1.5.4 1.1.7 1.6 1 .1.1.2.1.3.2 1.1.6 2.2 1.2 3.4 1.6.1 0 .2.1.3.1l1.8.6c.6.2 1.2.3 1.8.5.1 0 .3.1.4.1.6.1 1.2.3 1.8.4.6.1 1.3.2 1.9.2h.5c.6 0 1.3.1 1.9.1s1.3 0 1.9-.1h.5c.6-.1 1.3-.1 1.9-.2.6-.1 1.2-.2 1.8-.4.1 0 .3-.1.4-.1.6-.1 1.2-.3 1.8-.5l1.8-.6c.1 0 .2-.1.3-.1 1.2-.5 2.3-1 3.4-1.6.1-.1.2-.1.3-.2.5-.3 1.1-.7 1.6-1 3.1-2.1 5.7-4.8 7.7-7.9 5 7.7 13.6 12.7 23.5 12.7 9.5 0 18-4.8 23-12.1 2 2.8 4.4 5.3 7.3 7.2.5.4 1.1.7 1.6 1 .1.1.2.1.3.2 1.1.6 2.2 1.2 3.4 1.6.1 0 .2.1.3.1l1.8.6c.6.2 1.2.3 1.8.5.1 0 .3.1.4.1.6.1 1.2.3 1.8.4.6.1 1.3.2 1.9.2h.5c.6 0 1.3.1 1.9.1.6 0 1.2 0 1.9-.1h.4c.6 0 1.2-.1 1.7-.2h.1c.6-.1 1.3-.2 1.9-.4h.1c11.9-2.7 20.9-12.8 21.8-25.3l-6.7-6.7zM150 107c-.1 8.8-7.3 15.9-16.1 15.9s-16-7.1-16.1-15.9l15-37h25l-7.8 37zm77.8 15.9c-8.8 0-16-7.1-16.1-15.9l-7.8-37h25l15 37c-.1 8.8-7.3 15.9-16.1 15.9z"/></svg>
|
After Width: | Height: | Size: 2.0 KiB |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="266 396.70001220703125 25.5 23.5999755859375"><path fill="#FFF" d="M266 402.5c0-3.5 2.2-5.8 5.5-5.8s5.5 2.3 5.5 5.8-2.2 5.8-5.5 5.8-5.5-2.3-5.5-5.8zm2.9 17.3l8.5-11.8 6.2-10.7h5.2l-8.6 11.9-6 10.7h-5.3zm4.1-17.3c0-1.6-.5-2.5-1.5-2.5s-1.5.9-1.5 2.5c0 1.5.6 2.5 1.5 2.5.9-.1 1.5-1 1.5-2.5zm7.5 12c0-3.5 2.2-5.8 5.5-5.8s5.5 2.3 5.5 5.8-2.2 5.8-5.5 5.8-5.5-2.3-5.5-5.8zm7 0c0-1.6-.6-2.5-1.5-2.5s-1.5.9-1.5 2.5c0 1.5.6 2.5 1.5 2.5.9-.1 1.5-1 1.5-2.5z"/></svg>
|
After Width: | Height: | Size: 504 B |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -1,5 +1,6 @@
|
|||
/*global wc_setup_params */
|
||||
/*global wc_setup_currencies */
|
||||
/*global wc_base_state */
|
||||
jQuery( function( $ ) {
|
||||
function blockWizardUI() {
|
||||
$('.wc-setup-content').block({
|
||||
|
@ -21,6 +22,35 @@ jQuery( function( $ ) {
|
|||
return true;
|
||||
} );
|
||||
|
||||
$( '#store_country' ).on( 'change', function() {
|
||||
// Prevent if we don't have the metabox data
|
||||
if ( wc_setup_params.states === null ){
|
||||
return;
|
||||
}
|
||||
|
||||
var $this = $( this ),
|
||||
country = $this.val(),
|
||||
$state_select = $( '#store_state' );
|
||||
|
||||
if ( ! $.isEmptyObject( wc_setup_params.states[ country ] ) ) {
|
||||
var states = wc_setup_params.states[ country ];
|
||||
|
||||
$state_select.empty();
|
||||
|
||||
$.each( states, function( index ) {
|
||||
$state_select.append( $( '<option value="' + index + '">' + states[ index ] + '</option>' ) );
|
||||
} );
|
||||
|
||||
$( '.store-state-container' ).show();
|
||||
$state_select.selectWoo().val( wc_base_state ).change().prop( 'required', true );
|
||||
} else {
|
||||
$( '.store-state-container' ).hide();
|
||||
$state_select.empty().val( '' ).change().prop( 'required', false );
|
||||
}
|
||||
} );
|
||||
|
||||
$( '#store_country' ).change();
|
||||
|
||||
$( '.wc-wizard-services' ).on( 'change', '.wc-wizard-service-enable input', function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( this ).closest( '.wc-wizard-service-toggle' ).removeClass( 'disabled' );
|
||||
|
@ -142,8 +172,8 @@ jQuery( function( $ ) {
|
|||
}
|
||||
} ).find( 'input#stripe_create_account, input#ppec_paypal_reroute_requests' ).change();
|
||||
|
||||
$( 'select#store_country_state' ).on( 'change', function() {
|
||||
var countryCode = this.value.split( ':' )[ 0 ];
|
||||
$( 'select#store_country' ).on( 'change', function() {
|
||||
var countryCode = $( this ).val();
|
||||
$( 'select#currency_code' ).val( wc_setup_currencies[ countryCode ] ).change();
|
||||
} );
|
||||
} );
|
||||
|
|
|
@ -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("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()})});
|
||||
jQuery(function(e){function i(){e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}function t(){e("form.activate-jetpack").submit()}function s(){wp.ajax.post("setup_wizard_check_jetpack").then(function(e){if(!e||!e.is_active||"yes"===e.is_active)return t();setTimeout(s,3e3)}).fail(function(){t()})}e(".button-next").on("click",function(){var t=e(this).parents("form").get(0);return("function"!=typeof t.checkValidity||t.checkValidity())&&i(),!0}),e("#store_country").on("change",function(){if(null!==wc_setup_params.states){var i=e(this).val(),t=e("#store_state");if(e.isEmptyObject(wc_setup_params.states[i]))e(".store-state-container").hide(),t.empty().val("").change().prop("required",!1);else{var s=wc_setup_params.states[i];t.empty(),e.each(s,function(i){t.append(e('<option value="'+i+'">'+s[i]+"</option>"))}),e(".store-state-container").show(),t.selectWoo().val(wc_base_state).change().prop("required",!0)}}}),e("#store_country").change(),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 t=e(this).find('input[type="checkbox"]');t.prop("checked",!t.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 t=e(this).closest(".wc-wizard-service-description"),s=i.target.value,c=t.find(".shipping-method-descriptions");c.find(".shipping-method-description").addClass("hide"),c.find("."+s).removeClass("hide");var r=t.find(".shipping-method-settings");r.find(".shipping-method-setting").addClass("hide").find(".shipping-method-required-field").prop("required",!1),r.find("."+s).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(),s()}),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").on("change",function(){var i=e(this).val();e("select#currency_code").val(wc_setup_currencies[i]).change()})});
|
|
@ -11,8 +11,12 @@ jQuery( function ( $ ) {
|
|||
$blankslate = $product_screen.find( '.woocommerce-BlankState' );
|
||||
|
||||
if ( 0 === $blankslate.length ) {
|
||||
$title_action.after( '<a href="' + woocommerce_admin.urls.export_products + '" class="page-title-action">' + woocommerce_admin.strings.export_products + '</a>' );
|
||||
$title_action.after( '<a href="' + woocommerce_admin.urls.import_products + '" class="page-title-action">' + woocommerce_admin.strings.import_products + '</a>' );
|
||||
if ( woocommerce_admin.urls.export_products ) {
|
||||
$title_action.after('<a href="' + woocommerce_admin.urls.export_products + '" class="page-title-action">' + woocommerce_admin.strings.export_products + '</a>');
|
||||
}
|
||||
if ( woocommerce_admin.urls.import_products ) {
|
||||
$title_action.after( '<a href="' + woocommerce_admin.urls.import_products + '" class="page-title-action">' + woocommerce_admin.strings.import_products + '</a>' );
|
||||
}
|
||||
} else {
|
||||
$title_action.hide();
|
||||
}
|
||||
|
@ -293,4 +297,50 @@ jQuery( function ( $ ) {
|
|||
|
||||
// Attribute term table
|
||||
$( 'table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
||||
|
||||
|
||||
// Toggle gateway on/off.
|
||||
$( '.wc_gateways' ).on( 'click', '.wc-payment-gateway-method-toggle-enabled', function() {
|
||||
var $link = $( this ),
|
||||
$row = $link.closest( 'tr' ),
|
||||
$table = $row.closest( 'div' ),
|
||||
$toggle = $link.find( '.woocommerce-input-toggle' );
|
||||
|
||||
var data = {
|
||||
action: 'woocommerce_toggle_gateway_enabled',
|
||||
security: woocommerce_admin.nonces.gateway_toggle,
|
||||
gateway_id: $row.data( 'gateway_id' )
|
||||
};
|
||||
|
||||
$table.block({
|
||||
message: null,
|
||||
overlayCSS: {
|
||||
background: '#fff',
|
||||
opacity: 0.6
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax( {
|
||||
url: woocommerce_admin.ajax_url,
|
||||
data: data,
|
||||
dataType : 'json',
|
||||
type : 'POST',
|
||||
success: function( response ) {
|
||||
if ( true === response.data ) {
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled' );
|
||||
$toggle.addClass( 'woocommerce-input-toggle--enabled' );
|
||||
} else if ( false === response.data ) {
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled' );
|
||||
$toggle.addClass( 'woocommerce-input-toggle--disabled' );
|
||||
} else if ( 'needs_setup' === response.data ) {
|
||||
window.location.href = $link.attr( 'href' );
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$table.unblock();
|
||||
}
|
||||
} );
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,17 +9,23 @@ jQuery( function( $ ) {
|
|||
var locale_json = wc_address_i18n_params.locale.replace( /"/g, '"' ),
|
||||
locale = $.parseJSON( locale_json );
|
||||
|
||||
function field_is_required( field, is_required ) {
|
||||
if ( is_required ) {
|
||||
if ( field.find( 'label abbr.required' ).length === 0 ) {
|
||||
field.find( 'label' ).append( ' <abbr class="required" title="' + wc_address_i18n_params.i18n_required_text + '">*</abbr>' );
|
||||
function field_is_required( field, is_required ) {
|
||||
if ( is_required ) {
|
||||
field.find( 'label .optional' ).remove();
|
||||
field.addClass( 'validate-required' );
|
||||
|
||||
if ( field.find( 'label .required' ).length === 0 ) {
|
||||
field.find( 'label' ).append( ' <abbr class="required" title="' + wc_address_i18n_params.i18n_required_text + '">*</abbr>' );
|
||||
}
|
||||
} else {
|
||||
field.find( 'label .required' ).remove();
|
||||
field.removeClass( 'validate-required' );
|
||||
|
||||
if ( field.find( 'label .required' ).length === 0 ) {
|
||||
field.find( 'label' ).append( ' <span class="optional">(' + wc_address_i18n_params.i18n_optional_text + ')</span>' );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
field.find( 'label abbr' ).remove();
|
||||
field.removeClass( 'validate-required' );
|
||||
}
|
||||
}
|
||||
|
||||
$( document.body )
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(e){function a(e,a){a?0===e.find("label abbr.required").length&&(e.find("label").append(' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>'),e.addClass("validate-required")):(e.find("label abbr").remove(),e.removeClass("validate-required"))}if("undefined"==typeof wc_address_i18n_params)return!1;var i=wc_address_i18n_params.locale.replace(/"/g,'"'),d=e.parseJSON(i);e(document.body).bind("country_to_state_changing",function(i,t,r){var l,n=r;l="undefined"!=typeof d[t]?d[t]:d["default"];var o=n.find("#billing_postcode_field, #shipping_postcode_field"),s=n.find("#billing_city_field, #shipping_city_field"),f=n.find("#billing_state_field, #shipping_state_field");o.attr("data-o_class")||(o.attr("data-o_class",o.attr("class")),s.attr("data-o_class",s.attr("class")),f.attr("data-o_class",f.attr("class")));var p=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(p,function(i,t){var r=n.find(t),o=e.extend(!0,{},d["default"][i],l[i]);"undefined"!=typeof o.label&&r.find("label").html(o.label),"undefined"!=typeof o.placeholder&&(r.find("input").attr("placeholder",o.placeholder),r.find(".select2-selection__placeholder").text(o.placeholder)),"undefined"!=typeof o.placeholder||"undefined"==typeof o.label||r.find("label").length||(r.find("input").attr("placeholder",o.label),r.find(".select2-selection__placeholder").text(o.label)),"undefined"!=typeof o.required?a(r,o.required):a(r,!1),"undefined"!=typeof o.priority&&r.data("priority",o.priority),"state"!==i&&("undefined"!=typeof o.hidden&&!0===o.hidden?r.hide().find("input").val(""):r.show())}),e(".woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper, .woocommerce-address-fields__field-wrapper, .woocommerce-additional-fields__field-wrapper .woocommerce-account-fields").each(function(a,i){var d=e(i).find(".form-row"),t=d.first().parent(),r=0;d.each(function(){e(this).data("priority")||e(this).data("priority",r+1),r=e(this).data("priority")}),d.sort(function(a,i){var d=e(a).data("priority"),t=e(i).data("priority");return d>t?1:d<t?-1:0}),d.detach().appendTo(t)})})});
|
||||
jQuery(function(e){function a(e,a){a?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append(' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>')):(e.find("label .required").remove(),e.removeClass("validate-required"),0===e.find("label .required").length&&e.find("label").append(' <span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}if("undefined"==typeof wc_address_i18n_params)return!1;var i=wc_address_i18n_params.locale.replace(/"/g,'"'),d=e.parseJSON(i);e(document.body).bind("country_to_state_changing",function(i,t,r){var l,n=r;l="undefined"!=typeof d[t]?d[t]:d["default"];var o=n.find("#billing_postcode_field, #shipping_postcode_field"),s=n.find("#billing_city_field, #shipping_city_field"),p=n.find("#billing_state_field, #shipping_state_field");o.attr("data-o_class")||(o.attr("data-o_class",o.attr("class")),s.attr("data-o_class",s.attr("class")),p.attr("data-o_class",p.attr("class")));var f=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(f,function(i,t){var r=n.find(t),o=e.extend(!0,{},d["default"][i],l[i]);"undefined"!=typeof o.label&&r.find("label").html(o.label),"undefined"!=typeof o.placeholder&&(r.find("input").attr("placeholder",o.placeholder),r.find(".select2-selection__placeholder").text(o.placeholder)),"undefined"!=typeof o.placeholder||"undefined"==typeof o.label||r.find("label").length||(r.find("input").attr("placeholder",o.label),r.find(".select2-selection__placeholder").text(o.label)),"undefined"!=typeof o.required?a(r,o.required):a(r,!1),"undefined"!=typeof o.priority&&r.data("priority",o.priority),"state"!==i&&("undefined"!=typeof o.hidden&&!0===o.hidden?r.hide().find("input").val(""):r.show())}),e(".woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper, .woocommerce-address-fields__field-wrapper, .woocommerce-additional-fields__field-wrapper .woocommerce-account-fields").each(function(a,i){var d=e(i).find(".form-row"),t=d.first().parent(),r=0;d.each(function(){e(this).data("priority")||e(this).data("priority",r+1),r=e(this).data("priority")}),d.sort(function(a,i){var d=e(a).data("priority"),t=e(i).data("priority");return d>t?1:d<t?-1:0}),d.detach().appendTo(t)})})});
|
|
@ -329,6 +329,7 @@ jQuery( function( $ ) {
|
|||
complete: function() {
|
||||
unblock( $form );
|
||||
unblock( $( 'div.cart_totals' ) );
|
||||
$.scroll_to_notices( $( '[role="alert"]' ) );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
@ -512,6 +513,7 @@ jQuery( function( $ ) {
|
|||
complete: function() {
|
||||
unblock( $form );
|
||||
unblock( $( 'div.cart_totals' ) );
|
||||
$.scroll_to_notices( $( '[role="alert"]' ) );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
@ -540,6 +542,7 @@ jQuery( function( $ ) {
|
|||
complete: function() {
|
||||
unblock( $form );
|
||||
unblock( $( 'div.cart_totals' ) );
|
||||
$.scroll_to_notices( $( '[role="alert"]' ) );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -512,24 +512,12 @@ jQuery( function( $ ) {
|
|||
$( document.body ).trigger( 'checkout_error' );
|
||||
},
|
||||
scroll_to_notices: function() {
|
||||
var scrollElement = $( '.woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout' ),
|
||||
isSmoothScrollSupported = 'scrollBehavior' in document.documentElement.style;
|
||||
var scrollElement = $( '.woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout' );
|
||||
|
||||
if ( ! scrollElement.length ) {
|
||||
scrollElement = $( '.form.checkout' );
|
||||
}
|
||||
|
||||
if ( scrollElement.length ) {
|
||||
if ( isSmoothScrollSupported ) {
|
||||
scrollElement[0].scrollIntoView({
|
||||
behavior: 'smooth'
|
||||
});
|
||||
} else {
|
||||
$( 'html, body' ).animate( {
|
||||
scrollTop: ( scrollElement.offset().top - 100 )
|
||||
}, 1000 );
|
||||
}
|
||||
}
|
||||
$.scroll_to_notices( scrollElement );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -649,7 +637,18 @@ jQuery( function( $ ) {
|
|||
|
||||
toggle_terms: function() {
|
||||
if ( $( '.woocommerce-terms-and-conditions' ).length ) {
|
||||
$( '.woocommerce-terms-and-conditions' ).slideToggle();
|
||||
$( '.woocommerce-terms-and-conditions' ).slideToggle( function() {
|
||||
var link_toggle = $( '.woocommerce-terms-and-conditions-link' );
|
||||
|
||||
if ( $( '.woocommerce-terms-and-conditions' ).is( ':visible' ) ) {
|
||||
link_toggle.addClass( 'woocommerce-terms-and-conditions-link--open' );
|
||||
link_toggle.removeClass( 'woocommerce-terms-and-conditions-link--closed' );
|
||||
} else {
|
||||
link_toggle.removeClass( 'woocommerce-terms-and-conditions-link--open' );
|
||||
link_toggle.addClass( 'woocommerce-terms-and-conditions-link--closed' );
|
||||
}
|
||||
} );
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -240,17 +240,20 @@ jQuery( function( $ ) {
|
|||
|
||||
if ( $slides.length > 0 ) {
|
||||
$slides.each( function( i, el ) {
|
||||
var img = $( el ).find( 'img' ),
|
||||
large_image_src = img.attr( 'data-large_image' ),
|
||||
large_image_w = img.attr( 'data-large_image_width' ),
|
||||
large_image_h = img.attr( 'data-large_image_height' ),
|
||||
item = {
|
||||
src : large_image_src,
|
||||
w : large_image_w,
|
||||
h : large_image_h,
|
||||
title: img.attr( 'data-caption' ) ? img.attr( 'data-caption' ) : img.attr( 'title' )
|
||||
};
|
||||
items.push( item );
|
||||
var img = $( el ).find( 'img' );
|
||||
|
||||
if ( img.length ) {
|
||||
var large_image_src = img.attr( 'data-large_image' ),
|
||||
large_image_w = img.attr( 'data-large_image_width' ),
|
||||
large_image_h = img.attr( 'data-large_image_height' ),
|
||||
item = {
|
||||
src : large_image_src,
|
||||
w : large_image_w,
|
||||
h : large_image_h,
|
||||
title: img.attr( 'data-caption' ) ? img.attr( 'data-caption' ) : img.attr( 'title' )
|
||||
};
|
||||
items.push( item );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -15,15 +15,69 @@ jQuery( function( $ ) {
|
|||
});
|
||||
|
||||
// Set a cookie and hide the store notice when the dismiss button is clicked
|
||||
jQuery( '.woocommerce-store-notice__dismiss-link' ).click( function() {
|
||||
$( '.woocommerce-store-notice__dismiss-link' ).click( function() {
|
||||
Cookies.set( 'store_notice', 'hidden', { path: '/' } );
|
||||
jQuery( '.woocommerce-store-notice' ).hide();
|
||||
$( '.woocommerce-store-notice' ).hide();
|
||||
});
|
||||
|
||||
// Check the value of that cookie and show/hide the notice accordingly
|
||||
if ( 'hidden' === Cookies.get( 'store_notice' ) ) {
|
||||
jQuery( '.woocommerce-store-notice' ).hide();
|
||||
$( '.woocommerce-store-notice' ).hide();
|
||||
} else {
|
||||
jQuery( '.woocommerce-store-notice' ).show();
|
||||
$( '.woocommerce-store-notice' ).show();
|
||||
}
|
||||
|
||||
// Make form field descriptions toggle on focus.
|
||||
$( document.body ).on( 'click', function() {
|
||||
$( '.woocommerce-input-wrapper span.description:visible' ).prop( 'aria-hidden', true ).slideUp( 250 );
|
||||
} );
|
||||
|
||||
$( '.woocommerce-input-wrapper' ).on( 'click', function( event ) {
|
||||
event.stopPropagation();
|
||||
} );
|
||||
|
||||
$( '.woocommerce-input-wrapper :input' )
|
||||
.on( 'keydown', function( event ) {
|
||||
var input = $( this ),
|
||||
parent = input.parent(),
|
||||
description = parent.find( 'span.description' );
|
||||
|
||||
if ( 27 === event.which && description.length && description.is( ':visible' ) ) {
|
||||
description.prop( 'aria-hidden', true ).slideUp( 250 );
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
} )
|
||||
.on( 'focus', function() {
|
||||
var input = $( this ),
|
||||
parent = input.parent(),
|
||||
description = parent.find( 'span.description' );
|
||||
|
||||
parent.addClass( 'currentTarget' );
|
||||
|
||||
$( '.woocommerce-input-wrapper:not(.currentTarget) span.description:visible' ).prop( 'aria-hidden', true ).slideUp( 250 );
|
||||
|
||||
if ( description.length && description.is( ':hidden' ) ) {
|
||||
description.prop( 'aria-hidden', false ).slideDown( 250 );
|
||||
}
|
||||
|
||||
parent.removeClass( 'currentTarget' );
|
||||
} );
|
||||
|
||||
// Common scroll to element code.
|
||||
$.scroll_to_notices = function( scrollElement ) {
|
||||
var isSmoothScrollSupported = 'scrollBehavior' in document.documentElement.style;
|
||||
|
||||
if ( scrollElement.length ) {
|
||||
if ( isSmoothScrollSupported ) {
|
||||
scrollElement[0].scrollIntoView({
|
||||
behavior: 'smooth'
|
||||
});
|
||||
} else {
|
||||
$( 'html, body' ).animate( {
|
||||
scrollTop: ( scrollElement.offset().top - 100 )
|
||||
}, 1000 );
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(o){o(".woocommerce-ordering").on("change","select.orderby",function(){o(this).closest("form").submit()}),o("input.qty:not(.product-quantity input.qty)").each(function(){var e=parseFloat(o(this).attr("min"));e>=0&&parseFloat(o(this).val())<e&&o(this).val(e)}),jQuery(".woocommerce-store-notice__dismiss-link").click(function(){Cookies.set("store_notice","hidden",{path:"/"}),jQuery(".woocommerce-store-notice").hide()}),"hidden"===Cookies.get("store_notice")?jQuery(".woocommerce-store-notice").hide():jQuery(".woocommerce-store-notice").show()});
|
||||
jQuery(function(o){o(".woocommerce-ordering").on("change","select.orderby",function(){o(this).closest("form").submit()}),o("input.qty:not(.product-quantity input.qty)").each(function(){var e=parseFloat(o(this).attr("min"));e>=0&&parseFloat(o(this).val())<e&&o(this).val(e)}),o(".woocommerce-store-notice__dismiss-link").click(function(){Cookies.set("store_notice","hidden",{path:"/"}),o(".woocommerce-store-notice").hide()}),"hidden"===Cookies.get("store_notice")?o(".woocommerce-store-notice").hide():o(".woocommerce-store-notice").show(),o(document.body).on("click",function(){o(".woocommerce-input-wrapper span.description:visible").prop("aria-hidden",!0).slideUp(250)}),o(".woocommerce-input-wrapper").on("click",function(o){o.stopPropagation()}),o(".woocommerce-input-wrapper :input").on("keydown",function(e){var i=o(this).parent().find("span.description");if(27===e.which&&i.length&&i.is(":visible"))return i.prop("aria-hidden",!0).slideUp(250),e.preventDefault(),!1}).on("focus",function(){var e=o(this).parent(),i=e.find("span.description");e.addClass("currentTarget"),o(".woocommerce-input-wrapper:not(.currentTarget) span.description:visible").prop("aria-hidden",!0).slideUp(250),i.length&&i.is(":hidden")&&i.prop("aria-hidden",!1).slideDown(250),e.removeClass("currentTarget")}),o.scroll_to_notices=function(e){var i="scrollBehavior"in document.documentElement.style;e.length&&(i?e[0].scrollIntoView({behavior:"smooth"}):o("html, body").animate({scrollTop:e.offset().top-100},1e3))}});
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,6 @@
|
|||
* Bangladeshi states (districts)
|
||||
*
|
||||
* @package WooCommerce/i18n
|
||||
* @version 2.0.0
|
||||
*/
|
||||
|
||||
global $states;
|
||||
|
@ -11,68 +10,68 @@ global $states;
|
|||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$states['BD'] = array(
|
||||
'BAG' => __( 'Bagerhat', 'woocommerce' ),
|
||||
'BAN' => __( 'Bandarban', 'woocommerce' ),
|
||||
'BAR' => __( 'Barguna', 'woocommerce' ),
|
||||
'BARI' => __( 'Barisal', 'woocommerce' ),
|
||||
'BHO' => __( 'Bhola', 'woocommerce' ),
|
||||
'BOG' => __( 'Bogra', 'woocommerce' ),
|
||||
'BRA' => __( 'Brahmanbaria', 'woocommerce' ),
|
||||
'CHA' => __( 'Chandpur', 'woocommerce' ),
|
||||
'CHI' => __( 'Chittagong', 'woocommerce' ),
|
||||
'CHU' => __( 'Chuadanga', 'woocommerce' ),
|
||||
'COM' => __( 'Comilla', 'woocommerce' ),
|
||||
'COX' => __( "Cox's Bazar", 'woocommerce' ),
|
||||
'DHA' => __( 'Dhaka', 'woocommerce' ),
|
||||
'DIN' => __( 'Dinajpur', 'woocommerce' ),
|
||||
'FAR' => __( 'Faridpur ', 'woocommerce' ),
|
||||
'FEN' => __( 'Feni', 'woocommerce' ),
|
||||
'GAI' => __( 'Gaibandha', 'woocommerce' ),
|
||||
'GAZI' => __( 'Gazipur', 'woocommerce' ),
|
||||
'GOP' => __( 'Gopalganj', 'woocommerce' ),
|
||||
'HAB' => __( 'Habiganj', 'woocommerce' ),
|
||||
'JAM' => __( 'Jamalpur', 'woocommerce' ),
|
||||
'JES' => __( 'Jessore', 'woocommerce' ),
|
||||
'JHA' => __( 'Jhalokati', 'woocommerce' ),
|
||||
'JHE' => __( 'Jhenaidah', 'woocommerce' ),
|
||||
'JOY' => __( 'Joypurhat', 'woocommerce' ),
|
||||
'KHA' => __( 'Khagrachhari', 'woocommerce' ),
|
||||
'KHU' => __( 'Khulna', 'woocommerce' ),
|
||||
'KIS' => __( 'Kishoreganj', 'woocommerce' ),
|
||||
'KUR' => __( 'Kurigram', 'woocommerce' ),
|
||||
'KUS' => __( 'Kushtia', 'woocommerce' ),
|
||||
'LAK' => __( 'Lakshmipur', 'woocommerce' ),
|
||||
'LAL' => __( 'Lalmonirhat', 'woocommerce' ),
|
||||
'MAD' => __( 'Madaripur', 'woocommerce' ),
|
||||
'MAG' => __( 'Magura', 'woocommerce' ),
|
||||
'MAN' => __( 'Manikganj ', 'woocommerce' ),
|
||||
'MEH' => __( 'Meherpur', 'woocommerce' ),
|
||||
'MOU' => __( 'Moulvibazar', 'woocommerce' ),
|
||||
'MUN' => __( 'Munshiganj', 'woocommerce' ),
|
||||
'MYM' => __( 'Mymensingh', 'woocommerce' ),
|
||||
'NAO' => __( 'Naogaon', 'woocommerce' ),
|
||||
'NAR' => __( 'Narail', 'woocommerce' ),
|
||||
'NARG' => __( 'Narayanganj', 'woocommerce' ),
|
||||
'NARD' => __( 'Narsingdi', 'woocommerce' ),
|
||||
'NAT' => __( 'Natore', 'woocommerce' ),
|
||||
'NAW' => __( 'Nawabganj', 'woocommerce' ),
|
||||
'NET' => __( 'Netrakona', 'woocommerce' ),
|
||||
'NIL' => __( 'Nilphamari', 'woocommerce' ),
|
||||
'NOA' => __( 'Noakhali', 'woocommerce' ),
|
||||
'PAB' => __( 'Pabna', 'woocommerce' ),
|
||||
'PAN' => __( 'Panchagarh', 'woocommerce' ),
|
||||
'PAT' => __( 'Patuakhali', 'woocommerce' ),
|
||||
'PIR' => __( 'Pirojpur', 'woocommerce' ),
|
||||
'RAJB' => __( 'Rajbari', 'woocommerce' ),
|
||||
'RAJ' => __( 'Rajshahi', 'woocommerce' ),
|
||||
'RAN' => __( 'Rangamati', 'woocommerce' ),
|
||||
'RANP' => __( 'Rangpur', 'woocommerce' ),
|
||||
'SAT' => __( 'Satkhira', 'woocommerce' ),
|
||||
'SHA' => __( 'Shariatpur', 'woocommerce' ),
|
||||
'SHE' => __( 'Sherpur', 'woocommerce' ),
|
||||
'SIR' => __( 'Sirajganj', 'woocommerce' ),
|
||||
'SUN' => __( 'Sunamganj', 'woocommerce' ),
|
||||
'SYL' => __( 'Sylhet', 'woocommerce' ),
|
||||
'TAN' => __( 'Tangail', 'woocommerce' ),
|
||||
'THA' => __( 'Thakurgaon', 'woocommerce' ),
|
||||
'BD-05' => __( 'Bagerhat', 'woocommerce' ),
|
||||
'BD-01' => __( 'Bandarban', 'woocommerce' ),
|
||||
'BD-02' => __( 'Barguna', 'woocommerce' ),
|
||||
'BD-06' => __( 'Barishal', 'woocommerce' ),
|
||||
'BD-07' => __( 'Bhola', 'woocommerce' ),
|
||||
'BD-03' => __( 'Bogura', 'woocommerce' ),
|
||||
'BD-04' => __( 'Brahmanbaria', 'woocommerce' ),
|
||||
'BD-09' => __( 'Chandpur', 'woocommerce' ),
|
||||
'BD-10' => __( 'Chattogram', 'woocommerce' ),
|
||||
'BD-12' => __( 'Chuadanga', 'woocommerce' ),
|
||||
'BD-11' => __( "Cox's Bazar", 'woocommerce' ),
|
||||
'BD-08' => __( 'Cumilla', 'woocommerce' ),
|
||||
'BD-13' => __( 'Dhaka', 'woocommerce' ),
|
||||
'BD-14' => __( 'Dinajpur', 'woocommerce' ),
|
||||
'BD-15' => __( 'Faridpur ', 'woocommerce' ),
|
||||
'BD-16' => __( 'Feni', 'woocommerce' ),
|
||||
'BD-19' => __( 'Gaibandha', 'woocommerce' ),
|
||||
'BD-18' => __( 'Gazipur', 'woocommerce' ),
|
||||
'BD-17' => __( 'Gopalganj', 'woocommerce' ),
|
||||
'BD-20' => __( 'Habiganj', 'woocommerce' ),
|
||||
'BD-21' => __( 'Jamalpur', 'woocommerce' ),
|
||||
'BD-22' => __( 'Jashore', 'woocommerce' ),
|
||||
'BD-25' => __( 'Jhalokati', 'woocommerce' ),
|
||||
'BD-23' => __( 'Jhenaidah', 'woocommerce' ),
|
||||
'BD-24' => __( 'Joypurhat', 'woocommerce' ),
|
||||
'BD-29' => __( 'Khagrachhari', 'woocommerce' ),
|
||||
'BD-27' => __( 'Khulna', 'woocommerce' ),
|
||||
'BD-26' => __( 'Kishoreganj', 'woocommerce' ),
|
||||
'BD-28' => __( 'Kurigram', 'woocommerce' ),
|
||||
'BD-30' => __( 'Kushtia', 'woocommerce' ),
|
||||
'BD-31' => __( 'Lakshmipur', 'woocommerce' ),
|
||||
'BD-32' => __( 'Lalmonirhat', 'woocommerce' ),
|
||||
'BD-36' => __( 'Madaripur', 'woocommerce' ),
|
||||
'BD-37' => __( 'Magura', 'woocommerce' ),
|
||||
'BD-33' => __( 'Manikganj ', 'woocommerce' ),
|
||||
'BD-39' => __( 'Meherpur', 'woocommerce' ),
|
||||
'BD-38' => __( 'Moulvibazar', 'woocommerce' ),
|
||||
'BD-35' => __( 'Munshiganj', 'woocommerce' ),
|
||||
'BD-34' => __( 'Mymensingh', 'woocommerce' ),
|
||||
'BD-48' => __( 'Naogaon', 'woocommerce' ),
|
||||
'BD-43' => __( 'Narail', 'woocommerce' ),
|
||||
'BD-40' => __( 'Narayanganj', 'woocommerce' ),
|
||||
'BD-42' => __( 'Narsingdi', 'woocommerce' ),
|
||||
'BD-44' => __( 'Natore', 'woocommerce' ),
|
||||
'BD-45' => __( 'Nawabganj', 'woocommerce' ),
|
||||
'BD-41' => __( 'Netrakona', 'woocommerce' ),
|
||||
'BD-46' => __( 'Nilphamari', 'woocommerce' ),
|
||||
'BD-47' => __( 'Noakhali', 'woocommerce' ),
|
||||
'BD-49' => __( 'Pabna', 'woocommerce' ),
|
||||
'BD-52' => __( 'Panchagarh', 'woocommerce' ),
|
||||
'BD-51' => __( 'Patuakhali', 'woocommerce' ),
|
||||
'BD-50' => __( 'Pirojpur', 'woocommerce' ),
|
||||
'BD-53' => __( 'Rajbari', 'woocommerce' ),
|
||||
'BD-54' => __( 'Rajshahi', 'woocommerce' ),
|
||||
'BD-56' => __( 'Rangamati', 'woocommerce' ),
|
||||
'BD-55' => __( 'Rangpur', 'woocommerce' ),
|
||||
'BD-58' => __( 'Satkhira', 'woocommerce' ),
|
||||
'BD-62' => __( 'Shariatpur', 'woocommerce' ),
|
||||
'BD-57' => __( 'Sherpur', 'woocommerce' ),
|
||||
'BD-59' => __( 'Sirajganj', 'woocommerce' ),
|
||||
'BD-61' => __( 'Sunamganj', 'woocommerce' ),
|
||||
'BD-60' => __( 'Sylhet', 'woocommerce' ),
|
||||
'BD-63' => __( 'Tangail', 'woocommerce' ),
|
||||
'BD-64' => __( 'Thakurgaon', 'woocommerce' ),
|
||||
);
|
||||
|
|
|
@ -14,10 +14,10 @@ $states['IE'] = array(
|
|||
'CW' => __( 'Carlow', 'woocommerce' ),
|
||||
'CN' => __( 'Cavan', 'woocommerce' ),
|
||||
'CE' => __( 'Clare', 'woocommerce' ),
|
||||
'CK' => __( 'Cork', 'woocommerce' ),
|
||||
'CO' => __( 'Cork', 'woocommerce' ),
|
||||
'DL' => __( 'Donegal', 'woocommerce' ),
|
||||
'DN' => __( 'Dublin', 'woocommerce' ),
|
||||
'GY' => __( 'Galway', 'woocommerce' ),
|
||||
'D' => __( 'Dublin', 'woocommerce' ),
|
||||
'G' => __( 'Galway', 'woocommerce' ),
|
||||
'KY' => __( 'Kerry', 'woocommerce' ),
|
||||
'KE' => __( 'Kildare', 'woocommerce' ),
|
||||
'KK' => __( 'Kilkenny', 'woocommerce' ),
|
||||
|
@ -32,7 +32,7 @@ $states['IE'] = array(
|
|||
'OY' => __( 'Offaly', 'woocommerce' ),
|
||||
'RN' => __( 'Roscommon', 'woocommerce' ),
|
||||
'SO' => __( 'Sligo', 'woocommerce' ),
|
||||
'TY' => __( 'Tipperary', 'woocommerce' ),
|
||||
'TA' => __( 'Tipperary', 'woocommerce' ),
|
||||
'WD' => __( 'Waterford', 'woocommerce' ),
|
||||
'WH' => __( 'Westmeath', 'woocommerce' ),
|
||||
'WX' => __( 'Wexford', 'woocommerce' ),
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* Liberia provinces
|
||||
*
|
||||
* @package WooCommerce/i18n
|
||||
* @version 3.0.0
|
||||
*/
|
||||
|
||||
global $states;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$states['LR'] = array(
|
||||
'BM' => __( 'Bomi', 'woocommerce' ),
|
||||
'BN' => __( 'Bong', 'woocommerce' ),
|
||||
'GA' => __( 'Gbarpolu', 'woocommerce' ),
|
||||
'GB' => __( 'Grand Bassa', 'woocommerce' ),
|
||||
'GC' => __( 'Grand Cape Mount', 'woocommerce' ),
|
||||
'GG' => __( 'Grand Gedeh', 'woocommerce' ),
|
||||
'GK' => __( 'Grand Kru', 'woocommerce' ),
|
||||
'LO' => __( 'Lofa ', 'woocommerce' ),
|
||||
'MA' => __( 'Margibi', 'woocommerce' ),
|
||||
'MY' => __( 'Maryland', 'woocommerce' ),
|
||||
'MO' => __( 'Montserrado', 'woocommerce' ),
|
||||
'NM' => __( 'Nimba', 'woocommerce' ),
|
||||
'RV' => __( 'Rivercess', 'woocommerce' ),
|
||||
'RG' => __( 'River Gee', 'woocommerce' ),
|
||||
'SN' => __( 'Sinoe', 'woocommerce' ),
|
||||
);
|
|
@ -706,7 +706,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
* Return an array of items/products within this order.
|
||||
*
|
||||
* @param string|array $types Types of line items to get (array or string).
|
||||
* @return Array of WC_Order_item
|
||||
* @return WC_Order_Item[]
|
||||
*/
|
||||
public function get_items( $types = 'line_item' ) {
|
||||
$items = array();
|
||||
|
@ -730,7 +730,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
/**
|
||||
* Return an array of fees within this order.
|
||||
*
|
||||
* @return array
|
||||
* @return WC_Order_item_Fee[]
|
||||
*/
|
||||
public function get_fees() {
|
||||
return $this->get_items( 'fee' );
|
||||
|
@ -739,7 +739,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
/**
|
||||
* Return an array of taxes within this order.
|
||||
*
|
||||
* @return array
|
||||
* @return WC_Order_Item_Tax[]
|
||||
*/
|
||||
public function get_taxes() {
|
||||
return $this->get_items( 'tax' );
|
||||
|
@ -748,7 +748,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
/**
|
||||
* Return an array of shipping costs within this order.
|
||||
*
|
||||
* @return array
|
||||
* @return WC_Order_Item_Shipping[]
|
||||
*/
|
||||
public function get_shipping_methods() {
|
||||
return $this->get_items( 'shipping' );
|
||||
|
@ -788,7 +788,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
* Gets the count of order items of a certain type.
|
||||
*
|
||||
* @param string $item_type Item type to lookup.
|
||||
* @return string
|
||||
* @return int|string
|
||||
*/
|
||||
public function get_item_count( $item_type = '' ) {
|
||||
$items = $this->get_items( empty( $item_type ) ? 'line_item' : $item_type );
|
||||
|
@ -802,7 +802,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get an order item object, based on it's type.
|
||||
* Get an order item object, based on its type.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param int $item_id ID of item to get.
|
||||
|
@ -1062,7 +1062,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
}
|
||||
|
||||
/**
|
||||
* After applying coupons via the WC_Disounts class, update line items.
|
||||
* After applying coupons via the WC_Discounts class, update line items.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @param WC_Discounts $discounts Discounts class.
|
||||
|
@ -1087,7 +1087,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
}
|
||||
|
||||
/**
|
||||
* After applying coupons via the WC_Disounts class, update or create coupon items.
|
||||
* After applying coupons via the WC_Discounts class, update or create coupon items.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @param WC_Discounts $discounts Discounts class.
|
||||
|
@ -1134,7 +1134,7 @@ 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
|
||||
* it's own method because it saves looking up order amounts (costs are added up for you).
|
||||
* its own method because it saves looking up order amounts (costs are added up for you).
|
||||
*
|
||||
* @param WC_Product $product Product object.
|
||||
* @param int $qty Quantity to add.
|
||||
|
|
|
@ -178,7 +178,9 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
|||
* Output the gateway settings screen.
|
||||
*/
|
||||
public function admin_options() {
|
||||
echo '<h2>' . esc_html( $this->get_method_title() ) . '</h2>';
|
||||
echo '<h2>' . esc_html( $this->get_method_title() );
|
||||
wc_back_link( __( 'Return to payments', 'woocommerce' ), admin_url( 'admin.php?page=wc-settings&tab=checkout' ) );
|
||||
echo '</h2>';
|
||||
echo wp_kses_post( wpautop( $this->get_method_description() ) );
|
||||
parent::admin_options();
|
||||
}
|
||||
|
@ -191,6 +193,19 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
|||
$this->enabled = ! empty( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled'] ? 'yes' : 'no';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether or not this gateway still requires setup to function.
|
||||
*
|
||||
* When this gateway is toggled on via AJAX, if this returns true a
|
||||
* redirect will occur to the settings page instead.
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @return bool
|
||||
*/
|
||||
public function needs_setup() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the return url (thank you page).
|
||||
*
|
||||
|
@ -388,6 +403,18 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
|||
return apply_filters( 'woocommerce_payment_gateway_supports', in_array( $feature, $this->supports ), $feature, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
* Can the order be refunded via this gateway?
|
||||
*
|
||||
* Should be extended by gateways to do their own checks.
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @return bool If false, the automatic refund button is hidden in the UI.
|
||||
*/
|
||||
public function can_refund_order( $order ) {
|
||||
return $order && $this->supports( 'refunds' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Core credit card form which gateways can used if needed. Deprecated - inherit WC_Payment_Gateway_CC instead.
|
||||
*
|
||||
|
|
|
@ -177,6 +177,24 @@ abstract class WC_Settings_API {
|
|||
return $_POST; // WPCS: CSRF ok, input var ok.
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a single option.
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @param string $key Option key.
|
||||
* @param mixed $value Value to set.
|
||||
* @return bool was anything saved?
|
||||
*/
|
||||
public function update_option( $key, $value = '' ) {
|
||||
if ( empty( $this->settings ) ) {
|
||||
$this->init_settings();
|
||||
}
|
||||
|
||||
$this->settings[ $key ] = $value;
|
||||
|
||||
return update_option( $this->get_option_key(), apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes and saves options.
|
||||
* If there is an error thrown, will continue to save and validate fields, but will leave the erroring field out.
|
||||
|
@ -405,8 +423,7 @@ abstract class WC_Settings_API {
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?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'] ); ?> <?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<fieldset>
|
||||
|
@ -449,8 +466,7 @@ abstract class WC_Settings_API {
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?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'] ); ?> <?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<fieldset>
|
||||
|
@ -493,8 +509,7 @@ abstract class WC_Settings_API {
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?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'] ); ?> <?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<fieldset>
|
||||
|
@ -549,8 +564,7 @@ abstract class WC_Settings_API {
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?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'] ); ?> <?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<fieldset>
|
||||
|
@ -595,8 +609,7 @@ abstract class WC_Settings_API {
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?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'] ); ?> <?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<fieldset>
|
||||
|
@ -643,8 +656,7 @@ abstract class WC_Settings_API {
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?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'] ); ?> <?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<fieldset>
|
||||
|
@ -689,8 +701,7 @@ abstract class WC_Settings_API {
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?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'] ); ?> <?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<fieldset>
|
||||
|
@ -740,15 +751,22 @@ abstract class WC_Settings_API {
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?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'] ); ?> <?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<fieldset>
|
||||
<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 ); // WPCS: XSS ok. ?>>
|
||||
<?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 ), true ); ?>><?php echo esc_attr( $option_value ); ?></option>
|
||||
<?php if ( is_array( $option_value ) ) : ?>
|
||||
<optgroup label="<?php echo esc_attr( $option_key ); ?>">
|
||||
<?php foreach ( $option_value as $option_key_inner => $option_value_inner ) : ?>
|
||||
<option value="<?php echo esc_attr( $option_key_inner ); ?>" <?php selected( in_array( $option_key_inner, $value, true ), true ); ?>><?php echo esc_attr( $option_value_inner ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</optgroup>
|
||||
<?php else : ?>
|
||||
<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 endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
|
||||
|
|
|
@ -72,7 +72,7 @@ abstract class WC_Background_Process extends WP_Background_Process {
|
|||
|
||||
$batch = new stdClass();
|
||||
$batch->key = $query->$column;
|
||||
$batch->data = maybe_unserialize( $query->$value_column );
|
||||
$batch->data = array_filter( (array) maybe_unserialize( $query->$value_column ) );
|
||||
|
||||
return $batch;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ abstract class WC_Background_Process extends WP_Background_Process {
|
|||
$interval = apply_filters( $this->identifier . '_cron_interval', 5 );
|
||||
|
||||
if ( property_exists( $this, 'cron_interval' ) ) {
|
||||
$interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval_identifier );
|
||||
$interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval );
|
||||
}
|
||||
|
||||
// Adds every 5 minutes to the existing schedules.
|
||||
|
|
|
@ -70,7 +70,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
|||
* @return string
|
||||
*/
|
||||
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=advanced§ion=keys&edit-key=' . $key['key_id'] );
|
||||
|
||||
$output = '<strong>';
|
||||
$output .= '<a href="' . esc_url( $url ) . '" class="row-title">';
|
||||
|
@ -92,7 +92,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
|||
add_query_arg(
|
||||
array(
|
||||
'revoke-key' => $key['key_id'],
|
||||
), admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys' )
|
||||
), admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=keys' )
|
||||
), 'revoke'
|
||||
)
|
||||
) . '">' . esc_html__( 'Revoke', 'woocommerce' ) . '</a>',
|
||||
|
|
|
@ -27,7 +27,7 @@ class WC_Admin_API_Keys {
|
|||
* @return bool
|
||||
*/
|
||||
private function is_api_keys_settings_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.
|
||||
return isset( $_GET['page'], $_GET['tab'], $_GET['section'] ) && 'wc-settings' === $_GET['page'] && 'advanced' === $_GET['tab'] && 'keys' === $_GET['section']; // WPCS: input var okay, CSRF ok.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,7 +72,7 @@ class WC_Admin_API_Keys {
|
|||
private static function table_list_output() {
|
||||
global $wpdb, $keys_table_list;
|
||||
|
||||
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>' . esc_html__( 'REST API', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=keys&create-key=1' ) ) . '" class="add-new-h2">' . esc_html__( 'Add key', 'woocommerce' ) . '</a></h2>';
|
||||
|
||||
// Get the API keys count.
|
||||
$count = $wpdb->get_var( "SELECT COUNT(key_id) FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1;" );
|
||||
|
@ -91,7 +91,7 @@ class WC_Admin_API_Keys {
|
|||
echo '<div class="woocommerce-BlankState woocommerce-BlankState--api">';
|
||||
?>
|
||||
<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 esc_html_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=advanced§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
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ class WC_Admin_API_Keys {
|
|||
}
|
||||
}
|
||||
|
||||
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=advanced§ion=keys' ) ) ) );
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
/**
|
||||
* Load assets
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.1.0
|
||||
*/
|
||||
|
@ -33,26 +31,26 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
public function admin_styles() {
|
||||
global $wp_scripts;
|
||||
|
||||
$screen = get_current_screen();
|
||||
$screen_id = $screen ? $screen->id : '';
|
||||
$screen = get_current_screen();
|
||||
$screen_id = $screen ? $screen->id: '';
|
||||
|
||||
// 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_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION );
|
||||
wp_register_style( 'jquery-ui-style', WC()->plugin_url() . '/assets/css/jquery-ui.min.css', array(), WC_VERSION );
|
||||
wp_register_style( 'jquery-ui-style', WC()->plugin_url() . '/assets/css/jquery-ui/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_print_reports_styles', WC()->plugin_url() . '/assets/css/reports-print.css', array(), WC_VERSION, 'print' );
|
||||
|
||||
// Add RTL support for admin styles
|
||||
// Add RTL support for admin styles.
|
||||
wp_style_add_data( 'woocommerce_admin_menu_styles', 'rtl', 'replace' );
|
||||
wp_style_add_data( 'woocommerce_admin_styles', 'rtl', 'replace' );
|
||||
wp_style_add_data( 'woocommerce_admin_dashboard_styles', 'rtl', 'replace' );
|
||||
wp_style_add_data( 'woocommerce_admin_print_reports_styles', 'rtl', 'replace' );
|
||||
|
||||
// Sitewide menu CSS
|
||||
// Sitewide menu CSS.
|
||||
wp_enqueue_style( 'woocommerce_admin_menu_styles' );
|
||||
|
||||
// Admin styles for WC pages only
|
||||
// Admin styles for WC pages only.
|
||||
if ( in_array( $screen_id, wc_get_screen_ids() ) ) {
|
||||
wp_enqueue_style( 'woocommerce_admin_styles' );
|
||||
wp_enqueue_style( 'jquery-ui-style' );
|
||||
|
@ -67,9 +65,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
wp_enqueue_style( 'woocommerce_admin_print_reports_styles' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 2.3
|
||||
*/
|
||||
// @deprecated 2.3.
|
||||
if ( has_action( 'woocommerce_admin_css' ) ) {
|
||||
do_action( 'woocommerce_admin_css' );
|
||||
wc_deprecated_function( 'The woocommerce_admin_css action', '2.3', 'admin_enqueue_scripts' );
|
||||
|
@ -88,7 +84,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
$wc_screen_id = sanitize_title( __( 'WooCommerce', 'woocommerce' ) );
|
||||
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||
|
||||
// Register scripts
|
||||
// Register scripts.
|
||||
wp_register_script( 'woocommerce_admin', WC()->plugin_url() . '/assets/js/admin/woocommerce_admin' . $suffix . '.js', array( 'jquery', 'jquery-blockui', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'jquery-tiptip' ), WC_VERSION );
|
||||
wp_register_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
|
||||
wp_register_script( 'jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array( 'jquery' ), WC_VERSION, true );
|
||||
|
@ -173,25 +169,29 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
'i18_delete_product_notice' => __( 'This product has produced sales and may be linked to existing orders. Are you sure you want to delete it?', 'woocommerce' ),
|
||||
'decimal_point' => $decimal,
|
||||
'mon_decimal_point' => wc_get_price_decimal_separator(),
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
'strings' => array(
|
||||
'import_products' => __( 'Import', 'woocommerce' ),
|
||||
'export_products' => __( 'Export', 'woocommerce' ),
|
||||
),
|
||||
'nonces' => array(
|
||||
'gateway_toggle' => wp_create_nonce( 'woocommerce-toggle-payment-gateway-enabled' ),
|
||||
),
|
||||
'urls' => array(
|
||||
'import_products' => esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_importer' ) ),
|
||||
'export_products' => esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_exporter' ) ),
|
||||
'import_products' => current_user_can( 'import' ) ? esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_importer' ) ) : null,
|
||||
'export_products' => current_user_can( 'export' ) ? esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_exporter' ) ) : null,
|
||||
),
|
||||
);
|
||||
|
||||
wp_localize_script( 'woocommerce_admin', 'woocommerce_admin', $params );
|
||||
}
|
||||
|
||||
// Edit product category pages
|
||||
// Edit product category pages.
|
||||
if ( in_array( $screen_id, array( 'edit-product_cat' ) ) ) {
|
||||
wp_enqueue_media();
|
||||
}
|
||||
|
||||
// Products
|
||||
// Products.
|
||||
if ( in_array( $screen_id, array( 'edit-product' ) ) ) {
|
||||
wp_enqueue_script( 'woocommerce_quick-edit', WC()->plugin_url() . '/assets/js/admin/quick-edit' . $suffix . '.js', array( 'jquery', 'woocommerce_admin' ), WC_VERSION );
|
||||
|
||||
|
@ -204,7 +204,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
wp_localize_script( 'woocommerce_quick-edit', 'woocommerce_quick_edit', $params );
|
||||
}
|
||||
|
||||
// Meta boxes
|
||||
// Meta boxes.
|
||||
if ( in_array( $screen_id, array( 'product', 'edit-product' ) ) ) {
|
||||
wp_enqueue_media();
|
||||
wp_register_script( 'wc-admin-product-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product' . $suffix . '.js', array( 'wc-admin-meta-boxes', 'media-models' ), WC_VERSION );
|
||||
|
@ -224,6 +224,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
'load_variations_nonce' => wp_create_nonce( 'load-variations' ),
|
||||
'save_variations_nonce' => wp_create_nonce( 'save-variations' ),
|
||||
'bulk_edit_variations_nonce' => wp_create_nonce( 'bulk-edit-variations' ),
|
||||
/* translators: %d: Number of variations */
|
||||
'i18n_link_all_variations' => esc_js( sprintf( __( 'Are you sure you want to link all variations? This will create a new variation for each and every possible combination of variation attributes (max %d per run).', 'woocommerce' ), defined( 'WC_MAX_LINKED_VARIATIONS' ) ? WC_MAX_LINKED_VARIATIONS : 50 ) ),
|
||||
'i18n_enter_a_value' => esc_js( __( 'Enter a value', 'woocommerce' ) ),
|
||||
'i18n_enter_menu_order' => esc_js( __( 'Variation menu order (determines position in the list of variations)', 'woocommerce' ) ),
|
||||
|
@ -270,8 +271,11 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
$post_id = isset( $post->ID ) ? $post->ID : '';
|
||||
$currency = '';
|
||||
|
||||
if ( $post_id && in_array( get_post_type( $post_id ), wc_get_order_types( 'order-meta-boxes' ) ) && ( $order = wc_get_order( $post_id ) ) ) {
|
||||
$currency = $order->get_currency();
|
||||
if ( $post_id && in_array( get_post_type( $post_id ), wc_get_order_types( 'order-meta-boxes' ) ) ) {
|
||||
$order = wc_get_order( $post_id );
|
||||
if ( $order ) {
|
||||
$currency = $order->get_currency();
|
||||
}
|
||||
}
|
||||
|
||||
$params = array(
|
||||
|
@ -318,7 +322,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
'currency_format_symbol' => get_woocommerce_currency_symbol( $currency ),
|
||||
'currency_format_decimal_sep' => esc_attr( wc_get_price_decimal_separator() ),
|
||||
'currency_format_thousand_sep' => esc_attr( wc_get_price_thousand_separator() ),
|
||||
'currency_format' => esc_attr( str_replace( array( '%1$s', '%2$s' ), array( '%s', '%v' ), get_woocommerce_price_format() ) ), // For accounting JS
|
||||
'currency_format' => esc_attr( str_replace( array( '%1$s', '%2$s' ), array( '%s', '%v' ), get_woocommerce_price_format() ) ), // For accounting JS.
|
||||
'rounding_precision' => wc_get_rounding_precision(),
|
||||
'tax_rounding_mode' => wc_get_tax_rounding_mode(),
|
||||
'product_types' => array_unique( array_merge( array( 'simple', 'grouped', 'variable', 'external' ), array_keys( wc_get_product_types() ) ) ),
|
||||
|
@ -333,13 +337,13 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
wp_localize_script( 'wc-admin-meta-boxes', 'woocommerce_admin_meta_boxes', $params );
|
||||
}
|
||||
|
||||
// Term ordering - only when sorting by term_order
|
||||
if ( ( strstr( $screen_id, 'edit-pa_' ) || ( ! empty( $_GET['taxonomy'] ) && in_array( $_GET['taxonomy'], apply_filters( 'woocommerce_sortable_taxonomies', array( 'product_cat' ) ) ) ) ) && ! isset( $_GET['orderby'] ) ) {
|
||||
// Term ordering - only when sorting by term_order.
|
||||
if ( ( strstr( $screen_id, 'edit-pa_' ) || ( ! empty( $_GET['taxonomy'] ) && in_array( wp_unslash( $_GET['taxonomy'] ), apply_filters( 'woocommerce_sortable_taxonomies', array( 'product_cat' ) ) ) ) ) && ! isset( $_GET['orderby'] ) ) {
|
||||
|
||||
wp_register_script( 'woocommerce_term_ordering', WC()->plugin_url() . '/assets/js/admin/term-ordering' . $suffix . '.js', array( 'jquery-ui-sortable' ), WC_VERSION );
|
||||
wp_enqueue_script( 'woocommerce_term_ordering' );
|
||||
|
||||
$taxonomy = isset( $_GET['taxonomy'] ) ? wc_clean( $_GET['taxonomy'] ) : '';
|
||||
$taxonomy = isset( $_GET['taxonomy'] ) ? wc_clean( wp_unslash( $_GET['taxonomy'] ) ) : '';
|
||||
|
||||
$woocommerce_term_order_params = array(
|
||||
'taxonomy' => $taxonomy,
|
||||
|
@ -348,13 +352,13 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
wp_localize_script( 'woocommerce_term_ordering', 'woocommerce_term_ordering_params', $woocommerce_term_order_params );
|
||||
}
|
||||
|
||||
// Product sorting - only when sorting by menu order on the products page
|
||||
// Product sorting - only when sorting by menu order on the products page.
|
||||
if ( current_user_can( 'edit_others_pages' ) && 'edit-product' === $screen_id && isset( $wp_query->query['orderby'] ) && 'menu_order title' === $wp_query->query['orderby'] ) {
|
||||
wp_register_script( 'woocommerce_product_ordering', WC()->plugin_url() . '/assets/js/admin/product-ordering' . $suffix . '.js', array( 'jquery-ui-sortable' ), WC_VERSION, true );
|
||||
wp_enqueue_script( 'woocommerce_product_ordering' );
|
||||
}
|
||||
|
||||
// Reports Pages
|
||||
// Reports Pages.
|
||||
if ( in_array( $screen_id, apply_filters( 'woocommerce_reports_screen_ids', array( $wc_screen_id . '_page_wc-reports', 'toplevel_page_wc-reports', 'dashboard' ) ) ) ) {
|
||||
wp_register_script( 'wc-reports', WC()->plugin_url() . '/assets/js/admin/reports' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker' ), WC_VERSION );
|
||||
|
||||
|
@ -366,7 +370,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
wp_enqueue_script( 'flot-stack' );
|
||||
}
|
||||
|
||||
// API settings
|
||||
// API settings.
|
||||
if ( $wc_screen_id . '_page_wc-settings' === $screen_id && isset( $_GET['section'] ) && 'keys' == $_GET['section'] ) {
|
||||
wp_register_script( 'wc-api-keys', WC()->plugin_url() . '/assets/js/admin/api-keys' . $suffix . '.js', array( 'jquery', 'woocommerce_admin', 'underscore', 'backbone', 'wp-util', 'qrcode', 'wc-clipboard' ), WC_VERSION, true );
|
||||
wp_enqueue_script( 'wc-api-keys' );
|
||||
|
|
|
@ -2,17 +2,13 @@
|
|||
/**
|
||||
* Attributes Page
|
||||
*
|
||||
* The attributes section lets users add custom attributes to assign to products - they can also be used in the layered nav widget.
|
||||
* The attributes section lets users add custom attributes to assign to products - they can also be used in the "Filter Products by Attribute" widget.
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.3.0
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Admin_Attributes Class.
|
||||
|
|
|
@ -26,6 +26,10 @@ class WC_Admin_Exporters {
|
|||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( ! $this->export_allowed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'admin_menu', array( $this, 'add_to_menus' ) );
|
||||
add_action( 'admin_head', array( $this, 'hide_from_menus' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
|
||||
|
@ -36,11 +40,20 @@ class WC_Admin_Exporters {
|
|||
$this->exporters['product_exporter'] = array(
|
||||
'menu' => 'edit.php?post_type=product',
|
||||
'name' => __( 'Product Export', 'woocommerce' ),
|
||||
'capability' => 'edit_products',
|
||||
'capability' => 'export',
|
||||
'callback' => array( $this, 'product_exporter' ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if WooCommerce export is allowed for current user, false otherwise.
|
||||
*
|
||||
* @return bool Whether current user can perform export.
|
||||
*/
|
||||
protected function export_allowed() {
|
||||
return current_user_can( 'edit_products' ) && current_user_can( 'export' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add menu items for our custom exporters.
|
||||
*/
|
||||
|
@ -112,8 +125,8 @@ class WC_Admin_Exporters {
|
|||
public function do_ajax_product_export() {
|
||||
check_ajax_referer( 'wc-product-export', 'security' );
|
||||
|
||||
if ( ! current_user_can( 'edit_products' ) ) {
|
||||
wp_die( -1 );
|
||||
if ( ! $this->export_allowed() ) {
|
||||
wp_send_json_error( array( 'message' => __( 'Insufficient privileges to export products.', 'woocommerce' ) ) );
|
||||
}
|
||||
|
||||
include_once WC_ABSPATH . 'includes/export/class-wc-product-csv-exporter.php';
|
||||
|
|
|
@ -77,8 +77,8 @@ class WC_Admin_Help {
|
|||
'title' => __( 'Education', 'woocommerce' ),
|
||||
'content' =>
|
||||
'<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><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>' . __( 'If you would like to learn about using WooCommerce from an expert, consider a WooCommerce course to further your education.', 'woocommerce' ) . '</p>' .
|
||||
'<p><a href="https://docs.woocommerce.com/document/further-education/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin" class="button button-primary">' . __( 'Further education', 'woocommerce' ) . '</a></p>',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -98,7 +98,7 @@ class WC_Admin_Help {
|
|||
'<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></p>' .
|
||||
'<p><a href="https://woocommerce.com/?utm_source=helptab&utm_medium=product&utm_content=about&utm_campaign=woocommerceplugin" target="_blank">' . __( 'About WooCommerce', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://wordpress.org/plugins/woocommerce/" target="_blank">' . __( 'WordPress.org project', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://github.com/woocommerce/woocommerce" target="_blank">' . __( 'Github project', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://github.com/woocommerce/woocommerce/" target="_blank">' . __( 'Github project', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://woocommerce.com/storefront/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official theme', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://woocommerce.com/product-category/woocommerce-extensions/?utm_source=helptab&utm_medium=product&utm_content=wcextensions&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official extensions', 'woocommerce' ) . '</a></p>'
|
||||
);
|
||||
|
|
|
@ -23,6 +23,10 @@ class WC_Admin_Importers {
|
|||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( ! $this->import_allowed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'admin_menu', array( $this, 'add_to_menus' ) );
|
||||
add_action( 'admin_init', array( $this, 'register_importers' ) );
|
||||
add_action( 'admin_head', array( $this, 'hide_from_menus' ) );
|
||||
|
@ -33,11 +37,20 @@ class WC_Admin_Importers {
|
|||
$this->importers['product_importer'] = array(
|
||||
'menu' => 'edit.php?post_type=product',
|
||||
'name' => __( 'Product Import', 'woocommerce' ),
|
||||
'capability' => 'edit_products',
|
||||
'capability' => 'import',
|
||||
'callback' => array( $this, 'product_importer' ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if WooCommerce imports are allowed for current user, false otherwise.
|
||||
*
|
||||
* @return bool Whether current user can perform imports.
|
||||
*/
|
||||
protected function import_allowed() {
|
||||
return current_user_can( 'edit_products' ) && current_user_can( 'import' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add menu items for our custom importers.
|
||||
*/
|
||||
|
@ -190,8 +203,8 @@ class WC_Admin_Importers {
|
|||
|
||||
check_ajax_referer( 'wc-product-import', 'security' );
|
||||
|
||||
if ( ! current_user_can( 'edit_products' ) || ! isset( $_POST['file'] ) ) { // PHPCS: input var ok.
|
||||
wp_die( -1 );
|
||||
if ( ! $this->import_allowed() || ! isset( $_POST['file'] ) ) { // PHPCS: input var ok.
|
||||
wp_send_json_error( array( 'message' => __( 'Insufficient privileges to import products.', 'woocommerce' ) ) );
|
||||
}
|
||||
|
||||
include_once WC_ABSPATH . 'includes/admin/importers/class-wc-product-csv-importer-controller.php';
|
||||
|
|
|
@ -65,7 +65,7 @@ class WC_Admin_Meta_Boxes {
|
|||
add_action( 'woocommerce_process_shop_coupon_meta', 'WC_Meta_Box_Coupon_Data::save', 10, 2 );
|
||||
|
||||
// Save Rating Meta Boxes.
|
||||
add_action( 'comment_edit_redirect', 'WC_Meta_Box_Product_Reviews::save', 1, 2 );
|
||||
add_filter( 'wp_update_comment_data', 'WC_Meta_Box_Product_Reviews::save', 1 );
|
||||
|
||||
// Error handling (for showing errors from meta boxes on next page load).
|
||||
add_action( 'admin_notices', array( $this, 'output_errors' ) );
|
||||
|
|
|
@ -2,15 +2,11 @@
|
|||
/**
|
||||
* Display notices in admin
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.3.0
|
||||
* @package WooCommerce\Admin
|
||||
* @version 3.4.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Admin_Notices Class.
|
||||
|
@ -37,6 +33,7 @@ class WC_Admin_Notices {
|
|||
'no_shipping_methods' => 'no_shipping_methods_notice',
|
||||
'simplify_commerce' => 'simplify_commerce_notice',
|
||||
'regenerating_thumbnails' => 'regenerating_thumbnails_notice',
|
||||
'no_secure_connection' => 'secure_connection_notice',
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -84,18 +81,23 @@ class WC_Admin_Notices {
|
|||
public static function reset_admin_notices() {
|
||||
$simplify_options = get_option( 'woocommerce_simplify_commerce_settings', array() );
|
||||
$location = wc_get_base_location();
|
||||
$shop_page = 0 < wc_get_page_id( 'shop' ) ? get_permalink( wc_get_page_id( 'shop' ) ) : get_home_url();
|
||||
|
||||
if ( ! class_exists( 'WC_Gateway_Simplify_Commerce_Loader' ) && ! empty( $simplify_options['enabled'] ) && 'yes' === $simplify_options['enabled'] && in_array( $location['country'], apply_filters( 'woocommerce_gateway_simplify_commerce_supported_countries', array( 'US', 'IE' ) ) ) ) {
|
||||
if ( ! class_exists( 'WC_Gateway_Simplify_Commerce_Loader' ) && ! empty( $simplify_options['enabled'] ) && 'yes' === $simplify_options['enabled'] && in_array( $location['country'], apply_filters( 'woocommerce_gateway_simplify_commerce_supported_countries', array( 'US', 'IE' ) ), true ) ) {
|
||||
WC_Admin_Notices::add_notice( 'simplify_commerce' );
|
||||
}
|
||||
|
||||
if ( ! is_ssl() || 'https' !== substr( $shop_page, 0, 5 ) ) {
|
||||
WC_Admin_Notices::add_notice( 'no_secure_connection' );
|
||||
}
|
||||
|
||||
self::add_notice( 'template_files' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a notice.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name Notice name.
|
||||
*/
|
||||
public static function add_notice( $name ) {
|
||||
self::$notices = array_unique( array_merge( self::get_notices(), array( $name ) ) );
|
||||
|
@ -104,7 +106,7 @@ class WC_Admin_Notices {
|
|||
/**
|
||||
* Remove a notice from being displayed.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name Notice name.
|
||||
*/
|
||||
public static function remove_notice( $name ) {
|
||||
self::$notices = array_diff( self::get_notices(), array( $name ) );
|
||||
|
@ -114,27 +116,27 @@ class WC_Admin_Notices {
|
|||
/**
|
||||
* See if a notice is being shown.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name Notice name.
|
||||
* @return boolean
|
||||
*/
|
||||
public static function has_notice( $name ) {
|
||||
return in_array( $name, self::get_notices() );
|
||||
return in_array( $name, self::get_notices(), true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide a notice if the GET variable is set.
|
||||
*/
|
||||
public static function hide_notices() {
|
||||
if ( isset( $_GET['wc-hide-notice'] ) && isset( $_GET['_wc_notice_nonce'] ) ) {
|
||||
if ( ! wp_verify_nonce( $_GET['_wc_notice_nonce'], 'woocommerce_hide_notices_nonce' ) ) {
|
||||
wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
||||
if ( isset( $_GET['wc-hide-notice'] ) && isset( $_GET['_wc_notice_nonce'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
if ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wc_notice_nonce'] ) ), 'woocommerce_hide_notices_nonce' ) ) { // WPCS: input var ok, CSRF ok.
|
||||
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'manage_woocommerce' ) ) {
|
||||
wp_die( __( 'You don’t have permission to do this.', 'woocommerce' ) );
|
||||
wp_die( esc_html__( 'You don’t have permission to do this.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$hide_notice = sanitize_text_field( $_GET['wc-hide-notice'] );
|
||||
$hide_notice = sanitize_text_field( wp_unslash( $_GET['wc-hide-notice'] ) ); // WPCS: input var ok, CSRF ok.
|
||||
|
||||
self::remove_notice( $hide_notice );
|
||||
|
||||
|
@ -150,18 +152,32 @@ class WC_Admin_Notices {
|
|||
public static function add_notices() {
|
||||
$notices = self::get_notices();
|
||||
|
||||
if ( ! empty( $notices ) ) {
|
||||
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', WC_PLUGIN_FILE ), array(), WC_VERSION );
|
||||
if ( empty( $notices ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add RTL support
|
||||
wp_style_add_data( 'woocommerce-activation', 'rtl', 'replace' );
|
||||
$screen = get_current_screen();
|
||||
$screen_id = $screen ? $screen->id : '';
|
||||
$show_on_screens = array(
|
||||
'dashboard',
|
||||
'plugins',
|
||||
);
|
||||
|
||||
foreach ( $notices as $notice ) {
|
||||
if ( ! empty( self::$core_notices[ $notice ] ) && apply_filters( 'woocommerce_show_admin_notice', true, $notice ) ) {
|
||||
add_action( 'admin_notices', array( __CLASS__, self::$core_notices[ $notice ] ) );
|
||||
} else {
|
||||
add_action( 'admin_notices', array( __CLASS__, 'output_custom_notices' ) );
|
||||
}
|
||||
// Notices should only show on WooCommerce screens, the main dashboard, and on the plugins screen.
|
||||
if ( ! in_array( $screen_id, wc_get_screen_ids(), true ) && ! in_array( $screen_id, $show_on_screens, true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', WC_PLUGIN_FILE ), array(), WC_VERSION );
|
||||
|
||||
// Add RTL support.
|
||||
wp_style_add_data( 'woocommerce-activation', 'rtl', 'replace' );
|
||||
|
||||
foreach ( $notices as $notice ) {
|
||||
if ( ! empty( self::$core_notices[ $notice ] ) && apply_filters( 'woocommerce_show_admin_notice', true, $notice ) ) {
|
||||
add_action( 'admin_notices', array( __CLASS__, self::$core_notices[ $notice ] ) );
|
||||
} else {
|
||||
add_action( 'admin_notices', array( __CLASS__, 'output_custom_notices' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,8 +185,8 @@ class WC_Admin_Notices {
|
|||
/**
|
||||
* Add a custom notice.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $notice_html
|
||||
* @param string $name Notice name.
|
||||
* @param string $notice_html Notice HTML.
|
||||
*/
|
||||
public static function add_custom_notice( $name, $notice_html ) {
|
||||
self::add_notice( $name );
|
||||
|
@ -189,7 +205,7 @@ class WC_Admin_Notices {
|
|||
$notice_html = get_option( 'woocommerce_admin_notice_' . $notice );
|
||||
|
||||
if ( $notice_html ) {
|
||||
include 'views/html-notice-custom.php';
|
||||
include dirname( __FILE__ ) . '/views/html-notice-custom.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,13 +218,13 @@ class WC_Admin_Notices {
|
|||
public static function update_notice() {
|
||||
if ( version_compare( get_option( 'woocommerce_db_version' ), WC_VERSION, '<' ) ) {
|
||||
$updater = new WC_Background_Updater();
|
||||
if ( $updater->is_updating() || ! empty( $_GET['do_update_woocommerce'] ) ) {
|
||||
include 'views/html-notice-updating.php';
|
||||
if ( $updater->is_updating() || ! empty( $_GET['do_update_woocommerce'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
include dirname( __FILE__ ) . '/views/html-notice-updating.php';
|
||||
} else {
|
||||
include 'views/html-notice-update.php';
|
||||
include dirname( __FILE__ ) . '/views/html-notice-update.php';
|
||||
}
|
||||
} else {
|
||||
include 'views/html-notice-updated.php';
|
||||
include dirname( __FILE__ ) . '/views/html-notice-updated.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +232,7 @@ class WC_Admin_Notices {
|
|||
* If we have just installed, show a message with the install pages button.
|
||||
*/
|
||||
public static function install_notice() {
|
||||
include 'views/html-notice-install.php';
|
||||
include dirname( __FILE__ ) . '/views/html-notice-install.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -228,7 +244,7 @@ class WC_Admin_Notices {
|
|||
wc_deprecated_function( 'WC_Admin_Notices::theme_check_notice', '3.3.0' );
|
||||
|
||||
if ( ! current_theme_supports( 'woocommerce' ) ) {
|
||||
include 'views/html-notice-theme-support.php';
|
||||
include dirname( __FILE__ ) . '/views/html-notice-theme-support.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,7 +280,7 @@ class WC_Admin_Notices {
|
|||
}
|
||||
|
||||
if ( $outdated ) {
|
||||
include 'views/html-notice-template-check.php';
|
||||
include dirname( __FILE__ ) . '/views/html-notice-template-check.php';
|
||||
} else {
|
||||
self::remove_notice( 'template_files' );
|
||||
}
|
||||
|
@ -285,7 +301,7 @@ class WC_Admin_Notices {
|
|||
}
|
||||
|
||||
if ( $enabled ) {
|
||||
include 'views/html-notice-legacy-shipping.php';
|
||||
include dirname( __FILE__ ) . '/views/html-notice-legacy-shipping.php';
|
||||
} else {
|
||||
self::remove_notice( 'template_files' );
|
||||
}
|
||||
|
@ -295,12 +311,12 @@ class WC_Admin_Notices {
|
|||
* No shipping methods.
|
||||
*/
|
||||
public static function no_shipping_methods_notice() {
|
||||
if ( wc_shipping_enabled() && ( empty( $_GET['page'] ) || empty( $_GET['tab'] ) || 'wc-settings' !== $_GET['page'] || 'shipping' !== $_GET['tab'] ) ) {
|
||||
if ( wc_shipping_enabled() && ( empty( $_GET['page'] ) || empty( $_GET['tab'] ) || 'wc-settings' !== $_GET['page'] || 'shipping' !== $_GET['tab'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
$product_count = wp_count_posts( 'product' );
|
||||
$method_count = wc_get_shipping_method_count();
|
||||
|
||||
if ( $product_count->publish > 0 && 0 === $method_count ) {
|
||||
include 'views/html-notice-no-shipping-methods.php';
|
||||
include dirname( __FILE__ ) . '/views/html-notice-no-shipping-methods.php';
|
||||
}
|
||||
|
||||
if ( $method_count > 0 ) {
|
||||
|
@ -315,12 +331,12 @@ class WC_Admin_Notices {
|
|||
public static function simplify_commerce_notice() {
|
||||
$location = wc_get_base_location();
|
||||
|
||||
if ( class_exists( 'WC_Gateway_Simplify_Commerce_Loader' ) || ! in_array( $location['country'], apply_filters( 'woocommerce_gateway_simplify_commerce_supported_countries', array( 'US', 'IE' ) ) ) ) {
|
||||
if ( class_exists( 'WC_Gateway_Simplify_Commerce_Loader' ) || ! in_array( $location['country'], apply_filters( 'woocommerce_gateway_simplify_commerce_supported_countries', array( 'US', 'IE' ) ), true ) ) {
|
||||
self::remove_notice( 'simplify_commerce' );
|
||||
return;
|
||||
}
|
||||
if ( empty( $_GET['action'] ) ) {
|
||||
include 'views/html-notice-simplify-commerce.php';
|
||||
if ( empty( $_GET['action'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
include dirname( __FILE__ ) . '/views/html-notice-simplify-commerce.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,7 +344,18 @@ class WC_Admin_Notices {
|
|||
* Notice shown when regenerating thumbnails background process is running.
|
||||
*/
|
||||
public static function regenerating_thumbnails_notice() {
|
||||
include 'views/html-notice-regenerating-thumbnails.php';
|
||||
include dirname( __FILE__ ) . '/views/html-notice-regenerating-thumbnails.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Notice about secure connection.
|
||||
*/
|
||||
public static function secure_connection_notice() {
|
||||
if ( get_user_meta( get_current_user_id(), 'dismissed_no_secure_connection_notice', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
include dirname( __FILE__ ) . '/views/html-notice-secure-connection.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -828,7 +828,7 @@ class WC_Admin_Post_Types {
|
|||
public function hide_cpt_archive_templates( $page_templates, $theme, $post ) {
|
||||
$shop_page_id = wc_get_page_id( 'shop' );
|
||||
|
||||
if ( $post && absint( $shop_page_id ) === absint( $post->ID ) ) {
|
||||
if ( $post && $shop_page_id === absint( $post->ID ) ) {
|
||||
$page_templates = array();
|
||||
}
|
||||
|
||||
|
@ -843,7 +843,7 @@ class WC_Admin_Post_Types {
|
|||
public function show_cpt_archive_notice( $post ) {
|
||||
$shop_page_id = wc_get_page_id( 'shop' );
|
||||
|
||||
if ( $post && absint( $shop_page_id ) === absint( $post->ID ) ) {
|
||||
if ( $post && $shop_page_id === absint( $post->ID ) ) {
|
||||
echo '<div class="notice notice-info">';
|
||||
echo '<p>' . sprintf( wp_kses_post( __( 'This is the WooCommerce shop page. The shop page is a special archive that lists your products. <a href="%s">You can read more about this here</a>.', 'woocommerce' ) ), 'https://docs.woocommerce.com/document/woocommerce-pages/#section-4' ) . '</p>';
|
||||
echo '</div>';
|
||||
|
|
|
@ -51,11 +51,11 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
$settings[] = include 'settings/class-wc-settings-products.php';
|
||||
$settings[] = include 'settings/class-wc-settings-tax.php';
|
||||
$settings[] = include 'settings/class-wc-settings-shipping.php';
|
||||
$settings[] = include 'settings/class-wc-settings-checkout.php';
|
||||
$settings[] = include 'settings/class-wc-settings-payment-gateways.php';
|
||||
$settings[] = include 'settings/class-wc-settings-accounts.php';
|
||||
$settings[] = include 'settings/class-wc-settings-emails.php';
|
||||
$settings[] = include 'settings/class-wc-settings-integrations.php';
|
||||
$settings[] = include 'settings/class-wc-settings-rest-api.php';
|
||||
$settings[] = include 'settings/class-wc-settings-advanced.php';
|
||||
|
||||
self::$settings = apply_filters( 'woocommerce_get_settings_pages', $settings );
|
||||
}
|
||||
|
@ -285,8 +285,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
|
||||
?><tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
|
||||
<?php echo $tooltip_html; // WPCS: XSS ok. ?>
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">
|
||||
<input
|
||||
|
@ -311,8 +310,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
|
||||
<?php echo $tooltip_html; // WPCS: XSS ok. ?>
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">‎
|
||||
<span class="colorpickpreview" style="background: <?php echo esc_attr( $option_value ); ?>"></span>
|
||||
|
@ -340,8 +338,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
|
||||
<?php echo $tooltip_html; // WPCS: XSS ok. ?>
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">
|
||||
<?php echo $description; // WPCS: XSS ok. ?>
|
||||
|
@ -367,8 +364,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
|
||||
<?php echo $tooltip_html; // WPCS: XSS ok. ?>
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">
|
||||
<select
|
||||
|
@ -410,8 +406,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
|
||||
<?php echo $tooltip_html; // WPCS: XSS ok. ?>
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">
|
||||
<fieldset>
|
||||
|
@ -548,6 +543,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
'class' => $value['class'],
|
||||
'echo' => false,
|
||||
'selected' => absint( self::get_option( $value['id'], $value['default'] ) ),
|
||||
'post_status' => 'publish,private,draft',
|
||||
);
|
||||
|
||||
if ( isset( $value['args'] ) ) {
|
||||
|
@ -579,8 +575,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
|
||||
<?php echo $tooltip_html; // WPCS: XSS ok. ?>
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp"><select name="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" data-placeholder="<?php esc_attr_e( 'Choose a country…', 'woocommerce' ); ?>" aria-label="<?php esc_attr_e( 'Country', 'woocommerce' ); ?>" class="wc-enhanced-select">
|
||||
<?php WC()->countries->country_dropdown_options( $country, $state ); ?>
|
||||
|
@ -604,15 +599,14 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
|
||||
<?php echo $tooltip_html; // WPCS: XSS ok. ?>
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select multiple="multiple" name="<?php echo esc_attr( $value['id'] ); ?>[]" style="width:350px" data-placeholder="<?php esc_attr_e( 'Choose countries…', 'woocommerce' ); ?>" aria-label="<?php esc_attr_e( 'Country', 'woocommerce' ); ?>" class="wc-enhanced-select">
|
||||
<?php
|
||||
if ( ! empty( $countries ) ) {
|
||||
foreach ( $countries as $key => $val ) {
|
||||
echo '<option value="' . esc_attr( $key ) . '" ' . selected( in_array( $key, $selections, true ), true, false ) . '>' . esc_html( $val ) . '</option>';
|
||||
echo '<option value="' . esc_attr( $key ) . '"' . wc_selected( $key, $selections ) . '>' . esc_html( $val ) . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -622,6 +616,45 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
<?php
|
||||
break;
|
||||
|
||||
// Days/months/years selector.
|
||||
case 'relative_date_selector':
|
||||
$periods = array(
|
||||
'days' => __( 'Day(s)', 'woocommerce' ),
|
||||
'weeks' => __( 'Week(s)', 'woocommerce' ),
|
||||
'months' => __( 'Month(s)', 'woocommerce' ),
|
||||
'years' => __( 'Year(s)', 'woocommerce' ),
|
||||
);
|
||||
$option_value = wc_parse_relative_date_option( self::get_option( $value['id'], $value['default'] ) );
|
||||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input
|
||||
name="<?php echo esc_attr( $value['id'] ); ?>[number]"
|
||||
id="<?php echo esc_attr( $value['id'] ); ?>"
|
||||
type="number"
|
||||
style="width: 80px;"
|
||||
value="<?php echo esc_attr( $option_value['number'] ); ?>"
|
||||
class="<?php echo esc_attr( $value['class'] ); ?>"
|
||||
placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>"
|
||||
step="1"
|
||||
min="1"
|
||||
<?php echo implode( ' ', $custom_attributes ); // WPCS: XSS ok. ?>
|
||||
/>
|
||||
<select name="<?php echo esc_attr( $value['id'] ); ?>[unit]" style="width: auto;">
|
||||
<?php
|
||||
foreach ( $periods as $value => $label ) {
|
||||
echo '<option value="' . esc_attr( $value ) . '"' . selected( $option_value['unit'], $value, false ) . '>' . esc_html( $label ) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select> <?php echo ( $description ) ? $description : ''; // WPCS: XSS ok. ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
break;
|
||||
|
||||
// Default: run an action.
|
||||
default:
|
||||
do_action( 'woocommerce_admin_field_' . $value['type'], $value );
|
||||
|
@ -742,6 +775,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
$default = ( empty( $option['default'] ) ? $allowed_values[0] : $option['default'] );
|
||||
$value = in_array( $raw_value, $allowed_values, true ) ? $raw_value : $default;
|
||||
break;
|
||||
case 'relative_date_selector':
|
||||
$value = wc_parse_relative_date_option( $raw_value );
|
||||
break;
|
||||
default:
|
||||
$value = wc_clean( $raw_value );
|
||||
break;
|
||||
|
|
|
@ -71,7 +71,7 @@ class WC_Admin_Setup_Wizard {
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function should_show_theme_extra() {
|
||||
protected function should_show_theme() {
|
||||
$support_woocommerce = current_theme_supports( 'woocommerce' ) && ! $this->is_default_theme();
|
||||
|
||||
return (
|
||||
|
@ -106,7 +106,7 @@ class WC_Admin_Setup_Wizard {
|
|||
* The "automated tax" extra should only be shown if the current user can
|
||||
* install plugins and the store is in a supported country.
|
||||
*/
|
||||
protected function should_show_automated_tax_extra() {
|
||||
protected function should_show_automated_tax() {
|
||||
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -121,6 +121,28 @@ class WC_Admin_Setup_Wizard {
|
|||
return in_array( $country_code, $tax_supported_countries, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we show the MailChimp install option?
|
||||
* True only if the user can install plugins.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function should_show_mailchimp() {
|
||||
return current_user_can( 'install_plugins' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we display the 'Recommended' step?
|
||||
* True if at least one of the recommendations will be displayed.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function should_show_recommended_step() {
|
||||
return $this->should_show_theme()
|
||||
|| $this->should_show_automated_tax()
|
||||
|| $this->should_show_mailchimp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the setup wizard.
|
||||
*/
|
||||
|
@ -144,10 +166,10 @@ class WC_Admin_Setup_Wizard {
|
|||
'view' => array( $this, 'wc_setup_shipping' ),
|
||||
'handler' => array( $this, 'wc_setup_shipping_save' ),
|
||||
),
|
||||
'extras' => array(
|
||||
'name' => __( 'Extras', 'woocommerce' ),
|
||||
'view' => array( $this, 'wc_setup_extras' ),
|
||||
'handler' => array( $this, 'wc_setup_extras_save' ),
|
||||
'recommended' => array(
|
||||
'name' => __( 'Recommended', 'woocommerce' ),
|
||||
'view' => array( $this, 'wc_setup_recommended' ),
|
||||
'handler' => array( $this, 'wc_setup_recommended_save' ),
|
||||
),
|
||||
'activate' => array(
|
||||
'name' => __( 'Activate', 'woocommerce' ),
|
||||
|
@ -161,9 +183,9 @@ class WC_Admin_Setup_Wizard {
|
|||
),
|
||||
);
|
||||
|
||||
// Hide the extras step if this store/user isn't eligible for them.
|
||||
if ( ! $this->should_show_theme_extra() && ! $this->should_show_automated_tax_extra() ) {
|
||||
unset( $default_steps['extras'] );
|
||||
// Hide recommended step if nothing is going to be shown there.
|
||||
if ( ! $this->should_show_recommended_step() ) {
|
||||
unset( $default_steps['recommended'] );
|
||||
}
|
||||
|
||||
// Hide shipping step if the store is selling digital products only.
|
||||
|
@ -209,6 +231,7 @@ class WC_Admin_Setup_Wizard {
|
|||
'wc_setup_params',
|
||||
array(
|
||||
'pending_jetpack_install' => $pending_jetpack ? 'yes' : 'no',
|
||||
'states' => WC()->countries->get_states(),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -280,7 +303,7 @@ class WC_Admin_Setup_Wizard {
|
|||
?>
|
||||
<?php if ( 'store_setup' === $this->step ) : ?>
|
||||
<a class="wc-setup-footer-links" href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Not right now', 'woocommerce' ); ?></a>
|
||||
<?php elseif ( 'activate' === $this->step ) : ?>
|
||||
<?php elseif ( 'recommended' === $this->step || 'activate' === $this->step ) : ?>
|
||||
<a class="wc-setup-footer-links" href="<?php echo esc_url( $this->get_next_step_link() ); ?>"><?php esc_html_e( 'Skip this step', 'woocommerce' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
|
@ -358,8 +381,6 @@ class WC_Admin_Setup_Wizard {
|
|||
$user_location = WC_Geolocation::geolocate_ip();
|
||||
$country = $user_location['country'];
|
||||
$state = $user_location['state'];
|
||||
} elseif ( empty( $state ) ) {
|
||||
$state = '*';
|
||||
}
|
||||
|
||||
$locale_info = include WC()->plugin_path() . '/i18n/locale-info.php';
|
||||
|
@ -368,75 +389,43 @@ class WC_Admin_Setup_Wizard {
|
|||
<form method="post" class="address-step">
|
||||
<?php wp_nonce_field( 'wc-setup' ); ?>
|
||||
<p class="store-setup"><?php esc_html_e( 'The following wizard will help you configure your store and get you started quickly.', 'woocommerce' ); ?></p>
|
||||
<label for="store_country_state" class="location-prompt">
|
||||
<?php esc_html_e( 'Where is your store based?', 'woocommerce' ); ?>
|
||||
</label>
|
||||
<select
|
||||
id="store_country_state"
|
||||
name="store_country_state"
|
||||
required
|
||||
data-placeholder="<?php esc_attr_e( 'Choose a country…', 'woocommerce' ); ?>"
|
||||
aria-label="<?php esc_attr_e( 'Country', 'woocommerce' ); ?>"
|
||||
class="location-input wc-enhanced-select dropdown"
|
||||
>
|
||||
<?php WC()->countries->country_dropdown_options( $country, $state ); ?>
|
||||
</select>
|
||||
|
||||
<div class="store-address-container">
|
||||
<label class="location-prompt" for="store_address">
|
||||
<?php esc_html_e( 'Address', 'woocommerce' ); ?>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="store_address"
|
||||
class="location-input"
|
||||
name="store_address"
|
||||
required
|
||||
value="<?php echo esc_attr( $address ); ?>"
|
||||
/>
|
||||
<label class="location-prompt" for="store_address_2">
|
||||
<?php esc_html_e( 'Address line 2', 'woocommerce' ); ?>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="store_address_2"
|
||||
class="location-input"
|
||||
name="store_address_2"
|
||||
value="<?php echo esc_attr( $address_2 ); ?>"
|
||||
/>
|
||||
<div class="city-and-postcode">
|
||||
<div>
|
||||
<label class="location-prompt" for="store_city">
|
||||
<?php esc_html_e( 'City', 'woocommerce' ); ?>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="store_city"
|
||||
class="location-input"
|
||||
name="store_city"
|
||||
required
|
||||
value="<?php echo esc_attr( $city ); ?>"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="location-prompt" for="store_postcode">
|
||||
<?php esc_html_e( 'Postcode / ZIP', 'woocommerce' ); ?>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="store_postcode"
|
||||
class="location-input"
|
||||
name="store_postcode"
|
||||
required
|
||||
value="<?php echo esc_attr( $postcode ); ?>"
|
||||
/>
|
||||
|
||||
<label for="store_country" class="location-prompt"><?php esc_html_e( 'Where is your store based?', 'woocommerce' ); ?></label>
|
||||
<select id="store_country" name="store_country" required data-placeholder="<?php esc_attr_e( 'Choose a country…', 'woocommerce' ); ?>" aria-label="<?php esc_attr_e( 'Country', 'woocommerce' ); ?>" class="location-input wc-enhanced-select dropdown">
|
||||
<?php foreach ( WC()->countries->get_countries() as $code => $label ) : ?>
|
||||
<option <?php selected( $code, $country ); ?> value="<?php echo esc_attr( $code ); ?>"><?php echo esc_html( $label ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
<label class="location-prompt" for="store_address"><?php esc_html_e( 'Address', 'woocommerce' ); ?></label>
|
||||
<input type="text" id="store_address" class="location-input" name="store_address" required value="<?php echo esc_attr( $address ); ?>" />
|
||||
|
||||
<label class="location-prompt" for="store_address_2"><?php esc_html_e( 'Address line 2', 'woocommerce' ); ?></label>
|
||||
<input type="text" id="store_address_2" class="location-input" name="store_address_2" value="<?php echo esc_attr( $address_2 ); ?>" />
|
||||
|
||||
<div class="city-and-postcode">
|
||||
<div>
|
||||
<label class="location-prompt" for="store_city"><?php esc_html_e( 'City', 'woocommerce' ); ?></label>
|
||||
<input type="text" id="store_city" class="location-input" name="store_city" required value="<?php echo esc_attr( $city ); ?>" />
|
||||
</div>
|
||||
<div class="store-state-container hidden">
|
||||
<label for="store_state" class="location-prompt">
|
||||
<?php esc_html_e( 'State', 'woocommerce' ); ?>
|
||||
</label>
|
||||
<select id="store_state" name="store_state" data-placeholder="<?php esc_attr_e( 'Choose a state…', 'woocommerce' ); ?>" aria-label="<?php esc_attr_e( 'State', 'woocommerce' ); ?>" class="location-input wc-enhanced-select dropdown"></select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="location-prompt" for="store_postcode"><?php esc_html_e( 'Postcode / ZIP', 'woocommerce' ); ?></label>
|
||||
<input type="text" id="store_postcode" class="location-input" name="store_postcode" required value="<?php echo esc_attr( $postcode ); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="store-currency-container">
|
||||
<label class="location-prompt" for="currency_code">
|
||||
<?php esc_html_e( 'What currency do you use?', 'woocommerce' ); ?>
|
||||
<?php esc_html_e( 'What currency do you accept payments in?', 'woocommerce' ); ?>
|
||||
</label>
|
||||
<select
|
||||
id="currency_code"
|
||||
|
@ -449,27 +438,30 @@ class WC_Admin_Setup_Wizard {
|
|||
<?php foreach ( get_woocommerce_currencies() as $code => $name ) : ?>
|
||||
<option value="<?php echo esc_attr( $code ); ?>" <?php selected( $currency, $code ); ?>>
|
||||
<?php
|
||||
$symbol = get_woocommerce_currency_symbol( $code );
|
||||
|
||||
if ( $symbol === $code ) {
|
||||
/* translators: 1: currency name 2: currency code */
|
||||
echo esc_html( sprintf( __( '%1$s (%2$s)', 'woocommerce' ), $name, get_woocommerce_currency_symbol( $code ) ) );
|
||||
echo esc_html( sprintf( __( '%1$s (%2$s)', 'woocommerce' ), $name, $code ) );
|
||||
} else {
|
||||
/* translators: 1: currency name 2: currency symbol, 3: currency code */
|
||||
echo esc_html( sprintf( __( '%1$s (%2$s / %3$s)', 'woocommerce' ), $name, get_woocommerce_currency_symbol( $code ), $code ) );
|
||||
}
|
||||
?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<script type="text/javascript">
|
||||
var wc_setup_currencies = <?php echo wp_json_encode( $currency_by_country ); ?>;
|
||||
var wc_base_state = "<?php echo esc_js( $state ); ?>";
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="product-type-container">
|
||||
<label class="location-prompt" for="product_type">
|
||||
<?php esc_html_e( 'What type of product do you plan to sell?', 'woocommerce' ); ?>
|
||||
<?php esc_html_e( 'What type of products do you plan to sell?', 'woocommerce' ); ?>
|
||||
</label>
|
||||
<select
|
||||
id="product_type"
|
||||
name="product_type"
|
||||
required
|
||||
class="location-input wc-enhanced-select dropdown"
|
||||
>
|
||||
<select id="product_type" name="product_type" required class="location-input wc-enhanced-select dropdown">
|
||||
<option value="both" <?php selected( $product_type, 'both' ); ?>><?php esc_html_e( 'I plan to sell both physical and digital products', 'woocommerce' ); ?></option>
|
||||
<option value="physical" <?php selected( $product_type, 'physical' ); ?>><?php esc_html_e( 'I plan to sell physical products', 'woocommerce' ); ?></option>
|
||||
<option value="virtual" <?php selected( $product_type, 'virtual' ); ?>><?php esc_html_e( 'I plan to sell digital products', 'woocommerce' ); ?></option>
|
||||
|
@ -521,39 +513,46 @@ class WC_Admin_Setup_Wizard {
|
|||
$address = sanitize_text_field( $_POST['store_address'] );
|
||||
$address_2 = sanitize_text_field( $_POST['store_address_2'] );
|
||||
$city = sanitize_text_field( $_POST['store_city'] );
|
||||
$country_state = sanitize_text_field( $_POST['store_country_state'] );
|
||||
$country = sanitize_text_field( $_POST['store_country'] );
|
||||
$state = sanitize_text_field( $_POST['store_state'] );
|
||||
$postcode = sanitize_text_field( $_POST['store_postcode'] );
|
||||
$currency_code = sanitize_text_field( $_POST['currency_code'] );
|
||||
$product_type = sanitize_text_field( $_POST['product_type'] );
|
||||
$sell_in_person = isset( $_POST['sell_in_person'] ) && ( 'yes' === sanitize_text_field( $_POST['sell_in_person'] ) );
|
||||
$tracking = isset( $_POST['wc_tracker_checkbox'] ) && ( 'yes' === sanitize_text_field( $_POST['wc_tracker_checkbox'] ) );
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
if ( ! $state ) {
|
||||
$state = '*';
|
||||
}
|
||||
|
||||
update_option( 'woocommerce_store_address', $address );
|
||||
update_option( 'woocommerce_store_address_2', $address_2 );
|
||||
update_option( 'woocommerce_store_city', $city );
|
||||
update_option( 'woocommerce_default_country', $country_state );
|
||||
update_option( 'woocommerce_default_country', $country . ':' . $state );
|
||||
update_option( 'woocommerce_store_postcode', $postcode );
|
||||
update_option( 'woocommerce_currency', $currency_code );
|
||||
update_option( 'woocommerce_product_type', $product_type );
|
||||
update_option( 'woocommerce_sell_in_person', $sell_in_person );
|
||||
|
||||
$locale_info = include WC()->plugin_path() . '/i18n/locale-info.php';
|
||||
$country = WC()->countries->get_base_country();
|
||||
|
||||
// Set currency formatting options based on chosen location and currency.
|
||||
if (
|
||||
isset( $locale_info[ $country ] ) &&
|
||||
$locale_info[ $country ]['currency_code'] === $currency_code
|
||||
) {
|
||||
update_option( 'woocommerce_currency_pos', $locale_info[ $country ]['currency_pos'] );
|
||||
update_option( 'woocommerce_price_decimal_sep', $locale_info[ $country ]['decimal_sep'] );
|
||||
update_option( 'woocommerce_price_num_decimals', $locale_info[ $country ]['num_decimals'] );
|
||||
update_option( 'woocommerce_price_thousand_sep', $locale_info[ $country ]['thousand_sep'] );
|
||||
if ( isset( $locale_info[ $country ] ) ) {
|
||||
update_option( 'woocommerce_weight_unit', $locale_info[ $country ]['weight_unit'] );
|
||||
update_option( 'woocommerce_dimension_unit', $locale_info[ $country ]['dimension_unit'] );
|
||||
|
||||
// Set currency formatting options based on chosen location and currency.
|
||||
if ( $locale_info[ $country ]['currency_code'] === $currency_code ) {
|
||||
update_option( 'woocommerce_currency_pos', $locale_info[ $country ]['currency_pos'] );
|
||||
update_option( 'woocommerce_price_decimal_sep', $locale_info[ $country ]['decimal_sep'] );
|
||||
update_option( 'woocommerce_price_num_decimals', $locale_info[ $country ]['num_decimals'] );
|
||||
update_option( 'woocommerce_price_thousand_sep', $locale_info[ $country ]['thousand_sep'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tracking ) {
|
||||
update_option( 'woocommerce_allow_tracking', 'yes' );
|
||||
WC_Tracker::send_tracking_data( true );
|
||||
wp_schedule_single_event( time() + 10, 'woocommerce_tracker_send_event', array( true ) );
|
||||
} else {
|
||||
update_option( 'woocommerce_allow_tracking', 'no' );
|
||||
}
|
||||
|
@ -617,7 +616,7 @@ class WC_Admin_Setup_Wizard {
|
|||
* Helper method to queue the background install of a plugin.
|
||||
*
|
||||
* @param string $plugin_id Plugin id used for background install.
|
||||
* @param array $plugin_info Plugin info array containing at least main file and repo slug.
|
||||
* @param array $plugin_info Plugin info array containing name and repo-slug, and optionally file if different from [repo-slug].php.
|
||||
*/
|
||||
protected function install_plugin( $plugin_id, $plugin_info ) {
|
||||
// Make sure we don't trigger multiple simultaneous installs.
|
||||
|
@ -625,7 +624,8 @@ class WC_Admin_Setup_Wizard {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( ! empty( $plugin_info['file'] ) && is_plugin_active( $plugin_info['file'] ) ) {
|
||||
$plugin_file = isset( $plugin_info['file'] ) ? $plugin_info['file'] : $plugin_info['repo-slug'] . '.php';
|
||||
if ( is_plugin_active( $plugin_info['repo-slug'] . '/' . $plugin_file ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -671,7 +671,6 @@ class WC_Admin_Setup_Wizard {
|
|||
$this->install_plugin(
|
||||
'jetpack',
|
||||
array(
|
||||
'file' => 'jetpack/jetpack.php',
|
||||
'name' => __( 'Jetpack', 'woocommerce' ),
|
||||
'repo-slug' => 'jetpack',
|
||||
)
|
||||
|
@ -686,7 +685,6 @@ class WC_Admin_Setup_Wizard {
|
|||
$this->install_plugin(
|
||||
'woocommerce-services',
|
||||
array(
|
||||
'file' => 'woocommerce-services/woocommerce-services.php',
|
||||
'name' => __( 'WooCommerce Services', 'woocommerce' ),
|
||||
'repo-slug' => 'woocommerce-services',
|
||||
)
|
||||
|
@ -822,19 +820,6 @@ class WC_Admin_Setup_Wizard {
|
|||
$existing_zones = WC_Shipping_Zones::get_zones();
|
||||
$dimension_unit = get_option( 'woocommerce_dimension_unit' );
|
||||
$weight_unit = get_option( 'woocommerce_weight_unit' );
|
||||
$locale_info = include WC()->plugin_path() . '/i18n/locale-info.php';
|
||||
|
||||
if ( ! $weight_unit && isset( $locale_info[ $country_code ] ) ) {
|
||||
$weight_unit = $locale_info[ $country_code ]['weight_unit'];
|
||||
} else {
|
||||
$weight_unit = $weight_unit ? $weight_unit : 'kg';
|
||||
}
|
||||
|
||||
if ( ! $dimension_unit && isset( $locale_info[ $country_code ] ) ) {
|
||||
$dimension_unit = $locale_info[ $country_code ]['dimension_unit'];
|
||||
} else {
|
||||
$dimension_unit = $dimension_unit ? $dimension_unit : 'cm';
|
||||
}
|
||||
|
||||
if ( ! empty( $existing_zones ) ) {
|
||||
$intro_text = __( 'How would you like units on your store displayed?', 'woocommerce' );
|
||||
|
@ -1135,6 +1120,19 @@ class WC_Admin_Setup_Wizard {
|
|||
return in_array( $country_code, $square_supported_countries, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Is eWAY Payments country supported
|
||||
*
|
||||
* @param string $country_code Country code.
|
||||
*/
|
||||
protected function is_eway_payments_supported_country( $country_code ) {
|
||||
$supported_countries = array(
|
||||
'AU', // Australia.
|
||||
'NZ', // New Zealand.
|
||||
);
|
||||
return in_array( $country_code, $supported_countries, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to retrieve the current user's email address.
|
||||
*
|
||||
|
@ -1269,6 +1267,23 @@ class WC_Admin_Setup_Wizard {
|
|||
'enabled' => true,
|
||||
'repo-slug' => 'woocommerce-square',
|
||||
),
|
||||
'eway' => array(
|
||||
'name' => __( 'eWAY', 'woocommerce' ),
|
||||
'description' => __( 'The eWAY extension for WooCommerce allows you to take credit card payments directly on your store without redirecting your customers to a third party site to make payment.', 'woocommerce' ),
|
||||
'image' => WC()->plugin_url() . '/assets/images/eway-logo.jpg',
|
||||
'enabled' => false,
|
||||
'class' => 'eway-logo',
|
||||
'repo-slug' => 'woocommerce-gateway-eway',
|
||||
),
|
||||
'payfast' => array(
|
||||
'name' => __( 'PayFast', 'woocommerce' ),
|
||||
'description' => __( 'The PayFast extension for WooCommerce enables you to accept payments by Credit Card and EFT via one of South Africa’s most popular payment gateways. No setup fees or monthly subscription costs.', 'woocommerce' ),
|
||||
'image' => WC()->plugin_url() . '/assets/images/payfast.png',
|
||||
'class' => 'payfast-logo',
|
||||
'enabled' => false,
|
||||
'repo-slug' => 'woocommerce-gateway-payfast',
|
||||
'file' => 'gateway-payfast.php',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1284,8 +1299,10 @@ class WC_Admin_Setup_Wizard {
|
|||
return array( 'paypal' => $gateways['paypal'] );
|
||||
}
|
||||
|
||||
$country = WC()->countries->get_base_country();
|
||||
$can_stripe = $this->is_stripe_supported_country( $country );
|
||||
$country = WC()->countries->get_base_country();
|
||||
$can_stripe = $this->is_stripe_supported_country( $country );
|
||||
$can_eway = $this->is_eway_payments_supported_country( $country );
|
||||
$can_payfast = ( 'ZA' === $country ); // South Africa.
|
||||
|
||||
if ( $this->is_klarna_checkout_supported_country( $country ) ) {
|
||||
$spotlight = 'klarna_checkout';
|
||||
|
@ -1300,19 +1317,40 @@ class WC_Admin_Setup_Wizard {
|
|||
$spotlight => $gateways[ $spotlight ],
|
||||
'ppec_paypal' => $gateways['ppec_paypal'],
|
||||
);
|
||||
|
||||
if ( $can_stripe ) {
|
||||
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
|
||||
}
|
||||
|
||||
if ( $can_eway ) {
|
||||
$offered_gateways += array( 'eway' => $gateways['eway'] );
|
||||
}
|
||||
|
||||
if ( $can_payfast ) {
|
||||
$offered_gateways += array( 'payfast' => $gateways['payfast'] );
|
||||
}
|
||||
|
||||
return $offered_gateways;
|
||||
}
|
||||
|
||||
$offered_gateways = array();
|
||||
|
||||
if ( $can_stripe ) {
|
||||
$gateways['stripe']['enabled'] = true;
|
||||
$gateways['stripe']['featured'] = true;
|
||||
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
|
||||
}
|
||||
|
||||
$offered_gateways += array( 'ppec_paypal' => $gateways['ppec_paypal'] );
|
||||
|
||||
if ( $can_eway ) {
|
||||
$offered_gateways += array( 'eway' => $gateways['eway'] );
|
||||
}
|
||||
|
||||
if ( $can_payfast ) {
|
||||
$offered_gateways += array( 'payfast' => $gateways['payfast'] );
|
||||
}
|
||||
|
||||
return $offered_gateways;
|
||||
}
|
||||
|
||||
|
@ -1583,74 +1621,100 @@ class WC_Admin_Setup_Wizard {
|
|||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extras.
|
||||
*/
|
||||
public function wc_setup_extras() {
|
||||
protected function display_recommended_item( $item_info ) {
|
||||
$type = $item_info['type'];
|
||||
$title = $item_info['title'];
|
||||
$description = $item_info['description'];
|
||||
$img_url = $item_info['img_url'];
|
||||
$img_alt = $item_info['img_alt'];
|
||||
?>
|
||||
<h1><?php esc_html_e( 'Recommended Extras', 'woocommerce' ); ?></h1>
|
||||
<li>
|
||||
<label class="recommended-item">
|
||||
<input
|
||||
class="recommended-item-checkbox"
|
||||
type="checkbox"
|
||||
name="<?php echo esc_attr( 'setup_' . $type ); ?>"
|
||||
value="yes"
|
||||
checked />
|
||||
<img
|
||||
src="<?php echo esc_url( $img_url ); ?>"
|
||||
class="<?php echo esc_attr( 'recommended-item-icon-' . $type ); ?> recommended-item-icon"
|
||||
alt="<?php echo esc_attr( $img_alt ); ?>" />
|
||||
<div class="recommended-item-description-container">
|
||||
<h3><?php echo esc_html( $title ); ?></h3>
|
||||
<p><?php echo wp_kses( $description, array(
|
||||
'a' => array(
|
||||
'href' => array(),
|
||||
'target' => array(),
|
||||
'rel' => array(),
|
||||
),
|
||||
'em' => array(),
|
||||
) ); ?></p>
|
||||
</div>
|
||||
</label>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Recommended step
|
||||
*/
|
||||
public function wc_setup_recommended() {
|
||||
?>
|
||||
<h1><?php esc_html_e( 'Recommended for All WooCommerce Stores', 'woocommerce' ); ?></h1>
|
||||
<p><?php
|
||||
// If we're displaying all of the recommended features, show the full description. Otherwise, display a placeholder.
|
||||
// We're not translating all of the different permutations to save on translations,
|
||||
// and the default is the most common.
|
||||
if (
|
||||
$this->should_show_theme()
|
||||
&& $this->should_show_automated_tax()
|
||||
&& $this->should_show_mailchimp()
|
||||
) :
|
||||
esc_html_e( 'Select from the list below to enable automated taxes and MailChimp’s best-in-class email services — and design your store with our official, free WooCommerce theme.', 'woocommerce' );
|
||||
else :
|
||||
esc_html_e( 'Enhance your store with these recommended features.', 'woocommerce' );
|
||||
endif;
|
||||
?></p>
|
||||
<form method="post">
|
||||
<?php if ( $this->should_show_theme_extra() ) : ?>
|
||||
<ul class="wc-wizard-services featured">
|
||||
<li class="wc-wizard-service-item">
|
||||
<div class="wc-wizard-service-description">
|
||||
<h3><?php esc_html_e( 'Storefront Theme', 'woocommerce' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
$theme = wp_get_theme();
|
||||
$theme_name = $theme['Name'];
|
||||
<ul class="recommended-step">
|
||||
<?php
|
||||
if ( $this->should_show_theme() ) :
|
||||
$theme = wp_get_theme();
|
||||
$theme_name = $theme['Name'];
|
||||
$this->display_recommended_item( array(
|
||||
'type' => 'storefront_theme',
|
||||
'title' => __( 'Storefront Theme', 'woocommerce' ),
|
||||
'description' => sprintf( __(
|
||||
'Design your store with deep WooCommerce integration. If toggled on, we’ll install <a href="https://woocommerce.com/storefront/" target="_blank" rel="noopener noreferrer">Storefront</a>, and your current theme <em>%s</em> will be deactivated.', 'woocommerce' ),
|
||||
$theme_name
|
||||
),
|
||||
'img_url' => WC()->plugin_url() . '/assets/images/obw-storefront-icon.svg',
|
||||
'img_alt' => __( 'Storefront icon', 'woocommerce' ),
|
||||
) );
|
||||
endif;
|
||||
|
||||
if ( $this->is_default_theme() ) {
|
||||
echo wp_kses_post( sprintf( __( 'The theme you are currently using is not optimized for WooCommerce. We recommend you switch to <a href="%s" title="Learn more about Storefront" target="_blank">Storefront</a>; our official, free, WooCommerce theme.', 'woocommerce' ), esc_url( 'https://woocommerce.com/storefront/' ) ) );
|
||||
} else {
|
||||
echo wp_kses_post( sprintf( __( 'The theme you are currently using does not fully support WooCommerce. We recommend you switch to <a href="%s" title="Learn more about Storefront" target="_blank">Storefront</a>; our official, free, WooCommerce theme.', 'woocommerce' ), esc_url( 'https://woocommerce.com/storefront/' ) ) );
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php echo wp_kses_post( sprintf( __( 'If toggled on, Storefront will be installed for you, and <em>%s</em> theme will be deactivated.', 'woocommerce' ), esc_html( $theme_name ) ) ); ?>
|
||||
</p>
|
||||
</div>
|
||||
if ( $this->should_show_automated_tax() ) :
|
||||
$this->display_recommended_item( array(
|
||||
'type' => 'automated_taxes',
|
||||
'title' => __( 'Automated Taxes', 'woocommerce' ),
|
||||
'description' => __( 'Save time and errors with automated tax calculation and collection at checkout. Powered by WooCommerce Services and Jetpack.', 'woocommerce' ),
|
||||
'img_url' => WC()->plugin_url() . '/assets/images/obw-taxes-icon.svg',
|
||||
'img_alt' => __( 'automated taxes icon', 'woocommerce' ),
|
||||
) );
|
||||
endif;
|
||||
|
||||
<div class="wc-wizard-service-enable">
|
||||
<span class="wc-wizard-service-toggle">
|
||||
<input id="setup_storefront_theme" type="checkbox" name="setup_storefront_theme" value="yes" checked="checked" />
|
||||
<label for="setup_storefront_theme">
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<?php if ( $this->should_show_automated_tax_extra() ) : ?>
|
||||
<ul class="wc-wizard-services featured">
|
||||
<li class="wc-wizard-service-item <?php echo get_option( 'woocommerce_setup_automated_taxes' ) ? 'checked' : ''; ?>">
|
||||
<div class="wc-wizard-service-description">
|
||||
<h3><?php esc_html_e( 'Automated Taxes (powered by WooCommerce Services)', 'woocommerce' ); ?></h3>
|
||||
<p>
|
||||
<?php esc_html_e( 'Automatically calculate and charge the correct rate of tax for each time a customer checks out. If toggled on, WooCommerce Services and Jetpack will be installed and activated for you.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
<p class="wc-wizard-service-learn-more">
|
||||
<a href="<?php echo esc_url( 'https://wordpress.org/plugins/woocommerce-services/' ); ?>" target="_blank">
|
||||
<?php esc_html_e( 'Learn more about WooCommerce Services', 'woocommerce' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="wc-wizard-service-enable">
|
||||
<span class="wc-wizard-service-toggle <?php echo get_option( 'woocommerce_setup_automated_taxes' ) ? '' : 'disabled'; ?>">
|
||||
<input
|
||||
id="setup_automated_taxes"
|
||||
type="checkbox"
|
||||
name="setup_automated_taxes"
|
||||
value="yes"
|
||||
<?php checked( get_option( 'woocommerce_setup_automated_taxes', 'no' ), 'yes' ); ?>
|
||||
/>
|
||||
<label for="setup_automated_taxes">
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
if ( $this->should_show_mailchimp() ) :
|
||||
$this->display_recommended_item( array(
|
||||
'type' => 'mailchimp',
|
||||
'title' => __( 'MailChimp', 'woocommerce' ),
|
||||
'description' => __( 'Join the 16 million customers who use MailChimp. Sync list and store data to send automated emails, and targeted campaigns.', 'woocommerce' ),
|
||||
'img_url' => WC()->plugin_url() . '/assets/images/obw-mailchimp-icon.svg',
|
||||
'img_alt' => __( 'MailChimp icon', 'woocommerce' ),
|
||||
) );
|
||||
endif;
|
||||
?>
|
||||
</ul>
|
||||
<p class="wc-setup-actions step">
|
||||
<button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
|
||||
<?php wp_nonce_field( 'wc-setup' ); ?>
|
||||
|
@ -1660,23 +1724,38 @@ class WC_Admin_Setup_Wizard {
|
|||
}
|
||||
|
||||
/**
|
||||
* Extras step save.
|
||||
* Recommended step save.
|
||||
*/
|
||||
public function wc_setup_extras_save() {
|
||||
public function wc_setup_recommended_save() {
|
||||
check_admin_referer( 'wc-setup' );
|
||||
|
||||
$setup_automated_tax = isset( $_POST['setup_automated_taxes'] ) && 'yes' === $_POST['setup_automated_taxes'];
|
||||
$install_storefront = isset( $_POST['setup_storefront_theme'] ) && 'yes' === $_POST['setup_storefront_theme'];
|
||||
$setup_storefront = isset( $_POST['setup_storefront_theme'] ) && 'yes' === $_POST['setup_storefront_theme'];
|
||||
$setup_automated_tax = isset( $_POST['setup_automated_taxes'] ) && 'yes' === $_POST['setup_automated_taxes'];
|
||||
$setup_mailchimp = isset( $_POST['setup_mailchimp'] ) && 'yes' === $_POST['setup_mailchimp'];
|
||||
|
||||
update_option( 'woocommerce_calc_taxes', $setup_automated_tax ? 'yes' : 'no' );
|
||||
update_option( 'woocommerce_setup_automated_taxes', $setup_automated_tax );
|
||||
|
||||
if ( $setup_storefront ) {
|
||||
$this->install_theme( 'storefront' );
|
||||
}
|
||||
|
||||
if ( $setup_automated_tax ) {
|
||||
$this->install_woocommerce_services();
|
||||
}
|
||||
|
||||
if ( $install_storefront ) {
|
||||
$this->install_theme( 'storefront' );
|
||||
if ( $setup_mailchimp ) {
|
||||
// Prevent MailChimp from redirecting to its settings page during the OBW flow.
|
||||
add_option( 'mailchimp_woocommerce_plugin_do_activation_redirect', false );
|
||||
|
||||
$this->install_plugin(
|
||||
'mailchimp-for-woocommerce',
|
||||
array(
|
||||
'name' => __( 'MailChimp for WooCommerce', 'woocommerce' ),
|
||||
'repo-slug' => 'mailchimp-for-woocommerce',
|
||||
'file' => 'mailchimp-woocommerce.php',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
|
||||
|
@ -1915,7 +1994,6 @@ class WC_Admin_Setup_Wizard {
|
|||
}
|
||||
|
||||
WC_Install::background_installer( 'jetpack', array(
|
||||
'file' => 'jetpack/jetpack.php',
|
||||
'name' => __( 'Jetpack', 'woocommerce' ),
|
||||
'repo-slug' => 'jetpack',
|
||||
) );
|
||||
|
|
|
@ -86,7 +86,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
|||
add_query_arg(
|
||||
array(
|
||||
'delete' => $webhook->get_id(),
|
||||
), admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks' )
|
||||
), admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks' )
|
||||
), 'delete-webhook'
|
||||
)
|
||||
) . '">' . esc_html__( 'Delete permanently', 'woocommerce' ) . '</a>',
|
||||
|
|
|
@ -43,7 +43,7 @@ class WC_Admin_Webhooks {
|
|||
* @return bool
|
||||
*/
|
||||
private function is_webhook_settings_page() {
|
||||
return isset( $_GET['page'], $_GET['tab'], $_GET['section'] ) && 'wc-settings' === $_GET['page'] && 'api' === $_GET['tab'] && 'webhooks' === $_GET['section']; // WPCS: input var okay, CSRF ok.
|
||||
return isset( $_GET['page'], $_GET['tab'], $_GET['section'] ) && 'wc-settings' === $_GET['page'] && 'advanced' === $_GET['tab'] && 'webhooks' === $_GET['section']; // WPCS: input var okay, CSRF ok.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,7 +127,7 @@ class WC_Admin_Webhooks {
|
|||
do_action( 'woocommerce_webhook_options_save', $webhook->get_id() );
|
||||
if ( $errors ) {
|
||||
// Redirect to webhook edit page to avoid settings save actions.
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&edit-webhook=' . $webhook->get_id() . '&error=' . rawurlencode( implode( '|', $errors ) ) ) );
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks&edit-webhook=' . $webhook->get_id() . '&error=' . rawurlencode( implode( '|', $errors ) ) ) );
|
||||
exit();
|
||||
} elseif ( isset( $_POST['webhook_status'] ) && 'active' === $_POST['webhook_status'] && $webhook->get_pending_delivery() ) { // WPCS: input var okay, CSRF ok.
|
||||
// Ping the webhook at the first time that is activated.
|
||||
|
@ -135,13 +135,13 @@ class WC_Admin_Webhooks {
|
|||
|
||||
if ( is_wp_error( $result ) ) {
|
||||
// Redirect to webhook edit page to avoid settings save actions.
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&edit-webhook=' . $webhook->get_id() . '&error=' . rawurlencode( $result->get_error_message() ) ) );
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks&edit-webhook=' . $webhook->get_id() . '&error=' . rawurlencode( $result->get_error_message() ) ) );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect to webhook edit page to avoid settings save actions.
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&edit-webhook=' . $webhook->get_id() . '&updated=1' ) );
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks&edit-webhook=' . $webhook->get_id() . '&updated=1' ) );
|
||||
exit();
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ class WC_Admin_Webhooks {
|
|||
$status = isset( $_GET['status'] ) ? '&status=' . sanitize_text_field( wp_unslash( $_GET['status'] ) ) : ''; // WPCS: input var okay, CSRF ok.
|
||||
|
||||
// Redirect to webhooks page.
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks' . $status . '&deleted=' . $qty ) );
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks' . $status . '&deleted=' . $qty ) );
|
||||
exit();
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ class WC_Admin_Webhooks {
|
|||
private static function table_list_output() {
|
||||
global $webhooks_table_list;
|
||||
|
||||
echo '<h2>' . esc_html__( 'Webhooks', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&edit-webhook=0' ) ) . '" class="add-new-h2">' . esc_html__( 'Add webhook', 'woocommerce' ) . '</a></h2>';
|
||||
echo '<h2>' . esc_html__( 'Webhooks', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks&edit-webhook=0' ) ) . '" class="add-new-h2">' . esc_html__( 'Add webhook', 'woocommerce' ) . '</a></h2>';
|
||||
|
||||
// Get the webhooks count.
|
||||
$data_store = WC_Data_Store::load( 'webhook' );
|
||||
|
@ -312,7 +312,7 @@ class WC_Admin_Webhooks {
|
|||
echo '<div class="woocommerce-BlankState woocommerce-BlankState--webhooks">';
|
||||
?>
|
||||
<h2 class="woocommerce-BlankState-message"><?php esc_html_e( 'Webhooks are event notifications sent to URLs of your choice. They can be used to integrate with third-party services which support them.', '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=webhooks&edit-webhook=0' ) ); ?>"><?php esc_html_e( 'Create a new webhook', 'woocommerce' ); ?></a>
|
||||
<a class="woocommerce-BlankState-cta button-primary button" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks&edit-webhook=0' ) ); ?>"><?php esc_html_e( 'Create a new webhook', 'woocommerce' ); ?></a>
|
||||
<style type="text/css">#posts-filter .wp-list-table, #posts-filter .tablenav.top, .tablenav.bottom .actions { display: none; }</style>
|
||||
<?php
|
||||
}
|
||||
|
|
|
@ -1318,6 +1318,10 @@ class WC_Helper {
|
|||
* @param string $screen_id Current screen ID.
|
||||
*/
|
||||
private static function _prompt_helper_connect( $screen_id ) {
|
||||
if ( apply_filters( 'woocommerce_helper_suppress_connect_notice', false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$screens = wc_get_screen_ids();
|
||||
$screens[] = 'plugins';
|
||||
|
||||
|
|
|
@ -295,7 +295,8 @@ class WC_Product_CSV_Importer_Controller {
|
|||
'test_form' => false,
|
||||
'mimes' => $valid_filetypes,
|
||||
);
|
||||
$upload = wp_handle_upload( wp_unslash( $_FILES['import'] ), $overrides );
|
||||
$import = wp_unslash( $_FILES['import'] ); // WPCS: sanitization ok.
|
||||
$upload = wp_handle_upload( $import, $overrides );
|
||||
|
||||
if ( isset( $upload['error'] ) ) {
|
||||
return new WP_Error( 'woocommerce_product_csv_importer_upload_error', $upload['error'] );
|
||||
|
|
|
@ -135,9 +135,10 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
|
|||
unset( $actions['edit'] );
|
||||
}
|
||||
|
||||
$actions['mark_processing'] = __( 'Change status to processing', 'woocommerce' );
|
||||
$actions['mark_on-hold'] = __( 'Change status to on-hold', 'woocommerce' );
|
||||
$actions['mark_completed'] = __( 'Change status to completed', 'woocommerce' );
|
||||
$actions['mark_processing'] = __( 'Change status to processing', 'woocommerce' );
|
||||
$actions['mark_on-hold'] = __( 'Change status to on-hold', 'woocommerce' );
|
||||
$actions['mark_completed'] = __( 'Change status to completed', 'woocommerce' );
|
||||
$actions['remove_personal_data'] = __( 'Remove personal data', 'woocommerce' );
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
@ -622,39 +623,46 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
|
|||
* @return string
|
||||
*/
|
||||
public function handle_bulk_actions( $redirect_to, $action, $ids ) {
|
||||
// Bail out if this is not a status-changing action.
|
||||
if ( false === strpos( $action, 'mark_' ) ) {
|
||||
return $redirect_to;
|
||||
}
|
||||
|
||||
$order_statuses = wc_get_order_statuses();
|
||||
$new_status = substr( $action, 5 ); // Get the status name from action.
|
||||
$report_action = 'marked_' . $new_status;
|
||||
|
||||
// Sanity check: bail out if this is actually not a status, or is
|
||||
// not a registered status.
|
||||
if ( ! isset( $order_statuses[ 'wc-' . $new_status ] ) ) {
|
||||
return $redirect_to;
|
||||
}
|
||||
|
||||
$changed = 0;
|
||||
$ids = array_map( 'absint', $ids );
|
||||
$changed = 0;
|
||||
|
||||
foreach ( $ids as $id ) {
|
||||
$order = wc_get_order( $id );
|
||||
$order->update_status( $new_status, __( 'Order status changed by bulk edit:', 'woocommerce' ), true );
|
||||
do_action( 'woocommerce_order_edit_status', $id, $new_status );
|
||||
$changed++;
|
||||
if ( 'remove_personal_data' === $action ) {
|
||||
$report_action = 'removed_personal_data';
|
||||
|
||||
foreach ( $ids as $id ) {
|
||||
$order = wc_get_order( $id );
|
||||
|
||||
if ( $order ) {
|
||||
do_action( 'woocommerce_remove_order_personal_data', $order );
|
||||
$changed++;
|
||||
}
|
||||
}
|
||||
} elseif ( false !== strpos( $action, 'mark_' ) ) {
|
||||
$order_statuses = wc_get_order_statuses();
|
||||
$new_status = substr( $action, 5 ); // Get the status name from action.
|
||||
$report_action = 'marked_' . $new_status;
|
||||
|
||||
// Sanity check: bail out if this is actually not a status, or is not a registered status.
|
||||
if ( isset( $order_statuses[ 'wc-' . $new_status ] ) ) {
|
||||
foreach ( $ids as $id ) {
|
||||
$order = wc_get_order( $id );
|
||||
$order->update_status( $new_status, __( 'Order status changed by bulk edit:', 'woocommerce' ), true );
|
||||
do_action( 'woocommerce_order_edit_status', $id, $new_status );
|
||||
$changed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$redirect_to = add_query_arg(
|
||||
array(
|
||||
'post_type' => $this->list_table_type,
|
||||
$report_action => true,
|
||||
'changed' => $changed,
|
||||
'ids' => join( ',', $ids ),
|
||||
), $redirect_to
|
||||
);
|
||||
if ( $changed ) {
|
||||
$redirect_to = add_query_arg(
|
||||
array(
|
||||
'post_type' => $this->list_table_type,
|
||||
'bulk_action' => $report_action,
|
||||
'changed' => $changed,
|
||||
'ids' => join( ',', $ids ),
|
||||
), $redirect_to
|
||||
);
|
||||
}
|
||||
|
||||
return esc_url_raw( $redirect_to );
|
||||
}
|
||||
|
@ -666,23 +674,29 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
|
|||
global $post_type, $pagenow;
|
||||
|
||||
// Bail out if not on shop order list page.
|
||||
if ( 'edit.php' !== $pagenow || 'shop_order' !== $post_type ) {
|
||||
if ( 'edit.php' !== $pagenow || 'shop_order' !== $post_type || ! isset( $_REQUEST['bulk_action'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
return;
|
||||
}
|
||||
|
||||
$order_statuses = wc_get_order_statuses();
|
||||
$number = isset( $_REQUEST['changed'] ) ? absint( $_REQUEST['changed'] ) : 0; // WPCS: input var ok, CSRF ok.
|
||||
$bulk_action = wc_clean( wp_unslash( $_REQUEST['bulk_action'] ) ); // WPCS: input var ok, CSRF ok.
|
||||
|
||||
// Check if any status changes happened.
|
||||
foreach ( $order_statuses as $slug => $name ) {
|
||||
if ( isset( $_REQUEST[ 'marked_' . str_replace( 'wc-', '', $slug ) ] ) ) { // WPCS: input var ok.
|
||||
|
||||
$number = isset( $_REQUEST['changed'] ) ? absint( $_REQUEST['changed'] ) : 0; // WPCS: input var ok.
|
||||
/* translators: %s: orders count */
|
||||
if ( 'marked_' . str_replace( 'wc-', '', $slug ) === $bulk_action ) { // WPCS: input var ok, CSRF ok.
|
||||
/* translators: %d: orders count */
|
||||
$message = sprintf( _n( '%d order status changed.', '%d order statuses changed.', $number, 'woocommerce' ), number_format_i18n( $number ) );
|
||||
echo '<div class="updated"><p>' . esc_html( $message ) . '</p></div>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'removed_personal_data' === $bulk_action ) { // WPCS: input var ok, CSRF ok.
|
||||
/* translators: %d: orders count */
|
||||
$message = sprintf( _n( 'Removed personal data from %d order.', 'Removed personal data from %d orders.', $number, 'woocommerce' ), number_format_i18n( $number ) );
|
||||
echo '<div class="updated"><p>' . esc_html( $message ) . '</p></div>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,7 +27,8 @@ class WC_Meta_Box_Coupon_Data {
|
|||
public static function output( $post ) {
|
||||
wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
|
||||
|
||||
$coupon = new WC_Coupon( $post->ID );
|
||||
$coupon_id = absint( $post->ID );
|
||||
$coupon = new WC_Coupon( $coupon_id );
|
||||
|
||||
?>
|
||||
|
||||
|
@ -78,6 +79,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
'id' => 'discount_type',
|
||||
'label' => __( 'Discount type', 'woocommerce' ),
|
||||
'options' => wc_get_coupon_types(),
|
||||
'value' => $coupon->get_discount_type( 'edit' ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -90,6 +92,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
'description' => __( 'Value of the coupon.', 'woocommerce' ),
|
||||
'data_type' => 'price',
|
||||
'desc_tip' => true,
|
||||
'value' => $coupon->get_amount( 'edit' ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -100,12 +103,13 @@ class WC_Meta_Box_Coupon_Data {
|
|||
'id' => 'free_shipping',
|
||||
'label' => __( 'Allow free shipping', 'woocommerce' ),
|
||||
'description' => sprintf( __( 'Check this box if the coupon grants free shipping. A <a href="%s" target="_blank">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce' ), 'https://docs.woocommerce.com/document/free-shipping/' ),
|
||||
'value' => wc_bool_to_string( $coupon->get_free_shipping( 'edit' ) ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Expiry date.
|
||||
$expiry_date = $coupon->get_date_expires() ? $coupon->get_date_expires()->date( 'Y-m-d' ) : '';
|
||||
$expiry_date = $coupon->get_date_expires( 'edit' ) ? $coupon->get_date_expires( 'edit' )->date( 'Y-m-d' ) : '';
|
||||
woocommerce_wp_text_input(
|
||||
array(
|
||||
'id' => 'expiry_date',
|
||||
|
@ -138,6 +142,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
'description' => __( 'This field allows you to set the minimum spend (subtotal) allowed to use the coupon.', 'woocommerce' ),
|
||||
'data_type' => 'price',
|
||||
'desc_tip' => true,
|
||||
'value' => $coupon->get_minimum_amount( 'edit' ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -150,6 +155,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
'description' => __( 'This field allows you to set the maximum spend (subtotal) allowed when using the coupon.', 'woocommerce' ),
|
||||
'data_type' => 'price',
|
||||
'desc_tip' => true,
|
||||
'value' => $coupon->get_maximum_amount( 'edit' ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -159,6 +165,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
'id' => 'individual_use',
|
||||
'label' => __( 'Individual use only', 'woocommerce' ),
|
||||
'description' => __( 'Check this box if the coupon cannot be used in conjunction with other coupons.', 'woocommerce' ),
|
||||
'value' => wc_bool_to_string( $coupon->get_individual_use( 'edit' ) ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -168,6 +175,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
'id' => 'exclude_sale_items',
|
||||
'label' => __( 'Exclude sale items', 'woocommerce' ),
|
||||
'description' => __( 'Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are items in the cart that are not on sale.', 'woocommerce' ),
|
||||
'value' => wc_bool_to_string( $coupon->get_exclude_sale_items( 'edit' ) ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -179,7 +187,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
<label><?php _e( 'Products', 'woocommerce' ); ?></label>
|
||||
<select class="wc-product-search" multiple="multiple" style="width: 50%;" name="product_ids[]" data-placeholder="<?php esc_attr_e( 'Search for a product…', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations">
|
||||
<?php
|
||||
$product_ids = $coupon->get_product_ids();
|
||||
$product_ids = $coupon->get_product_ids( 'edit' );
|
||||
|
||||
foreach ( $product_ids as $product_id ) {
|
||||
$product = wc_get_product( $product_id );
|
||||
|
@ -197,7 +205,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
<label><?php _e( 'Exclude products', 'woocommerce' ); ?></label>
|
||||
<select class="wc-product-search" multiple="multiple" style="width: 50%;" name="exclude_product_ids[]" data-placeholder="<?php esc_attr_e( 'Search for a product…', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations">
|
||||
<?php
|
||||
$product_ids = $coupon->get_excluded_product_ids();
|
||||
$product_ids = $coupon->get_excluded_product_ids( 'edit' );
|
||||
|
||||
foreach ( $product_ids as $product_id ) {
|
||||
$product = wc_get_product( $product_id );
|
||||
|
@ -219,12 +227,12 @@ class WC_Meta_Box_Coupon_Data {
|
|||
<label for="product_categories"><?php _e( 'Product categories', 'woocommerce' ); ?></label>
|
||||
<select id="product_categories" name="product_categories[]" style="width: 50%;" class="wc-enhanced-select" multiple="multiple" data-placeholder="<?php esc_attr_e( 'Any category', 'woocommerce' ); ?>">
|
||||
<?php
|
||||
$category_ids = $coupon->get_product_categories();
|
||||
$category_ids = $coupon->get_product_categories( 'edit' );
|
||||
$categories = get_terms( 'product_cat', 'orderby=name&hide_empty=0' );
|
||||
|
||||
if ( $categories ) {
|
||||
foreach ( $categories as $cat ) {
|
||||
echo '<option value="' . esc_attr( $cat->term_id ) . '"' . selected( in_array( $cat->term_id, $category_ids ), true, false ) . '>' . esc_html( $cat->name ) . '</option>';
|
||||
echo '<option value="' . esc_attr( $cat->term_id ) . '"' . wc_selected( $cat->term_id, $category_ids ) . '>' . esc_html( $cat->name ) . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -236,12 +244,12 @@ class WC_Meta_Box_Coupon_Data {
|
|||
<label for="exclude_product_categories"><?php _e( 'Exclude categories', 'woocommerce' ); ?></label>
|
||||
<select id="exclude_product_categories" name="exclude_product_categories[]" style="width: 50%;" class="wc-enhanced-select" multiple="multiple" data-placeholder="<?php esc_attr_e( 'No categories', 'woocommerce' ); ?>">
|
||||
<?php
|
||||
$category_ids = $coupon->get_excluded_product_categories();
|
||||
$category_ids = $coupon->get_excluded_product_categories( 'edit' );
|
||||
$categories = get_terms( 'product_cat', 'orderby=name&hide_empty=0' );
|
||||
|
||||
if ( $categories ) {
|
||||
foreach ( $categories as $cat ) {
|
||||
echo '<option value="' . esc_attr( $cat->term_id ) . '"' . selected( in_array( $cat->term_id, $category_ids ), true, false ) . '>' . esc_html( $cat->name ) . '</option>';
|
||||
echo '<option value="' . esc_attr( $cat->term_id ) . '"' . wc_selected( $cat->term_id, $category_ids ) . '>' . esc_html( $cat->name ) . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -258,7 +266,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
'label' => __( 'Email restrictions', 'woocommerce' ),
|
||||
'placeholder' => __( 'No restrictions', 'woocommerce' ),
|
||||
'description' => __( 'List of allowed emails to check against the customer billing email when an order is placed. Separate email addresses with commas. You can also use an asterisk (*) to match parts of an email. For example "*@gmail.com" would match all gmail addresses.', 'woocommerce' ),
|
||||
'value' => implode( ', ', (array) $coupon->get_email_restrictions() ),
|
||||
'value' => implode( ', ', (array) $coupon->get_email_restrictions( 'edit' ) ),
|
||||
'desc_tip' => true,
|
||||
'type' => 'email',
|
||||
'class' => '',
|
||||
|
@ -288,7 +296,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
'step' => 1,
|
||||
'min' => 0,
|
||||
),
|
||||
'value' => $coupon->get_usage_limit() ? $coupon->get_usage_limit() : '',
|
||||
'value' => $coupon->get_usage_limit( 'edit' ) ? $coupon->get_usage_limit( 'edit' ) : '',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -306,7 +314,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
'step' => 1,
|
||||
'min' => 0,
|
||||
),
|
||||
'value' => $coupon->get_limit_usage_to_x_items() ? $coupon->get_limit_usage_to_x_items() : '',
|
||||
'value' => $coupon->get_limit_usage_to_x_items( 'edit' ) ? $coupon->get_limit_usage_to_x_items( 'edit' ) : '',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -324,7 +332,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
'step' => 1,
|
||||
'min' => 0,
|
||||
),
|
||||
'value' => $coupon->get_usage_limit_per_user() ? $coupon->get_usage_limit_per_user() : '',
|
||||
'value' => $coupon->get_usage_limit_per_user( 'edit' ) ? $coupon->get_usage_limit_per_user( 'edit' ) : '',
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -344,7 +344,9 @@ class WC_Meta_Box_Order_Data {
|
|||
$field_value = make_clickable( esc_html( $field_value ) );
|
||||
}
|
||||
|
||||
echo '<p><strong>' . esc_html( $field['label'] ) . ':</strong> ' . wp_kses_post( $field_value ) . '</p>';
|
||||
if ( $field_value ) {
|
||||
echo '<p><strong>' . esc_html( $field['label'] ) . ':</strong> ' . wp_kses_post( $field_value ) . '</p>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -409,6 +411,7 @@ class WC_Meta_Box_Order_Data {
|
|||
array(
|
||||
'id' => '_transaction_id',
|
||||
'label' => __( 'Transaction ID', 'woocommerce' ),
|
||||
'value' => $order->get_transaction_id( 'edit' ),
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
@ -449,7 +452,9 @@ class WC_Meta_Box_Order_Data {
|
|||
$field_value = $order->get_meta( '_' . $field_name );
|
||||
}
|
||||
|
||||
echo '<p><strong>' . esc_html( $field['label'] ) . ':</strong> ' . make_clickable( esc_html( $field_value ) ) . '</p>';
|
||||
if ( $field_value ) {
|
||||
echo '<p><strong>' . esc_html( $field['label'] ) . ':</strong> ' . wp_kses_post( $field_value ) . '</p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -600,6 +605,11 @@ class WC_Meta_Box_Order_Data {
|
|||
|
||||
$props['date_created'] = $date;
|
||||
|
||||
// Set created via prop if new post.
|
||||
if ( isset( $_POST['original_post_status'] ) && $_POST['original_post_status'] === 'auto-draft' ) {
|
||||
$props['created_via'] = 'admin';
|
||||
}
|
||||
|
||||
// Save order data.
|
||||
$order->set_props( $props );
|
||||
$order->set_status( wc_clean( $_POST['order_status'] ), '', true );
|
||||
|
|
|
@ -40,17 +40,22 @@ class WC_Meta_Box_Product_Reviews {
|
|||
/**
|
||||
* Save meta box data
|
||||
*
|
||||
* @param mixed $location
|
||||
* @param int $comment_id
|
||||
* @param mixed $data
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function save( $location, $comment_id ) {
|
||||
public static function save( $data ) {
|
||||
// Not allowed, return regular value without updating meta
|
||||
if ( ! wp_verify_nonce( $_POST['woocommerce_meta_nonce'], 'woocommerce_save_data' ) && ! isset( $_POST['rating'] ) ) {
|
||||
return $location;
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ( $_POST['rating'] > 5 || $_POST['rating'] < 0 ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$comment_id = $data['comment_ID'];
|
||||
|
||||
// Update meta
|
||||
update_comment_meta(
|
||||
$comment_id,
|
||||
|
@ -59,6 +64,6 @@ class WC_Meta_Box_Product_Reviews {
|
|||
);
|
||||
|
||||
// Return regular value after updating
|
||||
return $location;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
|||
echo '<small class="times">×</small> ' . esc_html( $item->get_quantity() );
|
||||
|
||||
if ( $refunded_qty = $order->get_qty_refunded_for_item( $item_id ) ) {
|
||||
echo '<small class="refunded">' . ( $refunded_qty * -1 ) . '</small>';
|
||||
echo '<small class="refunded">-' . ( $refunded_qty * -1 ) . '</small>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -84,7 +84,7 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
|||
}
|
||||
|
||||
if ( $refunded = $order->get_total_refunded_for_item( $item_id ) ) {
|
||||
echo '<small class="refunded">' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>';
|
||||
echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -130,7 +130,7 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
|||
}
|
||||
|
||||
if ( $refunded = $order->get_tax_refunded_for_item( $item_id, $tax_item_id ) ) {
|
||||
echo '<small class="refunded">' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>';
|
||||
echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -121,13 +121,13 @@ if ( wc_tax_enabled() ) {
|
|||
<li class="<?php echo $class; ?>">
|
||||
<?php if ( $post_id ) : ?>
|
||||
<?php
|
||||
$post_url = add_query_arg(
|
||||
$post_url = apply_filters( 'woocommerce_admin_order_item_coupon_url', add_query_arg(
|
||||
array(
|
||||
'post' => $post_id,
|
||||
'action' => 'edit',
|
||||
),
|
||||
admin_url( 'post.php' )
|
||||
);
|
||||
), $item, $order );
|
||||
?>
|
||||
<a href="<?php echo esc_url( $post_url ); ?>" class="tips" data-tip="<?php echo esc_attr( wc_price( $item->get_discount(), array( 'currency' => $order->get_currency() ) ) ); ?>">
|
||||
<span><?php echo esc_html( $item->get_code() ); ?></span>
|
||||
|
@ -292,12 +292,14 @@ if ( wc_tax_enabled() ) {
|
|||
<div class="clear"></div>
|
||||
<div class="refund-actions">
|
||||
<?php
|
||||
$refund_amount = '<span class="wc-order-refund-amount">' . wc_price( 0, array( 'currency' => $order->get_currency() ) ) . '</span>';
|
||||
$gateway_supports_refunds = false !== $payment_gateway && $payment_gateway->supports( 'refunds' );
|
||||
$gateway_name = false !== $payment_gateway ? ( ! empty( $payment_gateway->method_title ) ? $payment_gateway->method_title : $payment_gateway->get_title() ) : __( 'Payment gateway', 'woocommerce' );
|
||||
$refund_amount = '<span class="wc-order-refund-amount">' . wc_price( 0, array( 'currency' => $order->get_currency() ) ) . '</span>';
|
||||
$gateway_name = false !== $payment_gateway ? ( ! empty( $payment_gateway->method_title ) ? $payment_gateway->method_title : $payment_gateway->get_title() ) : __( 'Payment gateway', 'woocommerce' );
|
||||
|
||||
if ( false !== $payment_gateway && $payment_gateway->can_refund_order( $order ) ) {
|
||||
/* translators: refund amount, gateway name */
|
||||
echo '<button type="button" class="button button-primary do-api-refund">' . sprintf( esc_html__( 'Refund %1$s via %2$s', 'woocommerce' ), wp_kses_post( $refund_amount ), esc_html( $gateway_name ) ) . '</button>';
|
||||
}
|
||||
?>
|
||||
<?php /* translators: refund amount, gateway name */ ?>
|
||||
<button type="button" class="button <?php echo $gateway_supports_refunds ? 'button-primary do-api-refund' : 'tips disabled'; ?>" <?php echo $gateway_supports_refunds ? '' : 'data-tip="' . esc_attr__( 'The payment gateway used to place this order does not support automatic refunds.', 'woocommerce' ) . '"'; ?>><?php printf( esc_html__( 'Refund %1$s via %2$s', 'woocommerce' ), $refund_amount, $gateway_name ); ?></button>
|
||||
<?php /* translators: refund amount */ ?>
|
||||
<button type="button" class="button button-primary do-manual-refund tips" data-tip="<?php esc_attr_e( 'You will need to manually issue a refund through your payment gateway after using this.', 'woocommerce' ); ?>"><?php printf( esc_html__( 'Refund %s manually', 'woocommerce' ), $refund_amount ); ?></button>
|
||||
<button type="button" class="button cancel-action"><?php esc_html_e( 'Cancel', 'woocommerce' ); ?></button>
|
||||
|
|
|
@ -48,7 +48,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
foreach ( $all_terms as $term ) {
|
||||
$options = $attribute->get_options();
|
||||
$options = ! empty( $options ) ? $options : array();
|
||||
echo '<option value="' . esc_attr( $term->term_id ) . '" ' . selected( in_array( $term->term_id, $options, true ), true, false ) . '>' . esc_attr( apply_filters( 'woocommerce_product_attribute_term_name', $term->name, $term ) ) . '</option>';
|
||||
echo '<option value="' . esc_attr( $term->term_id ) . '"' . wc_selected( $term->term_id, $options ) . '>' . esc_attr( apply_filters( 'woocommerce_product_attribute_term_name', $term->name, $term ) ) . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -332,8 +332,13 @@ class WC_Admin_Report {
|
|||
}
|
||||
|
||||
if ( $debug || $nocache || false === $cached_results || ! isset( $cached_results[ $query_hash ] ) ) {
|
||||
// Enable big selects for reports
|
||||
$wpdb->query( 'SET SESSION SQL_BIG_SELECTS=1' );
|
||||
static $big_selects = false;
|
||||
// Enable big selects for reports, just once for this session
|
||||
if ( ! $big_selects ) {
|
||||
$wpdb->query( 'SET SESSION SQL_BIG_SELECTS=1' );
|
||||
$big_selects = true;
|
||||
}
|
||||
|
||||
$cached_results[ $query_hash ] = apply_filters( 'woocommerce_reports_get_order_report_data', $wpdb->$query_type( $query ), $data );
|
||||
set_transient( strtolower( get_class( $this ) ), $cached_results, DAY_IN_SECONDS );
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
|
|||
<option value=""><?php esc_html_e( 'All coupons', 'woocommerce' ); ?></option>
|
||||
<?php
|
||||
foreach ( $used_coupons as $coupon ) {
|
||||
echo '<option value="' . esc_attr( $coupon ) . '" ' . selected( in_array( $coupon, $this->coupon_codes ), true, false ) . '>' . esc_html( $coupon ) . '</option>';
|
||||
echo '<option value="' . esc_attr( $coupon ) . '"' . wc_selected( $coupon, $this->coupon_codes ) . '>' . esc_html( $coupon ) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
|
|
@ -1,216 +1,188 @@
|
|||
<?php
|
||||
/**
|
||||
* WooCommerce Account Settings
|
||||
* WooCommerce Account Settings.
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.1.0
|
||||
* @package WooCommerce/Admin
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( class_exists( 'WC_Settings_Accounts', false ) ) {
|
||||
return new WC_Settings_Accounts();
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'WC_Settings_Accounts', false ) ) :
|
||||
/**
|
||||
* WC_Settings_Accounts.
|
||||
*/
|
||||
class WC_Settings_Accounts extends WC_Settings_Page {
|
||||
|
||||
/**
|
||||
* WC_Settings_Accounts.
|
||||
* Constructor.
|
||||
*/
|
||||
class WC_Settings_Accounts extends WC_Settings_Page {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'account';
|
||||
$this->label = __( 'Accounts', 'woocommerce' );
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings() {
|
||||
$settings = apply_filters(
|
||||
'woocommerce_' . $this->id . '_settings', array(
|
||||
|
||||
array(
|
||||
'title' => __( 'Account pages', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => __( 'These pages need to be set so that WooCommerce knows where to send users to access account related functionality.', 'woocommerce' ),
|
||||
'id' => 'account_page_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'My account page', 'woocommerce' ),
|
||||
'desc' => sprintf( __( 'Page contents: [%s]', 'woocommerce' ), apply_filters( 'woocommerce_my_account_shortcode_tag', 'woocommerce_my_account' ) ),
|
||||
'id' => 'woocommerce_myaccount_page_id',
|
||||
'type' => 'single_select_page',
|
||||
'default' => '',
|
||||
'class' => 'wc-enhanced-select-nostd',
|
||||
'css' => 'min-width:300px;',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'account_page_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => '',
|
||||
'type' => 'title',
|
||||
'id' => 'account_registration_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Customer registration', 'woocommerce' ),
|
||||
'desc' => __( 'Enable customer registration on the "Checkout" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_signup_and_login_from_checkout',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
'autoload' => false,
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Enable customer registration on the "My account" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_myaccount_registration',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end',
|
||||
'autoload' => false,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Login', 'woocommerce' ),
|
||||
'desc' => __( 'Display returning customer login reminder on the "Checkout" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_checkout_login_reminder',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
'autoload' => false,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Account creation', 'woocommerce' ),
|
||||
'desc' => __( 'Automatically generate username from customer email.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_registration_generate_username',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
'autoload' => false,
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Automatically generate customer password', 'woocommerce' ),
|
||||
'id' => 'woocommerce_registration_generate_password',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end',
|
||||
'autoload' => false,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'account_registration_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'My account endpoints', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => __( 'Endpoints are appended to your page URLs to handle specific actions on the accounts pages. They should be unique and can be left blank to disable the endpoint.', 'woocommerce' ),
|
||||
'id' => 'account_endpoint_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Orders', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Orders" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_orders_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'orders',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'View order', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → View order" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_view_order_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'view-order',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Downloads', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Downloads" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_downloads_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'downloads',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Edit account', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Edit account" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_edit_account_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'edit-account',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Addresses', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Addresses" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_edit_address_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'edit-address',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Payment methods', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Payment methods" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_payment_methods_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'payment-methods',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Lost password', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Lost password" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_lost_password_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'lost-password',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Logout', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the triggering logout. You can add this to your menus via a custom link: yoursite.com/?customer-logout=true', 'woocommerce' ),
|
||||
'id' => 'woocommerce_logout_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'customer-logout',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'account_endpoint_options',
|
||||
),
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
|
||||
}
|
||||
public function __construct() {
|
||||
$this->id = 'account';
|
||||
$this->label = __( 'Accounts & Privacy', 'woocommerce' );
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
endif;
|
||||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings() {
|
||||
$settings = apply_filters(
|
||||
'woocommerce_' . $this->id . '_settings', array(
|
||||
array(
|
||||
'title' => '',
|
||||
'type' => 'title',
|
||||
'id' => 'account_registration_options',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Guest checkout', 'woocommerce' ),
|
||||
'desc' => __( 'Allow customers to place orders without an account.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_guest_checkout',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
'autoload' => false,
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Login', 'woocommerce' ),
|
||||
'desc' => __( 'Allow customers to log into an existing account during checkout', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_checkout_login_reminder',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end',
|
||||
'autoload' => false,
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Account creation', 'woocommerce' ),
|
||||
'desc' => __( 'Allow customers to create an account during checkout.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_signup_and_login_from_checkout',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
'autoload' => false,
|
||||
),
|
||||
array(
|
||||
'desc' => __( 'Allow customers to create an account on the "My account" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_myaccount_registration',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => '',
|
||||
'autoload' => false,
|
||||
),
|
||||
array(
|
||||
'desc' => __( 'When creating an account, automatically generate a username from the customer\'s email address.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_registration_generate_username',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => '',
|
||||
'autoload' => false,
|
||||
),
|
||||
array(
|
||||
'desc' => __( 'When creating an account, automatically generate an account password.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_registration_generate_password',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end',
|
||||
'autoload' => false,
|
||||
),
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'account_registration_options',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Privacy policy', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'id' => 'privacy_policy_options',
|
||||
'desc' => __( 'This section controls the display of your website privacy policy. The privacy notices below will not show up unless a privacy page is first set.', 'woocommerce' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Privacy page', 'woocommerce' ),
|
||||
'desc' => __( 'Choose a page to act as your privacy policy.', 'woocommerce' ),
|
||||
'id' => 'wp_page_for_privacy_policy',
|
||||
'type' => 'single_select_page',
|
||||
'default' => '',
|
||||
'class' => 'wc-enhanced-select-nostd',
|
||||
'css' => 'min-width:300px;',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Registration privacy policy', 'woocommerce' ),
|
||||
'desc_tip' => __( 'Optionally add some text about your store privacy policy to show on account registration forms.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_registration_privacy_policy_text',
|
||||
'default' => __( 'Your personal data will be used to support your experience throughout this website, to manage access to your account, and for other purposes described in our [privacy_policy].', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'css' => 'min-width: 50%; height: 75px;',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Checkout privacy policy', 'woocommerce' ),
|
||||
'desc_tip' => __( 'Optionally add some text about your store privacy policy to show during checkout.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_checkout_privacy_policy_text',
|
||||
'default' => __( 'Your personal data will be used to process your order, support your experience throughout this website, and for other purposes described in our [privacy_policy].', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'css' => 'min-width: 50%; height: 75px;',
|
||||
),
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'privacy_policy_options',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Personal data cleanup', 'woocommerce' ),
|
||||
'desc' => __( 'These tools let you clean up personal data when it\'s no longer needed for processing.', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'id' => 'order_cleanup_options',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Trash pending orders after: ', 'woocommerce' ),
|
||||
'desc_tip' => __( 'Automatically trash orders with this status after a certain period of time. Leave blank to disable.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_trash_pending_orders',
|
||||
'type' => 'relative_date_selector',
|
||||
'placeholder' => __( 'N/A', 'woocommerce' ),
|
||||
'default' => '',
|
||||
'autoload' => false,
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Trash failed orders after: ', 'woocommerce' ),
|
||||
'desc_tip' => __( 'Automatically trash orders with this status after a certain period of time. Leave blank to disable.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_trash_failed_orders',
|
||||
'type' => 'relative_date_selector',
|
||||
'placeholder' => __( 'N/A', 'woocommerce' ),
|
||||
'default' => '',
|
||||
'autoload' => false,
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Trash cancelled orders after: ', 'woocommerce' ),
|
||||
'desc_tip' => __( 'Automatically trash orders with this status after a certain period of time. Leave blank to disable.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_trash_cancelled_orders',
|
||||
'type' => 'relative_date_selector',
|
||||
'placeholder' => __( 'N/A', 'woocommerce' ),
|
||||
'default' => '',
|
||||
'autoload' => false,
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Anonymize completed guest orders after: ', 'woocommerce' ),
|
||||
'desc_tip' => __( 'Remove personal data from guest orders after a certain period of time. Leave blank to disable.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_anonymize_completed_orders',
|
||||
'type' => 'relative_date_selector',
|
||||
'placeholder' => __( 'N/A', 'woocommerce' ),
|
||||
'default' => '',
|
||||
'autoload' => false,
|
||||
),
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'order_cleanup_options',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
|
||||
}
|
||||
}
|
||||
|
||||
return new WC_Settings_Accounts();
|
||||
|
|
|
@ -0,0 +1,409 @@
|
|||
<?php
|
||||
/**
|
||||
* WooCommerce advanced settings
|
||||
*
|
||||
* @package WooCommerce/Admin
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Settings for API.
|
||||
*/
|
||||
if ( class_exists( 'WC_Settings_Advanced', false ) ) {
|
||||
return new WC_Settings_Advanced();
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Settings_Advanced.
|
||||
*/
|
||||
class WC_Settings_Advanced extends WC_Settings_Page {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'advanced';
|
||||
$this->label = __( 'Advanced', 'woocommerce' );
|
||||
|
||||
add_action( 'woocommerce_settings_form_method_tab_' . $this->id, array( $this, 'form_method' ) );
|
||||
parent::__construct();
|
||||
|
||||
$this->notices();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sections.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_sections() {
|
||||
$sections = array(
|
||||
'' => __( 'Page setup', 'woocommerce' ),
|
||||
'keys' => __( 'REST API', 'woocommerce' ),
|
||||
'webhooks' => __( 'Webhooks', 'woocommerce' ),
|
||||
'legacy_api' => __( 'Legacy API', 'woocommerce' ),
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @param string $current_section Current section slug.
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings( $current_section = '' ) {
|
||||
$settings = array();
|
||||
|
||||
if ( '' === $current_section ) {
|
||||
$settings = apply_filters(
|
||||
'woocommerce_settings_pages', array(
|
||||
|
||||
array(
|
||||
'title' => __( 'Page setup', 'woocommerce' ),
|
||||
'desc' => __( 'These pages need to be set so that WooCommerce knows where to send users to checkout.', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'id' => 'advanced_page_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Cart page', 'woocommerce' ),
|
||||
/* Translators: %s Page contents. */
|
||||
'desc' => sprintf( __( 'Page contents: [%s]', 'woocommerce' ), apply_filters( 'woocommerce_cart_shortcode_tag', 'woocommerce_cart' ) ),
|
||||
'id' => 'woocommerce_cart_page_id',
|
||||
'type' => 'single_select_page',
|
||||
'default' => '',
|
||||
'class' => 'wc-enhanced-select-nostd',
|
||||
'css' => 'min-width:300px;',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Checkout page', 'woocommerce' ),
|
||||
/* Translators: %s Page contents. */
|
||||
'desc' => sprintf( __( 'Page contents: [%s]', 'woocommerce' ), apply_filters( 'woocommerce_checkout_shortcode_tag', 'woocommerce_checkout' ) ),
|
||||
'id' => 'woocommerce_checkout_page_id',
|
||||
'type' => 'single_select_page',
|
||||
'default' => '',
|
||||
'class' => 'wc-enhanced-select-nostd',
|
||||
'css' => 'min-width:300px;',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'My account page', 'woocommerce' ),
|
||||
/* Translators: %s Page contents. */
|
||||
'desc' => sprintf( __( 'Page contents: [%s]', 'woocommerce' ), apply_filters( 'woocommerce_my_account_shortcode_tag', 'woocommerce_my_account' ) ),
|
||||
'id' => 'woocommerce_myaccount_page_id',
|
||||
'type' => 'single_select_page',
|
||||
'default' => '',
|
||||
'class' => 'wc-enhanced-select-nostd',
|
||||
'css' => 'min-width:300px;',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Terms and conditions', 'woocommerce' ),
|
||||
'desc' => __( 'If you define a "Terms" page the customer will be asked if they accept them when checking out.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_terms_page_id',
|
||||
'default' => '',
|
||||
'class' => 'wc-enhanced-select-nostd',
|
||||
'css' => 'min-width:300px;',
|
||||
'type' => 'single_select_page',
|
||||
'args' => array( 'exclude' => wc_get_page_id( 'checkout' ) ),
|
||||
'desc_tip' => true,
|
||||
'autoload' => false,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'advanced_page_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => '',
|
||||
'type' => 'title',
|
||||
'id' => 'checkout_process_options',
|
||||
),
|
||||
|
||||
'force_ssl_checkout' => array(
|
||||
'title' => __( 'Secure checkout', 'woocommerce' ),
|
||||
'desc' => __( 'Force secure checkout', 'woocommerce' ),
|
||||
'id' => 'woocommerce_force_ssl_checkout',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
'show_if_checked' => 'option',
|
||||
/* Translators: %s Docs URL. */
|
||||
'desc_tip' => sprintf( __( 'Force SSL (HTTPS) on the checkout pages (<a href="%s" target="_blank">an SSL Certificate is required</a>).', 'woocommerce' ), 'https://docs.woocommerce.com/document/ssl-and-https/#section-3' ),
|
||||
),
|
||||
|
||||
'unforce_ssl_checkout' => array(
|
||||
'desc' => __( 'Force HTTP when leaving the checkout', 'woocommerce' ),
|
||||
'id' => 'woocommerce_unforce_ssl_checkout',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end',
|
||||
'show_if_checked' => 'yes',
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'checkout_process_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Checkout endpoints', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => __( 'Endpoints are appended to your page URLs to handle specific actions during the checkout process. They should be unique.', 'woocommerce' ),
|
||||
'id' => 'account_endpoint_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Pay', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "Checkout → Pay" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_checkout_pay_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'order-pay',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Order received', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "Checkout → Order received" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_checkout_order_received_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'order-received',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Add payment method', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "Checkout → Add payment method" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_add_payment_method_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'add-payment-method',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Delete payment method', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the delete payment method page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_delete_payment_method_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'delete-payment-method',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Set default payment method', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the setting a default payment method page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_set_default_payment_method_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'set-default-payment-method',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'checkout_endpoint_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Account endpoints', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => __( 'Endpoints are appended to your page URLs to handle specific actions on the accounts pages. They should be unique and can be left blank to disable the endpoint.', 'woocommerce' ),
|
||||
'id' => 'account_endpoint_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Orders', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Orders" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_orders_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'orders',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'View order', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → View order" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_view_order_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'view-order',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Downloads', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Downloads" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_downloads_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'downloads',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Edit account', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Edit account" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_edit_account_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'edit-account',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Addresses', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Addresses" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_edit_address_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'edit-address',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Payment methods', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Payment methods" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_payment_methods_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'payment-methods',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Lost password', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "My account → Lost password" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_lost_password_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'lost-password',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Logout', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the triggering logout. You can add this to your menus via a custom link: yoursite.com/?customer-logout=true', 'woocommerce' ),
|
||||
'id' => 'woocommerce_logout_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'customer-logout',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'account_endpoint_options',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
if ( wc_site_is_https() ) {
|
||||
unset( $settings['unforce_ssl_checkout'], $settings['force_ssl_checkout'] );
|
||||
}
|
||||
} elseif ( 'legacy_api' === $current_section ) {
|
||||
$settings = apply_filters(
|
||||
'woocommerce_settings_rest_api', array(
|
||||
array(
|
||||
'title' => '',
|
||||
'type' => 'title',
|
||||
'desc' => '',
|
||||
'id' => 'legacy_api_options',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Legacy API', 'woocommerce' ),
|
||||
'desc' => __( 'Enable the legacy REST API', 'woocommerce' ),
|
||||
'id' => 'woocommerce_api_enabled',
|
||||
'type' => 'checkbox',
|
||||
'default' => 'no',
|
||||
),
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'legacy_api_options',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );
|
||||
}
|
||||
|
||||
/**
|
||||
* Form method.
|
||||
*
|
||||
* @param string $method Method name.
|
||||
* @return string
|
||||
*/
|
||||
public function form_method( $method ) {
|
||||
global $current_section;
|
||||
|
||||
if ( 'keys' === $current_section ) {
|
||||
if ( isset( $_GET['create-key'] ) || isset( $_GET['edit-key'] ) ) { // WPCS: input var okay, CSRF ok.
|
||||
return 'post';
|
||||
}
|
||||
|
||||
return 'get';
|
||||
}
|
||||
|
||||
return 'post';
|
||||
}
|
||||
|
||||
/**
|
||||
* Notices.
|
||||
*/
|
||||
private function notices() {
|
||||
if ( isset( $_GET['section'] ) && 'webhooks' === $_GET['section'] ) { // WPCS: input var okay, CSRF ok.
|
||||
WC_Admin_Webhooks::notices();
|
||||
}
|
||||
if ( isset( $_GET['section'] ) && 'keys' === $_GET['section'] ) { // WPCS: input var okay, CSRF ok.
|
||||
WC_Admin_API_Keys::notices();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the settings.
|
||||
*/
|
||||
public function output() {
|
||||
global $current_section;
|
||||
|
||||
if ( 'webhooks' === $current_section ) {
|
||||
WC_Admin_Webhooks::page_output();
|
||||
} elseif ( 'keys' === $current_section ) {
|
||||
WC_Admin_API_Keys::page_output();
|
||||
} else {
|
||||
$settings = $this->get_settings( $current_section );
|
||||
WC_Admin_Settings::output_fields( $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings.
|
||||
*/
|
||||
public function save() {
|
||||
global $current_section;
|
||||
|
||||
if ( apply_filters( 'woocommerce_rest_api_valid_to_save', ! in_array( $current_section, array( 'keys', 'webhooks' ), true ) ) ) {
|
||||
$settings = $this->get_settings( $current_section );
|
||||
|
||||
// Prevent the T&Cs and checkout page from being set to the same page.
|
||||
if ( isset( $_POST['woocommerce_terms_page_id'], $_POST['woocommerce_checkout_page_id'] ) && $_POST['woocommerce_terms_page_id'] === $_POST['woocommerce_checkout_page_id'] ) { // WPCS: input var ok, CSRF ok.
|
||||
$_POST['woocommerce_terms_page_id'] = '';
|
||||
}
|
||||
|
||||
WC_Admin_Settings::save_fields( $settings );
|
||||
|
||||
if ( $current_section ) {
|
||||
do_action( 'woocommerce_update_options_' . $this->id . '_' . $current_section );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Settings_Rest_API class.
|
||||
*
|
||||
* @deprecated 3.4 in favour of WC_Settings_Advanced.
|
||||
* @todo remove in 4.0.
|
||||
*/
|
||||
class WC_Settings_Rest_API extends WC_Settings_Advanced {} // @codingStandardsIgnoreLine.
|
||||
|
||||
return new WC_Settings_Advanced();
|
|
@ -1,393 +1,11 @@
|
|||
<?php // @codingStandardsIgnoreLine.
|
||||
<?php // @codingStandardsIgnoreFile.
|
||||
/**
|
||||
* WooCommerce Checkout Settings
|
||||
* Settings class file.
|
||||
*
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.5.0
|
||||
* @deprecated 3.4.0 Replaced with class-wc-settings-payment-gateways.php.
|
||||
* @todo remove in 4.0.
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( class_exists( 'WC_Settings_Payment_Gateways', false ) ) {
|
||||
return new WC_Settings_Payment_Gateways();
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Settings_Payment_Gateways.
|
||||
*/
|
||||
class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'checkout';
|
||||
$this->label = _x( 'Checkout', 'Settings tab label', 'woocommerce' );
|
||||
|
||||
add_action( 'woocommerce_admin_field_payment_gateways', array( $this, 'payment_gateways_setting' ) );
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sections.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_sections() {
|
||||
$sections = array(
|
||||
'' => __( 'Checkout options', 'woocommerce' ),
|
||||
);
|
||||
|
||||
if ( ! defined( 'WC_INSTALLING' ) ) {
|
||||
$payment_gateways = WC()->payment_gateways->payment_gateways();
|
||||
|
||||
foreach ( $payment_gateways as $gateway ) {
|
||||
$title = empty( $gateway->method_title ) ? ucfirst( $gateway->id ) : $gateway->method_title;
|
||||
$sections[ strtolower( $gateway->id ) ] = esc_html( $title );
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @param string $current_section Section being shown.
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings( $current_section = '' ) {
|
||||
$settings = array();
|
||||
|
||||
if ( '' === $current_section ) {
|
||||
$settings = apply_filters(
|
||||
'woocommerce_payment_gateways_settings', array(
|
||||
|
||||
array(
|
||||
'title' => __( 'Checkout process', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'id' => 'checkout_process_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Coupons', 'woocommerce' ),
|
||||
'desc' => __( 'Enable the use of coupons', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_coupons',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
'desc_tip' => __( 'Coupons can be applied from the cart and checkout pages.', 'woocommerce' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Calculate coupon discounts sequentially', 'woocommerce' ),
|
||||
'id' => 'woocommerce_calc_discounts_sequentially',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'desc_tip' => __( 'When applying multiple coupons, apply the first coupon to the full price and the second coupon to the discounted price and so on.', 'woocommerce' ),
|
||||
'checkboxgroup' => 'end',
|
||||
'autoload' => false,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Checkout process', 'woocommerce' ),
|
||||
'desc' => __( 'Enable guest checkout', 'woocommerce' ),
|
||||
'desc_tip' => __( 'Allows customers to checkout without creating an account.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_guest_checkout',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
'autoload' => false,
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Force secure checkout', 'woocommerce' ),
|
||||
'id' => 'woocommerce_force_ssl_checkout',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => '',
|
||||
'show_if_checked' => 'option',
|
||||
/* Translators: %s Docs URL. */
|
||||
'desc_tip' => sprintf( __( 'Force SSL (HTTPS) on the checkout pages (<a href="%s" target="_blank">an SSL Certificate is required</a>).', 'woocommerce' ), 'https://docs.woocommerce.com/document/ssl-and-https/#section-3' ),
|
||||
),
|
||||
|
||||
'unforce_ssl_checkout' => array(
|
||||
'desc' => __( 'Force HTTP when leaving the checkout', 'woocommerce' ),
|
||||
'id' => 'woocommerce_unforce_ssl_checkout',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end',
|
||||
'show_if_checked' => 'yes',
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'checkout_process_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Checkout pages', 'woocommerce' ),
|
||||
'desc' => __( 'These pages need to be set so that WooCommerce knows where to send users to checkout.', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'id' => 'checkout_page_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Cart page', 'woocommerce' ),
|
||||
/* Translators: %s Page contents. */
|
||||
'desc' => sprintf( __( 'Page contents: [%s]', 'woocommerce' ), apply_filters( 'woocommerce_cart_shortcode_tag', 'woocommerce_cart' ) ),
|
||||
'id' => 'woocommerce_cart_page_id',
|
||||
'type' => 'single_select_page',
|
||||
'default' => '',
|
||||
'class' => 'wc-enhanced-select-nostd',
|
||||
'css' => 'min-width:300px;',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Checkout page', 'woocommerce' ),
|
||||
/* Translators: %s Page contents. */
|
||||
'desc' => sprintf( __( 'Page contents: [%s]', 'woocommerce' ), apply_filters( 'woocommerce_checkout_shortcode_tag', 'woocommerce_checkout' ) ),
|
||||
'id' => 'woocommerce_checkout_page_id',
|
||||
'type' => 'single_select_page',
|
||||
'default' => '',
|
||||
'class' => 'wc-enhanced-select-nostd',
|
||||
'css' => 'min-width:300px;',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Terms and conditions', 'woocommerce' ),
|
||||
'desc' => __( 'If you define a "Terms" page the customer will be asked if they accept them when checking out.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_terms_page_id',
|
||||
'default' => '',
|
||||
'class' => 'wc-enhanced-select-nostd',
|
||||
'css' => 'min-width:300px;',
|
||||
'type' => 'single_select_page',
|
||||
'args' => array( 'exclude' => wc_get_page_id( 'checkout' ) ),
|
||||
'desc_tip' => true,
|
||||
'autoload' => false,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'checkout_page_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Checkout endpoints', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => __( 'Endpoints are appended to your page URLs to handle specific actions during the checkout process. They should be unique.', 'woocommerce' ),
|
||||
'id' => 'account_endpoint_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Pay', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "Checkout → Pay" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_checkout_pay_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'order-pay',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Order received', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "Checkout → Order received" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_checkout_order_received_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'order-received',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Add payment method', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the "Checkout → Add payment method" page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_add_payment_method_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'add-payment-method',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Delete payment method', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the delete payment method page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_delete_payment_method_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'delete-payment-method',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Set default payment method', 'woocommerce' ),
|
||||
'desc' => __( 'Endpoint for the setting a default payment method page.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_myaccount_set_default_payment_method_endpoint',
|
||||
'type' => 'text',
|
||||
'default' => 'set-default-payment-method',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'checkout_endpoint_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Payment gateways', 'woocommerce' ),
|
||||
'desc' => __( 'Installed gateways are listed below. Drag and drop gateways to control their display order on the frontend.', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'id' => 'payment_gateways_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'payment_gateways',
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'payment_gateways_options',
|
||||
),
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
if ( wc_site_is_https() ) {
|
||||
unset( $settings['unforce_ssl_checkout'] );
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the settings.
|
||||
*/
|
||||
public function output() {
|
||||
global $current_section;
|
||||
|
||||
// Load gateways so we can show any global options they may have.
|
||||
$payment_gateways = WC()->payment_gateways->payment_gateways();
|
||||
|
||||
if ( $current_section ) {
|
||||
foreach ( $payment_gateways as $gateway ) {
|
||||
if ( in_array( $current_section, array( $gateway->id, sanitize_title( get_class( $gateway ) ) ), true ) ) {
|
||||
$gateway->admin_options();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$settings = $this->get_settings();
|
||||
|
||||
WC_Admin_Settings::output_fields( $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output payment gateway settings.
|
||||
*/
|
||||
public function payment_gateways_setting() {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc"><?php esc_html_e( 'Gateway display order', 'woocommerce' ); ?></th>
|
||||
<td class="forminp">
|
||||
<table class="wc_gateways widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php
|
||||
$columns = apply_filters(
|
||||
'woocommerce_payment_gateways_setting_columns', array(
|
||||
'sort' => '',
|
||||
'name' => __( 'Gateway', 'woocommerce' ),
|
||||
'id' => __( 'Gateway ID', 'woocommerce' ),
|
||||
'status' => __( 'Enabled', 'woocommerce' ),
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $columns as $key => $column ) {
|
||||
echo '<th class="' . esc_attr( $key ) . '">' . esc_html( $column ) . '</th>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ( WC()->payment_gateways->payment_gateways() as $gateway ) {
|
||||
|
||||
echo '<tr>';
|
||||
|
||||
foreach ( $columns as $key => $column ) {
|
||||
|
||||
switch ( $key ) {
|
||||
|
||||
case 'sort':
|
||||
echo '<td width="1%" class="sort">
|
||||
<input type="hidden" name="gateway_order[]" value="' . esc_attr( $gateway->id ) . '" />
|
||||
</td>';
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
$method_title = $gateway->get_title() ? $gateway->get_title() : __( '(no title)', 'woocommerce' );
|
||||
echo '<td class="name">
|
||||
<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '">' . esc_html( $method_title ) . '</a>
|
||||
</td>';
|
||||
break;
|
||||
|
||||
case 'id':
|
||||
echo '<td class="id">' . esc_html( $gateway->id ) . '</td>';
|
||||
break;
|
||||
|
||||
case 'status':
|
||||
echo '<td class="status">';
|
||||
echo ( 'yes' === $gateway->enabled ) ? '<span class="status-enabled tips" data-tip="' . esc_attr__( 'Yes', 'woocommerce' ) . '">' . esc_html__( 'Yes', 'woocommerce' ) . '</span>' : '-';
|
||||
echo '</td>';
|
||||
break;
|
||||
|
||||
default:
|
||||
do_action( 'woocommerce_payment_gateways_setting_column_' . $key, $gateway );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings.
|
||||
*/
|
||||
public function save() {
|
||||
global $current_section;
|
||||
|
||||
$wc_payment_gateways = WC_Payment_Gateways::instance();
|
||||
|
||||
if ( ! $current_section ) {
|
||||
// Prevent the T&Cs and checkout page from being set to the same page.
|
||||
if ( isset( $_POST['woocommerce_terms_page_id'], $_POST['woocommerce_checkout_page_id'] ) && $_POST['woocommerce_terms_page_id'] === $_POST['woocommerce_checkout_page_id'] ) { // WPCS: input var ok, CSRF ok.
|
||||
$_POST['woocommerce_terms_page_id'] = '';
|
||||
}
|
||||
|
||||
WC_Admin_Settings::save_fields( $this->get_settings() );
|
||||
$wc_payment_gateways->process_admin_options();
|
||||
$wc_payment_gateways->init();
|
||||
|
||||
} else {
|
||||
foreach ( $wc_payment_gateways->payment_gateways() as $gateway ) {
|
||||
if ( in_array( $current_section, array( $gateway->id, sanitize_title( get_class( $gateway ) ) ), true ) ) {
|
||||
do_action( 'woocommerce_update_options_payment_gateways_' . $gateway->id );
|
||||
$wc_payment_gateways->init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $current_section ) {
|
||||
do_action( 'woocommerce_update_options_' . $this->id . '_' . $current_section );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new WC_Settings_Payment_Gateways();
|
||||
return include 'class-wc-settings-payment-gateways.php';
|
||||
|
|
|
@ -2,338 +2,333 @@
|
|||
/**
|
||||
* WooCommerce Email Settings
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.1.0
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( class_exists( 'WC_Settings_Emails', false ) ) {
|
||||
return new WC_Settings_Emails();
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'WC_Settings_Emails', false ) ) :
|
||||
/**
|
||||
* WC_Settings_Emails.
|
||||
*/
|
||||
class WC_Settings_Emails extends WC_Settings_Page {
|
||||
|
||||
/**
|
||||
* WC_Settings_Emails.
|
||||
* Constructor.
|
||||
*/
|
||||
class WC_Settings_Emails extends WC_Settings_Page {
|
||||
public function __construct() {
|
||||
$this->id = 'email';
|
||||
$this->label = __( 'Emails', 'woocommerce' );
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'email';
|
||||
$this->label = __( 'Emails', 'woocommerce' );
|
||||
add_action( 'woocommerce_admin_field_email_notification', array( $this, 'email_notification_setting' ) );
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
add_action( 'woocommerce_admin_field_email_notification', array( $this, 'email_notification_setting' ) );
|
||||
parent::__construct();
|
||||
}
|
||||
/**
|
||||
* Get sections.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_sections() {
|
||||
$sections = array(
|
||||
'' => __( 'Email options', 'woocommerce' ),
|
||||
);
|
||||
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sections.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_sections() {
|
||||
$sections = array(
|
||||
'' => __( 'Email options', 'woocommerce' ),
|
||||
);
|
||||
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
|
||||
}
|
||||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings() {
|
||||
$settings = apply_filters(
|
||||
'woocommerce_email_settings', array(
|
||||
|
||||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings() {
|
||||
$settings = apply_filters(
|
||||
'woocommerce_email_settings', array(
|
||||
array(
|
||||
'title' => __( 'Email notifications', 'woocommerce' ),
|
||||
'desc' => __( 'Email notifications sent from WooCommerce are listed below. Click on an email to configure it.', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'id' => 'email_notification_settings',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Email notifications', 'woocommerce' ),
|
||||
'desc' => __( 'Email notifications sent from WooCommerce are listed below. Click on an email to configure it.', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'id' => 'email_notification_settings',
|
||||
array( 'type' => 'email_notification' ),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'email_notification_settings',
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'email_recipient_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Email sender options', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => '',
|
||||
'id' => 'email_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( '"From" name', 'woocommerce' ),
|
||||
'desc' => __( 'How the sender name appears in outgoing WooCommerce emails.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_email_from_name',
|
||||
'type' => 'text',
|
||||
'css' => 'min-width:300px;',
|
||||
'default' => esc_attr( get_bloginfo( 'name', 'display' ) ),
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( '"From" address', 'woocommerce' ),
|
||||
'desc' => __( 'How the sender email appears in outgoing WooCommerce emails.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_email_from_address',
|
||||
'type' => 'email',
|
||||
'custom_attributes' => array(
|
||||
'multiple' => 'multiple',
|
||||
),
|
||||
'css' => 'min-width:300px;',
|
||||
'default' => get_option( 'admin_email' ),
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array( 'type' => 'email_notification' ),
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'email_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'email_notification_settings',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Email template', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => sprintf( __( 'This section lets you customize the WooCommerce emails. <a href="%s" target="_blank">Click here to preview your email template</a>.', 'woocommerce' ), wp_nonce_url( admin_url( '?preview_woocommerce_mail=true' ), 'preview-mail' ) ),
|
||||
'id' => 'email_template_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'email_recipient_options',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Header image', 'woocommerce' ),
|
||||
'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'woocommerce' ),
|
||||
'id' => 'woocommerce_email_header_image',
|
||||
'type' => 'text',
|
||||
'css' => 'min-width:300px;',
|
||||
'placeholder' => __( 'N/A', 'woocommerce' ),
|
||||
'default' => '',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Email sender options', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => '',
|
||||
'id' => 'email_options',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Footer text', 'woocommerce' ),
|
||||
'desc' => __( 'The text to appear in the footer of WooCommerce emails.', 'woocommerce' ) . ' ' . sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '{site_title}' ),
|
||||
'id' => 'woocommerce_email_footer_text',
|
||||
'css' => 'width:300px; height: 75px;',
|
||||
'placeholder' => __( 'N/A', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'default' => '{site_title}',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( '"From" name', 'woocommerce' ),
|
||||
'desc' => __( 'How the sender name appears in outgoing WooCommerce emails.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_email_from_name',
|
||||
'type' => 'text',
|
||||
'css' => 'min-width:300px;',
|
||||
'default' => esc_attr( get_bloginfo( 'name', 'display' ) ),
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Base color', 'woocommerce' ),
|
||||
/* translators: %s: default color */
|
||||
'desc' => sprintf( __( 'The base color for WooCommerce email templates. Default %s.', 'woocommerce' ), '<code>#96588a</code>' ),
|
||||
'id' => 'woocommerce_email_base_color',
|
||||
'type' => 'color',
|
||||
'css' => 'width:6em;',
|
||||
'default' => '#96588a',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( '"From" address', 'woocommerce' ),
|
||||
'desc' => __( 'How the sender email appears in outgoing WooCommerce emails.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_email_from_address',
|
||||
'type' => 'email',
|
||||
'custom_attributes' => array(
|
||||
'multiple' => 'multiple',
|
||||
),
|
||||
'css' => 'min-width:300px;',
|
||||
'default' => get_option( 'admin_email' ),
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Background color', 'woocommerce' ),
|
||||
/* translators: %s: default color */
|
||||
'desc' => sprintf( __( 'The background color for WooCommerce email templates. Default %s.', 'woocommerce' ), '<code>#f7f7f7</code>' ),
|
||||
'id' => 'woocommerce_email_background_color',
|
||||
'type' => 'color',
|
||||
'css' => 'width:6em;',
|
||||
'default' => '#f7f7f7',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'email_options',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Body background color', 'woocommerce' ),
|
||||
/* translators: %s: default color */
|
||||
'desc' => sprintf( __( 'The main body background color. Default %s.', 'woocommerce' ), '<code>#ffffff</code>' ),
|
||||
'id' => 'woocommerce_email_body_background_color',
|
||||
'type' => 'color',
|
||||
'css' => 'width:6em;',
|
||||
'default' => '#ffffff',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Email template', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => sprintf( __( 'This section lets you customize the WooCommerce emails. <a href="%s" target="_blank">Click here to preview your email template</a>.', 'woocommerce' ), wp_nonce_url( admin_url( '?preview_woocommerce_mail=true' ), 'preview-mail' ) ),
|
||||
'id' => 'email_template_options',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Body text color', 'woocommerce' ),
|
||||
/* translators: %s: default color */
|
||||
'desc' => sprintf( __( 'The main body text color. Default %s.', 'woocommerce' ), '<code>#3c3c3c</code>' ),
|
||||
'id' => 'woocommerce_email_text_color',
|
||||
'type' => 'color',
|
||||
'css' => 'width:6em;',
|
||||
'default' => '#3c3c3c',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Header image', 'woocommerce' ),
|
||||
'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'woocommerce' ),
|
||||
'id' => 'woocommerce_email_header_image',
|
||||
'type' => 'text',
|
||||
'css' => 'min-width:300px;',
|
||||
'placeholder' => __( 'N/A', 'woocommerce' ),
|
||||
'default' => '',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'email_template_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Footer text', 'woocommerce' ),
|
||||
'desc' => __( 'The text to appear in the footer of WooCommerce emails.', 'woocommerce' )
|
||||
. ' ' . sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '{site_title}' ),
|
||||
'id' => 'woocommerce_email_footer_text',
|
||||
'css' => 'width:300px; height: 75px;',
|
||||
'placeholder' => __( 'N/A', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'default' => '{site_title}',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
array(
|
||||
'title' => __( 'Base color', 'woocommerce' ),
|
||||
/* translators: %s: default color */
|
||||
'desc' => sprintf( __( 'The base color for WooCommerce email templates. Default %s.', 'woocommerce' ), '<code>#96588a</code>' ),
|
||||
'id' => 'woocommerce_email_base_color',
|
||||
'type' => 'color',
|
||||
'css' => 'width:6em;',
|
||||
'default' => '#96588a',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
|
||||
}
|
||||
|
||||
array(
|
||||
'title' => __( 'Background color', 'woocommerce' ),
|
||||
/* translators: %s: default color */
|
||||
'desc' => sprintf( __( 'The background color for WooCommerce email templates. Default %s.', 'woocommerce' ), '<code>#f7f7f7</code>' ),
|
||||
'id' => 'woocommerce_email_background_color',
|
||||
'type' => 'color',
|
||||
'css' => 'width:6em;',
|
||||
'default' => '#f7f7f7',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
/**
|
||||
* Output the settings.
|
||||
*/
|
||||
public function output() {
|
||||
global $current_section;
|
||||
|
||||
array(
|
||||
'title' => __( 'Body background color', 'woocommerce' ),
|
||||
/* translators: %s: default color */
|
||||
'desc' => sprintf( __( 'The main body background color. Default %s.', 'woocommerce' ), '<code>#ffffff</code>' ),
|
||||
'id' => 'woocommerce_email_body_background_color',
|
||||
'type' => 'color',
|
||||
'css' => 'width:6em;',
|
||||
'default' => '#ffffff',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
// Define emails that can be customised here.
|
||||
$mailer = WC()->mailer();
|
||||
$email_templates = $mailer->get_emails();
|
||||
|
||||
array(
|
||||
'title' => __( 'Body text color', 'woocommerce' ),
|
||||
/* translators: %s: default color */
|
||||
'desc' => sprintf( __( 'The main body text color. Default %s.', 'woocommerce' ), '<code>#3c3c3c</code>' ),
|
||||
'id' => 'woocommerce_email_text_color',
|
||||
'type' => 'color',
|
||||
'css' => 'width:6em;',
|
||||
'default' => '#3c3c3c',
|
||||
'autoload' => false,
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'email_template_options',
|
||||
),
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the settings.
|
||||
*/
|
||||
public function output() {
|
||||
global $current_section;
|
||||
|
||||
// Define emails that can be customised here.
|
||||
$mailer = WC()->mailer();
|
||||
$email_templates = $mailer->get_emails();
|
||||
|
||||
if ( $current_section ) {
|
||||
foreach ( $email_templates as $email_key => $email ) {
|
||||
if ( strtolower( $email_key ) == $current_section ) {
|
||||
$email->admin_options();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$settings = $this->get_settings();
|
||||
WC_Admin_Settings::output_fields( $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings.
|
||||
*/
|
||||
public function save() {
|
||||
global $current_section;
|
||||
|
||||
if ( ! $current_section ) {
|
||||
WC_Admin_Settings::save_fields( $this->get_settings() );
|
||||
|
||||
} else {
|
||||
$wc_emails = WC_Emails::instance();
|
||||
|
||||
if ( in_array( $current_section, array_map( 'sanitize_title', array_keys( $wc_emails->get_emails() ) ) ) ) {
|
||||
foreach ( $wc_emails->get_emails() as $email_id => $email ) {
|
||||
if ( sanitize_title( $email_id ) === $current_section ) {
|
||||
do_action( 'woocommerce_update_options_' . $this->id . '_' . $email->id );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
do_action( 'woocommerce_update_options_' . $this->id . '_' . $current_section );
|
||||
if ( $current_section ) {
|
||||
foreach ( $email_templates as $email_key => $email ) {
|
||||
if ( strtolower( $email_key ) === $current_section ) {
|
||||
$email->admin_options();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output email notification settings.
|
||||
*/
|
||||
public function email_notification_setting() {
|
||||
// Define emails that can be customised here.
|
||||
$mailer = WC()->mailer();
|
||||
$email_templates = $mailer->get_emails();
|
||||
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td class="wc_emails_wrapper" colspan="2">
|
||||
<table class="wc_emails widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php
|
||||
$columns = apply_filters(
|
||||
'woocommerce_email_setting_columns', array(
|
||||
'status' => '',
|
||||
'name' => __( 'Email', 'woocommerce' ),
|
||||
'email_type' => __( 'Content type', 'woocommerce' ),
|
||||
'recipient' => __( 'Recipient(s)', 'woocommerce' ),
|
||||
'actions' => '',
|
||||
)
|
||||
);
|
||||
foreach ( $columns as $key => $column ) {
|
||||
echo '<th class="wc-email-settings-table-' . esc_attr( $key ) . '">' . esc_html( $column ) . '</th>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ( $email_templates as $email_key => $email ) {
|
||||
echo '<tr>';
|
||||
|
||||
foreach ( $columns as $key => $column ) {
|
||||
|
||||
switch ( $key ) {
|
||||
case 'name':
|
||||
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
|
||||
<a href="' . admin_url( 'admin.php?page=wc-settings&tab=email§ion=' . strtolower( $email_key ) ) . '">' . $email->get_title() . '</a>
|
||||
' . wc_help_tip( $email->get_description() ) . '
|
||||
</td>';
|
||||
break;
|
||||
case 'recipient':
|
||||
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
|
||||
' . esc_html( $email->is_customer_email() ? __( 'Customer', 'woocommerce' ) : $email->get_recipient() ) . '
|
||||
</td>';
|
||||
break;
|
||||
case 'status':
|
||||
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">';
|
||||
|
||||
if ( $email->is_manual() ) {
|
||||
echo '<span class="status-manual tips" data-tip="' . esc_attr__( 'Manually sent', 'woocommerce' ) . '">' . esc_html__( 'Manual', 'woocommerce' ) . '</span>';
|
||||
} elseif ( $email->is_enabled() ) {
|
||||
echo '<span class="status-enabled tips" data-tip="' . esc_attr__( 'Enabled', 'woocommerce' ) . '">' . esc_html__( 'Yes', 'woocommerce' ) . '</span>';
|
||||
} else {
|
||||
echo '<span class="status-disabled tips" data-tip="' . esc_attr__( 'Disabled', 'woocommerce' ) . '">-</span>';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
break;
|
||||
case 'email_type':
|
||||
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
|
||||
' . esc_html( $email->get_content_type() ) . '
|
||||
</td>';
|
||||
break;
|
||||
case 'actions':
|
||||
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
|
||||
<a class="button alignright tips" data-tip="' . esc_attr__( 'Configure', 'woocommerce' ) . '" href="' . admin_url( 'admin.php?page=wc-settings&tab=email§ion=' . strtolower( $email_key ) ) . '">' . esc_html__( 'Configure', 'woocommerce' ) . '</a>
|
||||
</td>';
|
||||
break;
|
||||
default:
|
||||
do_action( 'woocommerce_email_setting_column_' . $key, $email );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} else {
|
||||
$settings = $this->get_settings();
|
||||
WC_Admin_Settings::output_fields( $settings );
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
/**
|
||||
* Save settings.
|
||||
*/
|
||||
public function save() {
|
||||
global $current_section;
|
||||
|
||||
if ( ! $current_section ) {
|
||||
WC_Admin_Settings::save_fields( $this->get_settings() );
|
||||
|
||||
} else {
|
||||
$wc_emails = WC_Emails::instance();
|
||||
|
||||
if ( in_array( $current_section, array_map( 'sanitize_title', array_keys( $wc_emails->get_emails() ) ), true ) ) {
|
||||
foreach ( $wc_emails->get_emails() as $email_id => $email ) {
|
||||
if ( sanitize_title( $email_id ) === $current_section ) {
|
||||
do_action( 'woocommerce_update_options_' . $this->id . '_' . $email->id );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
do_action( 'woocommerce_update_options_' . $this->id . '_' . $current_section );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output email notification settings.
|
||||
*/
|
||||
public function email_notification_setting() {
|
||||
// Define emails that can be customised here.
|
||||
$mailer = WC()->mailer();
|
||||
$email_templates = $mailer->get_emails();
|
||||
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td class="wc_emails_wrapper" colspan="2">
|
||||
<table class="wc_emails widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php
|
||||
$columns = apply_filters(
|
||||
'woocommerce_email_setting_columns', array(
|
||||
'status' => '',
|
||||
'name' => __( 'Email', 'woocommerce' ),
|
||||
'email_type' => __( 'Content type', 'woocommerce' ),
|
||||
'recipient' => __( 'Recipient(s)', 'woocommerce' ),
|
||||
'actions' => '',
|
||||
)
|
||||
);
|
||||
foreach ( $columns as $key => $column ) {
|
||||
echo '<th class="wc-email-settings-table-' . esc_attr( $key ) . '">' . esc_html( $column ) . '</th>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ( $email_templates as $email_key => $email ) {
|
||||
echo '<tr>';
|
||||
|
||||
foreach ( $columns as $key => $column ) {
|
||||
|
||||
switch ( $key ) {
|
||||
case 'name':
|
||||
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
|
||||
<a href="' . admin_url( 'admin.php?page=wc-settings&tab=email§ion=' . strtolower( $email_key ) ) . '">' . $email->get_title() . '</a>
|
||||
' . wc_help_tip( $email->get_description() ) . '
|
||||
</td>';
|
||||
break;
|
||||
case 'recipient':
|
||||
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
|
||||
' . esc_html( $email->is_customer_email() ? __( 'Customer', 'woocommerce' ) : $email->get_recipient() ) . '
|
||||
</td>';
|
||||
break;
|
||||
case 'status':
|
||||
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">';
|
||||
|
||||
if ( $email->is_manual() ) {
|
||||
echo '<span class="status-manual tips" data-tip="' . esc_attr__( 'Manually sent', 'woocommerce' ) . '">' . esc_html__( 'Manual', 'woocommerce' ) . '</span>';
|
||||
} elseif ( $email->is_enabled() ) {
|
||||
echo '<span class="status-enabled tips" data-tip="' . esc_attr__( 'Enabled', 'woocommerce' ) . '">' . esc_html__( 'Yes', 'woocommerce' ) . '</span>';
|
||||
} else {
|
||||
echo '<span class="status-disabled tips" data-tip="' . esc_attr__( 'Disabled', 'woocommerce' ) . '">-</span>';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
break;
|
||||
case 'email_type':
|
||||
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
|
||||
' . esc_html( $email->get_content_type() ) . '
|
||||
</td>';
|
||||
break;
|
||||
case 'actions':
|
||||
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
|
||||
<a class="button alignright" href="' . admin_url( 'admin.php?page=wc-settings&tab=email§ion=' . strtolower( $email_key ) ) . '">' . esc_html__( 'Manage', 'woocommerce' ) . '</a>
|
||||
</td>';
|
||||
break;
|
||||
default:
|
||||
do_action( 'woocommerce_email_setting_column_' . $key, $email );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
return new WC_Settings_Emails();
|
||||
|
|
|
@ -2,357 +2,381 @@
|
|||
/**
|
||||
* WooCommerce General Settings
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.1.0
|
||||
* @package WooCommerce/Admin
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( class_exists( 'WC_Settings_General', false ) ) {
|
||||
return new WC_Settings_General();
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'WC_Settings_General', false ) ) :
|
||||
/**
|
||||
* WC_Admin_Settings_General.
|
||||
*/
|
||||
class WC_Settings_General extends WC_Settings_Page {
|
||||
|
||||
/**
|
||||
* WC_Admin_Settings_General.
|
||||
* Constructor.
|
||||
*/
|
||||
class WC_Settings_General extends WC_Settings_Page {
|
||||
public function __construct() {
|
||||
$this->id = 'general';
|
||||
$this->label = __( 'General', 'woocommerce' );
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'general';
|
||||
$this->label = __( 'General', 'woocommerce' );
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings() {
|
||||
|
||||
$currency_code_options = get_woocommerce_currencies();
|
||||
|
||||
foreach ( $currency_code_options as $code => $name ) {
|
||||
$currency_code_options[ $code ] = $name . ' (' . get_woocommerce_currency_symbol( $code ) . ')';
|
||||
}
|
||||
|
||||
$settings = apply_filters(
|
||||
'woocommerce_general_settings', array(
|
||||
|
||||
array(
|
||||
'title' => __( 'Store Address', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => __( 'This is where your business is located. Tax rates and shipping rates will use this address.', 'woocommerce' ),
|
||||
'id' => 'store_address',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Address line 1', 'woocommerce' ),
|
||||
'desc' => __( 'The street address for your business location.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_store_address',
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Address line 2', 'woocommerce' ),
|
||||
'desc' => __( 'An additional, optional address line for your business location.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_store_address_2',
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'City', 'woocommerce' ),
|
||||
'desc' => __( 'The city in which your business is located.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_store_city',
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Country / State', 'woocommerce' ),
|
||||
'desc' => __( 'The country and state or province, if any, in which your business is located.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_default_country',
|
||||
'default' => 'GB',
|
||||
'type' => 'single_select_country',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Postcode / ZIP', 'woocommerce' ),
|
||||
'desc' => __( 'The postal code, if any, in which your business is located.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_store_postcode',
|
||||
'css' => 'min-width:50px;',
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'store_address',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'General options', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => '',
|
||||
'id' => 'general_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Selling location(s)', 'woocommerce' ),
|
||||
'desc' => __( 'This option lets you limit which countries you are willing to sell to.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_allowed_countries',
|
||||
'default' => 'all',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'css' => 'min-width: 350px;',
|
||||
'desc_tip' => true,
|
||||
'options' => array(
|
||||
'all' => __( 'Sell to all countries', 'woocommerce' ),
|
||||
'all_except' => __( 'Sell to all countries, except for…', 'woocommerce' ),
|
||||
'specific' => __( 'Sell to specific countries', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Sell to all countries, except for…', 'woocommerce' ),
|
||||
'desc' => '',
|
||||
'id' => 'woocommerce_all_except_countries',
|
||||
'css' => 'min-width: 350px;',
|
||||
'default' => '',
|
||||
'type' => 'multi_select_countries',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Sell to specific countries', 'woocommerce' ),
|
||||
'desc' => '',
|
||||
'id' => 'woocommerce_specific_allowed_countries',
|
||||
'css' => 'min-width: 350px;',
|
||||
'default' => '',
|
||||
'type' => 'multi_select_countries',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Shipping location(s)', 'woocommerce' ),
|
||||
'desc' => __( 'Choose which countries you want to ship to, or choose to ship to all locations you sell to.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_ship_to_countries',
|
||||
'default' => '',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'desc_tip' => true,
|
||||
'options' => array(
|
||||
'' => __( 'Ship to all countries you sell to', 'woocommerce' ),
|
||||
'all' => __( 'Ship to all countries', 'woocommerce' ),
|
||||
'specific' => __( 'Ship to specific countries only', 'woocommerce' ),
|
||||
'disabled' => __( 'Disable shipping & shipping calculations', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Ship to specific countries', 'woocommerce' ),
|
||||
'desc' => '',
|
||||
'id' => 'woocommerce_specific_ship_to_countries',
|
||||
'css' => '',
|
||||
'default' => '',
|
||||
'type' => 'multi_select_countries',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Default customer location', 'woocommerce' ),
|
||||
'id' => 'woocommerce_default_customer_address',
|
||||
'desc_tip' => __( 'This option determines a customers default location. The MaxMind GeoLite Database will be periodically downloaded to your wp-content directory if using geolocation.', 'woocommerce' ),
|
||||
'default' => 'geolocation',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'options' => array(
|
||||
'' => __( 'No location by default', 'woocommerce' ),
|
||||
'base' => __( 'Shop base address', 'woocommerce' ),
|
||||
'geolocation' => __( 'Geolocate', 'woocommerce' ),
|
||||
'geolocation_ajax' => __( 'Geolocate (with page caching support)', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Enable taxes', 'woocommerce' ),
|
||||
'desc' => __( 'Enable taxes and tax calculations', 'woocommerce' ),
|
||||
'id' => 'woocommerce_calc_taxes',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'general_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Currency options', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => __( 'The following options affect how prices are displayed on the frontend.', 'woocommerce' ),
|
||||
'id' => 'pricing_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Currency', 'woocommerce' ),
|
||||
'desc' => __( 'This controls what currency prices are listed at in the catalog and which currency gateways will take payments in.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_currency',
|
||||
'default' => 'GBP',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'desc_tip' => true,
|
||||
'options' => $currency_code_options,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Currency position', 'woocommerce' ),
|
||||
'desc' => __( 'This controls the position of the currency symbol.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_currency_pos',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'default' => 'left',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'left' => __( 'Left', 'woocommerce' ),
|
||||
'right' => __( 'Right', 'woocommerce' ),
|
||||
'left_space' => __( 'Left with space', 'woocommerce' ),
|
||||
'right_space' => __( 'Right with space', 'woocommerce' ),
|
||||
),
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Thousand separator', 'woocommerce' ),
|
||||
'desc' => __( 'This sets the thousand separator of displayed prices.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_price_thousand_sep',
|
||||
'css' => 'width:50px;',
|
||||
'default' => ',',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Decimal separator', 'woocommerce' ),
|
||||
'desc' => __( 'This sets the decimal separator of displayed prices.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_price_decimal_sep',
|
||||
'css' => 'width:50px;',
|
||||
'default' => '.',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Number of decimals', 'woocommerce' ),
|
||||
'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_price_num_decimals',
|
||||
'css' => 'width:50px;',
|
||||
'default' => '2',
|
||||
'desc_tip' => true,
|
||||
'type' => 'number',
|
||||
'custom_attributes' => array(
|
||||
'min' => 0,
|
||||
'step' => 1,
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'pricing_options',
|
||||
),
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a color picker input box.
|
||||
*
|
||||
* @param mixed $name
|
||||
* @param string $id
|
||||
* @param mixed $value
|
||||
* @param string $desc (default: '')
|
||||
*/
|
||||
public function color_picker( $name, $id, $value, $desc = '' ) {
|
||||
echo '<div class="color_box">' . wc_help_tip( $desc ) . '
|
||||
<input name="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '" type="text" value="' . esc_attr( $value ) . '" class="colorpick" /> <div id="colorPickerDiv_' . esc_attr( $id ) . '" class="colorpickdiv"></div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a notice showing where the store notice setting has moved.
|
||||
*
|
||||
* @since 3.3.1
|
||||
* @todo remove in next major release.
|
||||
*/
|
||||
private function store_notice_setting_moved_notice() {
|
||||
if ( get_user_meta( get_current_user_id(), 'dismissed_store_notice_setting_moved_notice', true ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div id="message" class="updated woocommerce-message inline">
|
||||
<a class="woocommerce-message-close notice-dismiss" style="top:0;" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'store_notice_setting_moved' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'woocommerce' ); ?></a>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
/* translators: %s: URL to customizer. */
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
__( 'Looking for the store notice setting? It can now be found <a href="%s">in the Customizer</a>.', 'woocommerce' ), esc_url(
|
||||
add_query_arg(
|
||||
array(
|
||||
'autofocus' => array(
|
||||
'panel' => 'woocommerce',
|
||||
),
|
||||
'url' => wc_get_page_permalink( 'shop' ),
|
||||
), admin_url( 'customize.php' )
|
||||
)
|
||||
)
|
||||
), array(
|
||||
'a' => array(
|
||||
'href' => array(),
|
||||
'title' => array(),
|
||||
),
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the settings.
|
||||
*/
|
||||
public function output() {
|
||||
$settings = $this->get_settings();
|
||||
|
||||
$this->store_notice_setting_moved_notice();
|
||||
|
||||
WC_Admin_Settings::output_fields( $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings.
|
||||
*/
|
||||
public function save() {
|
||||
$settings = $this->get_settings();
|
||||
|
||||
WC_Admin_Settings::save_fields( $settings );
|
||||
}
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
endif;
|
||||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings() {
|
||||
|
||||
$currency_code_options = get_woocommerce_currencies();
|
||||
|
||||
foreach ( $currency_code_options as $code => $name ) {
|
||||
$currency_code_options[ $code ] = $name . ' (' . get_woocommerce_currency_symbol( $code ) . ')';
|
||||
}
|
||||
|
||||
$woocommerce_default_customer_address_options = array(
|
||||
'' => __( 'No location by default', 'woocommerce' ),
|
||||
'base' => __( 'Shop base address', 'woocommerce' ),
|
||||
'geolocation' => __( 'Geolocate', 'woocommerce' ),
|
||||
'geolocation_ajax' => __( 'Geolocate (with page caching support)', 'woocommerce' ),
|
||||
);
|
||||
|
||||
if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
||||
unset( $woocommerce_default_customer_address_options['geolocation'], $woocommerce_default_customer_address_options['geolocation_ajax'] );
|
||||
}
|
||||
|
||||
$settings = apply_filters(
|
||||
'woocommerce_general_settings', array(
|
||||
|
||||
array(
|
||||
'title' => __( 'Store Address', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => __( 'This is where your business is located. Tax rates and shipping rates will use this address.', 'woocommerce' ),
|
||||
'id' => 'store_address',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Address line 1', 'woocommerce' ),
|
||||
'desc' => __( 'The street address for your business location.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_store_address',
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Address line 2', 'woocommerce' ),
|
||||
'desc' => __( 'An additional, optional address line for your business location.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_store_address_2',
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'City', 'woocommerce' ),
|
||||
'desc' => __( 'The city in which your business is located.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_store_city',
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Country / State', 'woocommerce' ),
|
||||
'desc' => __( 'The country and state or province, if any, in which your business is located.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_default_country',
|
||||
'default' => 'GB',
|
||||
'type' => 'single_select_country',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Postcode / ZIP', 'woocommerce' ),
|
||||
'desc' => __( 'The postal code, if any, in which your business is located.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_store_postcode',
|
||||
'css' => 'min-width:50px;',
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'store_address',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'General options', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => '',
|
||||
'id' => 'general_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Selling location(s)', 'woocommerce' ),
|
||||
'desc' => __( 'This option lets you limit which countries you are willing to sell to.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_allowed_countries',
|
||||
'default' => 'all',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'css' => 'min-width: 350px;',
|
||||
'desc_tip' => true,
|
||||
'options' => array(
|
||||
'all' => __( 'Sell to all countries', 'woocommerce' ),
|
||||
'all_except' => __( 'Sell to all countries, except for…', 'woocommerce' ),
|
||||
'specific' => __( 'Sell to specific countries', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Sell to all countries, except for…', 'woocommerce' ),
|
||||
'desc' => '',
|
||||
'id' => 'woocommerce_all_except_countries',
|
||||
'css' => 'min-width: 350px;',
|
||||
'default' => '',
|
||||
'type' => 'multi_select_countries',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Sell to specific countries', 'woocommerce' ),
|
||||
'desc' => '',
|
||||
'id' => 'woocommerce_specific_allowed_countries',
|
||||
'css' => 'min-width: 350px;',
|
||||
'default' => '',
|
||||
'type' => 'multi_select_countries',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Shipping location(s)', 'woocommerce' ),
|
||||
'desc' => __( 'Choose which countries you want to ship to, or choose to ship to all locations you sell to.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_ship_to_countries',
|
||||
'default' => '',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'desc_tip' => true,
|
||||
'options' => array(
|
||||
'' => __( 'Ship to all countries you sell to', 'woocommerce' ),
|
||||
'all' => __( 'Ship to all countries', 'woocommerce' ),
|
||||
'specific' => __( 'Ship to specific countries only', 'woocommerce' ),
|
||||
'disabled' => __( 'Disable shipping & shipping calculations', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Ship to specific countries', 'woocommerce' ),
|
||||
'desc' => '',
|
||||
'id' => 'woocommerce_specific_ship_to_countries',
|
||||
'css' => '',
|
||||
'default' => '',
|
||||
'type' => 'multi_select_countries',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Default customer location', 'woocommerce' ),
|
||||
'id' => 'woocommerce_default_customer_address',
|
||||
'desc_tip' => __( 'This option determines a customers default location. The MaxMind GeoLite Database will be periodically downloaded to your wp-content directory if using geolocation.', 'woocommerce' ),
|
||||
'default' => 'geolocation',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'options' => $woocommerce_default_customer_address_options,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Enable taxes', 'woocommerce' ),
|
||||
'desc' => __( 'Enable tax rates and calculations', 'woocommerce' ),
|
||||
'id' => 'woocommerce_calc_taxes',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'desc_tip' => __( 'Rates will be configurable and taxes will be calculated during checkout.', 'woocommerce' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Enable coupons', 'woocommerce' ),
|
||||
'desc' => __( 'Enable the use of coupon codes', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_coupons',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
'show_if_checked' => 'option',
|
||||
'desc_tip' => __( 'Coupons can be applied from the cart and checkout pages.', 'woocommerce' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Calculate coupon discounts sequentially', 'woocommerce' ),
|
||||
'id' => 'woocommerce_calc_discounts_sequentially',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'desc_tip' => __( 'When applying multiple coupons, apply the first coupon to the full price and the second coupon to the discounted price and so on.', 'woocommerce' ),
|
||||
'show_if_checked' => 'yes',
|
||||
'checkboxgroup' => 'end',
|
||||
'autoload' => false,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'general_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Currency options', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => __( 'The following options affect how prices are displayed on the frontend.', 'woocommerce' ),
|
||||
'id' => 'pricing_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Currency', 'woocommerce' ),
|
||||
'desc' => __( 'This controls what currency prices are listed at in the catalog and which currency gateways will take payments in.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_currency',
|
||||
'default' => 'GBP',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'desc_tip' => true,
|
||||
'options' => $currency_code_options,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Currency position', 'woocommerce' ),
|
||||
'desc' => __( 'This controls the position of the currency symbol.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_currency_pos',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'default' => 'left',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'left' => __( 'Left', 'woocommerce' ),
|
||||
'right' => __( 'Right', 'woocommerce' ),
|
||||
'left_space' => __( 'Left with space', 'woocommerce' ),
|
||||
'right_space' => __( 'Right with space', 'woocommerce' ),
|
||||
),
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Thousand separator', 'woocommerce' ),
|
||||
'desc' => __( 'This sets the thousand separator of displayed prices.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_price_thousand_sep',
|
||||
'css' => 'width:50px;',
|
||||
'default' => ',',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Decimal separator', 'woocommerce' ),
|
||||
'desc' => __( 'This sets the decimal separator of displayed prices.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_price_decimal_sep',
|
||||
'css' => 'width:50px;',
|
||||
'default' => '.',
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Number of decimals', 'woocommerce' ),
|
||||
'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_price_num_decimals',
|
||||
'css' => 'width:50px;',
|
||||
'default' => '2',
|
||||
'desc_tip' => true,
|
||||
'type' => 'number',
|
||||
'custom_attributes' => array(
|
||||
'min' => 0,
|
||||
'step' => 1,
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'pricing_options',
|
||||
),
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a color picker input box.
|
||||
*
|
||||
* @param mixed $name Name of input.
|
||||
* @param string $id ID of input.
|
||||
* @param mixed $value Value of input.
|
||||
* @param string $desc (default: '') Description for input.
|
||||
*/
|
||||
public function color_picker( $name, $id, $value, $desc = '' ) {
|
||||
echo '<div class="color_box">' . wc_help_tip( $desc ) . '
|
||||
<input name="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '" type="text" value="' . esc_attr( $value ) . '" class="colorpick" /> <div id="colorPickerDiv_' . esc_attr( $id ) . '" class="colorpickdiv"></div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a notice showing where the store notice setting has moved.
|
||||
*
|
||||
* @since 3.3.1
|
||||
* @todo remove in next major release.
|
||||
*/
|
||||
private function store_notice_setting_moved_notice() {
|
||||
if ( get_user_meta( get_current_user_id(), 'dismissed_store_notice_setting_moved_notice', true ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div id="message" class="updated woocommerce-message inline">
|
||||
<a class="woocommerce-message-close notice-dismiss" style="top:0;" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'store_notice_setting_moved' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'woocommerce' ); ?></a>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
/* translators: %s: URL to customizer. */
|
||||
__( 'Looking for the store notice setting? It can now be found <a href="%s">in the Customizer</a>.', 'woocommerce' ), esc_url(
|
||||
add_query_arg(
|
||||
array(
|
||||
'autofocus' => array(
|
||||
'panel' => 'woocommerce',
|
||||
),
|
||||
'url' => wc_get_page_permalink( 'shop' ),
|
||||
), admin_url( 'customize.php' )
|
||||
)
|
||||
)
|
||||
), array(
|
||||
'a' => array(
|
||||
'href' => array(),
|
||||
'title' => array(),
|
||||
),
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the settings.
|
||||
*/
|
||||
public function output() {
|
||||
$settings = $this->get_settings();
|
||||
|
||||
$this->store_notice_setting_moved_notice();
|
||||
|
||||
WC_Admin_Settings::output_fields( $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings.
|
||||
*/
|
||||
public function save() {
|
||||
$settings = $this->get_settings();
|
||||
|
||||
WC_Admin_Settings::save_fields( $settings );
|
||||
}
|
||||
}
|
||||
|
||||
return new WC_Settings_General();
|
||||
|
|
|
@ -0,0 +1,220 @@
|
|||
<?php // @codingStandardsIgnoreLine.
|
||||
/**
|
||||
* WooCommerce Checkout Settings
|
||||
*
|
||||
* @package WooCommerce/Admin
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( class_exists( 'WC_Settings_Payment_Gateways', false ) ) {
|
||||
return new WC_Settings_Payment_Gateways();
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Settings_Payment_Gateways.
|
||||
*/
|
||||
class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'checkout'; // @todo In future versions this may make more sense as 'payment' however to avoid breakage lets leave this alone until we refactor settings APIs in general.
|
||||
$this->label = _x( 'Payments', 'Settings tab label', 'woocommerce' );
|
||||
|
||||
add_action( 'woocommerce_admin_field_payment_gateways', array( $this, 'payment_gateways_setting' ) );
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sections.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_sections() {
|
||||
$sections = array(
|
||||
'' => __( 'Payment methods', 'woocommerce' ),
|
||||
);
|
||||
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @param string $current_section Section being shown.
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings( $current_section = '' ) {
|
||||
$settings = array();
|
||||
|
||||
if ( '' === $current_section ) {
|
||||
$settings = apply_filters(
|
||||
'woocommerce_payment_gateways_settings', array(
|
||||
array(
|
||||
'title' => __( 'Payment methods', 'woocommerce' ),
|
||||
'desc' => __( 'Installed payment methods are listed below. Drag and drop gateways to control their display order on the frontend.', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'id' => 'payment_gateways_options',
|
||||
),
|
||||
array(
|
||||
'type' => 'payment_gateways',
|
||||
),
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'payment_gateways_options',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the settings.
|
||||
*/
|
||||
public function output() {
|
||||
global $current_section;
|
||||
|
||||
// Load gateways so we can show any global options they may have.
|
||||
$payment_gateways = WC()->payment_gateways->payment_gateways();
|
||||
|
||||
if ( $current_section ) {
|
||||
foreach ( $payment_gateways as $gateway ) {
|
||||
if ( in_array( $current_section, array( $gateway->id, sanitize_title( get_class( $gateway ) ) ), true ) ) {
|
||||
if ( isset( $_GET['toggle_enabled'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
$enabled = $gateway->get_option( 'enabled' );
|
||||
|
||||
if ( $enabled ) {
|
||||
$gateway->settings['enabled'] = wc_string_to_bool( $enabled ) ? 'no' : 'yes';
|
||||
}
|
||||
}
|
||||
$gateway->admin_options();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$settings = $this->get_settings();
|
||||
WC_Admin_Settings::output_fields( $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output payment gateway settings.
|
||||
*/
|
||||
public function payment_gateways_setting() {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td class="wc_payment_gateways_wrapper" colspan="2">
|
||||
<table class="wc_gateways widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php
|
||||
$default_columns = array(
|
||||
'sort' => '',
|
||||
'name' => __( 'Method', 'woocommerce' ),
|
||||
'status' => __( 'Enabled', 'woocommerce' ),
|
||||
'description' => __( 'Description', 'woocommerce' ),
|
||||
'action' => '',
|
||||
);
|
||||
|
||||
$columns = apply_filters( 'woocommerce_payment_gateways_setting_columns', $default_columns );
|
||||
|
||||
foreach ( $columns as $key => $column ) {
|
||||
echo '<th class="' . esc_attr( $key ) . '">' . esc_html( $column ) . '</th>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ( WC()->payment_gateways->payment_gateways() as $gateway ) {
|
||||
|
||||
echo '<tr data-gateway_id="' . esc_attr( $gateway->id ) . '">';
|
||||
|
||||
foreach ( $columns as $key => $column ) {
|
||||
if ( ! array_key_exists( $key, $default_columns ) ) {
|
||||
do_action( 'woocommerce_payment_gateways_setting_column_' . $key, $gateway );
|
||||
continue;
|
||||
}
|
||||
|
||||
$width = '';
|
||||
|
||||
if ( in_array( $key, array( 'sort', 'status', 'action' ), true ) ) {
|
||||
$width = '1%';
|
||||
}
|
||||
|
||||
echo '<td class="' . esc_attr( $key ) . '" width="' . esc_attr( $width ) . '">';
|
||||
|
||||
switch ( $key ) {
|
||||
case 'sort':
|
||||
echo '<input type="hidden" name="gateway_order[]" value="' . esc_attr( $gateway->id ) . '" />';
|
||||
break;
|
||||
case 'name':
|
||||
$method_title = $gateway->get_title() ? $gateway->get_title() : __( '(no title)', 'woocommerce' );
|
||||
echo '<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '">' . esc_html( $method_title ) . '</a>';
|
||||
break;
|
||||
case 'description':
|
||||
echo '<strong class="wc-payment-gateway-method-name">' . wp_kses_post( $gateway->get_method_title() ) . '</strong>';
|
||||
echo wp_kses_post( $gateway->get_method_description() );
|
||||
break;
|
||||
case 'action':
|
||||
if ( wc_string_to_bool( $gateway->enabled ) ) {
|
||||
echo '<a class="button alignright" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '">' . esc_html__( 'Manage', 'woocommerce' ) . '</a>';
|
||||
} else {
|
||||
echo '<a class="button alignright" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '">' . esc_html__( 'Set up', 'woocommerce' ) . '</a>';
|
||||
}
|
||||
break;
|
||||
case 'status':
|
||||
echo '<a class="wc-payment-gateway-method-toggle-enabled" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '">';
|
||||
if ( wc_string_to_bool( $gateway->enabled ) ) {
|
||||
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--enabled">' . esc_attr__( 'Yes', 'woocommerce' ) . '</span>';
|
||||
} else {
|
||||
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--disabled">' . esc_attr__( 'No', 'woocommerce' ) . '</span>';
|
||||
}
|
||||
echo '</a>';
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings.
|
||||
*/
|
||||
public function save() {
|
||||
global $current_section;
|
||||
|
||||
$wc_payment_gateways = WC_Payment_Gateways::instance();
|
||||
|
||||
if ( ! $current_section ) {
|
||||
WC_Admin_Settings::save_fields( $this->get_settings() );
|
||||
$wc_payment_gateways->process_admin_options();
|
||||
$wc_payment_gateways->init();
|
||||
} else {
|
||||
foreach ( $wc_payment_gateways->payment_gateways() as $gateway ) {
|
||||
if ( in_array( $current_section, array( $gateway->id, sanitize_title( get_class( $gateway ) ) ), true ) ) {
|
||||
do_action( 'woocommerce_update_options_payment_gateways_' . $gateway->id );
|
||||
$wc_payment_gateways->init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $current_section ) {
|
||||
do_action( 'woocommerce_update_options_' . $this->id . '_' . $current_section );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new WC_Settings_Payment_Gateways();
|
|
@ -1,159 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* WooCommerce API Settings
|
||||
*
|
||||
* @author Automattic
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 3.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings for API.
|
||||
*/
|
||||
if ( class_exists( 'WC_Settings_Rest_API', false ) ) {
|
||||
return new WC_Settings_Rest_API();
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Settings_Rest_API.
|
||||
*/
|
||||
class WC_Settings_Rest_API extends WC_Settings_Page {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'api';
|
||||
$this->label = __( 'API', 'woocommerce' );
|
||||
|
||||
add_action( 'woocommerce_settings_form_method_tab_' . $this->id, array( $this, 'form_method' ) );
|
||||
parent::__construct();
|
||||
|
||||
$this->notices();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sections.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_sections() {
|
||||
$sections = array(
|
||||
'' => __( 'Settings', 'woocommerce' ),
|
||||
'keys' => __( 'Keys/Apps', 'woocommerce' ),
|
||||
'webhooks' => __( 'Webhooks', 'woocommerce' ),
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @param string $current_section Current section slug.
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings( $current_section = '' ) {
|
||||
$settings = array();
|
||||
|
||||
if ( '' === $current_section ) {
|
||||
$settings = apply_filters(
|
||||
'woocommerce_settings_rest_api', array(
|
||||
array(
|
||||
'title' => __( 'General options', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => '',
|
||||
'id' => 'general_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Legacy API', 'woocommerce' ),
|
||||
'desc' => __( 'Enable the legacy REST API', 'woocommerce' ),
|
||||
'id' => 'woocommerce_api_enabled',
|
||||
'type' => 'checkbox',
|
||||
'default' => 'no',
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'general_options',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );
|
||||
}
|
||||
|
||||
/**
|
||||
* Form method.
|
||||
*
|
||||
* @param string $method Method name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function form_method( $method ) {
|
||||
global $current_section;
|
||||
|
||||
if ( 'keys' === $current_section ) {
|
||||
if ( isset( $_GET['create-key'] ) || isset( $_GET['edit-key'] ) ) { // WPCS: input var okay, CSRF ok.
|
||||
return 'post';
|
||||
}
|
||||
|
||||
return 'get';
|
||||
}
|
||||
|
||||
return 'post';
|
||||
}
|
||||
|
||||
/**
|
||||
* Notices.
|
||||
*/
|
||||
private function notices() {
|
||||
if ( isset( $_GET['section'] ) && 'webhooks' === $_GET['section'] ) { // WPCS: input var okay, CSRF ok.
|
||||
WC_Admin_Webhooks::notices();
|
||||
}
|
||||
if ( isset( $_GET['section'] ) && 'keys' === $_GET['section'] ) { // WPCS: input var okay, CSRF ok.
|
||||
WC_Admin_API_Keys::notices();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the settings.
|
||||
*/
|
||||
public function output() {
|
||||
global $current_section;
|
||||
|
||||
if ( 'webhooks' === $current_section ) {
|
||||
WC_Admin_Webhooks::page_output();
|
||||
} elseif ( 'keys' === $current_section ) {
|
||||
WC_Admin_API_Keys::page_output();
|
||||
} else {
|
||||
$settings = $this->get_settings( $current_section );
|
||||
WC_Admin_Settings::output_fields( $settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings.
|
||||
*/
|
||||
public function save() {
|
||||
global $current_section;
|
||||
|
||||
if ( apply_filters( 'woocommerce_rest_api_valid_to_save', ! in_array( $current_section, array( 'keys', 'webhooks' ), true ) ) ) {
|
||||
$settings = $this->get_settings();
|
||||
WC_Admin_Settings::save_fields( $settings );
|
||||
|
||||
if ( $current_section ) {
|
||||
do_action( 'woocommerce_update_options_' . $this->id . '_' . $current_section );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new WC_Settings_Rest_API();
|
|
@ -0,0 +1,11 @@
|
|||
<?php // @codingStandardsIgnoreFile.
|
||||
/**
|
||||
* Settings class file.
|
||||
*
|
||||
* @deprecated 3.4.0 Replaced with class-wc-settings-advanced.php.
|
||||
* @todo remove in 4.0.
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
return include 'class-wc-settings-advanced.php';
|
|
@ -22,8 +22,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php if ( 0 !== $zone->get_id() ) : ?>
|
||||
<tr valign="top" class="">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="zone_name"><?php esc_html_e( 'Zone name', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'This is the name of the zone for your reference.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
<label for="zone_name">
|
||||
<?php esc_html_e( 'Zone name', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'This is the name of the zone for your reference.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input type="text" data-attribute="zone_name" name="zone_name" id="zone_name" value="<?php echo esc_attr( $zone->get_zone_name( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'Zone name', 'woocommerce' ); ?>">
|
||||
|
@ -31,23 +33,25 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<tr valign="top" class="">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="zone_locations"><?php esc_html_e( 'Zone regions', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'These are regions inside this zone. Customers will be matched against these regions.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
<label for="zone_locations">
|
||||
<?php esc_html_e( 'Zone regions', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'These are regions inside this zone. Customers will be matched against these regions.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select multiple="multiple" data-attribute="zone_locations" id="zone_locations" name="zone_locations" data-placeholder="<?php esc_html_e( 'Select regions within this zone', 'woocommerce' ); ?>" class="wc-shipping-zone-region-select chosen_select">
|
||||
<?php
|
||||
foreach ( $continents as $continent_code => $continent ) {
|
||||
echo '<option value="continent:' . esc_attr( $continent_code ) . '" ' . selected( in_array( "continent:$continent_code", $locations ), true, false ) . ' alt="">' . esc_html( $continent['name'] ) . '</option>';
|
||||
echo '<option value="continent:' . esc_attr( $continent_code ) . '"' . wc_selected( "continent:$continent_code", $locations ) . ' alt="">' . esc_html( $continent['name'] ) . '</option>';
|
||||
|
||||
$countries = array_intersect( array_keys( $allowed_countries ), $continent['countries'] );
|
||||
|
||||
foreach ( $countries as $country_code ) {
|
||||
echo '<option value="country:' . esc_attr( $country_code ) . '" ' . selected( in_array( "country:$country_code", $locations ), true, false ) . ' alt="' . esc_attr( $continent['name'] ) . '">' . esc_html( ' ' . $allowed_countries[ $country_code ] ) . '</option>';
|
||||
echo '<option value="country:' . esc_attr( $country_code ) . '"' . wc_selected( "country:$country_code", $locations ) . ' alt="' . esc_attr( $continent['name'] ) . '">' . esc_html( ' ' . $allowed_countries[ $country_code ] ) . '</option>';
|
||||
|
||||
if ( $states = WC()->countries->get_states( $country_code ) ) {
|
||||
foreach ( $states as $state_code => $state_name ) {
|
||||
echo '<option value="state:' . esc_attr( $country_code . ':' . $state_code ) . '" ' . selected( in_array( "state:$country_code:$state_code", $locations ), true, false ) . ' alt="' . esc_attr( $continent['name'] . ' ' . $allowed_countries[ $country_code ] ) . '">' . esc_html( ' ' . $state_name ) . '</option>';
|
||||
echo '<option value="state:' . esc_attr( $country_code . ':' . $state_code ) . '"' . wc_selected( "state:$country_code:$state_code", $locations ) . ' alt="' . esc_attr( $continent['name'] . ' ' . $allowed_countries[ $country_code ] ) . '">' . esc_html( ' ' . $state_name ) . '</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,15 +71,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<tr valign="top" class="">
|
||||
<th scope="row" class="titledesc">
|
||||
<label><?php esc_html_e( 'Shipping methods', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'The following shipping methods apply to customers with shipping addresses within this zone.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
<label>
|
||||
<?php esc_html_e( 'Shipping methods', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'The following shipping methods apply to customers with shipping addresses within this zone.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="">
|
||||
<table class="wc-shipping-zone-methods widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="wc-shipping-zone-method-sort"></th>
|
||||
<th class="wc-shipping-zone-method-title"><?php esc_html_e( 'Shipping method title', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-method-title"><?php esc_html_e( 'Title', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-method-enabled"><?php esc_html_e( 'Enabled', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-method-description"><?php esc_html_e( 'Description', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
|
|
|
@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
?>
|
||||
|
||||
<div id="key-fields" class="settings-panel">
|
||||
<h2><?php _e( 'Key details', 'woocommerce' ); ?></h2>
|
||||
<h2><?php esc_html_e( 'Key details', 'woocommerce' ); ?></h2>
|
||||
|
||||
<input type="hidden" id="key_id" value="<?php echo esc_attr( $key_id ); ?>" />
|
||||
|
||||
|
@ -13,8 +13,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<tbody>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="key_description"><?php _e( 'Description', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'Friendly name for identifying this key.', 'woocommerce' ) ); ?>
|
||||
<label for="key_description">
|
||||
<?php esc_html_e( 'Description', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Friendly name for identifying this key.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input id="key_description" type="text" class="input-text regular-input" value="<?php echo esc_attr( $key_data['description'] ); ?>" />
|
||||
|
@ -22,8 +24,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="key_user"><?php _e( 'User', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'Owner of these keys.', 'woocommerce' ) ); ?>
|
||||
<label for="key_user">
|
||||
<?php esc_html_e( 'User', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Owner of these keys.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<?php
|
||||
|
@ -45,8 +49,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="key_permissions"><?php _e( 'Permissions', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'Select the access type of these keys.', 'woocommerce' ) ); ?>
|
||||
<label for="key_permissions">
|
||||
<?php esc_html_e( 'Permissions', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Select the access type of these keys.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select id="key_permissions" class="wc-enhanced-select">
|
||||
|
@ -68,7 +74,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php if ( 0 !== $key_id ) : ?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php _e( 'Consumer key ending in', 'woocommerce' ); ?>
|
||||
<?php esc_html_e( 'Consumer key ending in', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<code>…<?php echo esc_html( $key_data['truncated_key'] ); ?></code>
|
||||
|
@ -76,7 +82,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php _e( 'Last access', 'woocommerce' ); ?>
|
||||
<?php esc_html_e( 'Last access', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<span>
|
||||
|
@ -87,7 +93,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
echo apply_filters( 'woocommerce_api_key_last_access_datetime', $date, $key_data['last_access'] );
|
||||
} else {
|
||||
_e( 'Unknown', 'woocommerce' );
|
||||
esc_html_e( 'Unknown', 'woocommerce' );
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
|
@ -106,7 +112,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
?>
|
||||
<p class="submit">
|
||||
<?php submit_button( __( 'Save changes', 'woocommerce' ), 'primary', 'update_api_key', false ); ?>
|
||||
<a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'revoke-key' => $key_id ), admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys' ) ), 'revoke' ) ); ?>"><?php _e( 'Revoke key', 'woocommerce' ); ?></a>
|
||||
<a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'revoke-key' => $key_id ), admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=keys' ) ), 'revoke' ) ); ?>"><?php esc_html_e( 'Revoke key', 'woocommerce' ); ?></a>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
@ -119,23 +125,23 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<tbody>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php _e( 'Consumer key', 'woocommerce' ); ?>
|
||||
<?php esc_html_e( 'Consumer key', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input id="key_consumer_key" type="text" value="{{ data.consumer_key }}" size="55" readonly="readonly"> <button type="button" class="button-secondary copy-key" data-tip="<?php esc_attr_e( 'Copied!', 'woocommerce' ); ?>"><?php _e( 'Copy', 'woocommerce' ); ?></button>
|
||||
<input id="key_consumer_key" type="text" value="{{ data.consumer_key }}" size="55" readonly="readonly"> <button type="button" class="button-secondary copy-key" data-tip="<?php esc_attr_e( 'Copied!', 'woocommerce' ); ?>"><?php esc_html_e( 'Copy', 'woocommerce' ); ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php _e( 'Consumer secret', 'woocommerce' ); ?>
|
||||
<?php esc_html_e( 'Consumer secret', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input id="key_consumer_secret" type="text" value="{{ data.consumer_secret }}" size="55" readonly="readonly"> <button type="button" class="button-secondary copy-secret" data-tip="<?php esc_attr_e( 'Copied!', 'woocommerce' ); ?>"><?php _e( 'Copy', 'woocommerce' ); ?></button>
|
||||
<input id="key_consumer_secret" type="text" value="{{ data.consumer_secret }}" size="55" readonly="readonly"> <button type="button" class="button-secondary copy-secret" data-tip="<?php esc_attr_e( 'Copied!', 'woocommerce' ); ?>"><?php esc_html_e( 'Copy', 'woocommerce' ); ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php _e( 'QRCode', 'woocommerce' ); ?>
|
||||
<?php esc_html_e( 'QRCode', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<div id="keys-qrcode"></div>
|
||||
|
|
|
@ -18,11 +18,13 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<tbody>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_name"><?php esc_html_e( 'Name', 'woocommerce' ); ?></label>
|
||||
<?php
|
||||
/* translators: %s: date */
|
||||
echo wc_help_tip( sprintf( __( 'Friendly name for identifying this webhook, defaults to Webhook created on %s.', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce' ) ) ) ); // @codingStandardsIgnoreLine
|
||||
?>
|
||||
<label for="webhook_name">
|
||||
<?php esc_html_e( 'Name', 'woocommerce' ); ?>
|
||||
<?php
|
||||
/* translators: %s: date */
|
||||
echo wc_help_tip( sprintf( __( 'Friendly name for identifying this webhook, defaults to Webhook created on %s.', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce' ) ) ) ); // @codingStandardsIgnoreLine
|
||||
?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input name="webhook_name" id="webhook_name" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_name() ); ?>" />
|
||||
|
@ -30,8 +32,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_status"><?php esc_html_e( 'Status', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'The options are "Active" (delivers payload), "Paused" (does not deliver), or "Disabled" (does not deliver due delivery failures).', 'woocommerce' ) ); ?>
|
||||
<label for="webhook_status">
|
||||
<?php esc_html_e( 'Status', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'The options are "Active" (delivers payload), "Paused" (does not deliver), or "Disabled" (does not deliver due delivery failures).', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select name="webhook_status" id="webhook_status" class="wc-enhanced-select">
|
||||
|
@ -48,8 +52,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_topic"><?php esc_html_e( 'Topic', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'Select when the webhook will fire.', 'woocommerce' ) ); ?>
|
||||
<label for="webhook_topic">
|
||||
<?php esc_html_e( 'Topic', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Select when the webhook will fire.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select name="webhook_topic" id="webhook_topic" class="wc-enhanced-select">
|
||||
|
@ -87,8 +93,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<tr valign="top" id="webhook-action-event-wrap">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_action_event"><?php esc_html_e( 'Action event', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'Enter the action that will trigger this webhook.', 'woocommerce' ) ); ?>
|
||||
<label for="webhook_action_event">
|
||||
<?php esc_html_e( 'Action event', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Enter the action that will trigger this webhook.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input name="webhook_action_event" id="webhook_action_event" type="text" class="input-text regular-input" value="<?php echo esc_attr( $topic_data['event'] ); ?>" />
|
||||
|
@ -96,8 +104,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_delivery_url"><?php esc_html_e( 'Delivery URL', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'URL where the webhook payload is delivered.', 'woocommerce' ) ); ?>
|
||||
<label for="webhook_delivery_url">
|
||||
<?php esc_html_e( 'Delivery URL', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'URL where the webhook payload is delivered.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input name="webhook_delivery_url" id="webhook_delivery_url" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_delivery_url() ); ?>" />
|
||||
|
@ -105,8 +115,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_secret"><?php esc_html_e( 'Secret', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'The secret key is used to generate a hash of the delivered webhook and provided in the request headers.', 'woocommerce' ) ); ?>
|
||||
<label for="webhook_secret">
|
||||
<?php esc_html_e( 'Secret', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'The secret key is used to generate a hash of the delivered webhook and provided in the request headers.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input name="webhook_secret" id="webhook_secret" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_secret() ); ?>" />
|
||||
|
@ -114,8 +126,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_api_version"><?php esc_html_e( 'API Version', 'woocommerce' ); ?></label>
|
||||
<?php echo wc_help_tip( __( 'REST API version used in the webhook deliveries.', 'woocommerce' ) ); ?>
|
||||
<label for="webhook_api_version">
|
||||
<?php esc_html_e( 'API Version', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'REST API version used in the webhook deliveries.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select name="webhook_api_version" id="webhook_api_version">
|
||||
|
@ -174,7 +188,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
add_query_arg(
|
||||
array(
|
||||
'delete' => $webhook->get_id(),
|
||||
), admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks' )
|
||||
), admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks' )
|
||||
), 'delete-webhook'
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* Admin View: Page - Status Report.
|
||||
*
|
||||
* @package WooCommerce
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
global $wpdb;
|
||||
|
||||
|
@ -56,58 +56,83 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<tbody>
|
||||
<tr>
|
||||
<td data-export-label="Home URL"><?php esc_html_e( 'Home URL', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The homepage URL of your site.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The homepage URL of your site.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $environment['home_url'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Site URL"><?php esc_html_e( 'Site URL', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The root URL of your site.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The root URL of your site.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $environment['site_url'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="WC Version"><?php esc_html_e( 'WC version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The version of WooCommerce installed on your site.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td data-export-label="WC Version"><?php esc_html_e( 'WooCommerce version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The version of WooCommerce installed on your site.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $environment['version'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Log Directory Writable"><?php esc_html_e( 'Log directory writable', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Several WooCommerce extensions can write logs which makes debugging problems easier. The directory must be writable for this to happen.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Several WooCommerce extensions can write logs which makes debugging problems easier. The directory must be writable for this to happen.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( $environment['log_directory_writable'] ) {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span> <code class="private">' . esc_html( $environment['log_directory'] ) . '</code></mark> ';
|
||||
} else {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'To allow logging, make %1$s writable or define a custom %2$s.', 'woocommerce' ), '<code>' . $environment['log_directory'] . '</code>', '<code>WC_LOG_DIR</code>' ) . '</mark>';
|
||||
/* Translators: %1$s: Log directory, %2$s: Log directory constant */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( 'To allow logging, make %1$s writable or define a custom %2$s.', 'woocommerce' ), '<code>' . esc_html( $environment['log_directory'] ) . '</code>', '<code>WC_LOG_DIR</code>' ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="WP Version"><?php esc_html_e( 'WP version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The version of WordPress installed on your site.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $environment['wp_version'] ); ?></td>
|
||||
<td data-export-label="WP Version"><?php esc_html_e( 'WordPress version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The version of WordPress installed on your site.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$latest_version = get_transient( 'woocommerce_system_status_wp_version_check' );
|
||||
|
||||
if ( false === $latest_version ) {
|
||||
$version_check = wp_remote_get( 'https://api.wordpress.org/core/version-check/1.7/' );
|
||||
$api_response = json_decode( wp_remote_retrieve_body( $version_check ), true );
|
||||
|
||||
if ( $api_response && isset( $api_response['offers'], $api_response['offers'][0], $api_response['offers'][0]['version'] ) ) {
|
||||
$latest_version = $api_response['offers'][0]['version'];
|
||||
} else {
|
||||
$latest_version = $environment['wp_version'];
|
||||
}
|
||||
set_transient( 'woocommerce_system_status_wp_version_check', $latest_version, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
if ( version_compare( $environment['wp_version'], $latest_version, '<' ) ) {
|
||||
/* Translators: %1$s: Current version, %2$s: New version */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( '%1$s - There is a newer version of WordPress available (%2$s)', 'woocommerce' ), esc_html( $environment['wp_version'] ), esc_html( $latest_version ) ) . '</mark>';
|
||||
} else {
|
||||
echo '<mark class="yes">' . esc_html( $environment['wp_version'] ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="WP Multisite"><?php esc_html_e( 'WP multisite', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Whether or not you have WordPress Multisite enabled.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td data-export-label="WP Multisite"><?php esc_html_e( 'WordPress multisite', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Whether or not you have WordPress Multisite enabled.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo ( $environment['wp_multisite'] ) ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="WP Memory Limit"><?php esc_html_e( 'WP memory limit', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The maximum amount of memory (RAM) that your site can use at one time.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td data-export-label="WP Memory Limit"><?php esc_html_e( 'WordPress memory limit', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The maximum amount of memory (RAM) that your site can use at one time.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( $environment['wp_memory_limit'] < 67108864 ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%1$s - We recommend setting memory to at least 64MB. See: %2$s', 'woocommerce' ), size_format( $environment['wp_memory_limit'] ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . __( 'Increasing memory allocated to PHP', 'woocommerce' ) . '</a>' ) . '</mark>';
|
||||
/* Translators: %1$s: Memory limit, %2$s: Docs link. */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( '%1$s - We recommend setting memory to at least 64MB. See: %2$s', 'woocommerce' ), esc_html( size_format( $environment['wp_memory_limit'] ) ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . esc_html__( 'Increasing memory allocated to PHP', 'woocommerce' ) . '</a>' ) . '</mark>';
|
||||
} else {
|
||||
echo '<mark class="yes">' . size_format( $environment['wp_memory_limit'] ) . '</mark>';
|
||||
echo '<mark class="yes">' . esc_html( size_format( $environment['wp_memory_limit'] ) ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="WP Debug Mode"><?php esc_html_e( 'WP debug mode', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Displays whether or not WordPress is in Debug Mode.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td data-export-label="WP Debug Mode"><?php esc_html_e( 'WordPress debug mode', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Displays whether or not WordPress is in Debug Mode.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php if ( $environment['wp_debug_mode'] ) : ?>
|
||||
<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
|
||||
|
@ -117,8 +142,8 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="WP Cron"><?php esc_html_e( 'WP cron', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Displays whether or not WP Cron Jobs are enabled.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td data-export-label="WP Cron"><?php esc_html_e( 'WordPress cron', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Displays whether or not WP Cron Jobs are enabled.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php if ( $environment['wp_cron'] ) : ?>
|
||||
<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
|
||||
|
@ -129,12 +154,12 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Language"><?php esc_html_e( 'Language', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The current language used by WordPress. Default = English', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The current language used by WordPress. Default = English', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $environment['language'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="External object cache"><?php _e( 'External object cache', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Displays whether or not WordPress is using an external object cache.', 'woocommerce' ) ); ?></td>
|
||||
<td data-export-label="External object cache"><?php esc_html_e( 'External object cache', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Displays whether or not WordPress is using an external object cache.', 'woocommerce' ) ); ?></td>
|
||||
<td>
|
||||
<?php if ( $environment['external_object_cache'] ) : ?>
|
||||
<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
|
||||
|
@ -154,18 +179,28 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<tbody>
|
||||
<tr>
|
||||
<td data-export-label="Server Info"><?php esc_html_e( 'Server info', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Information about the web server that is currently hosting your site.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Information about the web server that is currently hosting your site.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $environment['server_info'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="PHP Version"><?php esc_html_e( 'PHP version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The version of PHP installed on your hosting server.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The version of PHP installed on your hosting server.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( version_compare( $environment['php_version'], '5.6', '<' ) ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%1$s - We recommend a minimum PHP version of 5.6. See: %2$s', 'woocommerce' ), esc_html( $environment['php_version'] ), '<a href="https://docs.woocommerce.com/document/how-to-update-your-php-version/" target="_blank">' . __( 'How to update your PHP version', 'woocommerce' ) . '</a>' ) . '</mark>';
|
||||
} else {
|
||||
if ( version_compare( $environment['php_version'], '7.2', '>=' ) ) {
|
||||
echo '<mark class="yes">' . esc_html( $environment['php_version'] ) . '</mark>';
|
||||
} else {
|
||||
$update_link = ' <a href="https://docs.woocommerce.com/document/how-to-update-your-php-version/" target="_blank">' . esc_html__( 'How to update your PHP version', 'woocommerce' ) . '</a>';
|
||||
|
||||
if ( version_compare( $environment['php_version'], '5.4', '<' ) ) {
|
||||
$notice = __( 'WooCommerce will run under this version of PHP, however, some features such as geolocation are not compatible. Support for this version will be dropped in the next major release. We recommend using PHP version 7.2 or above for greater performance and security.', 'woocommerce' ) . $update_link;
|
||||
} elseif ( version_compare( $environment['php_version'], '5.6', '<' ) ) {
|
||||
$notice = __( 'WooCommerce will run under this version of PHP, however, it has reached end of life. We recommend using PHP version 7.2 or above for greater performance and security.', 'woocommerce' ) . $update_link;
|
||||
} elseif ( version_compare( $environment['php_version'], '7.2', '<' ) ) {
|
||||
$notice = __( 'We recommend using PHP version 7.2 or above for greater performance and security.', 'woocommerce' ) . $update_link;
|
||||
}
|
||||
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html( $environment['php_version'] ) . ' - ' . wp_kses_post( $notice ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
@ -173,27 +208,27 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<?php if ( function_exists( 'ini_get' ) ) : ?>
|
||||
<tr>
|
||||
<td data-export-label="PHP Post Max Size"><?php esc_html_e( 'PHP post max size', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The largest filesize that can be contained in one post.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The largest filesize that can be contained in one post.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( size_format( $environment['php_post_max_size'] ) ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="PHP Time Limit"><?php esc_html_e( 'PHP time limit', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups)', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups)', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $environment['php_max_execution_time'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="PHP Max Input Vars"><?php esc_html_e( 'PHP max input vars', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $environment['php_max_input_vars'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="cURL Version"><?php esc_html_e( 'cURL version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The version of cURL installed on your server.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The version of cURL installed on your server.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $environment['curl_version'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="SUHOSIN Installed"><?php esc_html_e( 'SUHOSIN installed', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo $environment['suhosin_installed'] ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
@ -204,11 +239,12 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
?>
|
||||
<tr>
|
||||
<td data-export-label="MySQL Version"><?php esc_html_e( 'MySQL version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The version of MySQL installed on your hosting server.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The version of MySQL installed on your hosting server.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( version_compare( $environment['mysql_version'], '5.6', '<' ) ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%1$s - We recommend a minimum MySQL version of 5.6. See: %2$s', 'woocommerce' ), esc_html( $environment['mysql_version'] ), '<a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'WordPress requirements', 'woocommerce' ) . '</a>' ) . '</mark>';
|
||||
/* Translators: %1$s: MySQL version, %2$s: Recommended MySQL version. */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( '%1$s - We recommend a minimum MySQL version of 5.6. See: %2$s', 'woocommerce' ), esc_html( $environment['mysql_version'] ), '<a href="https://wordpress.org/about/requirements/" target="_blank">' . esc_html__( 'WordPress requirements', 'woocommerce' ) . '</a>' ) . '</mark>';
|
||||
} else {
|
||||
echo '<mark class="yes">' . esc_html( $environment['mysql_version'] ) . '</mark>';
|
||||
}
|
||||
|
@ -218,16 +254,17 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<?php endif; ?>
|
||||
<tr>
|
||||
<td data-export-label="Max Upload Size"><?php esc_html_e( 'Max upload size', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The largest filesize that can be uploaded to your WordPress installation.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo size_format( $environment['max_upload_size'] ); ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The largest filesize that can be uploaded to your WordPress installation.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( size_format( $environment['max_upload_size'] ) ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Default Timezone is UTC"><?php esc_html_e( 'Default timezone is UTC', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The default timezone for your server.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The default timezone for your server.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( 'UTC' !== $environment['default_timezone'] ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'woocommerce' ), $environment['default_timezone'] ) . '</mark>';
|
||||
/* Translators: %s: default timezone.. */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( 'Default timezone is %s - it should be UTC', 'woocommerce' ), esc_html( $environment['default_timezone'] ) ) . '</mark>';
|
||||
} else {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
|
||||
}
|
||||
|
@ -236,91 +273,97 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="fsockopen/cURL"><?php esc_html_e( 'fsockopen/cURL', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( $environment['fsockopen_or_curl_enabled'] ) {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
|
||||
} else {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'woocommerce' ) . '</mark>';
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'woocommerce' ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="SoapClient"><?php esc_html_e( 'SoapClient', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( $environment['soapclient_enabled'] ) {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
|
||||
} else {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'woocommerce' ), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>' ) . '</mark>';
|
||||
/* Translators: %s classname and link. */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'woocommerce' ), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>' ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="DOMDocument"><?php esc_html_e( 'DOMDocument', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( $environment['domdocument_enabled'] ) {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
|
||||
} else {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'woocommerce' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' ) . '</mark>';
|
||||
/* Translators: %s: classname and link. */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'woocommerce' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="GZip"><?php esc_html_e( 'GZip', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'GZip (gzopen) is used to open the GEOIP database from MaxMind.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'GZip (gzopen) is used to open the GEOIP database from MaxMind.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( $environment['gzip_enabled'] ) {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
|
||||
} else {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Your server does not support the %s function - this is required to use the GeoIP database from MaxMind.', 'woocommerce' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' ) . '</mark>';
|
||||
/* Translators: %s: classname and link. */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( 'Your server does not support the %s function - this is required to use the GeoIP database from MaxMind.', 'woocommerce' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Multibyte String"><?php esc_html_e( 'Multibyte string', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( $environment['mbstring_enabled'] ) {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
|
||||
} else {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'woocommerce' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' ) . '</mark>';
|
||||
/* Translators: %s: classname and link. */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'woocommerce' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Remote Post"><?php esc_html_e( 'Remote post', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'PayPal uses this method of communicating when sending back transaction information.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'PayPal uses this method of communicating when sending back transaction information.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( $environment['remote_post_successful'] ) {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
|
||||
} else {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s failed. Contact your hosting provider.', 'woocommerce' ), 'wp_remote_post()' ) . ' ' . esc_html( $environment['remote_post_response'] ) . '</mark>';
|
||||
/* Translators: %s: function name. */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( '%s failed. Contact your hosting provider.', 'woocommerce' ), 'wp_remote_post()' ) . ' ' . esc_html( $environment['remote_post_response'] ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Remote Get"><?php esc_html_e( 'Remote get', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'WooCommerce plugins may use this method of communication when checking for plugin updates.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'WooCommerce plugins may use this method of communication when checking for plugin updates.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( $environment['remote_get_successful'] ) {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
|
||||
} else {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s failed. Contact your hosting provider.', 'woocommerce' ), 'wp_remote_get()' ) . ' ' . esc_html( $environment['remote_get_response'] ) . '</mark>';
|
||||
/* Translators: %s: function name. */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( '%s failed. Contact your hosting provider.', 'woocommerce' ), 'wp_remote_get()' ) . ' ' . esc_html( $environment['remote_get_response'] ) . '</mark>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
@ -338,10 +381,10 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
?>
|
||||
<tr>
|
||||
<td data-export-label="<?php echo esc_attr( $row['name'] ); ?>"><?php echo esc_html( $row['name'] ); ?>:</td>
|
||||
<td class="help"><?php echo isset( $row['help'] ) ? $row['help'] : ''; ?></td>
|
||||
<td class="help"><?php echo esc_html( isset( $row['help'] ) ? $row['help'] : '' ); ?></td>
|
||||
<td>
|
||||
<mark class="<?php echo esc_attr( $css_class ); ?>">
|
||||
<?php echo $icon; ?> <?php echo ! empty( $row['note'] ) ? wp_kses_data( $row['note'] ) : ''; ?>
|
||||
<?php echo wp_kses_post( $icon ); ?> <?php echo wp_kses_data( ! empty( $row['note'] ) ? $row['note'] : '' ); ?>
|
||||
</mark>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -358,8 +401,8 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td data-export-label="WC Database Version"><?php esc_html_e( 'WC database version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The version of WooCommerce that the database is formatted for. This should be the same as your WooCommerce version.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td data-export-label="WC Database Version"><?php esc_html_e( 'WooCommerce database version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The version of WooCommerce that the database is formatted for. This should be the same as your WooCommerce version.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $database['wc_database_version'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -368,7 +411,8 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<td>
|
||||
<?php
|
||||
if ( strlen( $database['database_prefix'] ) > 20 ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%1$s - We recommend using a prefix with less than 20 characters. See: %2$s', 'woocommerce' ), esc_html( $database['database_prefix'] ), '<a href="https://docs.woocommerce.com/document/completed-order-email-doesnt-contain-download-links/#section-2" target="_blank">' . __( 'How to update your database table prefix', 'woocommerce' ) . '</a>' ) . '</mark>';
|
||||
/* Translators: %1$s: Database prefix, %2$s: Docs link. */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( '%1$s - We recommend using a prefix with less than 20 characters. See: %2$s', 'woocommerce' ), esc_html( $database['database_prefix'] ), '<a href="https://docs.woocommerce.com/document/completed-order-email-doesnt-contain-download-links/#section-2" target="_blank">' . esc_html__( 'How to update your database table prefix', 'woocommerce' ) . '</a>' ) . '</mark>';
|
||||
} else {
|
||||
echo '<mark class="yes">' . esc_html( $database['database_prefix'] ) . '</mark>';
|
||||
}
|
||||
|
@ -379,13 +423,16 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<?php if ( $settings['geolocation_enabled'] ) { ?>
|
||||
<tr>
|
||||
<td data-export-label="MaxMind GeoIP Database"><?php esc_html_e( 'MaxMind GeoIP database', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The GeoIP database from MaxMind is used to geolocate customers.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The GeoIP database from MaxMind is used to geolocate customers.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( file_exists( $database['maxmind_geoip_database'] ) ) {
|
||||
if ( version_compare( $environment['php_version'], '5.4', '<' ) ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . wp_kses_post( __( 'MaxMind GeoIP database requires at least PHP 5.4.', 'woocommerce' ) ) . '</mark>';
|
||||
} elseif ( file_exists( $database['maxmind_geoip_database'] ) ) {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span> <code class="private">' . esc_html( $database['maxmind_geoip_database'] ) . '</code></mark> ';
|
||||
} else {
|
||||
printf( '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'The MaxMind GeoIP Database does not exist - Geolocation will not function. You can download and install it manually from %1$s to the path: %2$s. Scroll down to "Downloads" and download the "MaxMind DB binary, gzipped" file next to "GeoLite2 Country". Please remember to uncompress GeoLite2-Country_xxxxxxxx.tar.gz and upload the GeoLite2-Country.mmdb file only.', 'woocommerce' ), make_clickable( 'https://dev.maxmind.com/geoip/geoip2/geolite2/' ), '<code class="private">' . $database['maxmind_geoip_database'] . '</code>' ) . '</mark>', WC_LOG_DIR );
|
||||
/* Translators: %1$s: Library url, %2$s: install path. */
|
||||
printf( '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( 'The MaxMind GeoIP Database does not exist - Geolocation will not function. You can download and install it manually from %1$s to the path: %2$s. Scroll down to "Downloads" and download the "MaxMind DB binary, gzipped" file next to "GeoLite2 Country". Please remember to uncompress GeoLite2-Country_xxxxxxxx.tar.gz and upload the GeoLite2-Country.mmdb file only.', 'woocommerce' ), '<a href="https://dev.maxmind.com/geoip/geoip2/geolite2/">https://dev.maxmind.com/geoip/geoip2/geolite2/</a>', '<code class="private">' . esc_html( $database['maxmind_geoip_database'] ) . '</code>' ) . '</mark>', esc_html( WC_LOG_DIR ) );
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
@ -395,19 +442,19 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<tr>
|
||||
<td><?php esc_html_e( 'Total Database Size', 'woocommerce' ); ?></td>
|
||||
<td class="help"> </td>
|
||||
<td><?php printf( '%.2fMB', $database['database_size']['data'] + $database['database_size']['index'] ); ?></td>
|
||||
<td><?php printf( '%.2fMB', esc_html( $database['database_size']['data'] + $database['database_size']['index'] ) ); ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php esc_html_e( 'Database Data Size', 'woocommerce' ); ?></td>
|
||||
<td class="help"> </td>
|
||||
<td><?php printf( '%.2fMB', $database['database_size']['data'] ); ?></td>
|
||||
<td><?php printf( '%.2fMB', esc_html( $database['database_size']['data'] ) ); ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php esc_html_e( 'Database Index Size', 'woocommerce' ); ?></td>
|
||||
<td class="help"> </td>
|
||||
<td><?php printf( '%.2fMB', $database['database_size']['index'] ); ?></td>
|
||||
<td><?php printf( '%.2fMB', esc_html( $database['database_size']['index'] ) ); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php foreach ( $database['database_tables']['woocommerce'] as $table => $table_data ) { ?>
|
||||
|
@ -417,9 +464,10 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<td>
|
||||
<?php
|
||||
if ( ! $table_data ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'Table does not exist', 'woocommerce' ) . '</mark>';
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Table does not exist', 'woocommerce' ) . '</mark>';
|
||||
} else {
|
||||
printf( __( 'Data: %1$.2fMB + Index: %2$.2fMB', 'woocommerce' ), wc_format_decimal( $table_data['data'], 2 ), wc_format_decimal( $table_data['index'], 2 ) );
|
||||
/* Translators: %1$f: Table size, %2$f: Index size. */
|
||||
printf( esc_html__( 'Data: %1$.2fMB + Index: %2$.2fMB', 'woocommerce' ), esc_html( wc_format_decimal( $table_data['data'], 2 ) ), esc_html( wc_format_decimal( $table_data['index'], 2 ) ) );
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
@ -431,7 +479,10 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<td><?php echo esc_html( $table ); ?></td>
|
||||
<td class="help"> </td>
|
||||
<td>
|
||||
<?php printf( __( 'Data: %1$.2fMB + Index: %2$.2fMB', 'woocommerce' ), wc_format_decimal( $table_data['data'], 2 ), wc_format_decimal( $table_data['index'], 2 ) ); ?>
|
||||
<?php
|
||||
/* Translators: %1$f: Table size, %2$f: Index size. */
|
||||
printf( esc_html__( 'Data: %1$.2fMB + Index: %2$.2fMB', 'woocommerce' ), esc_html( wc_format_decimal( $table_data['data'], 2 ) ), esc_html( wc_format_decimal( $table_data['index'], 2 ) ) );
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
@ -466,18 +517,23 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<tbody>
|
||||
<tr>
|
||||
<td data-export-label="Secure connection (HTTPS)"><?php esc_html_e( 'Secure connection (HTTPS)', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Is the connection to your store secure?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Is the connection to your store secure?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php if ( $security['secure_connection'] ) : ?>
|
||||
<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
|
||||
<?php else : ?>
|
||||
<mark class="error"><span class="dashicons dashicons-warning"></span><?php printf( __( 'Your store is not using HTTPS. <a href="%s" target="_blank">Learn more about HTTPS and SSL Certificates</a>.', 'woocommerce' ), 'https://docs.woocommerce.com/document/ssl-and-https/' ); ?></mark>
|
||||
<mark class="error"><span class="dashicons dashicons-warning"></span>
|
||||
<?php
|
||||
/* Translators: %s: docs link. */
|
||||
echo wp_kses_post( sprintf( __( 'Your store is not using HTTPS. <a href="%s" target="_blank">Learn more about HTTPS and SSL Certificates</a>.', 'woocommerce' ), 'https://docs.woocommerce.com/document/ssl-and-https/' ) );
|
||||
?>
|
||||
</mark>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Hide errors from visitors"><?php esc_html_e( 'Hide errors from visitors', 'woocommerce' ); ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Error messages can contain sensitive information about your store environment. These should be hidden from untrusted visitors.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Error messages can contain sensitive information about your store environment. These should be hidden from untrusted visitors.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php if ( $security['hide_errors'] ) : ?>
|
||||
<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
|
||||
|
@ -514,8 +570,8 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
$version_string = ' – <strong style="color:red;">' . sprintf( esc_html__( '%s is available', 'woocommerce' ), $plugin['version_latest'] ) . '</strong>';
|
||||
}
|
||||
|
||||
if ( false != $plugin['network_activated'] ) {
|
||||
$network_string = ' – <strong style="color:black;">' . __( 'Network enabled', 'woocommerce' ) . '</strong>';
|
||||
if ( false !== $plugin['network_activated'] ) {
|
||||
$network_string = ' – <strong style="color:black;">' . esc_html__( 'Network enabled', 'woocommerce' ) . '</strong>';
|
||||
}
|
||||
}
|
||||
$untested_string = '';
|
||||
|
@ -524,13 +580,13 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $plugin_name; ?></td>
|
||||
<td><?php echo wp_kses_post( $plugin_name ); ?></td>
|
||||
<td class="help"> </td>
|
||||
<td>
|
||||
<?php
|
||||
/* translators: %s: plugin author */
|
||||
printf( __( 'by %s', 'woocommerce' ), $plugin['author_name'] );
|
||||
echo ' – ' . esc_html( $plugin['version'] ) . $version_string . $untested_string . $network_string;
|
||||
printf( esc_html__( 'by %s', 'woocommerce' ), esc_html( $plugin['author_name'] ) );
|
||||
echo ' – ' . esc_html( $plugin['version'] ) . $version_string . $untested_string . $network_string; // WPCS: XSS ok.
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -549,42 +605,42 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<tbody>
|
||||
<tr>
|
||||
<td data-export-label="API Enabled"><?php esc_html_e( 'API enabled', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Does your site have REST API enabled?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Does your site have REST API enabled?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo $settings['api_enabled'] ? '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>' : '<mark class="no">–</mark>'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Force SSL"><?php esc_html_e( 'Force SSL', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Does your site force a SSL Certificate for transactions?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Does your site force a SSL Certificate for transactions?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo $settings['force_ssl'] ? '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>' : '<mark class="no">–</mark>'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Currency"><?php esc_html_e( 'Currency', 'woocommerce' ); ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'What currency prices are listed at in the catalog and which currency gateways will take payments in.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'What currency prices are listed at in the catalog and which currency gateways will take payments in.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $settings['currency'] ); ?> (<?php echo esc_html( $settings['currency_symbol'] ); ?>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Currency Position"><?php esc_html_e( 'Currency position', 'woocommerce' ); ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The position of the currency symbol.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The position of the currency symbol.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $settings['currency_position'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Thousand Separator"><?php esc_html_e( 'Thousand separator', 'woocommerce' ); ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The thousand separator of displayed prices.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The thousand separator of displayed prices.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $settings['thousand_separator'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Decimal Separator"><?php esc_html_e( 'Decimal separator', 'woocommerce' ); ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The decimal separator of displayed prices.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The decimal separator of displayed prices.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $settings['decimal_separator'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Number of Decimals"><?php esc_html_e( 'Number of decimals', 'woocommerce' ); ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The number of decimal points shown in displayed prices.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The number of decimal points shown in displayed prices.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $settings['number_of_decimals'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Taxonomies: Product Types"><?php esc_html_e( 'Taxonomies: Product types', 'woocommerce' ); ?></th>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'A list of taxonomy terms that can be used in regard to order/product statuses.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'A list of taxonomy terms that can be used in regard to order/product statuses.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$display_terms = array();
|
||||
|
@ -597,7 +653,7 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Taxonomies: Product Visibility"><?php esc_html_e( 'Taxonomies: Product visibility', 'woocommerce' ); ?></th>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'A list of taxonomy terms used for product visibility.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'A list of taxonomy terms used for product visibility.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$display_terms = array();
|
||||
|
@ -613,7 +669,7 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<table class="wc_status_table widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" data-export-label="WC Pages"><h2><?php esc_html_e( 'WC pages', 'woocommerce' ); ?></h2></th>
|
||||
<th colspan="3" data-export-label="WC Pages"><h2><?php esc_html_e( 'WooCommerce pages', 'woocommerce' ); ?></h2></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -623,36 +679,39 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
$error = false;
|
||||
|
||||
if ( $page['page_id'] ) {
|
||||
$page_name = '<a href="' . get_edit_post_link( $page['page_id'] ) . '" aria-label="' . sprintf( __( 'Edit %s page', 'woocommerce' ), esc_html( $page['page_name'] ) ) . '">' . esc_html( $page['page_name'] ) . '</a>';
|
||||
/* Translators: %s: page name. */
|
||||
$page_name = '<a href="' . get_edit_post_link( $page['page_id'] ) . '" aria-label="' . sprintf( esc_html__( 'Edit %s page', 'woocommerce' ), esc_html( $page['page_name'] ) ) . '">' . esc_html( $page['page_name'] ) . '</a>';
|
||||
} else {
|
||||
$page_name = esc_html( $page['page_name'] );
|
||||
}
|
||||
|
||||
echo '<tr><td data-export-label="' . esc_attr( $page_name ) . '">' . $page_name . ':</td>';
|
||||
echo '<td class="help">' . wc_help_tip( sprintf( __( 'The URL of your %s page (along with the Page ID).', 'woocommerce' ), $page_name ) ) . '</td><td>';
|
||||
echo '<tr><td data-export-label="' . esc_attr( $page_name ) . '">' . wp_kses_post( $page_name ) . ':</td>';
|
||||
/* Translators: %s: page name. */
|
||||
echo '<td class="help">' . wc_help_tip( sprintf( esc_html__( 'The URL of your %s page (along with the Page ID).', 'woocommerce' ), $page_name ) ) . '</td><td>';
|
||||
|
||||
// Page ID check.
|
||||
if ( ! $page['page_set'] ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'Page not set', 'woocommerce' ) . '</mark>';
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Page not set', 'woocommerce' ) . '</mark>';
|
||||
$error = true;
|
||||
} elseif ( ! $page['page_exists'] ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'Page ID is set, but the page does not exist', 'woocommerce' ) . '</mark>';
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Page ID is set, but the page does not exist', 'woocommerce' ) . '</mark>';
|
||||
$error = true;
|
||||
} elseif ( ! $page['page_visible'] ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Page visibility should be <a href="%s" target="_blank">public</a>', 'woocommerce' ), 'https://codex.wordpress.org/Content_Visibility' ) . '</mark>';
|
||||
/* Translators: %s: docs link. */
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . wp_kses_post( sprintf( __( 'Page visibility should be <a href="%s" target="_blank">public</a>', 'woocommerce' ), 'https://codex.wordpress.org/Content_Visibility' ) ) . '</mark>';
|
||||
$error = true;
|
||||
} else {
|
||||
// Shortcode check
|
||||
// Shortcode check.
|
||||
if ( $page['shortcode_required'] ) {
|
||||
if ( ! $page['shortcode_present'] ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Page does not contain the shortcode.', 'woocommerce' ), $page['shortcode'] ) . '</mark>';
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( 'Page does not contain the shortcode.', 'woocommerce' ), esc_html( $page['shortcode'] ) ) . '</mark>';
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $error ) {
|
||||
echo '<mark class="yes">#' . absint( $page['page_id'] ) . ' - ' . str_replace( home_url(), '', get_permalink( $page['page_id'] ) ) . '</mark>';
|
||||
echo '<mark class="yes">#' . absint( $page['page_id'] ) . ' - ' . esc_html( str_replace( home_url(), '', get_permalink( $page['page_id'] ) ) ) . '</mark>';
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
|
@ -669,66 +728,73 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<tbody>
|
||||
<tr>
|
||||
<td data-export-label="Name"><?php esc_html_e( 'Name', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The name of the current active theme.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The name of the current active theme.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $theme['name'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Version"><?php esc_html_e( 'Version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The installed version of the current active theme.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The installed version of the current active theme.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
echo esc_html( $theme['version'] );
|
||||
if ( version_compare( $theme['version'], $theme['version_latest'], '<' ) ) {
|
||||
/* translators: %s: theme latest version */
|
||||
echo ' – <strong style="color:red;">' . sprintf( __( '%s is available', 'woocommerce' ), esc_html( $theme['version_latest'] ) ) . '</strong>';
|
||||
echo ' – <strong style="color:red;">' . sprintf( esc_html__( '%s is available', 'woocommerce' ), esc_html( $theme['version_latest'] ) ) . '</strong>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Author URL"><?php esc_html_e( 'Author URL', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The theme developers URL.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The theme developers URL.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $theme['author_url'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Child Theme"><?php esc_html_e( 'Child theme', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Displays whether or not the current theme is a child theme.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Displays whether or not the current theme is a child theme.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php echo $theme['is_child_theme'] ? '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>' : '<span class="dashicons dashicons-no-alt"></span> – ' . sprintf( __( 'If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: <a href="%s" target="_blank">How to create a child theme</a>', 'woocommerce' ), 'https://codex.wordpress.org/Child_Themes' ); ?>
|
||||
</td>
|
||||
<?php
|
||||
if ( $theme['is_child_theme'] ) {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
|
||||
} else {
|
||||
/* Translators: %s docs link. */
|
||||
echo '<span class="dashicons dashicons-no-alt"></span> – ' . wp_kses_post( sprintf( __( 'If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: <a href="%s" target="_blank">How to create a child theme</a>', 'woocommerce' ), 'https://codex.wordpress.org/Child_Themes' ) );
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ( $theme['is_child_theme'] ) : ?>
|
||||
<tr>
|
||||
<td data-export-label="Parent Theme Name"><?php esc_html_e( 'Parent theme name', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The name of the parent theme.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The name of the parent theme.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $theme['parent_name'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Parent Theme Version"><?php esc_html_e( 'Parent theme version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The installed version of the parent theme.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The installed version of the parent theme.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
echo esc_html( $theme['parent_version'] );
|
||||
if ( version_compare( $theme['parent_version'], $theme['parent_version_latest'], '<' ) ) {
|
||||
/* translators: %s: parant theme latest version */
|
||||
echo ' – <strong style="color:red;">' . sprintf( __( '%s is available', 'woocommerce' ), esc_html( $theme['parent_version_latest'] ) ) . '</strong>';
|
||||
/* translators: %s: parent theme latest version */
|
||||
echo ' – <strong style="color:red;">' . sprintf( esc_html__( '%s is available', 'woocommerce' ), esc_html( $theme['parent_version_latest'] ) ) . '</strong>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Parent Theme Author URL"><?php esc_html_e( 'Parent theme author URL', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'The parent theme developers URL.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The parent theme developers URL.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $theme['parent_author_url'] ); ?></td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
<tr>
|
||||
<td data-export-label="WooCommerce Support"><?php esc_html_e( 'WooCommerce support', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( __( 'Displays whether or not the current active theme declares WooCommerce support.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'Displays whether or not the current active theme declares WooCommerce support.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ( ! $theme['has_woocommerce_support'] ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'Not declared', 'woocommerce' ) . '</mark>';
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Not declared', 'woocommerce' ) . '</mark>';
|
||||
} else {
|
||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
|
||||
}
|
||||
|
@ -740,7 +806,7 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
<table class="wc_status_table widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" data-export-label="Templates"><h2><?php esc_html_e( 'Templates', 'woocommerce' ); ?><?php echo wc_help_tip( __( 'This section shows any files that are overriding the default WooCommerce template pages.', 'woocommerce' ) ); ?></h2></th>
|
||||
<th colspan="3" data-export-label="Templates"><h2><?php esc_html_e( 'Templates', 'woocommerce' ); ?><?php echo wc_help_tip( esc_html__( 'This section shows any files that are overriding the default WooCommerce template pages.', 'woocommerce' ) ); ?></h2></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -763,10 +829,11 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'minor
|
|||
if ( $override['core_version'] && ( empty( $override['version'] ) || version_compare( $override['version'], $override['core_version'], '<' ) ) ) {
|
||||
$current_version = $override['version'] ? $override['version'] : '-';
|
||||
printf(
|
||||
__( '%1$s version %2$s is out of date. The core version is %3$s', 'woocommerce' ),
|
||||
'<code>' . $override['file'] . '</code>',
|
||||
'<strong style="color:red">' . $current_version . '</strong>',
|
||||
$override['core_version']
|
||||
/* Translators: %1$s: Template name, %2$s: Template version, %3$s: Core version. */
|
||||
esc_html__( '%1$s version %2$s is out of date. The core version is %3$s', 'woocommerce' ),
|
||||
'<code>' . esc_html( $override['file'] ) . '</code>',
|
||||
'<strong style="color:red">' . esc_html( $current_version ) . '</strong>',
|
||||
esc_html( $override['core_version'] )
|
||||
);
|
||||
} else {
|
||||
echo esc_html( $override['file'] );
|
||||
|
|
|
@ -37,7 +37,7 @@ if ( ! $tab_exists ) {
|
|||
self::show_messages();
|
||||
|
||||
do_action( 'woocommerce_settings_' . $current_tab );
|
||||
do_action( 'woocommerce_settings_tabs_' . $current_tab ); // @deprecated hook
|
||||
do_action( 'woocommerce_settings_tabs_' . $current_tab ); // @deprecated hook. @todo remove in 4.0.
|
||||
?>
|
||||
<p class="submit">
|
||||
<?php if ( empty( $GLOBALS['hide_save_button'] ) ) : ?>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
* Admin View: Notice - Secure connection.
|
||||
*
|
||||
* @package WooCommerce\Admin\Notices
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
?>
|
||||
<div id="message" class="updated woocommerce-message">
|
||||
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'no_secure_connection' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'woocommerce' ); ?></a>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
echo wp_kses_post( sprintf(
|
||||
/* translators: %s: documentation URL */
|
||||
__( 'Your store does not appear to be using a secure connection. We highly recommend serving your entire website over an HTTPS connection to help keep customer data secure. <a href="%s">Learn more here.</a>', 'woocommerce' ),
|
||||
'https://docs.woocommerce.com/document/ssl-and-https/'
|
||||
) );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
|
@ -227,7 +227,7 @@ function woocommerce_wp_select( $field ) {
|
|||
<select <?php echo wc_implode_html_attributes( $field_attributes ); // WPCS: XSS ok. ?>>
|
||||
<?php
|
||||
foreach ( $field['options'] as $key => $value ) {
|
||||
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $field['value'] === $key || ( is_array( $field['value'] ) && in_array( $key, $field['value'], true ) ), true, false ) . '>' . esc_html( $value ) . '</option>';
|
||||
echo '<option value="' . esc_attr( $key ) . '"' . wc_selected( $key, $field['value'] ) . '>' . esc_html( $value ) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
|
|
@ -79,9 +79,9 @@ class WC_REST_Authentication {
|
|||
|
||||
if ( is_ssl() ) {
|
||||
return $this->perform_basic_authentication();
|
||||
} else {
|
||||
return $this->perform_oauth_authentication();
|
||||
}
|
||||
|
||||
return $this->perform_oauth_authentication();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,7 +93,7 @@ class WC_REST_Customers_Controller extends WC_REST_Customers_V1_Controller {
|
|||
/**
|
||||
* Update customer meta fields.
|
||||
*
|
||||
* @param WC_Customer $customer Cusotmer data.
|
||||
* @param WC_Customer $customer Customer data.
|
||||
* @param WP_REST_Request $request Request data.
|
||||
*/
|
||||
protected function update_customer_meta_fields( $customer, $request ) {
|
||||
|
|
|
@ -510,6 +510,9 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller {
|
|||
return $object;
|
||||
}
|
||||
|
||||
// Make sure gateways are loaded so hooks from gateways fire on save/create.
|
||||
WC()->payment_gateways();
|
||||
|
||||
if ( ! is_null( $request['customer_id'] ) && 0 !== $request['customer_id'] ) {
|
||||
// Make sure customer exists.
|
||||
if ( false === get_user_by( 'id', $request['customer_id'] ) ) {
|
||||
|
|
|
@ -335,7 +335,11 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Products_Controller
|
|||
|
||||
// Stock handling.
|
||||
if ( isset( $request['manage_stock'] ) ) {
|
||||
$variation->set_manage_stock( $request['manage_stock'] );
|
||||
if ( 'parent' === $request['manage_stock'] ) {
|
||||
$variation->set_manage_stock( false ); // This just indicates the variation does not manage stock, but the parent does.
|
||||
} else {
|
||||
$variation->set_manage_stock( wc_string_to_bool( $request['manage_stock'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $request['in_stock'] ) ) {
|
||||
|
@ -802,7 +806,7 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Products_Controller
|
|||
),
|
||||
'manage_stock' => array(
|
||||
'description' => __( 'Stock management at variation level.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'type' => 'mixed',
|
||||
'default' => false,
|
||||
'context' => array( 'view', 'edit' ),
|
||||
),
|
||||
|
|
|
@ -246,6 +246,7 @@ class WC_REST_Products_Controller extends WC_REST_Legacy_Products_Controller {
|
|||
'taxonomy' => 'product_visibility',
|
||||
'field' => 'name',
|
||||
'terms' => 'featured',
|
||||
'operator' => true === $request['featured'] ? 'IN' : 'NOT IN',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ class WC_REST_Legacy_Products_Controller extends WC_REST_CRUD_Controller {
|
|||
'taxonomy' => 'product_visibility',
|
||||
'field' => 'name',
|
||||
'terms' => 'featured',
|
||||
'operator' => true === $request['featured'] ? 'IN' : 'NOT IN',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -317,13 +317,14 @@ class WC_API_Reports extends WC_API_Resource {
|
|||
*/
|
||||
protected function validate_request( $id = null, $type = null, $context = null ) {
|
||||
|
||||
if ( ! current_user_can( 'view_woocommerce_reports' ) ) {
|
||||
|
||||
return new WP_Error( 'woocommerce_api_user_cannot_read_report', __( 'You do not have permission to read this report', 'woocommerce' ), array( 'status' => 401 ) );
|
||||
|
||||
} else {
|
||||
|
||||
if ( current_user_can( 'view_woocommerce_reports' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return new WP_Error(
|
||||
'woocommerce_api_user_cannot_read_report',
|
||||
__( 'You do not have permission to read this report', 'woocommerce' ),
|
||||
array( 'status' => 401 )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,67 +85,68 @@ class WC_AJAX {
|
|||
public static function add_ajax_events() {
|
||||
// woocommerce_EVENT => nopriv.
|
||||
$ajax_events = array(
|
||||
'get_refreshed_fragments' => true,
|
||||
'apply_coupon' => true,
|
||||
'remove_coupon' => true,
|
||||
'update_shipping_method' => true,
|
||||
'get_cart_totals' => true,
|
||||
'update_order_review' => true,
|
||||
'add_to_cart' => true,
|
||||
'remove_from_cart' => true,
|
||||
'checkout' => true,
|
||||
'get_variation' => true,
|
||||
'get_customer_location' => true,
|
||||
'feature_product' => false,
|
||||
'mark_order_status' => false,
|
||||
'get_order_details' => false,
|
||||
'add_attribute' => false,
|
||||
'add_new_attribute' => false,
|
||||
'remove_variation' => false,
|
||||
'remove_variations' => false,
|
||||
'save_attributes' => false,
|
||||
'add_variation' => false,
|
||||
'link_all_variations' => false,
|
||||
'revoke_access_to_download' => false,
|
||||
'grant_access_to_download' => false,
|
||||
'get_customer_details' => false,
|
||||
'add_order_item' => false,
|
||||
'add_order_fee' => false,
|
||||
'add_order_shipping' => false,
|
||||
'add_order_tax' => false,
|
||||
'add_coupon_discount' => false,
|
||||
'remove_order_coupon' => false,
|
||||
'remove_order_item' => false,
|
||||
'remove_order_tax' => false,
|
||||
'reduce_order_item_stock' => false,
|
||||
'increase_order_item_stock' => false,
|
||||
'add_order_item_meta' => false,
|
||||
'remove_order_item_meta' => false,
|
||||
'calc_line_taxes' => false,
|
||||
'save_order_items' => false,
|
||||
'load_order_items' => false,
|
||||
'add_order_note' => false,
|
||||
'delete_order_note' => false,
|
||||
'json_search_products' => false,
|
||||
'json_search_products_and_variations' => false,
|
||||
'get_refreshed_fragments' => true,
|
||||
'apply_coupon' => true,
|
||||
'remove_coupon' => true,
|
||||
'update_shipping_method' => true,
|
||||
'get_cart_totals' => true,
|
||||
'update_order_review' => true,
|
||||
'add_to_cart' => true,
|
||||
'remove_from_cart' => true,
|
||||
'checkout' => true,
|
||||
'get_variation' => true,
|
||||
'get_customer_location' => true,
|
||||
'feature_product' => false,
|
||||
'mark_order_status' => false,
|
||||
'get_order_details' => false,
|
||||
'add_attribute' => false,
|
||||
'add_new_attribute' => false,
|
||||
'remove_variation' => false,
|
||||
'remove_variations' => false,
|
||||
'save_attributes' => false,
|
||||
'add_variation' => false,
|
||||
'link_all_variations' => false,
|
||||
'revoke_access_to_download' => false,
|
||||
'grant_access_to_download' => false,
|
||||
'get_customer_details' => false,
|
||||
'add_order_item' => false,
|
||||
'add_order_fee' => false,
|
||||
'add_order_shipping' => false,
|
||||
'add_order_tax' => false,
|
||||
'add_coupon_discount' => false,
|
||||
'remove_order_coupon' => false,
|
||||
'remove_order_item' => false,
|
||||
'remove_order_tax' => false,
|
||||
'reduce_order_item_stock' => false,
|
||||
'increase_order_item_stock' => false,
|
||||
'add_order_item_meta' => false,
|
||||
'remove_order_item_meta' => false,
|
||||
'calc_line_taxes' => false,
|
||||
'save_order_items' => false,
|
||||
'load_order_items' => false,
|
||||
'add_order_note' => false,
|
||||
'delete_order_note' => false,
|
||||
'json_search_products' => false,
|
||||
'json_search_products_and_variations' => false,
|
||||
'json_search_downloadable_products_and_variations' => false,
|
||||
'json_search_customers' => false,
|
||||
'json_search_categories' => false,
|
||||
'term_ordering' => false,
|
||||
'product_ordering' => false,
|
||||
'refund_line_items' => false,
|
||||
'delete_refund' => false,
|
||||
'rated' => false,
|
||||
'update_api_key' => false,
|
||||
'load_variations' => false,
|
||||
'save_variations' => false,
|
||||
'bulk_edit_variations' => false,
|
||||
'tax_rates_save_changes' => false,
|
||||
'shipping_zones_save_changes' => false,
|
||||
'shipping_zone_add_method' => false,
|
||||
'shipping_zone_methods_save_changes' => false,
|
||||
'shipping_zone_methods_save_settings' => false,
|
||||
'shipping_classes_save_changes' => false,
|
||||
'json_search_customers' => false,
|
||||
'json_search_categories' => false,
|
||||
'term_ordering' => false,
|
||||
'product_ordering' => false,
|
||||
'refund_line_items' => false,
|
||||
'delete_refund' => false,
|
||||
'rated' => false,
|
||||
'update_api_key' => false,
|
||||
'load_variations' => false,
|
||||
'save_variations' => false,
|
||||
'bulk_edit_variations' => false,
|
||||
'tax_rates_save_changes' => false,
|
||||
'shipping_zones_save_changes' => false,
|
||||
'shipping_zone_add_method' => false,
|
||||
'shipping_zone_methods_save_changes' => false,
|
||||
'shipping_zone_methods_save_settings' => false,
|
||||
'shipping_classes_save_changes' => false,
|
||||
'toggle_gateway_enabled' => false,
|
||||
);
|
||||
|
||||
foreach ( $ajax_events as $ajax_event => $nopriv ) {
|
||||
|
@ -698,7 +699,6 @@ class WC_AJAX {
|
|||
wp_die();
|
||||
}
|
||||
|
||||
$variations = array();
|
||||
$product = wc_get_product( $post_id );
|
||||
$attributes = wc_list_pluck( array_filter( $product->get_attributes(), 'wc_attributes_array_filter_variation' ), 'get_slugs' );
|
||||
|
||||
|
@ -1874,7 +1874,7 @@ class WC_AJAX {
|
|||
$data['consumer_key'] = $consumer_key;
|
||||
$data['consumer_secret'] = $consumer_secret;
|
||||
$data['message'] = __( 'API Key generated successfully. Make sure to copy your new keys now as the secret key will be hidden once you leave this page.', 'woocommerce' );
|
||||
$data['revoke_url'] = '<a style="color: #a00; text-decoration: none;" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'revoke-key' => $key_id ), admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys' ) ), 'revoke' ) ) . '">' . __( 'Revoke key', 'woocommerce' ) . '</a>';
|
||||
$data['revoke_url'] = '<a style="color: #a00; text-decoration: none;" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'revoke-key' => $key_id ), admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=keys' ) ), 'revoke' ) ) . '">' . __( 'Revoke key', 'woocommerce' ) . '</a>';
|
||||
}
|
||||
|
||||
wp_send_json_success( $data );
|
||||
|
@ -2689,6 +2689,8 @@ class WC_AJAX {
|
|||
$shipping_method->set_post_data( $_POST['data'] );
|
||||
$shipping_method->process_admin_options();
|
||||
|
||||
WC_Cache_Helper::get_transient_version( 'shipping', true );
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
'zone_id' => $zone->get_id(),
|
||||
|
@ -2769,6 +2771,46 @@ class WC_AJAX {
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle payment gateway on or off via AJAX.
|
||||
*
|
||||
* @since 3.4.0
|
||||
*/
|
||||
public static function toggle_gateway_enabled() {
|
||||
if ( current_user_can( 'manage_woocommerce' ) && check_ajax_referer( 'woocommerce-toggle-payment-gateway-enabled', 'security' ) ) {
|
||||
// Load gateways.
|
||||
$payment_gateways = WC()->payment_gateways->payment_gateways();
|
||||
|
||||
// Get posted gateway.
|
||||
$gateway_id = wc_clean( wp_unslash( $_POST['gateway_id'] ) );
|
||||
|
||||
foreach ( $payment_gateways as $gateway ) {
|
||||
if ( ! in_array( $gateway_id, array( $gateway->id, sanitize_title( get_class( $gateway ) ) ), true ) ) {
|
||||
continue;
|
||||
}
|
||||
$enabled = $gateway->get_option( 'enabled', 'no' );
|
||||
|
||||
if ( ! wc_string_to_bool( $enabled ) ) {
|
||||
if ( $gateway->needs_setup() ) {
|
||||
wp_send_json_error( 'needs_setup' );
|
||||
wp_die();
|
||||
} else {
|
||||
$gateway->update_option( 'enabled', 'yes' );
|
||||
}
|
||||
} else {
|
||||
// Disable the gateway.
|
||||
$gateway->update_option( 'enabled', 'no' );
|
||||
}
|
||||
|
||||
wp_send_json_success( ! wc_string_to_bool( $enabled ) );
|
||||
wp_die();
|
||||
}
|
||||
}
|
||||
|
||||
wp_send_json_error( 'invalid_gateway_id' );
|
||||
wp_die();
|
||||
}
|
||||
}
|
||||
|
||||
WC_AJAX::init();
|
||||
|
|
|
@ -97,6 +97,10 @@ final class WC_Cart_Session {
|
|||
foreach ( $cart as $key => $values ) {
|
||||
$product = wc_get_product( $values['variation_id'] ? $values['variation_id'] : $values['product_id'] );
|
||||
|
||||
if ( ! is_customize_preview() && 'customize-preview' === $key ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! empty( $product ) && $product->exists() && $values['quantity'] > 0 ) {
|
||||
|
||||
if ( ! $product->is_purchasable() ) {
|
||||
|
|
|
@ -530,7 +530,11 @@ class WC_Checkout {
|
|||
'discount_tax' => $cart->get_coupon_discount_tax_amount( $code ),
|
||||
)
|
||||
);
|
||||
$item->add_meta_data( 'coupon_data', $coupon->get_data() );
|
||||
|
||||
// Avoid storing used_by - it's not needed and can get large.
|
||||
$coupon_data = $coupon->get_data();
|
||||
unset( $coupon_data['used_by'] );
|
||||
$item->add_meta_data( 'coupon_data', $coupon_data );
|
||||
|
||||
/**
|
||||
* Action hook to adjust item before save.
|
||||
|
@ -717,7 +721,7 @@ class WC_Checkout {
|
|||
$this->check_cart_items();
|
||||
|
||||
if ( empty( $data['woocommerce_checkout_update_totals'] ) && ! empty( $_POST['terms-field'] ) && empty( $data['terms'] ) && apply_filters( 'woocommerce_checkout_show_terms', wc_get_page_id( 'terms' ) > 0 ) ) { // WPCS: input var ok, CSRF ok.
|
||||
$errors->add( 'terms', __( 'You must accept our Terms & Conditions.', 'woocommerce' ) );
|
||||
$errors->add( 'terms', __( 'Please read and accept the terms and conditions to proceed with your order.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
if ( WC()->cart->needs_shipping() ) {
|
||||
|
@ -1013,6 +1017,10 @@ class WC_Checkout {
|
|||
throw new Exception( $order_id->get_error_message() );
|
||||
}
|
||||
|
||||
if ( ! $order ) {
|
||||
throw new Exception( __( 'Unable to create order.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_checkout_order_processed', $order_id, $posted_data, $order );
|
||||
|
||||
if ( WC()->cart->needs_payment() ) {
|
||||
|
|
|
@ -633,6 +633,7 @@ class WC_Countries {
|
|||
'class' => array( 'form-row-wide' ),
|
||||
'autocomplete' => 'organization',
|
||||
'priority' => 30,
|
||||
'required' => 'required' === get_option( 'woocommerce_checkout_company_field', 'optional' ),
|
||||
),
|
||||
'country' => array(
|
||||
'type' => 'country',
|
||||
|
@ -657,6 +658,7 @@ class WC_Countries {
|
|||
'required' => false,
|
||||
'autocomplete' => 'address-line2',
|
||||
'priority' => 60,
|
||||
'required' => 'required' === get_option( 'woocommerce_checkout_address_2_field', 'optional' ),
|
||||
),
|
||||
'city' => array(
|
||||
'label' => __( 'Town / City', 'woocommerce' ),
|
||||
|
@ -684,6 +686,20 @@ class WC_Countries {
|
|||
),
|
||||
);
|
||||
|
||||
if ( 'hidden' === get_option( 'woocommerce_checkout_company_field', 'optional' ) ) {
|
||||
unset( $fields['company'] );
|
||||
}
|
||||
|
||||
$address_2_visibility = get_option( 'woocommerce_checkout_address_2_field', 'optional' );
|
||||
|
||||
if ( 'hidden' === $address_2_visibility ) {
|
||||
unset( $fields['address_2'] );
|
||||
}
|
||||
|
||||
if ( 'hidden' === get_option( 'woocommerce_checkout_address_2_field', 'optional' ) ) {
|
||||
unset( $fields['address_2'] );
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_default_address_fields', $fields );
|
||||
}
|
||||
|
||||
|
@ -1200,15 +1216,17 @@ class WC_Countries {
|
|||
|
||||
// Add email and phone fields.
|
||||
if ( 'billing_' === $type ) {
|
||||
$address_fields['billing_phone'] = array(
|
||||
'label' => __( 'Phone', 'woocommerce' ),
|
||||
'required' => true,
|
||||
'type' => 'tel',
|
||||
'class' => array( 'form-row-wide' ),
|
||||
'validate' => array( 'phone' ),
|
||||
'autocomplete' => 'tel',
|
||||
'priority' => 100,
|
||||
);
|
||||
if ( 'hidden' !== get_option( 'woocommerce_checkout_phone_field', 'optional' ) ) {
|
||||
$address_fields['billing_phone'] = array(
|
||||
'label' => __( 'Phone', 'woocommerce' ),
|
||||
'required' => 'required' === get_option( 'woocommerce_checkout_phone_field', 'optional' ),
|
||||
'type' => 'tel',
|
||||
'class' => array( 'form-row-wide' ),
|
||||
'validate' => array( 'phone' ),
|
||||
'autocomplete' => 'tel',
|
||||
'priority' => 100,
|
||||
);
|
||||
}
|
||||
$address_fields['billing_email'] = array(
|
||||
'label' => __( 'Email address', 'woocommerce' ),
|
||||
'required' => true,
|
||||
|
|
|
@ -39,6 +39,19 @@ class WC_Deprecated_Action_Hooks extends WC_Deprecated_Hooks {
|
|||
'woocommerce_new_payment_token' => 'woocommerce_payment_token_created',
|
||||
'woocommerce_new_product_variation' => 'woocommerce_create_product_variation',
|
||||
'woocommerce_order_details_after_order_table_items' => 'woocommerce_order_items_table',
|
||||
|
||||
'woocommerce_settings_advanced_page_options' => array(
|
||||
'woocommerce_settings_checkout_page_options',
|
||||
'woocommerce_settings_account_page_options',
|
||||
),
|
||||
'woocommerce_settings_advanced_page_options_end' => array(
|
||||
'woocommerce_settings_checkout_page_options_end',
|
||||
'woocommerce_settings_account_page_options_end',
|
||||
),
|
||||
'woocommerce_settings_advanced_page_options_after' => array(
|
||||
'woocommerce_settings_checkout_page_options_after',
|
||||
'woocommerce_settings_account_page_options_after',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -47,21 +60,27 @@ class WC_Deprecated_Action_Hooks extends WC_Deprecated_Hooks {
|
|||
* @var array
|
||||
*/
|
||||
protected $deprecated_version = array(
|
||||
'woocommerce_order_add_shipping' => '3.0.0',
|
||||
'woocommerce_order_add_coupon' => '3.0.0',
|
||||
'woocommerce_order_add_tax' => '3.0.0',
|
||||
'woocommerce_order_add_fee' => '3.0.0',
|
||||
'woocommerce_add_shipping_order_item' => '3.0.0',
|
||||
'woocommerce_add_order_item_meta' => '3.0.0',
|
||||
'woocommerce_add_order_fee_meta' => '3.0.0',
|
||||
'woocommerce_order_edit_product' => '3.0.0',
|
||||
'woocommerce_order_update_coupon' => '3.0.0',
|
||||
'woocommerce_order_update_shipping' => '3.0.0',
|
||||
'woocommerce_order_update_fee' => '3.0.0',
|
||||
'woocommerce_order_update_tax' => '3.0.0',
|
||||
'woocommerce_payment_token_created' => '3.0.0',
|
||||
'woocommerce_create_product_variation' => '3.0.0',
|
||||
'woocommerce_order_items_table' => '3.0.0',
|
||||
'woocommerce_order_add_shipping' => '3.0.0',
|
||||
'woocommerce_order_add_coupon' => '3.0.0',
|
||||
'woocommerce_order_add_tax' => '3.0.0',
|
||||
'woocommerce_order_add_fee' => '3.0.0',
|
||||
'woocommerce_add_shipping_order_item' => '3.0.0',
|
||||
'woocommerce_add_order_item_meta' => '3.0.0',
|
||||
'woocommerce_add_order_fee_meta' => '3.0.0',
|
||||
'woocommerce_order_edit_product' => '3.0.0',
|
||||
'woocommerce_order_update_coupon' => '3.0.0',
|
||||
'woocommerce_order_update_shipping' => '3.0.0',
|
||||
'woocommerce_order_update_fee' => '3.0.0',
|
||||
'woocommerce_order_update_tax' => '3.0.0',
|
||||
'woocommerce_payment_token_created' => '3.0.0',
|
||||
'woocommerce_create_product_variation' => '3.0.0',
|
||||
'woocommerce_order_items_table' => '3.0.0',
|
||||
'woocommerce_settings_checkout_page_options' => '3.4.0',
|
||||
'woocommerce_settings_account_page_options' => '3.4.0',
|
||||
'woocommerce_settings_checkout_page_options_end' => '3.4.0',
|
||||
'woocommerce_settings_account_page_options_end' => '3.4.0',
|
||||
'woocommerce_settings_checkout_page_options_after' => '3.4.0',
|
||||
'woocommerce_settings_account_page_options_after' => '3.4.0',
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue