Merge branch 'master' into orders-crud-classes

# Conflicts:
#	includes/abstracts/abstract-wc-order.php
This commit is contained in:
Mike Jolley 2016-08-03 12:32:27 +01:00
commit 837e08143b
395 changed files with 11460 additions and 6718 deletions

View File

@ -8,7 +8,7 @@ __Please Note:__
GitHub is for _bug reports and contributions only_ - if you have a support question or a request for a customization this is not the right place to post it. Use [WooThemes Support](https://support.woothemes.com) for customer support, [WordPress.org](https://wordpress.org/support/plugin/woocommerce) for community support, and for customizations we recommend one of the following services:
- [WooExperts](https://www.woothemes.com/experts/)
- [WooExperts](https://woocommerce.com/experts/)
- [Codeable](https://codeable.io/)
## Contributing To The Core
@ -95,5 +95,5 @@ By translating video tutorials you'll be helping non-English speaking users and
* [General GitHub documentation](https://help.github.com/)
* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
* [Translator Handbook](https://make.wordpress.org/polyglots/handbook/)
* [WooCommerce Docs](https://docs.woothemes.com/)
* [WooCommerce Docs](https://docs.woocommerce.com/)
* [WooThemes Support](https://support.woothemes.com)

View File

@ -1,5 +1,75 @@
== Changelog ==
= 2.6.3 - 19/07/16 =
* Fix - Security - Escape captions in product-thumbnail and product-image templates (template versions have been bumped).
* Fix - Fixed how we calculate shipping tax rates when using more than one tax class.
* Fix - When duplicating product variations, set title, name, and guid.
* Fix - Normalized 'read more' buttons.
* Fix - Add to cart notices for grouped products.
* Fix - Do not sanitize passwords in the settings API.
* Fix - Handle shipping zone location range conversion during update (dashes to ...).
* Fix - Always remove commas while processing flat rate costs.
* Fix - Ensures account page layout is only applied to desktop-sized displays.
* Fix - When getting layered nav counts, take search parameters into consideration.
* Fix - Free shipping show/hide javascript.
* Fix - Strip hash characters when exporting reports.
* Fix - Use permission id to revoke access to downloads to prevent removing wrong rows.
* Fix - When duplicating product variations, set title, name, and guid.
* Fix - Set more appropriate default rounding precision based on currency decimal places.
* Fix - Fix message styles for empty carts.
* Fix - Fixed the load of the WC_Email_Customer_On_Hold_Order class.
* Fix - Don't perform cart update on search submit.
* Dev - API - Added support for WP REST API with custom URL prefixes.
* Dev - API - Delete variations when deleting a variable product.
* Dev - API - Fixed how we check for product types.
* Dev - Added woocommerce_cart_id filter.
* Dev - Add shortcode name param to shortcode_atts function calls.
* Dev - Post custom data when fetching a variation via ajax.
* Dev - Include child prices in grouped_price_html filter.
* Dev - Allow filtering of variation stock quantity.
* Dev - Added $_product argument to 'woocommerce_restock_refunded_item' hook.
* Dev - Added a filter hook for the wc_ajax endpoint url.
* Tweak - Include account page link in new customer account emails.
* Tweak - Updated all URLs from WooThemes.com to WooCommerce.com.
* Tweak - Cache the result of WC_Comments::wp_count_comments() in a transient (improves performance).
= 2.6.2 - 30/06/16 =
* Fix - Set max index length on woocommerce_payment_tokenmeta table for utf8mb4 support.
* Fix - is_available check for legacy shipping methods.
* Fix - wc_add_to_cart_message() when non-array is passed.
* Fix - Maximum coupon check should allow the 'maximum' value.
* Fix - Product coupon logic to avoid applying non-applicable coupons.
* Fix - Potential notices when leaving out 'default' field for shipping instances.
* Fix - wp_cache_flush after term meta migration/update.
* Fix - wc_add_to_cart_message() when non-array is passed.
* Fix - woocommerce_redirect_single_search_result type check was incorrect.
* Fix - Javascript show/hide of option in free shipping method.
* Fix - Convert ellipsis to three periods when saving postcodes.
* Fix - Prevent get_terms returning duplicates.
* Fix - Removed non-existent country (Netherlands Antilles) from https://en.wikipedia.org/wiki/ISO_3166-1.
* Fix - Grouped product range display when child is free.
* Fix - Remove discount when checking free shipping min amount.
* Fix - Prevent blocking the same element multiple times on cart page.
* Fix - Don't sync ratings right after a new comment to prevent rating sync whilst rating meta does not exist yet.
* Fix - Fix product RSS feeds when using shop base.
* Fix - woocommerce_local_pickup_methods comparison by stripping instance IDs before the check.
* Fix - During password resets, use cookie to store reset key and user login to avoid them being exposed in the URL/referer headers.
* Dev - API - Fixed variable product stock at product level.
* Dev - CLI - Introduces `woocommerce_cli_get_product_variable_types` filter.
* Dev - Allow notices to be grouped on checkout after certain events.
* Dev - API - Allows save images by ID with product variations.
* Tweak - Made customer pay link display if order needs_payment() rather than checking pending status.
* Tweak - Zones - Wording clarifications.
* Tweak - Zones - Match zones with postcodes but no country.
* Tweak - Zones - Match zones with no regions as 'everywhere'.
* Tweak - Added view_admin_dashboard cap for disabling the admin access restriction in custom roles.
* Tweak - Revised stock display based on feedback to hide 'in stock' message if stock management is off and only show available on backorder if notifying customer.
* Tweak - Allow external product SKUs.
* Tweak - PT (Portugal) and JP (Japan) postcode formats.
* Tweak - Sort products from the `[product_category]` shortcode by menu order.
* Tweak - Improve wc_orders_count() performance by running a query to count only posts of the given status.
* Tweak - To allow my account page tabs to be disabled without code, you can now set the endpoint value to a blank string.
= 2.6.1 - 16/06/16 =
* Fix - Added missing localized format for line taxes in orders screen to prevent total miscalculation in manual orders.
* Fix - Improved the hour and time fields validation pattern on the orders screen.
@ -438,7 +508,7 @@
* Fix - Datepicker range for variations.
= 2.3.12 - 06/07/2015 =
* Fix - Fixed Google Chrome forcing to use SSL. This can cause some issues on websites behind load balancers or reverse proxies. [Read more](https://docs.woothemes.com/document/ssl-and-https/#websites-behind-load-balancers-or-reverse-proxies).
* Fix - Fixed Google Chrome forcing to use SSL. This can cause some issues on websites behind load balancers or reverse proxies. [Read more](https://docs.woocommerce.com/document/ssl-and-https/#websites-behind-load-balancers-or-reverse-proxies).
* Fix - Escaped shop url in empty cart template.
* Fix - Escaped product tabs titles.
* Fix - Removed deprecated PHP4 constructor on Widget classes.
@ -1264,7 +1334,7 @@
* Tweak - Filterable page installer.
* Tweak - Order details optimised for small screens.
* Tweak - Streamlined account process - username and passwords are optional and can be automatically generated.
* Tweak - Updated/new dummy data (including .csv files to be used with [Product CSV Import Suite](https://www.woothemes.com/products/product-csv-import-suite/)).
* Tweak - Updated/new dummy data (including .csv files to be used with [Product CSV Import Suite](https://woocommerce.com/products/product-csv-import-suite/)).
* Tweak - Product shortcodes columns parameter now affects layout correctly.
* Tweak - Disabled button styles.
* Tweak - Hooks for overriding default email inline styles.
@ -1383,7 +1453,7 @@
* Tweak - Allow users with edit rights to add draft products to cart (and nobody else)
* Tweak - Handle pending status for paypal
* Tweak - Only refresh fragment when cart cookie > 0
* Tweak - Updated/new dummy data (including .csv files to be used with [Product CSV Import Suite](https://www.woothemes.com/products/product-csv-import-suite/)).
* Tweak - Updated/new dummy data (including .csv files to be used with [Product CSV Import Suite](https://woocommerce.com/products/product-csv-import-suite/)).
* Fix - Extra escaping on layered nav variables to prevent injection
* Fix - Improved sanitization of option fields
* Fix - Add fee total to cart total
@ -1637,7 +1707,7 @@
* Feature - Filter coupons in admin by type.
* Feature - Append view cart link on ajax buttons.
* Feature - Revised the way coupons are stored per order and added new coupon reports on usage.
* Feature - Updated/new dummy data (including .csv files to be used with [Product CSV Import Suite](https://www.woothemes.com/products/product-csv-import-suite/)).
* Feature - Updated/new dummy data (including .csv files to be used with [Product CSV Import Suite](https://woocommerce.com/products/product-csv-import-suite/)).
* Feature - Option to hold stock for unpaid orders (defaults to 60mins). When this time limit is reached, and the order is not paid for, stock is released and the order is cancelled.
* Feature - Added set_stock() method to product class.
* Feature - Linking to mydomain.com/product#review_form will now open the review form on load (if WooCommerce lightbox is turned on)

View File

@ -1,13 +1,13 @@
# [WooCommerce](https://www.woothemes.com/woocommerce/) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) [![Build Status](https://api.travis-ci.org/woothemes/woocommerce.svg?branch=master)](https://travis-ci.org/woothemes/woocommerce) [![Coverage Status](https://coveralls.io/repos/woothemes/woocommerce/badge.svg?branch=master&service=github)](https://coveralls.io/github/woothemes/woocommerce?branch=master)
# [WooCommerce](https://woocommerce.com/) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) [![Build Status](https://api.travis-ci.org/woothemes/woocommerce.svg?branch=master)](https://travis-ci.org/woothemes/woocommerce) [![Coverage Status](https://coveralls.io/repos/woothemes/woocommerce/badge.svg?branch=master&service=github)](https://coveralls.io/github/woothemes/woocommerce?branch=master) [![Code Climate](https://codeclimate.com/github/woothemes/woocommerce/badges/gpa.svg)](https://codeclimate.com/github/woothemes/woocommerce)
Welcome to the WooCommerce repository on GitHub. Here you can browse the source, look at open issues and keep track of development. We recommend all developers to follow the [WooCommerce development blog](https://woocommerce.wordpress.com/) to stay up to date about everything happening in the project. You can also [follow @DevelopWC](https://twitter.com/DevelopWC) on Twitter for the latest development updates.
If you are not a developer, please use the [WooCommerce plugin page](https://wordpress.org/plugins/woocommerce/) on WordPress.org.
## Documentation
* [WooCommerce Documentation](https://docs.woothemes.com/documentation/plugins/woocommerce/)
* [WooCommerce Documentation](https://docs.woocommerce.com/documentation/plugins/woocommerce/)
* [WooCommerce Knowledge Base](https://support.woothemes.com/hc/en-us/categories/200146917-WooCommerce)
* [WooCommerce Code Reference](https://docs.woothemes.com/wc-apidocs/)
* [WooCommerce Code Reference](https://docs.woocommerce.com/wc-apidocs/)
* [WooCommerce REST API Docs](https://woothemes.github.io/woocommerce-rest-api-docs/)
## Support

View File

@ -29,7 +29,7 @@ main: WC
title: WooCommerce 2.6.x Code Reference
# base url used for sitemap (useful for public doc)
baseUrl: https://docs.woothemes.com/wc-apidocs/
baseUrl: https://docs.woocommerce.com/wc-apidocs/
# choose ApiGen template theme
templateTheme: default

View File

@ -45,9 +45,9 @@ class WC_HookFinder {
private static function get_hook_link( $hook, $details = array() ) {
if ( ! empty( $details['class'] ) ) {
$link = 'http://docs.woothemes.com/wc-apidocs/source-class-' . $details['class'] . '.html#' . $details['line'];
$link = 'http://docs.woocommerce.com/wc-apidocs/source-class-' . $details['class'] . '.html#' . $details['line'];
} elseif ( ! empty( $details['function'] ) ) {
$link = 'http://docs.woothemes.com/wc-apidocs/source-function-' . $details['function'] . '.html#' . $details['line'];
$link = 'http://docs.woocommerce.com/wc-apidocs/source-function-' . $details['function'] . '.html#' . $details['line'];
} else {
$link = 'https://github.com/woothemes/woocommerce/search?utf8=%E2%9C%93&q=' . $hook;
}

File diff suppressed because one or more lines are too long

View File

@ -306,7 +306,12 @@ table.wc_status_table {
#log-viewer-select {
padding: 10px 0 8px;
line-height: 180%;
line-height: 28px;
h2 {
a {
vertical-align: middle;
}
}
}
#log-viewer {
@ -585,7 +590,7 @@ ul.wc_coupon_list_block {
.hour,
.minute {
width: 2.5em;
width: 3.5em;
}
small {
@ -1045,7 +1050,7 @@ ul.wc_coupon_list_block {
display: block;
margin-top: .5em;
font-size: 0.92em !important;
color: #c8c8c8;
color: #888;
}
}
@ -1146,7 +1151,7 @@ ul.wc_coupon_list_block {
small.times, del, .wc-order-item-taxes, .wc-order-item-discount, .wc-order-item-refund-fields {
font-size: 0.92em !important;
color: #c8c8c8;
color: #888;
}
.wc-order-item-taxes, .wc-order-item-refund-fields {
@ -1197,7 +1202,7 @@ ul.wc_coupon_list_block {
table.display_meta {
margin: .5em 0 0 0;
font-size: 0.92em !important;
color: #c8c8c8;
color: #888;
tr {
th {
@ -2424,19 +2429,17 @@ table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-class
padding-right: 32px;
li {
display: inline;
margin: 0 0 0 0;
margin: 0;
}
li:before {
content: ", ";
}
li:last-child:before, li:first-child:before {
li:first-child:before,
li:nth-child(2):before {
content: "";
}
li:last-child {
display: block;
}
li:first-child {
margin: 0 !important;
display: block;
}
li.wc-shipping-zone-methods-add-row {
position: absolute;
@ -2537,7 +2540,7 @@ table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-class
}
input[type="checkbox"] {
width: auto;
min-width: 0;
min-width: 16px;
}
}
td, th {

File diff suppressed because one or more lines are too long

View File

@ -329,6 +329,18 @@
}
}
.woocommerce-account {
.woocommerce-MyAccount-navigation {
float: left;
width: 30%;
}
.woocommerce-MyAccount-content {
float: right;
width: 68%;
}
}
/**
* Twenty Eleven specific styles
*/

File diff suppressed because one or more lines are too long

View File

@ -213,6 +213,14 @@
}
}
.woocommerce-account {
.woocommerce-MyAccount-navigation,
.woocommerce-MyAccount-content {
float: none;
width: 100%;
}
}
/**
* Twenty Thirteen specific styles
*/

File diff suppressed because one or more lines are too long

View File

@ -80,66 +80,6 @@ p.demo_store {
}
}
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
padding: 1em 2em 1em 3.5em !important;
margin: 0 0 2em !important;
position: relative;
background-color: lighten($secondary,5%);
color: $secondarytext;
border-top: 3px solid $primary;
list-style: none outside !important;
@include clearfix();
width: auto;
word-wrap: break-word;
&:before {
font-family: "WooCommerce";
content: "\e028";
display: inline-block;
position: absolute;
top: 1em;
left: 1.5em;
}
.button {
float: right;
}
li {
list-style: none outside !important;
padding-left: 0 !important;
margin-left: 0 !important;
}
}
.woocommerce-message {
border-top-color: #8fae1b;
&:before {
content: "\e015";
color: #8fae1b;
}
}
.woocommerce-info {
border-top-color: #1e85be;
&:before {
color: #1e85be;
}
}
.woocommerce-error {
border-top-color: #b81c23;
&:before {
content: "\e016";
color: #b81c23;
}
}
small.note {
display: block;
color: $subtext;
@ -1200,6 +1140,10 @@ p.demo_store {
.buttons {
@include clearfix();
a {
margin-right: 5px;
margin-bottom: 5px;
}
}
}
@ -1549,6 +1493,66 @@ p.demo_store {
}
}
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
padding: 1em 2em 1em 3.5em !important;
margin: 0 0 2em !important;
position: relative;
background-color: lighten($secondary,5%);
color: $secondarytext;
border-top: 3px solid $primary;
list-style: none outside !important;
@include clearfix();
width: auto;
word-wrap: break-word;
&:before {
font-family: "WooCommerce";
content: "\e028";
display: inline-block;
position: absolute;
top: 1em;
left: 1.5em;
}
.button {
float: right;
}
li {
list-style: none outside !important;
padding-left: 0 !important;
margin-left: 0 !important;
}
}
.woocommerce-message {
border-top-color: #8fae1b;
&:before {
content: "\e015";
color: #8fae1b;
}
}
.woocommerce-info {
border-top-color: #1e85be;
&:before {
color: #1e85be;
}
}
.woocommerce-error {
border-top-color: #b81c23;
&:before {
content: "\e016";
color: #b81c23;
}
}
/**
* Account page
*/
@ -1557,16 +1561,6 @@ p.demo_store {
@include clearfix();
}
.woocommerce-MyAccount-navigation {
float: left;
width: 30%;
}
.woocommerce-MyAccount-content {
float: right;
width: 68%;
}
.addresses {
.title {
@include clearfix();
@ -1617,9 +1611,11 @@ p.demo_store {
}
/**
* Cart page
* Cart/checkout page
*/
.woocommerce-cart {
.woocommerce-cart,
.woocommerce-checkout,
#add_payment_method {
table.cart {
.product-thumbnail {
min-width: 32px;
@ -1745,12 +1741,6 @@ p.demo_store {
}
}
}
}
/**
* Checkout
*/
.woocommerce-checkout, #add_payment_method {
.checkout {
.col-2 {
h3#ship-to-different-address {

View File

@ -8,4 +8,4 @@
* Full details and documentation:
* http://openexchangerates.github.io/accounting.js/
*/
!function(a,b){function c(a){return!!(""===a||a&&a.charCodeAt&&a.substr)}function d(a){return l?l(a):"[object Array]"===m.call(a)}function e(a){return a&&"[object Object]"===m.call(a)}function f(a,b){var c;a=a||{},b=b||{};for(c in b)b.hasOwnProperty(c)&&null==a[c]&&(a[c]=b[c]);return a}function g(a,b,c){var d,e,f=[];if(!a)return f;if(k&&a.map===k)return a.map(b,c);for(d=0,e=a.length;e>d;d++)f[d]=b.call(c,a[d],d,a);return f}function h(a,b){return a=Math.round(Math.abs(a)),isNaN(a)?b:a}function i(a){var b=j.settings.currency.format;return"function"==typeof a&&(a=a()),c(a)&&a.match("%v")?{pos:a,neg:a.replace("-","").replace("%v","-%v"),zero:a}:a&&a.pos&&a.pos.match("%v")?a:c(b)?j.settings.currency.format={pos:b,neg:b.replace("%v","-%v"),zero:b}:b}var j={};j.version="0.4.1",j.settings={currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}};var k=Array.prototype.map,l=Array.isArray,m=Object.prototype.toString,n=j.unformat=j.parse=function(a,b){if(d(a))return g(a,function(a){return n(a,b)});if(a=a||0,"number"==typeof a)return a;b=b||j.settings.number.decimal;var c=new RegExp("[^0-9-"+b+"]",["g"]),e=parseFloat((""+a).replace(/\((.*)\)/,"-$1").replace(c,"").replace(b,"."));return isNaN(e)?0:e},o=j.toFixed=function(a,b){b=h(b,j.settings.number.precision);var c=Math.pow(10,b);return(Math.round(j.unformat(a)*c)/c).toFixed(b)},p=j.formatNumber=j.format=function(a,b,c,i){if(d(a))return g(a,function(a){return p(a,b,c,i)});a=n(a);var k=f(e(b)?b:{precision:b,thousand:c,decimal:i},j.settings.number),l=h(k.precision),m=0>a?"-":"",q=parseInt(o(Math.abs(a||0),l),10)+"",r=q.length>3?q.length%3:0;return m+(r?q.substr(0,r)+k.thousand:"")+q.substr(r).replace(/(\d{3})(?=\d)/g,"$1"+k.thousand)+(l?k.decimal+o(Math.abs(a),l).split(".")[1]:"")},q=j.formatMoney=function(a,b,c,k,l,m){if(d(a))return g(a,function(a){return q(a,b,c,k,l,m)});a=n(a);var o=f(e(b)?b:{symbol:b,precision:c,thousand:k,decimal:l,format:m},j.settings.currency),r=i(o.format),s=a>0?r.pos:0>a?r.neg:r.zero;return s.replace("%s",o.symbol).replace("%v",p(Math.abs(a),h(o.precision),o.thousand,o.decimal))};j.formatColumn=function(a,b,k,l,m,o){if(!a)return[];var q=f(e(b)?b:{symbol:b,precision:k,thousand:l,decimal:m,format:o},j.settings.currency),r=i(q.format),s=r.pos.indexOf("%s")<r.pos.indexOf("%v"),t=0,u=g(a,function(a,b){if(d(a))return j.formatColumn(a,q);a=n(a);var c=a>0?r.pos:0>a?r.neg:r.zero,e=c.replace("%s",q.symbol).replace("%v",p(Math.abs(a),h(q.precision),q.thousand,q.decimal));return e.length>t&&(t=e.length),e});return g(u,function(a,b){return c(a)&&a.length<t?s?a.replace(q.symbol,q.symbol+new Array(t-a.length+1).join(" ")):new Array(t-a.length+1).join(" ")+a:a})},"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports.accounting=j):"function"==typeof define&&define.amd?define([],function(){return j}):(j.noConflict=function(c){return function(){return a.accounting=c,j.noConflict=b,j}}(a.accounting),a.accounting=j)}(this);
!function(a,b){function c(a){return!!(""===a||a&&a.charCodeAt&&a.substr)}function d(a){return l?l(a):"[object Array]"===m.call(a)}function e(a){return a&&"[object Object]"===m.call(a)}function f(a,b){var c;a=a||{},b=b||{};for(c in b)b.hasOwnProperty(c)&&null==a[c]&&(a[c]=b[c]);return a}function g(a,b,c){var d,e,f=[];if(!a)return f;if(k&&a.map===k)return a.map(b,c);for(d=0,e=a.length;d<e;d++)f[d]=b.call(c,a[d],d,a);return f}function h(a,b){return a=Math.round(Math.abs(a)),isNaN(a)?b:a}function i(a){var b=j.settings.currency.format;return"function"==typeof a&&(a=a()),c(a)&&a.match("%v")?{pos:a,neg:a.replace("-","").replace("%v","-%v"),zero:a}:a&&a.pos&&a.pos.match("%v")?a:c(b)?j.settings.currency.format={pos:b,neg:b.replace("%v","-%v"),zero:b}:b}var j={};j.version="0.4.1",j.settings={currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}};var k=Array.prototype.map,l=Array.isArray,m=Object.prototype.toString,n=j.unformat=j.parse=function(a,b){if(d(a))return g(a,function(a){return n(a,b)});if(a=a||0,"number"==typeof a)return a;b=b||j.settings.number.decimal;var c=new RegExp("[^0-9-"+b+"]",["g"]),e=parseFloat((""+a).replace(/\((.*)\)/,"-$1").replace(c,"").replace(b,"."));return isNaN(e)?0:e},o=j.toFixed=function(a,b){b=h(b,j.settings.number.precision);var c=Math.pow(10,b);return(Math.round(j.unformat(a)*c)/c).toFixed(b)},p=j.formatNumber=j.format=function(a,b,c,i){if(d(a))return g(a,function(a){return p(a,b,c,i)});a=n(a);var k=f(e(b)?b:{precision:b,thousand:c,decimal:i},j.settings.number),l=h(k.precision),m=a<0?"-":"",q=parseInt(o(Math.abs(a||0),l),10)+"",r=q.length>3?q.length%3:0;return m+(r?q.substr(0,r)+k.thousand:"")+q.substr(r).replace(/(\d{3})(?=\d)/g,"$1"+k.thousand)+(l?k.decimal+o(Math.abs(a),l).split(".")[1]:"")},q=j.formatMoney=function(a,b,c,k,l,m){if(d(a))return g(a,function(a){return q(a,b,c,k,l,m)});a=n(a);var o=f(e(b)?b:{symbol:b,precision:c,thousand:k,decimal:l,format:m},j.settings.currency),r=i(o.format),s=a>0?r.pos:a<0?r.neg:r.zero;return s.replace("%s",o.symbol).replace("%v",p(Math.abs(a),h(o.precision),o.thousand,o.decimal))};j.formatColumn=function(a,b,k,l,m,o){if(!a)return[];var q=f(e(b)?b:{symbol:b,precision:k,thousand:l,decimal:m,format:o},j.settings.currency),r=i(q.format),s=r.pos.indexOf("%s")<r.pos.indexOf("%v"),t=0,u=g(a,function(a,b){if(d(a))return j.formatColumn(a,q);a=n(a);var c=a>0?r.pos:a<0?r.neg:r.zero,e=c.replace("%s",q.symbol).replace("%v",p(Math.abs(a),h(q.precision),q.thousand,q.decimal));return e.length>t&&(t=e.length),e});return g(u,function(a,b){return c(a)&&a.length<t?s?a.replace(q.symbol,q.symbol+new Array(t-a.length+1).join(" ")):new Array(t-a.length+1).join(" ")+a:a})},"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports.accounting=j):"function"==typeof define&&define.amd?define([],function(){return j}):(j.noConflict=function(c){return function(){return a.accounting=c,j.noConflict=b,j}}(a.accounting),a.accounting=j)}(this);

View File

@ -1266,9 +1266,10 @@ jQuery( function ( $ ) {
revoke_access: function () {
if ( window.confirm( woocommerce_admin_meta_boxes.i18n_permission_revoke ) ) {
var el = $( this ).parent().parent();
var product = $( this ).attr( 'rel' ).split( ',' )[0];
var file = $( this ).attr( 'rel' ).split( ',' )[1];
var el = $( this ).parent().parent();
var product = $( this ).attr( 'rel' ).split( ',' )[0];
var file = $( this ).attr( 'rel' ).split( ',' )[1];
var permission_id = $( this ).data( 'permission_id' );
if ( product > 0 ) {
$( el ).block({
@ -1280,11 +1281,12 @@ jQuery( function ( $ ) {
});
var data = {
action: 'woocommerce_revoke_access_to_download',
product_id: product,
download_id: file,
order_id: woocommerce_admin_meta_boxes.post_id,
security: woocommerce_admin_meta_boxes.revoke_access_nonce
action: 'woocommerce_revoke_access_to_download',
product_id: product,
download_id: file,
permission_id: permission_id,
order_id: woocommerce_admin_meta_boxes.post_id,
security: woocommerce_admin_meta_boxes.revoke_access_nonce
};
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -18,23 +18,23 @@ jQuery( function( $ ) {
});
});
// Prevent enter submitting post form
// Prevent enter submitting post form.
$( '#upsell_product_data' ).bind( 'keypress', function( e ) {
if ( e.keyCode === 13 ) {
return false;
}
});
// Type box
// Type box.
$( '.type_box' ).appendTo( '#woocommerce-product-data .hndle span' );
$( function() {
// Prevent inputs in meta box headings opening/closing contents
// Prevent inputs in meta box headings opening/closing contents.
$( '#woocommerce-product-data' ).find( '.hndle' ).unbind( 'click.postboxes' );
jQuery( '#woocommerce-product-data' ).on( 'click', '.hndle', function( event ) {
$( '#woocommerce-product-data' ).on( 'click', '.hndle', function( event ) {
// If the user clicks on some form input inside the h3 the box should not be toggled
// If the user clicks on some form input inside the h3 the box should not be toggled.
if ( $( event.target ).filter( 'input, option, label, select' ).length ) {
return;
}
@ -43,15 +43,15 @@ jQuery( function( $ ) {
});
});
// Catalog Visibility
$( '#catalog-visibility' ).find( '.edit-catalog-visibility' ).click( function () {
// Catalog Visibility.
$( '#catalog-visibility' ).find( '.edit-catalog-visibility' ).click( function() {
if ( $( '#catalog-visibility-select' ).is( ':hidden' ) ) {
$( '#catalog-visibility-select' ).slideDown( 'fast' );
$( this ).hide();
}
return false;
});
$( '#catalog-visibility' ).find( '.save-post-visibility' ).click( function () {
$( '#catalog-visibility' ).find( '.save-post-visibility' ).click( function() {
$( '#catalog-visibility-select' ).slideUp( 'fast' );
$( '#catalog-visibility' ).find( '.edit-catalog-visibility' ).show();
@ -65,7 +65,7 @@ jQuery( function( $ ) {
$( '#catalog-visibility-display' ).text( label );
return false;
});
$( '#catalog-visibility' ).find( '.cancel-post-visibility' ).click( function () {
$( '#catalog-visibility' ).find( '.cancel-post-visibility' ).click( function() {
$( '#catalog-visibility-select' ).slideUp( 'fast' );
$( '#catalog-visibility' ).find( '.edit-catalog-visibility' ).show();
@ -88,10 +88,10 @@ jQuery( function( $ ) {
return false;
});
// PRODUCT TYPE SPECIFIC OPTIONS
$( 'select#product-type' ).change( function () {
// PRODUCT TYPE SPECIFIC OPTIONS.
$( 'select#product-type' ).change( function() {
// Get value
// Get value.
var select_val = $( this ).val();
if ( 'variable' === select_val ) {
@ -129,7 +129,7 @@ jQuery( function( $ ) {
var is_virtual = $( 'input#_virtual:checked' ).length;
var is_downloadable = $( 'input#_downloadable:checked' ).length;
// Hide/Show all with rules
// Hide/Show all with rules.
var hide_classes = '.hide_if_downloadable, .hide_if_virtual';
var show_classes = '.show_if_downloadable, .show_if_virtual';
@ -141,7 +141,7 @@ jQuery( function( $ ) {
$( hide_classes ).show();
$( show_classes ).hide();
// Shows rules
// Shows rules.
if ( is_downloadable ) {
$( '.show_if_downloadable' ).show();
}
@ -151,7 +151,7 @@ jQuery( function( $ ) {
$( '.show_if_' + product_type ).show();
// Hide rules
// Hide rules.
if ( is_downloadable ) {
$( '.hide_if_downloadable' ).hide();
}
@ -162,16 +162,35 @@ jQuery( function( $ ) {
$( '.hide_if_' + product_type ).hide();
$( 'input#_manage_stock' ).change();
// Hide empty panels/tabs after display.
$( '.woocommerce_options_panel' ).each( function() {
var $children = $( this ).children( '.options_group' );
if ( 0 === $children.length ) {
return;
}
var $invisble = $children.filter( function() {
return 'none' === $( this ).css( 'display' );
});
// Hide panel.
if ( $invisble.length === $children.length ) {
var $id = $( this ).prop( 'id' );
$( '.product_data_tabs' ).find( 'li a[href="#' + $id + '"]' ).parent().hide();
}
});
}
// Sale price schedule
// Sale price schedule.
$( '.sale_price_dates_fields' ).each( function() {
var $these_sale_dates = $( this );
var sale_schedule_set = false;
var $wrap = $these_sale_dates.closest( 'div, table' );
$these_sale_dates.find( 'input' ).each( function() {
if ( $( this ).val() !== '' ) {
if ( '' !== $( this ).val() ) {
sale_schedule_set = true;
}
});
@ -205,7 +224,7 @@ jQuery( function( $ ) {
return false;
});
// File inputs
// File inputs.
$( '#woocommerce-product-data' ).on( 'click','.downloadable_files a.insert', function() {
$( this ).closest( '.downloadable_files' ).find( 'tbody' ).append( $( this ).data( 'row' ) );
return false;
@ -215,7 +234,7 @@ jQuery( function( $ ) {
return false;
});
// STOCK OPTIONS
// STOCK OPTIONS.
$( 'input#_manage_stock' ).change( function() {
if ( $( this ).is( ':checked' ) ) {
$( 'div.stock_fields' ).show();
@ -224,7 +243,7 @@ jQuery( function( $ ) {
}
}).change();
// DATE PICKER FIELDS
// DATE PICKER FIELDS.
$( '.sale_price_dates_fields' ).each( function() {
var dates = $( this ).find( 'input' ).datepicker({
defaultDate: '',
@ -240,18 +259,18 @@ jQuery( function( $ ) {
});
});
// ATTRIBUTE TABLES
// ATTRIBUTE TABLES.
// Initial order
var woocommerce_attribute_items = $('.product_attributes').find('.woocommerce_attribute').get();
// Initial order.
var woocommerce_attribute_items = $( '.product_attributes' ).find( '.woocommerce_attribute' ).get();
woocommerce_attribute_items.sort(function(a, b) {
woocommerce_attribute_items.sort( function( a, b ) {
var compA = parseInt( $( a ).attr( 'rel' ), 10 );
var compB = parseInt( $( b ).attr( 'rel' ), 10 );
return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
return ( compA < compB ) ? -1 : ( compA > compB ) ? 1 : 0;
});
$( woocommerce_attribute_items ).each( function( idx, itm ) {
$( '.product_attributes' ).append(itm);
$( woocommerce_attribute_items ).each( function( index, el ) {
$( '.product_attributes' ).append( el );
});
function attribute_row_indexes() {
@ -266,7 +285,7 @@ jQuery( function( $ ) {
}
});
// Add rows
// Add rows.
$( 'button.add_attribute' ).on( 'click', function() {
var size = $( '.product_attributes .woocommerce_attribute' ).length;
var attribute = $( 'select.attribute_taxonomy' ).val();
@ -291,7 +310,7 @@ jQuery( function( $ ) {
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
$attributes.append( response );
if ( product_type !== 'variable' ) {
if ( 'variable' !== product_type ) {
$attributes.find( '.enable_variation' ).hide();
}
@ -322,7 +341,7 @@ jQuery( function( $ ) {
$( '.product_attributes' ).on( 'click', 'button.select_no_attributes', function() {
$( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' );
$( this ).closest( 'td' ).find( 'select').change();
$( this ).closest( 'td' ).find( 'select' ).change();
return false;
});
@ -331,11 +350,11 @@ jQuery( function( $ ) {
var $parent = $( this ).parent().parent();
if ( $parent.is( '.taxonomy' ) ) {
$parent.find( 'select, input[type=text]' ).val('');
$parent.find( 'select, input[type=text]' ).val( '' );
$parent.hide();
$( 'select.attribute_taxonomy' ).find( 'option[value="' + $parent.data( 'taxonomy' ) + '"]' ).removeAttr( 'disabled' );
} else {
$parent.find( 'select, input[type=text]' ).val('');
$parent.find( 'select, input[type=text]' ).val( '' );
$parent.hide();
attribute_row_indexes();
}
@ -343,7 +362,7 @@ jQuery( function( $ ) {
return false;
});
// Attribute ordering
// Attribute ordering.
$( '.product_attributes' ).sortable({
items: '.woocommerce_attribute',
cursor: 'move',
@ -363,10 +382,16 @@ jQuery( function( $ ) {
}
});
// Add a new attribute (via ajax)
// Add a new attribute (via ajax).
$( '.product_attributes' ).on( 'click', 'button.add_new_attribute', function() {
$( '.product_attributes' ).block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } });
$( '.product_attributes' ).block({
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
var $wrapper = $( this ).closest( '.woocommerce_attribute' );
var attribute = $wrapper.data( 'taxonomy' );
@ -384,10 +409,10 @@ jQuery( function( $ ) {
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
if ( response.error ) {
// Error
// Error.
window.alert( response.error );
} else if ( response.slug ) {
// Success
// Success.
$wrapper.find( 'select.attribute_values' ).append( '<option value="' + response.slug + '" selected="selected">' + response.name + '</option>' );
$wrapper.find( 'select.attribute_values' ).change();
}
@ -402,7 +427,7 @@ jQuery( function( $ ) {
return false;
});
// Save attributes and update variations
// Save attributes and update variations.
$( '.save_attributes' ).on( 'click', function() {
$( '#woocommerce-product-data' ).block({
@ -421,22 +446,22 @@ jQuery( function( $ ) {
};
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function() {
// Reload variations panel
// Reload variations panel.
var this_page = window.location.toString();
this_page = this_page.replace( 'post-new.php?', 'post.php?post=' + woocommerce_admin_meta_boxes.post_id + '&action=edit&' );
// Load variations panel
// Load variations panel.
$( '#variable_product_options' ).load( this_page + ' #variable_product_options_inner', function() {
$( '#variable_product_options' ).trigger( 'reload' );
});
});
});
// Uploading files
// Uploading files.
var downloadable_file_frame;
var file_path_field;
jQuery( document.body ).on( 'click', '.upload_file_button', function( event ) {
$( document.body ).on( 'click', '.upload_file_button', function( event ) {
var $el = $( this );
file_path_field = $el.closest( 'tr' ).find( 'td.file_url input' );
@ -489,7 +514,7 @@ jQuery( function( $ ) {
file_path_field.val( file_path ).change();
});
// Set post to 0 and set our custom type
// Set post to 0 and set our custom type.
downloadable_file_frame.on( 'ready', function() {
downloadable_file_frame.uploader.options.uploader.params = {
type: 'downloadable_product'
@ -500,8 +525,8 @@ jQuery( function( $ ) {
downloadable_file_frame.open();
});
// Download ordering
jQuery( '.downloadable_files tbody' ).sortable({
// Download ordering.
$( '.downloadable_files tbody' ).sortable({
items: 'tr',
cursor: 'move',
axis: 'y',
@ -512,12 +537,12 @@ jQuery( function( $ ) {
opacity: 0.65
});
// Product gallery file uploads
// Product gallery file uploads.
var product_gallery_frame;
var $image_gallery_ids = $( '#product_image_gallery' );
var $product_images = $( '#product_images_container' ).find( 'ul.product_images' );
jQuery( '.add_product_images' ).on( 'click', 'a', function( event ) {
$( '.add_product_images' ).on( 'click', 'a', function( event ) {
var $el = $( this );
event.preventDefault();
@ -567,7 +592,7 @@ jQuery( function( $ ) {
product_gallery_frame.open();
});
// Image ordering
// Image ordering.
$product_images.sortable({
items: 'li.image',
cursor: 'move',
@ -587,7 +612,7 @@ jQuery( function( $ ) {
var attachment_ids = '';
$( '#product_images_container' ).find( 'ul li.image' ).css( 'cursor', 'default' ).each( function() {
var attachment_id = jQuery( this ).attr( 'data-attachment_id' );
var attachment_id = $( this ).attr( 'data-attachment_id' );
attachment_ids = attachment_ids + attachment_id + ',';
});
@ -595,20 +620,20 @@ jQuery( function( $ ) {
}
});
// Remove images
// Remove images.
$( '#product_images_container' ).on( 'click', 'a.delete', function() {
$( this ).closest( 'li.image' ).remove();
var attachment_ids = '';
$( '#product_images_container' ).find( 'ul li.image' ).css( 'cursor', 'default' ).each( function() {
var attachment_id = jQuery( this ).attr( 'data-attachment_id' );
var attachment_id = $( this ).attr( 'data-attachment_id' );
attachment_ids = attachment_ids + attachment_id + ',';
});
$image_gallery_ids.val( attachment_ids );
// remove any lingering tooltips
// Remove any lingering tooltips.
$( '#tiptip_holder' ).removeAttr( 'style' );
$( '#tiptip_arrow' ).removeAttr( 'style' );

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
jQuery(function(a){function b(){a("#tiptip_holder").removeAttr("style"),a("#tiptip_arrow").removeAttr("style"),a(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200})}b(),a("#titlediv").find("#title").keyup(function(b){var c=b.keyCode||b.which;return"9"===c&&a("#woocommerce-coupon-description").length>0?(b.stopPropagation(),a("#woocommerce-coupon-description").focus(),!1):void 0}),a(".wc-metaboxes-wrapper").on("click",".wc-metabox > h3",function(){a(this).parent(".wc-metabox").toggleClass("closed").toggleClass("open")}),a(document.body).on("wc-init-tabbed-panels",function(){a("ul.wc-tabs").show(),a("ul.wc-tabs a").click(function(b){b.preventDefault();var c=a(this).closest("div.panel-wrap");a("ul.wc-tabs li",c).removeClass("active"),a(this).parent().addClass("active"),a("div.panel",c).hide(),a(a(this).attr("href")).show()}),a("div.panel-wrap").each(function(){a(this).find("ul.wc-tabs li").eq(0).find("a").click()})}).trigger("wc-init-tabbed-panels"),a(document.body).on("wc-init-datepickers",function(){a(".date-picker-field, .date-picker").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0})}).trigger("wc-init-datepickers"),a(".wc-metaboxes-wrapper").on("click",".wc-metabox h3",function(b){a(b.target).filter(":input, option, .sort").length||a(this).next(".wc-metabox-content").stop().slideToggle()}).on("click",".expand_all",function(){return a(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > .wc-metabox-content").show(),!1}).on("click",".close_all",function(){return a(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > .wc-metabox-content").hide(),!1}),a(".wc-metabox.closed").each(function(){a(this).find(".wc-metabox-content").hide()})});
jQuery(function(a){function b(){a("#tiptip_holder").removeAttr("style"),a("#tiptip_arrow").removeAttr("style"),a(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200})}b(),a("#titlediv").find("#title").keyup(function(b){var c=b.keyCode||b.which;if("9"===c&&a("#woocommerce-coupon-description").length>0)return b.stopPropagation(),a("#woocommerce-coupon-description").focus(),!1}),a(".wc-metaboxes-wrapper").on("click",".wc-metabox > h3",function(){a(this).parent(".wc-metabox").toggleClass("closed").toggleClass("open")}),a(document.body).on("wc-init-tabbed-panels",function(){a("ul.wc-tabs").show(),a("ul.wc-tabs a").click(function(b){b.preventDefault();var c=a(this).closest("div.panel-wrap");a("ul.wc-tabs li",c).removeClass("active"),a(this).parent().addClass("active"),a("div.panel",c).hide(),a(a(this).attr("href")).show()}),a("div.panel-wrap").each(function(){a(this).find("ul.wc-tabs li").eq(0).find("a").click()})}).trigger("wc-init-tabbed-panels"),a(document.body).on("wc-init-datepickers",function(){a(".date-picker-field, .date-picker").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0})}).trigger("wc-init-datepickers"),a(".wc-metaboxes-wrapper").on("click",".wc-metabox h3",function(b){a(b.target).filter(":input, option, .sort").length||a(this).next(".wc-metabox-content").stop().slideToggle()}).on("click",".expand_all",function(){return a(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > .wc-metabox-content").show(),!1}).on("click",".close_all",function(){return a(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > .wc-metabox-content").hide(),!1}),a(".wc-metabox.closed").each(function(){a(this).find(".wc-metabox-content").hide()})});

View File

@ -3,7 +3,7 @@ jQuery(function( $ ) {
function showTooltip( x, y, contents ) {
$( '<div class="chart-tooltip">' + contents + '</div>' ).css( {
top: y - 16,
left: x + 20
left: x + 20
}).appendTo( 'body' ).fadeIn( 200 );
}
@ -142,20 +142,20 @@ jQuery(function( $ ) {
if ( 'table' === export_format ) {
$( this ).closest( 'div' ).find( 'thead tr,tbody tr' ).each( function() {
$( this ).offsetParent().find( 'thead tr,tbody tr' ).each( function() {
$( this ).find( 'th, td' ).each( function() {
var value = $( this ).text();
value = value.replace( '[?]', '' );
value = value.replace( '[?]', '' ).replace( '#', '' );
csv_data += '"' + value + '"' + ',';
});
csv_data = csv_data.substring( 0, csv_data.length - 1 );
csv_data += '\n';
});
$( this ).closest( 'div' ).find( 'tfoot tr' ).each( function() {
$( this ).offsetParent().find( 'tfoot tr' ).each( function() {
$( this ).find( 'th, td' ).each( function() {
var value = $( this ).text();
value = value.replace( '[?]', '' );
value = value.replace( '[?]', '' ).replace( '#', '' );
csv_data += '"' + value + '"' + ',';
if ( $( this ).attr( 'colspan' ) > 0 ) {
for ( i = 1; i < $(this).attr('colspan'); i++ ) {

View File

@ -1 +1 @@
jQuery(function(a){function b(b,c,d){a('<div class="chart-tooltip">'+d+"</div>").css({top:c-16,left:b+20}).appendTo("body").fadeIn(200)}var c=null,d=null;a(".chart-placeholder").bind("plothover",function(e,f,g){if(g){if((c!==g.dataIndex||d!==g.seriesIndex)&&(c=g.dataIndex,d=g.seriesIndex,a(".chart-tooltip").remove(),g.series.points.show||g.series.enable_tooltip)){var h=g.series.data[g.dataIndex][1],i="";g.series.prepend_label&&(i=i+g.series.label+": "),g.series.prepend_tooltip&&(i+=g.series.prepend_tooltip),i+=h,g.series.append_tooltip&&(i+=g.series.append_tooltip),g.series.pie.show?b(f.pageX,f.pageY,i):b(g.pageX,g.pageY,i)}}else a(".chart-tooltip").remove(),c=null}),a(".wc_sparkline.bars").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),bars:{fillColor:a(this).data("color"),fill:!0,show:!0,lineWidth:1,barWidth:a(this).data("barwidth"),align:"center"},shadowSize:0}];a.plot(a(this),d,c)}),a(".wc_sparkline.lines").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),lines:{fill:!1,show:!0,lineWidth:1,align:"center"},shadowSize:0}];a.plot(a(this),d,c)});var e=a(".range_datepicker").datepicker({changeMonth:!0,changeYear:!0,defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,maxDate:"+0D",showButtonPanel:!0,showOn:"focus",buttonImageOnly:!0,onSelect:function(b){var c=a(this).is(".from")?"minDate":"maxDate",d=a(this).data("datepicker"),f=a.datepicker.parseDate(d.settings.dateFormat||a.datepicker._defaults.dateFormat,b,d.settings);e.not(this).datepicker("option",c,f)}}),f=document.createElement("a");"undefined"==typeof f.download&&a(".export_csv").hide(),a(".export_csv").click(function(){var b=a(this).data("exclude_series")||"";b=b.toString(),b=b.split(",");var c,d,e,f=a(this).data("xaxes"),g=a(this).data("groupby"),h=a(this).data("export"),i="data:application/csv;charset=utf-8,";if("table"===h)a(this).closest("div").find("thead tr,tbody tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();b=b.replace("[?]",""),i+='"'+b+'",'}),i=i.substring(0,i.length-1),i+="\n"}),a(this).closest("div").find("tfoot tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();if(b=b.replace("[?]",""),i+='"'+b+'",',a(this).attr("colspan")>0)for(m=1;m<a(this).attr("colspan");m++)i+='"",'}),i=i.substring(0,i.length-1),i+="\n"});else{if(!window.main_chart)return!1;var j=window.main_chart.getData(),k=[];for(i+='"'+f+'",',a.each(j,function(c,d){b&&-1!==a.inArray(c.toString(),b)||k.push(d)}),c=0;c<k.length;++c)i+='"'+k[c].label+'",';i=i.substring(0,i.length-1),i+="\n";var l={};for(c=0;c<k.length;++c)for(d=k[c].data,e=0;e<d.length;++e){l[d[e][0]]=[];for(var m=0;m<k.length;++m)l[d[e][0]].push(0)}for(c=0;c<k.length;++c)for(d=k[c].data,e=0;e<d.length;++e)l[d[e][0]][c]=d[e][1];a.each(l,function(a,b){var c=new Date(parseInt(a,10));i+="day"===g?'"'+c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+"-"+c.getUTCDate()+'",':'"'+c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+'",';for(var d=0;d<b.length;++d){var e=b[d];Math.round(e)!==e&&(e=parseFloat(e),e=e.toFixed(2)),i+='"'+e+'",'}i=i.substring(0,i.length-1),i+="\n"})}return a(this).attr("href",encodeURI(i)),!0})});
jQuery(function(a){function b(b,c,d){a('<div class="chart-tooltip">'+d+"</div>").css({top:c-16,left:b+20}).appendTo("body").fadeIn(200)}var c=null,d=null;a(".chart-placeholder").bind("plothover",function(e,f,g){if(g){if((c!==g.dataIndex||d!==g.seriesIndex)&&(c=g.dataIndex,d=g.seriesIndex,a(".chart-tooltip").remove(),g.series.points.show||g.series.enable_tooltip)){var h=g.series.data[g.dataIndex][1],i="";g.series.prepend_label&&(i=i+g.series.label+": "),g.series.prepend_tooltip&&(i+=g.series.prepend_tooltip),i+=h,g.series.append_tooltip&&(i+=g.series.append_tooltip),g.series.pie.show?b(f.pageX,f.pageY,i):b(g.pageX,g.pageY,i)}}else a(".chart-tooltip").remove(),c=null}),a(".wc_sparkline.bars").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),bars:{fillColor:a(this).data("color"),fill:!0,show:!0,lineWidth:1,barWidth:a(this).data("barwidth"),align:"center"},shadowSize:0}];a.plot(a(this),d,c)}),a(".wc_sparkline.lines").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),lines:{fill:!1,show:!0,lineWidth:1,align:"center"},shadowSize:0}];a.plot(a(this),d,c)});var e=a(".range_datepicker").datepicker({changeMonth:!0,changeYear:!0,defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,maxDate:"+0D",showButtonPanel:!0,showOn:"focus",buttonImageOnly:!0,onSelect:function(b){var c=a(this).is(".from")?"minDate":"maxDate",d=a(this).data("datepicker"),f=a.datepicker.parseDate(d.settings.dateFormat||a.datepicker._defaults.dateFormat,b,d.settings);e.not(this).datepicker("option",c,f)}}),f=document.createElement("a");"undefined"==typeof f.download&&a(".export_csv").hide(),a(".export_csv").click(function(){var b=a(this).data("exclude_series")||"";b=b.toString(),b=b.split(",");var c,d,e,f=a(this).data("xaxes"),g=a(this).data("groupby"),h=a(this).data("export"),i="data:application/csv;charset=utf-8,";if("table"===h)a(this).offsetParent().find("thead tr,tbody tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();b=b.replace("[?]","").replace("#",""),i+='"'+b+'",'}),i=i.substring(0,i.length-1),i+="\n"}),a(this).offsetParent().find("tfoot tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();if(b=b.replace("[?]","").replace("#",""),i+='"'+b+'",',a(this).attr("colspan")>0)for(m=1;m<a(this).attr("colspan");m++)i+='"",'}),i=i.substring(0,i.length-1),i+="\n"});else{if(!window.main_chart)return!1;var j=window.main_chart.getData(),k=[];for(i+='"'+f+'",',a.each(j,function(c,d){b&&a.inArray(c.toString(),b)!==-1||k.push(d)}),c=0;c<k.length;++c)i+='"'+k[c].label+'",';i=i.substring(0,i.length-1),i+="\n";var l={};for(c=0;c<k.length;++c)for(d=k[c].data,e=0;e<d.length;++e){l[d[e][0]]=[];for(var m=0;m<k.length;++m)l[d[e][0]].push(0)}for(c=0;c<k.length;++c)for(d=k[c].data,e=0;e<d.length;++e)l[d[e][0]][c]=d[e][1];a.each(l,function(a,b){var c=new Date(parseInt(a,10));i+="day"===g?'"'+c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+"-"+c.getUTCDate()+'",':'"'+c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+'",';for(var d=0;d<b.length;++d){var e=b[d];Math.round(e)!==e&&(e=parseFloat(e),e=e.toFixed(2)),i+='"'+e+'",'}i=i.substring(0,i.length-1),i+="\n"})}return a(this).attr("href",encodeURI(i)),!0})});

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
!function(a,b,c,d){a(function(){var e=a(".wc-shipping-class-rows"),f=a(".wc-shipping-class-save"),g=c.template("wc-shipping-class-row"),h=c.template("wc-shipping-class-row-blank"),i=Backbone.Model.extend({changes:{},logChanges:function(a){var b=this.changes||{};_.each(a,function(a,c){b[c]=_.extend(b[c]||{term_id:c},a)}),this.changes=b,this.trigger("change:classes")},save:function(){_.size(this.changes)?a.post(d+(d.indexOf("?")>0?"&":"?")+"action=woocommerce_shipping_classes_save_changes",{wc_shipping_classes_nonce:b.wc_shipping_classes_nonce,changes:this.changes},this.onSaveResponse,"json"):k.trigger("saved:classes")},discardChanges:function(a){var b=this.changes||{};delete b[a],0===_.size(this.changes)&&l.clearUnloadConfirmation()},onSaveResponse:function(a,c){"success"===c&&(a.success?(k.set("classes",a.data.shipping_classes),k.trigger("change:classes"),k.changes={},k.trigger("saved:classes")):a.data?window.alert(a.data):window.alert(b.strings.save_failed)),l.unblock()}}),j=Backbone.View.extend({rowTemplate:g,initialize:function(){this.listenTo(this.model,"change:classes",this.setUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.clearUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.render),e.on("change",{view:this},this.updateModelOnChange),a(window).on("beforeunload",{view:this},this.unloadConfirmation),f.on("click",{view:this},this.onSubmit),a(document.body).on("click",".wc-shipping-class-add",{view:this},this.onAddNewRow),a(document.body).on("click",".wc-shipping-class-save-changes",{view:this},this.onSubmit)},block:function(){a(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){a(this.el).unblock()},render:function(){var b=_.indexBy(this.model.get("classes"),"term_id"),c=this;this.$el.empty(),this.unblock(),_.size(b)?(b=_.sortBy(b,function(a){return a.name}),a.each(b,function(a,b){c.renderRow(b)})):c.$el.append(h)},renderRow:function(a){var b=this;b.$el.append(b.rowTemplate(a)),b.initRow(a)},initRow:function(b){var c=this,d=c.$el.find('tr[data-id="'+b.term_id+'"]');d.find("select").each(function(){var c=a(this).data("attribute");a(this).find('option[value="'+b[c]+'"]').prop("selected",!0)}),d.find(".view").show(),d.find(".edit").hide(),d.find(".wc-shipping-class-edit").on("click",{view:this},this.onEditRow),d.find(".wc-shipping-class-delete").on("click",{view:this},this.onDeleteRow),d.find(".editing .wc-shipping-class-edit").trigger("click"),d.find(".wc-shipping-class-cancel-edit").on("click",{view:this},this.onCancelEditRow),!0===b.editing&&(d.addClass("editing"),d.find(".wc-shipping-class-edit").trigger("click"))},onSubmit:function(a){a.data.view.block(),a.data.view.model.save(),a.preventDefault()},onAddNewRow:function(c){c.preventDefault();var d=c.data.view,e=d.model,f=_.indexBy(e.get("classes"),"term_id"),g={},h=_.size(f),i=_.extend({},b.default_class,{term_id:"new-"+h+"-"+Date.now(),editing:!0,newRow:!0});g[i.term_id]=i,e.logChanges(g),d.renderRow(i),a(".wc-shipping-classes-blank-state").remove()},onEditRow:function(b){b.preventDefault(),a(this).closest("tr").addClass("editing"),a(this).closest("tr").find(".view").hide(),a(this).closest("tr").find(".edit").show(),b.data.view.model.trigger("change:classes")},onDeleteRow:function(b){var c=b.data.view,d=c.model,e=_.indexBy(d.get("classes"),"term_id"),f={},g=a(this).closest("tr").data("id");b.preventDefault(),e[g]&&(delete e[g],f[g]=_.extend(f[g]||{},{deleted:"deleted"}),d.set("classes",e),d.logChanges(f)),c.render()},onCancelEditRow:function(b){var c=b.data.view,d=c.model,e=a(this).closest("tr"),f=a(this).closest("tr").data("id"),g=_.indexBy(d.get("classes"),"term_id");b.preventDefault(),d.discardChanges(f),g[f]&&(g[f].editing=!1,e.after(c.rowTemplate(g[f])),c.initRow(g[f])),e.remove()},setUnloadConfirmation:function(){this.needsUnloadConfirm=!0,f.removeAttr("disabled")},clearUnloadConfirmation:function(){this.needsUnloadConfirm=!1,f.attr("disabled","disabled")},unloadConfirmation:function(a){return a.data.view.needsUnloadConfirm?(a.returnValue=b.strings.unload_confirmation_msg,window.event.returnValue=b.strings.unload_confirmation_msg,b.strings.unload_confirmation_msg):void 0},updateModelOnChange:function(b){var c=b.data.view.model,d=a(b.target),e=d.closest("tr").data("id"),f=d.data("attribute"),g=d.val(),h=_.indexBy(c.get("classes"),"term_id"),i={};h[e]&&h[e][f]===g||(i[e]={},i[e][f]=g),c.logChanges(i)}}),k=new i({classes:b.classes}),l=new j({model:k,el:e});l.render()})}(jQuery,shippingClassesLocalizeScript,wp,ajaxurl);
!function(a,b,c,d){a(function(){var e=a(".wc-shipping-class-rows"),f=a(".wc-shipping-class-save"),g=c.template("wc-shipping-class-row"),h=c.template("wc-shipping-class-row-blank"),i=Backbone.Model.extend({changes:{},logChanges:function(a){var b=this.changes||{};_.each(a,function(a,c){b[c]=_.extend(b[c]||{term_id:c},a)}),this.changes=b,this.trigger("change:classes")},save:function(){_.size(this.changes)?a.post(d+(d.indexOf("?")>0?"&":"?")+"action=woocommerce_shipping_classes_save_changes",{wc_shipping_classes_nonce:b.wc_shipping_classes_nonce,changes:this.changes},this.onSaveResponse,"json"):k.trigger("saved:classes")},discardChanges:function(a){var b=this.changes||{};delete b[a],0===_.size(this.changes)&&l.clearUnloadConfirmation()},onSaveResponse:function(a,c){"success"===c&&(a.success?(k.set("classes",a.data.shipping_classes),k.trigger("change:classes"),k.changes={},k.trigger("saved:classes")):a.data?window.alert(a.data):window.alert(b.strings.save_failed)),l.unblock()}}),j=Backbone.View.extend({rowTemplate:g,initialize:function(){this.listenTo(this.model,"change:classes",this.setUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.clearUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.render),e.on("change",{view:this},this.updateModelOnChange),a(window).on("beforeunload",{view:this},this.unloadConfirmation),f.on("click",{view:this},this.onSubmit),a(document.body).on("click",".wc-shipping-class-add",{view:this},this.onAddNewRow),a(document.body).on("click",".wc-shipping-class-save-changes",{view:this},this.onSubmit)},block:function(){a(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){a(this.el).unblock()},render:function(){var b=_.indexBy(this.model.get("classes"),"term_id"),c=this;this.$el.empty(),this.unblock(),_.size(b)?(b=_.sortBy(b,function(a){return a.name}),a.each(b,function(a,b){c.renderRow(b)})):c.$el.append(h)},renderRow:function(a){var b=this;b.$el.append(b.rowTemplate(a)),b.initRow(a)},initRow:function(b){var c=this,d=c.$el.find('tr[data-id="'+b.term_id+'"]');d.find("select").each(function(){var c=a(this).data("attribute");a(this).find('option[value="'+b[c]+'"]').prop("selected",!0)}),d.find(".view").show(),d.find(".edit").hide(),d.find(".wc-shipping-class-edit").on("click",{view:this},this.onEditRow),d.find(".wc-shipping-class-delete").on("click",{view:this},this.onDeleteRow),d.find(".editing .wc-shipping-class-edit").trigger("click"),d.find(".wc-shipping-class-cancel-edit").on("click",{view:this},this.onCancelEditRow),!0===b.editing&&(d.addClass("editing"),d.find(".wc-shipping-class-edit").trigger("click"))},onSubmit:function(a){a.data.view.block(),a.data.view.model.save(),a.preventDefault()},onAddNewRow:function(c){c.preventDefault();var d=c.data.view,e=d.model,f=_.indexBy(e.get("classes"),"term_id"),g={},h=_.size(f),i=_.extend({},b.default_class,{term_id:"new-"+h+"-"+Date.now(),editing:!0,newRow:!0});g[i.term_id]=i,e.logChanges(g),d.renderRow(i),a(".wc-shipping-classes-blank-state").remove()},onEditRow:function(b){b.preventDefault(),a(this).closest("tr").addClass("editing"),a(this).closest("tr").find(".view").hide(),a(this).closest("tr").find(".edit").show(),b.data.view.model.trigger("change:classes")},onDeleteRow:function(b){var c=b.data.view,d=c.model,e=_.indexBy(d.get("classes"),"term_id"),f={},g=a(this).closest("tr").data("id");b.preventDefault(),e[g]&&(delete e[g],f[g]=_.extend(f[g]||{},{deleted:"deleted"}),d.set("classes",e),d.logChanges(f)),c.render()},onCancelEditRow:function(b){var c=b.data.view,d=c.model,e=a(this).closest("tr"),f=a(this).closest("tr").data("id"),g=_.indexBy(d.get("classes"),"term_id");b.preventDefault(),d.discardChanges(f),g[f]&&(g[f].editing=!1,e.after(c.rowTemplate(g[f])),c.initRow(g[f])),e.remove()},setUnloadConfirmation:function(){this.needsUnloadConfirm=!0,f.removeAttr("disabled")},clearUnloadConfirmation:function(){this.needsUnloadConfirm=!1,f.attr("disabled","disabled")},unloadConfirmation:function(a){if(a.data.view.needsUnloadConfirm)return a.returnValue=b.strings.unload_confirmation_msg,window.event.returnValue=b.strings.unload_confirmation_msg,b.strings.unload_confirmation_msg},updateModelOnChange:function(b){var c=b.data.view.model,d=a(b.target),e=d.closest("tr").data("id"),f=d.data("attribute"),g=d.val(),h=_.indexBy(c.get("classes"),"term_id"),i={};h[e]&&h[e][f]===g||(i[e]={},i[e][f]=g),c.logChanges(i)}}),k=new i({classes:b.classes}),l=new j({model:k,el:e});l.render()})}(jQuery,shippingClassesLocalizeScript,wp,ajaxurl);

File diff suppressed because one or more lines are too long

View File

@ -209,17 +209,21 @@
$method_list.find( '.wc-shipping-zone-method' ).remove();
if ( _.size( shipping_methods ) ) {
_.each( shipping_methods, function( shipping_method, instance_id ) {
shipping_methods = _.sortBy( shipping_methods, function( method ) {
return parseInt( method.method_order, 10 );
} );
_.each( shipping_methods, function( shipping_method ) {
var class_name = 'method_disabled';
if ( 'yes' === shipping_method.enabled ) {
class_name = 'method_enabled';
}
$method_list.prepend( '<li class="wc-shipping-zone-method"><a href="admin.php?page=wc-settings&amp;tab=shipping&amp;instance_id=' + instance_id + '" class="' + class_name + '">' + shipping_method.title + '</a></li>' );
$method_list.append( '<li class="wc-shipping-zone-method"><a href="admin.php?page=wc-settings&amp;tab=shipping&amp;instance_id=' + shipping_method.instance_id + '" class="' + class_name + '">' + shipping_method.title + '</a></li>' );
} );
} else {
$method_list.prepend( '<li class="wc-shipping-zone-method">' + data.strings.no_shipping_methods_offered + '</li>' );
$method_list.append( '<li class="wc-shipping-zone-method">' + data.strings.no_shipping_methods_offered + '</li>' );
}
},
onSubmit: function( event ) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
jQuery(function(a){return"undefined"==typeof woocommerce_params?!1:(a("#add_payment_method").on("click init_add_payment_method",".payment_methods input.input-radio",function(){if(a(".payment_methods input.input-radio").length>1){var b=a("div.payment_box."+a(this).attr("ID"));a(this).is(":checked")&&!b.is(":visible")&&(a("div.payment_box").filter(":visible").slideUp(250),a(this).is(":checked")&&a("div.payment_box."+a(this).attr("ID")).slideDown(250))}else a("div.payment_box").show()}).find("input[name=payment_method]:checked").click(),a("#add_payment_method").submit(function(){a("#add_payment_method").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}),void a(document.body).trigger("init_add_payment_method"))});
jQuery(function(a){return"undefined"!=typeof woocommerce_params&&(a("#add_payment_method").on("click init_add_payment_method",".payment_methods input.input-radio",function(){if(a(".payment_methods input.input-radio").length>1){var b=a("div.payment_box."+a(this).attr("ID"));a(this).is(":checked")&&!b.is(":visible")&&(a("div.payment_box").filter(":visible").slideUp(250),a(this).is(":checked")&&a("div.payment_box."+a(this).attr("ID")).slideDown(250))}else a("div.payment_box").show()}).find("input[name=payment_method]:checked").click(),a("#add_payment_method").submit(function(){a("#add_payment_method").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}),void a(document.body).trigger("init_add_payment_method"))});

View File

@ -104,27 +104,29 @@
$form.find( '.variations select' ).each( function() {
var attribute_name = $( this ).data( 'attribute_name' ) || $( this ).attr( 'name' );
var value = $( this ).val() || '';
if ( $( this ).val().length === 0 ) {
if ( value.length === 0 ) {
all_attributes_chosen = false;
} else {
some_attributes_chosen = true;
}
data[ attribute_name ] = $( this ).val();
data[ attribute_name ] = value;
});
if ( all_attributes_chosen ) {
// Get a matchihng variation via ajax
data.product_id = $product_id;
data.product_id = $product_id;
data.custom_data = $form.data( 'custom_data' );
$( '.variations_form' ).block({
$form.block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
} );
$xhr = $.ajax( {
url: wc_cart_fragments_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_variation' ),
@ -140,7 +142,7 @@
}
},
complete: function() {
$( '.variations_form' ).unblock();
$form.unblock();
}
} );
} else {
@ -265,8 +267,9 @@
$form.find( '.variations select' ).each( function() {
var attribute_name = $( this ).data( 'attribute_name' ) || $( this ).attr( 'name' );
var value = $( this ).val() || '';
if ( $( this ).val().length === 0 ) {
if ( value.length === 0 ) {
all_attributes_chosen = false;
} else {
some_attributes_chosen = true;
@ -277,7 +280,7 @@
current_settings[ attribute_name ] = '';
} else {
// Add to settings array
current_settings[ attribute_name ] = $( this ).val();
current_settings[ attribute_name ] = value;
}
});

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*!
* WooCommerce Add to Cart JS
*/
jQuery(function(a){return"undefined"==typeof wc_add_to_cart_params?!1:void a(document).on("click",".add_to_cart_button",function(){var b=a(this);if(b.is(".ajax_add_to_cart")){if(!b.attr("data-product_id"))return!0;b.removeClass("added"),b.addClass("loading");var c={};return a.each(b.data(),function(a,b){c[a]=b}),a(document.body).trigger("adding_to_cart",[b,c]),a.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),c,function(c){if(c){var d=window.location.toString();if(d=d.replace("add-to-cart","added-to-cart"),c.error&&c.product_url)return void(window.location=c.product_url);if("yes"===wc_add_to_cart_params.cart_redirect_after_add)return void(window.location=wc_add_to_cart_params.cart_url);b.removeClass("loading");var e=c.fragments,f=c.cart_hash;e&&a.each(e,function(b){a(b).addClass("updating")}),a(".shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}}),b.addClass("added"),wc_add_to_cart_params.is_cart||0!==b.parent().find(".added_to_cart").length||b.after(' <a href="'+wc_add_to_cart_params.cart_url+'" class="added_to_cart wc-forward" title="'+wc_add_to_cart_params.i18n_view_cart+'">'+wc_add_to_cart_params.i18n_view_cart+"</a>"),e&&a.each(e,function(b,c){a(b).replaceWith(c)}),a(".widget_shopping_cart, .updating").stop(!0).css("opacity","1").unblock(),a(".shop_table.cart").load(d+" .shop_table.cart:eq(0) > *",function(){a(".shop_table.cart").stop(!0).css("opacity","1").unblock(),a(document.body).trigger("cart_page_refreshed")}),a(".cart_totals").load(d+" .cart_totals:eq(0) > *",function(){a(".cart_totals").stop(!0).css("opacity","1").unblock()}),a(document.body).trigger("added_to_cart",[e,f,b])}}),!1}return!0})});
jQuery(function(a){return"undefined"!=typeof wc_add_to_cart_params&&void a(document).on("click",".add_to_cart_button",function(){var b=a(this);if(b.is(".ajax_add_to_cart")){if(!b.attr("data-product_id"))return!0;b.removeClass("added"),b.addClass("loading");var c={};return a.each(b.data(),function(a,b){c[a]=b}),a(document.body).trigger("adding_to_cart",[b,c]),a.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),c,function(c){if(c){var d=window.location.toString();if(d=d.replace("add-to-cart","added-to-cart"),c.error&&c.product_url)return void(window.location=c.product_url);if("yes"===wc_add_to_cart_params.cart_redirect_after_add)return void(window.location=wc_add_to_cart_params.cart_url);b.removeClass("loading");var e=c.fragments,f=c.cart_hash;e&&a.each(e,function(b){a(b).addClass("updating")}),a(".shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}}),b.addClass("added"),wc_add_to_cart_params.is_cart||0!==b.parent().find(".added_to_cart").length||b.after(' <a href="'+wc_add_to_cart_params.cart_url+'" class="added_to_cart wc-forward" title="'+wc_add_to_cart_params.i18n_view_cart+'">'+wc_add_to_cart_params.i18n_view_cart+"</a>"),e&&a.each(e,function(b,c){a(b).replaceWith(c)}),a(".widget_shopping_cart, .updating").stop(!0).css("opacity","1").unblock(),a(".shop_table.cart").load(d+" .shop_table.cart:eq(0) > *",function(){a(".shop_table.cart").stop(!0).css("opacity","1").unblock(),a(document.body).trigger("cart_page_refreshed")}),a(".cart_totals").load(d+" .cart_totals:eq(0) > *",function(){a(".cart_totals").stop(!0).css("opacity","1").unblock()}),a(document.body).trigger("added_to_cart",[e,f,b])}}),!1}return!0})});

View File

@ -1 +1 @@
jQuery(function(a){function b(){e&&sessionStorage.setItem("wc_cart_created",(new Date).getTime())}function c(a){e&&(localStorage.setItem(f,a),sessionStorage.setItem(f,a))}function d(){a.ajax(h)}if("undefined"==typeof wc_cart_fragments_params)return!1;var e,f=wc_cart_fragments_params.ajax_url.toString()+"-wc_cart_hash";try{e="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc"),window.localStorage.setItem("wc","test"),window.localStorage.removeItem("wc")}catch(g){e=!1}var h={url:wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%","get_refreshed_fragments"),type:"POST",success:function(d){d&&d.fragments&&(a.each(d.fragments,function(b,c){a(b).replaceWith(c)}),e&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(d.fragments)),c(d.cart_hash),d.cart_hash&&b()),a(document.body).trigger("wc_fragments_refreshed"))}};if(e){var i=null,j=864e5;a(document.body).bind("wc_fragment_refresh updated_wc_div",function(){d()}),a(document.body).bind("added_to_cart",function(a,d,e){var g=sessionStorage.getItem(f);null!==g&&void 0!==g&&""!==g||b(),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(d)),c(e)}),a(document.body).bind("wc_fragments_refreshed",function(){clearTimeout(i),i=setTimeout(d,j)}),a(window).on("storage onstorage",function(a){f===a.originalEvent.key&&localStorage.getItem(f)!==sessionStorage.getItem(f)&&d()});try{var k=a.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),l=sessionStorage.getItem(f),m=a.cookie("woocommerce_cart_hash"),n=sessionStorage.getItem("wc_cart_created");if(null!==l&&void 0!==l&&""!==l||(l=""),null!==m&&void 0!==m&&""!==m||(m=""),l&&(null===n||void 0===n||""===n))throw"No cart_created";if(n){var o=1*n+j,p=(new Date).getTime();if(p>o)throw"Fragment expired";i=setTimeout(d,o-p)}if(!k||!k["div.widget_shopping_cart_content"]||l!==m)throw"No fragment";a.each(k,function(b,c){a(b).replaceWith(c)}),a(document.body).trigger("wc_fragments_loaded")}catch(g){d()}}else d();a.cookie("woocommerce_items_in_cart")>0?a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),a(document.body).bind("adding_to_cart",function(){a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})});
jQuery(function(a){function b(){e&&sessionStorage.setItem("wc_cart_created",(new Date).getTime())}function c(a){e&&(localStorage.setItem(f,a),sessionStorage.setItem(f,a))}function d(){a.ajax(h)}if("undefined"==typeof wc_cart_fragments_params)return!1;var e,f=wc_cart_fragments_params.ajax_url.toString()+"-wc_cart_hash";try{e="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc"),window.localStorage.setItem("wc","test"),window.localStorage.removeItem("wc")}catch(g){e=!1}var h={url:wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%","get_refreshed_fragments"),type:"POST",success:function(d){d&&d.fragments&&(a.each(d.fragments,function(b,c){a(b).replaceWith(c)}),e&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(d.fragments)),c(d.cart_hash),d.cart_hash&&b()),a(document.body).trigger("wc_fragments_refreshed"))}};if(e){var i=null,j=864e5;a(document.body).bind("wc_fragment_refresh updated_wc_div",function(){d()}),a(document.body).bind("added_to_cart",function(a,d,e){var g=sessionStorage.getItem(f);null!==g&&void 0!==g&&""!==g||b(),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(d)),c(e)}),a(document.body).bind("wc_fragments_refreshed",function(){clearTimeout(i),i=setTimeout(d,j)}),a(window).on("storage onstorage",function(a){f===a.originalEvent.key&&localStorage.getItem(f)!==sessionStorage.getItem(f)&&d()});try{var k=a.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),l=sessionStorage.getItem(f),m=a.cookie("woocommerce_cart_hash"),n=sessionStorage.getItem("wc_cart_created");if(null!==l&&void 0!==l&&""!==l||(l=""),null!==m&&void 0!==m&&""!==m||(m=""),l&&(null===n||void 0===n||""===n))throw"No cart_created";if(n){var o=1*n+j,p=(new Date).getTime();if(o<p)throw"Fragment expired";i=setTimeout(d,o-p)}if(!k||!k["div.widget_shopping_cart_content"]||l!==m)throw"No fragment";a.each(k,function(b,c){a(b).replaceWith(c)}),a(document.body).trigger("wc_fragments_loaded")}catch(g){d()}}else d();a.cookie("woocommerce_items_in_cart")>0?a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),a(document.body).bind("adding_to_cart",function(){a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})});

View File

@ -28,7 +28,7 @@ jQuery( function( $ ) {
* @return {bool} True if the DOM Element is UI Blocked, false if not.
*/
var is_blocked = function( $node ) {
return $node.is( '.processing' );
return $node.is( '.processing' ) || $node.parents( '.processing' ).length;
};
/**
@ -37,13 +37,15 @@ jQuery( function( $ ) {
* @param {JQuery Object} $node
*/
var block = function( $node ) {
$node.addClass( 'processing' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
if ( ! is_blocked( $node ) ) {
$node.addClass( 'processing' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
}
};
/**
@ -62,7 +64,7 @@ jQuery( function( $ ) {
*/
var update_wc_div = function( html_str ) {
var $html = $.parseHTML( html_str );
var $new_form = $( 'table.shop_table.cart', $html ).closest( 'form' );
var $new_form = $( '.shop_table.cart', $html ).closest( 'form' );
var $new_totals = $( '.cart_totals', $html );
// Error message collection
@ -73,18 +75,30 @@ jQuery( function( $ ) {
$( '.woocommerce-error, .woocommerce-message' ).remove();
if ( $new_form.length === 0 ) {
// If the checkout is also displayed on this page, trigger reload instead.
if ( $( '.woocommerce-checkout' ).length ) {
window.location.reload();
return;
}
// No items to display now! Replace all cart content.
var $cart_html = $( '.cart-empty', $html ).closest( '.woocommerce' );
$( 'table.shop_table.cart' ).closest( '.woocommerce' ).replaceWith( $cart_html );
$( '.shop_table.cart' ).closest( '.woocommerce' ).replaceWith( $cart_html );
// Display errors
if ( $error.length > 0 ) {
show_notice( $error, $( '.cart-empty' ).closest( '.woocommerce' ) );
} else if ( $message.length > 0 ) {
show_notice( $message, $( '.cart-empty' ).closest( '.woocommerce' ) );
}
} else {
$( 'table.shop_table.cart' ).closest( 'form' ).replaceWith( $new_form );
$( 'table.shop_table.cart' ).closest( 'form' ).find( 'input[name="update_cart"]' ).prop( 'disabled', true );
// If the checkout is also displayed on this page, trigger update event.
if ( $( '.woocommerce-checkout' ).length ) {
$( document.body ).trigger( 'update_checkout' );
}
$( '.shop_table.cart' ).closest( 'form' ).replaceWith( $new_form );
$( '.shop_table.cart' ).closest( 'form' ).find( 'input[name="update_cart"]' ).prop( 'disabled', true );
if ( $error.length > 0 ) {
show_notice( $error );
@ -115,7 +129,7 @@ jQuery( function( $ ) {
*/
var show_notice = function( html_element, $target ) {
if ( ! $target ) {
$target = $( 'table.shop_table.cart' ).closest( 'form' );
$target = $( '.shop_table.cart' ).closest( 'form' );
}
$( '.woocommerce-error, .woocommerce-message' ).remove();
$target.before( html_element );
@ -209,8 +223,8 @@ jQuery( function( $ ) {
var $form = $( evt.currentTarget );
block( $form );
block( $( 'div.cart_totals' ) );
block( $form );
// Provide the submit button value because wc-form-handler expects it.
$( '<input />' ).attr( 'type', 'hidden' )
@ -261,7 +275,7 @@ jQuery( function( $ ) {
this.submit_click );
$( document ).on(
'submit',
'div.woocommerce > form',
'div.woocommerce:not(.widget_product_search) > form',
this.cart_submit );
$( document ).on(
'click',
@ -290,7 +304,7 @@ jQuery( function( $ ) {
* Update entire cart via ajax.
*/
update_cart: function() {
var $form = $( 'table.shop_table.cart' ).closest( 'form' );
var $form = $( '.shop_table.cart' ).closest( 'form' );
block( $form );
block( $( 'div.cart_totals' ) );
@ -339,9 +353,10 @@ jQuery( function( $ ) {
var $submit = $( document.activeElement );
var $clicked = $( 'input[type=submit][clicked=true]' );
if ( 0 === $form.find( 'table.shop_table.cart' ).length ) {
return false;
if ( 0 === $form.find( '.shop_table.cart' ).length ) {
return;
}
if ( is_blocked( $form ) ) {
return false;
}

File diff suppressed because one or more lines are too long

View File

@ -29,7 +29,7 @@ jQuery( function( $ ) {
this.$checkout_form.on( 'submit', this.submit );
// Inline validation
this.$checkout_form.on( 'blur change', '.input-text, select', this.validate_field );
this.$checkout_form.on( 'blur change', '.input-text, select, input:checkbox', this.validate_field );
// Manual trigger
this.$checkout_form.on( 'update', this.trigger_update_checkout );
@ -55,7 +55,7 @@ jQuery( function( $ ) {
$( 'input#createaccount' ).change( this.toggle_create_account ).change();
}
},
init_payment_methods: function() {
init_payment_methods: function( selectedPaymentMethod ) {
var $payment_methods = $( '.woocommerce-checkout' ).find( 'input[name="payment_method"]' );
// If there is one method, we can hide the radio input
@ -63,6 +63,11 @@ jQuery( function( $ ) {
$payment_methods.eq(0).hide();
}
// If there was a previously selected method, check that one.
if ( selectedPaymentMethod ) {
$( '#' + selectedPaymentMethod ).prop( 'checked', true );
}
// If there are none selected, select the first.
if ( 0 === $payment_methods.filter( ':checked' ).length ) {
$payment_methods.eq(0).prop( 'checked', true );
@ -271,12 +276,18 @@ jQuery( function( $ ) {
url: wc_checkout_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'update_order_review' ),
data: data,
success: function( data ) {
var selectedPaymentMethod = $( '.woocommerce-checkout input[name="payment_method"]:checked' ).attr( 'id' );
// Reload the page if requested
if ( 'true' === data.reload ) {
window.location.reload();
return;
}
// Remove any notices added previously
$( '.woocommerce-NoticeGroup-updateOrderReview' ).remove();
var termsCheckBoxChecked = $( '#terms' ).prop( 'checked' );
// Always update the fragments
@ -297,17 +308,18 @@ jQuery( function( $ ) {
var $form = $( 'form.checkout' );
// Remove notices from all sources
$( '.woocommerce-error, .woocommerce-message' ).remove();
// Add new errors
// Add new errors returned by this event
if ( data.messages ) {
$form.prepend( data.messages );
$form.prepend( '<div class="woocommerce-NoticeGroup-updateOrderReview">' + data.messages + '</div>' );
} else {
$form.prepend( data );
}
// Lose focus for all fields
$form.find( '.input-text, select' ).blur();
$form.find( '.input-text, select, input:checkbox' ).blur();
// Scroll to top
$( 'html, body' ).animate( {
@ -317,7 +329,7 @@ jQuery( function( $ ) {
}
// Re-init methods
wc_checkout_form.init_payment_methods();
wc_checkout_form.init_payment_methods( selectedPaymentMethod );
// Fire updated_checkout e
$( document.body ).trigger( 'updated_checkout' );
@ -436,7 +448,7 @@ jQuery( function( $ ) {
$( '.woocommerce-error, .woocommerce-message' ).remove();
wc_checkout_form.$checkout_form.prepend( error_message );
wc_checkout_form.$checkout_form.removeClass( 'processing' ).unblock();
wc_checkout_form.$checkout_form.find( '.input-text, select' ).blur();
wc_checkout_form.$checkout_form.find( '.input-text, select, input:checkbox' ).blur();
$( 'html, body' ).animate({
scrollTop: ( $( 'form.checkout' ).offset().top - 100 )
}, 1000 );

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
jQuery(function(a){return"undefined"==typeof wc_single_product_params?!1:(a("body").on("init",".wc-tabs-wrapper, .woocommerce-tabs",function(){a(".wc-tab, .woocommerce-tabs .panel:not(.panel .panel)").hide();var b=window.location.hash,c=window.location.href,d=a(this).find(".wc-tabs, ul.tabs").first();b.toLowerCase().indexOf("comment-")>=0||"#reviews"===b||"#tab-reviews"===b?d.find("li.reviews_tab a").click():c.indexOf("comment-page-")>0||c.indexOf("cpage=")>0?d.find("li.reviews_tab a").click():d.find("li:first a").click()}).on("click",".wc-tabs li a, ul.tabs li a",function(b){b.preventDefault();var c=a(this),d=c.closest(".wc-tabs-wrapper, .woocommerce-tabs"),e=d.find(".wc-tabs, ul.tabs");e.find("li").removeClass("active"),d.find(".wc-tab, .panel:not(.panel .panel)").hide(),c.closest("li").addClass("active"),d.find(c.attr("href")).show()}).on("click","a.woocommerce-review-link",function(){return a(".reviews_tab a").click(),!0}).on("init","#rating",function(){a("#rating").hide().before('<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>')}).on("click","#respond p.stars a",function(){var b=a(this),c=a(this).closest("#respond").find("#rating"),d=a(this).closest(".stars");return c.val(b.text()),b.siblings("a").removeClass("active"),b.addClass("active"),d.addClass("selected"),!1}).on("click","#respond #submit",function(){var b=a(this).closest("#respond").find("#rating"),c=b.val();return b.length>0&&!c&&"yes"===wc_single_product_params.review_rating_required?(window.alert(wc_single_product_params.i18n_required_rating_text),!1):void 0}),void a(".wc-tabs-wrapper, .woocommerce-tabs, #rating").trigger("init"))});
jQuery(function(a){return"undefined"!=typeof wc_single_product_params&&(a("body").on("init",".wc-tabs-wrapper, .woocommerce-tabs",function(){a(".wc-tab, .woocommerce-tabs .panel:not(.panel .panel)").hide();var b=window.location.hash,c=window.location.href,d=a(this).find(".wc-tabs, ul.tabs").first();b.toLowerCase().indexOf("comment-")>=0||"#reviews"===b||"#tab-reviews"===b?d.find("li.reviews_tab a").click():c.indexOf("comment-page-")>0||c.indexOf("cpage=")>0?d.find("li.reviews_tab a").click():d.find("li:first a").click()}).on("click",".wc-tabs li a, ul.tabs li a",function(b){b.preventDefault();var c=a(this),d=c.closest(".wc-tabs-wrapper, .woocommerce-tabs"),e=d.find(".wc-tabs, ul.tabs");e.find("li").removeClass("active"),d.find(".wc-tab, .panel:not(.panel .panel)").hide(),c.closest("li").addClass("active"),d.find(c.attr("href")).show()}).on("click","a.woocommerce-review-link",function(){return a(".reviews_tab a").click(),!0}).on("init","#rating",function(){a("#rating").hide().before('<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>')}).on("click","#respond p.stars a",function(){var b=a(this),c=a(this).closest("#respond").find("#rating"),d=a(this).closest(".stars");return c.val(b.text()),b.siblings("a").removeClass("active"),b.addClass("active"),d.addClass("selected"),!1}).on("click","#respond #submit",function(){var b=a(this).closest("#respond").find("#rating"),c=b.val();if(b.length>0&&!c&&"yes"===wc_single_product_params.review_rating_required)return window.alert(wc_single_product_params.i18n_required_rating_text),!1}),void a(".wc-tabs-wrapper, .woocommerce-tabs, #rating").trigger("init"))});

View File

@ -37,6 +37,13 @@
// Trigger change event
$( ':input.woocommerce-SavedPaymentMethods-tokenInput:checked', $target ).trigger( 'change' );
// Hide "save card" if "Create Account" is not checked.
// Check that the field is shown in the form - some plugins and force create account remove it
if ( $( 'input#createaccount' ).length && ! $('input#createaccount').is( ':checked' ) ) {
$wcTokenizationForm.hideSaveNewCheckbox();
}
};
this.hideForm = function() {

View File

@ -1 +1 @@
!function(a){a(function(){var b=function(){function b(b){var c=a(b),d=c.closest(".payment_box"),e=this;this.onTokenChange=function(){"new"===a(this).val()?(e.showForm(),e.showSaveNewCheckbox()):(e.hideForm(),e.hideSaveNewCheckbox())},this.onCreateAccountChange=function(){a(this).is(":checked")?e.showSaveNewCheckbox():e.hideSaveNewCheckbox()},this.onDisplay=function(){0===a(":input.woocommerce-SavedPaymentMethods-tokenInput:checked",c).length&&a(":input.woocommerce-SavedPaymentMethods-tokenInput:last",c).prop("checked",!0),0===c.data("count")&&a(".woocommerce-SavedPaymentMethods-new",c).hide(),a(":input.woocommerce-SavedPaymentMethods-tokenInput:checked",c).trigger("change")},this.hideForm=function(){a(".wc-payment-form",d).hide()},this.showForm=function(){a(".wc-payment-form",d).show()},this.showSaveNewCheckbox=function(){a(".woocommerce-SavedPaymentMethods-saveNew",d).show()},this.hideSaveNewCheckbox=function(){a(".woocommerce-SavedPaymentMethods-saveNew",d).hide()},a(":input.woocommerce-SavedPaymentMethods-tokenInput",c).change(this.onTokenChange),a("input#createaccount").change(this.onCreateAccountChange),this.onDisplay()}return b}();a(document.body).on("updated_checkout",function(){var c=a("ul.woocommerce-SavedPaymentMethods");c.each(function(){new b(this)})})})}(jQuery);
!function(a){a(function(){var b=function(){function b(b){var c=a(b),d=c.closest(".payment_box"),e=this;this.onTokenChange=function(){"new"===a(this).val()?(e.showForm(),e.showSaveNewCheckbox()):(e.hideForm(),e.hideSaveNewCheckbox())},this.onCreateAccountChange=function(){a(this).is(":checked")?e.showSaveNewCheckbox():e.hideSaveNewCheckbox()},this.onDisplay=function(){0===a(":input.woocommerce-SavedPaymentMethods-tokenInput:checked",c).length&&a(":input.woocommerce-SavedPaymentMethods-tokenInput:last",c).prop("checked",!0),0===c.data("count")&&a(".woocommerce-SavedPaymentMethods-new",c).hide(),a(":input.woocommerce-SavedPaymentMethods-tokenInput:checked",c).trigger("change"),a("input#createaccount").length&&!a("input#createaccount").is(":checked")&&e.hideSaveNewCheckbox()},this.hideForm=function(){a(".wc-payment-form",d).hide()},this.showForm=function(){a(".wc-payment-form",d).show()},this.showSaveNewCheckbox=function(){a(".woocommerce-SavedPaymentMethods-saveNew",d).show()},this.hideSaveNewCheckbox=function(){a(".woocommerce-SavedPaymentMethods-saveNew",d).hide()},a(":input.woocommerce-SavedPaymentMethods-tokenInput",c).change(this.onTokenChange),a("input#createaccount").change(this.onCreateAccountChange),this.onDisplay()}return b}();a(document.body).on("updated_checkout",function(){var c=a("ul.woocommerce-SavedPaymentMethods");c.each(function(){new b(this)})})})}(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -5,4 +5,4 @@
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;n<o;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0!==a.cookie(b)&&(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
!function(a){function b(a){function b(a,b){for(var c=null,d=0;d<b.length&&a!=b[d];++d)b[d].stack==a.stack&&(c=b[d]);return c}function c(a,c,d){if(null!=c.stack&&c.stack!==!1){var e=b(c,a.getData());if(e){for(var f,g,h,i,j,k,l,m,n=d.pointsize,o=d.points,p=e.datapoints.pointsize,q=e.datapoints.points,r=[],s=c.lines.show,t=c.bars.horizontal,u=n>2&&(t?d.format[2].x:d.format[2].y),v=s&&c.lines.steps,w=!0,x=t?1:0,y=t?0:1,z=0,A=0;;){if(z>=o.length)break;if(l=r.length,null==o[z]){for(m=0;n>m;++m)r.push(o[z+m]);z+=n}else if(A>=q.length){if(!s)for(m=0;n>m;++m)r.push(o[z+m]);z+=n}else if(null==q[A]){for(m=0;n>m;++m)r.push(null);w=!0,A+=p}else{if(f=o[z+x],g=o[z+y],i=q[A+x],j=q[A+y],k=0,f==i){for(m=0;n>m;++m)r.push(o[z+m]);r[l+y]+=j,k=j,z+=n,A+=p}else if(f>i){if(s&&z>0&&null!=o[z-n]){for(h=g+(o[z-n+y]-g)*(i-f)/(o[z-n+x]-f),r.push(i),r.push(h+j),m=2;n>m;++m)r.push(o[z+m]);k=j}A+=p}else{if(w&&s){z+=n;continue}for(m=0;n>m;++m)r.push(o[z+m]);s&&A>0&&null!=q[A-p]&&(k=j+(q[A-p+y]-j)*(f-i)/(q[A-p+x]-i)),r[l+y]+=k,z+=n}w=!1,l!=r.length&&u&&(r[l+2]+=k)}if(v&&l!=r.length&&l>0&&null!=r[l]&&r[l]!=r[l-n]&&r[l+1]!=r[l-n+1]){for(m=0;n>m;++m)r[l+n+m]=r[l+m];r[l+1]=r[l-n+1]}}d.points=r}}}a.hooks.processDatapoints.push(c)}var c={series:{stack:null}};a.plot.plugins.push({init:b,options:c,name:"stack",version:"1.2"})}(jQuery);
!function(a){function b(a){function b(a,b){for(var c=null,d=0;d<b.length&&a!=b[d];++d)b[d].stack==a.stack&&(c=b[d]);return c}function c(a,c,d){if(null!=c.stack&&c.stack!==!1){var e=b(c,a.getData());if(e){for(var f,g,h,i,j,k,l,m,n=d.pointsize,o=d.points,p=e.datapoints.pointsize,q=e.datapoints.points,r=[],s=c.lines.show,t=c.bars.horizontal,u=n>2&&(t?d.format[2].x:d.format[2].y),v=s&&c.lines.steps,w=!0,x=t?1:0,y=t?0:1,z=0,A=0;;){if(z>=o.length)break;if(l=r.length,null==o[z]){for(m=0;m<n;++m)r.push(o[z+m]);z+=n}else if(A>=q.length){if(!s)for(m=0;m<n;++m)r.push(o[z+m]);z+=n}else if(null==q[A]){for(m=0;m<n;++m)r.push(null);w=!0,A+=p}else{if(f=o[z+x],g=o[z+y],i=q[A+x],j=q[A+y],k=0,f==i){for(m=0;m<n;++m)r.push(o[z+m]);r[l+y]+=j,k=j,z+=n,A+=p}else if(f>i){if(s&&z>0&&null!=o[z-n]){for(h=g+(o[z-n+y]-g)*(i-f)/(o[z-n+x]-f),r.push(i),r.push(h+j),m=2;m<n;++m)r.push(o[z+m]);k=j}A+=p}else{if(w&&s){z+=n;continue}for(m=0;m<n;++m)r.push(o[z+m]);s&&A>0&&null!=q[A-p]&&(k=j+(q[A-p+y]-j)*(f-i)/(q[A-p+x]-i)),r[l+y]+=k,z+=n}w=!1,l!=r.length&&u&&(r[l+2]+=k)}if(v&&l!=r.length&&l>0&&null!=r[l]&&r[l]!=r[l-n]&&r[l+1]!=r[l-n+1]){for(m=0;m<n;++m)r[l+n+m]=r[l+m];r[l+1]=r[l-n+1]}}d.points=r}}}a.hooks.processDatapoints.push(c)}var c={series:{stack:null}};a.plot.plugins.push({init:b,options:c,name:"stack",version:"1.2"})}(jQuery);

View File

@ -1 +1 @@
!function(a){function b(a,b){return b*Math.floor(a/b)}function c(a,b,c,d){if("function"==typeof a.strftime)return a.strftime(b);var e=function(a,b){return a=""+a,b=""+(null==b?"0":b),1==a.length?b+a:a},f=[],g=!1,h=a.getHours(),i=12>h;null==c&&(c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),null==d&&(d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]);var j;j=h>12?h-12:0==h?12:h;for(var k=0;k<b.length;++k){var l=b.charAt(k);if(g){switch(l){case"a":l=""+d[a.getDay()];break;case"b":l=""+c[a.getMonth()];break;case"d":l=e(a.getDate());break;case"e":l=e(a.getDate()," ");break;case"h":case"H":l=e(h);break;case"I":l=e(j);break;case"l":l=e(j," ");break;case"m":l=e(a.getMonth()+1);break;case"M":l=e(a.getMinutes());break;case"q":l=""+(Math.floor(a.getMonth()/3)+1);break;case"S":l=e(a.getSeconds());break;case"y":l=e(a.getFullYear()%100);break;case"Y":l=""+a.getFullYear();break;case"p":l=i?"am":"pm";break;case"P":l=i?"AM":"PM";break;case"w":l=""+a.getDay()}f.push(l),g=!1}else"%"==l?g=!0:f.push(l)}return f.join("")}function d(a){function b(a,b,c,d){a[b]=function(){return c[d].apply(c,arguments)}}var c={date:a};void 0!=a.strftime&&b(c,"strftime",a,"strftime"),b(c,"getTime",a,"getTime"),b(c,"setTime",a,"setTime");for(var d=["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds"],e=0;e<d.length;e++)b(c,"get"+d[e],a,"getUTC"+d[e]),b(c,"set"+d[e],a,"setUTC"+d[e]);return c}function e(a,b){if("browser"==b.timezone)return new Date(a);if(b.timezone&&"utc"!=b.timezone){if("undefined"!=typeof timezoneJS&&"undefined"!=typeof timezoneJS.Date){var c=new timezoneJS.Date;return c.setTimezone(b.timezone),c.setTime(a),c}return d(new Date(a))}return d(new Date(a))}function f(d){d.hooks.processOptions.push(function(d,f){a.each(d.getAxes(),function(a,d){var f=d.options;"time"==f.mode&&(d.tickGenerator=function(a){var c=[],d=e(a.min,f),g=0,i=f.tickSize&&"quarter"===f.tickSize[1]||f.minTickSize&&"quarter"===f.minTickSize[1]?k:j;null!=f.minTickSize&&(g="number"==typeof f.tickSize?f.tickSize:f.minTickSize[0]*h[f.minTickSize[1]]);for(var l=0;l<i.length-1&&!(a.delta<(i[l][0]*h[i[l][1]]+i[l+1][0]*h[i[l+1][1]])/2&&i[l][0]*h[i[l][1]]>=g);++l);var m=i[l][0],n=i[l][1];if("year"==n){if(null!=f.minTickSize&&"year"==f.minTickSize[1])m=Math.floor(f.minTickSize[0]);else{var o=Math.pow(10,Math.floor(Math.log(a.delta/h.year)/Math.LN10)),p=a.delta/h.year/o;m=1.5>p?1:3>p?2:7.5>p?5:10,m*=o}1>m&&(m=1)}a.tickSize=f.tickSize||[m,n];var q=a.tickSize[0];n=a.tickSize[1];var r=q*h[n];"second"==n?d.setSeconds(b(d.getSeconds(),q)):"minute"==n?d.setMinutes(b(d.getMinutes(),q)):"hour"==n?d.setHours(b(d.getHours(),q)):"month"==n?d.setMonth(b(d.getMonth(),q)):"quarter"==n?d.setMonth(3*b(d.getMonth()/3,q)):"year"==n&&d.setFullYear(b(d.getFullYear(),q)),d.setMilliseconds(0),r>=h.minute&&d.setSeconds(0),r>=h.hour&&d.setMinutes(0),r>=h.day&&d.setHours(0),r>=4*h.day&&d.setDate(1),r>=2*h.month&&d.setMonth(b(d.getMonth(),3)),r>=2*h.quarter&&d.setMonth(b(d.getMonth(),6)),r>=h.year&&d.setMonth(0);var s,t=0,u=Number.NaN;do if(s=u,u=d.getTime(),c.push(u),"month"==n||"quarter"==n)if(1>q){d.setDate(1);var v=d.getTime();d.setMonth(d.getMonth()+("quarter"==n?3:1));var w=d.getTime();d.setTime(u+t*h.hour+(w-v)*q),t=d.getHours(),d.setHours(0)}else d.setMonth(d.getMonth()+q*("quarter"==n?3:1));else"year"==n?d.setFullYear(d.getFullYear()+q):d.setTime(u+r);while(u<a.max&&u!=s);return c},d.tickFormatter=function(a,b){var d=e(a,b.options);if(null!=f.timeformat)return c(d,f.timeformat,f.monthNames,f.dayNames);var g,i=b.options.tickSize&&"quarter"==b.options.tickSize[1]||b.options.minTickSize&&"quarter"==b.options.minTickSize[1],j=b.tickSize[0]*h[b.tickSize[1]],k=b.max-b.min,l=f.twelveHourClock?" %p":"",m=f.twelveHourClock?"%I":"%H";g=j<h.minute?m+":%M:%S"+l:j<h.day?k<2*h.day?m+":%M"+l:"%b %d "+m+":%M"+l:j<h.month?"%b %d":i&&j<h.quarter||!i&&j<h.year?k<h.year?"%b":"%b %Y":i&&j<h.year?k<h.year?"Q%q":"Q%q %Y":"%Y";var n=c(d,g,f.monthNames,f.dayNames);return n})})})}var g={xaxis:{timezone:null,timeformat:null,twelveHourClock:!1,monthNames:null}},h={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,quarter:7776e6,year:525949.2*60*1e3},i=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[.25,"month"],[.5,"month"],[1,"month"],[2,"month"]],j=i.concat([[3,"month"],[6,"month"],[1,"year"]]),k=i.concat([[1,"quarter"],[2,"quarter"],[1,"year"]]);a.plot.plugins.push({init:f,options:g,name:"time",version:"1.0"}),a.plot.formatDate=c}(jQuery);
!function(a){function b(a,b){return b*Math.floor(a/b)}function c(a,b,c,d){if("function"==typeof a.strftime)return a.strftime(b);var e=function(a,b){return a=""+a,b=""+(null==b?"0":b),1==a.length?b+a:a},f=[],g=!1,h=a.getHours(),i=h<12;null==c&&(c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),null==d&&(d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]);var j;j=h>12?h-12:0==h?12:h;for(var k=0;k<b.length;++k){var l=b.charAt(k);if(g){switch(l){case"a":l=""+d[a.getDay()];break;case"b":l=""+c[a.getMonth()];break;case"d":l=e(a.getDate());break;case"e":l=e(a.getDate()," ");break;case"h":case"H":l=e(h);break;case"I":l=e(j);break;case"l":l=e(j," ");break;case"m":l=e(a.getMonth()+1);break;case"M":l=e(a.getMinutes());break;case"q":l=""+(Math.floor(a.getMonth()/3)+1);break;case"S":l=e(a.getSeconds());break;case"y":l=e(a.getFullYear()%100);break;case"Y":l=""+a.getFullYear();break;case"p":l=i?"am":"pm";break;case"P":l=i?"AM":"PM";break;case"w":l=""+a.getDay()}f.push(l),g=!1}else"%"==l?g=!0:f.push(l)}return f.join("")}function d(a){function b(a,b,c,d){a[b]=function(){return c[d].apply(c,arguments)}}var c={date:a};void 0!=a.strftime&&b(c,"strftime",a,"strftime"),b(c,"getTime",a,"getTime"),b(c,"setTime",a,"setTime");for(var d=["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds"],e=0;e<d.length;e++)b(c,"get"+d[e],a,"getUTC"+d[e]),b(c,"set"+d[e],a,"setUTC"+d[e]);return c}function e(a,b){if("browser"==b.timezone)return new Date(a);if(b.timezone&&"utc"!=b.timezone){if("undefined"!=typeof timezoneJS&&"undefined"!=typeof timezoneJS.Date){var c=new timezoneJS.Date;return c.setTimezone(b.timezone),c.setTime(a),c}return d(new Date(a))}return d(new Date(a))}function f(d){d.hooks.processOptions.push(function(d,f){a.each(d.getAxes(),function(a,d){var f=d.options;"time"==f.mode&&(d.tickGenerator=function(a){var c=[],d=e(a.min,f),g=0,i=f.tickSize&&"quarter"===f.tickSize[1]||f.minTickSize&&"quarter"===f.minTickSize[1]?k:j;null!=f.minTickSize&&(g="number"==typeof f.tickSize?f.tickSize:f.minTickSize[0]*h[f.minTickSize[1]]);for(var l=0;l<i.length-1&&!(a.delta<(i[l][0]*h[i[l][1]]+i[l+1][0]*h[i[l+1][1]])/2&&i[l][0]*h[i[l][1]]>=g);++l);var m=i[l][0],n=i[l][1];if("year"==n){if(null!=f.minTickSize&&"year"==f.minTickSize[1])m=Math.floor(f.minTickSize[0]);else{var o=Math.pow(10,Math.floor(Math.log(a.delta/h.year)/Math.LN10)),p=a.delta/h.year/o;m=p<1.5?1:p<3?2:p<7.5?5:10,m*=o}m<1&&(m=1)}a.tickSize=f.tickSize||[m,n];var q=a.tickSize[0];n=a.tickSize[1];var r=q*h[n];"second"==n?d.setSeconds(b(d.getSeconds(),q)):"minute"==n?d.setMinutes(b(d.getMinutes(),q)):"hour"==n?d.setHours(b(d.getHours(),q)):"month"==n?d.setMonth(b(d.getMonth(),q)):"quarter"==n?d.setMonth(3*b(d.getMonth()/3,q)):"year"==n&&d.setFullYear(b(d.getFullYear(),q)),d.setMilliseconds(0),r>=h.minute&&d.setSeconds(0),r>=h.hour&&d.setMinutes(0),r>=h.day&&d.setHours(0),r>=4*h.day&&d.setDate(1),r>=2*h.month&&d.setMonth(b(d.getMonth(),3)),r>=2*h.quarter&&d.setMonth(b(d.getMonth(),6)),r>=h.year&&d.setMonth(0);var s,t=0,u=Number.NaN;do if(s=u,u=d.getTime(),c.push(u),"month"==n||"quarter"==n)if(q<1){d.setDate(1);var v=d.getTime();d.setMonth(d.getMonth()+("quarter"==n?3:1));var w=d.getTime();d.setTime(u+t*h.hour+(w-v)*q),t=d.getHours(),d.setHours(0)}else d.setMonth(d.getMonth()+q*("quarter"==n?3:1));else"year"==n?d.setFullYear(d.getFullYear()+q):d.setTime(u+r);while(u<a.max&&u!=s);return c},d.tickFormatter=function(a,b){var d=e(a,b.options);if(null!=f.timeformat)return c(d,f.timeformat,f.monthNames,f.dayNames);var g,i=b.options.tickSize&&"quarter"==b.options.tickSize[1]||b.options.minTickSize&&"quarter"==b.options.minTickSize[1],j=b.tickSize[0]*h[b.tickSize[1]],k=b.max-b.min,l=f.twelveHourClock?" %p":"",m=f.twelveHourClock?"%I":"%H";g=j<h.minute?m+":%M:%S"+l:j<h.day?k<2*h.day?m+":%M"+l:"%b %d "+m+":%M"+l:j<h.month?"%b %d":i&&j<h.quarter||!i&&j<h.year?k<h.year?"%b":"%b %Y":i&&j<h.year?k<h.year?"Q%q":"Q%q %Y":"%Y";var n=c(d,g,f.monthNames,f.dayNames);return n})})})}var g={xaxis:{timezone:null,timeformat:null,twelveHourClock:!1,monthNames:null}},h={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,quarter:7776e6,year:525949.2*60*1e3},i=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[.25,"month"],[.5,"month"],[1,"month"],[2,"month"]],j=i.concat([[3,"month"],[6,"month"],[1,"year"]]),k=i.concat([[1,"quarter"],[2,"quarter"],[1,"year"]]);a.plot.plugins.push({init:f,options:g,name:"time",version:"1.0"}),a.plot.formatDate=c}(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,4 +7,4 @@
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*/
!function(a){"use strict";a.fn.serializeJSON=function(b){var c,d,e,f,g,h,i;return h=a.serializeJSON,i=h.setupOpts(b),d=this.serializeArray(),h.readCheckboxUncheckedValues(d,this,i),c={},a.each(d,function(a,b){e=h.splitInputNameIntoKeysArray(b.name,i),f=e.pop(),"skip"!==f&&(g=h.parseValue(b.value,f,i),i.parseWithFunction&&"_"===f&&(g=i.parseWithFunction(g,b.name)),h.deepSet(c,e,g,i))}),c},a.serializeJSON={defaultOptions:{checkboxUncheckedValue:void 0,parseNumbers:!1,parseBooleans:!1,parseNulls:!1,parseAll:!1,parseWithFunction:null,customTypes:{},defaultTypes:{string:function(a){return String(a)},number:function(a){return Number(a)},"boolean":function(a){var b=["false","null","undefined","","0"];return-1===b.indexOf(a)},"null":function(a){var b=["false","null","undefined","","0"];return-1===b.indexOf(a)?a:null},array:function(a){return JSON.parse(a)},object:function(a){return JSON.parse(a)},auto:function(b){return a.serializeJSON.parseValue(b,null,{parseNumbers:!0,parseBooleans:!0,parseNulls:!0})}},useIntKeysAsArrayIndex:!1},setupOpts:function(b){var c,d,e,f,g,h;h=a.serializeJSON,null==b&&(b={}),e=h.defaultOptions||{},d=["checkboxUncheckedValue","parseNumbers","parseBooleans","parseNulls","parseAll","parseWithFunction","customTypes","defaultTypes","useIntKeysAsArrayIndex"];for(c in b)if(-1===d.indexOf(c))throw new Error("serializeJSON ERROR: invalid option '"+c+"'. Please use one of "+d.join(", "));return f=function(a){return b[a]!==!1&&""!==b[a]&&(b[a]||e[a])},g=f("parseAll"),{checkboxUncheckedValue:f("checkboxUncheckedValue"),parseNumbers:g||f("parseNumbers"),parseBooleans:g||f("parseBooleans"),parseNulls:g||f("parseNulls"),parseWithFunction:f("parseWithFunction"),typeFunctions:a.extend({},f("defaultTypes"),f("customTypes")),useIntKeysAsArrayIndex:f("useIntKeysAsArrayIndex")}},parseValue:function(b,c,d){var e,f;return f=a.serializeJSON,e=d.typeFunctions&&d.typeFunctions[c],e?e(b):d.parseNumbers&&f.isNumeric(b)?Number(b):!d.parseBooleans||"true"!==b&&"false"!==b?d.parseNulls&&"null"==b?null:b:"true"===b},isObject:function(a){return a===Object(a)},isUndefined:function(a){return void 0===a},isValidArrayIndex:function(a){return/^[0-9]+$/.test(String(a))},isNumeric:function(a){return a-parseFloat(a)>=0},optionKeys:function(a){if(Object.keys)return Object.keys(a);var b,c=[];for(b in a)c.push(b);return c},splitInputNameIntoKeysArray:function(b,c){var d,e,f,g,h;return h=a.serializeJSON,g=h.extractTypeFromInputName(b,c),e=g[0],f=g[1],d=e.split("["),d=a.map(d,function(a){return a.replace(/\]/g,"")}),""===d[0]&&d.shift(),d.push(f),d},extractTypeFromInputName:function(b,c){var d,e,f;if(d=b.match(/(.*):([^:]+)$/)){if(f=a.serializeJSON,e=f.optionKeys(c?c.typeFunctions:f.defaultOptions.defaultTypes),e.push("skip"),-1!==e.indexOf(d[2]))return[d[1],d[2]];throw new Error("serializeJSON ERROR: Invalid type "+d[2]+" found in input name '"+b+"', please use one of "+e.join(", "))}return[b,"_"]},deepSet:function(b,c,d,e){var f,g,h,i,j,k;if(null==e&&(e={}),k=a.serializeJSON,k.isUndefined(b))throw new Error("ArgumentError: param 'o' expected to be an object or array, found undefined");if(!c||0===c.length)throw new Error("ArgumentError: param 'keys' expected to be an array with least one element");f=c[0],1===c.length?""===f?b.push(d):b[f]=d:(g=c[1],""===f&&(i=b.length-1,j=b[i],f=k.isObject(j)&&(k.isUndefined(j[g])||c.length>2)?i:i+1),""===g?!k.isUndefined(b[f])&&a.isArray(b[f])||(b[f]=[]):e.useIntKeysAsArrayIndex&&k.isValidArrayIndex(g)?!k.isUndefined(b[f])&&a.isArray(b[f])||(b[f]=[]):!k.isUndefined(b[f])&&k.isObject(b[f])||(b[f]={}),h=c.slice(1),k.deepSet(b[f],h,d,e))},readCheckboxUncheckedValues:function(b,c,d){var e,f,g,h,i;null==d&&(d={}),i=a.serializeJSON,e="input[type=checkbox][name]:not(:checked):not([disabled])",f=c.find(e).add(c.filter(e)),f.each(function(c,e){g=a(e),h=g.attr("data-unchecked-value"),h?b.push({name:e.name,value:h}):i.isUndefined(d.checkboxUncheckedValue)||b.push({name:e.name,value:d.checkboxUncheckedValue})})}}}(window.jQuery||window.Zepto||window.$);
!function(a){"use strict";a.fn.serializeJSON=function(b){var c,d,e,f,g,h,i;return h=a.serializeJSON,i=h.setupOpts(b),d=this.serializeArray(),h.readCheckboxUncheckedValues(d,this,i),c={},a.each(d,function(a,b){e=h.splitInputNameIntoKeysArray(b.name,i),f=e.pop(),"skip"!==f&&(g=h.parseValue(b.value,f,i),i.parseWithFunction&&"_"===f&&(g=i.parseWithFunction(g,b.name)),h.deepSet(c,e,g,i))}),c},a.serializeJSON={defaultOptions:{checkboxUncheckedValue:void 0,parseNumbers:!1,parseBooleans:!1,parseNulls:!1,parseAll:!1,parseWithFunction:null,customTypes:{},defaultTypes:{string:function(a){return String(a)},number:function(a){return Number(a)},"boolean":function(a){var b=["false","null","undefined","","0"];return b.indexOf(a)===-1},"null":function(a){var b=["false","null","undefined","","0"];return b.indexOf(a)===-1?a:null},array:function(a){return JSON.parse(a)},object:function(a){return JSON.parse(a)},auto:function(b){return a.serializeJSON.parseValue(b,null,{parseNumbers:!0,parseBooleans:!0,parseNulls:!0})}},useIntKeysAsArrayIndex:!1},setupOpts:function(b){var c,d,e,f,g,h;h=a.serializeJSON,null==b&&(b={}),e=h.defaultOptions||{},d=["checkboxUncheckedValue","parseNumbers","parseBooleans","parseNulls","parseAll","parseWithFunction","customTypes","defaultTypes","useIntKeysAsArrayIndex"];for(c in b)if(d.indexOf(c)===-1)throw new Error("serializeJSON ERROR: invalid option '"+c+"'. Please use one of "+d.join(", "));return f=function(a){return b[a]!==!1&&""!==b[a]&&(b[a]||e[a])},g=f("parseAll"),{checkboxUncheckedValue:f("checkboxUncheckedValue"),parseNumbers:g||f("parseNumbers"),parseBooleans:g||f("parseBooleans"),parseNulls:g||f("parseNulls"),parseWithFunction:f("parseWithFunction"),typeFunctions:a.extend({},f("defaultTypes"),f("customTypes")),useIntKeysAsArrayIndex:f("useIntKeysAsArrayIndex")}},parseValue:function(b,c,d){var e,f;return f=a.serializeJSON,e=d.typeFunctions&&d.typeFunctions[c],e?e(b):d.parseNumbers&&f.isNumeric(b)?Number(b):!d.parseBooleans||"true"!==b&&"false"!==b?d.parseNulls&&"null"==b?null:b:"true"===b},isObject:function(a){return a===Object(a)},isUndefined:function(a){return void 0===a},isValidArrayIndex:function(a){return/^[0-9]+$/.test(String(a))},isNumeric:function(a){return a-parseFloat(a)>=0},optionKeys:function(a){if(Object.keys)return Object.keys(a);var b,c=[];for(b in a)c.push(b);return c},splitInputNameIntoKeysArray:function(b,c){var d,e,f,g,h;return h=a.serializeJSON,g=h.extractTypeFromInputName(b,c),e=g[0],f=g[1],d=e.split("["),d=a.map(d,function(a){return a.replace(/\]/g,"")}),""===d[0]&&d.shift(),d.push(f),d},extractTypeFromInputName:function(b,c){var d,e,f;if(d=b.match(/(.*):([^:]+)$/)){if(f=a.serializeJSON,e=f.optionKeys(c?c.typeFunctions:f.defaultOptions.defaultTypes),e.push("skip"),e.indexOf(d[2])!==-1)return[d[1],d[2]];throw new Error("serializeJSON ERROR: Invalid type "+d[2]+" found in input name '"+b+"', please use one of "+e.join(", "))}return[b,"_"]},deepSet:function(b,c,d,e){var f,g,h,i,j,k;if(null==e&&(e={}),k=a.serializeJSON,k.isUndefined(b))throw new Error("ArgumentError: param 'o' expected to be an object or array, found undefined");if(!c||0===c.length)throw new Error("ArgumentError: param 'keys' expected to be an array with least one element");f=c[0],1===c.length?""===f?b.push(d):b[f]=d:(g=c[1],""===f&&(i=b.length-1,j=b[i],f=k.isObject(j)&&(k.isUndefined(j[g])||c.length>2)?i:i+1),""===g?!k.isUndefined(b[f])&&a.isArray(b[f])||(b[f]=[]):e.useIntKeysAsArrayIndex&&k.isValidArrayIndex(g)?!k.isUndefined(b[f])&&a.isArray(b[f])||(b[f]=[]):!k.isUndefined(b[f])&&k.isObject(b[f])||(b[f]={}),h=c.slice(1),k.deepSet(b[f],h,d,e))},readCheckboxUncheckedValues:function(b,c,d){var e,f,g,h,i;null==d&&(d={}),i=a.serializeJSON,e="input[type=checkbox][name]:not(:checked):not([disabled])",f=c.find(e).add(c.filter(e)),f.each(function(c,e){g=a(e),h=g.attr("data-unchecked-value"),h?b.push({name:e.name,value:h}):i.isUndefined(d.checkboxUncheckedValue)||b.push({name:e.name,value:d.checkboxUncheckedValue})})}}}(window.jQuery||window.Zepto||window.$);

View File

@ -1 +1 @@
!function(a){a.fn.tipTip=function(b){var c={activation:"hover",keepAlive:!1,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:!1,enter:function(){},exit:function(){}},d=a.extend(c,b);if(a("#tiptip_holder").length<=0){var e=a('<div id="tiptip_holder" style="max-width:'+d.maxWidth+';"></div>'),f=a('<div id="tiptip_content"></div>'),g=a('<div id="tiptip_arrow"></div>');a("body").append(e.html(f).prepend(g.html('<div id="tiptip_arrow_inner"></div>')))}else var e=a("#tiptip_holder"),f=a("#tiptip_content"),g=a("#tiptip_arrow");return this.each(function(){function b(){d.enter.call(this),f.html(i),e.hide().removeAttr("class").css("margin","0"),g.removeAttr("style");var b=parseInt(h.offset().top),c=parseInt(h.offset().left),k=parseInt(h.outerWidth()),l=parseInt(h.outerHeight()),m=e.outerWidth(),n=e.outerHeight(),o=Math.round((k-m)/2),p=Math.round((l-n)/2),q=Math.round(c+o),r=Math.round(b+l+d.edgeOffset),s="",t="",u=Math.round(m-12)/2;"bottom"==d.defaultPosition?s="_bottom":"top"==d.defaultPosition?s="_top":"left"==d.defaultPosition?s="_left":"right"==d.defaultPosition&&(s="_right");var v=o+c<parseInt(a(window).scrollLeft()),w=m+c>parseInt(a(window).width());v&&0>o||"_right"==s&&!w||"_left"==s&&c<m+d.edgeOffset+5?(s="_right",t=Math.round(n-13)/2,u=-12,q=Math.round(c+k+d.edgeOffset),r=Math.round(b+p)):(w&&0>o||"_left"==s&&!v)&&(s="_left",t=Math.round(n-13)/2,u=Math.round(m),q=Math.round(c-(m+d.edgeOffset+5)),r=Math.round(b+p));var x=b+l+d.edgeOffset+n+8>parseInt(a(window).height()+a(window).scrollTop()),y=b+l-(d.edgeOffset+n+8)<0;x||"_bottom"==s&&x||"_top"==s&&!y?("_top"==s||"_bottom"==s?s="_top":s+="_top",t=n,r=Math.round(b-(n+5+d.edgeOffset))):(y|("_top"==s&&y)||"_bottom"==s&&!x)&&("_top"==s||"_bottom"==s?s="_bottom":s+="_bottom",t=-12,r=Math.round(b+l+d.edgeOffset)),"_right_top"==s||"_left_top"==s?r+=5:"_right_bottom"!=s&&"_left_bottom"!=s||(r-=5),"_left_top"!=s&&"_left_bottom"!=s||(q+=5),g.css({"margin-left":u+"px","margin-top":t+"px"}),e.css({"margin-left":q+"px","margin-top":r+"px"}).attr("class","tip"+s),j&&clearTimeout(j),j=setTimeout(function(){e.stop(!0,!0).fadeIn(d.fadeIn)},d.delay)}function c(){d.exit.call(this),j&&clearTimeout(j),e.fadeOut(d.fadeOut)}var h=a(this);if(d.content)var i=d.content;else var i=h.attr(d.attribute);if(""!=i){d.content||h.removeAttr(d.attribute);var j=!1;"hover"==d.activation?(h.hover(function(){b()},function(){d.keepAlive||c()}),d.keepAlive&&e.hover(function(){},function(){c()})):"focus"==d.activation?h.focus(function(){b()}).blur(function(){c()}):"click"==d.activation&&(h.click(function(){return b(),!1}).hover(function(){},function(){d.keepAlive||c()}),d.keepAlive&&e.hover(function(){},function(){c()}))}})}}(jQuery);
!function(a){a.fn.tipTip=function(b){var c={activation:"hover",keepAlive:!1,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:!1,enter:function(){},exit:function(){}},d=a.extend(c,b);if(a("#tiptip_holder").length<=0){var e=a('<div id="tiptip_holder" style="max-width:'+d.maxWidth+';"></div>'),f=a('<div id="tiptip_content"></div>'),g=a('<div id="tiptip_arrow"></div>');a("body").append(e.html(f).prepend(g.html('<div id="tiptip_arrow_inner"></div>')))}else var e=a("#tiptip_holder"),f=a("#tiptip_content"),g=a("#tiptip_arrow");return this.each(function(){function b(){d.enter.call(this),f.html(i),e.hide().removeAttr("class").css("margin","0"),g.removeAttr("style");var b=parseInt(h.offset().top),c=parseInt(h.offset().left),k=parseInt(h.outerWidth()),l=parseInt(h.outerHeight()),m=e.outerWidth(),n=e.outerHeight(),o=Math.round((k-m)/2),p=Math.round((l-n)/2),q=Math.round(c+o),r=Math.round(b+l+d.edgeOffset),s="",t="",u=Math.round(m-12)/2;"bottom"==d.defaultPosition?s="_bottom":"top"==d.defaultPosition?s="_top":"left"==d.defaultPosition?s="_left":"right"==d.defaultPosition&&(s="_right");var v=o+c<parseInt(a(window).scrollLeft()),w=m+c>parseInt(a(window).width());v&&o<0||"_right"==s&&!w||"_left"==s&&c<m+d.edgeOffset+5?(s="_right",t=Math.round(n-13)/2,u=-12,q=Math.round(c+k+d.edgeOffset),r=Math.round(b+p)):(w&&o<0||"_left"==s&&!v)&&(s="_left",t=Math.round(n-13)/2,u=Math.round(m),q=Math.round(c-(m+d.edgeOffset+5)),r=Math.round(b+p));var x=b+l+d.edgeOffset+n+8>parseInt(a(window).height()+a(window).scrollTop()),y=b+l-(d.edgeOffset+n+8)<0;x||"_bottom"==s&&x||"_top"==s&&!y?("_top"==s||"_bottom"==s?s="_top":s+="_top",t=n,r=Math.round(b-(n+5+d.edgeOffset))):(y|("_top"==s&&y)||"_bottom"==s&&!x)&&("_top"==s||"_bottom"==s?s="_bottom":s+="_bottom",t=-12,r=Math.round(b+l+d.edgeOffset)),"_right_top"==s||"_left_top"==s?r+=5:"_right_bottom"!=s&&"_left_bottom"!=s||(r-=5),"_left_top"!=s&&"_left_bottom"!=s||(q+=5),g.css({"margin-left":u+"px","margin-top":t+"px"}),e.css({"margin-left":q+"px","margin-top":r+"px"}).attr("class","tip"+s),j&&clearTimeout(j),j=setTimeout(function(){e.stop(!0,!0).fadeIn(d.fadeIn)},d.delay)}function c(){d.exit.call(this),j&&clearTimeout(j),e.fadeOut(d.fadeOut)}var h=a(this);if(d.content)var i=d.content;else var i=h.attr(d.attribute);if(""!=i){d.content||h.removeAttr(d.attribute);var j=!1;"hover"==d.activation?(h.hover(function(){b()},function(){d.keepAlive||c()}),d.keepAlive&&e.hover(function(){},function(){c()})):"focus"==d.activation?h.focus(function(){b()}).blur(function(){c()}):"click"==d.activation&&(h.click(function(){return b(),!1}).hover(function(){},function(){d.keepAlive||c()}),d.keepAlive&&e.hover(function(){},function(){c()}))}})}}(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
function round(a,b,c){var d,e,f,g;if(b|=0,d=Math.pow(10,b),a*=d,g=a>0|-(0>a),f=a%1===.5*g,e=Math.floor(a),f)switch(c){case"2":case"PHP_ROUND_HALF_DOWN":a=e+(0>g);break;case"3":case"PHP_ROUND_HALF_EVEN":a=e+e%2*g;break;case"4":case"PHP_ROUND_HALF_ODD":a=e+!(e%2);break;default:a=e+(g>0)}return(f?a:Math.round(a))/d}
function round(a,b,c){var d,e,f,g;if(b|=0,d=Math.pow(10,b),a*=d,g=a>0|-(a<0),f=a%1===.5*g,e=Math.floor(a),f)switch(c){case"2":case"PHP_ROUND_HALF_DOWN":a=e+(g<0);break;case"3":case"PHP_ROUND_HALF_EVEN":a=e+e%2*g;break;case"4":case"PHP_ROUND_HALF_ODD":a=e+!(e%2);break;default:a=e+(g>0)}return(f?a:Math.round(a))/d}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

10
composer.json Normal file
View File

@ -0,0 +1,10 @@
{
"name": "woocommerce/woocommerce",
"description": "An e-commerce toolkit that helps you sell anything. Beautifully.",
"homepage": "https://woocommerce.com/",
"type": "wordpress-plugin",
"license": "GPL-2.0+",
"require": {
"composer/installers": "~1.0"
}
}

View File

@ -15,46 +15,289 @@ if ( ! defined( 'ABSPATH' ) ) {
}
return array(
'AF' => array(
'name' => __( 'Africa', 'woocommerce' ),
'countries' => array(
'AO', 'BF', 'BI', 'BJ', 'BW', 'CD', 'CF', 'CG', 'CI', 'CM', 'CV', 'DJ', 'DZ', 'EG', 'EH', 'ER', 'ET', 'GA', 'GH', 'GM', 'GN', 'GQ', 'GW', 'KE', 'KM', 'LR', 'LS', 'LY', 'MA', 'MG', 'ML', 'MR', 'MU', 'MW', 'MZ', 'NA', 'NE', 'NG', 'RE', 'RW', 'SC', 'SD', 'SS', 'SH', 'SL', 'SN', 'SO', 'ST', 'SZ', 'TD', 'TG', 'TN', 'TZ', 'UG', 'YT', 'ZA', 'ZM', 'ZW'
)
),
'AN' => array(
'name' => __( 'Antarctica', 'woocommerce' ),
'countries' => array(
'AQ', 'BV', 'GS', 'HM', 'TF'
)
),
'AS' => array(
'name' => __( 'Asia', 'woocommerce' ),
'countries' => array(
'AE', 'AF', 'AM', 'AZ', 'BD', 'BH', 'BN', 'BT', 'CC', 'CN', 'CX', 'CY', 'GE', 'HK', 'ID', 'IL', 'IN', 'IO', 'IQ', 'IR', 'JO', 'JP', 'KG', 'KH', 'KP', 'KR', 'KW', 'KZ', 'LA', 'LB', 'LK', 'MM', 'MN', 'MO', 'MV', 'MY', 'NP', 'OM', 'PH', 'PK', 'PS', 'QA', 'SA', 'SG', 'SY', 'TH', 'TJ', 'TL', 'TM', 'TW', 'UZ', 'VN', 'YE'
)
),
'EU' => array(
'name' => __( 'Europe', 'woocommerce' ),
'countries' => array(
'AD', 'AL', 'AT', 'AX', 'BA', 'BE', 'BG', 'BY', 'CH', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FO', 'FR', 'GB', 'GG', 'GI', 'GR', 'HR', 'HU', 'IE', 'IM', 'IS', 'IT', 'JE', 'LI', 'LT', 'LU', 'LV', 'MC', 'MD', 'ME', 'MK', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'RS', 'RU', 'SE', 'SI', 'SJ', 'SK', 'SM', 'TR', 'UA', 'VA'
)
),
'NA' => array(
'name' => __( 'North America', 'woocommerce' ),
'countries' => array(
'AG', 'AI', 'AN', 'AW', 'BB', 'BL', 'BM', 'BS', 'BZ', 'CA', 'CR', 'CU', 'DM', 'DO', 'GD', 'GL', 'GP', 'GT', 'HN', 'HT', 'JM', 'KN', 'KY', 'LC', 'MF', 'MQ', 'MS', 'MX', 'NI', 'PA', 'PM', 'PR', 'SV', 'TC', 'TT', 'US', 'VC', 'VG', 'VI'
)
),
'OC' => array(
'name' => __( 'Oceania', 'woocommerce' ),
'countries' => array(
'AS', 'AU', 'CK', 'FJ', 'FM', 'GU', 'KI', 'MH', 'MP', 'NC', 'NF', 'NR', 'NU', 'NZ', 'PF', 'PG', 'PN', 'PW', 'SB', 'TK', 'TO', 'TV', 'UM', 'VU', 'WF', 'WS'
)
),
'SA' => array(
'name' => __( 'South America', 'woocommerce' ),
'countries' => array(
'AR', 'BO', 'BR', 'CL', 'CO', 'EC', 'FK', 'GF', 'GY', 'PE', 'PY', 'SR', 'UY', 'VE'
)
)
'AF' => array(
'name' => __( 'Africa', 'woocommerce' ),
'countries' => array(
'AO',
'BF',
'BI',
'BJ',
'BW',
'CD',
'CF',
'CG',
'CI',
'CM',
'CV',
'DJ',
'DZ',
'EG',
'EH',
'ER',
'ET',
'GA',
'GH',
'GM',
'GN',
'GQ',
'GW',
'KE',
'KM',
'LR',
'LS',
'LY',
'MA',
'MG',
'ML',
'MR',
'MU',
'MW',
'MZ',
'NA',
'NE',
'NG',
'RE',
'RW',
'SC',
'SD',
'SH',
'SL',
'SN',
'SO',
'SS',
'ST',
'SZ',
'TD',
'TG',
'TN',
'TZ',
'UG',
'YT',
'ZA',
'ZM',
'ZW',
),
),
'AN' => array(
'name' => __( 'Antarctica', 'woocommerce' ),
'countries' => array(
'AQ',
'BV',
'GS',
'HM',
'TF',
),
),
'AS' => array(
'name' => __( 'Asia', 'woocommerce' ),
'countries' => array(
'AE',
'AF',
'AM',
'AZ',
'BD',
'BH',
'BN',
'BT',
'CC',
'CN',
'CX',
'CY',
'GE',
'HK',
'ID',
'IL',
'IN',
'IO',
'IQ',
'IR',
'JO',
'JP',
'KG',
'KH',
'KP',
'KR',
'KW',
'KZ',
'LA',
'LB',
'LK',
'MM',
'MN',
'MO',
'MV',
'MY',
'NP',
'OM',
'PH',
'PK',
'PS',
'QA',
'SA',
'SG',
'SY',
'TH',
'TJ',
'TL',
'TM',
'TW',
'UZ',
'VN',
'YE',
),
),
'EU' => array(
'name' => __( 'Europe', 'woocommerce' ),
'countries' => array(
'AD',
'AL',
'AT',
'AX',
'BA',
'BE',
'BG',
'BY',
'CH',
'CZ',
'DE',
'DK',
'EE',
'ES',
'FI',
'FO',
'FR',
'GB',
'GG',
'GI',
'GR',
'HR',
'HU',
'IE',
'IM',
'IS',
'IT',
'JE',
'LI',
'LT',
'LU',
'LV',
'MC',
'MD',
'ME',
'MK',
'MT',
'NL',
'NO',
'PL',
'PT',
'RO',
'RS',
'RU',
'SE',
'SI',
'SJ',
'SK',
'SM',
'TR',
'UA',
'VA',
),
),
'NA' => array(
'name' => __( 'North America', 'woocommerce' ),
'countries' => array(
'AG',
'AI',
'AN',
'AW',
'BB',
'BL',
'BM',
'BQ',
'BS',
'BZ',
'CA',
'CR',
'CU',
'CW',
'DM',
'DO',
'GD',
'GL',
'GP',
'GT',
'HN',
'HT',
'JM',
'KN',
'KY',
'LC',
'MF',
'MQ',
'MS',
'MX',
'NI',
'PA',
'PM',
'PR',
'SV',
'SX',
'TC',
'TT',
'US',
'VC',
'VG',
'VI',
),
),
'OC' => array(
'name' => __( 'Oceania', 'woocommerce' ),
'countries' => array(
'AS',
'AU',
'CK',
'FJ',
'FM',
'GU',
'KI',
'MH',
'MP',
'NC',
'NF',
'NR',
'NU',
'NZ',
'PF',
'PG',
'PN',
'PW',
'SB',
'TK',
'TO',
'TV',
'UM',
'VU',
'WF',
'WS',
),
),
'SA' => array(
'name' => __( 'South America', 'woocommerce' ),
'countries' => array(
'AR',
'BO',
'BR',
'CL',
'CO',
'EC',
'FK',
'GF',
'GY',
'PE',
'PY',
'SR',
'UY',
'VE',
),
),
);

View File

@ -263,5 +263,5 @@ return array(
'WS' => __( 'Samoa', 'woocommerce' ),
'YE' => __( 'Yemen', 'woocommerce' ),
'ZM' => __( 'Zambia', 'woocommerce' ),
'ZW' => __( 'Zimbabwe', 'woocommerce' )
'ZW' => __( 'Zimbabwe', 'woocommerce' ),
);

File diff suppressed because it is too large Load Diff

51
i18n/states/NG.php Normal file
View File

@ -0,0 +1,51 @@
<?php
/**
* Nigerian provinces
*
* @author hoshomoh
* @category i18n
* @package WooCommerce/i18n
* @version 2.7.0
*/
global $states;
$states['NG'] = array(
'AB' => __( 'Abia', 'woocommerce' ),
'FC' => __( 'Abuja', 'woocommerce' ),
'AD' => __( 'Adamawa', 'woocommerce' ),
'AK' => __( 'Akwa Ibom', 'woocommerce' ),
'AN' => __( 'Anambra', 'woocommerce' ),
'BA' => __( 'Bauchi', 'woocommerce' ),
'BY' => __( 'Bayelsa', 'woocommerce' ),
'BE' => __( 'Benue', 'woocommerce' ),
'BO' => __( 'Borno', 'woocommerce' ),
'CR' => __( 'Cross River', 'woocommerce' ),
'DE' => __( 'Delta', 'woocommerce' ),
'EB' => __( 'Ebonyi', 'woocommerce' ),
'ED' => __( 'Edo', 'woocommerce' ),
'EK' => __( 'Ekiti', 'woocommerce' ),
'EN' => __( 'Enugu', 'woocommerce' ),
'GO' => __( 'Gombe', 'woocommerce' ),
'IM' => __( 'Imo', 'woocommerce' ),
'JI' => __( 'Jigawa', 'woocommerce' ),
'KD' => __( 'Kaduna', 'woocommerce' ),
'KN' => __( 'Kano', 'woocommerce' ),
'KT' => __( 'Katsina', 'woocommerce' ),
'KE' => __( 'Kebbi', 'woocommerce' ),
'KO' => __( 'Kogi', 'woocommerce' ),
'KW' => __( 'Kwara', 'woocommerce' ),
'LA' => __( 'Lagos', 'woocommerce' ),
'NA' => __( 'Nasarawa', 'woocommerce' ),
'NI' => __( 'Niger', 'woocommerce' ),
'OG' => __( 'Ogun', 'woocommerce' ),
'ON' => __( 'Ondo', 'woocommerce' ),
'OS' => __( 'Osun', 'woocommerce' ),
'OY' => __( 'Oyo', 'woocommerce' ),
'PL' => __( 'Plateau', 'woocommerce' ),
'RI' => __( 'Rivers', 'woocommerce' ),
'SO' => __( 'Sokoto', 'woocommerce' ),
'TA' => __( 'Taraba', 'woocommerce' ),
'YO' => __( 'Yobe', 'woocommerce' ),
'ZA' => __( 'Zamfara', 'woocommerce' ),
);

View File

@ -616,6 +616,6 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
*/
public function get_order_currency() {
_deprecated_function( 'get_order_currency', '2.7', 'get_currency' );
return $this->get_currency();
return apply_filters( 'woocommerce_get_order_currency', $this->get_currency(), $this );
}
}

View File

@ -589,23 +589,24 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
}
/**
<<<<<<< HEAD
* Set order status.
* @since 2.7.0
* @param string $new_status Status to change the order to. No internal wc- prefix is required.
* @param array details of change
*/
public function set_status( $new_status ) {
$old_status = $this->get_status();
$new_status = 'wc-' === substr( $new_status, 0, 3 ) ? substr( $new_status, 3 ) : $new_status;
$old_status = $this->get_status();
$new_status = 'wc-' === substr( $new_status, 0, 3 ) ? substr( $new_status, 3 ) : $new_status;
// If the old status is unknown (e.g. draft) assume its pending for action usage.
if ( ! in_array( 'wc-' . $old_status, array_keys( wc_get_order_statuses() ) ) ) {
$old_status = 'pending';
}
if ( in_array( 'wc-' . $new_status, array_keys( wc_get_order_statuses() ) ) && $new_status !== $old_status ) {
$this->_data['status'] = 'wc-' . $new_status;
} else {
if ( in_array( 'wc-' . $new_status, array_keys( wc_get_order_statuses() ) ) && $new_status !== $old_status ) {
$this->_data['status'] = 'wc-' . $new_status;
} else {
$new_status = $old_status;
}
@ -613,7 +614,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
'from' => $old_status,
'to' => $new_status
);
}
}
/**
* Set Order Type
@ -1119,6 +1120,24 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
return $this->get_shipping_total();
}
/**
* Get all tax classes for items in the order.
*
* @since 2.6.3
* @return array
*/
public function get_items_tax_classes() {
$found_tax_classes = array();
foreach ( $this->get_items() as $item ) {
if ( $_product = $this->get_product_from_item( $item ) ) {
$found_tax_classes[] = $_product->get_tax_class();
}
}
return array_unique( $found_tax_classes );
}
/**
* Calculate taxes for all line items and shipping, and store the totals and tax rows.
*
@ -1126,7 +1145,6 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
* @param $args array Added in 2.7.0 to pass things like location.
*/
public function calculate_taxes( $args = array() ) {
$found_tax_classes = array();
$tax_based_on = get_option( 'woocommerce_tax_based_on' );
$args = wp_parse_args( $args, array(
'country' => 'billing' === $tax_based_on ? $this->get_billing_country() : $this->get_shipping_country(),
@ -1148,7 +1166,6 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
foreach ( $this->get_items( array( 'line_item', 'fee' ) ) as $item_id => $item ) {
$tax_class = $item->get_tax_class();
$tax_status = $item->get_tax_status();
$found_tax_classes[] = $tax_class;
if ( '0' !== $tax_class && 'taxable' === $tax_status ) {
$tax_rates = WC_Tax::find_rates( array(
@ -1181,7 +1198,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
// Inherit tax class from items
if ( '' === $shipping_tax_class ) {
$tax_classes = WC_Tax::get_tax_classes();
$tax_classes = WC_Tax::get_tax_classes();
$found_tax_classes = $this->get_items_tax_classes();
foreach ( $tax_classes as $tax_class ) {
$tax_class = sanitize_title( $tax_class );

View File

@ -214,9 +214,7 @@ class WC_Product {
}
/**
* Get total stock.
*
* This is the stock of parent and children combined.
* Get total stock - This is the stock of parent and children combined.
*
* @return int
*/
@ -610,20 +608,7 @@ class WC_Product {
* @return bool
*/
public function is_in_stock() {
$status = $this->stock_status === 'instock';
/**
* Sanity check to ensure stock qty is not lower than 0 but still listed
* instock.
*
* Check is not required for products on backorder since they can be
* instock regardless of actual stock quantity.
*/
if ( $this->managing_stock() && ! $this->backorders_allowed() && $this->get_total_stock() <= get_option( 'woocommerce_notify_no_stock_amount' ) ) {
$status = false;
}
return apply_filters( 'woocommerce_product_is_in_stock', $status );
return apply_filters( 'woocommerce_product_is_in_stock', $this->stock_status === 'instock', $this );
}
/**
@ -641,7 +626,7 @@ class WC_Product {
* @return bool
*/
public function backorders_require_notification() {
return $this->managing_stock() && $this->backorders === 'notify' ? true : false;
return apply_filters( 'woocommerce_product_backorders_require_notification', $this->managing_stock() && $this->backorders === 'notify' ? true : false, $this );
}
/**
@ -667,23 +652,33 @@ class WC_Product {
/**
* Returns the availability of the product.
*
* If stock management is enabled at global and product level, a stock message
* will be shown. e.g. In stock, In stock x10, Out of stock.
*
* If stock management is disabled at global or product level, out of stock
* will be shown when needed, but in stock will be hidden from view.
*
* This can all be changed through use of the woocommerce_get_availability filter.
*
* @return string
*/
public function get_availability() {
// Default to in-stock
$availability = __( 'In stock', 'woocommerce' );
$class = 'in-stock';
return apply_filters( 'woocommerce_get_availability', array(
'availability' => $this->get_availability_text(),
'class' => $this->get_availability_class(),
), $this );
}
// If out of stock, this takes priority over all other settings.
/**
* Get availability text based on stock status.
*
* @return string
*/
protected function get_availability_text() {
if ( ! $this->is_in_stock() ) {
$availability = __( 'Out of stock', 'woocommerce' );
$class = 'out-of-stock';
// Any further we can assume status is set to in stock.
} elseif ( $this->managing_stock() && $this->is_on_backorder( 1 ) ) {
$availability = __( 'Available on backorder', 'woocommerce' );
$class = 'available-on-backorder';
$availability = $this->backorders_require_notification() ? __( 'Available on backorder', 'woocommerce' ) : __( 'In stock', 'woocommerce' );
} elseif ( $this->managing_stock() ) {
switch ( get_option( 'woocommerce_stock_format' ) ) {
case 'no_amount' :
@ -708,9 +703,26 @@ class WC_Product {
}
break;
}
} else {
$availability = '';
}
return apply_filters( 'woocommerce_get_availability_text', $availability, $this );
}
return apply_filters( 'woocommerce_get_availability', array( 'availability' => $availability, 'class' => $class ), $this );
/**
* Get availability classname based on stock status.
*
* @return string
*/
protected function get_availability_class() {
if ( ! $this->is_in_stock() ) {
$class = 'out-of-stock';
} elseif ( $this->managing_stock() && $this->is_on_backorder( 1 ) && $this->backorders_require_notification() ) {
$class = 'available-on-backorder';
} else {
$class = 'in-stock';
}
return apply_filters( 'woocommerce_get_availability_class', $class, $this );
}
/**
@ -1135,7 +1147,7 @@ class WC_Product {
global $wpdb;
$counts = array();
$raw_counts = $wpdb->get_results( $wpdb->prepare("
$raw_counts = $wpdb->get_results( $wpdb->prepare( "
SELECT meta_value, COUNT( * ) as meta_value_count FROM $wpdb->commentmeta
LEFT JOIN $wpdb->comments ON $wpdb->commentmeta.comment_id = $wpdb->comments.comment_ID
WHERE meta_key = 'rating'

View File

@ -138,7 +138,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
* @return array
*/
protected function get_post_types() {
return array( $post->post_type );
return array( $this->post_type );
}
/**
@ -152,7 +152,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
$post = get_post( $id );
if ( empty( $id ) || empty( $post->ID ) || ! in_array( $post->post_type, $this->get_post_types() ) ) {
return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'Invalid id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$data = $this->prepare_item_for_response( $post, $request );
@ -574,6 +574,10 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
'posts_per_page',
'meta_query',
'tax_query',
'meta_key',
'meta_value',
'meta_compare',
'meta_value_num',
);
$valid_vars = array_merge( $valid_vars, $rest_valid );
@ -618,7 +622,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
'validate_callback' => 'rest_validate_request_arg',
);
$params['exclude'] = array(
'description' => __( 'Ensure result set excludes specific ids.', 'woocommerce' ),
'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
'type' => 'array',
'default' => array(),
'sanitize_callback' => 'wp_parse_id_list',
@ -659,13 +663,13 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
$post_type_obj = get_post_type_object( $this->post_type );
if ( isset( $post_type_obj->hierarchical ) && $post_type_obj->hierarchical ) {
$params['parent'] = array(
'description' => __( 'Limit result set to those of particular parent ids.', 'woocommerce' ),
'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce' ),
'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list',
'default' => array(),
);
$params['parent_exclude'] = array(
'description' => __( 'Limit result set to all items except those of a particular parent id.', 'woocommerce' ),
'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce' ),
'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list',
'default' => array(),

View File

@ -396,6 +396,8 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
// Add term data.
$meta_fields = $this->update_term_meta_fields( $term, $request );
if ( is_wp_error( $meta_fields ) ) {
wp_delete_term( $term['term_id'], $taxonomy );
return $meta_fields;
}

View File

@ -815,9 +815,7 @@ abstract class WC_Settings_API {
}
/**
* Validate Password Field.
*
* Make sure the data is escaped correctly, etc.
* Validate Password Field. No input sanitization is used to avoid corrupting passwords.
*
* @param string $key
* @param string|null $value Posted Value
@ -825,7 +823,7 @@ abstract class WC_Settings_API {
*/
public function validate_password_field( $key, $value ) {
$value = is_null( $value ) ? '' : $value;
return wp_kses_post( trim( stripslashes( $value ) ) );
return trim( stripslashes( $value ) );
}
/**

View File

@ -413,7 +413,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
*/
public function get_option( $key, $empty_value = null ) {
// Instance options take priority over global options
if ( array_key_exists( $key, $this->get_instance_form_fields() ) ) {
if ( $this->instance_id && array_key_exists( $key, $this->get_instance_form_fields() ) ) {
return $this->get_instance_option( $key, $empty_value );
}

View File

@ -101,16 +101,16 @@ class WC_Admin_Addons {
if ( 'storefront' === $template ) {
if ( 'storefront' === $stylesheet ) {
$url = 'https://www.woothemes.com/product-category/themes/storefront-child-theme-themes/';
$url = 'https://woocommerce.com/product-category/themes/storefront-child-theme-themes/';
$text = __( 'Need a fresh look? Try Storefront child themes', 'woocommerce' );
$utm_content = 'nostorefrontchildtheme';
} else {
$url = 'https://www.woothemes.com/product-category/themes/storefront-child-theme-themes/';
$url = 'https://woocommerce.com/product-category/themes/storefront-child-theme-themes/';
$text = __( 'View more Storefront child themes', 'woocommerce' );
$utm_content = 'hasstorefrontchildtheme';
}
} else {
$url = 'https://www.woothemes.com/storefront/';
$url = 'https://woocommerce.com/storefront/';
$text = __( 'Need a theme? Try Storefront', 'woocommerce' );
$utm_content = 'nostorefront';
}
@ -133,6 +133,6 @@ class WC_Admin_Addons {
$theme = wp_get_theme();
$section_keys = array_keys( $sections );
$current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys );
include_once( 'views/html-admin-page-addons.php' );
include_once( dirname( __FILE__ ) . '/views/html-admin-page-addons.php' );
}
}

View File

@ -36,12 +36,12 @@ class WC_Admin_Assets {
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
$jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
$jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.11.4';
// 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', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
wp_register_style( 'jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.min.css', array(), $jquery_version );
wp_register_style( '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' );
@ -277,7 +277,7 @@ class WC_Admin_Assets {
'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
'rounding_precision' => WC_ROUNDING_PRECISION,
'rounding_precision' => wc_get_rounding_precision(),
'tax_rounding_mode' => WC_TAX_ROUNDING_MODE,
'product_types' => array_unique( array_merge( array( 'simple', 'grouped', 'variable', 'external' ), array_keys( wc_get_product_types() ) ) ),
'i18n_download_permission_fail' => __( 'Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.', 'woocommerce' ),

View File

@ -271,6 +271,7 @@ class WC_Admin_Attributes {
<form action="edit.php?post_type=product&amp;page=product_attributes&amp;edit=<?php echo absint( $edit ); ?>" method="post">
<table class="form-table">
<tbody>
<?php do_action( 'woocommerce_before_edit_attribute_fields' ); ?>
<tr class="form-field form-required">
<th scope="row" valign="top">
<label for="attribute_label"><?php _e( 'Name', 'woocommerce' ); ?></label>
@ -309,7 +310,6 @@ class WC_Admin_Attributes {
<?php endforeach; ?>
<?php
/**
* Deprecated action in favor of product_attributes_type_selector filter.
*
@ -335,6 +335,7 @@ class WC_Admin_Attributes {
<p class="description"><?php _e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p>
</td>
</tr>
<?php do_action( 'woocommerce_after_edit_attribute_fields' ) ?>
</tbody>
</table>
<p class="submit"><input type="submit" name="save_attribute" id="submit" class="button-primary" value="<?php esc_attr_e( 'Update', 'woocommerce' ); ?>"></p>
@ -374,7 +375,6 @@ class WC_Admin_Attributes {
if ( $attribute_taxonomies = wc_get_attribute_taxonomies() ) :
foreach ( $attribute_taxonomies as $tax ) :
?><tr>
<td>
<strong><a href="edit-tags.php?taxonomy=<?php echo esc_html( wc_attribute_taxonomy_name( $tax->attribute_name ) ); ?>&amp;post_type=product"><?php echo esc_html( $tax->attribute_label ); ?></a></strong>
@ -440,6 +440,8 @@ class WC_Admin_Attributes {
<h2><?php _e( 'Add New Attribute', 'woocommerce' ); ?></h2>
<p><?php _e( 'Attributes let you define extra product data, such as size or colour. You can use these attributes in the shop sidebar using the "layered nav" widgets. Please note: you cannot rename an attribute later on.', 'woocommerce' ); ?></p>
<form action="edit.php?post_type=product&amp;page=product_attributes" method="post">
<?php do_action( 'woocommerce_before_add_attribute_fields' ) ?>
<div class="form-field">
<label for="attribute_label"><?php _e( 'Name', 'woocommerce' ); ?></label>
<input name="attribute_label" id="attribute_label" type="text" value="" />
@ -489,6 +491,8 @@ class WC_Admin_Attributes {
<p class="description"><?php _e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p>
</div>
<?php do_action( 'woocommerce_after_add_attribute_fields' ) ?>
<p class="submit"><input type="submit" name="add_new_attribute" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Add Attribute', 'woocommerce' ); ?>"></p>
<?php wp_nonce_field( 'woocommerce-add-new_attribute' ); ?>
</form>

View File

@ -46,8 +46,8 @@ class WC_Admin_Dashboard {
public function status_widget() {
global $wpdb;
include_once( 'reports/class-wc-admin-report.php' );
include_once( 'reports/class-wc-report-sales-by-date.php' );
include_once( dirname( __FILE__ ) . '/reports/class-wc-admin-report.php' );
include_once( dirname( __FILE__ ) . '/reports/class-wc-report-sales-by-date.php' );
$reports = new WC_Admin_Report();
$sales_by_date = new WC_Report_Sales_By_Date();

View File

@ -123,13 +123,15 @@ class WC_Admin_Duplicate_Product {
$new_post_date_gmt = get_gmt_from_date( $new_post_date );
if ( $parent > 0 ) {
$post_parent = $parent;
$post_status = $post_status ? $post_status : 'publish';
$suffix = '';
$post_parent = $parent;
$post_status = $post_status ? $post_status: 'publish';
$suffix = '';
$post_title = $post->post_title;
} else {
$post_parent = $post->post_parent;
$post_status = $post_status ? $post_status : 'draft';
$suffix = ' ' . __( '(Copy)', 'woocommerce' );
$post_parent = $post->post_parent;
$post_status = $post_status ? $post_status: 'draft';
$suffix = ' ' . __( '(Copy)', 'woocommerce' );
$post_title = $post->post_title . $suffix;
}
// Insert the new template in the post table
@ -141,7 +143,7 @@ class WC_Admin_Duplicate_Product {
'post_date_gmt' => $new_post_date_gmt,
'post_content' => $post->post_content,
'post_content_filtered' => $post->post_content_filtered,
'post_title' => $post->post_title . $suffix,
'post_title' => $post_title,
'post_excerpt' => $post->post_excerpt,
'post_status' => $post_status,
'post_type' => $post->post_type,
@ -160,6 +162,34 @@ class WC_Admin_Duplicate_Product {
$new_post_id = $wpdb->insert_id;
// Set title for variations
if ( 'product_variation' === $post->post_type ) {
$post_title = sprintf( __( 'Variation #%s of %s', 'woocommerce' ), absint( $new_post_id ), esc_html( get_the_title( $post_parent ) ) );
$wpdb->update(
$wpdb->posts,
array(
'post_title' => $post_title,
),
array(
'ID' => $new_post_id
)
);
}
// Set name and GUID
if ( ! in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) {
$wpdb->update(
$wpdb->posts,
array(
'post_name' => wp_unique_post_slug( sanitize_title( $post_title, $new_post_id ), $new_post_id, $post_status, $post->post_type, $post_parent ),
'guid' => get_permalink( $new_post_id ),
),
array(
'ID' => $new_post_id
)
);
}
// Copy the taxonomies
$this->duplicate_post_taxonomies( $post->ID, $new_post_id, $post->post_type );
@ -175,6 +205,9 @@ class WC_Admin_Duplicate_Product {
}
}
// Clear cache
clean_post_cache( $new_post_id );
return $new_post_id;
}
@ -197,7 +230,7 @@ class WC_Admin_Duplicate_Product {
$post = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE ID=$id" );
if ( isset( $post->post_type ) && $post->post_type == "revision" ) {
if ( isset( $post->post_type ) && 'revision' === $post->post_type ) {
$id = $post->post_parent;
$post = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE ID=$id" );
}

View File

@ -171,7 +171,7 @@ class WC_Admin_Help {
'id' => 'woocommerce_101_tab',
'title' => __( 'WooCommerce 101', 'woocommerce' ),
'content' =>
'<h2><a href="https://docs.woothemes.com/document/woocommerce-101-video-series/?utm_source=helptab&utm_medium=product&utm_content=videos&utm_campaign=woocommerceplugin">' . __( 'WooCommerce 101', 'woocommerce' ) . '</a> &ndash; ' . esc_html( $video_map[ $video_key ]['title'] ) . '</h2>' .
'<h2><a href="https://docs.woocommerce.com/document/woocommerce-101-video-series/?utm_source=helptab&utm_medium=product&utm_content=videos&utm_campaign=woocommerceplugin">' . __( 'WooCommerce 101', 'woocommerce' ) . '</a> &ndash; ' . esc_html( $video_map[ $video_key ]['title'] ) . '</h2>' .
'<iframe data-src="' . esc_url( $video_map[ $video_key ]['url'] ) . '" src="" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="480" height="298"></iframe>'
) );
}
@ -183,18 +183,18 @@ class WC_Admin_Help {
'<h2>' . __( 'Help &amp; Support', 'woocommerce' ) . '</h2>' .
'<p>' . sprintf(
__( 'Should you need help understanding, using, or extending WooCommerce, %splease read our documentation%s. You will find all kinds of resources including snippets, tutorials and much more.' , 'woocommerce' ),
'<a href="https://docs.woothemes.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin">',
'<a href="https://docs.woocommerce.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin">',
'</a>'
) . '</p>' .
'<p>' . sprintf(
__( 'For further assistance with WooCommerce core you can use the %scommunity forum%s. If you need help with premium add-ons sold by WooThemes, please %suse our helpdesk%s.', 'woocommerce' ),
'<a href="https://wordpress.org/support/plugin/woocommerce">',
'</a>',
'<a href="https://www.woothemes.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin">',
'<a href="https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin">',
'</a>'
) . '</p>' .
'<p>' . __( 'Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce' ) . '</p>' .
'<p><a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button button-primary">' . __( 'System Status', 'woocommerce' ) . '</a> <a href="' . 'https://wordpress.org/support/plugin/woocommerce' . '" class="button">' . __( 'Community Forum', 'woocommerce' ) . '</a> <a href="' . 'https://www.woothemes.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin' . '" class="button">' . __( 'WooThemes Helpdesk', 'woocommerce' ) . '</a></p>'
'<p><a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button button-primary">' . __( 'System Status', 'woocommerce' ) . '</a> <a href="' . 'https://wordpress.org/support/plugin/woocommerce' . '" class="button">' . __( 'Community Forum', 'woocommerce' ) . '</a> <a href="' . 'https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin' . '" class="button">' . __( 'WooThemes Helpdesk', 'woocommerce' ) . '</a></p>'
) );
$screen->add_help_tab( array(
@ -212,8 +212,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 ran by one of our educational partners.', 'woocommerce' ) . '</p>' .
'<p><a href="' . 'https://www.woothemes.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 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>'
) );
$screen->add_help_tab( array(
@ -228,11 +228,11 @@ class WC_Admin_Help {
$screen->set_help_sidebar(
'<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></p>' .
'<p><a href="' . 'https://www.woothemes.com/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=about&utm_campaign=woocommerceplugin' . '" target="_blank">' . __( 'About WooCommerce', 'woocommerce' ) . '</a></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/extend/plugins/woocommerce/' . '" target="_blank">' . __( 'WordPress.org Project', 'woocommerce' ) . '</a></p>' .
'<p><a href="' . 'https://github.com/woothemes/woocommerce' . '" target="_blank">' . __( 'Github Project', 'woocommerce' ) . '</a></p>' .
'<p><a href="' . 'https://www.woothemes.com/product-category/themes/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin' . '" target="_blank">' . __( 'Official Themes', 'woocommerce' ) . '</a></p>' .
'<p><a href="' . 'https://www.woothemes.com/product-category/woocommerce-extensions/?utm_source=helptab&utm_medium=product&utm_content=wcextensions&utm_campaign=woocommerceplugin' . '" target="_blank">' . __( 'Official Extensions', 'woocommerce' ) . '</a></p>'
'<p><a href="' . 'https://woocommerce.com/product-category/themes/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin' . '" target="_blank">' . __( 'Official Themes', '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>'
);
}

View File

@ -50,7 +50,7 @@ class WC_Admin_Importers {
}
// includes
require 'importers/class-wc-tax-rate-importer.php';
require( dirname( __FILE__ ) . '/importers/class-wc-tax-rate-importer.php' );
// Dispatch
$importer = new WC_Tax_Rate_Importer();

View File

@ -190,8 +190,8 @@ class WC_Admin_Permalink_Settings {
}
// This is an invalid base structure and breaks pages.
if ( '%product_cat%' == $product_permalink ) {
$product_permalink = '/' . _x( 'product', 'slug', 'woocommerce' ) . '/' . $product_permalink;
if ( '/%product_cat%' === $product_permalink ) {
$product_permalink = '/' . _x( 'product', 'slug', 'woocommerce' ) . $product_permalink;
}
} elseif ( empty( $product_permalink ) ) {
$product_permalink = false;

View File

@ -93,7 +93,7 @@ class WC_Admin_Post_Types {
}
// Meta-Box Class
include_once( 'class-wc-admin-meta-boxes.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-meta-boxes.php' );
// Download permissions
add_action( 'woocommerce_process_product_file_download_paths', array( $this, 'process_product_file_download_paths' ), 10, 3 );
@ -650,7 +650,7 @@ class WC_Admin_Post_Types {
$item_meta = new WC_Order_Item_Meta( $item, $product );
$item_meta_html = $item_meta->display( true, true );
?>
<tr class="<?php echo apply_filters( 'woocommerce_admin_order_item_class', '', $item ); ?>">
<tr class="<?php echo apply_filters( 'woocommerce_admin_order_item_class', '', $item, $the_order ); ?>">
<td class="qty"><?php echo absint( $item['qty'] ); ?></td>
<td class="name">
<?php if ( $product ) : ?>
@ -2273,13 +2273,13 @@ class WC_Admin_Post_Types {
case 'shop_order' :
?>
<h2 class="woocommerce-BlankState-message"><?php _e( 'When you receive a new order, it will appear here.', 'woocommerce' ); ?></h2>
<a class="woocommerce-BlankState-cta button-primary button" target="_blank" href="https://docs.woothemes.com/document/managing-orders/?utm_source=blankslate&utm_medium=product&utm_content=ordersdoc&utm_campaign=woocommerceplugin"><?php _e( 'Learn more about orders', 'woocommerce' ); ?></a>
<a class="woocommerce-BlankState-cta button-primary button" target="_blank" href="https://docs.woocommerce.com/document/managing-orders/?utm_source=blankslate&utm_medium=product&utm_content=ordersdoc&utm_campaign=woocommerceplugin"><?php _e( 'Learn more about orders', 'woocommerce' ); ?></a>
<?php
break;
case 'shop_coupon' :
?>
<h2 class="woocommerce-BlankState-message"><?php _e( 'Coupons are a great way to offer discounts and rewards to your customers. They will appear here once created.', 'woocommerce' ); ?></h2>
<a class="woocommerce-BlankState-cta button-primary button" target="_blank" href="https://docs.woothemes.com/document/coupon-management/?utm_source=blankslate&utm_medium=product&utm_content=couponsdoc&utm_campaign=woocommerceplugin"><?php _e( 'Learn more about coupons', 'woocommerce' ); ?></a>
<a class="woocommerce-BlankState-cta button-primary button" target="_blank" href="https://docs.woocommerce.com/document/coupon-management/?utm_source=blankslate&utm_medium=product&utm_content=couponsdoc&utm_campaign=woocommerceplugin"><?php _e( 'Learn more about coupons', 'woocommerce' ); ?></a>
<?php
break;
case 'product' :

View File

@ -153,7 +153,7 @@ class WC_Admin_Profile {
foreach ( $show_fields as $fieldset ) :
?>
<h3><?php echo $fieldset['title']; ?></h3>
<h2><?php echo $fieldset['title']; ?></h2>
<table class="form-table">
<?php
foreach ( $fieldset['fields'] as $key => $field ) :

View File

@ -30,8 +30,8 @@ class WC_Admin_Reports {
$current_tab = ! empty( $_GET['tab'] ) ? sanitize_title( $_GET['tab'] ) : $first_tab[0];
$current_report = isset( $_GET['report'] ) ? sanitize_title( $_GET['report'] ) : current( array_keys( $reports[ $current_tab ]['reports'] ) );
include_once( 'reports/class-wc-admin-report.php' );
include_once( 'views/html-admin-page-reports.php' );
include_once( dirname( __FILE__ ) . '/reports/class-wc-admin-report.php' );
include_once( dirname( __FILE__ ) . '/views/html-admin-page-reports.php' );
}
/**

View File

@ -47,7 +47,7 @@ class WC_Admin_Settings {
if ( empty( self::$settings ) ) {
$settings = array();
include_once( 'settings/class-wc-settings-page.php' );
include_once( dirname( __FILE__ ) . '/settings/class-wc-settings-page.php' );
$settings[] = include( 'settings/class-wc-settings-general.php' );
$settings[] = include( 'settings/class-wc-settings-products.php' );
@ -166,7 +166,7 @@ class WC_Admin_Settings {
// Get tabs for the settings page
$tabs = apply_filters( 'woocommerce_settings_tabs_array', array() );
include 'views/html-admin-settings.php';
include( dirname( __FILE__ ) . '/views/html-admin-settings.php' );
}
/**
@ -662,10 +662,14 @@ class WC_Admin_Settings {
* Loops though the woocommerce options array and outputs each field.
*
* @param array $options Options array to output
* @param array $data Optional. Data to use for saving. Defaults to $_POST.
* @return bool
*/
public static function save_fields( $options ) {
if ( empty( $_POST ) ) {
public static function save_fields( $options, $data = null ) {
if ( is_null( $data ) ) {
$data = $_POST;
}
if ( empty( $data ) ) {
return false;
}
@ -683,17 +687,17 @@ class WC_Admin_Settings {
parse_str( $option['id'], $option_name_array );
$option_name = current( array_keys( $option_name_array ) );
$setting_name = key( $option_name_array[ $option_name ] );
$raw_value = isset( $_POST[ $option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $option_name ][ $setting_name ] ) : null;
$raw_value = isset( $data[ $option_name ][ $setting_name ] ) ? wp_unslash( $data[ $option_name ][ $setting_name ] ) : null;
} else {
$option_name = $option['id'];
$setting_name = '';
$raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null;
$raw_value = isset( $data[ $option['id'] ] ) ? wp_unslash( $data[ $option['id'] ] ) : null;
}
// Format the value based on option type.
switch ( $option['type'] ) {
case 'checkbox' :
$value = is_null( $raw_value ) ? 'no' : 'yes';
$value = '1' === $raw_value || 'yes' === $raw_value ? 'yes' : 'no';
break;
case 'textarea' :
$value = wp_kses_post( trim( $raw_value ) );
@ -714,6 +718,15 @@ class WC_Admin_Settings {
$value['crop'] = $option['default']['crop'];
}
break;
case 'select':
$allowed_values = empty( $option['options'] ) ? array() : array_keys( $option['options'] );
if ( empty( $option['default'] ) && empty( $allowed_values ) ) {
$value = null;
break;
}
$default = ( empty( $option['default'] ) ? $allowed_values[0] : $option['default'] );
$value = in_array( $raw_value, $allowed_values ) ? $raw_value : $default;
break;
default :
$value = wc_clean( $raw_value );
break;

View File

@ -313,7 +313,7 @@ class WC_Admin_Setup_Wizard {
}
?>
</select>
<span class="description"><?php printf( __( 'If your currency is not listed you can %sadd it later%s.', 'woocommerce' ), '<a href="https://docs.woothemes.com/document/add-a-custom-currency-symbol/" target="_blank">', '</a>' ); ?></span>
<span class="description"><?php printf( __( 'If your currency is not listed you can %sadd it later%s.', 'woocommerce' ), '<a href="https://docs.woocommerce.com/document/add-a-custom-currency-symbol/" target="_blank">', '</a>' ); ?></span>
</td>
</tr>
<tr>
@ -456,7 +456,7 @@ class WC_Admin_Setup_Wizard {
?>
<tr class="tax-rates">
<td colspan="2">
<p><?php printf( __( 'The following tax rates will be imported automatically for you. You can read more about taxes in %1$sour documentation%2$s.', 'woocommerce' ), '<a href="https://docs.woothemes.com/document/setting-up-taxes-in-woocommerce/" target="_blank">', '</a>' ); ?></p>
<p><?php printf( __( 'The following tax rates will be imported automatically for you. You can read more about taxes in %1$sour documentation%2$s.', 'woocommerce' ), '<a href="https://docs.woocommerce.com/document/setting-up-taxes-in-woocommerce/" target="_blank">', '</a>' ); ?></p>
<div class="importing-tax-rates">
<table class="tax-rates">
<thead>
@ -483,7 +483,7 @@ class WC_Admin_Setup_Wizard {
</tbody>
</table>
</div>
<p class="description"><?php printf( __( 'You may you need to add/edit rates based on your products or business location which can be done from the %1$stax settings%2$s screen. If in doubt, speak to an accountant.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=tax' ) . '" target="_blank">', '</a>' ); ?></p>
<p class="description"><?php printf( __( 'You may need to add/edit rates based on your products or business location which can be done from the %1$stax settings%2$s screen. If in doubt, speak to an accountant.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=tax' ) . '" target="_blank">', '</a>' ); ?></p>
</td>
</tr>
<?php
@ -606,13 +606,13 @@ class WC_Admin_Setup_Wizard {
),
'bacs' => array(
'name' => __( 'Bank Transfer (BACS) Payments', 'woocommerce' ),
'description' => __( 'An simple offline gateway that lets you accept BACS payment.', 'woocommerce' ),
'description' => __( 'A simple offline gateway that lets you accept BACS payment.', 'woocommerce' ),
'image' => '',
'class' => '',
),
'cod' => array(
'name' => __( 'Cash on Delivery', 'woocommerce' ),
'description' => __( 'An simple offline gateway that lets you accept cash on delivery.', 'woocommerce' ),
'description' => __( 'A simple offline gateway that lets you accept cash on delivery.', 'woocommerce' ),
'image' => '',
'class' => '',
)
@ -745,14 +745,14 @@ class WC_Admin_Setup_Wizard {
$this->wc_setup_ready_actions();
shuffle( $this->tweets );
?>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="https://www.woothemes.com/woocommerce/" data-text="<?php echo esc_attr( $this->tweets[0] ); ?>" data-via="WooThemes" data-size="large">Tweet</a>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="https://woocommerce.com/" data-text="<?php echo esc_attr( $this->tweets[0] ); ?>" data-via="WooThemes" data-size="large">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<h1><?php _e( 'Your Store is Ready!', 'woocommerce' ); ?></h1>
<?php if ( 'unknown' === get_option( 'woocommerce_allow_tracking', 'unknown' ) ) : ?>
<div class="woocommerce-message woocommerce-tracker">
<p><?php printf( __( 'Want to help make WooCommerce even more awesome? Allow WooThemes to collect non-sensitive diagnostic data and usage information. %sFind out more%s.', 'woocommerce' ), '<a href="https://www.woothemes.com/woocommerce/usage-tracking/" target="_blank">', '</a>' ); ?></p>
<p><?php printf( __( 'Want to help make WooCommerce even more awesome? Allow WooThemes to collect non-sensitive diagnostic data and usage information. %sFind out more%s.', 'woocommerce' ), '<a href="https://woocommerce.com/usage-tracking/" target="_blank">', '</a>' ); ?></p>
<p class="submit">
<a class="button-primary button button-large" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc_tracker_optin', 'true' ), 'wc_tracker_optin', 'wc_tracker_nonce' ) ); ?>"><?php _e( 'Allow', 'woocommerce' ); ?></a>
<a class="button-secondary button button-large skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc_tracker_optout', 'true' ), 'wc_tracker_optout', 'wc_tracker_nonce' ) ); ?>"><?php _e( 'No thanks', 'woocommerce' ); ?></a>
@ -770,9 +770,9 @@ class WC_Admin_Setup_Wizard {
<div class="wc-setup-next-steps-last">
<h2><?php _e( 'Learn More', 'woocommerce' ); ?></h2>
<ul>
<li class="video-walkthrough"><a href="https://docs.woothemes.com/document/woocommerce-101-video-series/?utm_source=setupwizard&utm_medium=product&utm_content=videos&utm_campaign=woocommerceplugin"><?php _e( 'Watch the WC 101 video walkthroughs', 'woocommerce' ); ?></a></li>
<li class="newsletter"><a href="https://www.woothemes.com/woocommerce-onboarding-email/?utm_source=setupwizard&utm_medium=product&utm_content=newsletter&utm_campaign=woocommerceplugin"><?php _e( 'Get eCommerce advice in your inbox', 'woocommerce' ); ?></a></li>
<li class="learn-more"><a href="https://docs.woothemes.com/documentation/plugins/woocommerce/getting-started/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin"><?php _e( 'Learn more about getting started', 'woocommerce' ); ?></a></li>
<li class="video-walkthrough"><a href="https://docs.woocommerce.com/document/woocommerce-101-video-series/?utm_source=setupwizard&utm_medium=product&utm_content=videos&utm_campaign=woocommerceplugin"><?php _e( 'Watch the WC 101 video walkthroughs', 'woocommerce' ); ?></a></li>
<li class="newsletter"><a href="https://woocommerce.com/woocommerce-onboarding-email/?utm_source=setupwizard&utm_medium=product&utm_content=newsletter&utm_campaign=woocommerceplugin"><?php _e( 'Get eCommerce advice in your inbox', 'woocommerce' ); ?></a></li>
<li class="learn-more"><a href="https://docs.woocommerce.com/documentation/plugins/woocommerce/getting-started/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin"><?php _e( 'Learn more about getting started', 'woocommerce' ); ?></a></li>
</ul>
</div>
</div>

View File

@ -21,14 +21,14 @@ class WC_Admin_Status {
* Handles output of the reports page in admin.
*/
public static function output() {
include_once( 'views/html-admin-page-status.php' );
include_once( dirname( __FILE__ ) . '/views/html-admin-page-status.php' );
}
/**
* Handles output of report.
*/
public static function status_report() {
include_once( 'views/html-admin-page-status-report.php' );
include_once( dirname( __FILE__ ) . '/views/html-admin-page-status-report.php' );
}
/**
@ -138,7 +138,7 @@ class WC_Admin_Status {
echo '<div class="updated inline"><p>' . __( 'Your changes have been saved.', 'woocommerce' ) . '</p></div>';
}
include_once( 'views/html-admin-page-status-tools.php' );
include_once( dirname( __FILE__ ) . '/views/html-admin-page-status-tools.php' );
}
/**
@ -205,6 +205,12 @@ class WC_Admin_Status {
$viewed_log = current( $logs );
}
$handle = ! empty( $viewed_log ) ? self::get_log_file_handle( $viewed_log ) : '';
if ( ! empty( $_REQUEST[ 'handle' ] ) ) {
self::remove_log();
}
include_once( 'views/html-admin-page-status-logs.php' );
}
@ -240,6 +246,16 @@ class WC_Admin_Status {
return $version ;
}
/**
* Return the log file handle.
*
* @param string $filename
* @return string
*/
public static function get_log_file_handle( $filename ) {
return substr( $filename, 0, strlen( $filename ) > 37 ? strlen( $filename ) - 37 : strlen( $filename ) - 4 );
}
/**
* Scan the template files.
* @param string $template_path
@ -342,4 +358,21 @@ class WC_Admin_Status {
return $update_theme_version;
}
/**
* Remove/delete the chosen file.
*/
public static function remove_log() {
if ( empty( $_REQUEST[ '_wpnonce' ] ) || ! wp_verify_nonce( $_REQUEST[ '_wpnonce' ], 'remove_log' ) ) {
wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
}
if ( ! empty( $_REQUEST[ 'handle' ] ) ) {
$logger = new WC_Logger();
$logger->remove( $_REQUEST[ 'handle' ] );
}
wp_safe_redirect( esc_url_raw( admin_url( 'admin.php?page=wc-status&tab=logs' ) ) );
exit();
}
}

View File

@ -357,11 +357,9 @@ class WC_Admin_Taxonomies {
* @return array
*/
public function disable_checked_ontop( $args ) {
if ( 'product_cat' == $args['taxonomy'] ) {
if ( ! empty( $args['taxonomy'] ) && 'product_cat' === $args['taxonomy'] ) {
$args['checked_ontop'] = false;
}
return $args;
}
}

View File

@ -80,7 +80,7 @@ class WC_Admin_Webhooks {
* @param WC_Webhook $webhook
*/
private function update_secret( $webhook ) {
$secret = ! empty( $_POST['webhook_secret'] ) ? $_POST['webhook_secret'] : wc_webhook_generate_secret();
$secret = ! empty( $_POST['webhook_secret'] ) ? $_POST['webhook_secret'] : wp_generate_password( 50, true, true );
$webhook->set_secret( $secret );
}
@ -442,7 +442,7 @@ class WC_Admin_Webhooks {
add_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_webhook_comments' ), 10, 1 );
if ( $logs ) {
include_once( 'settings/views/html-webhook-logs.php' );
include_once( dirname( __FILE__ ) . '/settings/views/html-webhook-logs.php' );
} else {
echo '<p>' . __( 'This Webhook has no log yet.', 'woocommerce' ) . '</p>';
}

View File

@ -43,34 +43,34 @@ class WC_Admin {
* Include any classes we need within admin.
*/
public function includes() {
include_once( 'wc-admin-functions.php' );
include_once( 'wc-meta-box-functions.php' );
include_once( 'class-wc-admin-post-types.php' );
include_once( 'class-wc-admin-taxonomies.php' );
include_once( 'class-wc-admin-menus.php' );
include_once( 'class-wc-admin-notices.php' );
include_once( 'class-wc-admin-assets.php' );
include_once( 'class-wc-admin-api-keys.php' );
include_once( 'class-wc-admin-webhooks.php' );
include_once( 'class-wc-admin-pointers.php' );
include_once( dirname( __FILE__ ) . '/wc-admin-functions.php' );
include_once( dirname( __FILE__ ) . '/wc-meta-box-functions.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-post-types.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-taxonomies.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-menus.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-notices.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-assets.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-api-keys.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-webhooks.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-pointers.php' );
// Help Tabs
if ( apply_filters( 'woocommerce_enable_admin_help_tab', true ) ) {
include_once( 'class-wc-admin-help.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-help.php' );
}
// Setup/welcome
if ( ! empty( $_GET['page'] ) ) {
switch ( $_GET['page'] ) {
case 'wc-setup' :
include_once( 'class-wc-admin-setup-wizard.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-setup-wizard.php' );
break;
}
}
// Importers
if ( defined( 'WP_LOAD_IMPORTERS' ) ) {
include_once( 'class-wc-admin-importers.php' );
include_once( dirname( __FILE__ ) . '/class-wc-admin-importers.php' );
}
}
@ -226,7 +226,7 @@ class WC_Admin {
if ( isset( $current_screen->id ) && apply_filters( 'woocommerce_display_admin_footer_text', in_array( $current_screen->id, $wc_pages ) ) ) {
// Change the footer text
if ( ! get_option( 'woocommerce_admin_footer_text_rated' ) ) {
$footer_text = sprintf( __( 'If you like <strong>WooCommerce</strong> please leave us a %s&#9733;&#9733;&#9733;&#9733;&#9733;%s rating. A huge thank you from WooThemes in advance!', 'woocommerce' ), '<a href="https://wordpress.org/support/view/plugin-reviews/woocommerce?filter=5#postform" target="_blank" class="wc-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'woocommerce' ) . '">', '</a>' );
$footer_text = sprintf( __( 'If you like <strong>WooCommerce</strong> please leave us a %s&#9733;&#9733;&#9733;&#9733;&#9733;%s rating. A huge thanks in advance!', 'woocommerce' ), '<a href="https://wordpress.org/support/view/plugin-reviews/woocommerce?filter=5#postform" target="_blank" class="wc-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'woocommerce' ) . '">', '</a>' );
wc_enqueue_js( "
jQuery( 'a.wc-rating-link' ).click( function() {
jQuery.post( '" . WC()->ajax_url() . "', { action: 'woocommerce_rated' } );

View File

@ -70,7 +70,7 @@ class WC_Meta_Box_Coupon_Data {
woocommerce_wp_text_input( array( 'id' => 'coupon_amount', 'label' => __( 'Coupon amount', 'woocommerce' ), 'placeholder' => wc_format_localized_price( 0 ), 'description' => __( 'Value of the coupon.', 'woocommerce' ), 'data_type' => 'price', 'desc_tip' => true ) );
// Free Shipping
woocommerce_wp_checkbox( array( 'id' => 'free_shipping', 'label' => __( 'Allow free shipping', 'woocommerce' ), 'description' => sprintf( __( 'Check this box if the coupon grants free shipping. The <a href="%s">free shipping method</a> must be enabled and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce' ), admin_url('admin.php?page=wc-settings&tab=shipping&section=WC_Shipping_Free_Shipping')) ) );
woocommerce_wp_checkbox( array( 'id' => 'free_shipping', 'label' => __( 'Allow free shipping', 'woocommerce' ), 'description' => sprintf( __( 'Check this box if the coupon grants free shipping. A <a href="%s">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/' ) ) );
// Expiry date
woocommerce_wp_text_input( array( 'id' => 'expiry_date', 'label' => __( 'Coupon expiry date', 'woocommerce' ), 'placeholder' => _x( 'YYYY-MM-DD', 'placeholder', 'woocommerce' ), 'description' => '', 'class' => 'date-picker', 'custom_attributes' => array( 'pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" ) ) );

View File

@ -197,7 +197,7 @@ class WC_Meta_Box_Order_Data {
<h3><?php _e( 'General Details', 'woocommerce' ); ?></h3>
<p class="form-field form-field-wide"><label for="order_date"><?php _e( 'Order date:', 'woocommerce' ) ?></label>
<input type="text" class="date-picker" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="text" class="hour" placeholder="<?php esc_attr_e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="text" class="minute" placeholder="<?php esc_attr_e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="[0-5]{1}[0-9]{1}" />
<input type="text" class="date-picker" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="number" class="hour" placeholder="<?php esc_attr_e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" min="0" max="23" step="1" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php esc_attr_e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" min="0" max="59" step="1" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="[0-5]{1}[0-9]{1}" />
</p>
<p class="form-field form-field-wide wc-order-status"><label for="order_status"><?php _e( 'Order status:', 'woocommerce' ) ?> <?php

View File

@ -88,7 +88,7 @@ class WC_Meta_Box_Product_Data {
'inventory' => array(
'label' => __( 'Inventory', 'woocommerce' ),
'target' => 'inventory_product_data',
'class' => array( 'show_if_simple', 'show_if_variable', 'show_if_grouped' ),
'class' => array( 'show_if_simple', 'show_if_variable', 'show_if_grouped', 'show_if_external' ),
),
'shipping' => array(
'label' => __( 'Shipping', 'woocommerce' ),
@ -118,7 +118,7 @@ class WC_Meta_Box_Product_Data {
) );
foreach ( $product_data_tabs as $key => $tab ) {
?><li class="<?php echo $key; ?>_options <?php echo $key; ?>_tab <?php echo implode( ' ' , $tab['class'] ); ?>">
?><li class="<?php echo $key; ?>_options <?php echo $key; ?>_tab <?php echo implode( ' ' , (array) $tab['class'] ); ?>">
<a href="#<?php echo $tab['target']; ?>"><?php echo esc_html( $tab['label'] ); ?></a>
</li><?php
}
@ -324,7 +324,7 @@ class WC_Meta_Box_Product_Data {
}
// Stock status
woocommerce_wp_select( array( 'id' => '_stock_status', 'wrapper_class' => 'hide_if_variable', 'label' => __( 'Stock status', 'woocommerce' ), 'options' => array(
woocommerce_wp_select( array( 'id' => '_stock_status', 'wrapper_class' => 'hide_if_variable hide_if_external', 'label' => __( 'Stock status', 'woocommerce' ), 'options' => array(
'instock' => __( 'In stock', 'woocommerce' ),
'outofstock' => __( 'Out of stock', 'woocommerce' )
), 'desc_tip' => true, 'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ) ) );
@ -613,7 +613,7 @@ class WC_Meta_Box_Product_Data {
<div id="message" class="inline notice woocommerce-message">
<p><?php _e( 'Before you can add a variation you need to add some variation attributes on the <strong>Attributes</strong> tab.', 'woocommerce' ); ?></p>
<p>
<a class="button-primary" href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'https://docs.woothemes.com/document/variable-product/', 'product-variations' ) ); ?>" target="_blank"><?php _e( 'Learn more', 'woocommerce' ); ?></a>
<a class="button-primary" href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'https://docs.woocommerce.com/document/variable-product/', 'product-variations' ) ); ?>" target="_blank"><?php _e( 'Learn more', 'woocommerce' ); ?></a>
</p>
</div>

View File

@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) {
?>
<div class="wc-metabox closed">
<h3 class="fixed">
<button type="button" rel="<?php echo absint( $download->product_id ) . ',' . esc_attr( $download->download_id ); ?>" class="revoke_access button"><?php _e( 'Revoke Access', 'woocommerce' ); ?></button>
<button type="button" data-permission_id="<?php echo absint( $download->permission_id ); ?>" rel="<?php echo absint( $download->product_id ) . ',' . esc_attr( $download->download_id ); ?>" class="revoke_access button"><?php _e( 'Revoke Access', 'woocommerce' ); ?></button>
<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'woocommerce' ); ?>"></div>
<strong>
<?php echo '#' . absint( $product->id ) . ' &mdash; ' . apply_filters( 'woocommerce_admin_download_permissions_title', $product->get_title(), $download->product_id, $download->order_id, $download->order_key, $download->download_id ) . ' &mdash; ' . esc_html( $file_count ) . ': ' . wc_get_filename_from_url( $product->get_file_download_path( $download->download_id ) ) . ' &mdash; ' . sprintf( _n( 'Downloaded %s time', 'Downloaded %s times', absint( $download->download_count ), 'woocommerce'), absint( $download->download_count ) ); ?>

View File

@ -1,94 +1,94 @@
<div class="view">
<?php
global $wpdb;
<?php
global $wpdb;
if ( $metadata = $order->has_meta( $item_id ) ) {
echo '<table cellspacing="0" class="display_meta">';
foreach ( $metadata as $meta ) {
if ( $metadata = $order->has_meta( $item_id ) ) {
echo '<table cellspacing="0" class="display_meta">';
foreach ( $metadata as $meta ) {
// Skip hidden core fields
if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost'
) ) ) ) {
continue;
}
// Skip hidden core fields
if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost'
) ) ) ) {
continue;
}
// Skip serialised meta
if ( is_serialized( $meta['meta_value'] ) ) {
continue;
}
// Skip serialised meta
if ( is_serialized( $meta['meta_value'] ) ) {
continue;
}
// Get attribute data
if ( taxonomy_exists( wc_sanitize_taxonomy_name( $meta['meta_key'] ) ) ) {
$term = get_term_by( 'slug', $meta['meta_value'], wc_sanitize_taxonomy_name( $meta['meta_key'] ) );
$meta['meta_key'] = wc_attribute_label( wc_sanitize_taxonomy_name( $meta['meta_key'] ) );
$meta['meta_value'] = isset( $term->name ) ? $term->name : $meta['meta_value'];
} else {
$meta['meta_key'] = wc_attribute_label( $meta['meta_key'], $_product );
}
// Get attribute data
if ( taxonomy_exists( wc_sanitize_taxonomy_name( $meta['meta_key'] ) ) ) {
$term = get_term_by( 'slug', $meta['meta_value'], wc_sanitize_taxonomy_name( $meta['meta_key'] ) );
$meta['meta_key'] = wc_attribute_label( wc_sanitize_taxonomy_name( $meta['meta_key'] ) );
$meta['meta_value'] = isset( $term->name ) ? $term->name : $meta['meta_value'];
} else {
$meta['meta_key'] = wc_attribute_label( $meta['meta_key'], $_product );
}
echo '<tr><th>' . wp_kses_post( rawurldecode( $meta['meta_key'] ) ) . ':</th><td>' . wp_kses_post( wpautop( make_clickable( rawurldecode( $meta['meta_value'] ) ) ) ) . '</td></tr>';
}
echo '</table>';
}
?>
echo '<tr><th>' . wp_kses_post( rawurldecode( $meta['meta_key'] ) ) . ':</th><td>' . wp_kses_post( wpautop( make_clickable( rawurldecode( $meta['meta_value'] ) ) ) ) . '</td></tr>';
}
echo '</table>';
}
?>
</div>
<div class="edit" style="display: none;">
<table class="meta" cellspacing="0">
<tbody class="meta_items">
<?php
if ( $metadata = $order->has_meta( $item_id )) {
foreach ( $metadata as $meta ) {
<table class="meta" cellspacing="0">
<tbody class="meta_items">
<?php
if ( $metadata = $order->has_meta( $item_id )) {
foreach ( $metadata as $meta ) {
// Skip hidden core fields
if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost'
) ) ) ) {
continue;
}
// Skip hidden core fields
if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost'
) ) ) ) {
continue;
}
// Skip serialised meta
if ( is_serialized( $meta['meta_value'] ) ) {
continue;
}
// Skip serialised meta
if ( is_serialized( $meta['meta_value'] ) ) {
continue;
}
$meta['meta_key'] = rawurldecode( $meta['meta_key'] );
$meta['meta_value'] = esc_textarea( rawurldecode( $meta['meta_value'] ) ); // using a <textarea />
$meta['meta_id'] = absint( $meta['meta_id'] );
$meta['meta_key'] = rawurldecode( $meta['meta_key'] );
$meta['meta_value'] = esc_textarea( rawurldecode( $meta['meta_value'] ) ); // using a <textarea />
$meta['meta_id'] = absint( $meta['meta_id'] );
echo '<tr data-meta_id="' . esc_attr( $meta['meta_id'] ) . '">
<td>
<input type="text" name="meta_key[' . $meta['meta_id'] . ']" value="' . esc_attr( $meta['meta_key'] ) . '" />
<textarea name="meta_value[' . $meta['meta_id'] . ']">' . $meta['meta_value'] . '</textarea>
</td>
<td width="1%"><button class="remove_order_item_meta button">&times;</button></td>
</tr>';
}
}
?>
</tbody>
<tfoot>
<tr>
<td colspan="4"><button class="add_order_item_meta button"><?php _e( 'Add&nbsp;meta', 'woocommerce' ); ?></button></td>
</tr>
</tfoot>
</table>
echo '<tr data-meta_id="' . esc_attr( $meta['meta_id'] ) . '">
<td>
<input type="text" name="meta_key[' . $meta['meta_id'] . ']" value="' . esc_attr( $meta['meta_key'] ) . '" />
<textarea name="meta_value[' . $meta['meta_id'] . ']">' . $meta['meta_value'] . '</textarea>
</td>
<td width="1%"><button class="remove_order_item_meta button">&times;</button></td>
</tr>';
}
}
?>
</tbody>
<tfoot>
<tr>
<td colspan="4"><button class="add_order_item_meta button"><?php _e( 'Add&nbsp;meta', 'woocommerce' ); ?></button></td>
</tr>
</tfoot>
</table>
</div>

View File

@ -15,7 +15,7 @@ $tax_data = empty( $legacy_order ) && wc_tax_enabled() ? maybe_unserialize(
$item_total = ( isset( $item['line_total'] ) ) ? esc_attr( wc_format_localized_price( $item['line_total'] ) ) : '';
$item_subtotal = ( isset( $item['line_subtotal'] ) ) ? esc_attr( wc_format_localized_price( $item['line_subtotal'] ) ) : '';
?>
<tr class="item <?php echo apply_filters( 'woocommerce_admin_html_order_item_class', ( ! empty( $class ) ? $class : '' ), $item ); ?>" data-order_item_id="<?php echo $item_id; ?>">
<tr class="item <?php echo apply_filters( 'woocommerce_admin_html_order_item_class', ( ! empty( $class ) ? $class : '' ), $item, $order ); ?>" data-order_item_id="<?php echo $item_id; ?>">
<td class="thumb">
<?php
echo '<div class="wc-order-item-thumbnail">' . wp_kses_post( $thumbnail ) . '</div>';

View File

@ -120,6 +120,7 @@ if ( wc_tax_enabled() ) {
<button type="button" class="button bulk-delete-items"><?php _e( 'Delete selected row(s)', 'woocommerce' ); ?></button>
<button type="button" class="button bulk-decrease-stock"><?php _e( 'Reduce stock', 'woocommerce' ); ?></button>
<button type="button" class="button bulk-increase-stock"><?php _e( 'Increase stock', 'woocommerce' ); ?></button>
<?php do_action( 'woocommerce_admin_order_item_bulk_actions', $order ); ?>
</div>
<div class="wc-order-data-row wc-order-totals-items wc-order-items-editable">
<?php

View File

@ -242,14 +242,14 @@ class WC_Admin_Report {
$key = is_array( $value['meta_key'] ) ? $value['meta_key'][0] . '_array' : $value['meta_key'];
if ( strtolower( $value['operator'] ) == 'in' ) {
if ( strtolower( $value['operator'] ) == 'in' || strtolower( $value['operator'] ) == 'not in' ) {
if ( is_array( $value['meta_value'] ) ) {
$value['meta_value'] = implode( "','", $value['meta_value'] );
}
if ( ! empty( $value['meta_value'] ) ) {
$where_value = "IN ('{$value['meta_value']}')";
$where_value = "{$value['operator']} ('{$value['meta_value']}')";
}
} else {
$where_value = "{$value['operator']} '{$value['meta_value']}'";
@ -289,14 +289,14 @@ class WC_Admin_Report {
foreach ( $where as $value ) {
if ( strtolower( $value['operator'] ) == 'in' ) {
if ( strtolower( $value['operator'] ) == 'in' || strtolower( $value['operator'] ) == 'not in' ) {
if ( is_array( $value['value'] ) ) {
$value['value'] = implode( "','", $value['value'] );
}
if ( ! empty( $value['value'] ) ) {
$where_value = "IN ('{$value['value']}')";
$where_value = "{$value['operator']} ('{$value['value']}')";
}
} else {
$where_value = "{$value['operator']} '{$value['value']}'";

View File

@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
if ( ! class_exists( 'WC_Report_Stock' ) ) {
require_once( 'class-wc-report-stock.php' );
require_once( dirname( __FILE__ ) . '/class-wc-report-stock.php' );
}
/**

View File

@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
if ( ! class_exists( 'WC_Report_Stock' ) ) {
require_once( 'class-wc-report-stock.php' );
require_once( dirname( __FILE__ ) . '/class-wc-report-stock.php' );
}
/**

View File

@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
if ( ! class_exists( 'WC_Report_Stock' ) ) {
require_once( 'class-wc-report-stock.php' );
require_once( dirname( __FILE__ ) . '/class-wc-report-stock.php' );
}
/**

View File

@ -105,13 +105,13 @@ class WC_Settings_Accounts extends WC_Settings_Page {
'autoload' => false
),
array( 'type' => 'sectionend', 'id' => 'account_registration_options'),
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.', 'woocommerce' ), 'id' => 'account_endpoint_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 &rarr; Orders page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account &rarr; %s page', 'woocommerce' ), __( 'Orders', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_orders_endpoint',
'type' => 'text',
'default' => 'orders',
@ -120,7 +120,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'View Order', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account &rarr; View Order page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account &rarr; %s page', 'woocommerce' ), __( 'View Order', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_view_order_endpoint',
'type' => 'text',
'default' => 'view-order',
@ -129,7 +129,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'Downloads', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account &rarr; Downloads page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account &rarr; %s page', 'woocommerce' ), __( 'Downloads', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_downloads_endpoint',
'type' => 'text',
'default' => 'downloads',
@ -138,7 +138,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'Edit Account', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account &rarr; Edit Account page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account &rarr; %s page', 'woocommerce' ), __( 'Edit Account', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_edit_account_endpoint',
'type' => 'text',
'default' => 'edit-account',
@ -147,7 +147,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'Addresses', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account &rarr; Addresses page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account &rarr; %s page', 'woocommerce' ), __( 'Addresses', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_edit_address_endpoint',
'type' => 'text',
'default' => 'edit-address',
@ -156,7 +156,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'Payment Methods', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account &rarr; Payment Methods page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account &rarr; %s page', 'woocommerce' ), __( 'Payment Methods', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_payment_methods_endpoint',
'type' => 'text',
'default' => 'payment-methods',
@ -165,7 +165,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'Lost Password', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account &rarr; Lost Password page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account &rarr; %s page', 'woocommerce' ), __( 'Lost Password', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_lost_password_endpoint',
'type' => 'text',
'default' => 'lost-password',

View File

@ -317,7 +317,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
case 'name' :
$method_title = $gateway->get_title() ? $gateway->get_title() : __( '(no title)', 'woocommerce' );
echo '<td class="name">
<a href="' . admin_url( 'admin.php?page=wc-settings&tab=checkout&section=' . strtolower( get_class( $gateway ) ) ) . '">' . esc_html( $method_title ) . '</a>
<a href="' . admin_url( 'admin.php?page=wc-settings&tab=checkout&section=' . strtolower( $gateway->id ) ) . '">' . esc_html( $method_title ) . '</a>
</td>';
break;

View File

@ -43,6 +43,24 @@ abstract class WC_Settings_Page {
add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) );
}
/**
* Get settings page ID.
* @since 2.7.0
* @return string
*/
public function get_id() {
return $this->id;
}
/**
* Get settings page label.
* @since 2.7.0
* @return string
*/
public function get_label() {
return $this->label;
}
/**
* Add this page to settings.
*/

View File

@ -181,7 +181,7 @@ class WC_Settings_Products extends WC_Settings_Page {
array(
'title' => __( 'Catalog Images', 'woocommerce' ),
'desc' => __( 'This size is usually used in product listings', 'woocommerce' ),
'desc' => __( 'This size is usually used in product listings. (W x H)', 'woocommerce' ),
'id' => 'shop_catalog_image_size',
'css' => '',
'type' => 'image_width',
@ -195,7 +195,7 @@ class WC_Settings_Products extends WC_Settings_Page {
array(
'title' => __( 'Single Product Image', 'woocommerce' ),
'desc' => __( 'This is the size used by the main image on the product page.', 'woocommerce' ),
'desc' => __( 'This is the size used by the main image on the product page. (W x H)', 'woocommerce' ),
'id' => 'shop_single_image_size',
'css' => '',
'type' => 'image_width',
@ -209,7 +209,7 @@ class WC_Settings_Products extends WC_Settings_Page {
array(
'title' => __( 'Product Thumbnails', 'woocommerce' ),
'desc' => __( 'This size is usually used for the gallery of images on the product page.', 'woocommerce' ),
'desc' => __( 'This size is usually used for the gallery of images on the product page. (W x H)', 'woocommerce' ),
'id' => 'shop_thumbnail_image_size',
'css' => '',
'type' => 'image_width',
@ -301,7 +301,7 @@ class WC_Settings_Products extends WC_Settings_Page {
array(
'title' => __( 'Low Stock Threshold', 'woocommerce' ),
'desc' => '',
'desc' => __( 'When product stock reaches this amount you will be notified via email.', 'woocommerce' ),
'id' => 'woocommerce_notify_low_stock_amount',
'css' => 'width:50px;',
'type' => 'number',
@ -310,12 +310,13 @@ class WC_Settings_Products extends WC_Settings_Page {
'step' => 1
),
'default' => '2',
'autoload' => false
'autoload' => false,
'desc_tip' => true,
),
array(
'title' => __( 'Out Of Stock Threshold', 'woocommerce' ),
'desc' => '',
'desc' => __( 'When product stock reaches this amount the stock status will change to "out of stock" and you will be notified via email. This setting does not affect existing "in stock" products.', 'woocommerce' ),
'id' => 'woocommerce_notify_no_stock_amount',
'css' => 'width:50px;',
'type' => 'number',
@ -323,7 +324,8 @@ class WC_Settings_Products extends WC_Settings_Page {
'min' => 0,
'step' => 1
),
'default' => '0'
'default' => '0',
'desc_tip' => true,
),
array(

View File

@ -217,7 +217,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
) );
wp_enqueue_script( 'wc-shipping-zone-methods' );
include_once( 'views/html-admin-page-shipping-zone-methods.php' );
include_once( dirname( __FILE__ ) . '/views/html-admin-page-shipping-zone-methods.php' );
}
/**
@ -246,7 +246,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
) );
wp_enqueue_script( 'wc-shipping-zones' );
include_once( 'views/html-admin-page-shipping-zones.php' );
include_once( dirname( __FILE__ ) . '/views/html-admin-page-shipping-zones.php' );
}
/**
@ -277,7 +277,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
$shipping_method->display_errors();
}
include_once( 'views/html-admin-page-shipping-zones-instance.php' );
include_once( dirname( __FILE__ ) . '/views/html-admin-page-shipping-zones-instance.php' );
}
/**
@ -308,7 +308,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
'wc-shipping-class-count' => __( 'Product Count', 'woocommerce' ),
) );
include_once( 'views/html-admin-page-shipping-classes.php' );
include_once( dirname( __FILE__ ) . '/views/html-admin-page-shipping-classes.php' );
}
}

View File

@ -38,7 +38,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<td class="wc-shipping-zone-method-blank-state" colspan="5">
<p class="main"><?php _e( 'Add shipping methods to this zone', 'woocommerce' ); ?></p>
<p><?php _e( 'You can add multiple shipping methods within this zone. Only customers within the zone will see them.', 'woocommerce' ); ?></p>
<p><?php _e( 'Choose a method from the dropdown below and click "Add shipping method" to get started.', 'woocommerce' ); ?></p>
<p><?php _e( 'Click "Add shipping method" to get started.', 'woocommerce' ); ?></p>
</td>
</tr>
</script>
@ -106,7 +106,8 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( ! $method->supports( 'shipping-zones' ) ) {
continue;
}
echo '<option data-description="' . esc_attr( $method->method_description ) . '" value="' . esc_attr( $method->id ) . '">' . esc_attr( $method->title ) . '</li>';
echo '<option data-description="' . esc_attr( $method->method_description ) . '" value="' . esc_attr( $method->id ) . '">' . esc_attr( $method->method_title ) . '</li>';
}
?>
</select>

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