Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Ninos Ego 2014-09-10 01:00:18 +02:00
commit 46b786c14f
87 changed files with 1474 additions and 466 deletions

3
.coveralls.yml Normal file
View File

@ -0,0 +1,3 @@
src_dir: .
coverage_clover: ./tmp/clover.xml
json_path: ./tmp/coveralls-upload.json

11
.scrutinizer.yml Normal file
View File

@ -0,0 +1,11 @@
filter:
excluded_paths:
- tests/*
- apigen/*
- includes/api/v1/*
- includes/libraries/*
checks:
php:
code_rating: true
duplication: true

View File

@ -14,6 +14,10 @@ matrix:
env: WP_VERSION=latest WP_MULTISITE=0 env: WP_VERSION=latest WP_MULTISITE=0
before_script: before_script:
- bash tests/install-wp-tests.sh woocommerce_test root '' localhost $WP_VERSION - bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION
- bash tests/bin/travis.sh before
script: phpunit script: phpunit -c phpunit.xml.dist
after_script:
- bash tests/bin/travis.sh after

View File

@ -1,4 +1,4 @@
# [WooCommerce](http://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.png?branch=master)](http://travis-ci.org/woothemes/woocommerce) # [WooCommerce](http://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)](http://travis-ci.org/woothemes/woocommerce) [![Coverage Status](https://img.shields.io/coveralls/woothemes/woocommerce.svg)](https://coveralls.io/r/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](http://develop.woothemes.com/woocommerce/) 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. 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](http://develop.woothemes.com/woocommerce/) 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.
@ -7,11 +7,10 @@ If you are not a developer, please use the [WooCommerce plugin page](http://word
## Support ## Support
This repository is not suitable for support. Please don't use our issue tracker for support requests, but for core WooCommerce issues only. Support can take place in the appropriate channels: This repository is not suitable for support. Please don't use our issue tracker for support requests, but for core WooCommerce issues only. Support can take place in the appropriate channels:
* The [public support forums](http://wordpress.org/support/plugin/woocommerce) on WordPress.org, where the community can help each other out.
* The [WooThemes premium support portal](http://support.woothemes.com/) for customers who have purchased themes or extensions. * The [WooThemes premium support portal](http://support.woothemes.com/) for customers who have purchased themes or extensions.
* [Our public HelpDesk](https://support.woothemes.com/hc/communities/public/topics) which is available for all WooCommerce users.
Support requests in issues on this repository will be closed on sight. Support requests in issues on this repository will be closed on sight.
## Contributing to WooCommerce ## Contributing to WooCommerce
If you have a patch, or stumbled upon an issue with WooCommerce core, you can contribute this back to the code. Please read our [contributor guidelines](https://github.com/woothemes/woocommerce/blob/master/CONTRIBUTING.md) for more information how you can do this. If you have a patch, or stumbled upon an issue with WooCommerce core, you can contribute this back to the code. Please read our [contributor guidelines](https://github.com/woothemes/woocommerce/blob/master/CONTRIBUTING.md) for more information how you can do this.

View File

@ -186,15 +186,16 @@ jQuery( function ( $ ) {
// When the refund qty is changed, increase or decrease costs // When the refund qty is changed, increase or decrease costs
.on( 'change', '.woocommerce_order_items input.refund_order_item_qty', function() { .on( 'change', '.woocommerce_order_items input.refund_order_item_qty', function() {
var $row = $( this ).closest( 'tr.item' ); var $row = $( this ).closest( 'tr.item' );
var qty = $( this ).val(); var qty = $row.find( 'input.quantity' ).val();
var o_qty = $row.find( 'input.quantity' ).attr( 'data-qty' ); var refund_qty = $( this ).val();
var line_total = $( 'input.line_total', $row ); var line_total = $( 'input.line_total', $row );
var refund_line_total = $( 'input.refund_line_total', $row ); var refund_line_total = $( 'input.refund_line_total', $row );
// Totals // Totals
var unit_total = accounting.unformat( line_total.attr( 'data-total' ), woocommerce_admin.mon_decimal_point ); var unit_total = accounting.unformat( line_total.attr( 'data-total' ), woocommerce_admin.mon_decimal_point ) / qty;
refund_line_total.val( refund_line_total.val(
parseFloat( accounting.formatNumber( unit_total * qty, woocommerce_admin_meta_boxes.rounding_precision, '' ) ) parseFloat( accounting.formatNumber( unit_total * refund_qty, woocommerce_admin_meta_boxes.rounding_precision, '' ) )
.toString() .toString()
.replace( '.', woocommerce_admin.mon_decimal_point ) .replace( '.', woocommerce_admin.mon_decimal_point )
); );
@ -203,10 +204,11 @@ jQuery( function ( $ ) {
$( 'td.line_tax', $row ).each( function() { $( 'td.line_tax', $row ).each( function() {
var line_total_tax = $( 'input.line_tax', $( this ) ); var line_total_tax = $( 'input.line_tax', $( this ) );
var refund_line_total_tax = $( 'input.refund_line_tax', $( this ) ); var refund_line_total_tax = $( 'input.refund_line_tax', $( this ) );
var unit_total_tax = accounting.unformat( line_total_tax.attr( 'data-total_tax' ), woocommerce_admin.mon_decimal_point ); var unit_total_tax = accounting.unformat( line_total_tax.attr( 'data-total_tax' ), woocommerce_admin.mon_decimal_point ) / qty;
if ( 0 < unit_total_tax ) { if ( 0 < unit_total_tax ) {
refund_line_total_tax.val( refund_line_total_tax.val(
parseFloat( accounting.formatNumber( unit_total_tax * qty, woocommerce_admin_meta_boxes.rounding_precision, '' ) ) parseFloat( accounting.formatNumber( unit_total_tax * refund_qty, woocommerce_admin_meta_boxes.rounding_precision, '' ) )
.toString() .toString()
.replace( '.', woocommerce_admin.mon_decimal_point ) .replace( '.', woocommerce_admin.mon_decimal_point )
); );

File diff suppressed because one or more lines are too long

View File

@ -2,16 +2,16 @@
# This file is distributed under the same license as the WooCommerce package. # This file is distributed under the same license as the WooCommerce package.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WooCommerce 2.2.0-bleeding Admin\n" "Project-Id-Version: WooCommerce 2.2.0-RC1 Admin\n"
"Report-Msgid-Bugs-To: https://github.com/woothemes/woocommerce/issues\n" "Report-Msgid-Bugs-To: https://github.com/woothemes/woocommerce/issues\n"
"POT-Creation-Date: 2014-09-04 14:14:15+00:00\n" "POT-Creation-Date: 2014-09-08 15:44:12+00:00\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
"X-Generator: grunt-wp-i18n 0.4.7\n" "X-Generator: grunt-wp-i18n 0.4.8\n"
#. Plugin Name of the plugin/theme #. Plugin Name of the plugin/theme
msgid "WooCommerce" msgid "WooCommerce"
@ -205,7 +205,7 @@ msgstr ""
#: includes/admin/class-wc-admin-assets.php:186 #: includes/admin/class-wc-admin-assets.php:186
#: includes/admin/class-wc-admin-post-types.php:122 #: includes/admin/class-wc-admin-post-types.php:122
#: includes/admin/class-wc-admin-post-types.php:1952 #: includes/admin/class-wc-admin-post-types.php:1954
#: includes/admin/views/html-bulk-edit-product.php:181 #: includes/admin/views/html-bulk-edit-product.php:181
#: includes/admin/views/html-quick-edit-product.php:139 #: includes/admin/views/html-quick-edit-product.php:139
msgid "Featured" msgid "Featured"
@ -343,7 +343,7 @@ msgstr ""
#: includes/admin/class-wc-admin-attributes.php:321 #: includes/admin/class-wc-admin-attributes.php:321
#: includes/admin/class-wc-admin-post-types.php:211 #: includes/admin/class-wc-admin-post-types.php:211
#: includes/admin/class-wc-admin-post-types.php:1956 #: includes/admin/class-wc-admin-post-types.php:1958
#: includes/admin/meta-boxes/class-wc-meta-box-order-data.php:215 #: includes/admin/meta-boxes/class-wc-meta-box-order-data.php:215
#: includes/admin/meta-boxes/class-wc-meta-box-order-data.php:294 #: includes/admin/meta-boxes/class-wc-meta-box-order-data.php:294
#: includes/admin/meta-boxes/views/html-order-items.php:202 #: includes/admin/meta-boxes/views/html-order-items.php:202
@ -488,9 +488,9 @@ msgstr ""
#: includes/admin/class-wc-admin-help.php:52 #: includes/admin/class-wc-admin-help.php:52
msgid "" msgid ""
"After <a href=\"%s\">reading the documentation</a>, for further assistance " "After %sreading the documentation%s, for further assistance you can use our "
"you can use the <a href=\"%s\">community forum</a>, or if you have access " "%scommunity forum%s if you get stuck. For help with premium add-ons from "
"as a WooThemes customer, <a href=\"%s\">our support desk</a>." "WooThemes, or if you are a WooThemes customer, you can %suse our helpdesk%s."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-help.php:54 #: includes/admin/class-wc-admin-help.php:54
@ -508,11 +508,11 @@ msgid "System Status"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-help.php:56 #: includes/admin/class-wc-admin-help.php:56
msgid "Community Support" msgid "WooThemes Community Support"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-help.php:56 #: includes/admin/class-wc-admin-help.php:56
msgid "Customer Support" msgid "WooThemes Customer Support"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-help.php:62 #: includes/admin/class-wc-admin-help.php:62
@ -880,14 +880,14 @@ msgid "External/Affiliate"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:286 #: includes/admin/class-wc-admin-post-types.php:286
#: includes/admin/class-wc-admin-post-types.php:1408 #: includes/admin/class-wc-admin-post-types.php:1410
#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:57 #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:57
#: includes/admin/meta-boxes/views/html-variation-admin.php:235 #: includes/admin/meta-boxes/views/html-variation-admin.php:235
msgid "Virtual" msgid "Virtual"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:288 #: includes/admin/class-wc-admin-post-types.php:288
#: includes/admin/class-wc-admin-post-types.php:1400 #: includes/admin/class-wc-admin-post-types.php:1402
#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:64 #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:64
#: includes/admin/meta-boxes/views/html-variation-admin.php:233 #: includes/admin/meta-boxes/views/html-variation-admin.php:233
msgid "Downloadable" msgid "Downloadable"
@ -1028,247 +1028,247 @@ msgstr ""
msgid "Sort Products" msgid "Sort Products"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1136 #: includes/admin/class-wc-admin-post-types.php:1138
#: includes/admin/class-wc-admin-post-types.php:1137 #: includes/admin/class-wc-admin-post-types.php:1139
msgid "Mark processing" msgid "Mark processing"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1139 #: includes/admin/class-wc-admin-post-types.php:1141
#: includes/admin/class-wc-admin-post-types.php:1140 #: includes/admin/class-wc-admin-post-types.php:1142
msgid "Mark on-hold" msgid "Mark on-hold"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1142 #: includes/admin/class-wc-admin-post-types.php:1144
#: includes/admin/class-wc-admin-post-types.php:1143 #: includes/admin/class-wc-admin-post-types.php:1145
msgid "Mark complete" msgid "Mark complete"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1184 #: includes/admin/class-wc-admin-post-types.php:1186
msgid "Order status changed by bulk edit:" msgid "Order status changed by bulk edit:"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1206 #: includes/admin/class-wc-admin-post-types.php:1208
msgid "Order status changed." msgid "Order status changed."
msgid_plural "%s order statuses changed." msgid_plural "%s order statuses changed."
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: includes/admin/class-wc-admin-post-types.php:1360 #: includes/admin/class-wc-admin-post-types.php:1362
msgid "Show all product types" msgid "Show all product types"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1373 #: includes/admin/class-wc-admin-post-types.php:1375
#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:40 #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:40
msgid "Grouped product" msgid "Grouped product"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1376 #: includes/admin/class-wc-admin-post-types.php:1378
#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:41 #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:41
msgid "External/Affiliate product" msgid "External/Affiliate product"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1379 #: includes/admin/class-wc-admin-post-types.php:1381
#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:42 #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:42
msgid "Variable product" msgid "Variable product"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1382 #: includes/admin/class-wc-admin-post-types.php:1384
#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:39 #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:39
msgid "Simple product" msgid "Simple product"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1423 #: includes/admin/class-wc-admin-post-types.php:1425
msgid "Show all types" msgid "Show all types"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1451 #: includes/admin/class-wc-admin-post-types.php:1453
#: includes/admin/class-wc-admin-post-types.php:1473 #: includes/admin/class-wc-admin-post-types.php:1475
msgid "Show all customers" msgid "Show all customers"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1630 #: includes/admin/class-wc-admin-post-types.php:1632
msgid "Product updated. <a href=\"%s\">View Product</a>" msgid "Product updated. <a href=\"%s\">View Product</a>"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1631 #: includes/admin/class-wc-admin-post-types.php:1633
#: includes/admin/class-wc-admin-post-types.php:1646 #: includes/admin/class-wc-admin-post-types.php:1648
#: includes/admin/class-wc-admin-post-types.php:1661 #: includes/admin/class-wc-admin-post-types.php:1663
msgid "Custom field updated." msgid "Custom field updated."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1632 #: includes/admin/class-wc-admin-post-types.php:1634
#: includes/admin/class-wc-admin-post-types.php:1647 #: includes/admin/class-wc-admin-post-types.php:1649
#: includes/admin/class-wc-admin-post-types.php:1662 #: includes/admin/class-wc-admin-post-types.php:1664
msgid "Custom field deleted." msgid "Custom field deleted."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1633 #: includes/admin/class-wc-admin-post-types.php:1635
msgid "Product updated." msgid "Product updated."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1634 #: includes/admin/class-wc-admin-post-types.php:1636
msgid "Product restored to revision from %s" msgid "Product restored to revision from %s"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1635 #: includes/admin/class-wc-admin-post-types.php:1637
msgid "Product published. <a href=\"%s\">View Product</a>" msgid "Product published. <a href=\"%s\">View Product</a>"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1636 #: includes/admin/class-wc-admin-post-types.php:1638
msgid "Product saved." msgid "Product saved."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1637 #: includes/admin/class-wc-admin-post-types.php:1639
msgid "Product submitted. <a target=\"_blank\" href=\"%s\">Preview Product</a>" msgid "Product submitted. <a target=\"_blank\" href=\"%s\">Preview Product</a>"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1638 #: includes/admin/class-wc-admin-post-types.php:1640
msgid "" msgid ""
"Product scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" " "Product scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" "
"href=\"%2$s\">Preview Product</a>" "href=\"%2$s\">Preview Product</a>"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1639 #: includes/admin/class-wc-admin-post-types.php:1641
#: includes/admin/class-wc-admin-post-types.php:1654 #: includes/admin/class-wc-admin-post-types.php:1656
#: includes/admin/class-wc-admin-post-types.php:1669 #: includes/admin/class-wc-admin-post-types.php:1671
msgid "M j, Y @ G:i" msgid "M j, Y @ G:i"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1640 #: includes/admin/class-wc-admin-post-types.php:1642
msgid "Product draft updated. <a target=\"_blank\" href=\"%s\">Preview Product</a>" msgid "Product draft updated. <a target=\"_blank\" href=\"%s\">Preview Product</a>"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1645 #: includes/admin/class-wc-admin-post-types.php:1647
#: includes/admin/class-wc-admin-post-types.php:1648
#: includes/admin/class-wc-admin-post-types.php:1650 #: includes/admin/class-wc-admin-post-types.php:1650
#: includes/admin/class-wc-admin-post-types.php:1652
msgid "Order updated." msgid "Order updated."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1649 #: includes/admin/class-wc-admin-post-types.php:1651
msgid "Order restored to revision from %s" msgid "Order restored to revision from %s"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1651 #: includes/admin/class-wc-admin-post-types.php:1653
msgid "Order saved." msgid "Order saved."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1652 #: includes/admin/class-wc-admin-post-types.php:1654
msgid "Order submitted." msgid "Order submitted."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1653 #: includes/admin/class-wc-admin-post-types.php:1655
msgid "Order scheduled for: <strong>%1$s</strong>." msgid "Order scheduled for: <strong>%1$s</strong>."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1655 #: includes/admin/class-wc-admin-post-types.php:1657
msgid "Order draft updated." msgid "Order draft updated."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1660 #: includes/admin/class-wc-admin-post-types.php:1662
#: includes/admin/class-wc-admin-post-types.php:1663
#: includes/admin/class-wc-admin-post-types.php:1665 #: includes/admin/class-wc-admin-post-types.php:1665
#: includes/admin/class-wc-admin-post-types.php:1667
msgid "Coupon updated." msgid "Coupon updated."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1664 #: includes/admin/class-wc-admin-post-types.php:1666
msgid "Coupon restored to revision from %s" msgid "Coupon restored to revision from %s"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1666 #: includes/admin/class-wc-admin-post-types.php:1668
msgid "Coupon saved." msgid "Coupon saved."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1667 #: includes/admin/class-wc-admin-post-types.php:1669
msgid "Coupon submitted." msgid "Coupon submitted."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1668 #: includes/admin/class-wc-admin-post-types.php:1670
msgid "Coupon scheduled for: <strong>%1$s</strong>." msgid "Coupon scheduled for: <strong>%1$s</strong>."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1670 #: includes/admin/class-wc-admin-post-types.php:1672
msgid "Coupon draft updated." msgid "Coupon draft updated."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1852 #: includes/admin/class-wc-admin-post-types.php:1854
msgid "Product Image" msgid "Product Image"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1854 #: includes/admin/class-wc-admin-post-types.php:1856
msgid "Remove product image" msgid "Remove product image"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1856 #: includes/admin/class-wc-admin-post-types.php:1858
#: includes/admin/class-wc-admin-post-types.php:1870 #: includes/admin/class-wc-admin-post-types.php:1872
#: includes/admin/class-wc-admin-post-types.php:1871 #: includes/admin/class-wc-admin-post-types.php:1873
msgid "Set product image" msgid "Set product image"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1884 #: includes/admin/class-wc-admin-post-types.php:1886
msgid "Product name" msgid "Product name"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1887 #: includes/admin/class-wc-admin-post-types.php:1889
msgid "Coupon code" msgid "Coupon code"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1900 #: includes/admin/class-wc-admin-post-types.php:1902
msgid "Description (optional)" msgid "Description (optional)"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1917 #: includes/admin/class-wc-admin-post-types.php:1919
msgid "Insert into %s" msgid "Insert into %s"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1918 #: includes/admin/class-wc-admin-post-types.php:1920
msgid "Uploaded to this %s" msgid "Uploaded to this %s"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1941 #: includes/admin/class-wc-admin-post-types.php:1943
msgid "Catalog/search" msgid "Catalog/search"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1942 #: includes/admin/class-wc-admin-post-types.php:1944
#: includes/admin/views/html-bulk-edit-product.php:169 #: includes/admin/views/html-bulk-edit-product.php:169
#: includes/admin/views/html-quick-edit-product.php:126 #: includes/admin/views/html-quick-edit-product.php:126
msgid "Catalog" msgid "Catalog"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1943 #: includes/admin/class-wc-admin-post-types.php:1945
#: includes/admin/views/html-bulk-edit-product.php:170 #: includes/admin/views/html-bulk-edit-product.php:170
#: includes/admin/views/html-quick-edit-product.php:127 #: includes/admin/views/html-quick-edit-product.php:127
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1944 #: includes/admin/class-wc-admin-post-types.php:1946
#: includes/admin/views/html-bulk-edit-product.php:171 #: includes/admin/views/html-bulk-edit-product.php:171
#: includes/admin/views/html-quick-edit-product.php:128 #: includes/admin/views/html-quick-edit-product.php:128
msgid "Hidden" msgid "Hidden"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1948 #: includes/admin/class-wc-admin-post-types.php:1950
msgid "Catalog visibility:" msgid "Catalog visibility:"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1964 #: includes/admin/class-wc-admin-post-types.php:1966
msgid "" msgid ""
"Define the loops this product should be visible in. The product will still " "Define the loops this product should be visible in. The product will still "
"be accessible directly." "be accessible directly."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1970 #: includes/admin/class-wc-admin-post-types.php:1972
msgid "Enable this option to feature this product." msgid "Enable this option to feature this product."
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1972 #: includes/admin/class-wc-admin-post-types.php:1974
msgid "Featured Product" msgid "Featured Product"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1975 #: includes/admin/class-wc-admin-post-types.php:1977
msgid "OK" msgid "OK"
msgstr "" msgstr ""
#: includes/admin/class-wc-admin-post-types.php:1976 #: includes/admin/class-wc-admin-post-types.php:1978
#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:177 #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:177
#: includes/admin/meta-boxes/views/html-order-items.php:234 #: includes/admin/meta-boxes/views/html-order-items.php:234
#: includes/admin/meta-boxes/views/html-order-items.php:273 #: includes/admin/meta-boxes/views/html-order-items.php:273

View File

@ -2,16 +2,16 @@
# This file is distributed under the same license as the WooCommerce package. # This file is distributed under the same license as the WooCommerce package.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WooCommerce 2.2.0-bleeding Frontend\n" "Project-Id-Version: WooCommerce 2.2.0-RC1 Frontend\n"
"Report-Msgid-Bugs-To: https://github.com/woothemes/woocommerce/issues\n" "Report-Msgid-Bugs-To: https://github.com/woothemes/woocommerce/issues\n"
"POT-Creation-Date: 2014-09-04 14:14:15+00:00\n" "POT-Creation-Date: 2014-09-08 15:44:12+00:00\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
"X-Generator: grunt-wp-i18n 0.4.7\n" "X-Generator: grunt-wp-i18n 0.4.8\n"
#: i18n/countries.php:16 #: i18n/countries.php:16
msgid "Afghanistan" msgid "Afghanistan"
@ -4203,42 +4203,42 @@ msgstr ""
msgid "Backordered" msgid "Backordered"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:1614 #: includes/abstracts/abstract-wc-order.php:1613
msgid "&nbsp;<small>%svia %s</small>" msgid "&nbsp;<small>%svia %s</small>"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:1619 #: includes/abstracts/abstract-wc-order.php:1618
#: includes/abstracts/abstract-wc-product.php:883 #: includes/abstracts/abstract-wc-product.php:884
#: includes/abstracts/abstract-wc-product.php:889 #: includes/abstracts/abstract-wc-product.php:890
#: includes/class-wc-cart.php:1438 includes/class-wc-product-variation.php:289 #: includes/class-wc-cart.php:1438 includes/class-wc-product-variation.php:289
msgid "Free!" msgid "Free!"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:1681 #: includes/abstracts/abstract-wc-order.php:1680
msgid "Cart Subtotal:" msgid "Cart Subtotal:"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:1688 #: includes/abstracts/abstract-wc-order.php:1687
msgid "Cart Discount:" msgid "Cart Discount:"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:1695 #: includes/abstracts/abstract-wc-order.php:1694
msgid "Shipping:" msgid "Shipping:"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:1748 #: includes/abstracts/abstract-wc-order.php:1747
msgid "Order Discount:" msgid "Order Discount:"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:1755 #: includes/abstracts/abstract-wc-order.php:1754
msgid "Payment Method:" msgid "Payment Method:"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:1761 #: includes/abstracts/abstract-wc-order.php:1760
msgid "Order Total:" msgid "Order Total:"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:1781 #: includes/abstracts/abstract-wc-order.php:1780
#: includes/wc-cart-functions.php:250 #: includes/wc-cart-functions.php:250
msgid "(Includes %s)" msgid "(Includes %s)"
msgstr "" msgstr ""
@ -4247,16 +4247,16 @@ msgstr ""
msgid "WooCommerce" msgid "WooCommerce"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:2073 #: includes/abstracts/abstract-wc-order.php:2072
msgid "Order status changed from %s to %s." msgid "Order status changed from %s to %s."
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:2336 #: includes/abstracts/abstract-wc-order.php:2335
#: includes/class-wc-ajax.php:1161 includes/class-wc-ajax.php:1162 #: includes/class-wc-ajax.php:1161 includes/class-wc-ajax.php:1162
msgid "Item #%s stock reduced from %s to %s." msgid "Item #%s stock reduced from %s to %s."
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:2346 #: includes/abstracts/abstract-wc-order.php:2345
msgid "Order item stock reduced successfully." msgid "Order item stock reduced successfully."
msgstr "" msgstr ""
@ -4281,60 +4281,60 @@ msgstr ""
msgid "CVC" msgid "CVC"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-product.php:468 #: includes/abstracts/abstract-wc-product.php:469
#: includes/class-wc-product-simple.php:48 #: includes/class-wc-product-simple.php:48
#: includes/class-wc-product-variation.php:197 #: includes/class-wc-product-variation.php:197
msgid "Add to cart" msgid "Add to cart"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-product.php:477 #: includes/abstracts/abstract-wc-product.php:478
msgid "Read more" msgid "Read more"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-product.php:558 #: includes/abstracts/abstract-wc-product.php:559
#: includes/abstracts/abstract-wc-product.php:569 #: includes/abstracts/abstract-wc-product.php:570
#: includes/abstracts/abstract-wc-product.php:591 #: includes/abstracts/abstract-wc-product.php:592
#: includes/class-wc-ajax.php:624 includes/class-wc-product-variation.php:507 #: includes/class-wc-ajax.php:624 includes/class-wc-product-variation.php:507
#: includes/class-wc-product-variation.php:517 #: includes/class-wc-product-variation.php:517
#: includes/class-wc-product-variation.php:533 #: includes/class-wc-product-variation.php:533
msgid "In stock" msgid "In stock"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-product.php:563 #: includes/abstracts/abstract-wc-product.php:564
#: includes/class-wc-product-variation.php:511 #: includes/class-wc-product-variation.php:511
msgid "Only %s left in stock" msgid "Only %s left in stock"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-product.php:566 #: includes/abstracts/abstract-wc-product.php:567
#: includes/abstracts/abstract-wc-product.php:577 #: includes/abstracts/abstract-wc-product.php:578
#: includes/class-wc-product-variation.php:514 #: includes/class-wc-product-variation.php:514
#: includes/class-wc-product-variation.php:524 #: includes/class-wc-product-variation.php:524
msgid "(can be backordered)" msgid "(can be backordered)"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-product.php:574 #: includes/abstracts/abstract-wc-product.php:575
#: includes/class-wc-product-variation.php:521 #: includes/class-wc-product-variation.php:521
msgid "%s in stock" msgid "%s in stock"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-product.php:586 #: includes/abstracts/abstract-wc-product.php:587
#: includes/class-wc-product-variation.php:530 templates/cart/cart.php:72 #: includes/class-wc-product-variation.php:530 templates/cart/cart.php:72
msgid "Available on backorder" msgid "Available on backorder"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-product.php:596 #: includes/abstracts/abstract-wc-product.php:597
#: includes/abstracts/abstract-wc-product.php:602 #: includes/abstracts/abstract-wc-product.php:603
#: includes/class-wc-ajax.php:625 includes/class-wc-product-variation.php:536 #: includes/class-wc-ajax.php:625 includes/class-wc-product-variation.php:536
#: includes/class-wc-product-variation.php:540 #: includes/class-wc-product-variation.php:540
msgid "Out of stock" msgid "Out of stock"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-product.php:1011 #: includes/abstracts/abstract-wc-product.php:1012
#: templates/single-product/rating.php:23 #: templates/single-product/rating.php:23
msgid "Rated %s out of 5" msgid "Rated %s out of 5"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-product.php:1013 #: includes/abstracts/abstract-wc-product.php:1014
#: templates/single-product/rating.php:25 #: templates/single-product/rating.php:25
#: templates/single-product/review.php:27 #: templates/single-product/review.php:27
msgid "out of 5" msgid "out of 5"
@ -4627,7 +4627,7 @@ msgid "You do not have permission to create order notes"
msgstr "" msgstr ""
#: includes/api/class-wc-api-orders.php:1173 #: includes/api/class-wc-api-orders.php:1173
#: includes/api/class-wc-api-orders.php:1448 #: includes/api/class-wc-api-orders.php:1447
msgid "Order ID is invalid" msgid "Order ID is invalid"
msgstr "" msgstr ""
@ -4652,42 +4652,42 @@ msgstr ""
msgid "This order note cannot be deleted" msgid "This order note cannot be deleted"
msgstr "" msgstr ""
#: includes/api/class-wc-api-orders.php:1373 #: includes/api/class-wc-api-orders.php:1372
#: includes/api/class-wc-api-orders.php:1521 #: includes/api/class-wc-api-orders.php:1520
#: includes/api/class-wc-api-orders.php:1577 #: includes/api/class-wc-api-orders.php:1576
msgid "Invalid order refund ID" msgid "Invalid order refund ID"
msgstr "" msgstr ""
#: includes/api/class-wc-api-orders.php:1380 #: includes/api/class-wc-api-orders.php:1379
#: includes/api/class-wc-api-orders.php:1528 #: includes/api/class-wc-api-orders.php:1527
#: includes/api/class-wc-api-orders.php:1584 #: includes/api/class-wc-api-orders.php:1583
msgid "An order refund with the provided ID could not be found" msgid "An order refund with the provided ID could not be found"
msgstr "" msgstr ""
#: includes/api/class-wc-api-orders.php:1442 #: includes/api/class-wc-api-orders.php:1441
msgid "You do not have permission to create order refunds" msgid "You do not have permission to create order refunds"
msgstr "" msgstr ""
#: includes/api/class-wc-api-orders.php:1455 #: includes/api/class-wc-api-orders.php:1454
msgid "Refund amount is required" msgid "Refund amount is required"
msgstr "" msgstr ""
#: includes/api/class-wc-api-orders.php:1457 #: includes/api/class-wc-api-orders.php:1456
msgid "Refund amount must be positive" msgid "Refund amount must be positive"
msgstr "" msgstr ""
#: includes/api/class-wc-api-orders.php:1467 #: includes/api/class-wc-api-orders.php:1466
msgid "Cannot create order refund, please try again" msgid "Cannot create order refund, please try again"
msgstr "" msgstr ""
#: includes/api/class-wc-api-orders.php:1484 #: includes/api/class-wc-api-orders.php:1483
msgid "" msgid ""
"An error occurred while attempting to create the refund using the payment " "An error occurred while attempting to create the refund using the payment "
"gateway API" "gateway API"
msgstr "" msgstr ""
#: includes/api/class-wc-api-orders.php:1533 #: includes/api/class-wc-api-orders.php:1532
#: includes/api/class-wc-api-orders.php:1589 #: includes/api/class-wc-api-orders.php:1588
msgid "The order refund ID provided is not associated with the order" msgid "The order refund ID provided is not associated with the order"
msgstr "" msgstr ""
@ -4723,8 +4723,8 @@ msgstr ""
msgid "The SKU already exists on another product" msgid "The SKU already exists on another product"
msgstr "" msgstr ""
#: includes/api/class-wc-api-products.php:1085 includes/class-wc-emails.php:335 #: includes/api/class-wc-api-products.php:1085 includes/class-wc-emails.php:334
#: includes/class-wc-emails.php:367 includes/class-wc-emails.php:411 #: includes/class-wc-emails.php:366 includes/class-wc-emails.php:410
msgid "Variation #%s of %s" msgid "Variation #%s of %s"
msgstr "" msgstr ""
@ -5296,8 +5296,8 @@ msgstr ""
#: includes/class-wc-download-handler.php:95 #: includes/class-wc-download-handler.php:95
#: includes/class-wc-download-handler.php:100 #: includes/class-wc-download-handler.php:100
#: includes/class-wc-download-handler.php:104 #: includes/class-wc-download-handler.php:104
#: includes/class-wc-download-handler.php:148 #: includes/class-wc-download-handler.php:149
#: includes/class-wc-download-handler.php:312 #: includes/class-wc-download-handler.php:313
msgid "Go to homepage" msgid "Go to homepage"
msgstr "" msgstr ""
@ -5341,44 +5341,44 @@ msgstr ""
msgid "Sorry, this download has expired" msgid "Sorry, this download has expired"
msgstr "" msgstr ""
#: includes/class-wc-download-handler.php:148 #: includes/class-wc-download-handler.php:149
msgid "No file defined" msgid "No file defined"
msgstr "" msgstr ""
#: includes/class-wc-download-handler.php:312 #: includes/class-wc-download-handler.php:313
msgid "File not found" msgid "File not found"
msgstr "" msgstr ""
#: includes/class-wc-emails.php:288 #: includes/class-wc-emails.php:287
msgid "Note" msgid "Note"
msgstr "" msgstr ""
#: includes/class-wc-emails.php:330 #: includes/class-wc-emails.php:329
msgid "Product low in stock" msgid "Product low in stock"
msgstr "" msgstr ""
#: includes/class-wc-emails.php:337 includes/class-wc-emails.php:369 #: includes/class-wc-emails.php:336 includes/class-wc-emails.php:368
#: includes/class-wc-emails.php:413 #: includes/class-wc-emails.php:412
msgid "Product #%s - %s" msgid "Product #%s - %s"
msgstr "" msgstr ""
#: includes/class-wc-emails.php:339 #: includes/class-wc-emails.php:338
msgid "is low in stock." msgid "is low in stock."
msgstr "" msgstr ""
#: includes/class-wc-emails.php:362 #: includes/class-wc-emails.php:361
msgid "Product out of stock" msgid "Product out of stock"
msgstr "" msgstr ""
#: includes/class-wc-emails.php:371 #: includes/class-wc-emails.php:370
msgid "is out of stock." msgid "is out of stock."
msgstr "" msgstr ""
#: includes/class-wc-emails.php:406 #: includes/class-wc-emails.php:405
msgid "Product Backorder" msgid "Product Backorder"
msgstr "" msgstr ""
#: includes/class-wc-emails.php:416 #: includes/class-wc-emails.php:415
msgid "%s units of %s have been backordered in order %s." msgid "%s units of %s have been backordered in order %s."
msgstr "" msgstr ""
@ -5956,7 +5956,7 @@ msgid ""
"Changing status to draft." "Changing status to draft."
msgstr "" msgstr ""
#: includes/class-wc-product-variation.php:645 #: includes/class-wc-product-variation.php:644
msgid "%s &ndash; %s%s" msgid "%s &ndash; %s%s"
msgstr "" msgstr ""
@ -6715,7 +6715,7 @@ msgstr ""
#: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:47 #: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:47
#: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:131 #: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:131
#: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:276 #: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:277
msgid "" msgid ""
"Please make sure your card details have been entered correctly and that " "Please make sure your card details have been entered correctly and that "
"your browser supports JavaScript." "your browser supports JavaScript."
@ -6723,7 +6723,7 @@ msgstr ""
#: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:50 #: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:50
#: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:134 #: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:134
#: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:279 #: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:280
msgid "" msgid ""
"Developers: Please make sure that you're including jQuery and there are no " "Developers: Please make sure that you're including jQuery and there are no "
"JavaScript errors on the page." "JavaScript errors on the page."
@ -6755,17 +6755,17 @@ msgstr ""
#: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:257 #: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:257
#: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:356 #: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:356
#: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:304 #: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:305
msgid "Simplify payment approved (ID: %s, Auth Code: %s)" msgid "Simplify payment approved (ID: %s, Auth Code: %s)"
msgstr "" msgstr ""
#: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:261 #: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:261
#: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:315 #: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:316
msgid "Simplify payment declined" msgid "Simplify payment declined"
msgstr "" msgstr ""
#: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:263 #: includes/gateways/simplify-commerce/class-wc-addons-gateway-simplify-commerce.php:263
#: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:317 #: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:318
msgid "Payment was declined - please try another card." msgid "Payment was declined - please try another card."
msgstr "" msgstr ""
@ -6895,11 +6895,11 @@ msgstr ""
msgid "is invalid" msgid "is invalid"
msgstr "" msgstr ""
#: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:288 #: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:289
msgid "%s - Order %s" msgid "%s - Order %s"
msgstr "" msgstr ""
#: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:359 #: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:360
msgid "Refund was declined." msgid "Refund was declined."
msgstr "" msgstr ""
@ -7574,19 +7574,19 @@ msgstr ""
msgid "Egyptian Pound" msgid "Egyptian Pound"
msgstr "" msgstr ""
#: includes/wc-coupon-functions.php:22 #: includes/wc-coupon-functions.php:22 tests/unit-tests/coupon-functions.php:17
msgid "Cart Discount" msgid "Cart Discount"
msgstr "" msgstr ""
#: includes/wc-coupon-functions.php:23 #: includes/wc-coupon-functions.php:23 tests/unit-tests/coupon-functions.php:18
msgid "Cart % Discount" msgid "Cart % Discount"
msgstr "" msgstr ""
#: includes/wc-coupon-functions.php:24 #: includes/wc-coupon-functions.php:24 tests/unit-tests/coupon-functions.php:19
msgid "Product Discount" msgid "Product Discount"
msgstr "" msgstr ""
#: includes/wc-coupon-functions.php:25 #: includes/wc-coupon-functions.php:25 tests/unit-tests/coupon-functions.php:20
msgid "Product % Discount" msgid "Product % Discount"
msgstr "" msgstr ""
@ -7602,11 +7602,11 @@ msgid ""
"the new WooCommerce post_status instead, <a href=\"%s\">read more...</a>" "the new WooCommerce post_status instead, <a href=\"%s\">read more...</a>"
msgstr "" msgstr ""
#: includes/wc-order-functions.php:476 #: includes/wc-order-functions.php:475
msgid "Unpaid order cancelled - time limit reached." msgid "Unpaid order cancelled - time limit reached."
msgstr "" msgstr ""
#: includes/wc-order-functions.php:571 #: includes/wc-order-functions.php:570
msgid "Refund &ndash; %s" msgid "Refund &ndash; %s"
msgstr "" msgstr ""
@ -7722,11 +7722,11 @@ msgstr ""
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: includes/wc-term-functions.php:146 #: includes/wc-term-functions.php:144
msgid "Select a category" msgid "Select a category"
msgstr "" msgstr ""
#: includes/wc-term-functions.php:149 #: includes/wc-term-functions.php:147
msgid "Uncategorized" msgid "Uncategorized"
msgstr "" msgstr ""
@ -8929,12 +8929,12 @@ msgctxt "US state of Georgia"
msgid "Georgia" msgid "Georgia"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-order.php:872 #: includes/abstracts/abstract-wc-order.php:871
msgctxt "hash before order number" msgctxt "hash before order number"
msgid "#" msgid "#"
msgstr "" msgstr ""
#: includes/abstracts/abstract-wc-product.php:905 #: includes/abstracts/abstract-wc-product.php:906
msgctxt "min_price" msgctxt "min_price"
msgid "From:" msgid "From:"
msgstr "" msgstr ""
@ -9112,17 +9112,17 @@ msgctxt "Tax status"
msgid "None" msgid "None"
msgstr "" msgstr ""
#: includes/wc-core-functions.php:73 includes/wc-order-functions.php:571 #: includes/wc-core-functions.php:73 includes/wc-order-functions.php:570
msgctxt "Order date parsed by strftime" msgctxt "Order date parsed by strftime"
msgid "%b %d, %Y @ %I:%M %p" msgid "%b %d, %Y @ %I:%M %p"
msgstr "" msgstr ""
#: includes/wc-page-functions.php:78 #: includes/wc-page-functions.php:77
msgctxt "edit-address-slug" msgctxt "edit-address-slug"
msgid "billing" msgid "billing"
msgstr "" msgstr ""
#: includes/wc-page-functions.php:79 #: includes/wc-page-functions.php:78
msgctxt "edit-address-slug" msgctxt "edit-address-slug"
msgid "shipping" msgid "shipping"
msgstr "" msgstr ""

View File

@ -233,7 +233,7 @@ abstract class WC_Email extends WC_Settings_API {
/** /**
* get_attachments function. * get_attachments function.
* *
* @return array * @return string|array
*/ */
public function get_attachments() { public function get_attachments() {
return apply_filters( 'woocommerce_email_attachments', array(), $this->id, $this->object ); return apply_filters( 'woocommerce_email_attachments', array(), $this->id, $this->object );
@ -457,7 +457,7 @@ abstract class WC_Email extends WC_Settings_API {
/** /**
* Apply inline styles to dynamic content. * Apply inline styles to dynamic content.
* *
* @param mixed $content * @param string|null $content
* @return string * @return string
*/ */
public function style_inline( $content ) { public function style_inline( $content ) {
@ -521,9 +521,9 @@ abstract class WC_Email extends WC_Settings_API {
/** /**
* Send the email. * Send the email.
* *
* @param mixed $to * @param string $to
* @param mixed $subject * @param string $subject
* @param mixed $message * @param string $message
* @param string $headers * @param string $headers
* @param string $attachments * @param string $attachments
* @return bool * @return bool
@ -589,7 +589,7 @@ abstract class WC_Email extends WC_Settings_API {
* - Saves the options to the DB * - Saves the options to the DB
* *
* @since 1.0.0 * @since 1.0.0
* @return bool * @return boolean|null
*/ */
public function process_admin_options() { public function process_admin_options() {

View File

@ -25,7 +25,6 @@ abstract class WC_Abstract_Order {
* should be used. It is possible, but the aforementioned are preferred and are the only * should be used. It is possible, but the aforementioned are preferred and are the only
* methods that will be maintained going forward. * methods that will be maintained going forward.
* *
* @param string $id The order id. Default ''.
*/ */
public function __construct( $order = '' ) { public function __construct( $order = '' ) {
@ -78,6 +77,7 @@ abstract class WC_Abstract_Order {
* Set the payment method for the order * Set the payment method for the order
* *
* @param WC_Payment_Gateway * @param WC_Payment_Gateway
* @param WC_Payment_Gateway $payment_method
*/ */
public function set_payment_method( $payment_method ) { public function set_payment_method( $payment_method ) {
@ -227,7 +227,7 @@ abstract class WC_Abstract_Order {
* Add coupon code to the order * Add coupon code to the order
* *
* @param string $code * @param string $code
* @param float|int $discount_amount * @param integer $discount_amount
* @return int|bool Item ID or false * @return int|bool Item ID or false
*/ */
public function add_coupon( $code, $discount_amount = 0 ) { public function add_coupon( $code, $discount_amount = 0 ) {
@ -810,7 +810,6 @@ abstract class WC_Abstract_Order {
/** /**
* Checks the order status against a passed in status. * Checks the order status against a passed in status.
* *
* @param mixed $type Array or string of types
* @return bool * @return bool
*/ */
public function has_status( $status ) { public function has_status( $status ) {
@ -2070,7 +2069,8 @@ abstract class WC_Abstract_Order {
// Update the order // Update the order
wp_update_post( array( 'ID' => $this->id, 'post_status' => 'wc-' . $new_status ) ); wp_update_post( array( 'ID' => $this->id, 'post_status' => 'wc-' . $new_status ) );
$this->post_status = 'wc-' . $new_status; $this->post_status = 'wc-' . $new_status;
$this->add_order_note( trim( $note . ' ' . sprintf( __( 'Order status changed from %s to %s.', 'woocommerce' ), $old_status, $new_status ) ) );
$this->add_order_note( trim( $note . ' ' . sprintf( __( 'Order status changed from %s to %s.', 'woocommerce' ), strtolower( wc_get_order_status_label( $old_status ) ), strtolower( wc_get_order_status_label( $new_status ) ) ) ) );
// Status was changed // Status was changed
do_action( 'woocommerce_order_status_' . $new_status, $this->id ); do_action( 'woocommerce_order_status_' . $new_status, $this->id );
@ -2350,7 +2350,7 @@ abstract class WC_Abstract_Order {
/** /**
* send_stock_notifications function. * send_stock_notifications function.
* *
* @param object $product * @param WC_Product $product
* @param int $new_stock * @param int $new_stock
* @param int $qty_ordered * @param int $qty_ordered
*/ */
@ -2432,7 +2432,7 @@ abstract class WC_Abstract_Order {
/** /**
* Checks if an order needs display the shipping address, based on shipping method * Checks if an order needs display the shipping address, based on shipping method
* *
* @return bool * @return boolean|null
*/ */
public function needs_shipping_address() { public function needs_shipping_address() {

View File

@ -211,7 +211,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
* @param int $order_id * @param int $order_id
* @param float $amount * @param float $amount
* @param string $reason * @param string $reason
* @return bool|wp_error True or false based on success, or a WP_Error object * @return boolean True or false based on success, or a WP_Error object
*/ */
public function process_refund( $order_id, $amount = null, $reason = '' ) { public function process_refund( $order_id, $amount = null, $reason = '' ) {
return false; return false;
@ -245,7 +245,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
* Gateways should override this to declare support (or lack of support) for a feature. * Gateways should override this to declare support (or lack of support) for a feature.
* For backward compatibility, gateways support 'products' by default, but nothing else. * For backward compatibility, gateways support 'products' by default, but nothing else.
* *
* @param $feature string The name of a feature to test support for. * @param string $feature string The name of a feature to test support for.
* @return bool True if the gateway supports the feature, false otherwise. * @return bool True if the gateway supports the feature, false otherwise.
* @since 1.5.7 * @since 1.5.7
*/ */

View File

@ -53,7 +53,7 @@ class WC_Product {
/** /**
* __get function. * __get function.
* *
* @param mixed $key * @param string $key
* @return mixed * @return mixed
*/ */
public function __get( $key ) { public function __get( $key ) {
@ -225,6 +225,7 @@ class WC_Product {
/** /**
* set_stock_status function. * set_stock_status function.
* *
* @param string $status
* @return void * @return void
*/ */
public function set_stock_status( $status ) { public function set_stock_status( $status ) {
@ -248,7 +249,7 @@ class WC_Product {
* *
* Backwards compat with downloadable/virtual. * Backwards compat with downloadable/virtual.
* *
* @param mixed $type Array or string of types * @param string $type Array or string of types
* @return bool * @return bool
*/ */
public function is_type( $type ) { public function is_type( $type ) {
@ -908,7 +909,7 @@ class WC_Product {
/** /**
* Functions for getting parts of a price, in html, used by get_price_html. * Functions for getting parts of a price, in html, used by get_price_html.
* *
* @param mixed $from String or float to wrap with 'from' text * @param string $from String or float to wrap with 'from' text
* @param mixed $to String or float to wrap with 'to' text * @param mixed $to String or float to wrap with 'to' text
* @return string * @return string
*/ */
@ -1227,7 +1228,7 @@ class WC_Product {
/** /**
* Returns whether or not the product has any attributes set. * Returns whether or not the product has any attributes set.
* *
* @return mixed * @return boolean
*/ */
public function has_attributes() { public function has_attributes() {
@ -1354,7 +1355,6 @@ class WC_Product {
/** /**
* Get product name with SKU or ID. Used within admin. * Get product name with SKU or ID. Used within admin.
* *
* @param mixed $product
* @return string Formatted product name * @return string Formatted product name
*/ */
public function get_formatted_name() { public function get_formatted_name() {

View File

@ -54,6 +54,7 @@ abstract class WC_Widget extends WP_Widget {
/** /**
* Cache the widget * Cache the widget
* @param string $content
*/ */
public function cache_widget( $args, $content ) { public function cache_widget( $args, $content ) {
$cache[ $args['widget_id'] ] = $content; $cache[ $args['widget_id'] ] = $content;

View File

@ -49,11 +49,11 @@ class WC_Admin_Help {
'title' => __( 'Support', 'woocommerce' ), 'title' => __( 'Support', 'woocommerce' ),
'content' => 'content' =>
'<p>' . sprintf( __( 'After <a href="%s">reading the documentation</a>, for further assistance you can use the <a href="%s">community forum</a>, or if you have access as a WooThemes customer, <a href="%s">our support desk</a>.', 'woocommerce' ), 'http://docs.woothemes.com/documentation/plugins/woocommerce/', 'http://wordpress.org/support/plugin/woocommerce', 'http://support.woothemes.com' ) . '</p>' . '<p>' . sprintf( __( 'After %sreading the documentation%s, for further assistance you can use our %scommunity forum%s if you get stuck. For help with premium add-ons from WooThemes, or if you are a WooThemes customer, you can %suse our helpdesk%s.', 'woocommerce' ), '<a href="http://docs.woothemes.com/documentation/plugins/woocommerce/">', '</a>', '<a href="https://support.woothemes.com/hc/communities/public/topics">', '</a>', '<a href="http://support.woothemes.com">', '</a>' ) . '</p>' .
'<p>' . __( 'Before asking for help we recommend checking the status page to identify any problems with your configuration.', 'woocommerce' ) . '</p>' . '<p>' . __( 'Before asking for help we recommend checking the 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="' . 'http://wordpress.org/support/plugin/woocommerce' . '" class="button">' . __( 'Community Support', 'woocommerce' ) . '</a> <a href="' . 'http://support.woothemes.com' . '" class="button">' . __( 'Customer Support', 'woocommerce' ) . '</a></p>' '<p><a href="' . admin_url('admin.php?page=wc-status') . '" class="button button-primary">' . __( 'System Status', 'woocommerce' ) . '</a> <a href="' . 'https://support.woothemes.com/hc/communities/public/topics' . '" class="button">' . __( 'WooThemes Community Support', 'woocommerce' ) . '</a> <a href="' . 'http://support.woothemes.com' . '" class="button">' . __( 'WooThemes Customer Support', 'woocommerce' ) . '</a></p>'
) ); ) );

View File

@ -803,6 +803,7 @@ class WC_Admin_Post_Types {
/** /**
* Quick edit * Quick edit
* @param integer $post_id
*/ */
private function quick_edit_save( $post_id, $product ) { private function quick_edit_save( $post_id, $product ) {
global $wpdb; global $wpdb;
@ -924,6 +925,7 @@ class WC_Admin_Post_Types {
/** /**
* Bulk edit * Bulk edit
* @param integer $post_id
*/ */
public function bulk_edit_save( $post_id, $product ) { public function bulk_edit_save( $post_id, $product ) {

View File

@ -149,7 +149,7 @@ class WC_Admin_Settings {
/** /**
* Get a setting from the settings API. * Get a setting from the settings API.
* *
* @param mixed $option * @param mixed $option_name
* @return string * @return string
*/ */
public static function get_option( $option_name, $default = '' ) { public static function get_option( $option_name, $default = '' ) {

View File

@ -240,7 +240,7 @@ class WC_Admin_Status {
* *
* @since 2.1.1 * @since 2.1.1
* @param string $file Path to the file * @param string $file Path to the file
* @param array $all_headers List of headers, in the format array('HeaderKey' => 'Header Name') * @return string
*/ */
public static function get_file_version( $file ) { public static function get_file_version( $file ) {
// We don't need to write to the file, so just open for reading. // We don't need to write to the file, so just open for reading.

View File

@ -266,7 +266,7 @@ class WC_Settings_General extends WC_Settings_Page {
* Output a colour picker input box. * Output a colour picker input box.
* *
* @param mixed $name * @param mixed $name
* @param mixed $id * @param string $id
* @param mixed $value * @param mixed $value
* @param string $desc (default: '') * @param string $desc (default: '')
*/ */

View File

@ -46,7 +46,7 @@ function wc_get_screen_ids() {
* *
* @access public * @access public
* @param mixed $slug Slug for the new page * @param mixed $slug Slug for the new page
* @param mixed $option Option name to store the page's ID * @param string $option Option name to store the page's ID
* @param string $page_title (default: '') Title for the new page * @param string $page_title (default: '') Title for the new page
* @param string $page_content (default: '') Content for the new page * @param string $page_content (default: '') Content for the new page
* @param int $post_parent (default: 0) Parent for the new page * @param int $post_parent (default: 0) Parent for the new page
@ -130,7 +130,7 @@ function woocommerce_update_options( $options ) {
/** /**
* Get a setting from the settings API. * Get a setting from the settings API.
* *
* @param mixed $option * @param mixed $option_name
* @return string * @return string
*/ */
function woocommerce_settings_get_option( $option_name, $default = '' ) { function woocommerce_settings_get_option( $option_name, $default = '' ) {

View File

@ -674,7 +674,7 @@ class WC_API_Customers extends WC_API_Resource {
* *
* @since 2.1 * @since 2.1
* @see WC_API_Resource::validate_request() * @see WC_API_Resource::validate_request()
* @param string|int $id the customer ID * @param integer $id the customer ID
* @param string $type the request type, unused because this method overrides the parent class * @param string $type the request type, unused because this method overrides the parent class
* @param string $context the context of the request, either `read`, `edit` or `delete` * @param string $context the context of the request, either `read`, `edit` or `delete`
* @return int|WP_Error valid user ID or WP_Error if any of the checks fails * @return int|WP_Error valid user ID or WP_Error if any of the checks fails

View File

@ -1354,7 +1354,6 @@ class WC_API_Orders extends WC_API_Resource {
* *
* @since 2.2 * @since 2.2
* @param string $order_id order ID * @param string $order_id order ID
* @param int $refund order refund ID
* @param string|null $fields fields to limit response to * @param string|null $fields fields to limit response to
* @return array * @return array
*/ */

View File

@ -495,7 +495,7 @@ class WC_API_Products extends WC_API_Resource {
* *
* @since 2.1 * @since 2.1
* @param WC_Product $product * @param WC_Product $product
* @return array * @return WC_Product
*/ */
private function get_product_data( $product ) { private function get_product_data( $product ) {
@ -1440,7 +1440,7 @@ class WC_API_Products extends WC_API_Resource {
* *
* @since 2.2 * @since 2.2
* @param string $label * @param string $label
* @return stdClass * @return string|null
*/ */
private function get_attribute_taxonomy_by_label( $label ) { private function get_attribute_taxonomy_by_label( $label ) {
$taxonomy = null; $taxonomy = null;
@ -1653,7 +1653,7 @@ class WC_API_Products extends WC_API_Resource {
* Get product image as attachment * Get product image as attachment
* *
* @since 2.2 * @since 2.2
* @param array $upload * @param integer $upload
* @param int $id * @param int $id
* @return int * @return int
*/ */

View File

@ -446,7 +446,7 @@ class WC_API_Server {
'ssl_enabled' => ( 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ), 'ssl_enabled' => ( 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ),
'permalinks_enabled' => ( '' !== get_option( 'permalink_structure' ) ), 'permalinks_enabled' => ( '' !== get_option( 'permalink_structure' ) ),
'links' => array( 'links' => array(
'help' => 'http://woothemes.github.io/woocommerce/rest-api/', 'help' => 'http://docs.woocommercev2.apiary.io/',
), ),
), ),
) ); ) );

View File

@ -1809,7 +1809,7 @@ class WC_AJAX {
check_ajax_referer( 'order-item', 'security' ); check_ajax_referer( 'order-item', 'security' );
$order_id = absint( $_POST['order_id'] ); $order_id = absint( $_POST['order_id'] );
$refund_amount = sanitize_text_field( $_POST['refund_amount'] ); $refund_amount = wc_format_decimal( sanitize_text_field( $_POST['refund_amount'] ) );
$refund_reason = sanitize_text_field( $_POST['refund_reason'] ); $refund_reason = sanitize_text_field( $_POST['refund_reason'] );
$line_item_qtys = json_decode( sanitize_text_field( stripslashes( $_POST['line_item_qtys'] ) ), true ); $line_item_qtys = json_decode( sanitize_text_field( stripslashes( $_POST['line_item_qtys'] ) ), true );
$line_item_totals = json_decode( sanitize_text_field( stripslashes( $_POST['line_item_totals'] ) ), true ); $line_item_totals = json_decode( sanitize_text_field( stripslashes( $_POST['line_item_totals'] ) ), true );
@ -1850,10 +1850,10 @@ class WC_AJAX {
} }
} }
foreach ( $line_item_totals as $item_id => $total ) { foreach ( $line_item_totals as $item_id => $total ) {
$line_items[ $item_id ]['refund_total'] = $total; $line_items[ $item_id ]['refund_total'] = wc_format_decimal( $total );
} }
foreach ( $line_item_tax_totals as $item_id => $tax_totals ) { foreach ( $line_item_tax_totals as $item_id => $tax_totals ) {
$line_items[ $item_id ]['refund_tax'] = $tax_totals; $line_items[ $item_id ]['refund_tax'] = array_map( 'wc_format_decimal', $tax_totals );
} }
// Create the refund object // Create the refund object

View File

@ -53,7 +53,7 @@ class WC_API {
* @access public * @access public
* @since 2.0 * @since 2.0
* @param $vars * @param $vars
* @return array * @return string[]
*/ */
public function add_query_vars( $vars ) { public function add_query_vars( $vars ) {
$vars[] = 'wc-api'; $vars[] = 'wc-api';
@ -157,7 +157,7 @@ class WC_API {
* Register available API resources * Register available API resources
* *
* @since 2.1 * @since 2.1
* @param object $server the REST server * @param WC_API_Server $server the REST server
*/ */
public function register_resources( $server ) { public function register_resources( $server ) {

View File

@ -775,7 +775,7 @@ class WC_Cart {
* Add a product to the cart. * Add a product to the cart.
* *
* @param string $product_id contains the id of the product to add to the cart * @param string $product_id contains the id of the product to add to the cart
* @param string $quantity contains the quantity of the item to add * @param integer $quantity contains the quantity of the item to add
* @param int $variation_id * @param int $variation_id
* @param array $variation attribute values * @param array $variation attribute values
* @param array $cart_item_data extra cart item data we want to pass into the item * @param array $cart_item_data extra cart item data we want to pass into the item
@ -1783,7 +1783,7 @@ class WC_Cart {
* *
* @access public * @access public
* @param mixed $values * @param mixed $values
* @param mixed $price * @param double $price
*/ */
public function apply_product_discounts_after_tax( $values, $price ) { public function apply_product_discounts_after_tax( $values, $price ) {
if ( ! empty( $this->applied_coupons ) ) { if ( ! empty( $this->applied_coupons ) ) {
@ -1807,7 +1807,7 @@ class WC_Cart {
* *
* @access private * @access private
* @param mixed $code * @param mixed $code
* @param mixed $amount * @param double $amount
*/ */
private function increase_coupon_discount_amount( $code, $amount ) { private function increase_coupon_discount_amount( $code, $amount ) {
if ( empty( $this->coupon_discount_amounts[ $code ] ) ) if ( empty( $this->coupon_discount_amounts[ $code ] ) )
@ -1821,7 +1821,7 @@ class WC_Cart {
* *
* @access private * @access private
* @param mixed $code * @param mixed $code
* @param mixed $amount * @param integer $count
*/ */
private function increase_coupon_applied_count( $code, $count = 1 ) { private function increase_coupon_applied_count( $code, $count = 1 ) {
if ( empty( $this->coupon_applied_count[ $code ] ) ) if ( empty( $this->coupon_applied_count[ $code ] ) )

View File

@ -252,7 +252,7 @@ class WC_Countries {
* Gets an array of countries in the EU. * Gets an array of countries in the EU.
* *
* @access public * @access public
* @return array * @return string[]
*/ */
public function get_european_union_countries() { public function get_european_union_countries() {
return array( 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HU', 'HR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK' ); return array( 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HU', 'HR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK' );

View File

@ -278,7 +278,7 @@ class WC_Coupon {
* Check if a coupon is valid. Return a reason code if invalid. Reason codes: * Check if a coupon is valid. Return a reason code if invalid. Reason codes:
* *
* @access public * @access public
* @return bool|WP_Error validity or a WP_Error if not valid * @return boolean validity or a WP_Error if not valid
*/ */
public function is_valid() { public function is_valid() {
@ -599,7 +599,7 @@ class WC_Coupon {
* Map one of the WC_Coupon message codes to a message string * Map one of the WC_Coupon message codes to a message string
* *
* @access public * @access public
* @param mixed $msg_code * @param integer $msg_code
* @return string| Message/error string * @return string| Message/error string
*/ */
public function get_coupon_message( $msg_code ) { public function get_coupon_message( $msg_code ) {

View File

@ -331,7 +331,7 @@ class WC_Customer {
$tax_based_on = get_option( 'woocommerce_tax_based_on' ); $tax_based_on = get_option( 'woocommerce_tax_based_on' );
// Check shipping method at this point to see if we need special handling // Check shipping method at this point to see if we need special handling
if ( apply_filters( 'woocommerce_apply_base_tax_for_local_pickup', true ) == true && sizeof( array_intersect( WC()->session->get( 'chosen_shipping_methods', array( get_option( 'woocommerce_default_shipping_method' ) ) ), apply_filters( 'woocommerce_local_pickup_methods', array( 'local_pickup' ) ) ) ) > 0 ) { if ( apply_filters( 'woocommerce_apply_base_tax_for_local_pickup', true ) == true && WC()->cart->needs_shipping() && sizeof( array_intersect( WC()->session->get( 'chosen_shipping_methods', array( get_option( 'woocommerce_default_shipping_method' ) ) ), apply_filters( 'woocommerce_local_pickup_methods', array( 'local_pickup' ) ) ) ) > 0 ) {
$tax_based_on = 'base'; $tax_based_on = 'base';
} }
@ -372,8 +372,8 @@ class WC_Customer {
* Sets session data for the location. * Sets session data for the location.
* *
* @access public * @access public
* @param mixed $country * @param string $country
* @param mixed $state * @param string $state
* @param string $postcode (default: '') * @param string $postcode (default: '')
* @param string $city (default: '') * @param string $city (default: '')
*/ */
@ -448,7 +448,7 @@ class WC_Customer {
* Sets session data for the location. * Sets session data for the location.
* *
* @access public * @access public
* @param mixed $country * @param string $country
* @param string $state (default: '') * @param string $state (default: '')
* @param string $postcode (default: '') * @param string $postcode (default: '')
* @param string $city (default: '') * @param string $city (default: '')
@ -534,7 +534,7 @@ class WC_Customer {
* calculated_shipping function. * calculated_shipping function.
* *
* @access public * @access public
* @param mixed $calculated * @param boolean $calculated
*/ */
public function calculated_shipping( $calculated = true ) { public function calculated_shipping( $calculated = true ) {
$this->calculated_shipping = $calculated; $this->calculated_shipping = $calculated;

View File

@ -91,7 +91,7 @@ class WC_Download_Handler {
if ( $order_id ) { if ( $order_id ) {
$order = wc_get_order( $order_id ); $order = wc_get_order( $order_id );
if ( ! $order->is_download_permitted() || $order->post_status != 'wc-completed' ) { if ( ! $order->is_download_permitted() ) {
wp_die( __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . esc_url( home_url() ) . '" class="wc-forward">' . __( 'Go to homepage', 'woocommerce' ) . '</a>', '', array( 'response' => 404 ) ); wp_die( __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . esc_url( home_url() ) . '" class="wc-forward">' . __( 'Go to homepage', 'woocommerce' ) . '</a>', '', array( 'response' => 404 ) );
} }
} }
@ -138,6 +138,7 @@ class WC_Download_Handler {
/** /**
* Download a file - hook into init function. * Download a file - hook into init function.
* @param integer $product_id
*/ */
public static function download( $file_path, $product_id ) { public static function download( $file_path, $product_id ) {
global $is_IE; global $is_IE;

View File

@ -190,7 +190,7 @@ class WC_Emails {
* *
* @access public * @access public
* @param mixed $email_heading * @param mixed $email_heading
* @param mixed $message * @param string $message
* @return string * @return string
*/ */
function wrap_message( $email_heading, $message, $plain_text = false ) { function wrap_message( $email_heading, $message, $plain_text = false ) {
@ -244,7 +244,6 @@ class WC_Emails {
* Prepare and send the customer invoice email on demand. * Prepare and send the customer invoice email on demand.
* *
* @access public * @access public
* @param mixed $pay_for_order
* @return void * @return void
*/ */
function customer_invoice( $order ) { function customer_invoice( $order ) {

View File

@ -69,8 +69,6 @@ class WC_HTTPS {
/** /**
* Force a post link to be SSL if needed * Force a post link to be SSL if needed
* *
* @param string $post_link
* @param object $post
* @return string * @return string
*/ */
public static function force_https_page_link( $link, $page_id ) { public static function force_https_page_link( $link, $page_id ) {

View File

@ -28,7 +28,7 @@ class WC_Language_Pack_Upgrader {
*/ */
public function __construct() { public function __construct() {
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_for_update' ) ); add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_for_update' ) );
add_filter( 'upgrader_post_install', array( $this, 'version_update' ), 999, 2 ); add_filter( 'upgrader_pre_download', array( $this, 'version_update' ), 10, 2 );
add_action( 'woocommerce_language_pack_updater_check', array( $this, 'has_available_update' ) ); add_action( 'woocommerce_language_pack_updater_check', array( $this, 'has_available_update' ) );
} }
@ -117,17 +117,16 @@ class WC_Language_Pack_Upgrader {
/** /**
* Update the language version in database * Update the language version in database
* *
* @param bool $response Install response (true = success, false = fail) * This updates the database while the download the translation package and ensures that not generate download loop
* @param array $hook_extra Extra arguments passed to hooked filters * If the installation fails you can redo it in: WooCommerce > Sistem Status > Tools > Force Translation Upgrade
*
* @param bool $reply Whether to bail without returning the package (default: false)
* @param string $package Package URL
* *
* @return bool * @return bool
*/ */
public function version_update( $response, $hook_extra ) { public function version_update( $reply, $package ) {
if ( $response ) { if ( $package === $this->get_language_package_uri() ) {
if (
( isset( $hook_extra['language_update_type'] ) && 'plugin' == $hook_extra['language_update_type'] )
&& ( isset( $hook_extra['language_update']->slug ) && 'woocommerce' == $hook_extra['language_update']->slug )
) {
// Update the language pack version // Update the language pack version
update_option( 'woocommerce_language_pack_version', array( WC_VERSION , get_locale() ) ); update_option( 'woocommerce_language_pack_version', array( WC_VERSION , get_locale() ) );
@ -136,9 +135,8 @@ class WC_Language_Pack_Upgrader {
$notices = array_diff( $notices, array( 'translation_upgrade' ) ); $notices = array_diff( $notices, array( 'translation_upgrade' ) );
update_option( 'woocommerce_admin_notices', $notices ); update_option( 'woocommerce_admin_notices', $notices );
} }
}
return $response; return $reply;
} }
} }

View File

@ -75,7 +75,7 @@ class WC_Order extends WC_Abstract_Order {
* *
* @param int $item_id ID of the item we're checking * @param int $item_id ID of the item we're checking
* @param string $item_type type of the item we're checking, if not a line_item * @param string $item_type type of the item we're checking, if not a line_item
* @return float|int * @return integer
*/ */
public function get_qty_refunded_for_item( $item_id, $item_type = 'line_item' ) { public function get_qty_refunded_for_item( $item_id, $item_type = 'line_item' ) {
$qty = 0; $qty = 0;
@ -94,7 +94,7 @@ class WC_Order extends WC_Abstract_Order {
* *
* @param int $item_id ID of the item we're checking * @param int $item_id ID of the item we're checking
* @param string $item_type type of the item we're checking, if not a line_item * @param string $item_type type of the item we're checking, if not a line_item
* @return float|int * @return integer
*/ */
public function get_total_refunded_for_item( $item_id, $item_type = 'line_item' ) { public function get_total_refunded_for_item( $item_id, $item_type = 'line_item' ) {
$total = 0; $total = 0;
@ -121,7 +121,7 @@ class WC_Order extends WC_Abstract_Order {
* @param int $item_id ID of the item we're checking * @param int $item_id ID of the item we're checking
* @param int $tax_id ID of the tax we're checking * @param int $tax_id ID of the tax we're checking
* @param string $item_type type of the item we're checking, if not a line_item * @param string $item_type type of the item we're checking, if not a line_item
* @return float|int * @return integer
*/ */
public function get_tax_refunded_for_item( $item_id, $tax_id, $item_type = 'line_item' ) { public function get_tax_refunded_for_item( $item_id, $tax_id, $item_type = 'line_item' ) {
$total = 0; $total = 0;

View File

@ -66,7 +66,7 @@ class WC_Product_Variation extends WC_Product {
* Loads required variation data. * Loads required variation data.
* *
* @access public * @access public
* @param int $variation_id ID of the variation to load * @param int $variation ID of the variation to load
* @param array $args Array of the arguments containing parent product data * @param array $args Array of the arguments containing parent product data
*/ */
public function __construct( $variation, $args = array() ) { public function __construct( $variation, $args = array() ) {
@ -629,7 +629,6 @@ class WC_Product_Variation extends WC_Product {
* Get product name with extra details such as SKU, price and attributes. Used within admin. * Get product name with extra details such as SKU, price and attributes. Used within admin.
* *
* @access public * @access public
* @param mixed $product
* @return string Formatted product name, including attributes and price * @return string Formatted product name, including attributes and price
*/ */
public function get_formatted_name() { public function get_formatted_name() {

View File

@ -240,8 +240,6 @@ class WC_Query {
add_filter( 'wp', array( $this, 'remove_posts_where' ) ); add_filter( 'wp', array( $this, 'remove_posts_where' ) );
} }
add_filter( 'posts_where', array( $this, 'exclude_protected_products' ) );
// We're on a shop page so queue the woocommerce_get_products_in_view function // We're on a shop page so queue the woocommerce_get_products_in_view function
add_action( 'wp', array( $this, 'get_products_in_view' ), 2); add_action( 'wp', array( $this, 'get_products_in_view' ), 2);
@ -270,18 +268,6 @@ class WC_Query {
return $where; return $where;
} }
/**
* Prevent password protected products appearing in the loops
*
* @param string $where
* @return string
*/
public function exclude_protected_products( $where ) {
global $wpdb;
$where .= " AND {$wpdb->posts}.post_password = ''";
return $where;
}
/** /**
* wpseo_metadesc function. * wpseo_metadesc function.
* Hooked into wpseo_ hook already, so no need for function_exist * Hooked into wpseo_ hook already, so no need for function_exist

View File

@ -342,7 +342,7 @@ class WC_Webhook {
// save request data // save request data
add_comment_meta( $delivery_id, '_request_method', $request['method'] ); add_comment_meta( $delivery_id, '_request_method', $request['method'] );
add_comment_meta( $delivery_id, '_request_headers', array_merge( (array) $request['user-agent'], $request['headers'] ) ); add_comment_meta( $delivery_id, '_request_headers', array_merge( array( 'User-Agent' => $request['user-agent'] ), $request['headers'] ) );
add_comment_meta( $delivery_id, '_request_body', $request['body'] ); add_comment_meta( $delivery_id, '_request_body', $request['body'] );
// parse response // parse response

View File

@ -188,6 +188,10 @@ class Mijireh_Order extends Mijireh_Model {
} }
} }
/**
* @param string $key
* @param integer $value
*/
public function add_meta_data($key, $value) { public function add_meta_data($key, $value) {
if(!is_array($this->_data['meta_data'])) { if(!is_array($this->_data['meta_data'])) {
$this->_data['meta_data'] = array(); $this->_data['meta_data'] = array();
@ -199,6 +203,7 @@ class Mijireh_Order extends Mijireh_Model {
* Return the value associated with the given key in the order's meta data. * Return the value associated with the given key in the order's meta data.
* *
* If the key does not exist, return false. * If the key does not exist, return false.
* @param string $key
*/ */
public function get_meta_value($key) { public function get_meta_value($key) {
$value = false; $value = false;

View File

@ -50,6 +50,10 @@ class Mijireh_Rest {
} }
// $auth can be 'basic' or 'digest' // $auth can be 'basic' or 'digest'
/**
* @param string $pass
*/
public function setupAuth($user, $pass, $auth = 'basic') { public function setupAuth($user, $pass, $auth = 'basic') {
$this->curl_opts[CURLOPT_HTTPAUTH] = constant('CURLAUTH_'.strtoupper($auth)); $this->curl_opts[CURLOPT_HTTPAUTH] = constant('CURLAUTH_'.strtoupper($auth));
$this->curl_opts[CURLOPT_USERPWD] = $user . ":" . $pass; $this->curl_opts[CURLOPT_USERPWD] = $user . ":" . $pass;
@ -64,6 +68,10 @@ class Mijireh_Rest {
return $body; return $body;
} }
/**
* @param string $data
* @param string $url
*/
public function post($url, $data, $headers=array()) { public function post($url, $data, $headers=array()) {
$data = (is_array($data)) ? http_build_query($data) : $data; $data = (is_array($data)) ? http_build_query($data) : $data;
@ -81,6 +89,9 @@ class Mijireh_Rest {
return $body; return $body;
} }
/**
* @param string $data
*/
public function put($url, $data, $headers=array()) { public function put($url, $data, $headers=array()) {
$data = (is_array($data)) ? http_build_query($data) : $data; $data = (is_array($data)) ? http_build_query($data) : $data;
@ -125,6 +136,9 @@ class Mijireh_Rest {
return $body; return $body;
} }
/**
* @return string|null
*/
protected function processError($body) { protected function processError($body) {
// Override this in classes that extend Mijireh_Rest. // Override this in classes that extend Mijireh_Rest.
// The body of every erroneous (non-2xx/3xx) GET/POST/PUT/DELETE // The body of every erroneous (non-2xx/3xx) GET/POST/PUT/DELETE
@ -159,6 +173,9 @@ class Mijireh_Rest {
return $curl; return $curl;
} }
/**
* @param resource $curl
*/
private function doRequest($curl) { private function doRequest($curl) {
$body = curl_exec($curl); $body = curl_exec($curl);

View File

@ -4,6 +4,9 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Mijireh_RestJSON extends Mijireh_Rest { class Mijireh_RestJSON extends Mijireh_Rest {
/**
* @param string $url
*/
public function post($url, $data, $headers=array()) { public function post($url, $data, $headers=array()) {
return parent::post($url, json_encode($data), $headers); return parent::post($url, json_encode($data), $headers);
} }

View File

@ -216,7 +216,7 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce {
* process_subscription_payment function. * process_subscription_payment function.
* *
* @param WC_order $order * @param WC_order $order
* @param float $amount (default: 0) * @param integer $amount (default: 0)
* @return bool|WP_Error * @return bool|WP_Error
*/ */
public function process_subscription_payment( $order = '', $amount = 0 ) { public function process_subscription_payment( $order = '', $amount = 0 ) {
@ -318,7 +318,7 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce {
* Process a pre-order payment when the pre-order is released * Process a pre-order payment when the pre-order is released
* *
* @param WC_Order $order * @param WC_Order $order
* @return void * @return wp_error|null
*/ */
public function process_pre_order_release_payment( $order ) { public function process_pre_order_release_payment( $order ) {

View File

@ -248,7 +248,7 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
* Outputs scripts used for simplify payment * Outputs scripts used for simplify payment
*/ */
public function payment_scripts() { public function payment_scripts() {
if ( ! is_checkout() ) { if ( ! is_checkout() || ! $this->is_available() ) {
return; return;
} }
@ -265,6 +265,7 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
/** /**
* Process the payment * Process the payment
* @param integer $order_id
*/ */
public function process_payment( $order_id ) { public function process_payment( $order_id ) {
$order = new WC_Order( $order_id ); $order = new WC_Order( $order_id );

View File

@ -104,6 +104,11 @@ class Simplify_AccessToken extends Simplify_Object {
return $this; return $this;
} }
/**
* @param string $props
* @param string $context
* @param Simplify_Authentication $authentication
*/
private static function sendRequest($props, $context, $authentication){ private static function sendRequest($props, $context, $authentication){
$url = Simplify_Constants::OAUTH_BASE_URL.'/'.$context; $url = Simplify_Constants::OAUTH_BASE_URL.'/'.$context;

View File

@ -37,7 +37,7 @@ class Simplify_Chargeback extends Simplify_Object {
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd> * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> amount</tt><tt> description</tt><tt> dateCreated</tt>.</dd></dl> * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> amount</tt><tt> description</tt><tt> dateCreated</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Chargeback objects and the total * @return Simplify_ResourceList a ResourceList object that holds the list of Chargeback objects and the total
* number of Chargeback objects available for the given criteria. * number of Chargeback objects available for the given criteria.
* @see ResourceList * @see ResourceList
*/ */

View File

@ -81,7 +81,7 @@ class Simplify_Coupon extends Simplify_Object {
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd> * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> maxRedemptions</tt><tt> timesRedeemed</tt><tt> id</tt><tt> startDate</tt><tt> endDate</tt><tt> percentOff</tt><tt> couponCode</tt><tt> durationInMonths</tt><tt> amountOff</tt>.</dd></dl> * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> maxRedemptions</tt><tt> timesRedeemed</tt><tt> id</tt><tt> startDate</tt><tt> endDate</tt><tt> percentOff</tt><tt> couponCode</tt><tt> durationInMonths</tt><tt> amountOff</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Coupon objects and the total * @return Simplify_ResourceList a ResourceList object that holds the list of Coupon objects and the total
* number of Coupon objects available for the given criteria. * number of Coupon objects available for the given criteria.
* @see ResourceList * @see ResourceList
*/ */

View File

@ -97,7 +97,7 @@ class Simplify_Customer extends Simplify_Object {
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd> * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> id</tt><tt> name</tt><tt> email</tt><tt> reference</tt>.</dd></dl> * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> id</tt><tt> name</tt><tt> email</tt><tt> reference</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Customer objects and the total * @return Simplify_ResourceList a ResourceList object that holds the list of Customer objects and the total
* number of Customer objects available for the given criteria. * number of Customer objects available for the given criteria.
* @see ResourceList * @see ResourceList
*/ */

View File

@ -37,7 +37,7 @@ class Simplify_Deposit extends Simplify_Object {
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd> * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> amount</tt><tt> dateCreated</tt><tt> depositDate</tt>.</dd></dl> * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> amount</tt><tt> dateCreated</tt><tt> depositDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Deposit objects and the total * @return Simplify_ResourceList a ResourceList object that holds the list of Deposit objects and the total
* number of Deposit objects available for the given criteria. * number of Deposit objects available for the given criteria.
* @see ResourceList * @see ResourceList
*/ */

View File

@ -122,6 +122,7 @@ class Simplify_ApiConnectionException extends Simplify_ApiException {
/** /**
* @ignore * @ignore
* @param string $message
*/ */
function __construct($message, $status = null, $errorData = null) { function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData); parent::__construct($message, $status, $errorData);
@ -135,6 +136,7 @@ class Simplify_AuthenticationException extends Simplify_ApiException {
/** /**
* @ignore * @ignore
* @param string $message
*/ */
function __construct($message, $status = null, $errorData = null) { function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData); parent::__construct($message, $status, $errorData);
@ -150,6 +152,7 @@ class Simplify_BadRequestException extends Simplify_ApiException {
/** /**
* @ignore * @ignore
* @param string $message
*/ */
function __construct($message, $status = null, $errorData = null) { function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData); parent::__construct($message, $status, $errorData);
@ -258,6 +261,7 @@ class Simplify_ObjectNotFoundException extends Simplify_ApiException {
/** /**
* @ignore * @ignore
* @param string $message
*/ */
function __construct($message, $status = null, $errorData = null) { function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData); parent::__construct($message, $status, $errorData);
@ -271,6 +275,7 @@ class Simplify_NotAllowedException extends Simplify_ApiException {
/** /**
* @ignore * @ignore
* @param string $message
*/ */
function __construct($message, $status = null, $errorData = null) { function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData); parent::__construct($message, $status, $errorData);
@ -284,6 +289,7 @@ class Simplify_SystemException extends Simplify_ApiException {
/** /**
* @ignore * @ignore
* @param string $message
*/ */
function __construct($message, $status = null, $errorData = null) { function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData); parent::__construct($message, $status, $errorData);

View File

@ -58,6 +58,9 @@ class Simplify_HTTP
"get" => self::GET, "get" => self::GET,
"delete" => self::DELETE); "delete" => self::DELETE);
/**
* @param string $url
*/
private function request($url, $method, $authentication, $payload = '') private function request($url, $method, $authentication, $payload = '')
{ {
if ($authentication->publicKey == null) { if ($authentication->publicKey == null) {
@ -126,7 +129,7 @@ class Simplify_HTTP
/** /**
* Handles Simplify API requests * Handles Simplify API requests
* *
* @param $url * @param string $url
* @param $method * @param $method
* @param $authentication * @param $authentication
* @param string $payload * @param string $payload
@ -167,9 +170,9 @@ class Simplify_HTTP
/** /**
* Handles Simplify OAuth requests * Handles Simplify OAuth requests
* *
* @param $url * @param string $url
* @param $payload * @param string $payload
* @param $authentication * @param Simplify_Authentication $authentication
* @return mixed * @return mixed
* @throws Simplify_AuthenticationException * @throws Simplify_AuthenticationException
* @throws Simplify_ObjectNotFoundException * @throws Simplify_ObjectNotFoundException
@ -225,6 +228,9 @@ class Simplify_HTTP
throw new Simplify_SystemException("An unexpected error has been raised. Looks like there's something wrong at our end." , $status, $object); throw new Simplify_SystemException("An unexpected error has been raised. Looks like there's something wrong at our end." , $status, $object);
} }
/**
* @param Simplify_Authentication $authentication
*/
public function jwsDecode($authentication, $hash) public function jwsDecode($authentication, $hash)
{ {
if ($authentication->publicKey == null) { if ($authentication->publicKey == null) {
@ -271,6 +277,10 @@ class Simplify_HTTP
} }
} }
/**
* @param string $payload
* @param boolean $hasPayload
*/
private function jwsEncode($authentication, $url, $payload, $hasPayload) private function jwsEncode($authentication, $url, $payload, $hasPayload)
{ {
// TODO - better seeding of RNG // TODO - better seeding of RNG
@ -299,6 +309,9 @@ class Simplify_HTTP
return $msg . "." . $this->jwsSign($authentication->privateKey, $msg); return $msg . "." . $this->jwsSign($authentication->privateKey, $msg);
} }
/**
* @param string $msg
*/
private function jwsSign($privateKey, $msg) { private function jwsSign($privateKey, $msg) {
$decodedPrivateKey = $this->jwsUrlSafeDecode64($privateKey); $decodedPrivateKey = $this->jwsUrlSafeDecode64($privateKey);
$sig = hash_hmac('sha256', $msg, $decodedPrivateKey, true); $sig = hash_hmac('sha256', $msg, $decodedPrivateKey, true);
@ -306,6 +319,9 @@ class Simplify_HTTP
return $this->jwsUrlSafeEncode64($sig); return $this->jwsUrlSafeEncode64($sig);
} }
/**
* @param string $header
*/
private function jwsVerifyHeader($header, $url, $publicKey) { private function jwsVerifyHeader($header, $url, $publicKey) {
$hdr = json_decode($header, true); $hdr = json_decode($header, true);
@ -359,10 +375,16 @@ class Simplify_HTTP
} }
/**
* @param string $msg
*/
private function jwsVerifySignature($privateKey, $msg, $expectedSig) { private function jwsVerifySignature($privateKey, $msg, $expectedSig) {
return $this->jwsSign($privateKey, $msg) == $expectedSig; return $this->jwsSign($privateKey, $msg) == $expectedSig;
} }
/**
* @param string $reason
*/
private function jwsAuthError($reason) { private function jwsAuthError($reason) {
throw new Simplify_AuthenticationException("JWS authentication failure: " . $reason); throw new Simplify_AuthenticationException("JWS authentication failure: " . $reason);
} }
@ -376,6 +398,9 @@ class Simplify_HTTP
return strpos($k, "lvpb") === 0; return strpos($k, "lvpb") === 0;
} }
/**
* @param string $s
*/
private function jwsUrlSafeEncode64($s) { private function jwsUrlSafeEncode64($s) {
return str_replace(array('+', '/', '='), return str_replace(array('+', '/', '='),
array('-', '_', ''), array('-', '_', ''),
@ -395,6 +420,9 @@ class Simplify_HTTP
return base64_decode(str_replace(array('-', '_'), array('+', '/'), $s)); return base64_decode(str_replace(array('-', '_'), array('+', '/'), $s));
} }
/**
* @param string $msg
*/
private function buildOauthError($msg, $error, $error_description){ private function buildOauthError($msg, $error, $error_description){
return array( return array(

View File

@ -37,7 +37,7 @@ class Simplify_Invoice extends Simplify_Object {
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd> * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> invoiceDate</tt><tt> customer</tt><tt> amount</tt><tt> processedDate</tt>.</dd></dl> * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> invoiceDate</tt><tt> customer</tt><tt> amount</tt><tt> processedDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Invoice objects and the total * @return Simplify_ResourceList a ResourceList object that holds the list of Invoice objects and the total
* number of Invoice objects available for the given criteria. * number of Invoice objects available for the given criteria.
* @see ResourceList * @see ResourceList
*/ */

View File

@ -77,7 +77,7 @@ class Simplify_InvoiceItem extends Simplify_Object {
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd> * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> amount</tt><tt> description</tt><tt> invoice</tt>.</dd></dl> * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> amount</tt><tt> description</tt><tt> invoice</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of InvoiceItem objects and the total * @return Simplify_ResourceList a ResourceList object that holds the list of InvoiceItem objects and the total
* number of InvoiceItem objects available for the given criteria. * number of InvoiceItem objects available for the given criteria.
* @see ResourceList * @see ResourceList
*/ */

View File

@ -73,7 +73,7 @@ class Simplify_Payment extends Simplify_Object {
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd> * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> amount</tt><tt> id</tt><tt> description</tt><tt> paymentDate</tt>.</dd></dl> * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> amount</tt><tt> id</tt><tt> description</tt><tt> paymentDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Payment objects and the total * @return Simplify_ResourceList a ResourceList object that holds the list of Payment objects and the total
* number of Payment objects available for the given criteria. * number of Payment objects available for the given criteria.
* @see ResourceList * @see ResourceList
*/ */

View File

@ -43,6 +43,7 @@ class Simplify_PaymentsApi
/** /**
* @ignore * @ignore
* @param Simplify_Authentication $authentication
*/ */
static public function createObject($object, $authentication = null) static public function createObject($object, $authentication = null)
{ {
@ -57,6 +58,7 @@ class Simplify_PaymentsApi
/** /**
* @ignore * @ignore
* @param Simplify_Authentication $authentication
*/ */
static public function findObject($object, $authentication = null) static public function findObject($object, $authentication = null)
{ {
@ -70,6 +72,7 @@ class Simplify_PaymentsApi
/** /**
* @ignore * @ignore
* @param Simplify_Authentication $authentication
*/ */
static public function updateObject($object, $authentication = null) { static public function updateObject($object, $authentication = null) {
$paymentsApi = new Simplify_PaymentsApi(); $paymentsApi = new Simplify_PaymentsApi();
@ -82,6 +85,7 @@ class Simplify_PaymentsApi
/** /**
* @ignore * @ignore
* @param Simplify_Authentication $authentication
*/ */
static public function deleteObject($object, $authentication = null) { static public function deleteObject($object, $authentication = null) {
$paymentsApi = new Simplify_PaymentsApi(); $paymentsApi = new Simplify_PaymentsApi();
@ -93,6 +97,7 @@ class Simplify_PaymentsApi
/** /**
* @ignore * @ignore
* @param Simplify_Authentication $authentication
*/ */
static public function listObject($object, $criteria = null, $authentication =null) { static public function listObject($object, $criteria = null, $authentication =null) {
if ($criteria != null) { if ($criteria != null) {
@ -154,6 +159,7 @@ class Simplify_PaymentsApi
/** /**
* @ignore * @ignore
* @param string $action
*/ */
public function getUrl($publicKey, $action, $object) public function getUrl($publicKey, $action, $object)
{ {
@ -195,6 +201,7 @@ class Simplify_PaymentsApi
/** /**
* @ignore * @ignore
* @param string $action
*/ */
public function getMethod($action) public function getMethod($action)
{ {
@ -206,6 +213,8 @@ class Simplify_PaymentsApi
/** /**
* @ignore * @ignore
* @param string $action
* @param Simplify_Authentication|null $authentication
*/ */
private function execute($action, $object, $authentication) private function execute($action, $object, $authentication)
{ {
@ -217,6 +226,7 @@ class Simplify_PaymentsApi
/** /**
* @ignore * @ignore
* @param Simplify_Authentication $authentication
*/ */
public function jwsDecode($hash, $authentication) public function jwsDecode($hash, $authentication)
{ {
@ -247,6 +257,7 @@ class Simplify_PaymentsApi
/** /**
* @ignore * @ignore
* @param string $c
*/ */
private function endsWith($s, $c) private function endsWith($s, $c)
{ {
@ -262,7 +273,7 @@ class Simplify_PaymentsApi
* @ignore * @ignore
* @param $authentication * @param $authentication
* @param $args * @param $args
* @param $expectedArgCount * @param integer $expectedArgCount
* @return Simplify_Authentication * @return Simplify_Authentication
*/ */
static function buildAuthenticationObject($authentication = null, $args, $expectedArgCount){ static function buildAuthenticationObject($authentication = null, $args, $expectedArgCount){

View File

@ -77,7 +77,7 @@ class Simplify_Plan extends Simplify_Object {
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd> * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> amount</tt><tt> frequency</tt><tt> name</tt><tt> id</tt>.</dd></dl> * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> amount</tt><tt> frequency</tt><tt> name</tt><tt> id</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Plan objects and the total * @return Simplify_ResourceList a ResourceList object that holds the list of Plan objects and the total
* number of Plan objects available for the given criteria. * number of Plan objects available for the given criteria.
* @see ResourceList * @see ResourceList
*/ */

View File

@ -60,7 +60,7 @@ class Simplify_Refund extends Simplify_Object {
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd> * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> amount</tt><tt> description</tt><tt> dateCreated</tt><tt> paymentDate</tt>.</dd></dl> * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> amount</tt><tt> description</tt><tt> dateCreated</tt><tt> paymentDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Refund objects and the total * @return Simplify_ResourceList a ResourceList object that holds the list of Refund objects and the total
* number of Refund objects available for the given criteria. * number of Refund objects available for the given criteria.
* @see ResourceList * @see ResourceList
*/ */

View File

@ -81,7 +81,7 @@ class Simplify_Subscription extends Simplify_Object {
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd> * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> plan</tt>.</dd></dl> * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> plan</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Subscription objects and the total * @return Simplify_ResourceList a ResourceList object that holds the list of Subscription objects and the total
* number of Subscription objects available for the given criteria. * number of Subscription objects available for the given criteria.
* @see ResourceList * @see ResourceList
*/ */

View File

@ -74,7 +74,7 @@ class Simplify_Webhook extends Simplify_Object {
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd> * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt>.</dd></dl> * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Webhook objects and the total * @return Simplify_ResourceList a ResourceList object that holds the list of Webhook objects and the total
* number of Webhook objects available for the given criteria. * number of Webhook objects available for the given criteria.
* @see ResourceList * @see ResourceList
*/ */

View File

@ -21,7 +21,6 @@ class WC_Product_Cat_Dropdown_Walker extends Walker {
* @since 2.1.0 * @since 2.1.0
* *
* @param string $output Passed by reference. Used to append additional content. * @param string $output Passed by reference. Used to append additional content.
* @param object $category Category data object.
* @param int $depth Depth of category in reference to parents. * @param int $depth Depth of category in reference to parents.
* @param integer $current_object_id * @param integer $current_object_id
*/ */

View File

@ -53,7 +53,6 @@ class WC_Product_Cat_List_Walker extends Walker {
* @since 2.1.0 * @since 2.1.0
* *
* @param string $output Passed by reference. Used to append additional content. * @param string $output Passed by reference. Used to append additional content.
* @param object $category Category data object.
* @param int $depth Depth of category in reference to parents. * @param int $depth Depth of category in reference to parents.
* @param integer $current_object_id * @param integer $current_object_id
*/ */
@ -84,7 +83,6 @@ class WC_Product_Cat_List_Walker extends Walker {
* @since 2.1.0 * @since 2.1.0
* *
* @param string $output Passed by reference. Used to append additional content. * @param string $output Passed by reference. Used to append additional content.
* @param object $page Not used.
* @param int $depth Depth of category. Not used. * @param int $depth Depth of category. Not used.
* @param array $args Only uses 'list' for whether should append to output. * @param array $args Only uses 'list' for whether should append to output.
*/ */

View File

@ -44,7 +44,7 @@ function wc_empty_cart() {
* Load the cart upon login * Load the cart upon login
* *
* @param mixed $user_login * @param mixed $user_login
* @param mixed $user * @param integer $user
* @return void * @return void
*/ */
function wc_load_persistent_cart( $user_login, $user = 0 ) { function wc_load_persistent_cart( $user_login, $user = 0 ) {

View File

@ -114,7 +114,7 @@ function wc_create_order( $args = array() ) {
/** /**
* Update an order. Uses wc_create_order. * Update an order. Uses wc_create_order.
* @param array $args * @param array $args
* @return WC_Error | WC_Order * @return string | WC_Order
*/ */
function wc_update_order( $args ) { function wc_update_order( $args ) {
if ( ! $args['order_id'] ) { if ( ! $args['order_id'] ) {
@ -590,7 +590,7 @@ add_filter( 'mod_rewrite_rules', 'wc_ms_protect_download_rewite_rules' );
* WooCommerce Core Supported Themes * WooCommerce Core Supported Themes
* *
* @since 2.2 * @since 2.2
* @return array * @return string[]
*/ */
function wc_get_core_supported_themes() { function wc_get_core_supported_themes() {
return array( 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' ); return array( 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' );

View File

@ -17,7 +17,6 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
* *
* urldecode is used to reverse munging of UTF8 characters. * urldecode is used to reverse munging of UTF8 characters.
* *
* @access public
* @param mixed $taxonomy * @param mixed $taxonomy
* @return string * @return string
*/ */
@ -28,7 +27,6 @@ function wc_sanitize_taxonomy_name( $taxonomy ) {
/** /**
* Gets the filename part of a download URL * Gets the filename part of a download URL
* *
* @access public
* @param string $file_url * @param string $file_url
* @return string * @return string
*/ */
@ -44,7 +42,6 @@ function wc_get_filename_from_url( $file_url ) {
* *
* Usage: wc_get_dimension(55, 'in'); * Usage: wc_get_dimension(55, 'in');
* *
* @access public
* @param mixed $dim * @param mixed $dim
* @param mixed $to_unit 'in', 'm', 'cm', 'm' * @param mixed $to_unit 'in', 'm', 'cm', 'm'
* @return float * @return float
@ -92,11 +89,10 @@ function wc_get_dimension( $dim, $to_unit ) {
} }
/** /**
* Normalise weights, unify to cm then convert to wanted unit value * Normalise weights, unify to kg then convert to wanted unit value
* *
* Usage: wc_get_weight(55, 'kg'); * Usage: wc_get_weight(55, 'kg');
* *
* @access public
* @param mixed $weight * @param mixed $weight
* @param mixed $to_unit 'g', 'kg', 'lbs' * @param mixed $to_unit 'g', 'kg', 'lbs'
* @return float * @return float
@ -140,7 +136,6 @@ function wc_get_weight( $weight, $to_unit ) {
/** /**
* Trim trailing zeros off prices. * Trim trailing zeros off prices.
* *
* @access public
* @param mixed $price * @param mixed $price
* @return string * @return string
*/ */
@ -151,16 +146,17 @@ function wc_trim_zeros( $price ) {
/** /**
* Round a tax amount * Round a tax amount
* *
* @access public * @param mixed $tax
* @param mixed $price * @return double
* @return string
*/ */
function wc_round_tax_total( $tax ) { function wc_round_tax_total( $tax ) {
$dp = (int) get_option( 'woocommerce_price_num_decimals' ); $dp = (int) get_option( 'woocommerce_price_num_decimals' );
// @codeCoverageIgnoreStart
if ( version_compare( phpversion(), '5.3', '<' ) ) { if ( version_compare( phpversion(), '5.3', '<' ) ) {
$tax = round( $tax, $dp ); $tax = round( $tax, $dp );
} else { } else {
// @codeCoverageIgnoreEnd
$tax = round( $tax, $dp, WC_TAX_ROUNDING_MODE ); $tax = round( $tax, $dp, WC_TAX_ROUNDING_MODE );
} }
return $tax; return $tax;
@ -244,7 +240,6 @@ function wc_format_localized_decimal( $value ) {
/** /**
* Clean variables * Clean variables
* *
* @access public
* @param string $var * @param string $var
* @return string * @return string
*/ */
@ -255,7 +250,6 @@ function wc_clean( $var ) {
/** /**
* Merge two arrays * Merge two arrays
* *
* @access public
* @param array $a1 * @param array $a1
* @param array $a2 * @param array $a2
* @return array * @return array
@ -312,7 +306,6 @@ function get_woocommerce_price_format() {
/** /**
* Format the price with a currency symbol. * Format the price with a currency symbol.
* *
* @access public
* @param float $price * @param float $price
* @param array $args (default: array()) * @param array $args (default: array())
* @return string * @return string
@ -358,7 +351,6 @@ function wc_price( $price, $args = array() ) {
* *
* This function transforms the php.ini notation for numbers (like '2M') to an integer. * This function transforms the php.ini notation for numbers (like '2M') to an integer.
* *
* @access public
* @param $size * @param $size
* @return int * @return int
*/ */
@ -383,7 +375,6 @@ function wc_let_to_num( $size ) {
/** /**
* WooCommerce Date Format - Allows to change date format for everything WooCommerce * WooCommerce Date Format - Allows to change date format for everything WooCommerce
* *
* @access public
* @return string * @return string
*/ */
function wc_date_format() { function wc_date_format() {
@ -393,7 +384,6 @@ function wc_date_format() {
/** /**
* WooCommerce Time Format - Allows to change time format for everything WooCommerce * WooCommerce Time Format - Allows to change time format for everything WooCommerce
* *
* @access public
* @return string * @return string
*/ */
function wc_time_format() { function wc_time_format() {
@ -407,7 +397,6 @@ function wc_time_format() {
* Adapted from http://www.php.net/manual/en/function.timezone-name-from-abbr.php#89155 * Adapted from http://www.php.net/manual/en/function.timezone-name-from-abbr.php#89155
* *
* @since 2.1 * @since 2.1
* @access public
* @return string a valid PHP timezone string for the site * @return string a valid PHP timezone string for the site
*/ */
function wc_timezone_string() { function wc_timezone_string() {
@ -452,7 +441,6 @@ if ( ! function_exists( 'wc_rgb_from_hex' ) ) {
/** /**
* Hex darker/lighter/contrast functions for colours * Hex darker/lighter/contrast functions for colours
* *
* @access public
* @param mixed $color * @param mixed $color
* @return string * @return string
*/ */
@ -473,7 +461,6 @@ if ( ! function_exists( 'wc_hex_darker' ) ) {
/** /**
* Hex darker/lighter/contrast functions for colours * Hex darker/lighter/contrast functions for colours
* *
* @access public
* @param mixed $color * @param mixed $color
* @param int $factor (default: 30) * @param int $factor (default: 30)
* @return string * @return string
@ -482,17 +469,17 @@ if ( ! function_exists( 'wc_hex_darker' ) ) {
$base = wc_rgb_from_hex( $color ); $base = wc_rgb_from_hex( $color );
$color = '#'; $color = '#';
foreach ($base as $k => $v) : foreach ( $base as $k => $v ) {
$amount = $v / 100; $amount = $v / 100;
$amount = round( $amount * $factor ); $amount = round( $amount * $factor );
$new_decimal = $v - $amount; $new_decimal = $v - $amount;
$new_hex_component = dechex( $new_decimal ); $new_hex_component = dechex( $new_decimal );
if(strlen($new_hex_component) < 2) : if ( strlen( $new_hex_component ) < 2 ) {
$new_hex_component = "0" . $new_hex_component; $new_hex_component = "0" . $new_hex_component;
endif; }
$color .= $new_hex_component; $color .= $new_hex_component;
endforeach; }
return $color; return $color;
} }
@ -503,7 +490,6 @@ if ( ! function_exists( 'wc_hex_lighter' ) ) {
/** /**
* Hex darker/lighter/contrast functions for colours * Hex darker/lighter/contrast functions for colours
* *
* @access public
* @param mixed $color * @param mixed $color
* @param int $factor (default: 30) * @param int $factor (default: 30)
* @return string * @return string
@ -512,18 +498,18 @@ if ( ! function_exists( 'wc_hex_lighter' ) ) {
$base = wc_rgb_from_hex( $color ); $base = wc_rgb_from_hex( $color );
$color = '#'; $color = '#';
foreach ($base as $k => $v) : foreach ( $base as $k => $v ) {
$amount = 255 - $v; $amount = 255 - $v;
$amount = $amount / 100; $amount = $amount / 100;
$amount = round( $amount * $factor ); $amount = round( $amount * $factor );
$new_decimal = $v + $amount; $new_decimal = $v + $amount;
$new_hex_component = dechex( $new_decimal ); $new_hex_component = dechex( $new_decimal );
if(strlen($new_hex_component) < 2) : if ( strlen( $new_hex_component ) < 2 ) {
$new_hex_component = "0" . $new_hex_component; $new_hex_component = "0" . $new_hex_component;
endif; }
$color .= $new_hex_component; $color .= $new_hex_component;
endforeach; }
return $color; return $color;
} }
@ -534,19 +520,19 @@ if ( ! function_exists( 'wc_light_or_dark' ) ) {
/** /**
* Detect if we should use a light or dark colour on a background colour * Detect if we should use a light or dark colour on a background colour
* *
* @access public
* @param mixed $color * @param mixed $color
* @param string $dark (default: '#000000') * @param string $dark (default: '#000000')
* @param string $light (default: '#FFFFFF') * @param string $light (default: '#FFFFFF')
* @return string * @return string
*/ */
function wc_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) { function wc_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
//return ( hexdec( $color ) > 0xffffff / 2 ) ? $dark : $light;
$hex = str_replace( '#', '', $color ); $hex = str_replace( '#', '', $color );
$c_r = hexdec( substr( $hex, 0, 2 ) ); $c_r = hexdec( substr( $hex, 0, 2 ) );
$c_g = hexdec( substr( $hex, 2, 2 ) ); $c_g = hexdec( substr( $hex, 2, 2 ) );
$c_b = hexdec( substr( $hex, 4, 2 ) ); $c_b = hexdec( substr( $hex, 4, 2 ) );
$brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000; $brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
return $brightness > 155 ? $dark : $light; return $brightness > 155 ? $dark : $light;
@ -558,7 +544,6 @@ if ( ! function_exists( 'wc_format_hex' ) ) {
/** /**
* Format string as hex * Format string as hex
* *
* @access public
* @param string $hex * @param string $hex
* @return string * @return string
*/ */
@ -570,7 +555,7 @@ if ( ! function_exists( 'wc_format_hex' ) ) {
$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
} }
if ( $hex ) return '#' . $hex; return $hex ? '#' . $hex : null;
} }
} }
@ -595,7 +580,6 @@ function wc_format_postcode( $postcode, $country ) {
/** /**
* format_phone function. * format_phone function.
* *
* @access public
* @param mixed $tel * @param mixed $tel
* @return string * @return string
*/ */

View File

@ -13,9 +13,10 @@
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/** /**
* Get the count of notices added, either for all notices (default) or for one particular notice type specified * Get the count of notices added, either for all notices (default) or for one
* by $notice_type. * particular notice type specified by $notice_type.
* *
* @since 2.1
* @param string $notice_type The name of the notice type - either error, success or notice. [optional] * @param string $notice_type The name of the notice type - either error, success or notice. [optional]
* @return int * @return int
*/ */
@ -39,8 +40,9 @@ function wc_notice_count( $notice_type = '' ) {
} }
/** /**
* See if a notice has already been added * Check if a notice has already been added
* *
* @since 2.1
* @param string $message The text to display in the notice. * @param string $message The text to display in the notice.
* @param string $notice_type The singular name of the notice type - either error, success or notice. [optional] * @param string $notice_type The singular name of the notice type - either error, success or notice. [optional]
* @return bool * @return bool
@ -54,6 +56,7 @@ function wc_has_notice( $message, $notice_type = 'success' ) {
/** /**
* Add and store a notice * Add and store a notice
* *
* @since 2.1
* @param string $message The text to display in the notice. * @param string $message The text to display in the notice.
* @param string $notice_type The singular name of the notice type - either error, success or notice. [optional] * @param string $notice_type The singular name of the notice type - either error, success or notice. [optional]
*/ */
@ -62,8 +65,9 @@ function wc_add_notice( $message, $notice_type = 'success' ) {
$notices = WC()->session->get( 'wc_notices', array() ); $notices = WC()->session->get( 'wc_notices', array() );
// Backward compatibility // Backward compatibility
if ( 'success' === $notice_type ) if ( 'success' === $notice_type ) {
$message = apply_filters( 'woocommerce_add_message', $message ); $message = apply_filters( 'woocommerce_add_message', $message );
}
$notices[$notice_type][] = apply_filters( 'woocommerce_add_' . $notice_type, $message ); $notices[$notice_type][] = apply_filters( 'woocommerce_add_' . $notice_type, $message );
@ -105,13 +109,15 @@ add_action( 'woocommerce_before_single_product', 'wc_print_notices', 10 );
/** /**
* Print a single notice immediately * Print a single notice immediately
* *
* @since 2.1
* @param string $message The text to display in the notice. * @param string $message The text to display in the notice.
* @param string $notice_type The singular name of the notice type - either error, success or notice. [optional] * @param string $notice_type The singular name of the notice type - either error, success or notice. [optional]
*/ */
function wc_print_notice( $message, $notice_type = 'success' ) { function wc_print_notice( $message, $notice_type = 'success' ) {
if ( 'success' === $notice_type ) if ( 'success' === $notice_type ) {
$message = apply_filters( 'woocommerce_add_message', $message ); $message = apply_filters( 'woocommerce_add_message', $message );
}
wc_get_template( "notices/{$notice_type}.php", array( wc_get_template( "notices/{$notice_type}.php", array(
'messages' => array( apply_filters( 'woocommerce_add_' . $notice_type, $message ) ) 'messages' => array( apply_filters( 'woocommerce_add_' . $notice_type, $message ) )
@ -120,6 +126,8 @@ function wc_print_notice( $message, $notice_type = 'success' ) {
/** /**
* Returns all queued notices, optionally filtered by a notice type. * Returns all queued notices, optionally filtered by a notice type.
*
* @since 2.1
* @param string $notice_type The singular name of the notice type - either error, success or notice. [optional] * @param string $notice_type The singular name of the notice type - either error, success or notice. [optional]
* @return array|mixed * @return array|mixed
*/ */

View File

@ -31,6 +31,22 @@ function wc_get_order_statuses() {
return apply_filters( 'wc_order_statuses', $order_statuses ); return apply_filters( 'wc_order_statuses', $order_statuses );
} }
/**
* Get the order status label.
*
* @since 2.2
* @param string $status
* @return string
*/
function wc_get_order_status_label( $status ) {
$order_statuses = wc_get_order_statuses();
$status = str_replace( 'wc-', '', $status );
$status = isset( $order_statuses[ 'wc-' . $status ] ) ? $order_statuses[ 'wc-' . $status ] : $status;
return $status;
}
/** /**
* Main function for returning orders, uses the WC_Order_Factory class. * Main function for returning orders, uses the WC_Order_Factory class.
* *
@ -305,7 +321,6 @@ add_action( 'woocommerce_order_status_processing', 'wc_downloadable_product_perm
* *
* @access public * @access public
* @param int $order_id * @param int $order_id
* @param array $data
* @return mixed * @return mixed
*/ */
function wc_add_order_item( $order_id, $item ) { function wc_add_order_item( $order_id, $item ) {

View File

@ -39,7 +39,6 @@ function wc_get_page_id( $page ) {
* *
* Gets the URL for an endpoint, which varies depending on permalink settings. * Gets the URL for an endpoint, which varies depending on permalink settings.
* *
* @param string $page
* @return string * @return string
*/ */
function wc_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) { function wc_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) {
@ -94,7 +93,6 @@ function wc_edit_address_i18n( $id, $flip = false ) {
* Returns the url to the lost password endpoint url * Returns the url to the lost password endpoint url
* *
* @access public * @access public
* @param string $url
* @return string * @return string
*/ */
function wc_lostpassword_url() { function wc_lostpassword_url() {

View File

@ -273,7 +273,7 @@ function wc_placeholder_img( $size = 'shop_thumbnail' ) {
* Gets a formatted version of variation data or item meta * Gets a formatted version of variation data or item meta
* *
* @access public * @access public
* @param array $variation * @param string $variation
* @param bool $flat (default: false) * @param bool $flat (default: false)
* @return string * @return string
*/ */

View File

@ -1403,7 +1403,7 @@ if ( ! function_exists( 'woocommerce_product_subcategories' ) ) {
* @access public * @access public
* @subpackage Loop * @subpackage Loop
* @param array $args * @param array $args
* @return bool * @return null|boolean
*/ */
function woocommerce_product_subcategories( $args = array() ) { function woocommerce_product_subcategories( $args = array() ) {
global $wp_query; global $wp_query;

View File

@ -100,9 +100,7 @@ function _wc_get_product_terms_parent_usort_callback( $a, $b ) {
* Stuck with this until a fix for http://core.trac.wordpress.org/ticket/13258 * Stuck with this until a fix for http://core.trac.wordpress.org/ticket/13258
* We use a custom walker, just like WordPress does * We use a custom walker, just like WordPress does
* *
* @param int $show_counts (default: 1) * @param int $deprecated_show_uncategorized (default: 1)
* @param int $hierarchical (default: 1)
* @param int $show_uncategorized (default: 1)
* @return string * @return string
*/ */
function wc_product_dropdown_categories( $args = array(), $deprecated_hierarchical = 1, $deprecated_show_uncategorized = 1, $deprecated_orderby = '' ) { function wc_product_dropdown_categories( $args = array(), $deprecated_hierarchical = 1, $deprecated_show_uncategorized = 1, $deprecated_orderby = '' ) {
@ -198,7 +196,7 @@ add_action( 'switch_blog', 'wc_taxonomy_metadata_wpdbfix', 0 );
* WooCommerce Term Meta API - Update term meta * WooCommerce Term Meta API - Update term meta
* *
* @param mixed $term_id * @param mixed $term_id
* @param mixed $meta_key * @param string $meta_key
* @param mixed $meta_value * @param mixed $meta_value
* @param string $prev_value (default: '') * @param string $prev_value (default: '')
* @return bool * @return bool
@ -237,7 +235,7 @@ function delete_woocommerce_term_meta( $term_id, $meta_key, $meta_value = '', $d
* WooCommerce Term Meta API - Get term meta * WooCommerce Term Meta API - Get term meta
* *
* @param mixed $term_id * @param mixed $term_id
* @param mixed $key * @param string $key
* @param bool $single (default: true) * @param bool $single (default: true)
* @return mixed * @return mixed
*/ */

View File

@ -10,16 +10,16 @@
"main": "Gruntfile.js", "main": "Gruntfile.js",
"devDependencies": { "devDependencies": {
"grunt": "~0.4.5", "grunt": "~0.4.5",
"grunt-contrib-uglify": "~0.5.1",
"grunt-contrib-less": "~0.11.4",
"grunt-contrib-cssmin": "~0.10.0",
"grunt-shell": "~0.7.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-clean": "~0.6.0",
"grunt-checktextdomain": "^0.1.1", "grunt-checktextdomain": "^0.1.1",
"grunt-wp-i18n": "^0.4.7", "grunt-contrib-clean": "~0.6.0",
"grunt-contrib-jshint": "^0.10.0" "grunt-contrib-copy": "~0.5.0",
"grunt-contrib-cssmin": "~0.10.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-less": "~0.11.4",
"grunt-contrib-uglify": "~0.5.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-shell": "^1.1.1",
"grunt-wp-i18n": "^0.4.8"
}, },
"engines": { "engines": {
"node": ">=0.8.0", "node": ">=0.8.0",

28
phpunit.xml.dist Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
verbose="true"
>
<testsuites>
<testsuite name="WooCommerce Test Suite">
<directory suffix=".php">./tests/unit-tests</directory>
</testsuite>
</testsuites>
<filter>
<blacklist>
<directory suffix=".php">./apigen/</directory>
<directory suffix=".php">./i18n/</directory>
<directory suffix=".php">./templates/</directory>
<directory suffix=".php">./tests/</directory>
<directory suffix=".php">./tmp/</directory>
</blacklist>
</filter>
<logging>
<log type="coverage-clover" target="./tmp/clover.xml" charset="UTF-8" />
</logging>
</phpunit>

View File

@ -1,10 +1,10 @@
=== WooCommerce - excelling eCommerce === === WooCommerce - excelling eCommerce ===
Contributors: woothemes, mikejolley, jameskoster Contributors: woothemes, mikejolley, jameskoster, claudiosanches
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, affiliate, store, sales, sell, shop, shopping, cart, checkout, configurable, variable, widgets, reports, download, downloadable, digital, inventory, stock, reports, shipping, tax Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, affiliate, store, sales, sell, shop, shopping, cart, checkout, configurable, variable, widgets, reports, download, downloadable, digital, inventory, stock, reports, shipping, tax
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce
Requires at least: 3.8 Requires at least: 3.8
Tested up to: 3.9 Tested up to: 4.0
Stable tag: 2.1.10 Stable tag: 2.2.0
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -99,7 +99,7 @@ For extending or theming WooCommerce, see our [codex](http://docs.woothemes.com/
= Where can I get support or talk to other users? = = Where can I get support or talk to other users? =
If you get stuck, WooThemes customers can communicate with one another on the [WooThemes Community Forum](https://support.woothemes.com/hc/communities/public/topics) and non-customers can ask for help from other users on the [WordPress.org Community Forums](http://wordpress.org/support/plugin/woocommerce). If you get stuck you can ask for help on the [WooThemes Community Forum](https://support.woothemes.com/hc/communities/public/topics).
For help with premium add-ons from WooThemes, use [our helpdesk](http://support.woothemes.com/). For help with premium add-ons from WooThemes, use [our helpdesk](http://support.woothemes.com/).
@ -151,6 +151,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Tweak - Load archive-product.php for other product taxonomies. * Tweak - Load archive-product.php for other product taxonomies.
* Tweak - Disable image size settings if filters are being used. * Tweak - Disable image size settings if filters are being used.
* Tweak - Hide the shipping address when local pickup is used. * Tweak - Hide the shipping address when local pickup is used.
* Tweak - Password protected posts are not hidden from catalog by default anymore, visibility can be set via the 'Catalog visibility' option.
* Dev - API Version 2 with push support. * Dev - API Version 2 with push support.
* Dev - API: Lookup customers by email endpoint. * Dev - API: Lookup customers by email endpoint.
* Dev - API: Allow ordering on the resource level. * Dev - API: Allow ordering on the resource level.

View File

@ -6,13 +6,13 @@
$ phpunit --version $ phpunit --version
2) Install WordPress and the WP Unit Test lib using the `install-wp-tests.sh` script. Change to the plugin root directory and type: 2) Install WordPress and the WP Unit Test lib using the `install.sh` script. Change to the plugin root directory and type:
$ tests/install-wp-tests.sh <db-name> <db-user> <db-password> [db-host] $ tests/bin/install.sh <db-name> <db-user> <db-password> [db-host]
Sample usage: Sample usage:
$ tests/install-wp-tests.sh woocommerce_tests root root $ tests/bin/install.sh woocommerce_tests root root
**Important**: The `<db-name>` database will be created if it doesn't exist and all data will be removed during testing. **Important**: The `<db-name>` database will be created if it doesn't exist and all data will be removed during testing.
@ -34,8 +34,20 @@ A text code coverage summary can be displayed using the `--coverage-text` option
## Writing Tests ## Writing Tests
TODO * Each test file should roughly correspond to an associated source file, e.g. the `formatting-functions.php` test file covers code in the `wc-formatting-functions.php` file
* Each test method should cover a single method or function with one or more assertions
* A single method or function can have multiple associated test methods if it's a large or complex method
* Use the test coverage HTML report (under `tmp/coverage/index.html`) to examine which lines your tests are covering and aim for 100% coverage
* For code that cannot be tested (e.g. they require a certain PHP version), you can exclude them from coverage using a comment: `// @codeCoverageIgnoreStart` and `// @codeCoverageIgnoreEnd`. For example, see [`wc_round_tax_total()`](https://github.com/woothemes/woocommerce/blob/master/includes/wc-formatting-functions.php#L155-155)
* In addition to covering each line of a method/function, make sure to test common input and edge cases.
* Prefer `assertsEquals()` where possible as it tests both type & equality
* Remember that only methods prefixed with `test` will be run so use helper methods liberally to keep test methods small and reduce code duplication. If there is a common helper method used in multiple test files, consider adding it to the `WC_Unit_Test_Case` class so it can be shared by all test cases
* Filters persist between test cases so be sure to remove them in your test method or in the `tearDown()` method.
## Automated Tests ## Automated Tests
Tests are automatically run with Travis-CI for each commit and pull request. Tests are automatically run with [Travis-CI](https://travis-ci.org) for each commit and pull request.
## Code Coverage
Code coverage is available on [Coveralls](https://coveralls.io/) which receives updated data after each Travis build.

5
tests/install-wp-tests.sh → tests/bin/install.sh Normal file → Executable file
View File

@ -16,7 +16,6 @@ WP_VERSION=${5-latest}
WP_TESTS_DIR="${PWD}/tmp/wordpress-tests-lib" WP_TESTS_DIR="${PWD}/tmp/wordpress-tests-lib"
WP_CORE_DIR="${PWD}/tmp/wordpress/" WP_CORE_DIR="${PWD}/tmp/wordpress/"
set -ex set -ex
install_wp() { install_wp() {
@ -55,6 +54,10 @@ install_test_suite() {
sed $ioption "s/yourusernamehere/$DB_USER/" wp-tests-config.php sed $ioption "s/yourusernamehere/$DB_USER/" wp-tests-config.php
sed $ioption "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php sed $ioption "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php
sed $ioption "s|localhost|${DB_HOST}|" wp-tests-config.php sed $ioption "s|localhost|${DB_HOST}|" wp-tests-config.php
sed $ioption "s/wptests_/wctests_/" wp-tests-config.php
sed $ioption "s/example.org/woocommerce.com/" wp-tests-config.php
sed $ioption "s/admin@example.org/tests@woocommerce.com/" wp-tests-config.php
sed $ioption "s/Test Blog/WooCommerce Unit Tests/" wp-tests-config.php
} }
install_db() { install_db() {

20
tests/bin/travis.sh Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# usage: travis.sh before|after
if [ $1 == 'before' ]; then
# composer install fails in PHP 5.2
[ $TRAVIS_PHP_VERSION == '5.2' ] && exit;
# install php-coveralls to send coverage info
composer init --require=satooshi/php-coveralls:0.7.x-dev -n
composer install --no-interaction
elif [ $1 == 'after' ]; then
# no Xdebug and therefore no coverage in PHP 5.2
[ $TRAVIS_PHP_VERSION == '5.2' ] && exit;
# send coverage data to coveralls
php vendor/bin/coveralls --verbose --exclude-no-stmt
fi

View File

@ -84,7 +84,15 @@ class WC_Unit_Tests_Bootstrap {
*/ */
public function includes() { public function includes() {
require_once( $this->tests_dir . '/framework/wc-unit-test-factory.php' ); // factories
require_once( $this->tests_dir . '/framework/factories/class-wc-unit-test-factory-for-webhook.php' );
require_once( $this->tests_dir . '/framework/factories/class-wc-unit-test-factory-for-webhook-delivery.php' );
// framework
require_once( $this->tests_dir . '/framework/class-wc-unit-test-factory.php' );
require_once( $this->tests_dir . '/framework/class-wc-mock-session-handler.php' );
// test cases
require_once( $this->tests_dir . '/framework/class-wc-unit-test-case.php' ); require_once( $this->tests_dir . '/framework/class-wc-unit-test-case.php' );
require_once( $this->tests_dir . '/framework/class-wc-api-unit-test-case.php' ); require_once( $this->tests_dir . '/framework/class-wc-api-unit-test-case.php' );
} }

View File

@ -0,0 +1,7 @@
<?php
/**
* WooCommerce Mock Session Handler
*
* @since 2.2
*/
class WC_Mock_Session_Handler extends WC_Session { }

View File

@ -23,6 +23,37 @@ class WC_Unit_Test_Case extends WP_UnitTestCase {
// add custom factories // add custom factories
$this->factory = new WC_Unit_Test_Factory(); $this->factory = new WC_Unit_Test_Factory();
// setup mock WC session handler
add_filter( 'woocommerce_session_handler', array( $this, 'set_mock_session_handler' ) );
$this->setOutputCallback( array( $this, 'filter_output' ) );
}
/**
* Mock the WC session using the abstract class as cookies are not available
* during tests
*
* @since 2.2
* @return string
*/
public function set_mock_session_handler() {
return 'WC_Mock_Session_Handler';
}
/**
* Strip newlines and tabs when using expectedOutputString() as otherwise
* the most template-related tests will fail due to indentation/alignment in
* the template not matching the sample strings set in the tests
*
* @since 2.2
*/
public function filter_output( $output ) {
$output = preg_replace( '/[\n]+/S', '', $output );
$output = preg_replace( '/[\t]+/S', '', $output );
return $output;
} }
/** /**
@ -36,4 +67,24 @@ class WC_Unit_Test_Case extends WP_UnitTestCase {
$this->assertNotInstanceOf( 'WP_Error', $actual, $message ); $this->assertNotInstanceOf( 'WP_Error', $actual, $message );
} }
/**
* Backport assertNotFalse to PHPUnit 3.6.12 which only runs in PHP 5.2
*
* @since 2.2
* @param $condition
* @param string $message
* @return mixed
*/
public static function assertNotFalse( $condition, $message = '' ) {
if ( version_compare( phpversion(), '5.3', '<' ) ) {
self::assertThat( $condition, self::logicalNot( self::isFalse() ), $message );
} else {
parent::assertNotFalse( $condition, $message );
}
}
} }

View File

@ -0,0 +1,28 @@
<?php
/**
* WC Unit Test Factory
*
* Provides WooCommerce-specific factories
*
* @since 2.2
*/
class WC_Unit_Test_Factory extends WP_UnitTest_Factory {
/** @var \WC_Unit_Test_Factory_For_Webhook */
public $webhook;
/** @var \WC_Unit_Test_Factory_For_Webhook_Delivery */
public $webhook_delivery;
/**
* Setup factories
*/
public function __construct() {
parent::__construct();
$this->webhook = new WC_Unit_Test_Factory_For_Webhook( $this );
$this->webhook_delivery = new WC_Unit_Test_Factory_For_Webhook_Delivery( $this );
}
}

View File

@ -1,30 +1,8 @@
<?php <?php
/**
* WC Unit Test Factory
*
* Provides WooCommerce-specific factories
*
* @since 2.2
*/
class WC_Unit_Test_Factory extends WP_UnitTest_Factory {
/** @var \WC_Unit_Test_Factory_For_Webhook_Delivery */
public $webhook_delivery;
/**
* Setup factories
*/
public function __construct() {
parent::__construct();
$this->webhook_delivery = new WC_Unit_Test_Factory_For_Webhook_Delivery( $this );
}
}
/** /**
* Webhook Delivery Test Factory * Webhook Delivery Test Factory
* *
* @see \WP_UnitTest_Factory_For_Comment
* @since 2.2 * @since 2.2
*/ */
class WC_Unit_Test_Factory_For_Webhook_Delivery extends WP_UnitTest_Factory_For_Comment { class WC_Unit_Test_Factory_For_Webhook_Delivery extends WP_UnitTest_Factory_For_Comment {

View File

@ -0,0 +1,71 @@
<?php
/**
* Webhook Test Factory
*
* @see \WP_UnitTest_Factory_For_Post
* @since 2.2
*/
class WC_Unit_Test_Factory_For_Webhook extends WP_UnitTest_Factory_For_Post {
/**
* Setup factory
*
* @since 2.2
* @param null $factory
*/
public function __construct( $factory = null ) {
parent::__construct( $factory );
// set default
$this->default_generation_definitions = array(
'post_status' => 'publish',
'post_title' => rand_str(),
'post_type' => 'shop_webhook',
);
}
/**
* Create a mock webhook
*
* @since 2.2
* @see WP_UnitTest_Factory_For_Post::create_object()
* @param array $args
* @return int webhook (post) ID
*/
public function create_object( $args ) {
$id = parent::create_object( $args );
$meta_args = array(
'_topic' => 'coupon.created',
'_resource' => 'coupon',
'_event' => 'created',
'_hooks' => array(
'woocommerce_process_shop_coupon_meta',
'woocommerce_api_create_coupon',
),
'_delivery_url' => 'http://requestb.in/Tt8675309',
);
foreach ( $meta_args as $key => $value ) {
update_post_meta( $id, $key, $value );
}
return $id;
}
/**
* Get a mock webhook object
*
* @since 2.2
* @see WP_UnitTest_Factory_For_Post::get_object_by_id()
* @param int $id webhook ID
* @return \WC_Webhook webhook instance
*/
public function get_object_by_id( $id ) {
return new WC_Webhook( $id );
}
}

View File

@ -28,31 +28,8 @@ class WC_Tests_Webhooks extends WC_API_Unit_Test_Case {
$this->endpoint = WC()->api->WC_API_Webhooks; $this->endpoint = WC()->api->WC_API_Webhooks;
$post_args = array(
'post_type' => 'shop_webhook',
'post_status' => 'publish',
'post_title' => rand_str(),
);
$post_id = $this->factory->post->create( $post_args );
$meta_args = array(
'_topic' => 'coupon.created',
'_resource' => 'coupon',
'_event' => 'created',
'_hooks' => array(
'woocommerce_process_shop_coupon_meta',
'woocommerce_api_create_coupon',
),
'_delivery_url' => rand_str(),
);
foreach ( $meta_args as $key => $value ) {
update_post_meta( $post_id, $key, $value );
}
// mock webhook // mock webhook
$this->webhook = new WC_Webhook( $post_id ); $this->webhook = $this->factory->webhook->create_and_get();
// mock webhook delivery // mock webhook delivery
$this->webhook_delivery_id = $this->factory->webhook_delivery->create( array( 'comment_post_ID' => $this->webhook->id ) ); $this->webhook_delivery_id = $this->factory->webhook_delivery->create( array( 'comment_post_ID' => $this->webhook->id ) );

View File

@ -101,11 +101,13 @@ class WC_Tests_Core_Functions extends WC_Unit_Test_Case {
*/ */
public function test_get_woocommerce_api_url() { public function test_get_woocommerce_api_url() {
$base_uri = get_home_url();
// base uri // base uri
$this->assertEquals( 'http://example.org/wc-api/v2/', get_woocommerce_api_url( null ) ); $this->assertEquals( "$base_uri/wc-api/v2/", get_woocommerce_api_url( null ) );
// path // path
$this->assertEquals( 'http://example.org/wc-api/v2/orders', get_woocommerce_api_url( 'orders' ) ); $this->assertEquals( "$base_uri/wc-api/v2/orders", get_woocommerce_api_url( 'orders' ) );
} }
/** /**

View File

@ -0,0 +1,37 @@
<?php
/**
* Test WC coupon functions
*
* @since 2.2
*/
class WC_Tests_Coupon_Functions extends WC_Unit_Test_Case {
/**
* Test wc_get_coupon_types()
*
* @since 2.2
*/
public function test_wc_get_coupon_types() {
$coupon_types = array(
'fixed_cart' => __( 'Cart Discount', 'woocommerce' ),
'percent' => __( 'Cart % Discount', 'woocommerce' ),
'fixed_product' => __( 'Product Discount', 'woocommerce' ),
'percent_product' => __( 'Product % Discount', 'woocommerce' )
);
$this->assertEquals( $coupon_types, wc_get_coupon_types() );
}
/**
* Test wc_get_coupon_type()
*
* @since 2.2
*/
public function test_wc_get_coupon_type() {
$this->assertEquals( 'Cart Discount', wc_get_coupon_type( 'fixed_cart' ) );
$this->assertEmpty( wc_get_coupon_type( 'bogus_type' ) );
}
}

View File

@ -0,0 +1,523 @@
<?php
/**
* Test WC formatting functions
*
* @since 2.2
*/
class WC_Tests_Formatting_Functions extends WC_Unit_Test_Case {
/**
* Test wc_sanitize_taxonomy_name()
*
* @since 2.2
*/
public function test_wc_sanitize_taxonomy_name() {
$this->assertEquals( 'name-with-spaces', wc_sanitize_taxonomy_name( 'Name With Spaces' ) );
$this->assertEquals( 'namewithtabs', wc_sanitize_taxonomy_name( 'Name With Tabs' ) );
$this->assertEquals( 'specialchars', wc_sanitize_taxonomy_name( 'special!@#$%^&*()chars' ) );
$this->assertEquals( 'look-of-ಠ_ಠ', wc_sanitize_taxonomy_name( 'Look Of ಠ_ಠ' ) );
}
/**
* Test wc_get_filename_from_url()
*
* @since 2.2
*/
public function test_wc_get_filename_from_url() {
$this->assertEquals( 'woocommerce.pdf', wc_get_filename_from_url( 'http://www.woothemes.com/woocommerce.pdf' ) );
$this->assertEmpty( wc_get_filename_from_url( 'ftp://wc' ) );
$this->assertEmpty( wc_get_filename_from_url( 'http://www.skyverge.com' ) );
$this->assertEquals( 'woocommerce', wc_get_filename_from_url( 'http://www.woothemes.com/woocommerce' ) );
}
/**
* Test wc_get_dimension()
*
* @since 2.2
*/
public function test_wc_get_dimension() {
// save default
$default_unit = get_option( 'woocommerce_dimension_unit' );
// cm (default unit)
$this->assertEquals( 10, wc_get_dimension( 10, 'cm' ) );
$this->assertEquals( 3.937, wc_get_dimension( 10, 'in' ) );
$this->assertEquals( 0.10936133, wc_get_dimension( 10, 'yd' ) );
$this->assertEquals( 100, wc_get_dimension( 10, 'mm' ) );
$this->assertEquals( 0.1, wc_get_dimension( 10, 'm' ) );
// in
update_option( 'woocommerce_dimension_unit', 'in' );
$this->assertEquals( 25.4, wc_get_dimension( 10, 'cm' ) );
$this->assertEquals( 10, wc_get_dimension( 10, 'in' ) );
$this->assertEquals( 0.2777777782, wc_get_dimension( 10, 'yd' ) );
$this->assertEquals( 254, wc_get_dimension( 10, 'mm' ) );
$this->assertEquals( 0.254, wc_get_dimension( 10, 'm' ) );
// m
update_option( 'woocommerce_dimension_unit', 'm' );
$this->assertEquals( 1000, wc_get_dimension( 10, 'cm' ) );
$this->assertEquals( 393.7, wc_get_dimension( 10, 'in' ) );
$this->assertEquals( 10.936133, wc_get_dimension( 10, 'yd' ) );
$this->assertEquals( 10000, wc_get_dimension( 10, 'mm' ) );
$this->assertEquals( 10, wc_get_dimension( 10, 'm' ) );
// mm
update_option( 'woocommerce_dimension_unit', 'mm' );
$this->assertEquals( 1, wc_get_dimension( 10, 'cm' ) );
$this->assertEquals( 0.3937, wc_get_dimension( 10, 'in' ) );
$this->assertEquals( 0.010936133, wc_get_dimension( 10, 'yd' ) );
$this->assertEquals( 10, wc_get_dimension( 10, 'mm' ) );
$this->assertEquals( 0.01, wc_get_dimension( 10, 'm' ) );
// yd
update_option( 'woocommerce_dimension_unit', 'yd' );
$this->assertEquals( 914.4, wc_get_dimension( 10, 'cm' ) );
$this->assertEquals( 359.99928, wc_get_dimension( 10, 'in' ) );
$this->assertEquals( 10, wc_get_dimension( 10, 'yd' ) );
$this->assertEquals( 9144, wc_get_dimension( 10, 'mm' ) );
$this->assertEquals( 9.144, wc_get_dimension( 10, 'm' ) );
// negative
$this->assertEquals( 0, wc_get_dimension( -10, 'mm' ) );
// restore default
update_option( 'woocommerce_dimension_unit', $default_unit );
}
/**
* Test wc_get_weight()
*
* @since 2.2
*/
public function test_wc_get_weight() {
// save default
$default_unit = get_option( 'woocommerce_weight_unit' );
// kg (default unit)
$this->assertEquals( 10, wc_get_weight( 10, 'kg' ) );
$this->assertEquals( 10000, wc_get_weight( 10, 'g' ) );
$this->assertEquals( 22.046, wc_get_weight( 10, 'lbs' ) );
$this->assertEquals( 352.74, wc_get_weight( 10, 'oz' ) );
// g
update_option( 'woocommerce_weight_unit', 'g' );
$this->assertEquals( 0.01, wc_get_weight( 10, 'kg' ) );
$this->assertEquals( 10, wc_get_weight( 10, 'g' ) );
$this->assertEquals( 0.022046, wc_get_weight( 10, 'lbs' ) );
$this->assertEquals( 0.35274, wc_get_weight( 10, 'oz' ) );
// lbs
update_option( 'woocommerce_weight_unit', 'lbs' );
$this->assertEquals( 4.536, wc_get_weight( 10, 'kg' ) );
$this->assertEquals( 4536, wc_get_weight( 10, 'g' ) );
$this->assertEquals( 10, wc_get_weight( 10, 'lbs' ) );
$this->assertEquals( 160.002864, wc_get_weight( 10, 'oz' ) );
// oz
update_option( 'woocommerce_weight_unit', 'oz' );
$this->assertEquals( 0.283, wc_get_weight( 10, 'kg' ) );
$this->assertEquals( 283, wc_get_weight( 10, 'g' ) );
$this->assertEquals( 0.6239018, wc_get_weight( 10, 'lbs' ) );
$this->assertEquals( 10, wc_get_weight( 10, 'oz' ) );
// negative
$this->assertEquals( 0, wc_get_weight( -10, 'g' ) );
// restore default
update_option( 'woocommerce_weight_unit', $default_unit );
}
/**
* Test wc_trim_zeros()
*
* @since 2.2
*/
public function test_wc_trim_zeros() {
$this->assertEquals( '$1', wc_trim_zeros( '$1.00' ) );
$this->assertEquals( '$1.10', wc_trim_zeros( '$1.10' ) );
}
/**
* Test wc_round_tax_total()
*
* Note the PHP 5.2 section of wc_round_tax_total() is excluded from test
* coverage
*
* @since 2.2
*/
public function test_wc_round_tax_total() {
$this->assertEquals( 1.25, wc_round_tax_total( 1.246 ) );
$this->assertEquals( 20, wc_round_tax_total( 19.9997 ) );
$this->assertEquals( 19.99, wc_round_tax_total( 19.99 ) );
}
/**
* Test wc_format_refund_total()
*
* @since 2.2
*/
public function test_wc_format_refund_total() {
$this->assertEquals( -10, wc_format_refund_total( 10 ) );
$this->assertEquals( 10, wc_format_refund_total( -10 ) );
}
/**
* Test wc_format_decimal()
*
* @since 2.2
*/
public function test_wc_format_decimal() {
// given string
$this->assertEquals( '9.99', wc_format_decimal( '9.99' ) );
// float
$this->assertEquals( '9.99', wc_format_decimal( 9.99 ) );
// dp = false, no rounding
$this->assertEquals( '9.9999', wc_format_decimal( 9.9999 ) );
// dp = use default (2)
$this->assertEquals( '9.99', wc_format_decimal( 9.9911, '' ) );
// dp = use default (2) and round
$this->assertEquals( '10.00', wc_format_decimal( 9.9999, '' ) );
// dp = use custom
$this->assertEquals( '9.991', wc_format_decimal( 9.9912, 3 ) );
// trim zeros
$this->assertEquals( '9', wc_format_decimal( 9.00, false, true ) );
// trim zeros and round
$this->assertEquals( '10', wc_format_decimal( 9.9999, '', true ) );
}
/**
* Test wc_float_to_string()
*
* @since 2.2
*/
public function test_wc_float_to_string() {
// given string, return string
$this->assertEquals( '1.99', wc_float_to_string( '1.99' ) );
$this->assertEquals( '1.17', wc_float_to_string( 1.17 ) );
}
/**
* Test wc_format_localized_price()
*
* @since 2.2
*/
public function test_wc_format_localized_price() {
// save default
$decimal_sep = get_option( 'woocommerce_price_decimal_sep' );
update_option( 'woocommerce_price_decimal_sep', ',' );
$this->assertEquals( '1,17', wc_format_localized_price( '1.17' ) );
// restore default
update_option( 'woocommerce_price_decimal_sep', $decimal_sep );
}
/**
* Test wc_format_localized_decimal()
*
* @since 2.2
*/
public function test_wc_format_localized_decimal() {
$this->assertEquals( '1.17', wc_format_localized_decimal( '1.17' ) );
}
/**
* Test wc_clean() - note this is a basic type test as WP core already
* has coverage for sanitized_text_field()
*
* @since 2.2
*/
public function test_wc_clean() {
$this->assertInternalType( 'string', wc_clean( 'cleaned' ) );
}
/**
* Test wc_array_overlay()
*
* @since 2.2
*/
public function test_wc_array_overlay() {
$a1 = array(
'apple' => 'banana',
'pear' => 'grape',
'vegetables' => array(
'cucumber' => 'asparagus',
)
);
$a2 = array(
'strawberry' => 'orange',
'apple' => 'kiwi',
'vegetables' => array(
'cucumber' => 'peas',
),
);
$overlayed = array(
'apple' => 'kiwi',
'pear' => 'grape',
'vegetables' => array(
'cucumber' => 'peas',
),
);
$this->assertEquals( $overlayed, wc_array_overlay( $a1, $a2 ) );
}
/**
* Test wc_stock_amount()
*
* @since 2.2
*/
public function test_wc_stock_amount() {
$this->assertEquals( 10, wc_stock_amount( 10 ) );
$this->assertEquals( 10, wc_stock_amount( '10' ) );
$this->assertEquals( 3, wc_stock_amount( 3.43 ) );
}
/**
* Test wc_get_woocommerce_price_format()
*
* @since 2.2
*/
public function test_get_woocommerce_price_format() {
// save default
$currency_pos = get_option( 'woocommerce_currency_pos' );
// default format (left)
$this->assertEquals( '%1$s%2$s', get_woocommerce_price_format() );
// right
update_option( 'woocommerce_currency_pos', 'right' );
$this->assertEquals( '%2$s%1$s', get_woocommerce_price_format() );
// left space
update_option( 'woocommerce_currency_pos', 'left_space' );
$this->assertEquals( '%1$s&nbsp;%2$s', get_woocommerce_price_format() );
// right space
update_option( 'woocommerce_currency_pos', 'right_space' );
$this->assertEquals( '%2$s&nbsp;%1$s', get_woocommerce_price_format() );
// restore default
update_option( 'woocommerce_currency_pos', $currency_pos );
}
/**
* Test wc_price()
*
* @since 2.2
*/
public function test_wc_price() {
// common prices
$this->assertEquals( '<span class="amount">&pound;1.00</span>', wc_price( 1 ) );
$this->assertEquals( '<span class="amount">&pound;1.10</span>', wc_price( 1.1 ) );
$this->assertEquals( '<span class="amount">&pound;1.17</span>', wc_price( 1.17 ) );
$this->assertEquals( '<span class="amount">&pound;1,111.17</span>', wc_price( 1111.17 ) );
$this->assertEquals( '<span class="amount">&pound;0.00</span>', wc_price( 0 ) );
// different currency
$this->assertEquals( '<span class="amount">&#36;1,111.17</span>', wc_price( 1111.17, array( 'currency' => 'USD' ) ) );
// negative price
$this->assertEquals( '<span class="amount">-&pound;1.17</span>', wc_price( -1.17 ) );
// bogus prices
$this->assertEquals( '<span class="amount">&pound;0.00</span>', wc_price( null ) );
$this->assertEquals( '<span class="amount">&pound;0.00</span>', wc_price( 'Q' ) );
$this->assertEquals( '<span class="amount">&pound;0.00</span>', wc_price( 'ಠ_ಠ' ) );
// trim zeros
add_filter( 'woocommerce_price_trim_zeros', '__return_true' );
$this->assertEquals( '<span class="amount">&pound;1</span>', wc_price( 1.00 ) );
remove_filter( 'woocommerce_price_trim_zeros', '__return_true' );
// ex tax label
$calc_taxes = get_option( 'woocommerce_calc_taxes' );
update_option( 'woocommerce_calc_taxes', 'yes' );
$this->assertEquals( '<span class="amount">&pound;1,111.17</span> <small>(ex. VAT)</small>', wc_price( '1111.17', array( 'ex_tax_label' => true ) ) );
update_option( 'woocommerce_calc_taxes', $calc_taxes );
}
/**
* Test wc_let_to_num()
*
* @since 2.2
*/
public function test_wc_let_to_num() {
$sizes = array(
'10K' => 10240,
'10M' => 10485760,
'10G' => 10737418240,
'10T' => 10995116277760,
'10P' => 11258999068426240,
);
foreach ( $sizes as $notation => $size ) {
$this->assertEquals( $size, wc_let_to_num( $notation ) );
}
}
/**
* Test wc_date_format()
*
* @since 2.2
*/
public function test_wc_date_format() {
$this->assertEquals( get_option( 'date_format' ), wc_date_format() );
}
/**
* Test wc_time_format()
*
* @since 2.2
*/
public function test_wc_time_format() {
$this->assertEquals( get_option( 'time_format' ), wc_time_format() );
}
/**
* Test wc_timezone_string()
*
* @since 2.2
*/
public function test_wc_timezone_string() {
// test when timezone string exists
update_option( 'timezone_string', 'America/New_York' );
$this->assertEquals( 'America/New_York', wc_timezone_string() );
// restore default
update_option( 'timezone_string', '' );
// test with missing UTC offset
delete_option( 'gmt_offset' );
$this->assertEquals( 'UTC', wc_timezone_string() );
// test with manually set UTC offset
update_option( 'gmt_offset', -4 );
$this->assertEquals( 'America/Boa_Vista', wc_timezone_string() );
// test with invalid offset
update_option( 'gmt_offset', 99 );
$this->assertEquals( 'UTC', wc_timezone_string() );
// restore default
update_option( 'gmt_offset', '0' );
}
/**
* Test wc_rgb_from_hex()
*
* @since 2.2
*/
public function test_wc_rgb_from_hex() {
$rgb = array(
'R' => 0,
'G' => 93,
'B' => 171,
);
$this->assertEquals( $rgb, wc_rgb_from_hex( '005dab' ) );
$this->assertEquals( $rgb, wc_rgb_from_hex( '#005dab' ) );
}
/**
* Test wc_hex_darker()
*
* @since 2.2
*/
public function test_wc_hex_darker() {
$this->assertEquals( '#004178', wc_hex_darker( '005dab' ) );
$this->assertEquals( '#004178', wc_hex_darker( '#005dab' ) );
}
/**
* Test wc_hex_lighter()
*
* @since 2.2
*/
public function test_wc_hex_lighter() {
$this->assertEquals( '#4d8ec4', wc_hex_lighter( '005dab' ) );
$this->assertEquals( '#4d8ec4', wc_hex_lighter( '#005dab' ) );
$this->assertEquals( '#0c3a3b', wc_hex_lighter( '0a3839', 1 ) );
}
/**
* Test wc_light_or_dark()
*
* @since 2.2
*/
public function test_wc_light_or_dark() {
$this->assertEquals( '#FFFFFF', wc_light_or_dark( '005dab' ) );
$this->assertEquals( '#FFFFFF', wc_light_or_dark( '#005dab' ) );
}
/**
* Test wc_format_hex()
*
* @since 2.2
*/
public function test_wc_format_hex() {
$this->assertEquals( '#CCCCCC', wc_format_hex( 'CCC' ) );
$this->assertEquals( '#CCCCCC', wc_format_hex( '#CCC' ) );
$this->assertEquals( null, wc_format_hex( null ) );
}
/**
* Test wc_format_postcode()
*
* @since 2.2
*/
public function test_wc_format_postcode() {
// generic postcode
$this->assertEquals( '02111', wc_format_postcode( ' 02111 ', 'US' ) );
// UK postcode
$this->assertEquals( 'PCRN 1ZZ', wc_format_postcode( 'pcrn1zz', 'GB' ) );
}
/**
* Test wc_format_phone_number()
*
* @since 2.2
*/
public function test_wc_format_phone_number() {
$this->assertEquals( '1-610-385-0000', wc_format_phone_number( '1.610.385.0000' ) );
}
}

View File

@ -0,0 +1,184 @@
<?php
/**
* Test WC notice functions
*
* @since 2.2
*/
class WC_Tests_Notice_Functions extends WC_Unit_Test_Case {
/**
* Clear out notices after each test
*
* @since 2.2
*/
public function tearDown() {
WC()->session->set( 'wc_notices', null );
}
/**
* Test wc_notice_count()
*
* @since 2.2
*/
function test_wc_notice_count() {
// no notices
$this->assertEquals( 0, wc_notice_count() );
// single notice
wc_add_notice( 'Bogus Notice', 'success' );
$this->assertEquals( 1, wc_notice_count() );
// specific notice
wc_add_notice( 'Bogus Error Notice', 'error' );
$this->assertEquals( 1, wc_notice_count( 'error' ) );
// multiple notices of different types
wc_add_notice( 'Bogus Notice 2', 'success' );
wc_add_notice( 'Bogus Error Notice 2', 'error' );
$this->assertEquals( 4, wc_notice_count() );
}
/**
* Test wc_has_notice()
*
* @since 2.2
*/
function test_wc_has_notice() {
// negative
wc_add_notice( 'Bogus Notice', 'success' );
$this->assertFalse( wc_has_notice( 'Legit Notice' ) );
// positive
wc_add_notice( 'One True Notice', 'notice' );
$this->assertTrue( wc_has_notice( 'One True Notice', 'notice' ) );
}
/**
* Test wc_notice_add_notice()
*
* @since 2.2
*/
function test_wc_add_notice() {
// default type
wc_add_notice( 'Test Notice' );
$notices = wc_get_notices();
$this->assertArrayHasKey( 'success', $notices );
$this->assertEquals( 'Test Notice', $notices['success'][0] );
// clear notices
WC()->session->set( 'wc_notices', null );
// specific type
wc_add_notice( 'Test Error Notice', 'error' );
$notices = wc_get_notices();
$this->assertArrayHasKey( 'error', $notices );
$this->assertEquals( 'Test Error Notice', $notices['error'][0] );
}
/**
* Test wc_clear_notices()
*
* @since 2.2
*/
function test_wc_clear_notices() {
wc_add_notice( 'Test Notice' );
wc_clear_notices();
$this->assertEmpty( WC()->session->get( 'wc_notices' ) );
}
/**
* Test wc_print_notices()
*
* @since 2.2
*/
public function test_wc_print_notices() {
wc_add_notice( 'One True Notice', 'notice' );
$this->expectOutputString( '<div class="woocommerce-info">One True Notice</div>' );
wc_print_notices();
$this->assertEmpty( WC()->session->get( 'wc_notices' ) );
}
/**
* Test actions that print the notices
*
* @since 2.2
*/
public function test_wc_print_notices_actions() {
$this->assertNotFalse( has_action( 'woocommerce_before_shop_loop', 'wc_print_notices' ) );
$this->assertNotFalse( has_action( 'woocommerce_before_single_product', 'wc_print_notices' ) );
}
/**
* Test wc_print_notice() w/ success type
*
* @since 2.2
*/
public function test_wc_print_success_notice() {
$this->expectOutputString( '<div class="woocommerce-message">Success!</div>' );
wc_print_notice( 'Success!' );
}
/**
* Test wc_print_notice() w/ notice type
*
* @since 2.2
*/
public function test_wc_print_info_notice() {
$this->expectOutputString( '<div class="woocommerce-info">Info!</div>' );
wc_print_notice( 'Info!', 'notice' );
}
/**
* Test wc_print_notice() w/ error type
*
* @since 2.2
*/
public function test_wc_print_error_notice() {
// specific type
$this->expectOutputString( '<ul class="woocommerce-error"><li>Error!</li></ul>' );
wc_print_notice( 'Error!', 'error' );
}
/**
* Test wc_get_notices()
*
* @since 2.2
*/
public function test_wc_get_notices() {
// no notices
$notices = wc_get_notices();
$this->assertInternalType( 'array', $notices );
$this->assertEmpty( $notices );
// default type
wc_add_notice( 'Another Notice' );
$this->assertEquals( array( 'success' => array( 'Another Notice' ) ), wc_get_notices() );
// specific type
wc_add_notice( 'Error Notice', 'error' );
$this->assertEquals( array( 'Error Notice' ), wc_get_notices( 'error' ) );
// invalid type
$notices = wc_get_notices( 'bogus_type' );
$this->assertInternalType( 'array', $notices );
$this->assertEmpty( $notices );
}
}

View File

@ -64,7 +64,7 @@ class WC_Tests_WooCommerce extends WC_Unit_Test_Case {
$this->assertInstanceOf( 'WC_Product_Factory', $this->wc->product_factory ); $this->assertInstanceOf( 'WC_Product_Factory', $this->wc->product_factory );
$this->assertInstanceOf( 'WC_Order_Factory', $this->wc->order_factory ); $this->assertInstanceOf( 'WC_Order_Factory', $this->wc->order_factory );
$this->assertInstanceOf( 'WC_Countries', $this->wc->countries ); $this->assertInstanceOf( 'WC_Countries', $this->wc->countries );
$this->assertInstanceOf( 'WC_Session_Handler', $this->wc->session ); $this->assertInstanceOf( 'WC_Mock_Session_Handler', $this->wc->session );
$this->assertInstanceOf( 'WC_Cart', $this->wc->cart ); $this->assertInstanceOf( 'WC_Cart', $this->wc->cart );
$this->assertInstanceOf( 'WC_Customer', $this->wc->customer ); $this->assertInstanceOf( 'WC_Customer', $this->wc->customer );
} }

View File

@ -3,11 +3,11 @@
* Plugin Name: WooCommerce * Plugin Name: WooCommerce
* Plugin URI: http://www.woothemes.com/woocommerce/ * Plugin URI: http://www.woothemes.com/woocommerce/
* Description: An e-commerce toolkit that helps you sell anything. Beautifully. * Description: An e-commerce toolkit that helps you sell anything. Beautifully.
* Version: 2.2.0-bleeding * Version: 2.2.0-RC1
* Author: WooThemes * Author: WooThemes
* Author URI: http://woothemes.com * Author URI: http://woothemes.com
* Requires at least: 3.8 * Requires at least: 3.8
* Tested up to: 3.9 * Tested up to: 4.0
* *
* Text Domain: woocommerce * Text Domain: woocommerce
* Domain Path: /i18n/languages/ * Domain Path: /i18n/languages/
@ -510,7 +510,7 @@ final class WooCommerce {
/** /**
* Return the WC API URL for a given request * Return the WC API URL for a given request
* *
* @param mixed $request * @param string $request
* @param mixed $ssl (default: null) * @param mixed $ssl (default: null)
* @return string * @return string
*/ */
@ -597,7 +597,7 @@ final class WooCommerce {
/** /**
* Email Class. * Email Class.
* *
* @return WC_Email * @return WC_Emails
*/ */
public function mailer() { public function mailer() {
return WC_Emails::instance(); return WC_Emails::instance();