Flexible Shipping for WooCommerce - Version 4.0.5

Version Description

  • 2020-12-23 =
  • Fixed "Invalid argument supplied for foreach() shipping-method.php
Download this release

Release Info

Developer wpdesk
Plugin Icon 128x128 Flexible Shipping for WooCommerce
Version 4.0.5
Comparing to
See all releases

Code changes from version 4.0.4 to 4.0.5

classes/table-rate/shipping-method.php CHANGED
@@ -226,7 +226,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
226
  }
227
 
228
  public function get_shipping_methods( $enabled = false ) {
229
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
230
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
231
  $ret = array();
232
  if ( is_array( $shipping_method_order ) ) {
@@ -246,7 +246,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
246
  }
247
 
248
  private function get_shipping_method_order() {
249
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
250
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
251
  $ret = array();
252
  if ( is_array( $shipping_method_order ) ) {
@@ -360,7 +360,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
360
  }
361
 
362
  private function process_import_action() {
363
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
364
 
365
  if ( ! is_array( $shipping_methods ) ) {
366
  $shipping_methods = array();
@@ -392,7 +392,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
392
  <div class="<?php echo esc_html( $settings_div_class ) ; ?>"><table class="form-table">
393
  <?php
394
  if ( $action == 'new' || $action == 'edit' ) {
395
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
396
  $shipping_method = array(
397
  'method_title' => '',
398
  'method_description' => '',
@@ -428,7 +428,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
428
  <?php
429
  if ( isset( $_GET['added'] ) ) {
430
  $method_id = sanitize_key( $_GET['added'] );
431
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
432
  if ( isset( $shipping_methods[$method_id] ) )
433
  {
434
  if ( ! $this->message_added ) {
@@ -447,7 +447,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
447
  if ( isset( $_GET['methods_id'] ) ) {
448
  $methods_id = explode( ',' , sanitize_text_field( $_GET['methods_id'] ) );
449
  }
450
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
451
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
452
  foreach ( $methods_id as $method_id ) {
453
  if ( isset( $shipping_methods[$method_id] ) ) {
@@ -470,7 +470,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
470
  else {
471
  if ( isset( $_GET['added'] ) ) {
472
  $method_id = sanitize_key( $_GET['added'] );
473
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
474
  if ( isset( $shipping_methods[$method_id] ) )
475
  {
476
  if ( ! $this->message_added ) {
@@ -483,7 +483,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
483
  }
484
  if ( isset( $_GET['updated'] ) ) {
485
  $method_id = sanitize_key( $_GET['updated'] );
486
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
487
  if ( isset( $shipping_methods[$method_id] ) )
488
  {
489
  $shipping_method = $shipping_methods[$method_id];
@@ -756,4 +756,17 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
756
  return $modifier->append_beacon_search_data_to_fields( $form_fields );
757
  }
758
 
 
 
 
 
 
 
 
 
 
 
 
 
 
759
  }
226
  }
227
 
228
  public function get_shipping_methods( $enabled = false ) {
229
+ $shipping_methods = $this->get_option_shipping_methods();
230
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
231
  $ret = array();
232
  if ( is_array( $shipping_method_order ) ) {
246
  }
247
 
248
  private function get_shipping_method_order() {
249
+ $shipping_methods = $this->get_option_shipping_methods();
250
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
251
  $ret = array();
252
  if ( is_array( $shipping_method_order ) ) {
360
  }
361
 
362
  private function process_import_action() {
363
+ $shipping_methods = $this->get_option_shipping_methods();
364
 
365
  if ( ! is_array( $shipping_methods ) ) {
366
  $shipping_methods = array();
392
  <div class="<?php echo esc_html( $settings_div_class ) ; ?>"><table class="form-table">
393
  <?php
394
  if ( $action == 'new' || $action == 'edit' ) {
395
+ $shipping_methods = $this->get_option_shipping_methods();
396
  $shipping_method = array(
397
  'method_title' => '',
398
  'method_description' => '',
428
  <?php
429
  if ( isset( $_GET['added'] ) ) {
430
  $method_id = sanitize_key( $_GET['added'] );
431
+ $shipping_methods = $this->get_option_shipping_methods();
432
  if ( isset( $shipping_methods[$method_id] ) )
433
  {
434
  if ( ! $this->message_added ) {
447
  if ( isset( $_GET['methods_id'] ) ) {
448
  $methods_id = explode( ',' , sanitize_text_field( $_GET['methods_id'] ) );
449
  }
450
+ $shipping_methods = $this->get_option_shipping_methods();
451
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
452
  foreach ( $methods_id as $method_id ) {
453
  if ( isset( $shipping_methods[$method_id] ) ) {
470
  else {
471
  if ( isset( $_GET['added'] ) ) {
472
  $method_id = sanitize_key( $_GET['added'] );
473
+ $shipping_methods = $this->get_option_shipping_methods();
474
  if ( isset( $shipping_methods[$method_id] ) )
475
  {
476
  if ( ! $this->message_added ) {
483
  }
484
  if ( isset( $_GET['updated'] ) ) {
485
  $method_id = sanitize_key( $_GET['updated'] );
486
+ $shipping_methods = $this->get_option_shipping_methods();
487
  if ( isset( $shipping_methods[$method_id] ) )
488
  {
489
  $shipping_method = $shipping_methods[$method_id];
756
  return $modifier->append_beacon_search_data_to_fields( $form_fields );
757
  }
758
 
759
+ /**
760
+ * @return array
761
+ */
762
+ private function get_option_shipping_methods() {
763
+ $shipping_methods = get_option( $this->shipping_methods_option, array() );
764
+
765
+ if ( ! is_array( $shipping_methods ) ) {
766
+ $shipping_methods = array();
767
+ }
768
+
769
+ return $shipping_methods;
770
+ }
771
+
772
  }
flexible-shipping.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Flexible Shipping
4
  * Plugin URI: https://wordpress.org/plugins/flexible-shipping/
5
  * Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
6
- * Version: 4.0.4
7
  * Author: WP Desk
8
  * Author URI: https://flexibleshipping.com/?utm_source=plugin-list&utm_medium=link&utm_campaign=flexible-shipping-plugin-list
9
  * Text Domain: flexible-shipping
@@ -38,7 +38,7 @@ if ( ! defined( 'ABSPATH' ) ) {
38
  } // Exit if accessed directly
39
 
40
  /* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
41
- $plugin_version = '4.0.4';
42
 
43
  $plugin_name = 'Flexible Shipping';
44
  $product_id = 'Flexible Shipping';
3
  * Plugin Name: Flexible Shipping
4
  * Plugin URI: https://wordpress.org/plugins/flexible-shipping/
5
  * Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
6
+ * Version: 4.0.5
7
  * Author: WP Desk
8
  * Author URI: https://flexibleshipping.com/?utm_source=plugin-list&utm_medium=link&utm_campaign=flexible-shipping-plugin-list
9
  * Text Domain: flexible-shipping
38
  } // Exit if accessed directly
39
 
40
  /* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
41
+ $plugin_version = '4.0.5';
42
 
43
  $plugin_name = 'Flexible Shipping';
44
  $product_id = 'Flexible Shipping';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flexibleshipping.com/table-rate/
4
  Tags: table rate, table rate shipping, conditional shipping, shipping method, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes, shipping, free shipping, advanced shipping
5
  Requires at least: 4.5
6
  Tested up to: 5.6
7
- Stable tag: 4.0.4
8
  Requires PHP: 7.0
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -163,6 +163,8 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
163
 
164
  == Changelog ==
165
 
 
 
166
 
167
  = 4.0.4 - 2020-12-22 =
168
  * Fixed free shipping notice functionality
4
  Tags: table rate, table rate shipping, conditional shipping, shipping method, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes, shipping, free shipping, advanced shipping
5
  Requires at least: 4.5
6
  Tested up to: 5.6
7
+ Stable tag: 4.0.5
8
  Requires PHP: 7.0
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
163
 
164
  == Changelog ==
165
 
166
+ = 4.0.5 - 2020-12-23 =
167
+ * Fixed "Invalid argument supplied for foreach() shipping-method.php
168
 
169
  = 4.0.4 - 2020-12-22 =
170
  * Fixed free shipping notice functionality
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit95646562a6e168e95a3c26c615893989::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit2bb1fc42f3b0e6bcb4c9f50161879719::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit95646562a6e168e95a3c26c615893989
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit95646562a6e168e95a3c26c615893989
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit95646562a6e168e95a3c26c615893989', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit95646562a6e168e95a3c26c615893989', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit95646562a6e168e95a3c26c615893989::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit95646562a6e168e95a3c26c615893989
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInit95646562a6e168e95a3c26c615893989::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequire95646562a6e168e95a3c26c615893989($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequire95646562a6e168e95a3c26c615893989($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit2bb1fc42f3b0e6bcb4c9f50161879719
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit2bb1fc42f3b0e6bcb4c9f50161879719', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit2bb1fc42f3b0e6bcb4c9f50161879719', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire2bb1fc42f3b0e6bcb4c9f50161879719($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire2bb1fc42f3b0e6bcb4c9f50161879719($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit95646562a6e168e95a3c26c615893989
8
  {
9
  public static $files = array (
10
  '0509b34a4bd7aebefeac629c9dc8a978' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/notice-functions.php',
@@ -596,10 +596,10 @@ class ComposerStaticInit95646562a6e168e95a3c26c615893989
596
  public static function getInitializer(ClassLoader $loader)
597
  {
598
  return \Closure::bind(function () use ($loader) {
599
- $loader->prefixLengthsPsr4 = ComposerStaticInit95646562a6e168e95a3c26c615893989::$prefixLengthsPsr4;
600
- $loader->prefixDirsPsr4 = ComposerStaticInit95646562a6e168e95a3c26c615893989::$prefixDirsPsr4;
601
- $loader->fallbackDirsPsr4 = ComposerStaticInit95646562a6e168e95a3c26c615893989::$fallbackDirsPsr4;
602
- $loader->classMap = ComposerStaticInit95646562a6e168e95a3c26c615893989::$classMap;
603
 
604
  }, null, ClassLoader::class);
605
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719
8
  {
9
  public static $files = array (
10
  '0509b34a4bd7aebefeac629c9dc8a978' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/notice-functions.php',
596
  public static function getInitializer(ClassLoader $loader)
597
  {
598
  return \Closure::bind(function () use ($loader) {
599
+ $loader->prefixLengthsPsr4 = ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::$prefixLengthsPsr4;
600
+ $loader->prefixDirsPsr4 = ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::$prefixDirsPsr4;
601
+ $loader->fallbackDirsPsr4 = ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::$fallbackDirsPsr4;
602
+ $loader->classMap = ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::$classMap;
603
 
604
  }, null, ClassLoader::class);
605
  }