Commit Graph

541 Commits

Author SHA1 Message Date
roykho edd5463691
Simplied fix per comment 2021-06-29 06:41:16 -07:00
roykho bb2664d56a
Use a helper divider method to account for strings and zeros when dividing closes #29768 2021-06-25 13:30:04 -07:00
Christopher Allford 070954c888 Revert #28187
The default functionality within the `ThemeSupport` class has an unintended
side-effect of breaking the existing default functionality within the
`wc_get_theme_support()` function. Since the default set in the support
class is prioritized over the one given to `ThemeSupport::get_option()`,
the WordPress options set in the Customizer are never used for images.
2021-05-21 12:10:15 -07:00
vedanshujain 30cbf4638d Use constant instead of magic numbers. 2021-05-07 14:30:44 +05:30
Nestor Soriano 3a895c9eed
Move ThemeSupport class to Internal namespace, and use in 2021 theme. 2021-04-21 12:57:56 +02:00
Nestor Soriano d11a20b5b4
Merge branch 'trunk' into fix/25900-take-2 2021-04-20 16:08:45 +02:00
roykho 6c7c420d25
Set US:CA as the default store location 2021-04-12 09:28:30 -07:00
Claudio Sanches fc991ac418 Remove translation function 2021-03-17 12:50:52 -03:00
Claudio Sanches 5c6778a0dc Fix coding standards 2021-03-16 11:46:34 -03:00
Claudio Sanches 3f50ab3278 Handles errors in fault installations of PHP Intl 2021-03-15 17:48:49 -03:00
Peter Fabian 313ea8541c Remove compatibility checks for major version.
In addition to #28840, there are other places where we make use of compatibility check with major versions. I've discovered 2:
- update through /wp-admin/update-core.php
- force disabling auto-updates if there are any extensions that haven't declared their compatibility with WC 5.0

This change updates both places to be in line with the changes done in #28840.
2021-02-23 13:27:06 +01:00
Nestor Soriano 2c957d2531 Merge branch 'master' into fix/25900-take-2 2021-01-29 10:00:51 +01:00
Nestor Soriano c9ea5922e2 Add a comment to wc_ascii_uasort_comparison explaining why setlocale is needed. 2021-01-14 11:16:42 +01:00
Nestor Soriano 1d0b6b7cd9 Fix wc_ascii_uasort_comparison for PHP 8
In PHP 8 "iconv( 'UTF-8', 'ASCII//TRANSLIT')" doesn't work as expected:
instead of returning a proper substitute for non-ASCII characters
it returns "?". Temporarily changing the locale to C.UTF-8
fixes the issue.
2021-01-05 15:54:49 +01:00
Jeffrey Pearce bf8662bf67 Adds structure for Twenty Twenty One default theme support. Issue #27766
- New class class-wc-twenty-twenty-one.php
- New stylesheet twenty-twenty-one.scss
- Updates checks for default themes in theme_support_includes() and wc_is_wp_default_theme_active()
2020-11-16 06:41:39 -06:00
vedanshujain 3dd80d6d65 Add polyfill for wp_cache_get_multiple 2020-11-10 14:23:44 +05:30
Nestor Soriano d620f1d232 Fix #25900 - image size customisation controls not shown
- Added the `ThemeSupport class`, with methods to add and get
  theme support options.
  - It also has a new `add_default_options` method that adds the
    options under a `_defaults` key.
- The `WC_Twenty_*` classes now use `ThemeSupport` instead of
  the `add_theme_support` function to define image and thumbnail sizes.
  - The values are defined as default options.
- The `WC_Shop_Customizer` class now uses `ThemeSupport` instead of
  `wc_get_theme_support` to check if image and thumbnail sizes UI
  should be rendered.
  - The check is made excluding default values.

With these changes the UI to change the image and thumbnail sizes
is hidden only if the options are added as non-defaults elsewhere.

Additional changes:

- The code of the `wc_get_theme_support` function is replaced with
  a simple call to `get_option` in `ThemeSupport`.
- Added the utility class `ArrayUtil`.
2020-11-04 13:01:53 +01:00
Nestor Soriano cd443581cf Fix code sniffer errors 2020-11-04 12:39:45 +01:00
Néstor Soriano c15488d840
Merge pull request #27830 from woocommerce/php8/fix-round-function-with-non-numeric-argument 2020-10-09 08:01:44 +02:00
Nestor Soriano 52eed70f04 Add a 'NumberUtil' class with a 'round' method.
There's a number of places in the WooCommerce codebase where the
built-in function 'round' is executed passing a non-numeric value
(not a number and not a string that can be parsed as a number),
for example round(''). In PHP 7 this yields a value of 0, but in
PHP 8 this throws an error.

