Merge branch 'master'
|
@ -1,56 +1,62 @@
|
|||
# How To Contribute
|
||||
# Contributing to WooCommerce ✨
|
||||
|
||||
Community made patches, localizations, bug reports and contributions are always welcome and crucial to ensure WooCommerce remains the leading eCommerce platform for WordPress. WooCommerce currently powers 30% of all online stores across the internet, and your help making it even more awesome will be greatly appreciated :)
|
||||
There are many ways to contribute to the WooCommerce project!
|
||||
|
||||
When contributing please ensure you follow the guidelines below to help us keep on top of things.
|
||||
- Translating strings into your language.
|
||||
- Answering questions on GitHub and within the various WooCommerce communities.
|
||||
- Submitting fixes, improvements, and enhancements.
|
||||
|
||||
__Please Note:__
|
||||
WooCommerce currently powers 30% of all online stores across the internet, and your help making it even more awesome will be greatly appreciated :)
|
||||
|
||||
GitHub is for _bug reports and contributions only_ - if you have a support question or a request for a customization this is not the right place to post it. Use [WooCommerce Support](https://woocommerce.com/contact-us/) for customer support, [WordPress.org](https://wordpress.org/support/plugin/woocommerce) for community support, and for customizations we recommend one of the following services:
|
||||
If you think something can be improved and you wish to contribute code,
|
||||
[fork](https://help.github.com/articles/fork-a-repo/) WooCommerce, commit your changes,
|
||||
and [send a pull request](https://help.github.com/articles/using-pull-requests/). We'll be happy to review your changes!
|
||||
|
||||
## Feature Requests
|
||||
|
||||
Feature requests can be [submitted to our issue tracker](https://github.com/woocommerce/woocommerce/issues/new?template=Feature_request.md). Be sure to include a description of the expected behavior and use case, and before submitting a request, please search for similar ones in the closed issues.
|
||||
|
||||
Feature request issues will remain closed until we see sufficient interest via comments and [👍 reactions](https://help.github.com/articles/about-discussions-in-issues-and-pull-requests/) from the community.
|
||||
|
||||
You can see a [list of current feature requests which require votes here](https://github.com/woocommerce/woocommerce/issues?q=label%3A%22votes+needed%22+label%3Aenhancement+sort%3Areactions-%2B1-desc+is%3Aclosed).
|
||||
|
||||
## Technical Support / Questions
|
||||
|
||||
We don't offer technical support on GitHub so we recommend using the following:
|
||||
|
||||
**Reading our documentation**
|
||||
Usage docs can be found here: https://docs.woocommerce.com/
|
||||
|
||||
If you have a problem, you may want to start with the self help guide here: https://docs.woocommerce.com/document/woocommerce-self-service-guide/
|
||||
|
||||
**Technical support for premium extensions or if you're a WooCommerce.com customer**
|
||||
from a human being - submit a ticket via the helpdesk
|
||||
https://woocommerce.com/contact-us/
|
||||
|
||||
**General usage and development questions**
|
||||
- WooCommerce Slack Community: https://woocommerce.com/community-slack/
|
||||
- WordPress.org Forums: https://wordpress.org/support/plugin/woocommerce
|
||||
- The WooCommerce Help and Share Facebook group
|
||||
|
||||
**Customizations**
|
||||
- [WooExperts](https://woocommerce.com/experts/)
|
||||
- [Codeable](https://codeable.io/)
|
||||
|
||||
## Contributing to Core
|
||||
## Coding Guidelines
|
||||
|
||||
### Reporting Issues
|
||||
- **Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/coding-standards/php/)**
|
||||
- Install our pre-commit hook using composer. It'll help with the Coding Standards. To install run `composer install` from the command line within the woocommerce plugin directory.
|
||||
- Ensure you use LF line endings in your code editor. Use [EditorConfig](http://editorconfig.org/) if your editor supports it so that indentation, line endings and other settings are auto configured.
|
||||
- When committing, reference your issue number (#1234) and include a note about the fix.
|
||||
- Push the changes to your fork and submit a pull request on the master branch of the WooCommerce repository. Existing maintenance branches will be maintained by WooCommerce developers.
|
||||
|
||||
Reporting issues is a great way to became a contributor as it doesn't require technical skills. In fact you don't even need to know a programming language or to be able to check the code itself, you just need to make sure that everything works as expected and [submit an issue report](https://github.com/woocommerce/woocommerce/issues/new) if you spot a bug. Sound like something you're up for? Go for it!
|
||||
Please **don't** modify the changelog or update the .pot files. These will be maintained by the WooCommerce team.
|
||||
|
||||
#### How To Submit An Issue Report
|
||||
## Translating WooCommerce
|
||||
|
||||
If something isn't working, congratulations you've found a bug! Help us fix it by submitting an issue report:
|
||||
We have a [project on translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/woocommerce). You can join the localization team of your language and help by translating WooCommerce. [Find more about using joining a language team and using GlotPress](https://make.wordpress.org/polyglots/handbook/tools/glotpress-translate-wordpress-org/).
|
||||
|
||||
* Make sure you have a [GitHub account](https://github.com/signup/free)
|
||||
* Search the [Existing Issues](https://github.com/woocommerce/woocommerce/issues) to be sure that the one you've noticed isn't already there
|
||||
* Submit a report for your issue
|
||||
* Clearly describe the issue (including steps to reproduce it if it's a bug)
|
||||
* Make sure you fill in the earliest version that you know has the issue.
|
||||
|
||||
### Making Changes
|
||||
|
||||
Making changes to the core is a key way to help us improve WooCommerce. You will need some technical skills to make a change, like knowing a bit of PHP, CSS, SASS or JavaScript.
|
||||
|
||||
If you think something could be improved and you're able to do so, make your changes and submit a Pull Request. We'll be pleased to get it :)
|
||||
|
||||
#### How To Submit A PR
|
||||
|
||||
* Fork the repository on GitHub
|
||||
* Make the changes to your forked repository
|
||||
* **Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/coding-standards/php/)**
|
||||
* Install our pre-commit hook using composer. It'll help with the Coding Standards. To install just run `composer install`
|
||||
* Ensure you use LF line endings - no crazy Windows line endings please :)
|
||||
* Optionally it's possible install [EditorConfig](http://editorconfig.org/) on your editor to auto configure with indentation, line endings and other settings
|
||||
* When committing, reference your issue number (#1234) and include a note about the fix
|
||||
* Push the changes to your fork and submit a pull request on the master branch of the WooCommerce repository. Existing maintenance branches will be maintained by WooCommerce developers
|
||||
* Please **don't** modify the changelog - this will be maintained by the WooCommerce developers.
|
||||
* Please **don't** add your localizations or update the .pot files - these will also be maintained by the WooCommerce developers. To contribute to the localization of WooCommerce, please join the [translate.wordpress.org project](https://translate.wordpress.org/projects/wp-plugins/woocommerce). This is much needed, if you speak a language that needs translating consider yourself officially invited to the party.
|
||||
|
||||
After you follow the step above, the next stage will be waiting on us to merge your Pull Request. We review them all, and make suggestions and changes as and if necessary.
|
||||
|
||||
## Contribute To Localizing WooCommerce
|
||||
|
||||
Localization is a very important part of WooCommerce. We believe in net neutrality and want our platform to be available to everyone, everywhere with equal ease. When you localize WooCommerce, you are helping hundreds of people in the world, and all the people who speak your language. That's pretty neat.
|
||||
If WooCommerce is already 100% translated for your language, join the team anyway! We regularly update our language files and there will definitely be need of your help soon.
|
||||
|
||||
### Glossary & Style Guide
|
||||
|
||||
|
@ -80,22 +86,8 @@ We don’t have a Style Guide template available, so feel free to create your ow
|
|||
|
||||
If you created a style guide for your language, please let us know so we can add it in the list above. You can also add it by yourself by submitting a PR for this file.
|
||||
|
||||
### Translating Core
|
||||
|
||||
We have a [project on translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/woocommerce). You can join the localization team of your language and help by translating WooCommerce. [Find more about using joining a language team and using GlotPress](https://make.wordpress.org/polyglots/handbook/tools/glotpress-translate-wordpress-org/).
|
||||
|
||||
If WooCommerce is already 100% translated for your language, join the team anyway! We regularly update our language files and there will definitely be need of your help soon.
|
||||
|
||||
### Translating Video Tutorials
|
||||
|
||||
Another valuable way to help is by translating our growing library of WooCommerce video tutorials. Check out the [Translating Our Videos](https://docs.woocommerce.com/document/translating-our-videos/) doc and join in!
|
||||
|
||||
By translating video tutorials you'll be helping non-English speaking users and people affected by disabilities to get to grips with using WooCommerce for the first time, and to go on and create their businesses and make a living! That's something to be proud of and if you choose to dive into this area, we salute you.
|
||||
|
||||
# Additional Resources
|
||||
|
||||
* [General GitHub documentation](https://help.github.com/)
|
||||
* [GitHub pull request documentation](https://help.github.com/articles/about-pull-requests/)
|
||||
* [Translator Handbook](https://make.wordpress.org/polyglots/handbook/)
|
||||
* [WooCommerce Docs](https://docs.woocommerce.com/)
|
||||
* [WooCommerce Support](https://support.woocommerce.com)
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
name: "\U0001F41E Bug report"
|
||||
about: Report a bug if something isn't working as expected in the core WooCommerce
|
||||
plugin.
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is. Please be as descriptive as possible; issues lacking detail, or for any other reason than to report a bug, may be closed without action.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Isolating the problem (mark completed items with an [x]):**
|
||||
- [ ] I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
|
||||
- [ ] This bug happens with a default WordPress theme active, or [Storefront](https://woocommerce.com/storefront/).
|
||||
- [ ] I can reproduce this bug consistently using the steps above.
|
||||
|
||||
**WordPress Environment**
|
||||
<details>
|
||||
```
|
||||
Copy and paste the system status report from **WooCommerce > System Status** in WordPress admin.
|
||||
```
|
||||
</details>
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
name: "✨ New Enhancement"
|
||||
about: "If you have an idea to improve an existing feature in core or need something for development (such as a new hook) please let us know or submit a Pull Request!"
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
name: "\U0001F680 Feature request"
|
||||
about: "Suggest a new feature \U0001F389 We'll consider building it if it receives sufficient interest! \U0001F44D"
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
name: "❓ Support Question"
|
||||
about: "If you have a question \U0001F4AC please see our docs or use our forums, helpdesk,
|
||||
or Slack Community!"
|
||||
|
||||
---
|
||||
|
||||
We don't offer technical support on GitHub so we recommend using the following:
|
||||
|
||||
**Reading our documentation**
|
||||
Usage docs can be found here: https://docs.woocommerce.com/
|
||||
|
||||
If you have a problem, you may want to start with the self help guide here: https://docs.woocommerce.com/document/woocommerce-self-service-guide/
|
||||
|
||||
**Technical support for premium extensions or if you're a WooCommerce.com customer**
|
||||
from a human being - submit a ticket via the helpdesk
|
||||
https://woocommerce.com/contact-us/
|
||||
|
||||
**General usage and development questions**
|
||||
- WooCommerce Slack Community: https://woocommerce.com/community-slack/
|
||||
- WordPress.org Forums: https://wordpress.org/support/plugin/woocommerce
|
||||
- The WooCommerce Help and Share Facebook group
|
|
@ -0,0 +1,33 @@
|
|||
### All Submissions:
|
||||
|
||||
* [ ] Have you followed the [WooCommerce Contributing guideline](https://github.com/woocommerce/woocommerce/blob/master/.github/CONTRIBUTING.md)?
|
||||
* [ ] Does your code follow the [WordPress' coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/)?
|
||||
* [ ] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change?
|
||||
|
||||
<!-- Mark completed items with an [x] -->
|
||||
|
||||
<!-- You can erase any parts of this template not applicable to your Pull Request. -->
|
||||
|
||||
### Changes proposed in this Pull Request:
|
||||
|
||||
<!-- Describe the changes made to this Pull Request, and the reason for such changes. -->
|
||||
|
||||
Closes # .
|
||||
|
||||
### How to test the changes in this Pull Request:
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
### Other information:
|
||||
|
||||
* [ ] Have you added an explanation of what your changes do and why you'd like us to include them?
|
||||
* [ ] Have you written new tests for your changes, as applicable?
|
||||
* [ ] Have you successfully ran tests with your changes locally?
|
||||
|
||||
<!-- Mark completed items with an [x] -->
|
||||
|
||||
### Changelog entry
|
||||
|
||||
> Enter a short summary of all changes on this Pull Request. This will appear in the changelog if accepted.
|
|
@ -38,9 +38,11 @@ tests/cli/vendor
|
|||
/tmp
|
||||
/tests/bin/tmp
|
||||
/tests/e2e-tests/config/local-*.json
|
||||
/tests/e2e-tests/config/local.json
|
||||
|
||||
# Logs
|
||||
/logs
|
||||
|
||||
# Composer
|
||||
/vendor/
|
||||
contributors.md
|
||||
|
|
215
CHANGELOG.txt
|
@ -1,5 +1,220 @@
|
|||
== Changelog ==
|
||||
|
||||
= 3.4.1 - 2018-05-29 =
|
||||
* Fix - Fix webhook admin filtering URLs. #20236
|
||||
* Fix - Add missing wp_unslash calls to product data meta box to prevent quote characters being escaped on save. #20235
|
||||
* Fix - Display price filter widget in LTR mode on RTL sites. #20221
|
||||
* Fix - Refactor WC_Coupon constructor to allow for passing in coupon objects. #20193
|
||||
* Fix - Path field in advanced CSV importer was broken due to an esc_url call. #20191
|
||||
* Fix - Prevent shipping method instances trying to save settings on non-instance screens. #20217
|
||||
* Fix - Wrapper function to get full mysql version string with mariadb handling. #20231
|
||||
* Fix - woocommerce_pagination had some extra white space. #20214
|
||||
* Fix - If a file size cannot be read, ignore range headers to prevent offsite downloads being 0kb. #20205
|
||||
* Fix - Allow HTML when using `wc_attribute_label()`. #20202
|
||||
* Fix - Update address-i18n.js to prevent appending multiple "(optional)" labels. #20195
|
||||
* Fix - Check plugin properties exist when listening to auto_update_plugin hook. #20234
|
||||
* Fix - Add extra checks in `get_canonical_package_rate_ids` to prevent notices. #20237
|
||||
* Fix - Fix infinite loop with importing tax rates. #20253
|
||||
* Fix - Echo attribute label for "empty" default option. #20256
|
||||
* Fix - Fix download sample tax rates URL format. #20272
|
||||
* Fix - Product properties should not be accessed directly PHP notice when calling `wc_get_product_attachment_props`. #20282
|
||||
* Fix - If flexslider is disabled, gallery images also need to trigger photoswipe on click. #20290
|
||||
* Fix - Product import file uploads on windows servers. #20273
|
||||
* Fix - Fix variation attribute selection via the cart page/query string. #20293
|
||||
* Fix - Add greater specificity to required styling in 2017 theme. #20296
|
||||
* Enhancement - Export legacy paypal meta data in personal data exporter. #20200
|
||||
* Enhancement - Improve performance of `wc_update_340_states` update routine to help prevent timeouts. #20241
|
||||
* Dev - Remove red styling for PHP notice if using > 5.6. #20294
|
||||
* Dev - Add an action hook after printing the cart item name. #20190
|
||||
* Localization - Use "payment tokens" terminology in exports. #20197
|
||||
|
||||
= 3.4.0 - 2018-05-23 =
|
||||
* Feature - GDPR: Tools to export WooCommerce data using the new export functionality in WordPress 4.9.6. #19330
|
||||
* Feature - GDPR: Tools to bulk anonymize order data in admin. #19330
|
||||
* Feature - GDPR: Tools to turn off company/address-2/phone checkout fields to avoid unnecessary data collection, and a toggle to choose how required fields are presented. This is available via the Customizer. #19637
|
||||
* Feature - GDPR: Tools in the Customizer to change the terms and conditions checkbox label on the checkout. #19637
|
||||
* Feature - GDPR: Tools to define a privacy policy for the account page and checkout page in "account privacy" settings and within the Customizer. #19747
|
||||
* Feature - GDPR: Tools to automatically clean up and remove order personal data after a set time period. #19743
|
||||
* Feature - GDPR: Added privacy snippet which works with the new privacy page functionality in WordPress 4.9.6. #19749
|
||||
* Feature - Added a new order widget to the dashboard (on multisite) so you can see your orders across multiple stores on the same WordPress network. #17598
|
||||
* Feature - Added "display name" input on the My Account page. #19078
|
||||
* Feature - Product search improvements including stopword support and support for searching for multiple products at the same time. #19096
|
||||
* Feature - Cash on Delivery gateway can be enabled/disabled for specific shipping methods instead of only method types. #19221
|
||||
* Feature - Add wildcard email support for coupons. #19331
|
||||
* Feature - Added support for the GeoLite2 library as a replacement for the deprecated MaxMind GeoIP library. #19419
|
||||
* Feature - Added tool for cleaning up download permissions table. #19922
|
||||
* Tweak - GDPR: Improved appearance of checkout field 'descriptions' (if used) to make them more useful for privacy notices. #19637
|
||||
* Tweak - GDPR: Improved related data cleanup when deleting users/orders. #19330
|
||||
* Tweak - GDPR: Notice about HTTPS as a requirement in admin if missing. #19756
|
||||
* Tweak - GDPR: Improved the checkout (payments) settings screen, moved page options to a new "advanced" section, and made an "Accounts and Privacy" section. #19703
|
||||
* Tweak - GDPR: Hash customer email address in download URLs to protect privacy. #18957
|
||||
* Tweak - GDPR: Add highlight to T&C checkbox if not checked to show it needs to be checked. #19177
|
||||
* Tweak - GDPR: Automatically purge old logs after 30 days. #19920
|
||||
* Tweak - GDPR: Only log Webhook body if WP_DEBUG is enabled. #19914
|
||||
* Tweak - GDPR: Store less PII in PayPal standard. #19914
|
||||
* Tweak - Only show admin notices on WooCommerce screens/plugins/dashboard. #19772
|
||||
* Tweak - Standardize stock update messages in admin and correctly log who performed the action. When an order note is added after modifying stock manually, update order notes display via AJAX. #18080
|
||||
* Tweak - Rollback if payment complete or update status fails to prevent partial order updates on failure. #18175
|
||||
* Tweak - Made the system status tool which purges user carts also purge persistent carts. #18492
|
||||
* Tweak - Display whether or not external object cache is enabled in system status report. #18595
|
||||
* Tweak - Display zero value when using shipping classes. #18624
|
||||
* Tweak - Fixed settings table styling on mobile. #18655
|
||||
* Tweak - Updated Flexslider to version 2.7.0. #18779
|
||||
* Tweak - Enable screen options for list screens. #18817
|
||||
* Tweak - Don't call WC_Install::install() on downgrades. #18818
|
||||
* Tweak - Remove user login from reset password link to protect personally identifying info. #18820
|
||||
* Tweak - Added a function to return a list of custom tables to aid with cleanup. #18831
|
||||
* Tweak - Enable going backwards in the setup wizard. #18921
|
||||
* Tweak - Make sure terms page exists and isn’t trashed before using it. #18993
|
||||
* Tweak - Toggle when clicking anywhere in toggle row during setup wizard. #19035
|
||||
* Tweak - Use `read_product` permissions instead of `edit_product` for ajax product search. #19087
|
||||
* Tweak - Add `priceSpecification` property with `valueAddedTaxIncluded` to product structured data. #19091
|
||||
* Tweak - Importer remembers mappings across imports. #19110
|
||||
* Tweak - Made coupon total displayed in cart more consistent. #19166
|
||||
* Tweak - Remove forced CSS line-heights to improve text input displays across different browsers. #19174
|
||||
* Tweak - When loading default attributes/variation, if there is no longer a match, reset the form and hide the notice #19190
|
||||
* Tweak - Removed admin product type column from core and made it into a free feature plugin. #19192
|
||||
* Tweak - Use `woocommerce-no-js` class to hide JavaScript-only forms and content. #19199
|
||||
* Tweak - Activate plugins during installation process even if directory doesn't match slug. #19200
|
||||
* Tweak - Allow category and attribute ids in the `products` shortcode instead of only slugs. #19204
|
||||
* Tweak - Invalidate cart items when important props like product type are updated. #19255
|
||||
* Tweak - Don't use mysql functions directly on system status page to prevent errors if they are disabled. #19281
|
||||
* Tweak - Replaces `have_posts` with `woocommerce_product_loop` which looks to see if there are products, or if the loop is going to be showing something else. #19288
|
||||
* Tweak - Delete widget options and order notes on uninstall. #19371
|
||||
* Tweak - Add unique names to all nonces in template fields and forms. #19387
|
||||
* Tweak - Enable using the tab key to select elements in selectWoo dropdowns. #19416
|
||||
* Tweak - Added autocomplete attributes to form elements for better autocomplete support. #19426
|
||||
* Tweak - Removed PayPal line item limit and ensured URLs are shorter than maximum length. #19493
|
||||
* Tweak - Disable Gutenberg editor on products posts. #19543
|
||||
* Tweak - Improvements around UI and wording of store setup step in setup wizard, a revamped extras step, and other improvements.
|
||||
* Tweak - Only push images to lightbox if an image is found. #19568
|
||||
* Tweak - Added and improved notices around old PHP versions and disabled geolocation on PHP 5.4 or lower. #19573
|
||||
* Tweak - The `manage_stock` field in the product API can return a `mixed` type instead of `boolean` for variations. #19598
|
||||
* Tweak - Link product import/export to WordPress import/export capabilities. #19602
|
||||
* Tweak - Use ` ` to separate asterisks in required fields to prevent awkward line breaks. #19610
|
||||
* Tweak - Load meta box input values using CRUD and edit context. #19670
|
||||
* Tweak - Scroll to notices on cart/checkout for better mobile visibility. #19699
|
||||
* Tweak - Add filter to coupon URL on "Edit order" screen. #19777
|
||||
* Tweak - Throw error if order can't be loaded on checkout. #19802
|
||||
* Tweak - Remove deprecated freegeoip service from geolocation. #19841
|
||||
* Tweak - Allow arrays of query vars in wc_get_orders and wc_get_products. #19848
|
||||
* Tweak - Invalidate fragment cache on theme switch.
|
||||
* Tweak - Include select tags when saving payment details temporarily in checkout.js. #19854
|
||||
* Tweak - Update - Include pending products in export. #19928
|
||||
* Tweak - Deprecate woocommerce_ajax_added_order_items action in favor of more useful action. #19933
|
||||
* Tweak - Enable touch-to-zoom on touch devices to make photoswipe more easily accessible. #20002
|
||||
* Tweak - Wizard: List out all plugins to be installed upon proceeding to the next step, with a highlight on hover indicating relevant settings. #19952
|
||||
* Tweak - Hide/show password strength meter instead of removing/inserting password strength meter. #20006
|
||||
* Tweak - Added support for HTTP_RANGE requests (used by iOS devices) to Force download method. #19984
|
||||
* Tweak - Replaced protocol-relative URLs for thumbnails in the cart and mini-cart with protocol-specific URLs to prevent problems with URLs that include port section. #19934
|
||||
* Tweak - In CSV exports, wrap cell in ' rather than just prepending to escape values. #20041
|
||||
* Tweak - Add JS listeners for reloading/reinitializing order items in edit-order page. #20082
|
||||
* Fix - Properly set orderby and order when calling WC_Customer_Download_Data_Store::get_downloads(). #1862
|
||||
* Fix - Set maxlength for order item meta key to avoid values disappearing if too long. #18918
|
||||
* Fix - Remove hardcoded /wp-content check for downloads. #18961
|
||||
* Fix - Made get_on_sale_products respect the setting to hide outofstock products. #18984
|
||||
* Fix - Prevent shortcode [product_page] redirecting to the actual product's page after add to cart. #19043
|
||||
* Fix - Make the "main term" logic match for both the breadcrumb and product categories widget. #19044
|
||||
* Fix - Check parent status too when seeing if variation is purchasable. #19045
|
||||
* Fix - Fix uppercasing of accented characters. #19086
|
||||
* Fix - Do not allow updating parent ID from variations after created. #19097
|
||||
* Fix - Ensure coupon amount is not empty to prevent non-numeric value errors. #19098
|
||||
* Fix - Ensure shop archive works correctly when `paged=1` is in the URL. #19104
|
||||
* Fix - Ensure orders created with `woocommerce_adjust_non_base_location_prices` filter active have the same cost on frontend and admin. #19109
|
||||
* Fix - Handling in the CLI to prevent `Resource does not exist` errors when using commands of a certain format. #19123
|
||||
* Fix - Use subtotal when calculating discounts in admin/orders to ensure prices are the same as on the frontend. #19159
|
||||
* Fix - Use `kses` to process download names to prevent escaped HTML displaying in emails.
|
||||
* Fix - Remove translation from Thailand state file to prevent PayPal errors around unsupported characters. #19219
|
||||
* Fix - Fix auto-select variation URLs with special characters in them. #19283
|
||||
* Fix - Introduced `wc_round_discount` and improved consistency of discount rounding. #19291
|
||||
* Fix - Only add schema for ratings to structured data when ratings are enabled. #19310
|
||||
* Fix - Prevent default state applying unless the country was also unset in JS state/country inputs. #19338
|
||||
* Fix - Escape quantity labels correctly to prevent broken html. #19375
|
||||
* Fix - Delete orphaned variations after product import. #19378
|
||||
* Fix - Ensure API credentials exist before defining PayPal refund support. #19380
|
||||
* Fix - Force word-wrapping in the log viewer to prevent layout-breaking long lines. #19503
|
||||
* Fix - Removes permission checks that were preventing webhooks from displaying properly when no post object existed. #19508
|
||||
* Fix - Empty cart after completing PayPal payment. #19509
|
||||
* Fix - Strip tags on aria-labels in Add to Cart template to prevent broken HTML. #19522
|
||||
* Fix - Update post_modified date when saving products and variations but no other product data. #19595
|
||||
* Fix - Clear comment count transient when cleaning product transients to prevent incorrect comment count displays. #19664
|
||||
* Fix - Load gateways before order is saved/email is triggered to ensure all information gets sent/processed. #19667
|
||||
* Fix - Clear shipping transient when saving shipping method on zones screen. #19668
|
||||
* Fix - Handle escape characters for fputcsv to work around PHP standards issues. #19678
|
||||
* Fix - Cast post IDs to integers in admin meta boxes. #19710
|
||||
* Fix - Fix CSV unescaping of negative numbers in download expiry/limit columns. #19732
|
||||
* Fix - Don't load unsupported theme functionality if shop page ID is -1. #19822
|
||||
* Fix - Select and display "Downloadable" option in product admin filter when selected. #19876
|
||||
* Fix - Add sort handle column when adding new tags. #19875
|
||||
* Fix - More thorough CSV importer cleanup. #19877
|
||||
* Fix - Fix gallery switching when image is the same #19878
|
||||
* Fix - Ensure coupon amount is always returns as a float value #19889
|
||||
* Fix - No update available message after activating subscription that has a valid update. #19831
|
||||
* Fix - Include scheduled products in CSV export. #19907
|
||||
* Fix - Generator tag actions should be filters. #19946
|
||||
* Fix - WC API should not try to create a product image when creating a product variation if an empty image is passed. #19971
|
||||
* Fix - Force settings API settings to autoload by default. #19998
|
||||
* Fix - Cart html5 validation events when using keyboard. #20001
|
||||
* Fix - Don't show stock status fields in external product quick-edit. #20005
|
||||
* Fix - Prevent an infinite loop if 2 grouped products are linked. #20020
|
||||
* Fix - Switch stock_status when manage stock gets changed to prevent being out of stock if stock quantity is > 0. #20021
|
||||
* Fix - When duplicating variation, set the date to null. #20083
|
||||
* Fix - Fix rounding of line items for orders to match cart. #20086
|
||||
* Fix - Remove hardcoded border in email template. #20090
|
||||
* Fix - Prevent autofocus on checkout. #20123
|
||||
* Fix - Recalc taxes if address changes in API. #20137
|
||||
* Dev - Made wc_query_string_form_fields handle strings. #20162
|
||||
* Dev - Added refunded_payment prop to orders for determining if payment was refunded via API. #18196
|
||||
* Dev - Added extra params to `woocommerce_order_get_downloadable_items`. #18408
|
||||
* Dev - Store shipping method ID and instance ID in separate fields instead of both in one serialized field. #18483
|
||||
* Dev - Add `woocommerce_rest_insert_system_status_tool` hook that fires after executing a REST system status tool. #18505
|
||||
* Dev - Gallery meta box is now powered by CRUD. #18511
|
||||
* Dev - Refactor woocommerce_wp_select so it could be used for a multiselect. #18536
|
||||
* Dev - Added ability to declare sanitize_callback in settings API. #18554
|
||||
* Dev - Added support for additional HTML5 input types for settings/checkout forms. #18594
|
||||
* Dev - Made 'woocommerce_email_downloads_column_' hook format aware. #18600
|
||||
* Dev - Add missing `woocommerce_update_options__` actions for settings pages that override save method. #18609
|
||||
* Dev - Allow default value for single_select_country and multi_select_countries. #18754 #18756
|
||||
* Dev - Added `grouped_form` class to grouped product `form` element. #18786
|
||||
* Dev - Mini cart item link now respects value of $product_permalink. #18979
|
||||
* Dev - Added `woocommerce_coupon_get_items_to_validate` filter to enable excluding products from coupon validation. #19002
|
||||
* Dev - Added `woocommerce_persistent_cart_enabled` filter. #19027
|
||||
* Dev - Added `woocommerce_admin_order_item_coupon_url` filter. #19777
|
||||
* Dev - Replaced calls to `exit` with `wp_die` in the ajax methods to enable unit testing of those methods.
|
||||
* Dev - Introduce `woocommerce_coupon_custom_discounts_array` filter to allow post processing on custom coupons. #19148
|
||||
* Dev - Move jQuery UI styles into WooCommerce assets folder and load them from there. #19173
|
||||
* Dev - Added `woocommerce_coupon_validate_expiry_date` filter to enable modifying the coupon expiry date check. #19228
|
||||
* Dev - Added `woocommerce_shipping_calculator_enable_state` filter to enable disabling state section in shipping calculator. #19241
|
||||
* Dev - Added `woocommerce_bacs_process_payment_order_status` filter allowing plugins to change the order status to the BACS gateway. #19311
|
||||
* Dev - Added `woocommerce_coupon_sort` filter to allow plugins to override the default coupon apply order. #19339
|
||||
* Dev - Added `woocommerce_before_output_product_categories` and `woocommerce_after_output_product_categories` filters. #19363
|
||||
* Dev - Added general `woocommerce_form_field` filter to make it easier to filter all of the form fields. #19388
|
||||
* Dev - Added `woocommerce_install_get_tables` filter to enable plugins to register new, WooCommerce-specific tables. $19436
|
||||
* Dev - Use `get_variation_price` method in structured data to grab min/max so filters are ran. #19527
|
||||
* Dev - Added `woocommerce_helper_suppress_connect_notice` filter to enable suppressing the admin WordPress.com connection message. #19599
|
||||
* Dev - Moved all photoswipe styles to `photoswipe.css` to make it easy to dequeue all the photoswipe styles. #19673
|
||||
* Dev - Slash meta values before updating values in the data stores. #19675
|
||||
* Dev - New wc_selected method to handle array key conversion to int. #19705
|
||||
* Performance - Optimized saving of orders. Adds a transient for needs_processing, and only saves changes when saving order items. #18538
|
||||
* Performance - Refactored the SQL query for `WC_Customer_Download_Data_Store::get_downloads()` to fetch available downloads faster. #18559
|
||||
* Performance - Split the layered nav counts into multiple transient records by taxonomy and added a filter to allow bypassing caching. #19225
|
||||
* Performance - Removed duplicate `SET SESSION SQL_BIG_SELECTS=1` queries. #19502
|
||||
* Performance - Avoid storing coupon `_used_by` data to prevent database bloat. #19669
|
||||
* Performance - Introduced new wc_get_product_class() and wc_product_class() functions. #19639
|
||||
* Performance - Series of tweaks aimed at reducing the number of queries performed #19918
|
||||
* Template - Update cart coupon button from input to button type. #19059
|
||||
* Template - Added `woocommerce-form-register` class to registration form. #19486
|
||||
* Template - Added escaping to publish date. #19530
|
||||
* Template - Added a template file for recent product reviews. #19711
|
||||
* Template - Made add to cart templates more consistent between product types. #19666
|
||||
* Localization - Switched Georgian Lari symbol to new UTF symbol. #19603
|
||||
* Localization - Use ISO county codes for Irish states. #19658
|
||||
* Localization - Use ISO county codes for BD states. #19744
|
||||
* Localization - LR-Liberia states. #19709
|
||||
* Localization - Update ZA tax rate. #19909
|
||||
* Localization - Various spelling, grammar fixes, and phrasing improvements.
|
||||
* Localization - Fix missing Bahrain country code. #20061
|
||||
|
||||
= 3.3.5 - 2018-04-10 =
|
||||
* Fix - Shop page notice should not appear when editing the "Hello World!" page.
|
||||
* Fix - Inconsistent order item refund sign.
|
||||
|
|
51
Gruntfile.js
|
@ -101,16 +101,9 @@ module.exports = function( grunt ) {
|
|||
ext: '.min.js'
|
||||
}]
|
||||
},
|
||||
simplify_commerce: {
|
||||
flexslider: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: 'includes/gateways/simplify-commerce/assets/js/',
|
||||
src: [
|
||||
'*.js',
|
||||
'!*.min.js'
|
||||
],
|
||||
dest: 'includes/gateways/simplify-commerce/assets/js/',
|
||||
ext: '.min.js'
|
||||
'<%= dirs.js %>/flexslider/jquery.flexslider.min.js': ['<%= dirs.js %>/flexslider/jquery.flexslider.js']
|
||||
}]
|
||||
}
|
||||
},
|
||||
|
@ -131,7 +124,7 @@ module.exports = function( grunt ) {
|
|||
}
|
||||
},
|
||||
|
||||
// Generate RTL .css files
|
||||
// Generate RTL .css files.
|
||||
rtlcss: {
|
||||
woocommerce: {
|
||||
expand: true,
|
||||
|
@ -263,6 +256,31 @@ module.exports = function( grunt ) {
|
|||
},
|
||||
e2e_tests_grep: {
|
||||
command: 'npm run --silent test:grep "' + grunt.option( 'grep' ) + '"'
|
||||
},
|
||||
contributors: {
|
||||
command: [
|
||||
'echo "Generating contributor list since <%= fromDate %>"',
|
||||
'./node_modules/.bin/githubcontrib --owner woocommerce --repo woocommerce --fromDate <%= fromDate %> --authToken <%= authToken %> --cols 6 --sortBy contributions --format md --sortOrder desc --showlogin true > contributors.md'
|
||||
].join( '&&' )
|
||||
}
|
||||
},
|
||||
|
||||
prompt: {
|
||||
contributors: {
|
||||
options: {
|
||||
questions: [
|
||||
{
|
||||
config: 'fromDate',
|
||||
type: 'input',
|
||||
message: 'What date (YYYY-MM-DD) should we get contributions since?'
|
||||
},
|
||||
{
|
||||
config: 'authToken',
|
||||
type: 'input',
|
||||
message: '(optional) Provide a personal access token. This will allow 5000 requests per hour rather than 60 - use if nothing is generated.'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -314,7 +332,7 @@ module.exports = function( grunt ) {
|
|||
}
|
||||
});
|
||||
|
||||
// Load NPM tasks to be used here
|
||||
// Load NPM tasks to be used here.
|
||||
grunt.loadNpmTasks( 'grunt-sass' );
|
||||
grunt.loadNpmTasks( 'grunt-shell' );
|
||||
grunt.loadNpmTasks( 'grunt-phpcs' );
|
||||
|
@ -329,8 +347,9 @@ module.exports = function( grunt ) {
|
|||
grunt.loadNpmTasks( 'grunt-contrib-concat' );
|
||||
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
||||
grunt.loadNpmTasks( 'grunt-contrib-clean' );
|
||||
grunt.loadNpmTasks( 'grunt-prompt' );
|
||||
|
||||
// Register tasks
|
||||
// Register tasks.
|
||||
grunt.registerTask( 'default', [
|
||||
'js',
|
||||
'css',
|
||||
|
@ -340,7 +359,8 @@ module.exports = function( grunt ) {
|
|||
grunt.registerTask( 'js', [
|
||||
'jshint',
|
||||
'uglify:admin',
|
||||
'uglify:frontend'
|
||||
'uglify:frontend',
|
||||
'uglify:flexslider'
|
||||
]);
|
||||
|
||||
grunt.registerTask( 'css', [
|
||||
|
@ -356,6 +376,11 @@ module.exports = function( grunt ) {
|
|||
'shell:apidocs'
|
||||
]);
|
||||
|
||||
grunt.registerTask( 'contributors', [
|
||||
'prompt:contributors',
|
||||
'shell:contributors'
|
||||
]);
|
||||
|
||||
// Only an alias to 'default' task.
|
||||
grunt.registerTask( 'dev', [
|
||||
'default'
|
||||
|
|
|
@ -58,34 +58,42 @@ class WC_HookFinder {
|
|||
}
|
||||
|
||||
public static function process_hooks() {
|
||||
// If we have one, get the PHP files from it.
|
||||
$template_files = self::get_files( '*.php', GLOB_MARK, '../templates/' );
|
||||
$template_files[] = '../includes/wc-template-functions.php';
|
||||
$template_files[] = '../includes/wc-template-hooks.php';
|
||||
self::$files_to_scan = array();
|
||||
|
||||
$shortcode_files = self::get_files( '*.php', GLOB_MARK, '../includes/shortcodes/' );
|
||||
$widget_files = self::get_files( '*.php', GLOB_MARK, '../includes/widgets/' );
|
||||
$admin_files = self::get_files( '*.php', GLOB_MARK, '../includes/admin/' );
|
||||
$class_files = self::get_files( '*.php', GLOB_MARK, '../includes/' );
|
||||
$other_files = array(
|
||||
'../woocommerce.php'
|
||||
self::$files_to_scan['Template Files'] = self::get_files( '*.php', GLOB_MARK, '../templates/' );
|
||||
self::$files_to_scan['Template Functions'] = array( '../includes/wc-template-functions.php', '../includes/wc-template-hooks.php' );
|
||||
self::$files_to_scan['Shortcodes'] = self::get_files( '*.php', GLOB_MARK, '../includes/shortcodes/' );
|
||||
self::$files_to_scan['Widgets'] = self::get_files( '*.php', GLOB_MARK, '../includes/widgets/' );
|
||||
self::$files_to_scan['Data Stores'] = self::get_files( '*.php', GLOB_MARK, '../includes/data-stores' );
|
||||
self::$files_to_scan['Core Classes'] = array_merge(
|
||||
self::get_files( '*.php', GLOB_MARK, '../includes/' ),
|
||||
self::get_files( '*.php', GLOB_MARK, '../includes/abstracts/' ),
|
||||
self::get_files( '*.php', GLOB_MARK, '../includes/customizer/' ),
|
||||
self::get_files( '*.php', GLOB_MARK, '../includes/emails/' ),
|
||||
self::get_files( '*.php', GLOB_MARK, '../includes/export/' ),
|
||||
self::get_files( '*.php', GLOB_MARK, '../includes/gateways/' ),
|
||||
self::get_files( '*.php', GLOB_MARK, '../includes/import/' ),
|
||||
self::get_files( '*.php', GLOB_MARK, '../includes/shipping/' )
|
||||
);
|
||||
|
||||
self::$files_to_scan = array(
|
||||
'Template Hooks' => $template_files,
|
||||
'Shortcode Hooks' => $shortcode_files,
|
||||
'Widget Hooks' => $widget_files,
|
||||
'Class Hooks' => $class_files,
|
||||
'Admin Hooks' => $admin_files,
|
||||
'Other Hooks' => $other_files,
|
||||
);
|
||||
self::$files_to_scan = array_filter( self::$files_to_scan );
|
||||
|
||||
$scanned = array();
|
||||
|
||||
ob_start();
|
||||
|
||||
$index = array();
|
||||
|
||||
foreach ( self::$files_to_scan as $heading => $files ) {
|
||||
$index[] = '<a href="#hooks-' . str_replace( ' ', '-', strtolower( $heading ) ) . '">' . $heading . '</a>';
|
||||
}
|
||||
|
||||
echo '<div id="content">';
|
||||
echo '<h1>Action and Filter Hook Reference</h1>';
|
||||
echo '<div class="description">
|
||||
<p>This is simply a list of action and filter hooks found within WooCommerce files. View the source to see supported params and usage.</p>
|
||||
<p>' . implode( ', ', $index ) . '</p>
|
||||
</div>';
|
||||
|
||||
foreach ( self::$files_to_scan as $heading => $files ) {
|
||||
self::$custom_hooks_found = array();
|
||||
|
@ -125,43 +133,36 @@ class WC_HookFinder {
|
|||
case 'filter' :
|
||||
case 'action' :
|
||||
$hook = trim( $token[1], "'" );
|
||||
$hook = str_replace( '_FUNCTION_', strtoupper( $current_function ), $hook );
|
||||
$hook = str_replace( '_CLASS_', strtoupper( $current_class ), $hook );
|
||||
$hook = str_replace( '$this', strtoupper( $current_class ), $hook );
|
||||
$hook = str_replace( array( '.', '{', '}', '"', "'", ' ', ')', '(' ), '', $hook );
|
||||
$loop = 0;
|
||||
|
||||
if ( '_' === substr( $hook, '-1', 1 ) ) {
|
||||
$hook .= '{';
|
||||
$open = true;
|
||||
// Keep adding to hook until we find a comma or colon
|
||||
while ( 1 ) {
|
||||
$loop ++;
|
||||
$next_hook = trim( trim( is_string( $tokens[ $index + $loop ] ) ? $tokens[ $index + $loop ] : $tokens[ $index + $loop ][1], '"' ), "'" );
|
||||
// Keep adding to hook until we find a comma or colon
|
||||
while ( 1 ) {
|
||||
$loop ++;
|
||||
$prev_hook = is_string( $tokens[ $index + $loop - 1 ] ) ? $tokens[ $index + $loop - 1 ] : $tokens[ $index + $loop - 1 ][1];
|
||||
$next_hook = is_string( $tokens[ $index + $loop ] ) ? $tokens[ $index + $loop ] : $tokens[ $index + $loop ][1];
|
||||
|
||||
if ( in_array( $next_hook, array( '.', '{', '}', '"', "'", ' ' ) ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$hook_first = substr( $next_hook, 0, 1 );
|
||||
$hook_last = substr( $next_hook, -1, 1 );
|
||||
|
||||
if ( in_array( $next_hook, array( ',', ';' ) ) ) {
|
||||
if ( $open ) {
|
||||
$hook .= '}';
|
||||
$open = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( '_' === $hook_first ) {
|
||||
$next_hook = '}' . $next_hook;
|
||||
$open = false;
|
||||
}
|
||||
|
||||
if ( '_' === $hook_last ) {
|
||||
$next_hook .= '{';
|
||||
$open = true;
|
||||
}
|
||||
|
||||
$hook .= $next_hook;
|
||||
if ( in_array( $next_hook, array( '.', '{', '}', '"', "'", ' ', ')', '(' ) ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( in_array( $next_hook, array( ',', ';' ) ) ) {
|
||||
break;
|
||||
}
|
||||
|
||||
$hook_first = substr( $next_hook, 0, 1 );
|
||||
$hook_last = substr( $next_hook, -1, 1 );
|
||||
|
||||
if ( '{' === $hook_first || '}' === $hook_last || '$' === $hook_first || ')' === $hook_last || '>' === substr( $prev_hook, -1, 1 ) ) {
|
||||
$next_hook = strtoupper( $next_hook );
|
||||
}
|
||||
|
||||
$next_hook = str_replace( array( '.', '{', '}', '"', "'", ' ', ')', '(' ), '', $next_hook );
|
||||
|
||||
$hook .= $next_hook;
|
||||
}
|
||||
|
||||
if ( isset( self::$custom_hooks_found[ $hook ] ) ) {
|
||||
|
@ -185,14 +186,14 @@ class WC_HookFinder {
|
|||
|
||||
foreach ( self::$custom_hooks_found as $hook => $details ) {
|
||||
if ( ! strstr( $hook, 'woocommerce' ) && ! strstr( $hook, 'product' ) && ! strstr( $hook, 'wc_' ) ) {
|
||||
unset( self::$custom_hooks_found[ $hook ] );
|
||||
//unset( self::$custom_hooks_found[ $hook ] );
|
||||
}
|
||||
}
|
||||
|
||||
ksort( self::$custom_hooks_found );
|
||||
|
||||
if ( ! empty( self::$custom_hooks_found ) ) {
|
||||
echo '<div class="panel panel-default"><div class="panel-heading"><h2>' . $heading . '</h2></div>';
|
||||
echo '<div class="panel panel-default"><div class="panel-heading"><h2 id="hooks-' . str_replace( ' ', '-', strtolower( $heading ) ) . '">' . $heading . '</h2></div>';
|
||||
|
||||
echo '<table class="summary table table-bordered table-striped"><thead><tr><th>Hook</th><th>Type</th><th>File(s)</th></tr></thead><tbody>';
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
div.woocommerce-message{overflow:hidden;position:relative;border-right-color:#cc99c2!important}div.woocommerce-message p{max-width:700px}div.woocommerce-message p:last-child{max-width:inherit}.woocommerce-message .button-primary,p.woocommerce-actions .button-primary{background:#bb77ae;border-color:#a36597;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,-1px 0 1px #a36597,0 1px 1px #a36597,1px 0 1px #a36597}.woocommerce-message .button-primary:active,.woocommerce-message .button-primary:focus,.woocommerce-message .button-primary:hover,p.woocommerce-actions .button-primary:active,p.woocommerce-actions .button-primary:focus,p.woocommerce-actions .button-primary:hover{background:#a36597;border-color:#a36597;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597}.woocommerce-message a.woocommerce-message-close,p.woocommerce-actions a.woocommerce-message-close{position:absolute;top:0;left:0;padding:10px 21px 10px 15px;font-size:13px;line-height:1.23076923;text-decoration:none}.woocommerce-message a.woocommerce-message-close::before,p.woocommerce-actions a.woocommerce-message-close::before{position:absolute;top:8px;right:0;-webkit-transition:all .1s ease-in-out;transition:all .1s ease-in-out}.woocommerce-message .button-primary,.woocommerce-message .button-secondary,p.woocommerce-actions .button-primary,p.woocommerce-actions .button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-right:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}div.woocommerce-legacy-shipping-notice,div.woocommerce-no-shipping-methods-notice{overflow:hidden;padding:1px 12px}div.woocommerce-legacy-shipping-notice p,div.woocommerce-no-shipping-methods-notice p{position:relative;z-index:1;max-width:700px;line-height:1.5em;margin:12px 0}div.woocommerce-legacy-shipping-notice p.main,div.woocommerce-no-shipping-methods-notice p.main{font-size:1.1em}div.woocommerce-legacy-shipping-notice::before,div.woocommerce-no-shipping-methods-notice::before{content:'\e01b';font-family:WooCommerce;text-align:center;line-height:1;color:#f7f1f6;display:block;width:1em;font-size:20em;top:36px;left:12px;position:absolute}
|
||||
div.woocommerce-message{overflow:hidden;position:relative;border-right-color:#cc99c2!important}div.woocommerce-message p{max-width:700px}div.woocommerce-message p:last-child{max-width:inherit}.woocommerce-message .button-primary,p.woocommerce-actions .button-primary{background:#bb77ae;border-color:#a36597;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,-1px 0 1px #a36597,0 1px 1px #a36597,1px 0 1px #a36597}.woocommerce-message .button-primary:active,.woocommerce-message .button-primary:focus,.woocommerce-message .button-primary:hover,p.woocommerce-actions .button-primary:active,p.woocommerce-actions .button-primary:focus,p.woocommerce-actions .button-primary:hover{background:#a36597;border-color:#a36597;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597}.woocommerce-message a.woocommerce-message-close,p.woocommerce-actions a.woocommerce-message-close{position:static;float:left;top:0;left:0;padding:0 28px 10px 15px;margin-top:-10px;font-size:13px;line-height:1.23076923;text-decoration:none}.woocommerce-message a.woocommerce-message-close::before,p.woocommerce-actions a.woocommerce-message-close::before{position:relative;top:18px;right:-20px;-webkit-transition:all .1s ease-in-out;transition:all .1s ease-in-out}.woocommerce-message .button-primary,.woocommerce-message .button-secondary,p.woocommerce-actions .button-primary,p.woocommerce-actions .button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-right:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}div.woocommerce-legacy-shipping-notice,div.woocommerce-no-shipping-methods-notice{overflow:hidden;padding:1px 12px}div.woocommerce-legacy-shipping-notice p,div.woocommerce-no-shipping-methods-notice p{position:relative;z-index:1;max-width:700px;line-height:1.5em;margin:12px 0}div.woocommerce-legacy-shipping-notice p.main,div.woocommerce-no-shipping-methods-notice p.main{font-size:1.1em}div.woocommerce-legacy-shipping-notice::before,div.woocommerce-no-shipping-methods-notice::before{content:'\e01b';font-family:WooCommerce;text-align:center;line-height:1;color:#f7f1f6;display:block;width:1em;font-size:20em;top:36px;left:12px;position:absolute}
|
|
@ -1 +1 @@
|
|||
div.woocommerce-message{overflow:hidden;position:relative;border-left-color:#cc99c2!important}div.woocommerce-message p{max-width:700px}div.woocommerce-message p:last-child{max-width:inherit}.woocommerce-message .button-primary,p.woocommerce-actions .button-primary{background:#bb77ae;border-color:#a36597;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,1px 0 1px #a36597,0 1px 1px #a36597,-1px 0 1px #a36597}.woocommerce-message .button-primary:active,.woocommerce-message .button-primary:focus,.woocommerce-message .button-primary:hover,p.woocommerce-actions .button-primary:active,p.woocommerce-actions .button-primary:focus,p.woocommerce-actions .button-primary:hover{background:#a36597;border-color:#a36597;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597}.woocommerce-message a.woocommerce-message-close,p.woocommerce-actions a.woocommerce-message-close{position:absolute;top:0;right:0;padding:10px 15px 10px 21px;font-size:13px;line-height:1.23076923;text-decoration:none}.woocommerce-message a.woocommerce-message-close::before,p.woocommerce-actions a.woocommerce-message-close::before{position:absolute;top:8px;left:0;-webkit-transition:all .1s ease-in-out;transition:all .1s ease-in-out}.woocommerce-message .button-primary,.woocommerce-message .button-secondary,p.woocommerce-actions .button-primary,p.woocommerce-actions .button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-left:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}div.woocommerce-legacy-shipping-notice,div.woocommerce-no-shipping-methods-notice{overflow:hidden;padding:1px 12px}div.woocommerce-legacy-shipping-notice p,div.woocommerce-no-shipping-methods-notice p{position:relative;z-index:1;max-width:700px;line-height:1.5em;margin:12px 0}div.woocommerce-legacy-shipping-notice p.main,div.woocommerce-no-shipping-methods-notice p.main{font-size:1.1em}div.woocommerce-legacy-shipping-notice::before,div.woocommerce-no-shipping-methods-notice::before{content:'\e01b';font-family:WooCommerce;text-align:center;line-height:1;color:#f7f1f6;display:block;width:1em;font-size:20em;top:36px;right:12px;position:absolute}
|
||||
div.woocommerce-message{overflow:hidden;position:relative;border-left-color:#cc99c2!important}div.woocommerce-message p{max-width:700px}div.woocommerce-message p:last-child{max-width:inherit}.woocommerce-message .button-primary,p.woocommerce-actions .button-primary{background:#bb77ae;border-color:#a36597;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,1px 0 1px #a36597,0 1px 1px #a36597,-1px 0 1px #a36597}.woocommerce-message .button-primary:active,.woocommerce-message .button-primary:focus,.woocommerce-message .button-primary:hover,p.woocommerce-actions .button-primary:active,p.woocommerce-actions .button-primary:focus,p.woocommerce-actions .button-primary:hover{background:#a36597;border-color:#a36597;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #a36597}.woocommerce-message a.woocommerce-message-close,p.woocommerce-actions a.woocommerce-message-close{position:static;float:right;top:0;right:0;padding:0 15px 10px 28px;margin-top:-10px;font-size:13px;line-height:1.23076923;text-decoration:none}.woocommerce-message a.woocommerce-message-close::before,p.woocommerce-actions a.woocommerce-message-close::before{position:relative;top:18px;left:-20px;-webkit-transition:all .1s ease-in-out;transition:all .1s ease-in-out}.woocommerce-message .button-primary,.woocommerce-message .button-secondary,p.woocommerce-actions .button-primary,p.woocommerce-actions .button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-left:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}div.woocommerce-legacy-shipping-notice,div.woocommerce-no-shipping-methods-notice{overflow:hidden;padding:1px 12px}div.woocommerce-legacy-shipping-notice p,div.woocommerce-no-shipping-methods-notice p{position:relative;z-index:1;max-width:700px;line-height:1.5em;margin:12px 0}div.woocommerce-legacy-shipping-notice p.main,div.woocommerce-no-shipping-methods-notice p.main{font-size:1.1em}div.woocommerce-legacy-shipping-notice::before,div.woocommerce-no-shipping-methods-notice::before{content:'\e01b';font-family:WooCommerce;text-align:center;line-height:1;color:#f7f1f6;display:block;width:1em;font-size:20em;top:36px;right:12px;position:absolute}
|
|
@ -35,17 +35,19 @@ p.woocommerce-actions,
|
|||
}
|
||||
|
||||
a.woocommerce-message-close {
|
||||
position: absolute;
|
||||
position: static;
|
||||
float: right;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 10px 15px 10px 21px;
|
||||
padding: 0px 15px 10px 28px;
|
||||
margin-top: -10px;
|
||||
font-size: 13px;
|
||||
line-height: 1.23076923;
|
||||
text-decoration: none;
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 0;
|
||||
position: relative;
|
||||
top: 18px;
|
||||
left: -20px;
|
||||
transition: all 0.1s ease-in-out;
|
||||
}
|
||||
}
|
||||
|
|
12569
assets/css/admin.scss
After Width: | Height: | Size: 98 B |
After Width: | Height: | Size: 97 B |
After Width: | Height: | Size: 113 B |
After Width: | Height: | Size: 82 B |
After Width: | Height: | Size: 89 B |
After Width: | Height: | Size: 115 B |
After Width: | Height: | Size: 113 B |
After Width: | Height: | Size: 86 B |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 4.6 KiB |
|
@ -64,6 +64,22 @@
|
|||
.loader {
|
||||
@include loader();
|
||||
}
|
||||
|
||||
form .form-row {
|
||||
.required {
|
||||
color: firebrick;
|
||||
text-decoration: none;
|
||||
visibility: hidden; // Only show optional by default.
|
||||
|
||||
&[title] {
|
||||
border: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.optional {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.woocommerce-breadcrumb {
|
||||
|
@ -137,20 +153,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.required {
|
||||
color: firebrick;
|
||||
text-decoration: none;
|
||||
visibility: hidden; // Only show optional by default.
|
||||
|
||||
&[title] {
|
||||
border: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.optional {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.woocommerce-message,
|
||||
.woocommerce-error,
|
||||
.woocommerce-info {
|
||||
|
@ -400,6 +402,7 @@ table.variations {
|
|||
|
||||
.zoomImg {
|
||||
background-color: #fff;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.woocommerce-product-gallery__image:nth-child(n+2) {
|
||||
|
@ -410,8 +413,8 @@ table.variations {
|
|||
.flex-control-thumbs {
|
||||
li {
|
||||
list-style: none;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
}
|
||||
|
||||
img {
|
||||
|
@ -426,6 +429,8 @@ table.variations {
|
|||
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -339,57 +339,57 @@ body {
|
|||
font-size: 1em;
|
||||
margin-top: 0;
|
||||
margin-bottom: 20px;
|
||||
|
||||
input[type="checkbox"] {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.checkbox {
|
||||
input[type="checkbox"] {
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
}
|
||||
label {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding-left: 28px;
|
||||
&:before,
|
||||
&:after {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
}
|
||||
label {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding-left: 28px;
|
||||
&:before,
|
||||
&:after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
display: inline-block;
|
||||
}
|
||||
&:before {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
left: 0px;
|
||||
top: 3px;
|
||||
border: 1px solid #aaa;
|
||||
background-color: #fff;
|
||||
border-radius: 3px;
|
||||
}
|
||||
&:after {
|
||||
height: 5px;
|
||||
width: 9px;
|
||||
border-left: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
transform: rotate(-45deg);
|
||||
left: 4px;
|
||||
top: 7px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
input[type="checkbox"] + label::after {
|
||||
content: none;
|
||||
}
|
||||
input[type="checkbox"]:checked + label::after {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
}
|
||||
input[type="checkbox"]:focus + label::before {
|
||||
outline: rgb(59, 153, 252) auto 5px;
|
||||
&:before {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
left: 0px;
|
||||
top: 3px;
|
||||
border: 1px solid #aaa;
|
||||
background-color: #fff;
|
||||
border-radius: 3px;
|
||||
}
|
||||
input[type="checkbox"]:checked + label::before {
|
||||
background: #935687;
|
||||
border-color: #935687;
|
||||
outline: none;
|
||||
&:after {
|
||||
height: 5px;
|
||||
width: 9px;
|
||||
border-left: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
transform: rotate(-45deg);
|
||||
left: 4px;
|
||||
top: 7px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
input[type="checkbox"] + label::after {
|
||||
content: none;
|
||||
}
|
||||
input[type="checkbox"]:checked + label::after {
|
||||
content: "";
|
||||
}
|
||||
input[type="checkbox"]:focus + label::before {
|
||||
outline: rgb(59, 153, 252) auto 5px;
|
||||
}
|
||||
input[type="checkbox"]:checked + label::before {
|
||||
background: #935687;
|
||||
border-color: #935687;
|
||||
}
|
||||
}
|
||||
}
|
||||
.wc-setup-steps {
|
||||
|
@ -711,6 +711,7 @@ body {
|
|||
|
||||
.wc-wizard-service-settings {
|
||||
display: none;
|
||||
margin-top: 0.75em;
|
||||
margin-bottom: 0;
|
||||
cursor: default;
|
||||
|
||||
|
@ -947,6 +948,40 @@ h3.jetpack-reasons {
|
|||
}
|
||||
}
|
||||
|
||||
.wc-setup .wc-setup-actions .plugin-install-info {
|
||||
display: block;
|
||||
font-style: italic;
|
||||
color: #999;
|
||||
font-size: 14px;
|
||||
line-height: 1.5em;
|
||||
margin: 5px 0;
|
||||
|
||||
& > * {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.plugin-install-info-list-item:not(:last-child)::after {
|
||||
content: ', ';
|
||||
}
|
||||
|
||||
a {
|
||||
white-space: nowrap;
|
||||
|
||||
&:not(:hover):not(:focus) {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.plugin-install-source {
|
||||
$background: rgba( #bb77ae, 0.15 );
|
||||
background: $background;
|
||||
|
||||
&:not(.wc-wizard-service-item) {
|
||||
box-shadow: 0 0 0 10px $background;
|
||||
}
|
||||
}
|
||||
|
||||
.location-prompt {
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
|
@ -1168,7 +1203,6 @@ p.jetpack-terms {
|
|||
.wc-wizard-service-setting-stripe_create_account, .wc-wizard-service-setting-ppec_paypal_reroute_requests {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-top: 0.75em;
|
||||
|
||||
.payment-checkbox-input {
|
||||
order: 1;
|
||||
|
@ -1186,6 +1220,7 @@ p.jetpack-terms {
|
|||
|
||||
.wc-wizard-service-setting-stripe_email, .wc-wizard-service-setting-ppec_paypal_email {
|
||||
margin-top: 0.75em;
|
||||
margin-left: 1.5em;
|
||||
|
||||
label.stripe_email, label.ppec_paypal_email {
|
||||
position: absolute;
|
||||
|
@ -1199,17 +1234,14 @@ p.jetpack-terms {
|
|||
}
|
||||
|
||||
input.payment-email-input {
|
||||
margin-left: 1.5em;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: .5em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wc-wizard-service-settings-description {
|
||||
margin-left: 1.5em;
|
||||
height: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
.recommended-step {
|
||||
.wc-setup-content .recommended-step {
|
||||
border: 1px solid #ebebeb;
|
||||
border-radius: 4px;
|
||||
padding: 2.5em;
|
||||
|
@ -1217,15 +1249,22 @@ p.jetpack-terms {
|
|||
li {
|
||||
list-style: none;
|
||||
|
||||
&:last-child .recommended-item {
|
||||
&:last-child label {
|
||||
margin-bottom: 0; // Avoid extra space at the end of the list.
|
||||
}
|
||||
}
|
||||
|
||||
.recommended-item {
|
||||
label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 1.5em;
|
||||
|
||||
&:before, &:after {
|
||||
top: auto;
|
||||
}
|
||||
&:after {
|
||||
margin-top: -1.5px;
|
||||
}
|
||||
}
|
||||
|
||||
.recommended-item-icon {
|
||||
|
@ -1233,7 +1272,7 @@ p.jetpack-terms {
|
|||
border-radius: 7px;
|
||||
height: 3.5em;
|
||||
margin-right: 1em;
|
||||
margin-left: 1em;
|
||||
margin-left: 4px;
|
||||
|
||||
&.recommended-item-icon-storefront_theme {
|
||||
background-color: #f4a224;
|
||||
|
|
|
@ -186,6 +186,7 @@ p.demo_store,
|
|||
|
||||
.woocommerce-product-gallery__wrapper .zoomImg {
|
||||
background-color: #fff;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.woocommerce-product-gallery__image:nth-child(n+2) {
|
||||
|
@ -1710,8 +1711,10 @@ p.demo_store,
|
|||
/**
|
||||
* Right to left styles
|
||||
*/
|
||||
.rtl.woocommerce div.product div.images .flex-control-thumbs li {
|
||||
float: right;
|
||||
.rtl.woocommerce .price_label span {
|
||||
unicode-bidi: embed;
|
||||
/* rtl:ignore */
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
.woocommerce-message {
|
||||
|
|
|
@ -274,7 +274,11 @@ jQuery( function ( $ ) {
|
|||
|
||||
// Meta
|
||||
.on( 'click', 'button.add_order_item_meta', this.item_meta.add )
|
||||
.on( 'click', 'button.remove_order_item_meta', this.item_meta.remove );
|
||||
.on( 'click', 'button.remove_order_item_meta', this.item_meta.remove )
|
||||
|
||||
// Reload items
|
||||
.on( 'wc_order_items_reload', this.reload_items )
|
||||
.on( 'wc_order_items_reloaded', this.reloaded_items );
|
||||
|
||||
$( document.body )
|
||||
.on( 'wc_backbone_modal_loaded', this.backbone.init )
|
||||
|
@ -311,13 +315,17 @@ jQuery( function ( $ ) {
|
|||
success: function( response ) {
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).empty();
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).append( response );
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.reloaded_items();
|
||||
wc_meta_boxes_order_items.unblock();
|
||||
wc_meta_boxes_order_items.stupidtable.init();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
reloaded_items: function() {
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.stupidtable.init();
|
||||
},
|
||||
|
||||
// When the qty is changed, increase or decrease costs
|
||||
quantity_changed: function() {
|
||||
var $row = $( this ).closest( 'tr.item' );
|
||||
|
@ -393,9 +401,8 @@ jQuery( function ( $ ) {
|
|||
if ( response.success ) {
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).empty();
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).append( response.data.html );
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.reloaded_items();
|
||||
wc_meta_boxes_order_items.unblock();
|
||||
wc_meta_boxes_order_items.stupidtable.init();
|
||||
} else {
|
||||
window.alert( response.data.error );
|
||||
}
|
||||
|
@ -421,9 +428,8 @@ jQuery( function ( $ ) {
|
|||
if ( response.success ) {
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).empty();
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).append( response.data.html );
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.reloaded_items();
|
||||
wc_meta_boxes_order_items.unblock();
|
||||
wc_meta_boxes_order_items.stupidtable.init();
|
||||
} else {
|
||||
window.alert( response.data.error );
|
||||
}
|
||||
|
@ -481,9 +487,8 @@ jQuery( function ( $ ) {
|
|||
if ( response.success ) {
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).empty();
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).append( response.data.html );
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.reloaded_items();
|
||||
wc_meta_boxes_order_items.unblock();
|
||||
wc_meta_boxes_order_items.stupidtable.init();
|
||||
} else {
|
||||
window.alert( response.data.error );
|
||||
}
|
||||
|
@ -560,9 +565,8 @@ jQuery( function ( $ ) {
|
|||
if ( response.success ) {
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).empty();
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).append( response.data.html );
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.reloaded_items();
|
||||
wc_meta_boxes_order_items.unblock();
|
||||
wc_meta_boxes_order_items.stupidtable.init();
|
||||
} else {
|
||||
window.alert( response.data.error );
|
||||
}
|
||||
|
@ -592,9 +596,8 @@ jQuery( function ( $ ) {
|
|||
if ( response.success ) {
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).empty();
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).append( response.data.html );
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.reloaded_items();
|
||||
wc_meta_boxes_order_items.unblock();
|
||||
wc_meta_boxes_order_items.stupidtable.init();
|
||||
} else {
|
||||
window.alert( response.data.error );
|
||||
}
|
||||
|
@ -651,9 +654,8 @@ jQuery( function ( $ ) {
|
|||
success: function( response ) {
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).empty();
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).append( response );
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.reloaded_items();
|
||||
wc_meta_boxes_order_items.unblock();
|
||||
wc_meta_boxes_order_items.stupidtable.init();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -678,9 +680,8 @@ jQuery( function ( $ ) {
|
|||
success: function( response ) {
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).empty();
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).append( response );
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.reloaded_items();
|
||||
wc_meta_boxes_order_items.unblock();
|
||||
wc_meta_boxes_order_items.stupidtable.init();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1128,8 +1129,7 @@ jQuery( function ( $ ) {
|
|||
if ( response.success ) {
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).empty();
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).append( response.data.html );
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.stupidtable.init();
|
||||
wc_meta_boxes_order_items.reloaded_items();
|
||||
} else {
|
||||
window.alert( response.data.error );
|
||||
}
|
||||
|
@ -1171,8 +1171,7 @@ jQuery( function ( $ ) {
|
|||
if ( response.success ) {
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).empty();
|
||||
$( '#woocommerce-order-items' ).find( '.inside' ).append( response.data.html );
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.stupidtable.init();
|
||||
wc_meta_boxes_order_items.reloaded_items();
|
||||
} else {
|
||||
window.alert( response.data.error );
|
||||
}
|
||||
|
|
|
@ -59,20 +59,31 @@ jQuery(function( $ ) {
|
|||
$( 'input[name="_featured"]', '.inline-edit-row' ).removeAttr( 'checked' );
|
||||
}
|
||||
|
||||
if ( 'yes' === manage_stock ) {
|
||||
$( '.stock_qty_field, .backorder_field', '.inline-edit-row' ).show().removeAttr( 'style' );
|
||||
$( '.stock_status_field' ).hide();
|
||||
$( 'input[name="_manage_stock"]', '.inline-edit-row' ).attr( 'checked', 'checked' );
|
||||
} else {
|
||||
$( '.stock_qty_field, .backorder_field', '.inline-edit-row' ).hide();
|
||||
$( '.stock_status_field' ).show().removeAttr( 'style' );
|
||||
$( 'input[name="_manage_stock"]', '.inline-edit-row' ).removeAttr( 'checked' );
|
||||
}
|
||||
|
||||
// Conditional display
|
||||
var product_type = $wc_inline_data.find( '.product_type' ).text(),
|
||||
product_is_virtual = $wc_inline_data.find( '.product_is_virtual' ).text();
|
||||
|
||||
var product_supports_stock_status = 'external' !== product_type;
|
||||
var product_supports_stock_fields = 'external' !== product_type && 'grouped' !== product_type;
|
||||
|
||||
$( '.stock_fields, .manage_stock_field, .stock_status_field, .backorder_field' ).show();
|
||||
|
||||
if ( product_supports_stock_fields ) {
|
||||
if ( 'yes' === manage_stock ) {
|
||||
$( '.stock_fields' ).show().removeAttr( 'style' );
|
||||
$( '.stock_status_field' ).hide();
|
||||
$( '.manage_stock_field input' ).prop( 'checked', true );
|
||||
} else {
|
||||
$( '.stock_qty_field', '.inline-edit-row' ).hide();
|
||||
$( '.stock_status_field' ).show().removeAttr( 'style' );
|
||||
$( '.manage_stock_field input' ).prop( 'checked', false );
|
||||
}
|
||||
} else if ( product_supports_stock_status ) {
|
||||
$( '.stock_fields, .manage_stock_field, .backorder_field' ).hide();
|
||||
} else {
|
||||
$( '.stock_fields, .manage_stock_field, .stock_status_field, .backorder_field' ).hide();
|
||||
}
|
||||
|
||||
if ( 'simple' === product_type || 'external' === product_type ) {
|
||||
$( '.price_fields', '.inline-edit-row' ).show().removeAttr( 'style' );
|
||||
} else {
|
||||
|
@ -85,12 +96,6 @@ jQuery(function( $ ) {
|
|||
$( '.dimension_fields', '.inline-edit-row' ).show().removeAttr( 'style' );
|
||||
}
|
||||
|
||||
if ( 'grouped' === product_type ) {
|
||||
$( '.stock_fields', '.inline-edit-row' ).hide();
|
||||
} else {
|
||||
$( '.stock_fields', '.inline-edit-row' ).show().removeAttr( 'style' );
|
||||
}
|
||||
|
||||
// Rename core strings
|
||||
$( 'input[name="comment_status"]' ).parent().find( '.checkbox-title' ).text( woocommerce_quick_edit.strings.allow_reviews );
|
||||
});
|
||||
|
@ -98,10 +103,10 @@ jQuery(function( $ ) {
|
|||
$( '#the-list' ).on( 'change', '.inline-edit-row input[name="_manage_stock"]', function() {
|
||||
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( '.stock_qty_field, .backorder_field', '.inline-edit-row' ).show().removeAttr( 'style' );
|
||||
$( '.stock_qty_field', '.inline-edit-row' ).show().removeAttr( 'style' );
|
||||
$( '.stock_status_field' ).hide();
|
||||
} else {
|
||||
$( '.stock_qty_field, .backorder_field', '.inline-edit-row' ).hide();
|
||||
$( '.stock_qty_field', '.inline-edit-row' ).hide();
|
||||
$( '.stock_status_field' ).show().removeAttr( 'style' );
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(e){e("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var t=e(this).closest("tr").attr("id");t=t.replace("post-","");var i=e("#woocommerce_inline_"+t),n=i.find(".sku").text(),o=i.find(".regular_price").text(),d=i.find(".sale_price ").text(),l=i.find(".weight").text(),s=i.find(".length").text(),c=i.find(".width").text(),r=i.find(".height").text(),a=i.find(".shipping_class").text(),_=i.find(".visibility").text(),m=i.find(".stock_status").text(),p=i.find(".stock").text(),u=i.find(".featured").text(),w=i.find(".manage_stock").text(),f=i.find(".menu_order").text(),h=i.find(".tax_status").text(),k=i.find(".tax_class").text(),v=i.find(".backorders").text(),x=o.replace(".",woocommerce_admin.mon_decimal_point),g=d.replace(".",woocommerce_admin.mon_decimal_point);e('input[name="_sku"]',".inline-edit-row").val(n),e('input[name="_regular_price"]',".inline-edit-row").val(x),e('input[name="_sale_price"]',".inline-edit-row").val(g),e('input[name="_weight"]',".inline-edit-row").val(l),e('input[name="_length"]',".inline-edit-row").val(s),e('input[name="_width"]',".inline-edit-row").val(c),e('input[name="_height"]',".inline-edit-row").val(r),e('select[name="_shipping_class"] option:selected',".inline-edit-row").attr("selected",!1).change(),e('select[name="_shipping_class"] option[value="'+a+'"]').attr("selected","selected").change(),e('input[name="_stock"]',".inline-edit-row").val(p),e('input[name="menu_order"]',".inline-edit-row").val(f),e('select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').removeAttr("selected"),e('select[name="_tax_status"] option[value="'+h+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_tax_class"] option[value="'+k+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_visibility"] option[value="'+_+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_stock_status"] option[value="'+m+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_backorders"] option[value="'+v+'"]',".inline-edit-row").attr("selected","selected"),"yes"===u?e('input[name="_featured"]',".inline-edit-row").attr("checked","checked"):e('input[name="_featured"]',".inline-edit-row").removeAttr("checked"),"yes"===w?(e(".stock_qty_field, .backorder_field",".inline-edit-row").show().removeAttr("style"),e(".stock_status_field").hide(),e('input[name="_manage_stock"]',".inline-edit-row").attr("checked","checked")):(e(".stock_qty_field, .backorder_field",".inline-edit-row").hide(),e(".stock_status_field").show().removeAttr("style"),e('input[name="_manage_stock"]',".inline-edit-row").removeAttr("checked"));var y=i.find(".product_type").text(),b=i.find(".product_is_virtual").text();"simple"===y||"external"===y?e(".price_fields",".inline-edit-row").show().removeAttr("style"):e(".price_fields",".inline-edit-row").hide(),"yes"===b?e(".dimension_fields",".inline-edit-row").hide():e(".dimension_fields",".inline-edit-row").show().removeAttr("style"),"grouped"===y?e(".stock_fields",".inline-edit-row").hide():e(".stock_fields",".inline-edit-row").show().removeAttr("style"),e('input[name="comment_status"]').parent().find(".checkbox-title").text(woocommerce_quick_edit.strings.allow_reviews)}),e("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){e(this).is(":checked")?(e(".stock_qty_field, .backorder_field",".inline-edit-row").show().removeAttr("style"),e(".stock_status_field").hide()):(e(".stock_qty_field, .backorder_field",".inline-edit-row").hide(),e(".stock_status_field").show().removeAttr("style"))}),e("#wpbody").on("click","#doaction, #doaction2",function(){e("input.text",".inline-edit-row").val(""),e("#woocommerce-fields").find("select").prop("selectedIndex",0),e("#woocommerce-fields-bulk").find(".inline-edit-group .change-input").hide()}),e("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){0<e(this).val()?e(this).closest("div").find(".change-input").show():e(this).closest("div").find(".change-input").hide()}),e("#wpbody").on("click",".trash-product",function(){return window.confirm(woocommerce_admin.i18_delete_product_notice)})});
|
||||
jQuery(function(e){e("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var t=e(this).closest("tr").attr("id");t=t.replace("post-","");var i=e("#woocommerce_inline_"+t),n=i.find(".sku").text(),o=i.find(".regular_price").text(),s=i.find(".sale_price ").text(),d=i.find(".weight").text(),l=i.find(".length").text(),c=i.find(".width").text(),a=i.find(".height").text(),r=i.find(".shipping_class").text(),_=i.find(".visibility").text(),m=i.find(".stock_status").text(),p=i.find(".stock").text(),u=i.find(".featured").text(),f=i.find(".manage_stock").text(),h=i.find(".menu_order").text(),w=i.find(".tax_status").text(),k=i.find(".tax_class").text(),v=i.find(".backorders").text(),x=o.replace(".",woocommerce_admin.mon_decimal_point),g=s.replace(".",woocommerce_admin.mon_decimal_point);e('input[name="_sku"]',".inline-edit-row").val(n),e('input[name="_regular_price"]',".inline-edit-row").val(x),e('input[name="_sale_price"]',".inline-edit-row").val(g),e('input[name="_weight"]',".inline-edit-row").val(d),e('input[name="_length"]',".inline-edit-row").val(l),e('input[name="_width"]',".inline-edit-row").val(c),e('input[name="_height"]',".inline-edit-row").val(a),e('select[name="_shipping_class"] option:selected',".inline-edit-row").attr("selected",!1).change(),e('select[name="_shipping_class"] option[value="'+r+'"]').attr("selected","selected").change(),e('input[name="_stock"]',".inline-edit-row").val(p),e('input[name="menu_order"]',".inline-edit-row").val(h),e('select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').removeAttr("selected"),e('select[name="_tax_status"] option[value="'+w+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_tax_class"] option[value="'+k+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_visibility"] option[value="'+_+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_stock_status"] option[value="'+m+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_backorders"] option[value="'+v+'"]',".inline-edit-row").attr("selected","selected"),"yes"===u?e('input[name="_featured"]',".inline-edit-row").attr("checked","checked"):e('input[name="_featured"]',".inline-edit-row").removeAttr("checked");var y=i.find(".product_type").text(),b=i.find(".product_is_virtual").text(),A="external"!==y,q="external"!==y&&"grouped"!==y;e(".stock_fields, .manage_stock_field, .stock_status_field, .backorder_field").show(),q?"yes"===f?(e(".stock_fields").show().removeAttr("style"),e(".stock_status_field").hide(),e(".manage_stock_field input").prop("checked",!0)):(e(".stock_qty_field",".inline-edit-row").hide(),e(".stock_status_field").show().removeAttr("style"),e(".manage_stock_field input").prop("checked",!1)):A?e(".stock_fields, .manage_stock_field, .backorder_field").hide():e(".stock_fields, .manage_stock_field, .stock_status_field, .backorder_field").hide(),"simple"===y||"external"===y?e(".price_fields",".inline-edit-row").show().removeAttr("style"):e(".price_fields",".inline-edit-row").hide(),"yes"===b?e(".dimension_fields",".inline-edit-row").hide():e(".dimension_fields",".inline-edit-row").show().removeAttr("style"),e('input[name="comment_status"]').parent().find(".checkbox-title").text(woocommerce_quick_edit.strings.allow_reviews)}),e("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){e(this).is(":checked")?(e(".stock_qty_field",".inline-edit-row").show().removeAttr("style"),e(".stock_status_field").hide()):(e(".stock_qty_field",".inline-edit-row").hide(),e(".stock_status_field").show().removeAttr("style"))}),e("#wpbody").on("click","#doaction, #doaction2",function(){e("input.text",".inline-edit-row").val(""),e("#woocommerce-fields").find("select").prop("selectedIndex",0),e("#woocommerce-fields-bulk").find(".inline-edit-group .change-input").hide()}),e("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){0<e(this).val()?e(this).closest("div").find(".change-input").show():e(this).closest("div").find(".change-input").hide()}),e("#wpbody").on("click",".trash-product",function(){return window.confirm(woocommerce_admin.i18_delete_product_notice)})});
|
|
@ -1,127 +1,172 @@
|
|||
/* global woocommerce_settings_params */
|
||||
( function( $ ) {
|
||||
/* global woocommerce_settings_params, wp */
|
||||
( function( $, params, wp ) {
|
||||
$( function() {
|
||||
// Sell Countries
|
||||
$( 'select#woocommerce_allowed_countries' ).change( function() {
|
||||
if ( 'specific' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
$( this ).closest('tr').next().next( 'tr' ).show();
|
||||
} else if ( 'all_except' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).show();
|
||||
$( this ).closest('tr').next().next( 'tr' ).hide();
|
||||
} else {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
$( this ).closest('tr').next().next( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Sell Countries
|
||||
$( 'select#woocommerce_allowed_countries' ).change( function() {
|
||||
if ( 'specific' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
$( this ).closest('tr').next().next( 'tr' ).show();
|
||||
} else if ( 'all_except' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).show();
|
||||
$( this ).closest('tr').next().next( 'tr' ).hide();
|
||||
} else {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
$( this ).closest('tr').next().next( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
// Ship Countries
|
||||
$( 'select#woocommerce_ship_to_countries' ).change( function() {
|
||||
if ( 'specific' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).show();
|
||||
} else {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Ship Countries
|
||||
$( 'select#woocommerce_ship_to_countries' ).change( function() {
|
||||
if ( 'specific' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).show();
|
||||
} else {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
// Stock management
|
||||
$( 'input#woocommerce_manage_stock' ).change( function() {
|
||||
if ( $( this ).is(':checked') ) {
|
||||
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).show();
|
||||
} else {
|
||||
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Stock management
|
||||
$( 'input#woocommerce_manage_stock' ).change( function() {
|
||||
if ( $( this ).is(':checked') ) {
|
||||
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).show();
|
||||
} else {
|
||||
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
// Color picker
|
||||
$( '.colorpick' )
|
||||
|
||||
// Color picker
|
||||
$( '.colorpick' )
|
||||
.iris({
|
||||
change: function( event, ui ) {
|
||||
$( this ).parent().find( '.colorpickpreview' ).css({ backgroundColor: ui.color.toString() });
|
||||
},
|
||||
hide: true,
|
||||
border: true
|
||||
})
|
||||
|
||||
.iris({
|
||||
change: function( event, ui ) {
|
||||
$( this ).parent().find( '.colorpickpreview' ).css({ backgroundColor: ui.color.toString() });
|
||||
},
|
||||
hide: true,
|
||||
border: true
|
||||
})
|
||||
.on( 'click focus', function( event ) {
|
||||
event.stopPropagation();
|
||||
$( '.iris-picker' ).hide();
|
||||
$( this ).closest( 'td' ).find( '.iris-picker' ).show();
|
||||
$( this ).data( 'original-value', $( this ).val() );
|
||||
})
|
||||
|
||||
.on( 'click focus', function( event ) {
|
||||
event.stopPropagation();
|
||||
.on( 'change', function() {
|
||||
if ( $( this ).is( '.iris-error' ) ) {
|
||||
var original_value = $( this ).data( 'original-value' );
|
||||
|
||||
if ( original_value.match( /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ ) ) {
|
||||
$( this ).val( $( this ).data( 'original-value' ) ).change();
|
||||
} else {
|
||||
$( this ).val( '' ).change();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', function() {
|
||||
$( '.iris-picker' ).hide();
|
||||
$( this ).closest( 'td' ).find( '.iris-picker' ).show();
|
||||
$( this ).data( 'original-value', $( this ).val() );
|
||||
})
|
||||
});
|
||||
|
||||
.on( 'change', function() {
|
||||
if ( $( this ).is( '.iris-error' ) ) {
|
||||
var original_value = $( this ).data( 'original-value' );
|
||||
// Edit prompt
|
||||
$( function() {
|
||||
var changed = false;
|
||||
|
||||
if ( original_value.match( /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ ) ) {
|
||||
$( this ).val( $( this ).data( 'original-value' ) ).change();
|
||||
$( 'input, textarea, select, checkbox' ).change( function() {
|
||||
changed = true;
|
||||
});
|
||||
|
||||
$( '.woo-nav-tab-wrapper a' ).click( function() {
|
||||
if ( changed ) {
|
||||
window.onbeforeunload = function() {
|
||||
return params.i18n_nav_warning;
|
||||
};
|
||||
} else {
|
||||
$( this ).val( '' ).change();
|
||||
window.onbeforeunload = '';
|
||||
}
|
||||
});
|
||||
|
||||
$( '.submit :input' ).click( function() {
|
||||
window.onbeforeunload = '';
|
||||
});
|
||||
});
|
||||
|
||||
// Sorting
|
||||
$( 'table.wc_gateways tbody, table.wc_shipping tbody' ).sortable({
|
||||
items: 'tr',
|
||||
cursor: 'move',
|
||||
axis: 'y',
|
||||
handle: 'td.sort',
|
||||
scrollSensitivity: 40,
|
||||
helper: function( event, ui ) {
|
||||
ui.children().each( function() {
|
||||
$( this ).width( $( this ).width() );
|
||||
});
|
||||
ui.css( 'left', '0' );
|
||||
return ui;
|
||||
},
|
||||
start: function( event, ui ) {
|
||||
ui.item.css( 'background-color', '#f6f6f6' );
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
ui.item.removeAttr( 'style' );
|
||||
ui.item.trigger( 'updateMoveButtons' );
|
||||
}
|
||||
});
|
||||
|
||||
// Select all/none
|
||||
$( '.woocommerce' ).on( 'click', '.select_all', function() {
|
||||
$( this ).closest( 'td' ).find( 'select option' ).attr( 'selected', 'selected' );
|
||||
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
|
||||
$( '.woocommerce' ).on( 'click', '.select_none', function() {
|
||||
$( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' );
|
||||
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
|
||||
// Re-order buttons.
|
||||
$( '.wc-item-reorder-nav').find( '.wc-move-up, .wc-move-down' ).on( 'click', function() {
|
||||
var moveBtn = $( this ),
|
||||
$row = moveBtn.closest( 'tr' );
|
||||
|
||||
moveBtn.focus();
|
||||
|
||||
var isMoveUp = moveBtn.is( '.wc-move-up' ),
|
||||
isMoveDown = moveBtn.is( '.wc-move-down' );
|
||||
|
||||
if ( isMoveUp ) {
|
||||
var $previewRow = $row.prev( 'tr' );
|
||||
|
||||
if ( $previewRow && $previewRow.length ) {
|
||||
$previewRow.before( $row );
|
||||
wp.a11y.speak( params.i18n_moved_up );
|
||||
}
|
||||
} else if ( isMoveDown ) {
|
||||
var $nextRow = $row.next( 'tr' );
|
||||
|
||||
if ( $nextRow && $nextRow.length ) {
|
||||
$nextRow.after( $row );
|
||||
wp.a11y.speak( params.i18n_moved_down );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', function() {
|
||||
$( '.iris-picker' ).hide();
|
||||
moveBtn.focus(); // Re-focus after the container was moved.
|
||||
moveBtn.closest( 'table' ).trigger( 'updateMoveButtons' );
|
||||
} );
|
||||
|
||||
$( '.wc-item-reorder-nav').closest( 'table' ).on( 'updateMoveButtons', function() {
|
||||
var table = $( this ),
|
||||
lastRow = $( this ).find( 'tbody tr:last' ),
|
||||
firstRow = $( this ).find( 'tbody tr:first' );
|
||||
|
||||
table.find( '.wc-item-reorder-nav .wc-move-disabled' ).removeClass( 'wc-move-disabled' ).attr( { 'tabindex': '0', 'aria-hidden': 'false' } );
|
||||
firstRow.find( '.wc-item-reorder-nav .wc-move-up' ).addClass( 'wc-move-disabled' ).attr( { 'tabindex': '-1', 'aria-hidden': 'true' } );
|
||||
lastRow.find( '.wc-item-reorder-nav .wc-move-down' ).addClass( 'wc-move-disabled' ).attr( { 'tabindex': '-1', 'aria-hidden': 'true' } );
|
||||
} );
|
||||
|
||||
$( '.wc-item-reorder-nav').closest( 'table' ).trigger( 'updateMoveButtons' );
|
||||
|
||||
});
|
||||
|
||||
// Edit prompt
|
||||
$( function() {
|
||||
var changed = false;
|
||||
|
||||
$( 'input, textarea, select, checkbox' ).change( function() {
|
||||
changed = true;
|
||||
});
|
||||
|
||||
$( '.woo-nav-tab-wrapper a' ).click( function() {
|
||||
if ( changed ) {
|
||||
window.onbeforeunload = function() {
|
||||
return woocommerce_settings_params.i18n_nav_warning;
|
||||
};
|
||||
} else {
|
||||
window.onbeforeunload = '';
|
||||
}
|
||||
});
|
||||
|
||||
$( '.submit input' ).click( function() {
|
||||
window.onbeforeunload = '';
|
||||
});
|
||||
});
|
||||
|
||||
// Sorting
|
||||
$( 'table.wc_gateways tbody, table.wc_shipping tbody' ).sortable({
|
||||
items: 'tr',
|
||||
cursor: 'move',
|
||||
axis: 'y',
|
||||
handle: 'td.sort',
|
||||
scrollSensitivity: 40,
|
||||
helper: function( event, ui ) {
|
||||
ui.children().each( function() {
|
||||
$( this ).width( $( this ).width() );
|
||||
});
|
||||
ui.css( 'left', '0' );
|
||||
return ui;
|
||||
},
|
||||
start: function( event, ui ) {
|
||||
ui.item.css( 'background-color', '#f6f6f6' );
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
ui.item.removeAttr( 'style' );
|
||||
}
|
||||
});
|
||||
|
||||
// Select all/none
|
||||
$( '.woocommerce' ).on( 'click', '.select_all', function() {
|
||||
$( this ).closest( 'td' ).find( 'select option' ).attr( 'selected', 'selected' );
|
||||
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
|
||||
$( '.woocommerce' ).on( 'click', '.select_none', function() {
|
||||
$( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' );
|
||||
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
})( jQuery );
|
||||
})( jQuery, woocommerce_settings_params, wp );
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(t){t("select#woocommerce_allowed_countries").change(function(){"specific"===t(this).val()?(t(this).closest("tr").next("tr").hide(),t(this).closest("tr").next().next("tr").show()):"all_except"===t(this).val()?(t(this).closest("tr").next("tr").show(),t(this).closest("tr").next().next("tr").hide()):(t(this).closest("tr").next("tr").hide(),t(this).closest("tr").next().next("tr").hide())}).change(),t("select#woocommerce_ship_to_countries").change(function(){"specific"===t(this).val()?t(this).closest("tr").next("tr").show():t(this).closest("tr").next("tr").hide()}).change(),t("input#woocommerce_manage_stock").change(function(){t(this).is(":checked")?t(this).closest("tbody").find(".manage_stock_field").closest("tr").show():t(this).closest("tbody").find(".manage_stock_field").closest("tr").hide()}).change(),t(".colorpick").iris({change:function(e,i){t(this).parent().find(".colorpickpreview").css({backgroundColor:i.color.toString()})},hide:!0,border:!0}).on("click focus",function(e){e.stopPropagation(),t(".iris-picker").hide(),t(this).closest("td").find(".iris-picker").show(),t(this).data("original-value",t(this).val())}).on("change",function(){t(this).is(".iris-error")&&(t(this).data("original-value").match(/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/)?t(this).val(t(this).data("original-value")).change():t(this).val("").change())}),t("body").on("click",function(){t(".iris-picker").hide()}),t(function(){var e=!1;t("input, textarea, select, checkbox").change(function(){e=!0}),t(".woo-nav-tab-wrapper a").click(function(){window.onbeforeunload=e?function(){return woocommerce_settings_params.i18n_nav_warning}:""}),t(".submit input").click(function(){window.onbeforeunload=""})}),t("table.wc_gateways tbody, table.wc_shipping tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(e,i){return i.children().each(function(){t(this).width(t(this).width())}),i.css("left","0"),i},start:function(t,e){e.item.css("background-color","#f6f6f6")},stop:function(t,e){e.item.removeAttr("style")}}),t(".woocommerce").on("click",".select_all",function(){return t(this).closest("td").find("select option").attr("selected","selected"),t(this).closest("td").find("select").trigger("change"),!1}),t(".woocommerce").on("click",".select_none",function(){return t(this).closest("td").find("select option").removeAttr("selected"),t(this).closest("td").find("select").trigger("change"),!1})}(jQuery);
|
||||
!function(t,e,i){t(function(){t("select#woocommerce_allowed_countries").change(function(){"specific"===t(this).val()?(t(this).closest("tr").next("tr").hide(),t(this).closest("tr").next().next("tr").show()):"all_except"===t(this).val()?(t(this).closest("tr").next("tr").show(),t(this).closest("tr").next().next("tr").hide()):(t(this).closest("tr").next("tr").hide(),t(this).closest("tr").next().next("tr").hide())}).change(),t("select#woocommerce_ship_to_countries").change(function(){"specific"===t(this).val()?t(this).closest("tr").next("tr").show():t(this).closest("tr").next("tr").hide()}).change(),t("input#woocommerce_manage_stock").change(function(){t(this).is(":checked")?t(this).closest("tbody").find(".manage_stock_field").closest("tr").show():t(this).closest("tbody").find(".manage_stock_field").closest("tr").hide()}).change(),t(".colorpick").iris({change:function(e,i){t(this).parent().find(".colorpickpreview").css({backgroundColor:i.color.toString()})},hide:!0,border:!0}).on("click focus",function(e){e.stopPropagation(),t(".iris-picker").hide(),t(this).closest("td").find(".iris-picker").show(),t(this).data("original-value",t(this).val())}).on("change",function(){t(this).is(".iris-error")&&(t(this).data("original-value").match(/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/)?t(this).val(t(this).data("original-value")).change():t(this).val("").change())}),t("body").on("click",function(){t(".iris-picker").hide()}),t(function(){var i=!1;t("input, textarea, select, checkbox").change(function(){i=!0}),t(".woo-nav-tab-wrapper a").click(function(){window.onbeforeunload=i?function(){return e.i18n_nav_warning}:""}),t(".submit :input").click(function(){window.onbeforeunload=""})}),t("table.wc_gateways tbody, table.wc_shipping tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(e,i){return i.children().each(function(){t(this).width(t(this).width())}),i.css("left","0"),i},start:function(t,e){e.item.css("background-color","#f6f6f6")},stop:function(t,e){e.item.removeAttr("style"),e.item.trigger("updateMoveButtons")}}),t(".woocommerce").on("click",".select_all",function(){return t(this).closest("td").find("select option").attr("selected","selected"),t(this).closest("td").find("select").trigger("change"),!1}),t(".woocommerce").on("click",".select_none",function(){return t(this).closest("td").find("select option").removeAttr("selected"),t(this).closest("td").find("select").trigger("change"),!1}),t(".wc-item-reorder-nav").find(".wc-move-up, .wc-move-down").on("click",function(){var o=t(this),s=o.closest("tr");o.focus();var n=o.is(".wc-move-up"),c=o.is(".wc-move-down");if(n){var r=s.prev("tr");r&&r.length&&(r.before(s),i.a11y.speak(e.i18n_moved_up))}else if(c){var a=s.next("tr");a&&a.length&&(a.after(s),i.a11y.speak(e.i18n_moved_down))}o.focus(),o.closest("table").trigger("updateMoveButtons")}),t(".wc-item-reorder-nav").closest("table").on("updateMoveButtons",function(){var e=t(this),i=t(this).find("tbody tr:last"),o=t(this).find("tbody tr:first");e.find(".wc-item-reorder-nav .wc-move-disabled").removeClass("wc-move-disabled").attr({tabindex:"0","aria-hidden":"false"}),o.find(".wc-item-reorder-nav .wc-move-up").addClass("wc-move-disabled").attr({tabindex:"-1","aria-hidden":"true"}),i.find(".wc-item-reorder-nav .wc-move-down").addClass("wc-move-disabled").attr({tabindex:"-1","aria-hidden":"true"})}),t(".wc-item-reorder-nav").closest("table").trigger("updateMoveButtons")})}(jQuery,woocommerce_settings_params,wp);
|
|
@ -5,19 +5,33 @@ jQuery( function( $ ) {
|
|||
|
||||
var table_selector = 'table.wp-list-table',
|
||||
item_selector = 'tbody tr:not(.inline-edit-row)',
|
||||
term_id_selector = '.column-handle input[name="term_id"]';
|
||||
term_id_selector = '.column-handle input[name="term_id"]',
|
||||
column_handle = '<td class="column-handle"></td>';
|
||||
|
||||
if ( 0 === $( table_selector ).find( '.column-handle' ).length ) {
|
||||
$( table_selector ).find( 'tr:not(.inline-edit-row)' ).append( '<td class="column-handle"></td>' );
|
||||
$( table_selector ).find( 'tr:not(.inline-edit-row)' ).append( column_handle );
|
||||
|
||||
term_id_selector = '.check-column input';
|
||||
}
|
||||
|
||||
$( table_selector ).find( '.column-handle' ).show();
|
||||
|
||||
$.wc_add_missing_sort_handles = function() {
|
||||
var all_table_rows = $( table_selector ).find('tbody > tr');
|
||||
var rows_with_handle = $( table_selector ).find('tbody > tr > td.column-handle').parent();
|
||||
if ( all_table_rows.length !== rows_with_handle.length ) {
|
||||
all_table_rows.each(function(index, elem){
|
||||
if ( ! rows_with_handle.is( elem ) ) {
|
||||
$( elem ).append( column_handle );
|
||||
}
|
||||
});
|
||||
}
|
||||
$( table_selector ).find( '.column-handle' ).show();
|
||||
};
|
||||
|
||||
$( document ).ajaxComplete( function( event, request, options ) {
|
||||
if ( request && 4 === request.readyState && 200 === request.status && options.data && 0 <= options.data.indexOf( '_inline_edit' ) ) {
|
||||
$( table_selector ).find( '.column-handle' ).show();
|
||||
if ( request && 4 === request.readyState && 200 === request.status && options.data && ( 0 <= options.data.indexOf( '_inline_edit' ) || 0 <= options.data.indexOf( 'add-tag' ) ) ) {
|
||||
$.wc_add_missing_sort_handles();
|
||||
$( document.body ).trigger( 'init_tooltips' );
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(e){var t="table.wp-list-table",n='.column-handle input[name="term_id"]';0===e(t).find(".column-handle").length&&(e(t).find("tr:not(.inline-edit-row)").append('<td class="column-handle"></td>'),n=".check-column input"),e(t).find(".column-handle").show(),e(document).ajaxComplete(function(n,i,d){i&&4===i.readyState&&200===i.status&&d.data&&0<=d.data.indexOf("_inline_edit")&&(e(t).find(".column-handle").show(),e(document.body).trigger("init_tooltips"))}),e(t).sortable({items:"tbody tr:not(.inline-edit-row)",cursor:"move",handle:".column-handle",axis:"y",forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"product-cat-placeholder",scrollSensitivity:40,start:function(e,t){t.item.hasClass("alternate")||t.item.css("background-color","#ffffff"),t.item.children("td, th").css("border-bottom-width","0"),t.item.css("outline","1px solid #aaa")},stop:function(e,t){t.item.removeAttr("style"),t.item.children("td, th").css("border-bottom-width","1px")},update:function(i,d){var o,a,l=d.item.find(n).val(),r=d.item.find(".parent").html(),c=d.item.prev().find(n).val(),m=d.item.next().find(n).val();c!==undefined&&(o=d.item.prev().find(".parent").html())!==r&&(c=undefined),m!==undefined&&(a=d.item.next().find(".parent").html())!==r&&(m=undefined),c===undefined&&m===undefined||m===undefined&&a===c||m!==undefined&&o===l?e(t).sortable("cancel"):(d.item.find(".check-column input").hide(),d.item.find(".check-column").append('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),e.post(ajaxurl,{action:"woocommerce_term_ordering",id:l,nextid:m,thetaxonomy:woocommerce_term_ordering_params.taxonomy},function(e){"children"===e?window.location.reload():(d.item.find(".check-column input").show(),d.item.find(".check-column").find("img").remove())}),e("table.widefat tbody tr").each(function(){jQuery("table.widefat tbody tr").index(this)%2==0?jQuery(this).addClass("alternate"):jQuery(this).removeClass("alternate")}))}})});
|
||||
jQuery(function(e){var t="table.wp-list-table",n='.column-handle input[name="term_id"]';0===e(t).find(".column-handle").length&&(e(t).find("tr:not(.inline-edit-row)").append('<td class="column-handle"></td>'),n=".check-column input"),e(t).find(".column-handle").show(),e.wc_add_missing_sort_handles=function(){var n=e(t).find("tbody > tr"),i=e(t).find("tbody > tr > td.column-handle").parent();n.length!==i.length&&n.each(function(t,n){i.is(n)||e(n).append('<td class="column-handle"></td>')}),e(t).find(".column-handle").show()},e(document).ajaxComplete(function(t,n,i){n&&4===n.readyState&&200===n.status&&i.data&&(0<=i.data.indexOf("_inline_edit")||0<=i.data.indexOf("add-tag"))&&(e.wc_add_missing_sort_handles(),e(document.body).trigger("init_tooltips"))}),e(t).sortable({items:"tbody tr:not(.inline-edit-row)",cursor:"move",handle:".column-handle",axis:"y",forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"product-cat-placeholder",scrollSensitivity:40,start:function(e,t){t.item.hasClass("alternate")||t.item.css("background-color","#ffffff"),t.item.children("td, th").css("border-bottom-width","0"),t.item.css("outline","1px solid #aaa")},stop:function(e,t){t.item.removeAttr("style"),t.item.children("td, th").css("border-bottom-width","1px")},update:function(i,d){var a,o,l=d.item.find(n).val(),c=d.item.find(".parent").html(),r=d.item.prev().find(n).val(),m=d.item.next().find(n).val();r!==undefined&&(a=d.item.prev().find(".parent").html())!==c&&(r=undefined),m!==undefined&&(o=d.item.next().find(".parent").html())!==c&&(m=undefined),r===undefined&&m===undefined||m===undefined&&o===r||m!==undefined&&a===l?e(t).sortable("cancel"):(d.item.find(".check-column input").hide(),d.item.find(".check-column").append('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),e.post(ajaxurl,{action:"woocommerce_term_ordering",id:l,nextid:m,thetaxonomy:woocommerce_term_ordering_params.taxonomy},function(e){"children"===e?window.location.reload():(d.item.find(".check-column input").show(),d.item.find(".check-column").find("img").remove())}),e("table.widefat tbody tr").each(function(){jQuery("table.widefat tbody tr").index(this)%2==0?jQuery(this).addClass("alternate"):jQuery(this).removeClass("alternate")}))}})});
|
|
@ -47,6 +47,8 @@ jQuery( function( $ ) {
|
|||
$( '.store-state-container' ).hide();
|
||||
$state_select.empty().val( '' ).change().prop( 'required', false );
|
||||
}
|
||||
|
||||
$( '#currency_code' ).val( wc_setup_currencies[ country ] ).change();
|
||||
} );
|
||||
|
||||
$( '#store_country' ).change();
|
||||
|
@ -108,9 +110,11 @@ jQuery( function( $ ) {
|
|||
|
||||
$( '.wc-wizard-services' ).on( 'change', '.wc-wizard-shipping-method-enable', function() {
|
||||
var checked = $( this ).is( ':checked' );
|
||||
var selectedMethod = $( '.wc-wizard-shipping-method-select .method' ).val();
|
||||
|
||||
$( this )
|
||||
.closest( '.wc-wizard-service-item' )
|
||||
.find( '.' + selectedMethod )
|
||||
.find( '.shipping-method-required-field' )
|
||||
.prop( 'required', checked );
|
||||
} );
|
||||
|
@ -172,8 +176,50 @@ jQuery( function( $ ) {
|
|||
}
|
||||
} ).find( 'input#stripe_create_account, input#ppec_paypal_reroute_requests' ).change();
|
||||
|
||||
$( 'select#store_country' ).on( 'change', function() {
|
||||
var countryCode = $( this ).val();
|
||||
$( 'select#currency_code' ).val( wc_setup_currencies[ countryCode ] ).change();
|
||||
} );
|
||||
function addPlugins( bySlug, $el, hover ) {
|
||||
var plugins = $el.data( 'plugins' );
|
||||
for ( var i in Array.isArray( plugins ) ? plugins : [] ) {
|
||||
var slug = plugins[ i ].slug;
|
||||
bySlug[ slug ] = bySlug[ slug ] ||
|
||||
$( '<span class="plugin-install-info-list-item">' )
|
||||
.append( '<a href="https://wordpress.org/plugins/' + slug + '/" target="_blank">' + plugins[ i ].name + '</a>' );
|
||||
|
||||
bySlug[ slug ].find( 'a' )
|
||||
.on( 'mouseenter mouseleave', ( function( $hover, event ) {
|
||||
$hover.toggleClass( 'plugin-install-source', 'mouseenter' === event.type );
|
||||
} ).bind( null, hover ? $el.closest( hover ) : $el ) );
|
||||
}
|
||||
}
|
||||
|
||||
function updatePluginInfo() {
|
||||
var pluginLinkBySlug = {};
|
||||
|
||||
$( '.wc-wizard-service-enable input:checked' ).each( function() {
|
||||
addPlugins( pluginLinkBySlug, $( this ), '.wc-wizard-service-item' );
|
||||
|
||||
var $container = $( this ).closest( '.wc-wizard-service-item' );
|
||||
$container.find( 'input.payment-checkbox-input:checked' ).each( function() {
|
||||
addPlugins( pluginLinkBySlug, $( this ), '.wc-wizard-service-settings' );
|
||||
} );
|
||||
$container.find( '.wc-wizard-shipping-method-select .method' ).each( function() {
|
||||
var $this = $( this );
|
||||
if ( 'live_rates' === $this.val() ) {
|
||||
addPlugins( pluginLinkBySlug, $this, '.wc-wizard-service-item' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
$( '.recommended-item input:checked' ).each( function() {
|
||||
addPlugins( pluginLinkBySlug, $( this ), '.recommended-item' );
|
||||
} );
|
||||
|
||||
var $list = $( 'span.plugin-install-info-list' ).empty();
|
||||
for ( var slug in pluginLinkBySlug ) {
|
||||
$list.append( pluginLinkBySlug[ slug ] );
|
||||
}
|
||||
$( 'span.plugin-install-info' ).toggle( $list.children().length > 0 );
|
||||
}
|
||||
|
||||
updatePluginInfo();
|
||||
$( '.wc-setup-content' ).on( 'change', '[data-plugins]', updatePluginInfo );
|
||||
} );
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(e){function i(){e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}function t(){e("form.activate-jetpack").submit()}function s(){wp.ajax.post("setup_wizard_check_jetpack").then(function(e){if(!e||!e.is_active||"yes"===e.is_active)return t();setTimeout(s,3e3)}).fail(function(){t()})}e(".button-next").on("click",function(){var t=e(this).parents("form").get(0);return("function"!=typeof t.checkValidity||t.checkValidity())&&i(),!0}),e("#store_country").on("change",function(){if(null!==wc_setup_params.states){var i=e(this).val(),t=e("#store_state");if(e.isEmptyObject(wc_setup_params.states[i]))e(".store-state-container").hide(),t.empty().val("").change().prop("required",!1);else{var s=wc_setup_params.states[i];t.empty(),e.each(s,function(i){t.append(e('<option value="'+i+'">'+s[i]+"</option>"))}),e(".store-state-container").show(),t.selectWoo().val(wc_base_state).change().prop("required",!0)}}}),e("#store_country").change(),e(".wc-wizard-services").on("change",".wc-wizard-service-enable input",function(){e(this).is(":checked")?(e(this).closest(".wc-wizard-service-toggle").removeClass("disabled"),e(this).closest(".wc-wizard-service-item").addClass("checked"),e(this).closest(".wc-wizard-service-item").find(".wc-wizard-service-settings").removeClass("hide")):(e(this).closest(".wc-wizard-service-toggle").addClass("disabled"),e(this).closest(".wc-wizard-service-item").removeClass("checked"),e(this).closest(".wc-wizard-service-item").find(".wc-wizard-service-settings").addClass("hide"))}),e(".wc-wizard-services").on("click",".wc-wizard-service-enable",function(i){if(e(i.target).is("input"))i.stopPropagation();else{var t=e(this).find('input[type="checkbox"]');t.prop("checked",!t.prop("checked")).change()}}),e(".wc-wizard-services-list-toggle").on("click",function(){e(this).closest(".wc-wizard-services-list-toggle").toggleClass("closed"),e(this).closest(".wc-wizard-services").find(".wc-wizard-service-item").slideToggle().css("display","flex")}),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-select .method",function(i){var t=e(this).closest(".wc-wizard-service-description"),s=i.target.value,c=t.find(".shipping-method-descriptions");c.find(".shipping-method-description").addClass("hide"),c.find("."+s).removeClass("hide");var r=t.find(".shipping-method-settings");r.find(".shipping-method-setting").addClass("hide").find(".shipping-method-required-field").prop("required",!1),r.find("."+s).removeClass("hide").find(".shipping-method-required-field").prop("required",!0)}).find(".wc-wizard-shipping-method-select .method").change(),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-enable",function(){var i=e(this).is(":checked");e(this).closest(".wc-wizard-service-item").find(".shipping-method-required-field").prop("required",i)}),e(".activate-jetpack").on("click",".button-primary",function(e){if(i(),"no"===wc_setup_params.pending_jetpack_install)return!0;e.preventDefault(),s()}),e(".wc-wizard-services").on("change","input#stripe_create_account, input#ppec_paypal_reroute_requests",function(){e(this).is(":checked")?(e(this).closest(".wc-wizard-service-settings").find("input.payment-email-input").prop("required",!0),e(this).closest(".wc-wizard-service-settings").find(".wc-wizard-service-setting-stripe_email, .wc-wizard-service-setting-ppec_paypal_email").show()):(e(this).closest(".wc-wizard-service-settings").find("input.payment-email-input").prop("required",!1),e(this).closest(".wc-wizard-service-settings").find(".wc-wizard-service-setting-stripe_email, .wc-wizard-service-setting-ppec_paypal_email").hide())}).find("input#stripe_create_account, input#ppec_paypal_reroute_requests").change(),e("select#store_country").on("change",function(){var i=e(this).val();e("select#currency_code").val(wc_setup_currencies[i]).change()})});
|
||||
jQuery(function(e){function i(){e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}function t(){e("form.activate-jetpack").submit()}function s(){wp.ajax.post("setup_wizard_check_jetpack").then(function(e){if(!e||!e.is_active||"yes"===e.is_active)return t();setTimeout(s,3e3)}).fail(function(){t()})}function c(i,t,s){var c=t.data("plugins");for(var n in Array.isArray(c)?c:[]){var a=c[n].slug;i[a]=i[a]||e('<span class="plugin-install-info-list-item">').append('<a href="https://wordpress.org/plugins/'+a+'/" target="_blank">'+c[n].name+"</a>"),i[a].find("a").on("mouseenter mouseleave",function(e,i){e.toggleClass("plugin-install-source","mouseenter"===i.type)}.bind(null,s?t.closest(s):t))}}function n(){var i={};e(".wc-wizard-service-enable input:checked").each(function(){c(i,e(this),".wc-wizard-service-item");var t=e(this).closest(".wc-wizard-service-item");t.find("input.payment-checkbox-input:checked").each(function(){c(i,e(this),".wc-wizard-service-settings")}),t.find(".wc-wizard-shipping-method-select .method").each(function(){var t=e(this);"live_rates"===t.val()&&c(i,t,".wc-wizard-service-item")})}),e(".recommended-item input:checked").each(function(){c(i,e(this),".recommended-item")});var t=e("span.plugin-install-info-list").empty();for(var s in i)t.append(i[s]);e("span.plugin-install-info").toggle(t.children().length>0)}e(".button-next").on("click",function(){var t=e(this).parents("form").get(0);return("function"!=typeof t.checkValidity||t.checkValidity())&&i(),!0}),e("#store_country").on("change",function(){if(null!==wc_setup_params.states){var i=e(this).val(),t=e("#store_state");if(e.isEmptyObject(wc_setup_params.states[i]))e(".store-state-container").hide(),t.empty().val("").change().prop("required",!1);else{var s=wc_setup_params.states[i];t.empty(),e.each(s,function(i){t.append(e('<option value="'+i+'">'+s[i]+"</option>"))}),e(".store-state-container").show(),t.selectWoo().val(wc_base_state).change().prop("required",!0)}e("#currency_code").val(wc_setup_currencies[i]).change()}}),e("#store_country").change(),e(".wc-wizard-services").on("change",".wc-wizard-service-enable input",function(){e(this).is(":checked")?(e(this).closest(".wc-wizard-service-toggle").removeClass("disabled"),e(this).closest(".wc-wizard-service-item").addClass("checked"),e(this).closest(".wc-wizard-service-item").find(".wc-wizard-service-settings").removeClass("hide")):(e(this).closest(".wc-wizard-service-toggle").addClass("disabled"),e(this).closest(".wc-wizard-service-item").removeClass("checked"),e(this).closest(".wc-wizard-service-item").find(".wc-wizard-service-settings").addClass("hide"))}),e(".wc-wizard-services").on("click",".wc-wizard-service-enable",function(i){if(e(i.target).is("input"))i.stopPropagation();else{var t=e(this).find('input[type="checkbox"]');t.prop("checked",!t.prop("checked")).change()}}),e(".wc-wizard-services-list-toggle").on("click",function(){e(this).closest(".wc-wizard-services-list-toggle").toggleClass("closed"),e(this).closest(".wc-wizard-services").find(".wc-wizard-service-item").slideToggle().css("display","flex")}),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-select .method",function(i){var t=e(this).closest(".wc-wizard-service-description"),s=i.target.value,c=t.find(".shipping-method-descriptions");c.find(".shipping-method-description").addClass("hide"),c.find("."+s).removeClass("hide");var n=t.find(".shipping-method-settings");n.find(".shipping-method-setting").addClass("hide").find(".shipping-method-required-field").prop("required",!1),n.find("."+s).removeClass("hide").find(".shipping-method-required-field").prop("required",!0)}).find(".wc-wizard-shipping-method-select .method").change(),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-enable",function(){var i=e(this).is(":checked"),t=e(".wc-wizard-shipping-method-select .method").val();e(this).closest(".wc-wizard-service-item").find("."+t).find(".shipping-method-required-field").prop("required",i)}),e(".activate-jetpack").on("click",".button-primary",function(e){if(i(),"no"===wc_setup_params.pending_jetpack_install)return!0;e.preventDefault(),s()}),e(".wc-wizard-services").on("change","input#stripe_create_account, input#ppec_paypal_reroute_requests",function(){e(this).is(":checked")?(e(this).closest(".wc-wizard-service-settings").find("input.payment-email-input").prop("required",!0),e(this).closest(".wc-wizard-service-settings").find(".wc-wizard-service-setting-stripe_email, .wc-wizard-service-setting-ppec_paypal_email").show()):(e(this).closest(".wc-wizard-service-settings").find("input.payment-email-input").prop("required",!1),e(this).closest(".wc-wizard-service-settings").find(".wc-wizard-service-setting-stripe_email, .wc-wizard-service-setting-ppec_paypal_email").hide())}).find("input#stripe_create_account, input#ppec_paypal_reroute_requests").change(),n(),e(".wc-setup-content").on("change","[data-plugins]",n)});
|
|
@ -1,346 +1,338 @@
|
|||
/* global woocommerce_admin */
|
||||
jQuery( function ( $ ) {
|
||||
|
||||
if ( 'undefined' === typeof woocommerce_admin ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add buttons to product screen.
|
||||
var $product_screen = $( '.edit-php.post-type-product' ),
|
||||
$title_action = $product_screen.find( '.page-title-action:first' ),
|
||||
$blankslate = $product_screen.find( '.woocommerce-BlankState' );
|
||||
|
||||
if ( 0 === $blankslate.length ) {
|
||||
if ( woocommerce_admin.urls.export_products ) {
|
||||
$title_action.after('<a href="' + woocommerce_admin.urls.export_products + '" class="page-title-action">' + woocommerce_admin.strings.export_products + '</a>');
|
||||
( function( $, woocommerce_admin ) {
|
||||
$( function() {
|
||||
if ( 'undefined' === typeof woocommerce_admin ) {
|
||||
return;
|
||||
}
|
||||
if ( woocommerce_admin.urls.import_products ) {
|
||||
$title_action.after( '<a href="' + woocommerce_admin.urls.import_products + '" class="page-title-action">' + woocommerce_admin.strings.import_products + '</a>' );
|
||||
|
||||
// Add buttons to product screen.
|
||||
var $product_screen = $( '.edit-php.post-type-product' ),
|
||||
$title_action = $product_screen.find( '.page-title-action:first' ),
|
||||
$blankslate = $product_screen.find( '.woocommerce-BlankState' );
|
||||
|
||||
if ( 0 === $blankslate.length ) {
|
||||
if ( woocommerce_admin.urls.export_products ) {
|
||||
$title_action.after('<a href="' + woocommerce_admin.urls.export_products + '" class="page-title-action">' + woocommerce_admin.strings.export_products + '</a>');
|
||||
}
|
||||
if ( woocommerce_admin.urls.import_products ) {
|
||||
$title_action.after( '<a href="' + woocommerce_admin.urls.import_products + '" class="page-title-action">' + woocommerce_admin.strings.import_products + '</a>' );
|
||||
}
|
||||
} else {
|
||||
$title_action.hide();
|
||||
}
|
||||
} else {
|
||||
$title_action.hide();
|
||||
}
|
||||
|
||||
// Progress indicators when showing steps.
|
||||
$( '.woocommerce-progress-form-wrapper .button-next' ).on( 'click', function() {
|
||||
$('.wc-progress-form-content').block({
|
||||
message: null,
|
||||
overlayCSS: {
|
||||
background: '#fff',
|
||||
opacity: 0.6
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} );
|
||||
// Progress indicators when showing steps.
|
||||
$( '.woocommerce-progress-form-wrapper .button-next' ).on( 'click', function() {
|
||||
$('.wc-progress-form-content').block({
|
||||
message: null,
|
||||
overlayCSS: {
|
||||
background: '#fff',
|
||||
opacity: 0.6
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} );
|
||||
|
||||
// Field validation error tips
|
||||
$( document.body )
|
||||
// Field validation error tips
|
||||
$( document.body )
|
||||
|
||||
.on( 'wc_add_error_tip', function( e, element, error_type ) {
|
||||
var offset = element.position();
|
||||
.on( 'wc_add_error_tip', function( e, element, error_type ) {
|
||||
var offset = element.position();
|
||||
|
||||
if ( element.parent().find( '.wc_error_tip' ).length === 0 ) {
|
||||
element.after( '<div class="wc_error_tip ' + error_type + '">' + woocommerce_admin[error_type] + '</div>' );
|
||||
element.parent().find( '.wc_error_tip' )
|
||||
.css( 'left', offset.left + element.width() - ( element.width() / 2 ) - ( $( '.wc_error_tip' ).width() / 2 ) )
|
||||
.css( 'top', offset.top + element.height() )
|
||||
.fadeIn( '100' );
|
||||
}
|
||||
})
|
||||
if ( element.parent().find( '.wc_error_tip' ).length === 0 ) {
|
||||
element.after( '<div class="wc_error_tip ' + error_type + '">' + woocommerce_admin[error_type] + '</div>' );
|
||||
element.parent().find( '.wc_error_tip' )
|
||||
.css( 'left', offset.left + element.width() - ( element.width() / 2 ) - ( $( '.wc_error_tip' ).width() / 2 ) )
|
||||
.css( 'top', offset.top + element.height() )
|
||||
.fadeIn( '100' );
|
||||
}
|
||||
})
|
||||
|
||||
.on( 'wc_remove_error_tip', function( e, element, error_type ) {
|
||||
element.parent().find( '.wc_error_tip.' + error_type ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
.on( 'wc_remove_error_tip', function( e, element, error_type ) {
|
||||
element.parent().find( '.wc_error_tip.' + error_type ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
|
||||
.on( 'click', function() {
|
||||
$( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
.on( 'click', function() {
|
||||
$( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
|
||||
.on( 'blur', '.wc_input_decimal[type=text], .wc_input_price[type=text], .wc_input_country_iso[type=text]', function() {
|
||||
$( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
.on( 'blur', '.wc_input_decimal[type=text], .wc_input_price[type=text], .wc_input_country_iso[type=text]', function() {
|
||||
$( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
|
||||
.on( 'change', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc-order-totals #refund_amount[type=text]', function() {
|
||||
var regex;
|
||||
.on( 'change', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc-order-totals #refund_amount[type=text]', function() {
|
||||
var regex;
|
||||
|
||||
if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
|
||||
} else {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
|
||||
}
|
||||
if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
|
||||
} else {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
|
||||
}
|
||||
|
||||
var value = $( this ).val();
|
||||
var newvalue = value.replace( regex, '' );
|
||||
var value = $( this ).val();
|
||||
var newvalue = value.replace( regex, '' );
|
||||
|
||||
if ( value !== newvalue ) {
|
||||
$( this ).val( newvalue );
|
||||
}
|
||||
})
|
||||
if ( value !== newvalue ) {
|
||||
$( this ).val( newvalue );
|
||||
}
|
||||
})
|
||||
|
||||
.on( 'keyup', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc_input_country_iso[type=text], .wc-order-totals #refund_amount[type=text]', function() {
|
||||
var regex, error;
|
||||
.on( 'keyup', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc_input_country_iso[type=text], .wc-order-totals #refund_amount[type=text]', function() {
|
||||
var regex, error;
|
||||
|
||||
if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
|
||||
error = 'i18n_mon_decimal_error';
|
||||
} else if ( $( this ).is( '.wc_input_country_iso' ) ) {
|
||||
regex = new RegExp( '([^A-Z])+|(.){3,}', 'im' );
|
||||
error = 'i18n_country_iso_error';
|
||||
} else {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
|
||||
error = 'i18n_decimal_error';
|
||||
}
|
||||
if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
|
||||
error = 'i18n_mon_decimal_error';
|
||||
} else if ( $( this ).is( '.wc_input_country_iso' ) ) {
|
||||
regex = new RegExp( '([^A-Z])+|(.){3,}', 'im' );
|
||||
error = 'i18n_country_iso_error';
|
||||
} else {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
|
||||
error = 'i18n_decimal_error';
|
||||
}
|
||||
|
||||
var value = $( this ).val();
|
||||
var newvalue = value.replace( regex, '' );
|
||||
var value = $( this ).val();
|
||||
var newvalue = value.replace( regex, '' );
|
||||
|
||||
if ( value !== newvalue ) {
|
||||
$( document.body ).triggerHandler( 'wc_add_error_tip', [ $( this ), error ] );
|
||||
} else {
|
||||
$( document.body ).triggerHandler( 'wc_remove_error_tip', [ $( this ), error ] );
|
||||
}
|
||||
})
|
||||
if ( value !== newvalue ) {
|
||||
$( document.body ).triggerHandler( 'wc_add_error_tip', [ $( this ), error ] );
|
||||
} else {
|
||||
$( document.body ).triggerHandler( 'wc_remove_error_tip', [ $( this ), error ] );
|
||||
}
|
||||
})
|
||||
|
||||
.on( 'change', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
||||
var sale_price_field = $( this ), regular_price_field;
|
||||
.on( 'change', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
||||
var sale_price_field = $( this ), regular_price_field;
|
||||
|
||||
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
||||
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
||||
} else {
|
||||
regular_price_field = $( '#_regular_price' );
|
||||
}
|
||||
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
||||
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
||||
} else {
|
||||
regular_price_field = $( '#_regular_price' );
|
||||
}
|
||||
|
||||
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
|
||||
if ( sale_price >= regular_price ) {
|
||||
$( this ).val( '' );
|
||||
}
|
||||
})
|
||||
if ( sale_price >= regular_price ) {
|
||||
$( this ).val( '' );
|
||||
}
|
||||
})
|
||||
|
||||
.on( 'keyup', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
||||
var sale_price_field = $( this ), regular_price_field;
|
||||
.on( 'keyup', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
||||
var sale_price_field = $( this ), regular_price_field;
|
||||
|
||||
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
||||
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
||||
} else {
|
||||
regular_price_field = $( '#_regular_price' );
|
||||
}
|
||||
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
||||
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
||||
} else {
|
||||
regular_price_field = $( '#_regular_price' );
|
||||
}
|
||||
|
||||
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
|
||||
if ( sale_price >= regular_price ) {
|
||||
$( document.body ).triggerHandler( 'wc_add_error_tip', [ $(this), 'i18_sale_less_than_regular_error' ] );
|
||||
} else {
|
||||
$( document.body ).triggerHandler( 'wc_remove_error_tip', [ $(this), 'i18_sale_less_than_regular_error' ] );
|
||||
}
|
||||
})
|
||||
if ( sale_price >= regular_price ) {
|
||||
$( document.body ).triggerHandler( 'wc_add_error_tip', [ $(this), 'i18_sale_less_than_regular_error' ] );
|
||||
} else {
|
||||
$( document.body ).triggerHandler( 'wc_remove_error_tip', [ $(this), 'i18_sale_less_than_regular_error' ] );
|
||||
}
|
||||
})
|
||||
|
||||
.on( 'init_tooltips', function() {
|
||||
.on( 'init_tooltips', function() {
|
||||
|
||||
$( '.tips, .help_tip, .woocommerce-help-tip' ).tipTip( {
|
||||
'attribute': 'data-tip',
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
} );
|
||||
|
||||
$( '.column-wc_actions .wc-action-button' ).tipTip( {
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
} );
|
||||
|
||||
// Add tiptip to parent element for widefat tables
|
||||
$( '.parent-tips' ).each( function() {
|
||||
$( this ).closest( 'a, th' ).attr( 'data-tip', $( this ).data( 'tip' ) ).tipTip( {
|
||||
$( '.tips, .help_tip, .woocommerce-help-tip' ).tipTip( {
|
||||
'attribute': 'data-tip',
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
} ).css( 'cursor', 'help' );
|
||||
} );
|
||||
|
||||
$( '.column-wc_actions .wc-action-button' ).tipTip( {
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
} );
|
||||
|
||||
// Add tiptip to parent element for widefat tables
|
||||
$( '.parent-tips' ).each( function() {
|
||||
$( this ).closest( 'a, th' ).attr( 'data-tip', $( this ).data( 'tip' ) ).tipTip( {
|
||||
'attribute': 'data-tip',
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
} ).css( 'cursor', 'help' );
|
||||
});
|
||||
});
|
||||
|
||||
// Tooltips
|
||||
$( document.body ).trigger( 'init_tooltips' );
|
||||
|
||||
// wc_input_table tables
|
||||
$( '.wc_input_table.sortable tbody' ).sortable({
|
||||
items: 'tr',
|
||||
cursor: 'move',
|
||||
axis: 'y',
|
||||
scrollSensitivity: 40,
|
||||
forcePlaceholderSize: true,
|
||||
helper: 'clone',
|
||||
opacity: 0.65,
|
||||
placeholder: 'wc-metabox-sortable-placeholder',
|
||||
start: function( event, ui ) {
|
||||
ui.item.css( 'background-color', '#f6f6f6' );
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
ui.item.removeAttr( 'style' );
|
||||
}
|
||||
});
|
||||
// Focus on inputs within the table if clicked instead of trying to sort.
|
||||
$( '.wc_input_table.sortable tbody input' ).on( 'click', function() {
|
||||
$( this ).focus();
|
||||
} );
|
||||
|
||||
$( '.wc_input_table .remove_rows' ).click( function() {
|
||||
var $tbody = $( this ).closest( '.wc_input_table' ).find( 'tbody' );
|
||||
if ( $tbody.find( 'tr.current' ).length > 0 ) {
|
||||
var $current = $tbody.find( 'tr.current' );
|
||||
$current.each( function() {
|
||||
$( this ).remove();
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Tooltips
|
||||
$( document.body ).trigger( 'init_tooltips' );
|
||||
var controlled = false;
|
||||
var shifted = false;
|
||||
var hasFocus = false;
|
||||
|
||||
// wc_input_table tables
|
||||
$( '.wc_input_table.sortable tbody' ).sortable({
|
||||
items: 'tr',
|
||||
cursor: 'move',
|
||||
axis: 'y',
|
||||
scrollSensitivity: 40,
|
||||
forcePlaceholderSize: true,
|
||||
helper: 'clone',
|
||||
opacity: 0.65,
|
||||
placeholder: 'wc-metabox-sortable-placeholder',
|
||||
start: function( event, ui ) {
|
||||
ui.item.css( 'background-color', '#f6f6f6' );
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
ui.item.removeAttr( 'style' );
|
||||
}
|
||||
});
|
||||
// Focus on inputs within the table if clicked instead of trying to sort.
|
||||
$( '.wc_input_table.sortable tbody input' ).on( 'click', function() {
|
||||
$( this ).focus();
|
||||
} );
|
||||
$( document.body ).bind( 'keyup keydown', function( e ) {
|
||||
shifted = e.shiftKey;
|
||||
controlled = e.ctrlKey || e.metaKey;
|
||||
});
|
||||
|
||||
$( '.wc_input_table .remove_rows' ).click( function() {
|
||||
var $tbody = $( this ).closest( '.wc_input_table' ).find( 'tbody' );
|
||||
if ( $tbody.find( 'tr.current' ).length > 0 ) {
|
||||
var $current = $tbody.find( 'tr.current' );
|
||||
$current.each( function() {
|
||||
$( this ).remove();
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$( '.wc_input_table' ).on( 'focus click', 'input', function( e ) {
|
||||
var $this_table = $( this ).closest( 'table, tbody' );
|
||||
var $this_row = $( this ).closest( 'tr' );
|
||||
|
||||
var controlled = false;
|
||||
var shifted = false;
|
||||
var hasFocus = false;
|
||||
if ( ( e.type === 'focus' && hasFocus !== $this_row.index() ) || ( e.type === 'click' && $( this ).is( ':focus' ) ) ) {
|
||||
hasFocus = $this_row.index();
|
||||
|
||||
$( document.body ).bind( 'keyup keydown', function( e ) {
|
||||
shifted = e.shiftKey;
|
||||
controlled = e.ctrlKey || e.metaKey;
|
||||
});
|
||||
if ( ! shifted && ! controlled ) {
|
||||
$( 'tr', $this_table ).removeClass( 'current' ).removeClass( 'last_selected' );
|
||||
$this_row.addClass( 'current' ).addClass( 'last_selected' );
|
||||
} else if ( shifted ) {
|
||||
$( 'tr', $this_table ).removeClass( 'current' );
|
||||
$this_row.addClass( 'selected_now' ).addClass( 'current' );
|
||||
|
||||
$( '.wc_input_table' ).on( 'focus click', 'input', function( e ) {
|
||||
var $this_table = $( this ).closest( 'table, tbody' );
|
||||
var $this_row = $( this ).closest( 'tr' );
|
||||
if ( $( 'tr.last_selected', $this_table ).length > 0 ) {
|
||||
if ( $this_row.index() > $( 'tr.last_selected', $this_table ).index() ) {
|
||||
$( 'tr', $this_table ).slice( $( 'tr.last_selected', $this_table ).index(), $this_row.index() ).addClass( 'current' );
|
||||
} else {
|
||||
$( 'tr', $this_table ).slice( $this_row.index(), $( 'tr.last_selected', $this_table ).index() + 1 ).addClass( 'current' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( e.type === 'focus' && hasFocus !== $this_row.index() ) || ( e.type === 'click' && $( this ).is( ':focus' ) ) ) {
|
||||
hasFocus = $this_row.index();
|
||||
|
||||
if ( ! shifted && ! controlled ) {
|
||||
$( 'tr', $this_table ).removeClass( 'current' ).removeClass( 'last_selected' );
|
||||
$this_row.addClass( 'current' ).addClass( 'last_selected' );
|
||||
} else if ( shifted ) {
|
||||
$( 'tr', $this_table ).removeClass( 'current' );
|
||||
$this_row.addClass( 'selected_now' ).addClass( 'current' );
|
||||
|
||||
if ( $( 'tr.last_selected', $this_table ).length > 0 ) {
|
||||
if ( $this_row.index() > $( 'tr.last_selected', $this_table ).index() ) {
|
||||
$( 'tr', $this_table ).slice( $( 'tr.last_selected', $this_table ).index(), $this_row.index() ).addClass( 'current' );
|
||||
$( 'tr', $this_table ).removeClass( 'last_selected' );
|
||||
$this_row.addClass( 'last_selected' );
|
||||
} else {
|
||||
$( 'tr', $this_table ).removeClass( 'last_selected' );
|
||||
if ( controlled && $( this ).closest( 'tr' ).is( '.current' ) ) {
|
||||
$this_row.removeClass( 'current' );
|
||||
} else {
|
||||
$( 'tr', $this_table ).slice( $this_row.index(), $( 'tr.last_selected', $this_table ).index() + 1 ).addClass( 'current' );
|
||||
$this_row.addClass( 'current' ).addClass( 'last_selected' );
|
||||
}
|
||||
}
|
||||
|
||||
$( 'tr', $this_table ).removeClass( 'last_selected' );
|
||||
$this_row.addClass( 'last_selected' );
|
||||
} else {
|
||||
$( 'tr', $this_table ).removeClass( 'last_selected' );
|
||||
if ( controlled && $( this ).closest( 'tr' ).is( '.current' ) ) {
|
||||
$this_row.removeClass( 'current' );
|
||||
} else {
|
||||
$this_row.addClass( 'current' ).addClass( 'last_selected' );
|
||||
}
|
||||
}
|
||||
|
||||
$( 'tr', $this_table ).removeClass( 'selected_now' );
|
||||
}
|
||||
}).on( 'blur', 'input', function() {
|
||||
hasFocus = false;
|
||||
});
|
||||
|
||||
// Additional cost and Attribute term tables
|
||||
$( '.woocommerce_page_wc-settings .shippingrows tbody tr:even, table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
||||
|
||||
// Show order items on orders page
|
||||
$( document.body ).on( 'click', '.show_order_items', function() {
|
||||
$( this ).closest( 'td' ).find( 'table' ).toggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Select availability
|
||||
$( 'select.availability' ).change( function() {
|
||||
if ( $( this ).val() === 'all' ) {
|
||||
$( this ).closest( 'tr' ).next( 'tr' ).hide();
|
||||
} else {
|
||||
$( this ).closest( 'tr' ).next( 'tr' ).show();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Hidden options
|
||||
$( '.hide_options_if_checked' ).each( function() {
|
||||
$( this ).find( 'input:eq(0)' ).change( function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
|
||||
} else {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
|
||||
}
|
||||
}).change();
|
||||
});
|
||||
|
||||
$( '.show_options_if_checked' ).each( function() {
|
||||
$( this ).find( 'input:eq(0)' ).change( function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
|
||||
} else {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
|
||||
}
|
||||
}).change();
|
||||
});
|
||||
|
||||
// Reviews.
|
||||
$( 'input#woocommerce_enable_reviews' ).change(function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).show();
|
||||
} else {
|
||||
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Attribute term table
|
||||
$( 'table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
||||
|
||||
|
||||
// Toggle gateway on/off.
|
||||
$( '.wc_gateways' ).on( 'click', '.wc-payment-gateway-method-toggle-enabled', function() {
|
||||
var $link = $( this ),
|
||||
$row = $link.closest( 'tr' ),
|
||||
$table = $row.closest( 'div' ),
|
||||
$toggle = $link.find( '.woocommerce-input-toggle' );
|
||||
|
||||
var data = {
|
||||
action: 'woocommerce_toggle_gateway_enabled',
|
||||
security: woocommerce_admin.nonces.gateway_toggle,
|
||||
gateway_id: $row.data( 'gateway_id' )
|
||||
};
|
||||
|
||||
$table.block({
|
||||
message: null,
|
||||
overlayCSS: {
|
||||
background: '#fff',
|
||||
opacity: 0.6
|
||||
$( 'tr', $this_table ).removeClass( 'selected_now' );
|
||||
}
|
||||
}).on( 'blur', 'input', function() {
|
||||
hasFocus = false;
|
||||
});
|
||||
|
||||
$.ajax( {
|
||||
url: woocommerce_admin.ajax_url,
|
||||
data: data,
|
||||
dataType : 'json',
|
||||
type : 'POST',
|
||||
success: function( response ) {
|
||||
if ( true === response.data ) {
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled' );
|
||||
$toggle.addClass( 'woocommerce-input-toggle--enabled' );
|
||||
} else if ( false === response.data ) {
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled' );
|
||||
$toggle.addClass( 'woocommerce-input-toggle--disabled' );
|
||||
} else if ( 'needs_setup' === response.data ) {
|
||||
window.location.href = $link.attr( 'href' );
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$table.unblock();
|
||||
}
|
||||
} );
|
||||
// Additional cost and Attribute term tables
|
||||
$( '.woocommerce_page_wc-settings .shippingrows tbody tr:even, table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
||||
|
||||
return false;
|
||||
// Show order items on orders page
|
||||
$( document.body ).on( 'click', '.show_order_items', function() {
|
||||
$( this ).closest( 'td' ).find( 'table' ).toggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Select availability
|
||||
$( 'select.availability' ).change( function() {
|
||||
if ( $( this ).val() === 'all' ) {
|
||||
$( this ).closest( 'tr' ).next( 'tr' ).hide();
|
||||
} else {
|
||||
$( this ).closest( 'tr' ).next( 'tr' ).show();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Hidden options
|
||||
$( '.hide_options_if_checked' ).each( function() {
|
||||
$( this ).find( 'input:eq(0)' ).change( function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
|
||||
} else {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
|
||||
}
|
||||
}).change();
|
||||
});
|
||||
|
||||
$( '.show_options_if_checked' ).each( function() {
|
||||
$( this ).find( 'input:eq(0)' ).change( function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
|
||||
} else {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
|
||||
}
|
||||
}).change();
|
||||
});
|
||||
|
||||
// Reviews.
|
||||
$( 'input#woocommerce_enable_reviews' ).change(function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).show();
|
||||
} else {
|
||||
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Attribute term table
|
||||
$( 'table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
||||
|
||||
// Toggle gateway on/off.
|
||||
$( '.wc_gateways' ).on( 'click', '.wc-payment-gateway-method-toggle-enabled', function() {
|
||||
var $link = $( this ),
|
||||
$row = $link.closest( 'tr' ),
|
||||
$toggle = $link.find( '.woocommerce-input-toggle' );
|
||||
|
||||
var data = {
|
||||
action: 'woocommerce_toggle_gateway_enabled',
|
||||
security: woocommerce_admin.nonces.gateway_toggle,
|
||||
gateway_id: $row.data( 'gateway_id' )
|
||||
};
|
||||
|
||||
$toggle.addClass( 'woocommerce-input-toggle--loading' );
|
||||
|
||||
$.ajax( {
|
||||
url: woocommerce_admin.ajax_url,
|
||||
data: data,
|
||||
dataType : 'json',
|
||||
type : 'POST',
|
||||
success: function( response ) {
|
||||
if ( true === response.data ) {
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled' );
|
||||
$toggle.addClass( 'woocommerce-input-toggle--enabled' );
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--loading' );
|
||||
} else if ( false === response.data ) {
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled' );
|
||||
$toggle.addClass( 'woocommerce-input-toggle--disabled' );
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--loading' );
|
||||
} else if ( 'needs_setup' === response.data ) {
|
||||
window.location.href = $link.attr( 'href' );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
})( jQuery, woocommerce_admin );
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* jQuery FlexSlider v2.7.0
|
||||
* jQuery FlexSlider v2.7.1
|
||||
* Copyright 2012 WooThemes
|
||||
* Contributing Author: Tyler Smith
|
||||
*/
|
||||
|
@ -15,8 +15,8 @@
|
|||
// making variables public
|
||||
|
||||
//if rtl value was not passed and html is in rtl..enable it by default.
|
||||
if(typeof options.rtl=='undefined' && $('html').attr('dir')=='rtl'){
|
||||
options.rtl=true;
|
||||
if(typeof options.rtl=='undefined' && $('html').attr('dir')=='rtl'){
|
||||
options.rtl=true;
|
||||
}
|
||||
slider.vars = $.extend({}, $.flexslider.defaults, options);
|
||||
|
||||
|
@ -75,6 +75,7 @@
|
|||
}
|
||||
return false;
|
||||
}());
|
||||
slider.isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
slider.ensureAnimationEnd = '';
|
||||
// CONTROLSCONTAINER:
|
||||
if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
|
||||
|
@ -176,14 +177,14 @@
|
|||
e.preventDefault();
|
||||
var $slide = $(this),
|
||||
target = $slide.index();
|
||||
var posFromX;
|
||||
var posFromX;
|
||||
if(slider.vars.rtl){
|
||||
posFromX = -1*($slide.offset().right - $(slider).scrollLeft()); // Find position of slide relative to right of slider container
|
||||
}
|
||||
else
|
||||
{
|
||||
posFromX = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
|
||||
}
|
||||
posFromX = -1*($slide.offset().right - $(slider).scrollLeft()); // Find position of slide relative to right of slider container
|
||||
}
|
||||
else
|
||||
{
|
||||
posFromX = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
|
||||
}
|
||||
if( posFromX <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) {
|
||||
slider.flexAnimate(slider.getTarget("prev"), true);
|
||||
} else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
|
||||
|
@ -894,7 +895,7 @@
|
|||
}());
|
||||
|
||||
if (slider.transitions) {
|
||||
target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + ((slider.vars.rtl?-1:1)*parseInt(target)+'px') + ",0,0)";
|
||||
target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + (parseInt(target)+'px') + ",0,0)";
|
||||
dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
|
||||
slider.container.css("-" + slider.pfx + "-transition-duration", dur);
|
||||
slider.container.css("transition-duration", dur);
|
||||
|
@ -950,7 +951,7 @@
|
|||
setTimeout(function(){
|
||||
slider.doMath();
|
||||
if(slider.vars.rtl){
|
||||
slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
|
||||
slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "right", "display": "block"});
|
||||
}
|
||||
else{
|
||||
slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
|
||||
|
@ -996,6 +997,7 @@
|
|||
maxItems = slider.vars.maxItems;
|
||||
|
||||
slider.w = (slider.viewport===undefined) ? slider.width() : slider.viewport.width();
|
||||
if (slider.isFirefox) { slider.w = slider.width(); }
|
||||
slider.h = slide.height();
|
||||
slider.boxPadding = slide.outerWidth() - slide.width();
|
||||
|
||||
|
@ -1139,7 +1141,7 @@
|
|||
// Usability features
|
||||
pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
|
||||
pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
|
||||
pauseInvisible: true, //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
|
||||
pauseInvisible: true, //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
|
||||
useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available
|
||||
touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
|
||||
video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
|
||||
|
@ -1173,6 +1175,9 @@
|
|||
move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
|
||||
allowOneSlide: true, //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide
|
||||
|
||||
// Browser Specific
|
||||
isFirefox: false, // {NEW} Boolean: Set to true when Firefox is the browser used.
|
||||
|
||||
// Callback API
|
||||
start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
|
||||
before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
|
||||
|
@ -1181,7 +1186,7 @@
|
|||
added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
|
||||
removed: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is removed
|
||||
init: function() {}, //{NEW} Callback: function(slider) - Fires after the slider is initially setup
|
||||
rtl: false //{NEW} Boolean: Whether or not to enable RTL mode
|
||||
rtl: false //{NEW} Boolean: Whether or not to enable RTL mode
|
||||
};
|
||||
|
||||
//FlexSlider: Plugin Function
|
||||
|
|
|
@ -538,7 +538,7 @@
|
|||
$product = $form.closest( '.product' ),
|
||||
$product_gallery = $product.find( '.images' ),
|
||||
reset_slide_position = false,
|
||||
new_image_id = ( variation && variation.image_id ) ? variation.image_id : '';
|
||||
new_image_id = ( variation && variation.image_id ) ? variation.image_id : '';
|
||||
|
||||
if ( $form.attr( 'current-image' ) !== new_image_id ) {
|
||||
reset_slide_position = true;
|
||||
|
@ -565,27 +565,41 @@
|
|||
$product_link = $product_img_wrap.find( 'a' ).eq( 0 );
|
||||
|
||||
if ( variation && variation.image && variation.image.src && variation.image.src.length > 1 ) {
|
||||
if ( $gallery_nav.find( 'li img[src="' + variation.image.gallery_thumbnail_src + '"]' ).length > 0 ) {
|
||||
// See if the gallery has an image with the same original src as the image we want to switch to.
|
||||
var galleryHasImage = $gallery_nav.find( 'li img[data-o_src="' + variation.image.gallery_thumbnail_src + '"]' ).length > 0;
|
||||
|
||||
// If the gallery has the image, reset the images. We'll scroll to the correct one.
|
||||
if ( galleryHasImage ) {
|
||||
$form.wc_variations_image_reset();
|
||||
$gallery_nav.find( 'li img[src="' + variation.image.gallery_thumbnail_src + '"]' ).trigger( 'click' );
|
||||
$form.attr( 'current-image', variation.image_id );
|
||||
return;
|
||||
} else {
|
||||
$product_img.wc_set_variation_attr( 'src', variation.image.src );
|
||||
$product_img.wc_set_variation_attr( 'height', variation.image.src_h );
|
||||
$product_img.wc_set_variation_attr( 'width', variation.image.src_w );
|
||||
$product_img.wc_set_variation_attr( 'srcset', variation.image.srcset );
|
||||
$product_img.wc_set_variation_attr( 'sizes', variation.image.sizes );
|
||||
$product_img.wc_set_variation_attr( 'title', variation.image.title );
|
||||
$product_img.wc_set_variation_attr( 'alt', variation.image.alt );
|
||||
$product_img.wc_set_variation_attr( 'data-src', variation.image.full_src );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image', variation.image.full_src );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image_width', variation.image.full_src_w );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image_height', variation.image.full_src_h );
|
||||
$product_img_wrap.wc_set_variation_attr( 'data-thumb', variation.image.src );
|
||||
$gallery_img.wc_set_variation_attr( 'src', variation.image.gallery_thumbnail_src );
|
||||
$product_link.wc_set_variation_attr( 'href', variation.image.full_src );
|
||||
}
|
||||
|
||||
// See if gallery has a matching image we can slide to.
|
||||
var slideToImage = $gallery_nav.find( 'li img[src="' + variation.image.gallery_thumbnail_src + '"]' );
|
||||
|
||||
if ( slideToImage.length > 0 ) {
|
||||
slideToImage.trigger( 'click' );
|
||||
$form.attr( 'current-image', variation.image_id );
|
||||
window.setTimeout( function() {
|
||||
$( window ).trigger( 'resize' );
|
||||
$product_gallery.trigger( 'woocommerce_gallery_init_zoom' );
|
||||
}, 20 );
|
||||
return;
|
||||
}
|
||||
|
||||
$product_img.wc_set_variation_attr( 'src', variation.image.src );
|
||||
$product_img.wc_set_variation_attr( 'height', variation.image.src_h );
|
||||
$product_img.wc_set_variation_attr( 'width', variation.image.src_w );
|
||||
$product_img.wc_set_variation_attr( 'srcset', variation.image.srcset );
|
||||
$product_img.wc_set_variation_attr( 'sizes', variation.image.sizes );
|
||||
$product_img.wc_set_variation_attr( 'title', variation.image.title );
|
||||
$product_img.wc_set_variation_attr( 'alt', variation.image.alt );
|
||||
$product_img.wc_set_variation_attr( 'data-src', variation.image.full_src );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image', variation.image.full_src );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image_width', variation.image.full_src_w );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image_height', variation.image.full_src_h );
|
||||
$product_img_wrap.wc_set_variation_attr( 'data-thumb', variation.image.src );
|
||||
$gallery_img.wc_set_variation_attr( 'src', variation.image.gallery_thumbnail_src );
|
||||
$product_link.wc_set_variation_attr( 'href', variation.image.full_src );
|
||||
} else {
|
||||
$form.wc_variations_image_reset();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ jQuery( function( $ ) {
|
|||
field.find( 'label .required' ).remove();
|
||||
field.removeClass( 'validate-required' );
|
||||
|
||||
if ( field.find( 'label .required' ).length === 0 ) {
|
||||
if ( field.find( 'label .optional' ).length === 0 ) {
|
||||
field.find( 'label' ).append( ' <span class="optional">(' + wc_address_i18n_params.i18n_optional_text + ')</span>' );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(e){function a(e,a){a?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append(' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>')):(e.find("label .required").remove(),e.removeClass("validate-required"),0===e.find("label .required").length&&e.find("label").append(' <span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}if("undefined"==typeof wc_address_i18n_params)return!1;var i=wc_address_i18n_params.locale.replace(/"/g,'"'),d=e.parseJSON(i);e(document.body).bind("country_to_state_changing",function(i,t,r){var l,n=r;l="undefined"!=typeof d[t]?d[t]:d["default"];var o=n.find("#billing_postcode_field, #shipping_postcode_field"),s=n.find("#billing_city_field, #shipping_city_field"),p=n.find("#billing_state_field, #shipping_state_field");o.attr("data-o_class")||(o.attr("data-o_class",o.attr("class")),s.attr("data-o_class",s.attr("class")),p.attr("data-o_class",p.attr("class")));var f=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(f,function(i,t){var r=n.find(t),o=e.extend(!0,{},d["default"][i],l[i]);"undefined"!=typeof o.label&&r.find("label").html(o.label),"undefined"!=typeof o.placeholder&&(r.find("input").attr("placeholder",o.placeholder),r.find(".select2-selection__placeholder").text(o.placeholder)),"undefined"!=typeof o.placeholder||"undefined"==typeof o.label||r.find("label").length||(r.find("input").attr("placeholder",o.label),r.find(".select2-selection__placeholder").text(o.label)),"undefined"!=typeof o.required?a(r,o.required):a(r,!1),"undefined"!=typeof o.priority&&r.data("priority",o.priority),"state"!==i&&("undefined"!=typeof o.hidden&&!0===o.hidden?r.hide().find("input").val(""):r.show())}),e(".woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper, .woocommerce-address-fields__field-wrapper, .woocommerce-additional-fields__field-wrapper .woocommerce-account-fields").each(function(a,i){var d=e(i).find(".form-row"),t=d.first().parent(),r=0;d.each(function(){e(this).data("priority")||e(this).data("priority",r+1),r=e(this).data("priority")}),d.sort(function(a,i){var d=e(a).data("priority"),t=e(i).data("priority");return d>t?1:d<t?-1:0}),d.detach().appendTo(t)})})});
|
||||
jQuery(function(e){function a(e,a){a?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append(' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>')):(e.find("label .required").remove(),e.removeClass("validate-required"),0===e.find("label .optional").length&&e.find("label").append(' <span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}if("undefined"==typeof wc_address_i18n_params)return!1;var i=wc_address_i18n_params.locale.replace(/"/g,'"'),d=e.parseJSON(i);e(document.body).bind("country_to_state_changing",function(i,t,l){var r,n=l;r="undefined"!=typeof d[t]?d[t]:d["default"];var o=n.find("#billing_postcode_field, #shipping_postcode_field"),s=n.find("#billing_city_field, #shipping_city_field"),p=n.find("#billing_state_field, #shipping_state_field");o.attr("data-o_class")||(o.attr("data-o_class",o.attr("class")),s.attr("data-o_class",s.attr("class")),p.attr("data-o_class",p.attr("class")));var f=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(f,function(i,t){var l=n.find(t),o=e.extend(!0,{},d["default"][i],r[i]);"undefined"!=typeof o.label&&l.find("label").html(o.label),"undefined"!=typeof o.placeholder&&(l.find("input").attr("placeholder",o.placeholder),l.find(".select2-selection__placeholder").text(o.placeholder)),"undefined"!=typeof o.placeholder||"undefined"==typeof o.label||l.find("label").length||(l.find("input").attr("placeholder",o.label),l.find(".select2-selection__placeholder").text(o.label)),"undefined"!=typeof o.required?a(l,o.required):a(l,!1),"undefined"!=typeof o.priority&&l.data("priority",o.priority),"state"!==i&&("undefined"!=typeof o.hidden&&!0===o.hidden?l.hide().find("input").val(""):l.show())}),e(".woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper, .woocommerce-address-fields__field-wrapper, .woocommerce-additional-fields__field-wrapper .woocommerce-account-fields").each(function(a,i){var d=e(i).find(".form-row"),t=d.first().parent(),l=0;d.each(function(){e(this).data("priority")||e(this).data("priority",l+1),l=e(this).data("priority")}),d.sort(function(a,i){var d=e(a).data("priority"),t=e(i).data("priority");return d>t?1:d<t?-1:0}),d.detach().appendTo(t)})})});
|
|
@ -366,8 +366,18 @@ jQuery( function( $ ) {
|
|||
|
||||
// Catch the enter key and don't let it submit the form.
|
||||
if ( 13 === evt.keyCode ) {
|
||||
evt.preventDefault();
|
||||
this.cart_submit( evt );
|
||||
var $form = $( evt.currentTarget ).parents( 'form' );
|
||||
|
||||
try {
|
||||
// If there are no validation errors, handle the submit.
|
||||
if ( $form[0].checkValidity() ) {
|
||||
evt.preventDefault();
|
||||
this.cart_submit( evt );
|
||||
}
|
||||
} catch( err ) {
|
||||
evt.preventDefault();
|
||||
this.cart_submit( evt );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -77,6 +77,12 @@ jQuery( function( $ ) {
|
|||
$payment_methods.eq(0).prop( 'checked', true );
|
||||
}
|
||||
|
||||
if ( $payment_methods.length > 1 ) {
|
||||
|
||||
// Hide open descriptions.
|
||||
$( 'div.payment_box' ).filter( ':visible' ).slideUp( 0 );
|
||||
}
|
||||
|
||||
// Trigger click event for selected method
|
||||
$payment_methods.filter( ':checked' ).eq(0).trigger( 'click' );
|
||||
},
|
||||
|
@ -85,13 +91,14 @@ jQuery( function( $ ) {
|
|||
},
|
||||
payment_method_selected: function() {
|
||||
if ( $( '.payment_methods input.input-radio' ).length > 1 ) {
|
||||
var target_payment_box = $( 'div.payment_box.' + $( this ).attr( 'ID' ) );
|
||||
var target_payment_box = $( 'div.payment_box.' + $( this ).attr( 'ID' ) ),
|
||||
is_checked = $( this ).is( ':checked' );
|
||||
|
||||
if ( $( this ).is( ':checked' ) && ! target_payment_box.is( ':visible' ) ) {
|
||||
$( 'div.payment_box' ).filter( ':visible' ).slideUp( 250 );
|
||||
if ( is_checked && ! target_payment_box.is( ':visible' ) ) {
|
||||
$( 'div.payment_box' ).filter( ':visible' ).slideUp( 230 );
|
||||
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( 'div.payment_box.' + $( this ).attr( 'ID' ) ).slideDown( 250 );
|
||||
if ( is_checked ) {
|
||||
target_payment_box.slideDown( 230 );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -333,7 +340,7 @@ jQuery( function( $ ) {
|
|||
|
||||
// Save payment details to a temporary object
|
||||
var paymentDetails = {};
|
||||
$( '.payment_box input' ).each( function() {
|
||||
$( '.payment_box :input' ).each( function() {
|
||||
var ID = $( this ).attr( 'id' );
|
||||
|
||||
if ( ID ) {
|
||||
|
@ -360,7 +367,7 @@ jQuery( function( $ ) {
|
|||
|
||||
// Fill in the payment details if possible without overwriting data if set.
|
||||
if ( ! $.isEmptyObject( paymentDetails ) ) {
|
||||
$( '.payment_box input' ).each( function() {
|
||||
$( '.payment_box :input' ).each( function() {
|
||||
var ID = $( this ).attr( 'id' );
|
||||
|
||||
if ( ID ) {
|
||||
|
|
|
@ -89,7 +89,7 @@ jQuery( function( $ ) {
|
|||
|
||||
var country = $( this ).val(),
|
||||
$statebox = $wrapper.find( '#billing_state, #shipping_state, #calc_shipping_state' ),
|
||||
$parent = $statebox.parent(),
|
||||
$parent = $statebox.closest( 'p.form-row' ),
|
||||
input_name = $statebox.attr( 'name' ),
|
||||
input_id = $statebox.attr( 'id' ),
|
||||
value = $statebox.val(),
|
||||
|
@ -98,7 +98,7 @@ jQuery( function( $ ) {
|
|||
if ( states[ country ] ) {
|
||||
if ( $.isEmptyObject( states[ country ] ) ) {
|
||||
|
||||
$statebox.parent().hide().find( '.select2-container' ).remove();
|
||||
$statebox.closest( 'p.form-row' ).hide().find( '.select2-container' ).remove();
|
||||
$statebox.replaceWith( '<input type="hidden" class="hidden" name="' + input_name + '" id="' + input_id + '" value="" placeholder="' + placeholder + '" />' );
|
||||
|
||||
$( document.body ).trigger( 'country_to_state_changed', [ country, $wrapper ] );
|
||||
|
@ -114,7 +114,7 @@ jQuery( function( $ ) {
|
|||
}
|
||||
}
|
||||
|
||||
$statebox.parent().show();
|
||||
$statebox.closest( 'p.form-row' ).show();
|
||||
|
||||
if ( $statebox.is( 'input' ) ) {
|
||||
// Change for select
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(t){function e(){return{language:{errorLoading:function(){return wc_country_select_params.i18n_searching},inputTooLong:function(t){var e=t.input.length-t.maximum;return 1===e?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",e)},inputTooShort:function(t){var e=t.minimum-t.input.length;return 1===e?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",e)},loadingMore:function(){return wc_country_select_params.i18n_load_more},maximumSelected:function(t){return 1===t.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",t.maximum)},noResults:function(){return wc_country_select_params.i18n_no_matches},searching:function(){return wc_country_select_params.i18n_searching}}}}if("undefined"==typeof wc_country_select_params)return!1;if(t().selectWoo){var n=function(){t("select.country_select:visible, select.state_select:visible").each(function(){var n=t.extend({placeholderOption:"first",width:"100%"},e());t(this).selectWoo(n),t(this).on("select2:select",function(){t(this).focus()})})};n(),t(document.body).bind("country_to_state_changed",function(){n()})}var o=wc_country_select_params.countries.replace(/"/g,'"'),c=t.parseJSON(o);t(document.body).on("change","select.country_to_state, input.country_to_state",function(){var e=t(this).closest(".woocommerce-billing-fields, .woocommerce-shipping-fields, .woocommerce-shipping-calculator");e.length||(e=t(this).closest(".form-row").parent());var n=t(this).val(),o=e.find("#billing_state, #shipping_state, #calc_shipping_state"),i=o.parent(),a=o.attr("name"),r=o.attr("id"),s=o.val(),_=o.attr("placeholder")||o.attr("data-placeholder")||"";if(c[n])if(t.isEmptyObject(c[n]))o.parent().hide().find(".select2-container").remove(),o.replaceWith('<input type="hidden" class="hidden" name="'+a+'" id="'+r+'" value="" placeholder="'+_+'" />'),t(document.body).trigger("country_to_state_changed",[n,e]);else{var l="",u=c[n];for(var p in u)u.hasOwnProperty(p)&&(l=l+'<option value="'+p+'">'+u[p]+"</option>");o.parent().show(),o.is("input")&&(o.replaceWith('<select name="'+a+'" id="'+r+'" class="state_select" data-placeholder="'+_+'"></select>'),o=e.find("#billing_state, #shipping_state, #calc_shipping_state")),o.html('<option value="">'+wc_country_select_params.i18n_select_state_text+"</option>"+l),o.val(s).change(),t(document.body).trigger("country_to_state_changed",[n,e])}else o.is("select")?(i.show().find(".select2-container").remove(),o.replaceWith('<input type="text" class="input-text" name="'+a+'" id="'+r+'" placeholder="'+_+'" />'),t(document.body).trigger("country_to_state_changed",[n,e])):o.is('input[type="hidden"]')&&(i.show().find(".select2-container").remove(),o.replaceWith('<input type="text" class="input-text" name="'+a+'" id="'+r+'" placeholder="'+_+'" />'),t(document.body).trigger("country_to_state_changed",[n,e]));t(document.body).trigger("country_to_state_changing",[n,e])}),t(function(){t(":input.country_to_state").change()})});
|
||||
jQuery(function(t){function e(){return{language:{errorLoading:function(){return wc_country_select_params.i18n_searching},inputTooLong:function(t){var e=t.input.length-t.maximum;return 1===e?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",e)},inputTooShort:function(t){var e=t.minimum-t.input.length;return 1===e?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",e)},loadingMore:function(){return wc_country_select_params.i18n_load_more},maximumSelected:function(t){return 1===t.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",t.maximum)},noResults:function(){return wc_country_select_params.i18n_no_matches},searching:function(){return wc_country_select_params.i18n_searching}}}}if("undefined"==typeof wc_country_select_params)return!1;if(t().selectWoo){var n=function(){t("select.country_select:visible, select.state_select:visible").each(function(){var n=t.extend({placeholderOption:"first",width:"100%"},e());t(this).selectWoo(n),t(this).on("select2:select",function(){t(this).focus()})})};n(),t(document.body).bind("country_to_state_changed",function(){n()})}var o=wc_country_select_params.countries.replace(/"/g,'"'),c=t.parseJSON(o);t(document.body).on("change","select.country_to_state, input.country_to_state",function(){var e=t(this).closest(".woocommerce-billing-fields, .woocommerce-shipping-fields, .woocommerce-shipping-calculator");e.length||(e=t(this).closest(".form-row").parent());var n=t(this).val(),o=e.find("#billing_state, #shipping_state, #calc_shipping_state"),i=o.closest("p.form-row"),r=o.attr("name"),a=o.attr("id"),s=o.val(),_=o.attr("placeholder")||o.attr("data-placeholder")||"";if(c[n])if(t.isEmptyObject(c[n]))o.closest("p.form-row").hide().find(".select2-container").remove(),o.replaceWith('<input type="hidden" class="hidden" name="'+r+'" id="'+a+'" value="" placeholder="'+_+'" />'),t(document.body).trigger("country_to_state_changed",[n,e]);else{var l="",u=c[n];for(var p in u)u.hasOwnProperty(p)&&(l=l+'<option value="'+p+'">'+u[p]+"</option>");o.closest("p.form-row").show(),o.is("input")&&(o.replaceWith('<select name="'+r+'" id="'+a+'" class="state_select" data-placeholder="'+_+'"></select>'),o=e.find("#billing_state, #shipping_state, #calc_shipping_state")),o.html('<option value="">'+wc_country_select_params.i18n_select_state_text+"</option>"+l),o.val(s).change(),t(document.body).trigger("country_to_state_changed",[n,e])}else o.is("select")?(i.show().find(".select2-container").remove(),o.replaceWith('<input type="text" class="input-text" name="'+r+'" id="'+a+'" placeholder="'+_+'" />'),t(document.body).trigger("country_to_state_changed",[n,e])):o.is('input[type="hidden"]')&&(i.show().find(".select2-container").remove(),o.replaceWith('<input type="text" class="input-text" name="'+r+'" id="'+a+'" placeholder="'+_+'" />'),t(document.body).trigger("country_to_state_changed",[n,e]));t(document.body).trigger("country_to_state_changing",[n,e])}),t(function(){t(":input.country_to_state").change()})});
|
|
@ -56,8 +56,9 @@ jQuery( function( $ ) {
|
|||
$( 'form' ).each( function() {
|
||||
var $this = $( this );
|
||||
var method = $this.attr( 'method' );
|
||||
var hasField = $this.find('input[name="v"]').length > 0;
|
||||
|
||||
if ( method && 'get' === method.toLowerCase() ) {
|
||||
if ( method && 'get' === method.toLowerCase() && !hasField ) {
|
||||
$this.append( '<input type="hidden" name="v" value="' + wc_geolocation_params.hash + '" />' );
|
||||
} else {
|
||||
var href = $this.attr( 'action' );
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(a){var o=window.location.toString(),t=function(){wc_geolocation_params.hash&&a('a[href^="'+wc_geolocation_params.home_url+'"]:not(a[href*="v="]), a[href^="/"]:not(a[href*="v="])').each(function(){var o=a(this),t=o.attr("href"),e=t.split("#");t=(t=e[0]).indexOf("?")>0?t+"&v="+wc_geolocation_params.hash:t+"?v="+wc_geolocation_params.hash,"undefined"!=typeof e[1]&&null!==e[1]&&(t=t+"#"+e[1]),o.attr("href",t)})},e=function(a){o=o.indexOf("?v=")>0||o.indexOf("&v=")>0?o.replace(/v=[^&]+/,"v="+a):o.indexOf("?")>0?o+"&v="+a:o+"?v="+a,window.location=o},n={url:wc_geolocation_params.wc_ajax_url.toString().replace("%%endpoint%%","get_customer_location"),type:"GET",success:function(a){a.success&&a.data.hash&&a.data.hash!==wc_geolocation_params.hash&&e(a.data.hash)}};"1"===wc_geolocation_params.is_available&&(a.ajax(n),a("form").each(function(){var o=a(this),t=o.attr("method");if(t&&"get"===t.toLowerCase())o.append('<input type="hidden" name="v" value="'+wc_geolocation_params.hash+'" />');else{var e=o.attr("action");e&&(e.indexOf("?")>0?o.attr("action",e+"&v="+wc_geolocation_params.hash):o.attr("action",e+"?v="+wc_geolocation_params.hash))}}),t()),a(document.body).on("added_to_cart",function(){t()})});
|
||||
jQuery(function(a){var o=window.location.toString(),t=function(){wc_geolocation_params.hash&&a('a[href^="'+wc_geolocation_params.home_url+'"]:not(a[href*="v="]), a[href^="/"]:not(a[href*="v="])').each(function(){var o=a(this),t=o.attr("href"),n=t.split("#");t=(t=n[0]).indexOf("?")>0?t+"&v="+wc_geolocation_params.hash:t+"?v="+wc_geolocation_params.hash,"undefined"!=typeof n[1]&&null!==n[1]&&(t=t+"#"+n[1]),o.attr("href",t)})},n=function(a){o=o.indexOf("?v=")>0||o.indexOf("&v=")>0?o.replace(/v=[^&]+/,"v="+a):o.indexOf("?")>0?o+"&v="+a:o+"?v="+a,window.location=o},e={url:wc_geolocation_params.wc_ajax_url.toString().replace("%%endpoint%%","get_customer_location"),type:"GET",success:function(a){a.success&&a.data.hash&&a.data.hash!==wc_geolocation_params.hash&&n(a.data.hash)}};"1"===wc_geolocation_params.is_available&&(a.ajax(e),a("form").each(function(){var o=a(this),t=o.attr("method"),n=o.find('input[name="v"]').length>0;if(t&&"get"===t.toLowerCase()&&!n)o.append('<input type="hidden" name="v" value="'+wc_geolocation_params.hash+'" />');else{var e=o.attr("action");e&&(e.indexOf("?")>0?o.attr("action",e+"&v="+wc_geolocation_params.hash):o.attr("action",e+"?v="+wc_geolocation_params.hash))}}),t()),a(document.body).on("added_to_cart",function(){t()})});
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
strength = wc_password_strength_meter.checkPasswordStrength( wrapper, field );
|
||||
|
||||
if ( fieldValue.length > 0 && strength < wc_password_strength_meter_params.min_password_strength && ! wrapper.is( 'form.checkout' ) ) {
|
||||
if ( fieldValue.length > 0 && strength < wc_password_strength_meter_params.min_password_strength && ! wrapper.is( 'form.checkout' ) && -1 !== strength ) {
|
||||
submit.attr( 'disabled', 'disabled' ).addClass( 'disabled' );
|
||||
} else {
|
||||
submit.removeAttr( 'disabled', 'disabled' ).removeClass( 'disabled' );
|
||||
|
@ -46,11 +46,14 @@
|
|||
var meter = wrapper.find( '.woocommerce-password-strength' );
|
||||
|
||||
if ( '' === field.val() ) {
|
||||
meter.remove();
|
||||
$( document.body ).trigger( 'wc-password-strength-removed' );
|
||||
meter.hide();
|
||||
$( document.body ).trigger( 'wc-password-strength-hide' );
|
||||
} else if ( 0 === meter.length ) {
|
||||
field.after( '<div class="woocommerce-password-strength" aria-live="polite"></div>' );
|
||||
$( document.body ).trigger( 'wc-password-strength-added' );
|
||||
} else {
|
||||
meter.show();
|
||||
$( document.body ).trigger( 'wc-password-strength-show' );
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -62,16 +65,20 @@
|
|||
* @return {Int}
|
||||
*/
|
||||
checkPasswordStrength: function( wrapper, field ) {
|
||||
var meter = wrapper.find( '.woocommerce-password-strength' );
|
||||
var hint = wrapper.find( '.woocommerce-password-hint' );
|
||||
var hint_html = '<small class="woocommerce-password-hint">' + wc_password_strength_meter_params.i18n_password_hint + '</small>';
|
||||
var strength = wp.passwordStrength.meter( field.val(), wp.passwordStrength.userInputBlacklist() );
|
||||
var error = '';
|
||||
var meter = wrapper.find( '.woocommerce-password-strength' ),
|
||||
hint = wrapper.find( '.woocommerce-password-hint' ),
|
||||
hint_html = '<small class="woocommerce-password-hint">' + wc_password_strength_meter_params.i18n_password_hint + '</small>',
|
||||
strength = wp.passwordStrength.meter( field.val(), wp.passwordStrength.userInputBlacklist() ),
|
||||
error = '';
|
||||
|
||||
// Reset
|
||||
// Reset.
|
||||
meter.removeClass( 'short bad good strong' );
|
||||
hint.remove();
|
||||
|
||||
if ( meter.is( ':hidden' ) ) {
|
||||
return strength;
|
||||
}
|
||||
|
||||
// Error to append
|
||||
if ( strength < wc_password_strength_meter_params.min_password_strength ) {
|
||||
error = ' - ' + wc_password_strength_meter_params.i18n_password_error;
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(s){"use strict";var r={init:function(){s(document.body).on("keyup change","form.register #reg_password, form.checkout #account_password, form.edit-account #password_1, form.lost_reset_password #password_1",this.strengthMeter),s("form.checkout #createaccount").change()},strengthMeter:function(){var e=s("form.register, form.checkout, form.edit-account, form.lost_reset_password"),t=s('button[type="submit"]',e),o=s("#reg_password, #account_password, #password_1",e),a=1,d=o.val();r.includeMeter(e,o),a=r.checkPasswordStrength(e,o),d.length>0&&a<wc_password_strength_meter_params.min_password_strength&&!e.is("form.checkout")?t.attr("disabled","disabled").addClass("disabled"):t.removeAttr("disabled","disabled").removeClass("disabled")},includeMeter:function(r,e){var t=r.find(".woocommerce-password-strength");""===e.val()?(t.remove(),s(document.body).trigger("wc-password-strength-removed")):0===t.length&&(e.after('<div class="woocommerce-password-strength" aria-live="polite"></div>'),s(document.body).trigger("wc-password-strength-added"))},checkPasswordStrength:function(s,r){var e=s.find(".woocommerce-password-strength"),t=s.find(".woocommerce-password-hint"),o='<small class="woocommerce-password-hint">'+wc_password_strength_meter_params.i18n_password_hint+"</small>",a=wp.passwordStrength.meter(r.val(),wp.passwordStrength.userInputBlacklist()),d="";switch(e.removeClass("short bad good strong"),t.remove(),a<wc_password_strength_meter_params.min_password_strength&&(d=" - "+wc_password_strength_meter_params.i18n_password_error),a){case 0:e.addClass("short").html(pwsL10n["short"]+d),e.after(o);break;case 1:case 2:e.addClass("bad").html(pwsL10n.bad+d),e.after(o);break;case 3:e.addClass("good").html(pwsL10n.good+d);break;case 4:e.addClass("strong").html(pwsL10n.strong+d);break;case 5:e.addClass("short").html(pwsL10n.mismatch)}return a}};r.init()}(jQuery);
|
||||
!function(s){"use strict";var r={init:function(){s(document.body).on("keyup change","form.register #reg_password, form.checkout #account_password, form.edit-account #password_1, form.lost_reset_password #password_1",this.strengthMeter),s("form.checkout #createaccount").change()},strengthMeter:function(){var e=s("form.register, form.checkout, form.edit-account, form.lost_reset_password"),t=s('button[type="submit"]',e),o=s("#reg_password, #account_password, #password_1",e),a=1,d=o.val();r.includeMeter(e,o),a=r.checkPasswordStrength(e,o),d.length>0&&a<wc_password_strength_meter_params.min_password_strength&&!e.is("form.checkout")&&-1!==a?t.attr("disabled","disabled").addClass("disabled"):t.removeAttr("disabled","disabled").removeClass("disabled")},includeMeter:function(r,e){var t=r.find(".woocommerce-password-strength");""===e.val()?(t.hide(),s(document.body).trigger("wc-password-strength-hide")):0===t.length?(e.after('<div class="woocommerce-password-strength" aria-live="polite"></div>'),s(document.body).trigger("wc-password-strength-added")):(t.show(),s(document.body).trigger("wc-password-strength-show"))},checkPasswordStrength:function(s,r){var e=s.find(".woocommerce-password-strength"),t=s.find(".woocommerce-password-hint"),o='<small class="woocommerce-password-hint">'+wc_password_strength_meter_params.i18n_password_hint+"</small>",a=wp.passwordStrength.meter(r.val(),wp.passwordStrength.userInputBlacklist()),d="";if(e.removeClass("short bad good strong"),t.remove(),e.is(":hidden"))return a;switch(a<wc_password_strength_meter_params.min_password_strength&&(d=" - "+wc_password_strength_meter_params.i18n_password_error),a){case 0:e.addClass("short").html(pwsL10n["short"]+d),e.after(o);break;case 1:case 2:e.addClass("bad").html(pwsL10n.bad+d),e.after(o);break;case 3:e.addClass("good").html(pwsL10n.good+d);break;case 4:e.addClass("strong").html(pwsL10n.strong+d);break;case 5:e.addClass("short").html(pwsL10n.mismatch)}return a}};r.init()}(jQuery);
|
|
@ -204,7 +204,7 @@ jQuery( function( $ ) {
|
|||
touch: false
|
||||
}, wc_single_product_params.zoom_options );
|
||||
|
||||
if ( 'ontouchstart' in window ) {
|
||||
if ( 'ontouchstart' in document.documentElement ) {
|
||||
zoom_options.on = 'click';
|
||||
}
|
||||
|
||||
|
@ -220,8 +220,17 @@ jQuery( function( $ ) {
|
|||
if ( this.zoom_enabled && this.$images.length > 0 ) {
|
||||
this.$target.prepend( '<a href="#" class="woocommerce-product-gallery__trigger">🔍</a>' );
|
||||
this.$target.on( 'click', '.woocommerce-product-gallery__trigger', this.openPhotoswipe );
|
||||
this.$target.on( 'click', '.woocommerce-product-gallery__image a', function( e ) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// If flexslider is disabled, gallery images also need to trigger photoswipe on click.
|
||||
if ( ! this.flexslider_enabled ) {
|
||||
this.$target.on( 'click', '.woocommerce-product-gallery__image a', this.openPhotoswipe );
|
||||
}
|
||||
} else {
|
||||
this.$target.on( 'click', '.woocommerce-product-gallery__image a', this.openPhotoswipe );
|
||||
}
|
||||
this.$target.on( 'click', '.woocommerce-product-gallery__image a', this.openPhotoswipe );
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -71,7 +71,8 @@ jQuery( function( $ ) {
|
|||
if ( scrollElement.length ) {
|
||||
if ( isSmoothScrollSupported ) {
|
||||
scrollElement[0].scrollIntoView({
|
||||
behavior: 'smooth'
|
||||
behavior: 'smooth',
|
||||
block: 'center'
|
||||
});
|
||||
} else {
|
||||
$( 'html, body' ).animate( {
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(o){o(".woocommerce-ordering").on("change","select.orderby",function(){o(this).closest("form").submit()}),o("input.qty:not(.product-quantity input.qty)").each(function(){var e=parseFloat(o(this).attr("min"));e>=0&&parseFloat(o(this).val())<e&&o(this).val(e)}),o(".woocommerce-store-notice__dismiss-link").click(function(){Cookies.set("store_notice","hidden",{path:"/"}),o(".woocommerce-store-notice").hide()}),"hidden"===Cookies.get("store_notice")?o(".woocommerce-store-notice").hide():o(".woocommerce-store-notice").show(),o(document.body).on("click",function(){o(".woocommerce-input-wrapper span.description:visible").prop("aria-hidden",!0).slideUp(250)}),o(".woocommerce-input-wrapper").on("click",function(o){o.stopPropagation()}),o(".woocommerce-input-wrapper :input").on("keydown",function(e){var i=o(this).parent().find("span.description");if(27===e.which&&i.length&&i.is(":visible"))return i.prop("aria-hidden",!0).slideUp(250),e.preventDefault(),!1}).on("focus",function(){var e=o(this).parent(),i=e.find("span.description");e.addClass("currentTarget"),o(".woocommerce-input-wrapper:not(.currentTarget) span.description:visible").prop("aria-hidden",!0).slideUp(250),i.length&&i.is(":hidden")&&i.prop("aria-hidden",!1).slideDown(250),e.removeClass("currentTarget")}),o.scroll_to_notices=function(e){var i="scrollBehavior"in document.documentElement.style;e.length&&(i?e[0].scrollIntoView({behavior:"smooth"}):o("html, body").animate({scrollTop:e.offset().top-100},1e3))}});
|
||||
jQuery(function(o){o(".woocommerce-ordering").on("change","select.orderby",function(){o(this).closest("form").submit()}),o("input.qty:not(.product-quantity input.qty)").each(function(){var e=parseFloat(o(this).attr("min"));e>=0&&parseFloat(o(this).val())<e&&o(this).val(e)}),o(".woocommerce-store-notice__dismiss-link").click(function(){Cookies.set("store_notice","hidden",{path:"/"}),o(".woocommerce-store-notice").hide()}),"hidden"===Cookies.get("store_notice")?o(".woocommerce-store-notice").hide():o(".woocommerce-store-notice").show(),o(document.body).on("click",function(){o(".woocommerce-input-wrapper span.description:visible").prop("aria-hidden",!0).slideUp(250)}),o(".woocommerce-input-wrapper").on("click",function(o){o.stopPropagation()}),o(".woocommerce-input-wrapper :input").on("keydown",function(e){var t=o(this).parent().find("span.description");if(27===e.which&&t.length&&t.is(":visible"))return t.prop("aria-hidden",!0).slideUp(250),e.preventDefault(),!1}).on("focus",function(){var e=o(this).parent(),t=e.find("span.description");e.addClass("currentTarget"),o(".woocommerce-input-wrapper:not(.currentTarget) span.description:visible").prop("aria-hidden",!0).slideUp(250),t.length&&t.is(":hidden")&&t.prop("aria-hidden",!1).slideDown(250),e.removeClass("currentTarget")}),o.scroll_to_notices=function(e){var t="scrollBehavior"in document.documentElement.style;e.length&&(t?e[0].scrollIntoView({behavior:"smooth",block:"center"}):o("html, body").animate({scrollTop:e.offset().top-100},1e3))}});
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
Zoom 1.7.18
|
||||
Zoom 1.7.21
|
||||
license: MIT
|
||||
http://www.jacklmoore.com/zoom
|
||||
*/
|
||||
|
@ -220,12 +220,14 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if ($.isFunction(settings.callback)) {
|
||||
settings.callback.call(img);
|
||||
}
|
||||
};
|
||||
|
||||
img.setAttribute('role', 'presentation');
|
||||
img.alt = '';
|
||||
img.src = settings.url;
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*!
|
||||
Zoom 1.7.18
|
||||
Zoom 1.7.21
|
||||
license: MIT
|
||||
http://www.jacklmoore.com/zoom
|
||||
*/
|
||||
!function(o){var t={url:!1,callback:!1,target:!1,duration:120,on:"mouseover",touch:!0,onZoomIn:!1,onZoomOut:!1,magnify:1};o.zoom=function(t,n,e,i){var u,c,a,r,m,l,s,f=o(t),h=f.css("position"),d=o(n);return t.style.position=/(absolute|fixed)/.test(h)?h:"relative",t.style.overflow="hidden",e.style.width=e.style.height="",o(e).addClass("zoomImg").css({position:"absolute",top:0,left:0,opacity:0,width:e.width*i,height:e.height*i,border:"none",maxWidth:"none",maxHeight:"none"}).appendTo(t),{init:function(){c=f.outerWidth(),u=f.outerHeight(),n===t?(r=c,a=u):(r=d.outerWidth(),a=d.outerHeight()),m=(e.width-c)/r,l=(e.height-u)/a,s=d.offset()},move:function(o){var t=o.pageX-s.left,n=o.pageY-s.top;n=Math.max(Math.min(n,a),0),t=Math.max(Math.min(t,r),0),e.style.left=t*-m+"px",e.style.top=n*-l+"px"}}},o.fn.zoom=function(n){return this.each(function(){var e=o.extend({},t,n||{}),i=e.target&&o(e.target)[0]||this,u=this,c=o(u),a=document.createElement("img"),r=o(a),m="mousemove.zoom",l=!1,s=!1;if(!e.url){var f=u.querySelector("img");if(f&&(e.url=f.getAttribute("data-src")||f.currentSrc||f.src),!e.url)return}c.one("zoom.destroy",function(o,t){c.off(".zoom"),i.style.position=o,i.style.overflow=t,a.onload=null,r.remove()}.bind(this,i.style.position,i.style.overflow)),a.onload=function(){function t(t){f.init(),f.move(t),r.stop().fadeTo(o.support.opacity?e.duration:0,1,!!o.isFunction(e.onZoomIn)&&e.onZoomIn.call(a))}function n(){r.stop().fadeTo(e.duration,0,!!o.isFunction(e.onZoomOut)&&e.onZoomOut.call(a))}var f=o.zoom(i,u,a,e.magnify);"grab"===e.on?c.on("mousedown.zoom",function(e){1===e.which&&(o(document).one("mouseup.zoom",function(){n(),o(document).off(m,f.move)}),t(e),o(document).on(m,f.move),e.preventDefault())}):"click"===e.on?c.on("click.zoom",function(e){return l?void 0:(l=!0,t(e),o(document).on(m,f.move),o(document).one("click.zoom",function(){n(),l=!1,o(document).off(m,f.move)}),!1)}):"toggle"===e.on?c.on("click.zoom",function(o){l?n():t(o),l=!l}):"mouseover"===e.on&&(f.init(),c.on("mouseenter.zoom",t).on("mouseleave.zoom",n).on(m,f.move)),e.touch&&c.on("touchstart.zoom",function(o){o.preventDefault(),s?(s=!1,n()):(s=!0,t(o.originalEvent.touches[0]||o.originalEvent.changedTouches[0]))}).on("touchmove.zoom",function(o){o.preventDefault(),f.move(o.originalEvent.touches[0]||o.originalEvent.changedTouches[0])}).on("touchend.zoom",function(o){o.preventDefault(),s&&(s=!1,n())}),o.isFunction(e.callback)&&e.callback.call(a)},a.src=e.url})},o.fn.zoom.defaults=t}(window.jQuery);
|
||||
(function(o){var t={url:!1,callback:!1,target:!1,duration:120,on:"mouseover",touch:!0,onZoomIn:!1,onZoomOut:!1,magnify:1};o.zoom=function(t,n,e,i){var u,c,a,r,m,l,s,f=o(t),h=f.css("position"),d=o(n);return t.style.position=/(absolute|fixed)/.test(h)?h:"relative",t.style.overflow="hidden",e.style.width=e.style.height="",o(e).addClass("zoomImg").css({position:"absolute",top:0,left:0,opacity:0,width:e.width*i,height:e.height*i,border:"none",maxWidth:"none",maxHeight:"none"}).appendTo(t),{init:function(){c=f.outerWidth(),u=f.outerHeight(),n===t?(r=c,a=u):(r=d.outerWidth(),a=d.outerHeight()),m=(e.width-c)/r,l=(e.height-u)/a,s=d.offset()},move:function(o){var t=o.pageX-s.left,n=o.pageY-s.top;n=Math.max(Math.min(n,a),0),t=Math.max(Math.min(t,r),0),e.style.left=t*-m+"px",e.style.top=n*-l+"px"}}},o.fn.zoom=function(n){return this.each(function(){var e=o.extend({},t,n||{}),i=e.target&&o(e.target)[0]||this,u=this,c=o(u),a=document.createElement("img"),r=o(a),m="mousemove.zoom",l=!1,s=!1;if(!e.url){var f=u.querySelector("img");if(f&&(e.url=f.getAttribute("data-src")||f.currentSrc||f.src),!e.url)return}c.one("zoom.destroy",function(o,t){c.off(".zoom"),i.style.position=o,i.style.overflow=t,a.onload=null,r.remove()}.bind(this,i.style.position,i.style.overflow)),a.onload=function(){function t(t){f.init(),f.move(t),r.stop().fadeTo(o.support.opacity?e.duration:0,1,o.isFunction(e.onZoomIn)?e.onZoomIn.call(a):!1)}function n(){r.stop().fadeTo(e.duration,0,o.isFunction(e.onZoomOut)?e.onZoomOut.call(a):!1)}var f=o.zoom(i,u,a,e.magnify);"grab"===e.on?c.on("mousedown.zoom",function(e){1===e.which&&(o(document).one("mouseup.zoom",function(){n(),o(document).off(m,f.move)}),t(e),o(document).on(m,f.move),e.preventDefault())}):"click"===e.on?c.on("click.zoom",function(e){return l?void 0:(l=!0,t(e),o(document).on(m,f.move),o(document).one("click.zoom",function(){n(),l=!1,o(document).off(m,f.move)}),!1)}):"toggle"===e.on?c.on("click.zoom",function(o){l?n():t(o),l=!l}):"mouseover"===e.on&&(f.init(),c.on("mouseenter.zoom",t).on("mouseleave.zoom",n).on(m,f.move)),e.touch&&c.on("touchstart.zoom",function(o){o.preventDefault(),s?(s=!1,n()):(s=!0,t(o.originalEvent.touches[0]||o.originalEvent.changedTouches[0]))}).on("touchmove.zoom",function(o){o.preventDefault(),f.move(o.originalEvent.touches[0]||o.originalEvent.changedTouches[0])}).on("touchend.zoom",function(o){o.preventDefault(),s&&(s=!1,n())}),o.isFunction(e.callback)&&e.callback.call(a)},a.setAttribute("role","presentation"),a.alt="",a.src=e.url})},o.fn.zoom.defaults=t})(window.jQuery);
|
|
@ -936,25 +936,28 @@
|
|||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.7.0",
|
||||
"version": "1.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e"
|
||||
"reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
|
||||
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/478465659fd987669df0bd8a9bf22a8710e5f1b6",
|
||||
"reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0"
|
||||
"php": "^7.1"
|
||||
},
|
||||
"replace": {
|
||||
"myclabs/deep-copy": "self.version"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/collections": "^1.0",
|
||||
"doctrine/common": "^2.6",
|
||||
"phpunit/phpunit": "^4.1"
|
||||
"phpunit/phpunit": "^7.1"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
|
@ -977,7 +980,7 @@
|
|||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"time": "2017-10-19T19:58:43+00:00"
|
||||
"time": "2018-05-29T17:25:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nette/application",
|
||||
|
@ -2064,23 +2067,23 @@
|
|||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
"version": "1.7.5",
|
||||
"version": "1.7.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpspec/prophecy.git",
|
||||
"reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401"
|
||||
"reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/dfd6be44111a7c41c2e884a336cc4f461b3b2401",
|
||||
"reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401",
|
||||
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712",
|
||||
"reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/instantiator": "^1.0.2",
|
||||
"php": "^5.3|^7.0",
|
||||
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
|
||||
"sebastian/comparator": "^1.1|^2.0",
|
||||
"sebastian/comparator": "^1.1|^2.0|^3.0",
|
||||
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
@ -2123,20 +2126,20 @@
|
|||
"spy",
|
||||
"stub"
|
||||
],
|
||||
"time": "2018-02-19T10:16:54+00:00"
|
||||
"time": "2018-04-18T13:57:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "5.3.0",
|
||||
"version": "5.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||
"reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1"
|
||||
"reference": "c89677919c5dd6d3b3852f230a663118762218ac"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/661f34d0bd3f1a7225ef491a70a020ad23a057a1",
|
||||
"reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac",
|
||||
"reference": "c89677919c5dd6d3b3852f230a663118762218ac",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2186,7 +2189,7 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2017-12-06T09:29:45+00:00"
|
||||
"time": "2018-04-06T15:36:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
|
@ -2376,16 +2379,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "6.5.7",
|
||||
"version": "6.5.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "6bd77b57707c236833d2b57b968e403df060c9d9"
|
||||
"reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6bd77b57707c236833d2b57b968e403df060c9d9",
|
||||
"reference": "6bd77b57707c236833d2b57b968e403df060c9d9",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4f21a3c6b97c42952fd5c2837bb354ec0199b97b",
|
||||
"reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2456,20 +2459,20 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2018-02-26T07:01:09+00:00"
|
||||
"time": "2018-04-10T11:38:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
"version": "5.0.6",
|
||||
"version": "5.0.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
||||
"reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf"
|
||||
"reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/33fd41a76e746b8fa96d00b49a23dadfa8334cdf",
|
||||
"reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3eaf040f20154d27d6da59ca2c6e28ac8fd56dce",
|
||||
"reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2515,7 +2518,7 @@
|
|||
"mock",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2018-01-06T05:45:45+00:00"
|
||||
"time": "2018-05-29T13:50:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
|
@ -3225,16 +3228,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v2.8.35",
|
||||
"version": "v2.8.41",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "a6ff8b2ffa4eb43046828b303af2e3fedadacc27"
|
||||
"reference": "e8e59b74ad1274714dad2748349b55e3e6e630c7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/a6ff8b2ffa4eb43046828b303af2e3fedadacc27",
|
||||
"reference": "a6ff8b2ffa4eb43046828b303af2e3fedadacc27",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/e8e59b74ad1274714dad2748349b55e3e6e630c7",
|
||||
"reference": "e8e59b74ad1274714dad2748349b55e3e6e630c7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3248,7 +3251,7 @@
|
|||
"symfony/process": "~2.1|~3.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "For using the console logger",
|
||||
"psr/log-implementation": "For using the console logger",
|
||||
"symfony/event-dispatcher": "",
|
||||
"symfony/process": ""
|
||||
},
|
||||
|
@ -3282,7 +3285,7 @@
|
|||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2018-02-26T15:33:21+00:00"
|
||||
"time": "2018-05-15T21:17:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
|
@ -3397,17 +3400,72 @@
|
|||
"time": "2015-05-13T11:33:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.7.0",
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b"
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b",
|
||||
"reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
|
||||
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.8-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "BackEndTea@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"ctype",
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"time": "2018-04-30T19:57:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "3296adf6a6454a050679cde90f95350ad604b171"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171",
|
||||
"reference": "3296adf6a6454a050679cde90f95350ad604b171",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3419,7 +3477,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.7-dev"
|
||||
"dev-master": "1.8-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -3453,24 +3511,25 @@
|
|||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2018-01-30T19:27:44+00:00"
|
||||
"time": "2018-04-26T10:06:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v2.8.35",
|
||||
"version": "v2.8.41",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "be720fcfae4614df204190d57795351059946a77"
|
||||
"reference": "51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/be720fcfae4614df204190d57795351059946a77",
|
||||
"reference": "be720fcfae4614df204190d57795351059946a77",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff",
|
||||
"reference": "51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.9"
|
||||
"php": ">=5.3.9",
|
||||
"symfony/polyfill-ctype": "~1.8"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
|
@ -3502,7 +3561,7 @@
|
|||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2018-01-03T07:36:31+00:00"
|
||||
"time": "2018-05-01T22:52:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "theseer/tokenizer",
|
||||
|
@ -3546,16 +3605,16 @@
|
|||
},
|
||||
{
|
||||
"name": "tracy/tracy",
|
||||
"version": "v2.4.12",
|
||||
"version": "v2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nette/tracy.git",
|
||||
"reference": "4182ce7b92f67002509b7fa2fc34bd84deea0b24"
|
||||
"reference": "534d4e4f0f31da494026a3761fad020c20b8debf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nette/tracy/zipball/4182ce7b92f67002509b7fa2fc34bd84deea0b24",
|
||||
"reference": "4182ce7b92f67002509b7fa2fc34bd84deea0b24",
|
||||
"url": "https://api.github.com/repos/nette/tracy/zipball/534d4e4f0f31da494026a3761fad020c20b8debf",
|
||||
"reference": "534d4e4f0f31da494026a3761fad020c20b8debf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3573,7 +3632,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.4-dev"
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -3607,7 +3666,7 @@
|
|||
"nette",
|
||||
"profiler"
|
||||
],
|
||||
"time": "2018-02-28T00:49:47+00:00"
|
||||
"time": "2018-05-25T09:33:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
|
@ -3746,16 +3805,16 @@
|
|||
},
|
||||
{
|
||||
"name": "woocommerce/woocommerce-sniffs",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/woocommerce/woocommerce-sniffs.git",
|
||||
"reference": "383d5b361c1d7532ae1ca6156fd7619fd37bbc05"
|
||||
"reference": "2890fd5d98b318f62acb42f2b5cd6d02627cfd82"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/383d5b361c1d7532ae1ca6156fd7619fd37bbc05",
|
||||
"reference": "383d5b361c1d7532ae1ca6156fd7619fd37bbc05",
|
||||
"url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/2890fd5d98b318f62acb42f2b5cd6d02627cfd82",
|
||||
"reference": "2890fd5d98b318f62acb42f2b5cd6d02627cfd82",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3783,7 +3842,7 @@
|
|||
"woocommerce",
|
||||
"wordpress"
|
||||
],
|
||||
"time": "2017-12-21T22:52:52+00:00"
|
||||
"time": "2018-03-22T18:39:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "wp-coding-standards/wpcs",
|
||||
|
|
|
@ -999,7 +999,7 @@ return array(
|
|||
array(
|
||||
'country' => 'ZA',
|
||||
'state' => '',
|
||||
'rate' => '14.0000',
|
||||
'rate' => '15.0000',
|
||||
'name' => 'VAT',
|
||||
'shipping' => true,
|
||||
),
|
||||
|
|
|
@ -32,7 +32,6 @@ $states['IT'] = array(
|
|||
'CA' => __( 'Cagliari', 'woocommerce' ),
|
||||
'CL' => __( 'Caltanissetta', 'woocommerce' ),
|
||||
'CB' => __( 'Campobasso', 'woocommerce' ),
|
||||
'CI' => __( 'Carbonia-Iglesias', 'woocommerce' ),
|
||||
'CE' => __( 'Caserta', 'woocommerce' ),
|
||||
'CT' => __( 'Catania', 'woocommerce' ),
|
||||
'CZ' => __( 'Catanzaro', 'woocommerce' ),
|
||||
|
@ -73,7 +72,6 @@ $states['IT'] = array(
|
|||
'NA' => __( 'Napoli', 'woocommerce' ),
|
||||
'NO' => __( 'Novara', 'woocommerce' ),
|
||||
'NU' => __( 'Nuoro', 'woocommerce' ),
|
||||
'OT' => __( 'Olbia-Tempio', 'woocommerce' ),
|
||||
'OR' => __( 'Oristano', 'woocommerce' ),
|
||||
'PD' => __( 'Padova', 'woocommerce' ),
|
||||
'PA' => __( 'Palermo', 'woocommerce' ),
|
||||
|
@ -97,17 +95,16 @@ $states['IT'] = array(
|
|||
'RM' => __( 'Roma', 'woocommerce' ),
|
||||
'RO' => __( 'Rovigo', 'woocommerce' ),
|
||||
'SA' => __( 'Salerno', 'woocommerce' ),
|
||||
'VS' => __( 'Medio Campidano', 'woocommerce' ),
|
||||
'SS' => __( 'Sassari', 'woocommerce' ),
|
||||
'SV' => __( 'Savona', 'woocommerce' ),
|
||||
'SI' => __( 'Siena', 'woocommerce' ),
|
||||
'SR' => __( 'Siracusa', 'woocommerce' ),
|
||||
'SO' => __( 'Sondrio', 'woocommerce' ),
|
||||
'SU' => __( 'Sud Sardegna', 'woocommerce' ),
|
||||
'TA' => __( 'Taranto', 'woocommerce' ),
|
||||
'TE' => __( 'Teramo', 'woocommerce' ),
|
||||
'TR' => __( 'Terni', 'woocommerce' ),
|
||||
'TO' => __( 'Torino', 'woocommerce' ),
|
||||
'OG' => __( 'Ogliastra', 'woocommerce' ),
|
||||
'TP' => __( 'Trapani', 'woocommerce' ),
|
||||
'TN' => __( 'Trento', 'woocommerce' ),
|
||||
'TV' => __( 'Treviso', 'woocommerce' ),
|
||||
|
|
|
@ -18,7 +18,7 @@ $states['LR'] = array(
|
|||
'GC' => __( 'Grand Cape Mount', 'woocommerce' ),
|
||||
'GG' => __( 'Grand Gedeh', 'woocommerce' ),
|
||||
'GK' => __( 'Grand Kru', 'woocommerce' ),
|
||||
'LO' => __( 'Lofa ', 'woocommerce' ),
|
||||
'LO' => __( 'Lofa', 'woocommerce' ),
|
||||
'MA' => __( 'Margibi', 'woocommerce' ),
|
||||
'MY' => __( 'Maryland', 'woocommerce' ),
|
||||
'MO' => __( 'Montserrado', 'woocommerce' ),
|
||||
|
|
|
@ -1182,6 +1182,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
$item->save();
|
||||
$this->add_item( $item );
|
||||
wc_do_deprecated_action( 'woocommerce_order_add_product', array( $this->get_id(), $item->get_id(), $product, $qty, $args ), '3.0', 'woocommerce_new_order_item action instead' );
|
||||
delete_transient( 'wc_order_' . $this->get_id() . '_needs_processing' );
|
||||
return $item->get_id();
|
||||
}
|
||||
|
||||
|
@ -1324,7 +1325,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
$shipping_tax_class = count( $found_classes ) ? current( $found_classes ) : false;
|
||||
}
|
||||
|
||||
$is_vat_exempt = apply_filters( 'woocommerce_order_is_vat_exempt', 'yes' === $this->get_meta( 'is_vat_exempt' ) );
|
||||
$is_vat_exempt = apply_filters( 'woocommerce_order_is_vat_exempt', 'yes' === $this->get_meta( 'is_vat_exempt' ), $this );
|
||||
|
||||
// Trigger tax recalculation for all items.
|
||||
foreach ( $this->get_items( array( 'line_item', 'fee' ) ) as $item_id => $item ) {
|
||||
|
@ -1358,7 +1359,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
foreach ( $this->get_items( array( 'line_item', 'fee' ) ) as $item_id => $item ) {
|
||||
$taxes = $item->get_taxes();
|
||||
foreach ( $taxes['total'] as $tax_rate_id => $tax ) {
|
||||
$cart_taxes[ $tax_rate_id ] = isset( $cart_taxes[ $tax_rate_id ] ) ? $cart_taxes[ $tax_rate_id ] + (float) $tax : (float) $tax;
|
||||
$tax_amount = (float) $tax;
|
||||
|
||||
if ( 'yes' !== get_option( 'woocommerce_tax_round_at_subtotal' ) ) {
|
||||
$tax_amount = wc_round_tax_total( $tax_amount );
|
||||
}
|
||||
|
||||
$cart_taxes[ $tax_rate_id ] = isset( $cart_taxes[ $tax_rate_id ] ) ? $cart_taxes[ $tax_rate_id ] + $tax_amount : $tax_amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
<?php
|
||||
/**
|
||||
* WooCommerce abstract privacy class.
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @package WooCommerce/Abstracts
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Abstract class that is intended to be extended by
|
||||
* specific privacy class. It handles the display
|
||||
* of the privacy message of the privacy id to the admin,
|
||||
* privacy data to be exported and privacy data to be deleted.
|
||||
*
|
||||
* @version 3.4.0
|
||||
* @package WooCommerce/Abstracts
|
||||
*/
|
||||
abstract class WC_Abstract_Privacy {
|
||||
/**
|
||||
* This is the name of this object type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* This is a list of exporters.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $exporters = array();
|
||||
|
||||
/**
|
||||
* This is a list of erasers.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $erasers = array();
|
||||
|
||||
/**
|
||||
* This is a priority for the wp_privacy_personal_data_exporters filter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $export_priority;
|
||||
|
||||
/**
|
||||
* This is a priority for the wp_privacy_personal_data_erasers filter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $erase_priority;
|
||||
|
||||
/**
|
||||
* WC_Abstract_Privacy Constructor.
|
||||
*
|
||||
* @param string $name Plugin identifier.
|
||||
* @param int $export_priority Export priority.
|
||||
* @param int $erase_priority Erase priority.
|
||||
*/
|
||||
public function __construct( $name = '', $export_priority = 5, $erase_priority = 10 ) {
|
||||
$this->name = $name;
|
||||
$this->export_priority = $export_priority;
|
||||
$this->erase_priority = $erase_priority;
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook in events.
|
||||
*/
|
||||
protected function init() {
|
||||
add_action( 'admin_init', array( $this, 'add_privacy_message' ) );
|
||||
// We set priority to 5 to help WooCommerce's findings appear before those from extensions in exported items.
|
||||
add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_exporters' ), $this->export_priority );
|
||||
add_filter( 'wp_privacy_personal_data_erasers', array( $this, 'register_erasers' ), $this->erase_priority );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the privacy message on WC privacy page.
|
||||
*/
|
||||
public function add_privacy_message() {
|
||||
if ( function_exists( 'wp_add_privacy_policy_content' ) ) {
|
||||
$content = $this->get_privacy_message();
|
||||
|
||||
if ( $content ) {
|
||||
wp_add_privacy_policy_content( $this->name, $this->get_privacy_message() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message of the privacy to display.
|
||||
* To be overloaded by the implementor.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_privacy_message() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Integrate this exporter implementation within the WordPress core exporters.
|
||||
*
|
||||
* @param array $exporters List of exporter callbacks.
|
||||
* @return array
|
||||
*/
|
||||
public function register_exporters( $exporters = array() ) {
|
||||
foreach ( $this->exporters as $id => $exporter ) {
|
||||
$exporters[ $id ] = $exporter;
|
||||
}
|
||||
return $exporters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Integrate this eraser implementation within the WordPress core erasers.
|
||||
*
|
||||
* @param array $erasers List of eraser callbacks.
|
||||
* @return array
|
||||
*/
|
||||
public function register_erasers( $erasers = array() ) {
|
||||
foreach ( $this->erasers as $id => $eraser ) {
|
||||
$erasers[ $id ] = $eraser;
|
||||
}
|
||||
return $erasers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add exporter to list of exporters.
|
||||
*
|
||||
* @param string $id ID of the Exporter.
|
||||
* @param string $name Exporter name.
|
||||
* @param string|array $callback Exporter callback.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add_exporter( $id, $name, $callback ) {
|
||||
$this->exporters[ $id ] = array(
|
||||
'exporter_friendly_name' => $name,
|
||||
'callback' => $callback,
|
||||
);
|
||||
return $this->exporters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add eraser to list of erasers.
|
||||
*
|
||||
* @param string $id ID of the Eraser.
|
||||
* @param string $name Exporter name.
|
||||
* @param string|array $callback Exporter callback.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add_eraser( $id, $name, $callback ) {
|
||||
$this->erasers[ $id ] = array(
|
||||
'eraser_friendly_name' => $name,
|
||||
'callback' => $callback,
|
||||
);
|
||||
return $this->erasers;
|
||||
}
|
||||
}
|
|
@ -1314,7 +1314,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
|||
$this->set_stock_status( 'onbackorder' );
|
||||
|
||||
// If the stock level is changing and we do now have enough, force in stock status.
|
||||
} elseif ( $this->get_stock_quantity() > get_option( 'woocommerce_notify_no_stock_amount', 0 ) && array_key_exists( 'stock_quantity', $this->get_changes() ) ) {
|
||||
} elseif ( $this->get_stock_quantity() > get_option( 'woocommerce_notify_no_stock_amount', 0 ) && ( array_key_exists( 'stock_quantity', $this->get_changes() ) || array_key_exists( 'manage_stock', $this->get_changes() ) ) ) {
|
||||
$this->set_stock_status( 'instock' );
|
||||
}
|
||||
}
|
||||
|
@ -1809,7 +1809,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
|||
$image = '';
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_product_get_image', wc_get_relative_url( $image ), $this, $size, $attr, $placeholder, $image );
|
||||
return apply_filters( 'woocommerce_product_get_image', $image, $this, $size, $attr, $placeholder, $image );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -380,20 +380,11 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
if ( isset( $request['slug'] ) ) {
|
||||
$args['slug'] = $request['slug'];
|
||||
}
|
||||
|
||||
if ( isset( $request['parent'] ) ) {
|
||||
if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
|
||||
return new WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce' ), array( 'status' => 400 ) );
|
||||
}
|
||||
|
||||
$parent = get_term( (int) $request['parent'], $taxonomy );
|
||||
|
||||
// If is null or WP_Error is invalid parent term.
|
||||
if ( ! $parent || is_wp_error( $parent ) ) {
|
||||
return new WP_Error( 'woocommerce_rest_term_invalid', __( 'Parent resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
$args['parent'] = $parent->term_id;
|
||||
$args['parent'] = $request['parent'];
|
||||
}
|
||||
|
||||
$term = wp_insert_term( $name, $taxonomy, $args );
|
||||
|
@ -486,25 +477,11 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
if ( isset( $request['slug'] ) ) {
|
||||
$prepared_args['slug'] = $request['slug'];
|
||||
}
|
||||
|
||||
if ( isset( $request['parent'] ) ) {
|
||||
if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
|
||||
return new WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce' ), array( 'status' => 400 ) );
|
||||
}
|
||||
|
||||
$parent_id = (int) $request['parent'];
|
||||
|
||||
if ( 0 === $parent_id ) {
|
||||
$prepared_args['parent'] = $parent_id;
|
||||
} else {
|
||||
$parent = get_term( $parent_id, $taxonomy );
|
||||
|
||||
if ( ! $parent ) {
|
||||
return new WP_Error( 'woocommerce_rest_term_invalid', __( 'Parent resource does not exist.', 'woocommerce' ), array( 'status' => 400 ) );
|
||||
}
|
||||
|
||||
$prepared_args['parent'] = $parent->term_id;
|
||||
}
|
||||
$prepared_args['parent'] = $request['parent'];
|
||||
}
|
||||
|
||||
// Only update the term if we haz something to update.
|
||||
|
|
|
@ -192,7 +192,7 @@ abstract class WC_Settings_API {
|
|||
|
||||
$this->settings[ $key ] = $value;
|
||||
|
||||
return update_option( $this->get_option_key(), apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings ) );
|
||||
return update_option( $this->get_option_key(), apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings ), 'yes' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -216,7 +216,7 @@ abstract class WC_Settings_API {
|
|||
}
|
||||
}
|
||||
|
||||
return update_option( $this->get_option_key(), apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings ) );
|
||||
return update_option( $this->get_option_key(), apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings ), 'yes' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -569,7 +569,7 @@ abstract class WC_Settings_API {
|
|||
<td class="forminp">
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
||||
<span class="colorpickpreview" style="background:<?php echo esc_attr( $this->get_option( $key ) ); ?>;"></span>
|
||||
<span class="colorpickpreview" style="background:<?php echo esc_attr( $this->get_option( $key ) ); ?>;"> </span>
|
||||
<input class="colorpick <?php echo esc_attr( $data['class'] ); ?>" type="text" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo esc_attr( $this->get_option( $key ) ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?> />
|
||||
<div id="colorPickerDiv_<?php echo esc_attr( $field_key ); ?>" class="colorpickdiv" style="z-index: 100; background: #eee; border: 1px solid #ccc; position: absolute; display: none;"></div>
|
||||
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
|
||||
|
|
|
@ -524,31 +524,37 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
|||
}
|
||||
|
||||
/**
|
||||
* Processes and saves options.
|
||||
* If there is an error thrown, will continue to save and validate fields, but will leave the erroring field out.
|
||||
* Processes and saves global shipping method options in the admin area.
|
||||
*
|
||||
* This method is usually attached to woocommerce_update_options_x hooks.
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @return bool was anything saved?
|
||||
*/
|
||||
public function process_admin_options() {
|
||||
if ( $this->instance_id ) {
|
||||
$this->init_instance_settings();
|
||||
|
||||
$post_data = $this->get_post_data();
|
||||
|
||||
foreach ( $this->get_instance_form_fields() as $key => $field ) {
|
||||
if ( 'title' !== $this->get_field_type( $field ) ) {
|
||||
try {
|
||||
$this->instance_settings[ $key ] = $this->get_field_value( $key, $field, $post_data );
|
||||
} catch ( Exception $e ) {
|
||||
$this->add_error( $e->getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return update_option( $this->get_instance_option_key(), apply_filters( 'woocommerce_shipping_' . $this->id . '_instance_settings_values', $this->instance_settings, $this ) );
|
||||
} else {
|
||||
if ( ! $this->instance_id ) {
|
||||
return parent::process_admin_options();
|
||||
}
|
||||
|
||||
// Check we are processing the correct form for this instance.
|
||||
if ( ! isset( $_REQUEST['instance_id'] ) || absint( $_REQUEST['instance_id'] ) !== $this->instance_id ) { // WPCS: input var ok, CSRF ok.
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->init_instance_settings();
|
||||
|
||||
$post_data = $this->get_post_data();
|
||||
|
||||
foreach ( $this->get_instance_form_fields() as $key => $field ) {
|
||||
if ( 'title' !== $this->get_field_type( $field ) ) {
|
||||
try {
|
||||
$this->instance_settings[ $key ] = $this->get_field_value( $key, $field, $post_data );
|
||||
} catch ( Exception $e ) {
|
||||
$this->add_error( $e->getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return update_option( $this->get_instance_option_key(), apply_filters( 'woocommerce_shipping_' . $this->id . '_instance_settings_values', $this->instance_settings, $this ), 'yes' );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,14 +78,14 @@ abstract class WC_Widget extends WP_Widget {
|
|||
* @return bool true if the widget is cached otherwise false
|
||||
*/
|
||||
public function get_cached_widget( $args ) {
|
||||
$cache = wp_cache_get( apply_filters( 'woocommerce_cached_widget_id', $this->widget_id ), 'widget' );
|
||||
$cache = wp_cache_get( $this->get_widget_id_for_cache( $this->widget_id ), 'widget' );
|
||||
|
||||
if ( ! is_array( $cache ) ) {
|
||||
$cache = array();
|
||||
}
|
||||
|
||||
if ( isset( $cache[ $args['widget_id'] ] ) ) {
|
||||
echo $cache[ $args['widget_id'] ]; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
||||
if ( isset( $cache[ $this->get_widget_id_for_cache( $args['widget_id'] ) ] ) ) {
|
||||
echo $cache[ $this->get_widget_id_for_cache( $args['widget_id'] ) ]; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -100,15 +100,15 @@ abstract class WC_Widget extends WP_Widget {
|
|||
* @return string the content that was cached
|
||||
*/
|
||||
public function cache_widget( $args, $content ) {
|
||||
$cache = wp_cache_get( apply_filters( 'woocommerce_cached_widget_id', $this->widget_id ), 'widget' );
|
||||
$cache = wp_cache_get( $this->get_widget_id_for_cache( $this->widget_id ), 'widget' );
|
||||
|
||||
if ( ! is_array( $cache ) ) {
|
||||
$cache = array();
|
||||
}
|
||||
|
||||
$cache[ $args['widget_id'] ] = $content;
|
||||
$cache[ $this->get_widget_id_for_cache( $args['widget_id'] ) ] = $content;
|
||||
|
||||
wp_cache_set( apply_filters( 'woocommerce_cached_widget_id', $this->widget_id ), $cache, 'widget' );
|
||||
wp_cache_set( $this->get_widget_id_for_cache( $this->widget_id ), $cache, 'widget' );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
@ -117,7 +117,9 @@ abstract class WC_Widget extends WP_Widget {
|
|||
* Flush the cache.
|
||||
*/
|
||||
public function flush_widget_cache() {
|
||||
wp_cache_delete( apply_filters( 'woocommerce_cached_widget_id', $this->widget_id ), 'widget' );
|
||||
foreach ( array( 'https', 'http' ) as $scheme ) {
|
||||
wp_cache_delete( $this->get_widget_id_for_cache( $this->widget_id, $scheme ), 'widget' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -347,4 +349,22 @@ abstract class WC_Widget extends WP_Widget {
|
|||
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get widget id plus scheme/protocol to prevent serving mixed content from (persistently) cached widgets.
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @param string $widget_id Id of the cached widget.
|
||||
* @param string $scheme Scheme for the widget id.
|
||||
* @return string Widget id including scheme/protocol.
|
||||
*/
|
||||
protected function get_widget_id_for_cache( $widget_id, $scheme = '' ) {
|
||||
if ( $scheme ) {
|
||||
$widget_id_for_cache = $widget_id . '-' . $scheme;
|
||||
} else {
|
||||
$widget_id_for_cache = $widget_id . '-' . ( is_ssl() ? 'https' : 'http' );
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_cached_widget_id', $widget_id_for_cache );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,17 +2,13 @@
|
|||
/**
|
||||
* Attributes Page
|
||||
*
|
||||
* The attributes section lets users add custom attributes to assign to products - they can also be used in the layered nav widget.
|
||||
* The attributes section lets users add custom attributes to assign to products - they can also be used in the "Filter Products by Attribute" widget.
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.3.0
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Admin_Attributes Class.
|
||||
|
|
|
@ -38,8 +38,8 @@ if ( ! class_exists( 'WC_Admin_Customize', false ) ) :
|
|||
*/
|
||||
public function register_customize_nav_menu_item_types( $item_types ) {
|
||||
$item_types[] = array(
|
||||
'title' => __( 'WooCommerce endpoints', 'woocommerce' ),
|
||||
'type_label' => __( 'WooCommerce endpoint', 'woocommerce' ),
|
||||
'title' => __( 'WooCommerce Endpoints', 'woocommerce' ),
|
||||
'type_label' => __( 'WooCommerce Endpoint', 'woocommerce' ),
|
||||
'type' => 'woocommerce_nav',
|
||||
'object' => 'woocommerce_endpoint',
|
||||
);
|
||||
|
|
|
@ -166,6 +166,7 @@ class WC_Admin_Duplicate_Product {
|
|||
$child_duplicate = clone $child;
|
||||
$child_duplicate->set_parent_id( $duplicate->get_id() );
|
||||
$child_duplicate->set_id( 0 );
|
||||
$child_duplicate->set_date_created( null );
|
||||
|
||||
if ( '' !== $child->get_sku( 'edit' ) ) {
|
||||
$child_duplicate->set_sku( wc_product_generate_unique_sku( 0, $child->get_sku( 'edit' ) ) );
|
||||
|
|
|
@ -77,8 +77,8 @@ class WC_Admin_Help {
|
|||
'title' => __( 'Education', 'woocommerce' ),
|
||||
'content' =>
|
||||
'<h2>' . __( 'Education', 'woocommerce' ) . '</h2>' .
|
||||
'<p>' . __( 'If you would like to learn about using WooCommerce from an expert, consider following a WooCommerce course offered by one of our educational partners.', 'woocommerce' ) . '</p>' .
|
||||
'<p><a href="https://woocommerce.com/educational-partners/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin" class="button button-primary">' . __( 'View education partners', 'woocommerce' ) . '</a></p>',
|
||||
'<p>' . __( 'If you would like to learn about using WooCommerce from an expert, consider a WooCommerce course to further your education.', 'woocommerce' ) . '</p>' .
|
||||
'<p><a href="https://docs.woocommerce.com/document/further-education/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin" class="button button-primary">' . __( 'Further education', 'woocommerce' ) . '</a></p>',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -98,7 +98,7 @@ class WC_Admin_Help {
|
|||
'<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></p>' .
|
||||
'<p><a href="https://woocommerce.com/?utm_source=helptab&utm_medium=product&utm_content=about&utm_campaign=woocommerceplugin" target="_blank">' . __( 'About WooCommerce', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://wordpress.org/plugins/woocommerce/" target="_blank">' . __( 'WordPress.org project', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://github.com/woocommerce/woocommerce" target="_blank">' . __( 'Github project', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://github.com/woocommerce/woocommerce/" target="_blank">' . __( 'Github project', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://woocommerce.com/storefront/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official theme', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://woocommerce.com/product-category/woocommerce-extensions/?utm_source=helptab&utm_medium=product&utm_content=wcextensions&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official extensions', 'woocommerce' ) . '</a></p>'
|
||||
);
|
||||
|
|
|
@ -235,26 +235,38 @@ class WC_Admin_Importers {
|
|||
update_user_option( get_current_user_id(), 'product_import_error_log', $error_log );
|
||||
|
||||
if ( 100 === $percent_complete ) {
|
||||
// Clear temp meta.
|
||||
$wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_original_id' ) ); // @codingStandardsIgnoreLine.
|
||||
$wpdb->query(
|
||||
"DELETE {$wpdb->posts}, {$wpdb->postmeta}, {$wpdb->term_relationships}
|
||||
FROM {$wpdb->posts}
|
||||
LEFT JOIN {$wpdb->term_relationships} ON ( {$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id )
|
||||
LEFT JOIN {$wpdb->postmeta} ON ( {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id )
|
||||
LEFT JOIN {$wpdb->term_taxonomy} ON ( {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id )
|
||||
LEFT JOIN {$wpdb->terms} ON ( {$wpdb->terms}.term_id = {$wpdb->term_taxonomy}.term_id )
|
||||
WHERE {$wpdb->posts}.post_type IN ( 'product', 'product_variation' )
|
||||
AND {$wpdb->posts}.post_status = 'importing'"
|
||||
);
|
||||
// @codingStandardsIgnoreStart.
|
||||
$wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_original_id' ) );
|
||||
$wpdb->delete( $wpdb->posts, array(
|
||||
'post_type' => 'product',
|
||||
'post_status' => 'importing',
|
||||
) );
|
||||
$wpdb->delete( $wpdb->posts, array(
|
||||
'post_type' => 'product_variation',
|
||||
'post_status' => 'importing',
|
||||
) );
|
||||
// @codingStandardsIgnoreEnd.
|
||||
|
||||
// Clear orphan variations.
|
||||
$wpdb->query(
|
||||
"DELETE products
|
||||
FROM {$wpdb->posts} products
|
||||
LEFT JOIN {$wpdb->posts} wp ON wp.ID = products.post_parent
|
||||
WHERE wp.ID IS NULL AND products.post_type = 'product_variation';"
|
||||
);
|
||||
// Clean up orphaned data.
|
||||
$wpdb->query( "
|
||||
DELETE {$wpdb->posts}.* FROM {$wpdb->posts}
|
||||
LEFT JOIN {$wpdb->posts} wp ON wp.ID = {$wpdb->posts}.post_parent
|
||||
WHERE wp.ID IS NULL AND {$wpdb->posts}.post_type = 'product_variation'
|
||||
" );
|
||||
$wpdb->query( "
|
||||
DELETE {$wpdb->postmeta}.* FROM {$wpdb->postmeta}
|
||||
LEFT JOIN {$wpdb->posts} wp ON wp.ID = {$wpdb->postmeta}.post_id
|
||||
WHERE wp.ID IS NULL
|
||||
" );
|
||||
// @codingStandardsIgnoreStart.
|
||||
$wpdb->query( "
|
||||
DELETE tr.* FROM {$wpdb->term_relationships} tr
|
||||
LEFT JOIN {$wpdb->posts} wp ON wp.ID = tr.object_id
|
||||
LEFT JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
|
||||
WHERE wp.ID IS NULL
|
||||
AND tt.taxonomy IN ( '" . implode( "','", array_map( 'esc_sql', get_object_taxonomies( 'product' ) ) ) . "' )
|
||||
" );
|
||||
// @codingStandardsIgnoreEnd.
|
||||
|
||||
// Send success.
|
||||
wp_send_json_success(
|
||||
|
|
|
@ -151,13 +151,13 @@ class WC_Admin_Log_Table_List extends WP_List_Table {
|
|||
'debug' => __( 'Debug', 'woocommerce' ),
|
||||
);
|
||||
|
||||
if ( isset( $levels[ $level_key ] ) ) {
|
||||
$level = $levels[ $level_key ];
|
||||
$level_class = sanitize_html_class( 'log-level--' . $level_key );
|
||||
return '<span class="log-level ' . $level_class . '">' . esc_html( $level ) . '</span>';
|
||||
} else {
|
||||
if ( ! isset( $levels[ $level_key ] ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$level = $levels[ $level_key ];
|
||||
$level_class = sanitize_html_class( 'log-level--' . $level_key );
|
||||
return '<span class="log-level ' . $level_class . '">' . esc_html( $level ) . '</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -375,11 +375,11 @@ class WC_Admin_Log_Table_List extends WP_List_Table {
|
|||
$where_values[] = '%' . $wpdb->esc_like( wc_clean( wp_unslash( $_REQUEST['s'] ) ) ) . '%';
|
||||
}
|
||||
|
||||
if ( ! empty( $where_conditions ) ) {
|
||||
return $wpdb->prepare( 'WHERE 1 = 1 AND ' . implode( ' AND ', $where_conditions ), $where_values );
|
||||
} else {
|
||||
if ( empty( $where_conditions ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $wpdb->prepare( 'WHERE 1 = 1 AND ' . implode( ' AND ', $where_conditions ), $where_values );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -98,7 +98,9 @@ class WC_Admin_Menus {
|
|||
$current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( wp_unslash( $_REQUEST['section'] ) ); // WPCS: input var okay, CSRF ok.
|
||||
|
||||
// Save settings if data has been posted.
|
||||
if ( apply_filters( '' !== $current_section ? "woocommerce_save_settings_{$current_tab}_{$current_section}" : "woocommerce_save_settings_{$current_tab}", ! empty( $_POST ) ) ) { // WPCS: input var okay, CSRF ok.
|
||||
if ( '' !== $current_section && apply_filters( "woocommerce_save_settings_{$current_tab}_{$current_section}", ! empty( $_POST ) ) ) { // WPCS: input var okay, CSRF ok.
|
||||
WC_Admin_Settings::save();
|
||||
} elseif ( apply_filters( "woocommerce_save_settings_{$current_tab}", ! empty( $_POST ) ) ) { // WPCS: input var okay, CSRF ok.
|
||||
WC_Admin_Settings::save();
|
||||
}
|
||||
|
||||
|
|
|
@ -132,11 +132,13 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
|
||||
do_action( 'woocommerce_settings_start' );
|
||||
|
||||
wp_enqueue_script( 'woocommerce_settings', WC()->plugin_url() . '/assets/js/admin/settings' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris', 'selectWoo' ), WC()->version, true );
|
||||
wp_enqueue_script( 'woocommerce_settings', WC()->plugin_url() . '/assets/js/admin/settings' . $suffix . '.js', array( 'jquery', 'wp-util', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris', 'selectWoo' ), WC()->version, true );
|
||||
|
||||
wp_localize_script(
|
||||
'woocommerce_settings', 'woocommerce_settings_params', array(
|
||||
'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'woocommerce' ),
|
||||
'i18n_moved_up' => __( 'Item moved up', 'woocommerce' ),
|
||||
'i18n_moved_down' => __( 'Item moved down', 'woocommerce' ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -249,7 +251,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
echo '<h2>' . esc_html( $value['title'] ) . '</h2>';
|
||||
}
|
||||
if ( ! empty( $value['desc'] ) ) {
|
||||
echo '<div id="' . esc_attr( sanitize_title( $value['id'] ) ) . '-description">';
|
||||
echo wp_kses_post( wpautop( wptexturize( $value['desc'] ) ) );
|
||||
echo '</div>';
|
||||
}
|
||||
echo '<table class="form-table">' . "\n\n";
|
||||
if ( ! empty( $value['id'] ) ) {
|
||||
|
@ -313,7 +317,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">‎
|
||||
<span class="colorpickpreview" style="background: <?php echo esc_attr( $option_value ); ?>"></span>
|
||||
<span class="colorpickpreview" style="background: <?php echo esc_attr( $option_value ); ?>"> </span>
|
||||
<input
|
||||
name="<?php echo esc_attr( $value['id'] ); ?>"
|
||||
id="<?php echo esc_attr( $value['id'] ); ?>"
|
||||
|
@ -520,7 +524,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
|
||||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html . $disabled_message; // WPCS: XSS ok. ?></th>
|
||||
<th scope="row" class="titledesc">
|
||||
<label><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html . $disabled_message; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp image_width_settings">
|
||||
|
||||
<input name="<?php echo esc_attr( $value['id'] ); ?>[width]" <?php echo $disabled_attr; // WPCS: XSS ok. ?> id="<?php echo esc_attr( $value['id'] ); ?>-width" type="text" size="3" value="<?php echo esc_attr( $width ); ?>" /> × <input name="<?php echo esc_attr( $value['id'] ); ?>[height]" <?php echo $disabled_attr; // WPCS: XSS ok. ?> id="<?php echo esc_attr( $value['id'] ); ?>-height" type="text" size="3" value="<?php echo esc_attr( $height ); ?>" />px
|
||||
|
@ -552,7 +558,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
|
||||
?>
|
||||
<tr valign="top" class="single_select_page">
|
||||
<th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></th>
|
||||
<th scope="row" class="titledesc">
|
||||
<label><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<?php echo str_replace( ' id=', " data-placeholder='" . esc_attr__( 'Select a page…', 'woocommerce' ) . "' style='" . $value['css'] . "' class='" . $value['class'] . "' id=", wp_dropdown_pages( $args ) ); // WPCS: XSS ok. ?> <?php echo $description; // WPCS: XSS ok. ?>
|
||||
</td>
|
||||
|
@ -606,7 +614,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
<?php
|
||||
if ( ! empty( $countries ) ) {
|
||||
foreach ( $countries as $key => $val ) {
|
||||
echo '<option value="' . esc_attr( $key ) . '"' . wc_selected( $key, $selections ) . '>' . esc_html( $val ) . '</option>';
|
||||
echo '<option value="' . esc_attr( $key ) . '"' . wc_selected( $key, $selections ) . '>' . esc_html( $val ) . '</option>'; // WPCS: XSS ok.
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -722,7 +730,8 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
}
|
||||
|
||||
// Options to update will be stored here and saved later.
|
||||
$update_options = array();
|
||||
$update_options = array();
|
||||
$autoload_options = array();
|
||||
|
||||
// Loop options and get values to save.
|
||||
foreach ( $options as $option ) {
|
||||
|
@ -825,6 +834,8 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
$update_options[ $option_name ] = $value;
|
||||
}
|
||||
|
||||
$autoload_options[ $option_name ] = isset( $option['autoload'] ) ? (bool) $option['autoload'] : true;
|
||||
|
||||
/**
|
||||
* Fire an action before saved.
|
||||
*
|
||||
|
@ -835,7 +846,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
|
||||
// Save all options in our array.
|
||||
foreach ( $update_options as $name => $value ) {
|
||||
update_option( $name, $value );
|
||||
update_option( $name, $value, $autoload_options[ $name ] ? 'yes' : 'no' );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -552,7 +552,7 @@ class WC_Admin_Setup_Wizard {
|
|||
|
||||
if ( $tracking ) {
|
||||
update_option( 'woocommerce_allow_tracking', 'yes' );
|
||||
WC_Tracker::send_tracking_data( true );
|
||||
wp_schedule_single_event( time() + 10, 'woocommerce_tracker_send_event', array( true ) );
|
||||
} else {
|
||||
update_option( 'woocommerce_allow_tracking', 'no' );
|
||||
}
|
||||
|
@ -691,6 +691,40 @@ class WC_Admin_Setup_Wizard {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve info for missing WooCommerce Services and/or Jetpack plugin.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_wcs_requisite_plugins() {
|
||||
$plugins = array();
|
||||
if ( ! is_plugin_active( 'woocommerce-services/woocommerce-services.php' ) && ! get_option( 'woocommerce_setup_background_installing_woocommerce-services' ) ) {
|
||||
$plugins[] = array(
|
||||
'name' => __( 'WooCommerce Services', 'woocommerce' ),
|
||||
'slug' => 'woocommerce-services',
|
||||
);
|
||||
}
|
||||
if ( ! is_plugin_active( 'jetpack/jetpack.php' ) && ! get_option( 'woocommerce_setup_background_installing_jetpack' ) ) {
|
||||
$plugins[] = array(
|
||||
'name' => __( 'Jetpack', 'woocommerce' ),
|
||||
'slug' => 'jetpack',
|
||||
);
|
||||
}
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plugin install info message markup with heading.
|
||||
*/
|
||||
public function plugin_install_info() {
|
||||
?>
|
||||
<span class="plugin-install-info">
|
||||
<span class="plugin-install-info-label"><?php esc_html_e( 'The following plugins will be installed and activated for you:', 'woocommerce' ); ?></span>
|
||||
<span class="plugin-install-info-list"></span>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the WCS shipping carrier for a given country code.
|
||||
*
|
||||
|
@ -722,7 +756,7 @@ class WC_Admin_Setup_Wizard {
|
|||
$shipping_methods = array(
|
||||
'live_rates' => array(
|
||||
'name' => __( 'Live Rates', 'woocommerce' ),
|
||||
'description' => __( 'WooCommerce Services and Jetpack will be installed and activated for you.', 'woocommerce' ),
|
||||
'description' => __( 'Powered by WooCommerce Services and Jetpack.', 'woocommerce' ),
|
||||
),
|
||||
'flat_rate' => array(
|
||||
'name' => __( 'Flat Rate', 'woocommerce' ),
|
||||
|
@ -765,7 +799,12 @@ class WC_Admin_Setup_Wizard {
|
|||
?>
|
||||
<div class="wc-wizard-shipping-method-select">
|
||||
<div class="wc-wizard-shipping-method-dropdown">
|
||||
<select id="<?php echo esc_attr( "{$input_prefix}[method]" ); ?>" name="<?php echo esc_attr( "{$input_prefix}[method]" ); ?>" class="method wc-enhanced-select">
|
||||
<select
|
||||
id="<?php echo esc_attr( "{$input_prefix}[method]" ); ?>"
|
||||
name="<?php echo esc_attr( "{$input_prefix}[method]" ); ?>"
|
||||
class="method wc-enhanced-select"
|
||||
data-plugins="<?php echo esc_attr( wp_json_encode( $this->get_wcs_requisite_plugins() ) ); ?>"
|
||||
>
|
||||
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
|
||||
<option value="<?php echo esc_attr( $method_id ); ?>" <?php selected( $selected, $method_id ); ?>><?php echo esc_html( $method['name'] ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
|
@ -861,7 +900,7 @@ class WC_Admin_Setup_Wizard {
|
|||
</div>
|
||||
<div class="wc-wizard-service-enable">
|
||||
<span class="wc-wizard-service-toggle">
|
||||
<input id="shipping_zones[domestic][enabled]" type="checkbox" name="shipping_zones[domestic][enabled]" value="yes" checked="checked" class="wc-wizard-shipping-method-enable" />
|
||||
<input id="shipping_zones[domestic][enabled]" type="checkbox" name="shipping_zones[domestic][enabled]" value="yes" checked="checked" class="wc-wizard-shipping-method-enable" data-plugins="true" />
|
||||
<label for="shipping_zones[domestic][enabled]">
|
||||
</span>
|
||||
</div>
|
||||
|
@ -875,7 +914,7 @@ class WC_Admin_Setup_Wizard {
|
|||
</div>
|
||||
<div class="wc-wizard-service-enable">
|
||||
<span class="wc-wizard-service-toggle">
|
||||
<input id="shipping_zones[intl][enabled]" type="checkbox" name="shipping_zones[intl][enabled]" value="yes" checked="checked" class="wc-wizard-shipping-method-enable"/>
|
||||
<input id="shipping_zones[intl][enabled]" type="checkbox" name="shipping_zones[intl][enabled]" value="yes" checked="checked" class="wc-wizard-shipping-method-enable" data-plugins="true" />
|
||||
<label for="shipping_zones[intl][enabled]">
|
||||
</span>
|
||||
</div>
|
||||
|
@ -928,6 +967,7 @@ class WC_Admin_Setup_Wizard {
|
|||
</div>
|
||||
|
||||
<p class="wc-setup-actions step">
|
||||
<?php $this->plugin_install_info(); ?>
|
||||
<button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
|
||||
<?php wp_nonce_field( 'wc-setup' ); ?>
|
||||
</p>
|
||||
|
@ -1076,7 +1116,46 @@ class WC_Admin_Setup_Wizard {
|
|||
}
|
||||
|
||||
/**
|
||||
* Is Klarna Checkout country supported
|
||||
* Is PayPal currency supported.
|
||||
*
|
||||
* @param string $currency Currency code.
|
||||
* @return boolean
|
||||
*/
|
||||
protected function is_paypal_supported_currency( $currency ) {
|
||||
$supported_currencies = array(
|
||||
'AUD',
|
||||
'BRL',
|
||||
'CAD',
|
||||
'MXN',
|
||||
'NZD',
|
||||
'HKD',
|
||||
'SGD',
|
||||
'USD',
|
||||
'EUR',
|
||||
'JPY',
|
||||
'TRY',
|
||||
'NOK',
|
||||
'CZK',
|
||||
'DKK',
|
||||
'HUF',
|
||||
'ILS',
|
||||
'MYR',
|
||||
'PHP',
|
||||
'PLN',
|
||||
'SEK',
|
||||
'CHF',
|
||||
'TWD',
|
||||
'THB',
|
||||
'GBP',
|
||||
'RMB',
|
||||
'RUB',
|
||||
'INR',
|
||||
);
|
||||
return in_array( $currency, $supported_currencies, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Is Klarna Checkout country supported.
|
||||
*
|
||||
* @param string $country_code Country code.
|
||||
*/
|
||||
|
@ -1091,7 +1170,7 @@ class WC_Admin_Setup_Wizard {
|
|||
}
|
||||
|
||||
/**
|
||||
* Is Klarna Payments country supported
|
||||
* Is Klarna Payments country supported.
|
||||
*
|
||||
* @param string $country_code Country code.
|
||||
*/
|
||||
|
@ -1181,7 +1260,7 @@ class WC_Admin_Setup_Wizard {
|
|||
|
||||
return array(
|
||||
'stripe' => array(
|
||||
'name' => __( 'Stripe', 'woocommerce' ),
|
||||
'name' => __( 'WooCommerce Stripe Gateway', 'woocommerce' ),
|
||||
'image' => WC()->plugin_url() . '/assets/images/stripe.png',
|
||||
'description' => $stripe_description,
|
||||
'class' => 'checked stripe-logo',
|
||||
|
@ -1193,19 +1272,20 @@ class WC_Admin_Setup_Wizard {
|
|||
'value' => 'yes',
|
||||
'placeholder' => '',
|
||||
'required' => false,
|
||||
'plugins' => $this->get_wcs_requisite_plugins(),
|
||||
),
|
||||
'email' => array(
|
||||
'label' => __( 'Stripe email address:', 'woocommerce' ),
|
||||
'type' => 'email',
|
||||
'value' => $user_email,
|
||||
'placeholder' => __( 'Stripe email address', 'woocommerce' ),
|
||||
'description' => __( "Enter your email address and we'll handle account creation. WooCommerce Services and Jetpack will be installed and activated for you.", 'woocommerce' ),
|
||||
'description' => __( "Enter your email address and we'll handle account creation. Powered by WooCommerce Services and Jetpack.", 'woocommerce' ),
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
'ppec_paypal' => array(
|
||||
'name' => __( 'PayPal Express Checkout', 'woocommerce' ),
|
||||
'name' => __( 'WooCommerce PayPal Express Checkout Gateway', 'woocommerce' ),
|
||||
'image' => WC()->plugin_url() . '/assets/images/paypal.png',
|
||||
'description' => $paypal_ec_description,
|
||||
'enabled' => true,
|
||||
|
@ -1218,13 +1298,14 @@ class WC_Admin_Setup_Wizard {
|
|||
'value' => 'yes',
|
||||
'placeholder' => '',
|
||||
'required' => false,
|
||||
'plugins' => $this->get_wcs_requisite_plugins(),
|
||||
),
|
||||
'email' => array(
|
||||
'label' => __( 'Direct payments to email address:', 'woocommerce' ),
|
||||
'type' => 'email',
|
||||
'value' => $user_email,
|
||||
'placeholder' => __( 'Email address to receive payments', 'woocommerce' ),
|
||||
'description' => __( "Enter your email address and we'll authenticate payments for you. WooCommerce Services and Jetpack will be installed and activated for you.", 'woocommerce' ),
|
||||
'description' => __( "Enter your email address and we'll authenticate payments for you. Powered by WooCommerce Services and Jetpack.", 'woocommerce' ),
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
|
@ -1244,7 +1325,7 @@ class WC_Admin_Setup_Wizard {
|
|||
),
|
||||
),
|
||||
'klarna_checkout' => array(
|
||||
'name' => __( 'Klarna Checkout', 'woocommerce' ),
|
||||
'name' => __( 'Klarna Checkout for WooCommerce', 'woocommerce' ),
|
||||
'description' => $klarna_checkout_description,
|
||||
'image' => WC()->plugin_url() . '/assets/images/klarna-white.png',
|
||||
'enabled' => true,
|
||||
|
@ -1252,7 +1333,7 @@ class WC_Admin_Setup_Wizard {
|
|||
'repo-slug' => 'klarna-checkout-for-woocommerce',
|
||||
),
|
||||
'klarna_payments' => array(
|
||||
'name' => __( 'Klarna Payments', 'woocommerce' ),
|
||||
'name' => __( 'Klarna Payments for WooCommerce', 'woocommerce' ),
|
||||
'description' => $klarna_payments_description,
|
||||
'image' => WC()->plugin_url() . '/assets/images/klarna-white.png',
|
||||
'enabled' => true,
|
||||
|
@ -1260,7 +1341,7 @@ class WC_Admin_Setup_Wizard {
|
|||
'repo-slug' => 'klarna-payments-for-woocommerce',
|
||||
),
|
||||
'square' => array(
|
||||
'name' => __( 'Square', 'woocommerce' ),
|
||||
'name' => __( 'WooCommerce Square', 'woocommerce' ),
|
||||
'description' => $square_description,
|
||||
'image' => WC()->plugin_url() . '/assets/images/square-white.png',
|
||||
'class' => 'square-logo',
|
||||
|
@ -1268,7 +1349,7 @@ class WC_Admin_Setup_Wizard {
|
|||
'repo-slug' => 'woocommerce-square',
|
||||
),
|
||||
'eway' => array(
|
||||
'name' => __( 'eWAY', 'woocommerce' ),
|
||||
'name' => __( 'WooCommerce eWAY Gateway', 'woocommerce' ),
|
||||
'description' => __( 'The eWAY extension for WooCommerce allows you to take credit card payments directly on your store without redirecting your customers to a third party site to make payment.', 'woocommerce' ),
|
||||
'image' => WC()->plugin_url() . '/assets/images/eway-logo.jpg',
|
||||
'enabled' => false,
|
||||
|
@ -1276,12 +1357,12 @@ class WC_Admin_Setup_Wizard {
|
|||
'repo-slug' => 'woocommerce-gateway-eway',
|
||||
),
|
||||
'payfast' => array(
|
||||
'name' => __( 'PayFast', 'woocommerce' ),
|
||||
'name' => __( 'WooCommerce PayFast Gateway', 'woocommerce' ),
|
||||
'description' => __( 'The PayFast extension for WooCommerce enables you to accept payments by Credit Card and EFT via one of South Africa’s most popular payment gateways. No setup fees or monthly subscription costs.', 'woocommerce' ),
|
||||
'image' => WC()->plugin_url() . '/assets/images/payfast.png',
|
||||
'class' => 'payfast-logo',
|
||||
'enabled' => false,
|
||||
'repo-slug' => 'woocommerce-gateway-payfast',
|
||||
'repo-slug' => 'woocommerce-payfast-gateway',
|
||||
'file' => 'gateway-payfast.php',
|
||||
),
|
||||
);
|
||||
|
@ -1294,15 +1375,19 @@ class WC_Admin_Setup_Wizard {
|
|||
*/
|
||||
public function get_wizard_in_cart_payment_gateways() {
|
||||
$gateways = $this->get_wizard_available_in_cart_payment_gateways();
|
||||
$country = WC()->countries->get_base_country();
|
||||
$currency = get_woocommerce_currency();
|
||||
|
||||
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||
return array( 'paypal' => $gateways['paypal'] );
|
||||
}
|
||||
|
||||
$country = WC()->countries->get_base_country();
|
||||
$can_stripe = $this->is_stripe_supported_country( $country );
|
||||
$can_eway = $this->is_eway_payments_supported_country( $country );
|
||||
$can_payfast = ( 'ZA' === $country ); // South Africa.
|
||||
$can_paypal = $this->is_paypal_supported_currency( $currency );
|
||||
|
||||
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||
return $can_paypal ? array( 'paypal' => $gateways['paypal'] ) : array();
|
||||
}
|
||||
|
||||
$spotlight = '';
|
||||
|
||||
if ( $this->is_klarna_checkout_supported_country( $country ) ) {
|
||||
$spotlight = 'klarna_checkout';
|
||||
|
@ -1312,12 +1397,15 @@ class WC_Admin_Setup_Wizard {
|
|||
$spotlight = 'square';
|
||||
}
|
||||
|
||||
if ( isset( $spotlight ) ) {
|
||||
if ( $spotlight ) {
|
||||
$offered_gateways = array(
|
||||
$spotlight => $gateways[ $spotlight ],
|
||||
'ppec_paypal' => $gateways['ppec_paypal'],
|
||||
$spotlight => $gateways[ $spotlight ],
|
||||
);
|
||||
|
||||
if ( $can_paypal ) {
|
||||
$offered_gateways += array( 'ppec_paypal' => $gateways['ppec_paypal'] );
|
||||
}
|
||||
|
||||
if ( $can_stripe ) {
|
||||
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
|
||||
}
|
||||
|
@ -1341,7 +1429,9 @@ class WC_Admin_Setup_Wizard {
|
|||
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
|
||||
}
|
||||
|
||||
$offered_gateways += array( 'ppec_paypal' => $gateways['ppec_paypal'] );
|
||||
if ( $can_paypal ) {
|
||||
$offered_gateways += array( 'ppec_paypal' => $gateways['ppec_paypal'] );
|
||||
}
|
||||
|
||||
if ( $can_eway ) {
|
||||
$offered_gateways += array( 'eway' => $gateways['eway'] );
|
||||
|
@ -1406,6 +1496,15 @@ class WC_Admin_Setup_Wizard {
|
|||
$should_enable_toggle = isset( $item_info['enabled'] ) && $item_info['enabled'];
|
||||
}
|
||||
|
||||
$plugins = null;
|
||||
if ( isset( $item_info['repo-slug'] ) ) {
|
||||
$plugin = array(
|
||||
'slug' => $item_info['repo-slug'],
|
||||
'name' => $item_info['name'],
|
||||
);
|
||||
$plugins = array( $plugin );
|
||||
}
|
||||
|
||||
?>
|
||||
<li class="<?php echo esc_attr( $item_class ); ?>">
|
||||
<div class="wc-wizard-service-name">
|
||||
|
@ -1452,6 +1551,7 @@ class WC_Admin_Setup_Wizard {
|
|||
placeholder="<?php echo esc_attr( $setting['placeholder'] ); ?>"
|
||||
<?php echo ( $setting['required'] ) ? 'required' : ''; ?>
|
||||
<?php echo $is_checkbox ? checked( isset( $checked ) && $checked, true, false ) : ''; ?>
|
||||
data-plugins="<?php echo esc_attr( wp_json_encode( isset( $setting['plugins'] ) ? $setting['plugins'] : null ) ); ?>"
|
||||
/>
|
||||
<?php if ( ! empty( $setting['description'] ) ) : ?>
|
||||
<span class="wc-wizard-service-settings-description"><?php echo esc_html( $setting['description'] ); ?></span>
|
||||
|
@ -1468,6 +1568,7 @@ class WC_Admin_Setup_Wizard {
|
|||
type="checkbox"
|
||||
name="wc-wizard-service-<?php echo esc_attr( $item_id ); ?>-enabled"
|
||||
value="yes" <?php checked( $should_enable_toggle ); ?>
|
||||
data-plugins="<?php echo esc_attr( wp_json_encode( $plugins ) ); ?>"
|
||||
/>
|
||||
<label for="wc-wizard-service-<?php echo esc_attr( $item_id ); ?>">
|
||||
</span>
|
||||
|
@ -1561,6 +1662,7 @@ class WC_Admin_Setup_Wizard {
|
|||
?>
|
||||
</ul>
|
||||
<p class="wc-setup-actions step">
|
||||
<?php $this->plugin_install_info(); ?>
|
||||
<button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
|
||||
<?php wp_nonce_field( 'wc-setup' ); ?>
|
||||
</p>
|
||||
|
@ -1628,14 +1730,16 @@ class WC_Admin_Setup_Wizard {
|
|||
$img_url = $item_info['img_url'];
|
||||
$img_alt = $item_info['img_alt'];
|
||||
?>
|
||||
<li>
|
||||
<label class="recommended-item">
|
||||
<input
|
||||
class="recommended-item-checkbox"
|
||||
type="checkbox"
|
||||
name="<?php echo esc_attr( 'setup_' . $type ); ?>"
|
||||
value="yes"
|
||||
checked />
|
||||
<li class="recommended-item checkbox">
|
||||
<input
|
||||
id="<?php echo esc_attr( 'wc_recommended_' . $type ); ?>"
|
||||
type="checkbox"
|
||||
name="<?php echo esc_attr( 'setup_' . $type ); ?>"
|
||||
value="yes"
|
||||
checked
|
||||
data-plugins="<?php echo esc_attr( wp_json_encode( isset( $item_info['plugins'] ) ? $item_info['plugins'] : null ) ); ?>"
|
||||
/>
|
||||
<label for="<?php echo esc_attr( 'wc_recommended_' . $type ); ?>">
|
||||
<img
|
||||
src="<?php echo esc_url( $img_url ); ?>"
|
||||
class="<?php echo esc_attr( 'recommended-item-icon-' . $type ); ?> recommended-item-icon"
|
||||
|
@ -1701,6 +1805,7 @@ class WC_Admin_Setup_Wizard {
|
|||
'description' => __( 'Save time and errors with automated tax calculation and collection at checkout. Powered by WooCommerce Services and Jetpack.', 'woocommerce' ),
|
||||
'img_url' => WC()->plugin_url() . '/assets/images/obw-taxes-icon.svg',
|
||||
'img_alt' => __( 'automated taxes icon', 'woocommerce' ),
|
||||
'plugins' => $this->get_wcs_requisite_plugins(),
|
||||
) );
|
||||
endif;
|
||||
|
||||
|
@ -1711,11 +1816,13 @@ class WC_Admin_Setup_Wizard {
|
|||
'description' => __( 'Join the 16 million customers who use MailChimp. Sync list and store data to send automated emails, and targeted campaigns.', 'woocommerce' ),
|
||||
'img_url' => WC()->plugin_url() . '/assets/images/obw-mailchimp-icon.svg',
|
||||
'img_alt' => __( 'MailChimp icon', 'woocommerce' ),
|
||||
'plugins' => array( array( 'name' => __( 'MailChimp for WooCommerce', 'woocommerce' ), 'slug' => 'mailchimp-for-woocommerce' ) ),
|
||||
) );
|
||||
endif;
|
||||
?>
|
||||
</ul>
|
||||
<p class="wc-setup-actions step">
|
||||
<?php $this->plugin_install_info(); ?>
|
||||
<button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
|
||||
<?php wp_nonce_field( 'wc-setup' ); ?>
|
||||
</p>
|
||||
|
|
|
@ -2,13 +2,11 @@
|
|||
/**
|
||||
* Debug/Status page
|
||||
*
|
||||
* @package WooCommerce/Admin/System Status
|
||||
* @version 2.2.0
|
||||
* @package WooCommerce/Admin/System Status
|
||||
* @version 2.2.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Admin_Status Class.
|
||||
|
@ -35,9 +33,9 @@ class WC_Admin_Status {
|
|||
public static function status_tools() {
|
||||
$tools = self::get_tools();
|
||||
|
||||
if ( ! empty( $_GET['action'] ) && ! empty( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'debug_action' ) ) {
|
||||
if ( ! empty( $_GET['action'] ) && ! empty( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'debug_action' ) ) { // WPCS: input var ok, sanitization ok.
|
||||
$tools_controller = new WC_REST_System_Status_Tools_Controller();
|
||||
$action = wc_clean( $_GET['action'] );
|
||||
$action = wc_clean( wp_unslash( $_GET['action'] ) ); // WPCS: input var ok.
|
||||
|
||||
if ( array_key_exists( $action, $tools ) ) {
|
||||
$response = $tools_controller->execute_tool( $action );
|
||||
|
@ -55,9 +53,9 @@ class WC_Admin_Status {
|
|||
}
|
||||
}
|
||||
|
||||
// Display message if settings settings have been saved
|
||||
if ( isset( $_REQUEST['settings-updated'] ) ) {
|
||||
echo '<div class="updated inline"><p>' . __( 'Your changes have been saved.', 'woocommerce' ) . '</p></div>';
|
||||
// Display message if settings settings have been saved.
|
||||
if ( isset( $_REQUEST['settings-updated'] ) ) { // WPCS: input var ok.
|
||||
echo '<div class="updated inline"><p>' . esc_html__( 'Your changes have been saved.', 'woocommerce' ) . '</p></div>';
|
||||
}
|
||||
|
||||
include_once dirname( __FILE__ ) . '/views/html-admin-page-status-tools.php';
|
||||
|
@ -88,18 +86,17 @@ class WC_Admin_Status {
|
|||
* Show the log page contents for file log handler.
|
||||
*/
|
||||
public static function status_logs_file() {
|
||||
|
||||
$logs = self::scan_log_files();
|
||||
|
||||
if ( ! empty( $_REQUEST['log_file'] ) && isset( $logs[ sanitize_title( $_REQUEST['log_file'] ) ] ) ) {
|
||||
$viewed_log = $logs[ sanitize_title( $_REQUEST['log_file'] ) ];
|
||||
if ( ! empty( $_REQUEST['log_file'] ) && isset( $logs[ sanitize_title( wp_unslash( $_REQUEST['log_file'] ) ) ] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
$viewed_log = $logs[ sanitize_title( wp_unslash( $_REQUEST['log_file'] ) ) ]; // WPCS: input var ok, CSRF ok.
|
||||
} elseif ( ! empty( $logs ) ) {
|
||||
$viewed_log = current( $logs );
|
||||
}
|
||||
|
||||
$handle = ! empty( $viewed_log ) ? self::get_log_file_handle( $viewed_log ) : '';
|
||||
|
||||
if ( ! empty( $_REQUEST['handle'] ) ) {
|
||||
if ( ! empty( $_REQUEST['handle'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
self::remove_log();
|
||||
}
|
||||
|
||||
|
@ -110,14 +107,11 @@ class WC_Admin_Status {
|
|||
* Show the log page contents for db log handler.
|
||||
*/
|
||||
public static function status_logs_db() {
|
||||
|
||||
// Flush
|
||||
if ( ! empty( $_REQUEST['flush-logs'] ) ) {
|
||||
if ( ! empty( $_REQUEST['flush-logs'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
self::flush_db_logs();
|
||||
}
|
||||
|
||||
// Bulk actions
|
||||
if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['log'] ) ) {
|
||||
if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['log'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
self::log_table_bulk_actions();
|
||||
}
|
||||
|
||||
|
@ -131,24 +125,24 @@ class WC_Admin_Status {
|
|||
* Retrieve metadata from a file. Based on WP Core's get_file_data function.
|
||||
*
|
||||
* @since 2.1.1
|
||||
* @param string $file Path to the file
|
||||
* @param string $file Path to the file.
|
||||
* @return string
|
||||
*/
|
||||
public static function get_file_version( $file ) {
|
||||
|
||||
// Avoid notices if file does not exist
|
||||
// Avoid notices if file does not exist.
|
||||
if ( ! file_exists( $file ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// We don't need to write to the file, so just open for reading.
|
||||
$fp = fopen( $file, 'r' );
|
||||
$fp = fopen( $file, 'r' ); // @codingStandardsIgnoreLine.
|
||||
|
||||
// Pull only the first 8kiB of the file in.
|
||||
$file_data = fread( $fp, 8192 );
|
||||
$file_data = fread( $fp, 8192 ); // @codingStandardsIgnoreLine.
|
||||
|
||||
// PHP will close file handle, but we are good citizens.
|
||||
fclose( $fp );
|
||||
fclose( $fp ); // @codingStandardsIgnoreLine.
|
||||
|
||||
// Make sure we catch CR-only line endings.
|
||||
$file_data = str_replace( "\r", "\n", $file_data );
|
||||
|
@ -164,7 +158,7 @@ class WC_Admin_Status {
|
|||
/**
|
||||
* Return the log file handle.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $filename Filename to get the handle for.
|
||||
* @return string
|
||||
*/
|
||||
public static function get_log_file_handle( $filename ) {
|
||||
|
@ -174,19 +168,18 @@ class WC_Admin_Status {
|
|||
/**
|
||||
* Scan the template files.
|
||||
*
|
||||
* @param string $template_path
|
||||
* @param string $template_path Path to the template directory.
|
||||
* @return array
|
||||
*/
|
||||
public static function scan_template_files( $template_path ) {
|
||||
|
||||
$files = @scandir( $template_path );
|
||||
$files = @scandir( $template_path ); // @codingStandardsIgnoreLine.
|
||||
$result = array();
|
||||
|
||||
if ( ! empty( $files ) ) {
|
||||
|
||||
foreach ( $files as $key => $value ) {
|
||||
|
||||
if ( ! in_array( $value, array( '.', '..' ) ) ) {
|
||||
if ( ! in_array( $value, array( '.', '..' ), true ) ) {
|
||||
|
||||
if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) {
|
||||
$sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value );
|
||||
|
@ -208,22 +201,7 @@ class WC_Admin_Status {
|
|||
* @return array
|
||||
*/
|
||||
public static function scan_log_files() {
|
||||
$files = @scandir( WC_LOG_DIR );
|
||||
$result = array();
|
||||
|
||||
if ( ! empty( $files ) ) {
|
||||
|
||||
foreach ( $files as $key => $value ) {
|
||||
|
||||
if ( ! in_array( $value, array( '.', '..' ) ) ) {
|
||||
if ( ! is_dir( $value ) && strstr( $value, '.log' ) ) {
|
||||
$result[ sanitize_title( $value ) ] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
return WC_Log_Handler_File::get_log_files();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,9 +230,10 @@ class WC_Admin_Status {
|
|||
if ( is_object( $api ) && ! is_wp_error( $api ) ) {
|
||||
$update_theme_version = $api->version;
|
||||
} elseif ( strstr( $theme->{'Author URI'}, 'woothemes' ) ) { // Check WooThemes Theme Version.
|
||||
$theme_dir = substr( strtolower( str_replace( ' ', '', $theme->Name ) ), 0, 45 );
|
||||
$theme_dir = substr( strtolower( str_replace( ' ', '', $theme->Name ) ), 0, 45 ); // @codingStandardsIgnoreLine.
|
||||
$theme_version_data = get_transient( $theme_dir . '_version_data' );
|
||||
|
||||
if ( false === ( $theme_version_data = get_transient( $theme_dir . '_version_data' ) ) ) {
|
||||
if ( false === $theme_version_data ) {
|
||||
$theme_changelog = wp_safe_remote_get( 'http://dzv365zjfbd8v.cloudfront.net/changelogs/' . $theme_dir . '/changelog.txt' );
|
||||
$cl_lines = explode( "\n", wp_remote_retrieve_body( $theme_changelog ) );
|
||||
if ( ! empty( $cl_lines ) ) {
|
||||
|
@ -288,13 +267,13 @@ class WC_Admin_Status {
|
|||
* Remove/delete the chosen file.
|
||||
*/
|
||||
public static function remove_log() {
|
||||
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'remove_log' ) ) {
|
||||
wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
||||
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'remove_log' ) ) { // WPCS: input var ok, sanitization ok.
|
||||
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
if ( ! empty( $_REQUEST['handle'] ) ) {
|
||||
if ( ! empty( $_REQUEST['handle'] ) ) { // WPCS: input var ok.
|
||||
$log_handler = new WC_Log_Handler_File();
|
||||
$log_handler->remove( $_REQUEST['handle'] );
|
||||
$log_handler->remove( wp_unslash( $_REQUEST['handle'] ) ); // WPCS: input var ok, sanitization ok.
|
||||
}
|
||||
|
||||
wp_safe_redirect( esc_url_raw( admin_url( 'admin.php?page=wc-status&tab=logs' ) ) );
|
||||
|
@ -307,8 +286,8 @@ class WC_Admin_Status {
|
|||
* @since 3.0.0
|
||||
*/
|
||||
private static function flush_db_logs() {
|
||||
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-status-logs' ) ) {
|
||||
wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
||||
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-status-logs' ) ) { // WPCS: input var ok, sanitization ok.
|
||||
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
WC_Log_Handler_DB::flush();
|
||||
|
@ -323,13 +302,13 @@ class WC_Admin_Status {
|
|||
* @since 3.0.0
|
||||
*/
|
||||
private static function log_table_bulk_actions() {
|
||||
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-status-logs' ) ) {
|
||||
wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
||||
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-status-logs' ) ) { // WPCS: input var ok, sanitization ok.
|
||||
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$log_ids = array_map( 'absint', (array) $_REQUEST['log'] );
|
||||
$log_ids = array_map( 'absint', (array) isset( $_REQUEST['log'] ) ? wp_unslash( $_REQUEST['log'] ) : array() ); // WPCS: input var ok, sanitization ok.
|
||||
|
||||
if ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) {
|
||||
if ( ( isset( $_REQUEST['action'] ) && 'delete' === $_REQUEST['action'] ) || ( isset( $_REQUEST['action2'] ) && 'delete' === $_REQUEST['action2'] ) ) { // WPCS: input var ok, sanitization ok.
|
||||
WC_Log_Handler_DB::delete( $log_ids );
|
||||
wp_safe_redirect( esc_url_raw( admin_url( 'admin.php?page=wc-status&tab=logs' ) ) );
|
||||
exit();
|
||||
|
|
|
@ -69,7 +69,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
|||
* @return string
|
||||
*/
|
||||
public function column_title( $webhook ) {
|
||||
$edit_link = admin_url( 'admin.php?page=wc-settings&tab=api&section=webhooks&edit-webhook=' . $webhook->get_id() );
|
||||
$edit_link = admin_url( 'admin.php?page=wc-settings&tab=advanced&section=webhooks&edit-webhook=' . $webhook->get_id() );
|
||||
$output = '';
|
||||
|
||||
// Title.
|
||||
|
@ -175,7 +175,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
|||
$class = empty( $_REQUEST['status'] ) ? ' class="current"' : ''; // WPCS: input var okay. CSRF ok.
|
||||
|
||||
/* translators: %s: count */
|
||||
$status_links['all'] = "<a href='admin.php?page=wc-settings&tab=api&section=webhooks'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_webhooks, 'posts', 'woocommerce' ), number_format_i18n( $total_webhooks ) ) . '</a>';
|
||||
$status_links['all'] = "<a href='admin.php?page=wc-settings&tab=advanced&section=webhooks'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_webhooks, 'posts', 'woocommerce' ), number_format_i18n( $total_webhooks ) ) . '</a>';
|
||||
|
||||
foreach ( $statuses as $status_name ) {
|
||||
$class = '';
|
||||
|
@ -190,7 +190,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
|||
|
||||
$label = $this->get_status_label( $status_name, $num_webhooks[ $status_name ] );
|
||||
|
||||
$status_links[ $status_name ] = "<a href='admin.php?page=wc-settings&tab=api&section=webhooks&status=$status_name'$class>" . sprintf( translate_nooped_plural( $label, $num_webhooks[ $status_name ] ), number_format_i18n( $num_webhooks[ $status_name ] ) ) . '</a>';
|
||||
$status_links[ $status_name ] = "<a href='admin.php?page=wc-settings&tab=advanced&section=webhooks&status=$status_name'$class>" . sprintf( translate_nooped_plural( $label, $num_webhooks[ $status_name ] ), number_format_i18n( $num_webhooks[ $status_name ] ) ) . '</a>';
|
||||
}
|
||||
|
||||
return $status_links;
|
||||
|
|
|
@ -307,17 +307,8 @@ class WC_Helper_Updater {
|
|||
public static function flush_updates_cache() {
|
||||
delete_transient( '_woocommerce_helper_updates' );
|
||||
delete_transient( '_woocommerce_helper_updates_count' );
|
||||
|
||||
// Refresh update transients
|
||||
$update_plugins = get_site_transient( 'update_plugins' );
|
||||
if ( ! empty( $update_plugins ) ) {
|
||||
set_site_transient( 'update_plugins', $update_plugins );
|
||||
}
|
||||
|
||||
$update_themes = get_site_transient( 'update_themes' );
|
||||
if ( ! empty( $update_themes ) ) {
|
||||
set_site_transient( 'update_themes', $update_themes );
|
||||
}
|
||||
delete_site_transient( 'update_plugins' );
|
||||
delete_site_transient( 'update_themes' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -741,6 +741,7 @@ class WC_Helper {
|
|||
}
|
||||
|
||||
self::_flush_subscriptions_cache();
|
||||
self::_flush_updates_cache();
|
||||
|
||||
// Enable tracking when connected.
|
||||
if ( class_exists( 'WC_Tracker' ) ) {
|
||||
|
@ -858,6 +859,8 @@ class WC_Helper {
|
|||
}
|
||||
|
||||
self::_flush_subscriptions_cache();
|
||||
self::_flush_updates_cache();
|
||||
|
||||
$redirect_uri = add_query_arg(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
|
@ -1214,12 +1217,13 @@ class WC_Helper {
|
|||
}
|
||||
|
||||
if ( ! $activated ) {
|
||||
self::log( 'Could not activate a subscription upon plugin activation: ' . $$filename );
|
||||
self::log( 'Could not activate a subscription upon plugin activation: ' . $filename );
|
||||
return;
|
||||
}
|
||||
|
||||
self::log( 'Auto-activated a subscription for ' . $filename );
|
||||
self::_flush_subscriptions_cache();
|
||||
self::_flush_updates_cache();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1280,6 +1284,7 @@ class WC_Helper {
|
|||
if ( $deactivated ) {
|
||||
self::log( sprintf( 'Auto-deactivated %d subscription(s) for %s', $deactivated, $filename ) );
|
||||
self::_flush_subscriptions_cache();
|
||||
self::_flush_updates_cache();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ class WC_Product_CSV_Importer_Controller {
|
|||
);
|
||||
|
||||
// phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification -- Nonce already verified in WC_Product_CSV_Importer_Controller::upload_form_handler()
|
||||
$file_url = isset( $_POST['file_url'] ) ? esc_url_raw( wp_unslash( $_POST['file_url'] ) ) : '';
|
||||
$file_url = isset( $_POST['file_url'] ) ? wc_clean( wp_unslash( $_POST['file_url'] ) ) : '';
|
||||
|
||||
if ( empty( $file_url ) ) {
|
||||
if ( ! isset( $_FILES['import'] ) ) {
|
||||
|
@ -295,7 +295,7 @@ class WC_Product_CSV_Importer_Controller {
|
|||
'test_form' => false,
|
||||
'mimes' => $valid_filetypes,
|
||||
);
|
||||
$import = wp_unslash( $_FILES['import'] ); // WPCS: sanitization ok.
|
||||
$import = $_FILES['import']; // WPCS: sanitization ok, input var ok.
|
||||
$upload = wp_handle_upload( $import, $overrides );
|
||||
|
||||
if ( isset( $upload['error'] ) ) {
|
||||
|
|
|
@ -162,6 +162,8 @@ class WC_Tax_Rate_Importer extends WP_Importer {
|
|||
$tax_rate_id = WC_Tax::_insert_tax_rate( $tax_rate );
|
||||
WC_Tax::_update_tax_rate_postcodes( $tax_rate_id, wc_clean( $postcode ) );
|
||||
WC_Tax::_update_tax_rate_cities( $tax_rate_id, wc_clean( $city ) );
|
||||
|
||||
$row = fgetcsv( $handle, 0, $this->delimiter );
|
||||
}
|
||||
} else {
|
||||
$this->import_error( __( 'The CSV is invalid.', 'woocommerce' ) );
|
||||
|
@ -242,8 +244,8 @@ class WC_Tax_Rate_Importer extends WP_Importer {
|
|||
echo '<div class="narrow">';
|
||||
echo '<p>' . esc_html__( 'Hi there! Upload a CSV file containing tax rates to import the contents into your shop. Choose a .csv file to upload, then click "Upload file and import".', 'woocommerce' ) . '</p>';
|
||||
|
||||
/* translators: 1: Link to tax rates sample file */
|
||||
echo '<p>' . sprintf( esc_html__( 'Tax rates need to be defined with columns in a specific order (10 columns). <a href="%s">Click here to download a sample</a>.', 'woocommerce' ), esc_url( WC()->plugin_url() ) . '/sample-data/sample_tax_rates.csv' ) . '</p>';
|
||||
/* translators: 1: Link to tax rates sample file 2: Closing link. */
|
||||
echo '<p>' . sprintf( esc_html__( 'Your CSV needs to include columns in a specific order. %1$sClick here to download a sample%2$s.', 'woocommerce' ), '<a href="' . esc_url( WC()->plugin_url() ) . '/sample-data/sample_tax_rates.csv">', '</a>' ) . '</p>';
|
||||
|
||||
$action = 'admin.php?import=woocommerce_tax_rate_csv&step=1';
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<ol class="wc-progress-steps">
|
||||
<?php foreach ( $this->steps as $step_key => $step ) : ?>
|
||||
<?php
|
||||
$step_class = '';
|
||||
if ( $step_key === $this->step ) {
|
||||
$step_class = 'active';
|
||||
} elseif ( array_search( $this->step, array_keys( $this->steps ), true ) > array_search( $step_key, array_keys( $this->steps ), true ) ) {
|
||||
|
|