This commit adds a 'NumberUtil' class with a static 'round' method,
this method checks if the passed value is numeric and if so it just
executes the built-in function, otherwise it returns 0. And all the
calls to 'round' in the codebase are replaced with 'NumberUtil::round'.
2020-10-01 11:08:51 +02:00
Ron Rennick bb6ded857d phpcs fixes 2020-09-21 13:34:14 -03:00
Ron Rennick 57fa6aff83 update taxonomy template names from `_` to `-` 2020-09-21 13:30:29 -03:00
Claudio Sanches ed1a59b39b
Merge pull request #27416 from woocommerce/fix/27415
Fixed country list sorting
2020-09-17 10:35:43 -03:00
Claudio Sanches b5d8d94bc8 Use reference in wc_asort_by_locale 2020-09-10 16:02:39 -03:00
jonathansadowski 53c22ba4e4
Merge pull request #27508 from woocommerce/fix/27419
Fix filter by attribute widget now working for "Any..." attributes
2020-09-02 13:32:54 -05:00
Nestor Soriano 53351fcc2f Update wc_product_attribute_uasort_comparison to accept null entries
When set_attributes is used on WC_Product to remove existing attributes
the wc_product_attribute_uasort_comparison ends up being called
with a null argument, and this breaks tests in PHP 7.4 since
null is used as an array. This commit modifies the function so that
if null is passed no array access is attempted.
2020-08-31 16:49:29 +02:00
Claudio Sanches 5240682f38 Improve choice of words 2020-08-25 18:03:03 -03:00
Claudio Sanches 47aaac8600 Introduced wc_asort_by_locale() function 2020-08-19 20:22:18 -03:00
Claudio Sanches e547cb84e5 Reverted changes on wc_ascii_uasort_comparison 2020-08-19 20:02:14 -03:00
Claudio Sanches 74e94f86d0 Use WP remove_accents() instead of iconv 2020-08-19 18:58:45 -03:00
Nestor Soriano 29cf161415 Small changes after review feedback:
- Method and class renames.
- Removed unnecessary autoloader registration.
- Add a unit test for classes with non-object type hints
  in constructor arguments.
2020-07-24 09:24:06 +02:00
Nestor Soriano d5d02a7175 Fix code sniffer errors in wc-core-functions.php 2020-07-24 09:23:05 +02:00
Claudio Sanches 1de6bf0c28
Merge pull request #26515 from koko-ng/patch-1
Fix error message in wc_get_template
2020-07-01 13:27:05 -03:00
Claudio Sanches 4d2bafcc49
Merge pull request #26219 from woocommerce/fix/wc-load-cart
`wc_load_cart` should load it's own dependencies and include required core files
2020-07-01 13:10:04 -03:00
Ron Rennick dd5cd361bc introduce wc_set_template_cache(), wc_clear_template_cache() 2020-06-11 14:06:56 -03:00
Claudio Sanches 9d8af073cf
Update since tag to 4.3.0 2020-05-29 13:45:00 -03:00
Peter Fabian 2394da73b4 Merge branch 'master' into refactor/23783 2020-05-28 11:19:03 +02:00
Albert Juhé Lluveras 9a34c4fe75 Update WC shipping settings so no shipping zones banner appears when all are deactivated 2020-05-15 16:32:12 +02:00
Albert Juhé Lluveras 973e50ab64 Add param to wc_get_shipping_method_count() 2020-05-15 11:22:28 +02:00
Albert Juhé Lluveras de7ca06b41 Set is_enabled=1 instead of is_enabled=true 2020-05-15 11:02:12 +02:00
Albert Juhé Lluveras 33b0bef8c5 Add is_enabled=true check in wc_get_shipping_method_count() 2020-05-15 11:02:12 +02:00
koko 54db5f07c4
Fix error message in wc_get_template
If the filtered template does not exist the error should report the filtered template, not the original
2020-05-14 17:10:06 +02:00
Claudio Sanches 8e21f10b3d
Update since tags 2020-05-06 14:07:46 -03:00
Mike Jolley 88c7ad1bd2 Don't "get" cart 2020-04-20 12:47:20 +01:00
Mike Jolley 232ae16940 Load dependencies in wc_load_cart 2020-04-20 12:30:44 +01:00
Christopher Allford 2fedf9306e Corrected the filter prefix for get_path_define_tokens 2020-04-07 10:25:57 -07:00
Christopher Allford b43ad106ef Added WPMU_PLUGIN_DIR and removed the path define token for ABSPATH
There's no need for the ABSPATH define since the WC plugin is always a child of a plugin directory anyway.
2020-04-06 07:17:01 -07:00
Christopher Allford a7c0dec33a Added a function to fetch all of the path define tokens that may be present in template paths 2020-04-05 13:21:50 -07:00
Christopher Allford 33e81654a9 Made the path tokenization deterministic
Since the tokens are replaced in a first-discovered first-replaced order, we may accidentally create tokenized paths like '{{ABSPATH}}/test' instead of the desired '{{WP_CONTENT_DIR}}test'. By ordering them according to specificity however, we ensure that we tokenize as much of the path as possible.
2020-04-05 12:41:39 -07:00
Christopher Allford e270dfce2e Extracted the template path tokenization so that it can be applied to more than one define more readily 2020-04-05 12:06:04 -07:00