WooCommerce Germanized - Version 1.6.7

Version Description

  • Fix - Free Shipping Auto Select WC 2.6
  • Fix - Payment Gateways Shortcode
  • Fix - Fallback Library random_compat for Direct Debit Gateway Encryption
  • Fix - Removed Unused Hook from Direct Debit Gateway
  • Fix - Better Order Email Filter Removal
  • Fix - Direct Debit Checkbox Validation
  • Fix - Better Dependency Management
Download this release

Release Info

Developer vendidero
Plugin Icon 128x128 WooCommerce Germanized
Version 1.6.7
Comparing to
See all releases

Code changes from version 1.6.6 to 1.6.7

Files changed (22) hide show
  1. assets/css/woocommerce-gzd-admin.min.css +1 -1
  2. includes/admin/views/html-notice-dependencies.php +37 -20
  3. includes/class-wc-gzd-checkout.php +27 -3
  4. includes/class-wc-gzd-dependencies.php +137 -19
  5. includes/class-wc-gzd-emails.php +5 -6
  6. includes/class-wc-gzd-install.php +3 -0
  7. includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit-encryption-helper.php +4 -1
  8. includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php +11 -15
  9. includes/gateways/direct-debit/libraries/random-compat/LICENSE +22 -0
  10. includes/gateways/direct-debit/libraries/random-compat/lib/byte_safe_strings.php +181 -0
  11. includes/gateways/direct-debit/libraries/random-compat/lib/cast_to_int.php +71 -0
  12. includes/gateways/direct-debit/libraries/random-compat/lib/error_polyfill.php +49 -0
  13. includes/gateways/direct-debit/libraries/random-compat/lib/random.php +197 -0
  14. includes/gateways/direct-debit/libraries/random-compat/lib/random_bytes_com_dotnet.php +81 -0
  15. includes/gateways/direct-debit/libraries/random-compat/lib/random_bytes_dev_urandom.php +148 -0
  16. includes/gateways/direct-debit/libraries/random-compat/lib/random_bytes_libsodium.php +86 -0
  17. includes/gateways/direct-debit/libraries/random-compat/lib/random_bytes_libsodium_legacy.php +86 -0
  18. includes/gateways/direct-debit/libraries/random-compat/lib/random_bytes_mcrypt.php +76 -0
  19. includes/gateways/direct-debit/libraries/random-compat/lib/random_int.php +191 -0
  20. readme.txt +10 -1
  21. templates/global/payment-methods.php +6 -2
  22. woocommerce-germanized.php +6 -4
assets/css/woocommerce-gzd-admin.min.css CHANGED
@@ -1 +1 @@
1
- .wc-gzd-admin-settings,.wc-gzd-admin-settings-sidebar{display:inline-block;box-sizing:border-box;vertical-align:top}.wc-gzd-button,.wc-gzd-button:hover{box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15)!important;border:1px solid #557020!important;text-shadow:none!important}table.data_table tr td p.form-field{margin:0!important;padding:0!important}.variable_cart_mini_desc .wp-editor-tools{margin-top:-3em}.variable_cart_mini_desc_pre .wp-editor-tools{margin-top:-2em}.wc-gzd-admin-settings{width:70%;border-right:1px solid #CCC;padding-right:2%}.wc-gzd-admin-settings-sidebar{padding-left:2%;margin-left:-4px;width:30%}.wc-gzd-admin-settings-agbs,.wc-gzd-admin-settings-sidebar img,.wc-gzd-admin-settings-widerruf{width:100%}.wc-gzd-admin-settings-sidebar .browser{border:1px solid #CCC;border-radius:3px}.wc-gzd-admin-settings-sidebar .small{font-size:.9em;display:block;margin-top:.5em}._billing_address_1_field,._billing_title_field,._shipping_address_1_field,._shipping_title_field{width:100%!important}.wc-gzd-button{background-color:#7b9f35!important}.wc-gzd-button:hover{background-color:#73982a!important}.wc-gzd-button-wrapper .button{margin-right:1em}.wc-gzd-premium-section-tab,.wc-gzd-pro{font-size:9px;background:#0074a2;border-radius:3px;line-height:9px;color:#FFF;text-align:center;text-transform:uppercase;padding:1px 3px;position:relative;top:-1px}.wc-gzd-premium-section-tab{background:#e4e4e4;border:1px solid #CCC;color:#555;padding:0 3px}.wc-gzd-pro{background:#222;font-style:normal;opacity:1!important;text-decoration:none}.wc-gzd-pro:hover,.wc-gzd-pro:visited{color:#FFF}.tourbus-leg-inner .wc-gzd-pro{top:-3px}.forminp-image img,.wc-gzd-premium img{width:100%;height:auto;opacity:.7}.woocommerce table.form-table th.forminp-image{padding-right:0}._unit_price_auto_field .wc-gzd-premium-desc,._unit_price_auto_field input,._unit_price_auto_field label{opacity:.6}table.wc-gzd-tax-example tr td,table.wc-gzd-tax-example tr th{padding:5px;font-size:.9em}table.wc-gzd-tax-example tr td:first-child,table.wc-gzd-tax-example tr th:first-child{padding-left:0}.wc-gzd-admin-settings tbody.ui-sortable tr:hover{cursor:move}#order_data .order_data_column ._direct_debit_bic_field,#order_data .order_data_column ._direct_debit_holder_field,#order_data .order_data_column ._direct_debit_iban_field,#order_data .order_data_column ._direct_debit_reference_field{clear:left;width:100%!important}#order_data .order_data_column ._direct_debit_bic_field input,#order_data .order_data_column ._direct_debit_holder_field input,#order_data .order_data_column ._direct_debit_iban_field input,#order_data .order_data_column ._direct_debit_reference_field input{width:100%}.wc-gzd-text-red{color:red}.wc-gzd-status-text{font-weight:600}.wc-gzd-text-green{color:green}.order_actions .xml{display:block;text-indent:-9999px;position:relative;padding:0!important;height:2em!important;width:2em}.order_actions .xml:after{content:"\e00d";font-family:WooCommerce;text-indent:0;position:absolute;width:100%;height:100%;speak:none;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;top:0;left:0;line-height:1.85;margin:0;text-align:center;font-weight:400}
1
+ .woocommerce-gzd-message ul{margin-left:20px}.woocommerce-gzd-message ul li{list-style:disc}.wc-gzd-admin-settings,.wc-gzd-admin-settings-sidebar{display:inline-block;box-sizing:border-box;vertical-align:top}.wc-gzd-button,.wc-gzd-button:hover{box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15)!important;border:1px solid #557020!important;text-shadow:none!important}table.data_table tr td p.form-field{margin:0!important;padding:0!important}.variable_cart_mini_desc .wp-editor-tools{margin-top:-3em}.variable_cart_mini_desc_pre .wp-editor-tools{margin-top:-2em}.wc-gzd-admin-settings{width:70%;border-right:1px solid #CCC;padding-right:2%}.wc-gzd-admin-settings-sidebar{padding-left:2%;margin-left:-4px;width:30%}.wc-gzd-admin-settings-agbs,.wc-gzd-admin-settings-sidebar img,.wc-gzd-admin-settings-widerruf{width:100%}.wc-gzd-admin-settings-sidebar .browser{border:1px solid #CCC;border-radius:3px}.wc-gzd-admin-settings-sidebar .small{font-size:.9em;display:block;margin-top:.5em}._billing_address_1_field,._billing_title_field,._shipping_address_1_field,._shipping_title_field{width:100%!important}.wc-gzd-button{background-color:#7b9f35!important}.wc-gzd-button:hover{background-color:#73982a!important}.wc-gzd-button-wrapper .button{margin-right:1em}.wc-gzd-premium-section-tab,.wc-gzd-pro{font-size:9px;background:#0074a2;border-radius:3px;line-height:9px;color:#FFF;text-align:center;text-transform:uppercase;padding:1px 3px;position:relative;top:-1px}.wc-gzd-premium-section-tab{background:#e4e4e4;border:1px solid #CCC;color:#555;padding:0 3px}.wc-gzd-pro{background:#222;font-style:normal;opacity:1!important;text-decoration:none}.wc-gzd-pro:hover,.wc-gzd-pro:visited{color:#FFF}.tourbus-leg-inner .wc-gzd-pro{top:-3px}.forminp-image img,.wc-gzd-premium img{width:100%;height:auto;opacity:.7}.woocommerce table.form-table th.forminp-image{padding-right:0}._unit_price_auto_field .wc-gzd-premium-desc,._unit_price_auto_field input,._unit_price_auto_field label{opacity:.6}table.wc-gzd-tax-example tr td,table.wc-gzd-tax-example tr th{padding:5px;font-size:.9em}table.wc-gzd-tax-example tr td:first-child,table.wc-gzd-tax-example tr th:first-child{padding-left:0}.wc-gzd-admin-settings tbody.ui-sortable tr:hover{cursor:move}#order_data .order_data_column ._direct_debit_bic_field,#order_data .order_data_column ._direct_debit_holder_field,#order_data .order_data_column ._direct_debit_iban_field,#order_data .order_data_column ._direct_debit_reference_field{clear:left;width:100%!important}#order_data .order_data_column ._direct_debit_bic_field input,#order_data .order_data_column ._direct_debit_holder_field input,#order_data .order_data_column ._direct_debit_iban_field input,#order_data .order_data_column ._direct_debit_reference_field input{width:100%}.wc-gzd-text-red{color:red}.wc-gzd-status-text{font-weight:600}.wc-gzd-text-green{color:green}.order_actions .xml{display:block;text-indent:-9999px;position:relative;padding:0!important;height:2em!important;width:2em}.order_actions .xml:after{content:"\e00d";font-family:WooCommerce;text-indent:0;position:absolute;width:100%;height:100%;speak:none;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;top:0;left:0;line-height:1.85;margin:0;text-align:center;font-weight:400}
includes/admin/views/html-notice-dependencies.php CHANGED
@@ -6,49 +6,66 @@
6
  if ( ! defined( 'ABSPATH' ) )
7
  exit;
8
 
9
- $missing_count = 0;
10
- $version_count = 0;
11
-
12
  ?>
13
 
14
  <div id="message" class="error woocommerce-gzd-message wc-connect">
15
 
16
- <h3><?php _e( 'Dependencies Missing or Outdated', 'woocommerce-germanized' );?></h3>
17
 
18
- <?php foreach ( $dependencies->plugins_required as $plugin => $data ) : ?>
19
 
20
- <?php if ( ! $dependencies->is_plugin_activated( $plugin ) ) : $missing_count++ ?>
21
 
22
- <?php if ( $missing_count == 1 ) : ?>
23
 
24
- <p><?php _e( 'To use WooCommerce Germanized you may at first install the following plugins:', 'woocommerce-germanized' ); ?></p>
 
 
 
 
 
 
25
 
26
- <?php endif; ?>
27
 
28
- <p><a class="button button-secondary" href="<?php echo admin_url( "plugin-install.php?tab=search&s=" . urlencode( $data[ 'name' ] ) ); ?>"><?php printf( __( 'Install %s', 'woocommerce-germanized' ), $data[ 'name' ] ); ?></a></p>
29
 
30
- <?php endif; ?>
 
 
 
 
 
 
31
 
32
- <?php if ( $dependencies->is_plugin_outdated( $plugin ) ) : $version_count ++ ?>
33
 
34
- <?php if ( $version_count == 1 ) : ?>
35
 
36
- <p><?php _e( 'To use WooCommerce Germanized you may at first update the following plugins to a newer version:', 'woocommerce-germanized' ); ?></p>
37
 
38
- <?php endif; ?>
39
-
40
- <p>- <?php printf( __( '%s required in at least version %s', 'woocommerce-germanized' ), $data[ 'name' ], '<strong>' . $data[ 'version' ] . '</strong>' ); ?></p>
 
 
41
 
42
  <?php endif; ?>
43
 
44
  <?php endforeach; ?>
45
 
46
- <?php if ( $version_count > 0 ) : ?>
47
 
48
  <p>
49
  <a class="button button-secondary" href="<?php echo admin_url( "update-core.php" ); ?>"><?php _e( 'Check for Updates', 'woocommerce-germanized' ); ?></a>
50
- <?php _e( 'or', 'woocommerce-germanized' ); ?>
51
- <a class="" href="https://wordpress.org/plugins/woocommerce-germanized/developers/" target="_blank"><?php _e( 'Install an older version', 'woocommerce-germanized' ); ?></a>
 
 
 
 
 
 
52
  </p>
53
 
54
  <?php endif; ?>
6
  if ( ! defined( 'ABSPATH' ) )
7
  exit;
8
 
 
 
 
9
  ?>
10
 
11
  <div id="message" class="error woocommerce-gzd-message wc-connect">
12
 
13
+ <h3><?php _e( 'Dependencies missing, outdated or not yet tested', 'woocommerce-germanized' );?></h3>
14
 
15
+ <?php foreach ( $dependencies->plugins_result as $type => $plugins ) : ?>
16
 
17
+ <?php if ( $type === 'unactivated' && ! empty( $plugins ) ) : ?>
18
 
19
+ <p><?php _e( 'To use WooCommerce Germanized you may at first install the following plugins:', 'woocommerce-germanized' ); ?></p>
20
 
21
+ <ul>
22
+
23
+ <?php foreach ( $plugins as $plugin ) : ?>
24
+ <li><a class="" href="<?php echo admin_url( "plugin-install.php?tab=search&s=" . urlencode( $plugin[ 'name' ] ) ); ?>"><?php echo $plugin[ 'name' ]; ?></a></li>
25
+ <?php endforeach; ?>
26
+
27
+ </ul>
28
 
29
+ <?php elseif ( $type === 'outdated' && ! empty( $plugins ) ) : ?>
30
 
31
+ <p><?php _e( 'To use WooCommerce Germanized you may at first update the following plugins to a newer version:', 'woocommerce-germanized' ); ?></p>
32
 
33
+ <ul>
34
+
35
+ <?php foreach ( $plugins as $plugin ) : ?>
36
+ <li><?php printf( __( '%s required in at least version %s', 'woocommerce-germanized' ), $plugin[ 'name' ], '<strong>' . $plugin[ 'requires' ] . '</strong>' ); ?></li>
37
+ <?php endforeach; ?>
38
+
39
+ </ul>
40
 
41
+ <?php elseif ( $type === 'untested' && ! empty( $plugins ) ) : ?>
42
 
43
+ <p><?php _e( 'Seems like you are using a not yet supported version of a Plugin which Germanized requires. You may downgrade the Plugin or update to the latest version of Germanized.', 'woocommerce-germanized' ); ?></p>
44
 
45
+ <ul>
46
 
47
+ <?php foreach ( $plugins as $plugin => $plugin_data ) : ?>
48
+ <li><?php printf( __( '%s %s is not yet supported - you may install an %s', 'woocommerce-germanized' ), $plugin_data[ 'name' ], '<strong>' . $plugin_data[ 'version' ] . '</strong>', '<a href="https://wordpress.org/plugins/' . $plugin . '/developers/" target="_blank">' . __( 'older version', 'woocommerce-germanized' ) . '</a>' ); ?></li>
49
+ <?php endforeach; ?>
50
+
51
+ </ul>
52
 
53
  <?php endif; ?>
54
 
55
  <?php endforeach; ?>
56
 
57
+ <?php if ( ! empty( $dependencies->plugins_result[ 'outdated' ] ) || ! empty( $dependencies->plugins_result[ 'untested' ] ) ) : ?>
58
 
59
  <p>
60
  <a class="button button-secondary" href="<?php echo admin_url( "update-core.php" ); ?>"><?php _e( 'Check for Updates', 'woocommerce-germanized' ); ?></a>
61
+
62
+ <?php if ( ! empty( $dependencies->plugins_result[ 'outdated' ] ) ) : ?>
63
+
64
+ <?php _e( 'or', 'woocommerce-germanized' ); ?>
65
+
66
+ <a class="" href="https://wordpress.org/plugins/woocommerce-germanized/developers/" target="_blank"><?php _e( 'Install an older version', 'woocommerce-germanized' ); ?></a>
67
+
68
+ <?php endif; ?>
69
  </p>
70
 
71
  <?php endif; ?>
includes/class-wc-gzd-checkout.php CHANGED
@@ -97,12 +97,36 @@ class WC_GZD_Checkout {
97
  }
98
 
99
  public function free_shipping_auto_select( $rates ) {
100
- if ( ( is_checkout() || is_cart() ) && isset( $rates['free_shipping'] ) ) {
101
- foreach ( $rates as $key => $value ) {
102
- if ( 'free_shipping' !== $key )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  unset( $rates[ $key ] );
104
  }
105
  }
 
106
  return $rates;
107
  }
108
 
97
  }
98
 
99
  public function free_shipping_auto_select( $rates ) {
100
+
101
+ if ( ! is_checkout() && ! is_cart() )
102
+ return $rates;
103
+
104
+ $keep = '';
105
+
106
+ // Legacy Support
107
+ if ( isset( $rates[ 'free_shipping' ] ) ) {
108
+ $keep = 'free_shipping';
109
+ }
110
+
111
+ // Check for cost-free shipping
112
+ foreach ( $rates as $key => $rate ) {
113
+
114
+ if ( is_object( $rate ) && isset( $rate->cost ) && $rate->cost == 0 ) {
115
+ $keep = $key;
116
+ }
117
+
118
+ }
119
+
120
+ // Unset all other rates
121
+ if ( ! empty( $keep ) ) {
122
+
123
+ foreach ( $rates as $key => $rate ) {
124
+
125
+ if ( $key !== $keep )
126
  unset( $rates[ $key ] );
127
  }
128
  }
129
+
130
  return $rates;
131
  }
132
 
includes/class-wc-gzd-dependencies.php CHANGED
@@ -14,15 +14,30 @@ class WC_GZD_Dependencies {
14
 
15
  public $loadable = true;
16
 
 
 
 
17
  public $plugins = array();
18
 
19
- public $plugins_required = array(
20
- 'woocommerce' => array( 'version' => '2.4', 'version_prefix' => 'woocommerce', 'name' => 'WooCommerce' ),
 
 
 
 
 
 
 
 
 
 
 
 
21
  );
22
 
23
- public static function instance() {
24
  if ( is_null( self::$_instance ) ) {
25
- self::$_instance = new self();
26
  }
27
  return self::$_instance;
28
  }
@@ -45,44 +60,151 @@ class WC_GZD_Dependencies {
45
  _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'woocommerce-germanized-pro' ), '1.0' );
46
  }
47
 
48
- public function __construct() {
 
 
 
 
 
 
 
 
 
 
49
 
50
  $this->plugins = (array) get_option( 'active_plugins', array() );
51
 
52
  if ( is_multisite() )
53
  $this->plugins = array_merge( $this->plugins, get_site_option( 'active_sitewide_plugins', array() ) );
54
-
55
- foreach ( $this->plugins_required as $plugin => $data ) {
 
 
 
 
 
56
 
57
- if ( ! $this->is_plugin_activated( $plugin ) || $this->is_plugin_outdated( $plugin ) ) {
58
- add_action( 'admin_notices', array( $this, 'dependencies_notice' ) );
59
- $this->loadable = false;
 
 
 
 
 
60
  }
61
 
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  }
65
 
66
  public function get_plugin_version( $plugin_slug ) {
67
- return get_option( $plugin_slug . '_version' );
 
68
  }
69
 
70
  public function is_plugin_outdated( $plugin ) {
71
- $required = ( isset( $this->plugins_required[ $plugin ] ) ? $this->plugins_required[ $plugin ] : false );
72
- if ( ! $required )
 
 
73
  return false;
74
- if ( version_compare( $this->get_plugin_version( $required[ 'version_prefix' ] ), $required[ 'version' ], "<" ) )
 
75
  return true;
 
76
  return false;
77
  }
78
 
79
  public function is_plugin_activated( $plugin ) {
 
 
 
 
 
 
80
 
81
  if ( strpos( $plugin, '.php' ) === false ) {
82
  $plugin = trailingslashit( $plugin ) . $plugin . '.php';
83
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
- return in_array( $plugin, $this->plugins ) || array_key_exists( $plugin, $this->plugins );
86
  }
87
 
88
  /**
@@ -98,13 +220,11 @@ class WC_GZD_Dependencies {
98
  return ( $this->is_plugin_activated( 'sitepress-multilingual-cms/sitepress.php' ) && $this->is_plugin_activated( 'woocommerce-multilingual/wpml-woocommerce.php' ) );
99
  }
100
 
101
-
102
  public function is_loadable() {
103
  return $this->loadable;
104
  }
105
 
106
  public function dependencies_notice() {
107
-
108
  global $dependencies;
109
  $dependencies = $this;
110
 
@@ -112,5 +232,3 @@ class WC_GZD_Dependencies {
112
  }
113
 
114
  }
115
-
116
- WC_GZD_Dependencies::instance();
14
 
15
  public $loadable = true;
16
 
17
+ public $plugin = null;
18
+ public $prefix = 'gzd';
19
+
20
  public $plugins = array();
21
 
22
+ public $plugins_header = array(
23
+ 'woocommerce' => array(
24
+ 'name' => 'WooCommerce',
25
+ 'tested' => '',
26
+ 'requires' => '',
27
+ 'version' => '',
28
+ 'version_prefix' => 'woocommerce',
29
+ ),
30
+ );
31
+
32
+ public $plugins_result = array(
33
+ 'outdated' => array(),
34
+ 'unactivated' => array(),
35
+ 'untested' => array(),
36
  );
37
 
38
+ public static function instance( $plugin = null ) {
39
  if ( is_null( self::$_instance ) ) {
40
+ self::$_instance = new self( $plugin );
41
  }
42
  return self::$_instance;
43
  }
60
  _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'woocommerce-germanized-pro' ), '1.0' );
61
  }
62
 
63
+ public function __construct( $plugin = null ) {
64
+
65
+ if ( ! $plugin ) {
66
+ $plugin = WC_germanized();
67
+ }
68
+
69
+ $this->plugin = $plugin;
70
+
71
+ if ( $plugin->version != get_option( 'woocommerce_' . $this->prefix . '_version' ) ) {
72
+ delete_option( 'woocommerce_' . $this->prefix . '_plugin_header_data' );
73
+ }
74
 
75
  $this->plugins = (array) get_option( 'active_plugins', array() );
76
 
77
  if ( is_multisite() )
78
  $this->plugins = array_merge( $this->plugins, get_site_option( 'active_sitewide_plugins', array() ) );
79
+
80
+ $this->parse_plugin_header_data();
81
+
82
+ // Set Plugin versions
83
+ foreach ( $this->plugins_header as $plugin => $data ) {
84
+ $this->plugins_header[ $plugin ][ 'version' ] = $this->get_plugin_version( $data[ 'version_prefix' ] );
85
+ }
86
 
87
+ foreach ( $this->plugins_header as $plugin => $data ) {
88
+
89
+ if ( ! $this->is_plugin_activated( $plugin ) ) {
90
+ $this->plugins_result[ 'unactivated' ][ $plugin ] = $data;
91
+ } else if ( $this->is_plugin_outdated( $plugin ) ) {
92
+ $this->plugins_result[ 'outdated' ][ $plugin ] = $data;
93
+ } else if ( ! $this->is_plugin_tested( $plugin ) ) {
94
+ $this->plugins_result[ 'untested' ][ $plugin ] = $data;
95
  }
96
 
97
  }
98
 
99
+ if ( ! empty( $this->plugins_result[ 'unactivated' ] ) || ! empty( $this->plugins_result[ 'outdated' ] ) ) {
100
+ $this->loadable = false;
101
+ add_action( 'admin_notices', array( $this, 'dependencies_notice' ) );
102
+ } else if ( ! empty( $this->plugins_result[ 'untested' ] ) ) {
103
+ add_action( 'admin_notices', array( $this, 'dependencies_notice' ) );
104
+ }
105
+
106
+ }
107
+
108
+ protected function get_current_plugin_path() {
109
+ return $this->plugin->plugin_path() . '/woocommerce-germanized.php';
110
+ }
111
+
112
+ protected function parse_plugin_header_data() {
113
+
114
+ $plugin_header_data = get_option( 'woocommerce_' . $this->prefix . '_plugin_header_data', array() );
115
+
116
+ if ( ! empty( $plugin_header_data ) ) {
117
+ $this->plugins_header = $plugin_header_data;
118
+ return;
119
+ }
120
+
121
+ $plugin_header_check = array();
122
+
123
+ foreach ( $this->plugins_header as $plugin => $data ) {
124
+
125
+ $plugin_header_check[ 'requires_' . $plugin ] = 'Requires at least ' . $data[ 'name' ];
126
+ $plugin_header_check[ 'tested_' . $plugin ] = 'Tested up to ' . $data[ 'name' ];
127
+
128
+ }
129
+
130
+ if ( ! empty( $plugin_header_check ) ) {
131
+
132
+ $plugin_data = get_file_data( $this->get_current_plugin_path(), $plugin_header_check );
133
+
134
+ foreach ( $plugin_data as $key => $value ) {
135
+ if ( strpos( $key, 'requires' ) !== false ) {
136
+ $this->plugins_header[ str_replace( 'requires_', '', $key ) ][ 'requires' ] = $value;
137
+ } else if ( strpos( $key, 'tested' ) !== false ) {
138
+ $this->plugins_header[ str_replace( 'tested_', '', $key ) ][ 'tested' ] = $value;
139
+ }
140
+ }
141
+ }
142
+
143
+ update_option( 'woocommerce_' . $this->prefix . '_plugin_header_data', $this->plugins_header );
144
  }
145
 
146
  public function get_plugin_version( $plugin_slug ) {
147
+ $version = preg_replace( '#(\.0+)+($|-)#', '', get_option( $plugin_slug . '_version', '1.0' ) );
148
+ return $version;
149
  }
150
 
151
  public function is_plugin_outdated( $plugin ) {
152
+
153
+ $plugin_data = ( isset( $this->plugins_header[ $plugin ] ) ? $this->plugins_header[ $plugin ] : false );
154
+
155
+ if ( ! $plugin_data || ! isset( $plugin_data[ 'requires' ] ) || empty( $plugin_data[ 'requires' ] ) )
156
  return false;
157
+
158
+ if ( $this->compare_versions( $plugin_data[ 'requires' ], $this->get_plugin_version( $plugin_data[ 'version_prefix' ] ), ">" ) )
159
  return true;
160
+
161
  return false;
162
  }
163
 
164
  public function is_plugin_activated( $plugin ) {
165
+
166
+ if ( isset( $this->plugins_header[ $plugin ][ 'constant' ] ) ) {
167
+
168
+ if ( ! defined( $this->plugins_header[ $plugin ][ 'constant' ] ) )
169
+ return false;
170
+ }
171
 
172
  if ( strpos( $plugin, '.php' ) === false ) {
173
  $plugin = trailingslashit( $plugin ) . $plugin . '.php';
174
  }
175
+
176
+ return ( in_array( $plugin, $this->plugins ) || array_key_exists( $plugin, $this->plugins ) );
177
+ }
178
+
179
+ public function is_plugin_tested( $plugin ) {
180
+
181
+ $plugin_data = ( isset( $this->plugins_header[ $plugin ] ) ? $this->plugins_header[ $plugin ] : false );
182
+
183
+ if ( ! $plugin_data || ! isset( $plugin_data[ 'tested' ] ) || empty( $plugin_data[ 'tested' ] ) )
184
+ return true;
185
+
186
+ if ( $this->compare_versions( $plugin_data[ 'tested' ], $this->get_plugin_version( $plugin_data[ 'version_prefix' ] ), ">=" ) )
187
+ return true;
188
+
189
+ return false;
190
+
191
+ }
192
+
193
+ /**
194
+ * This method removes accuration from $ver2 if this version is more accurate than $main_ver
195
+ */
196
+ public function compare_versions( $main_ver, $ver2, $operator ) {
197
+
198
+ $expl_main_ver = explode( '.', $main_ver );
199
+ $expl_ver2 = explode( '.', $ver2 );
200
+
201
+ // Check if ver2 string is more accurate than main_ver
202
+ if ( sizeof( $expl_main_ver ) == 2 && sizeof( $expl_ver2 ) > 2 ) {
203
+ $new_ver_2 = array_slice( $expl_ver2, 0, 2 );
204
+ $ver2 = implode( '.', $new_ver_2 );
205
+ }
206
 
207
+ return version_compare( $main_ver, $ver2, $operator );
208
  }
209
 
210
  /**
220
  return ( $this->is_plugin_activated( 'sitepress-multilingual-cms/sitepress.php' ) && $this->is_plugin_activated( 'woocommerce-multilingual/wpml-woocommerce.php' ) );
221
  }
222
 
 
223
  public function is_loadable() {
224
  return $this->loadable;
225
  }
226
 
227
  public function dependencies_notice() {
 
228
  global $dependencies;
229
  $dependencies = $this;
230
 
232
  }
233
 
234
  }
 
 
includes/class-wc-gzd-emails.php CHANGED
@@ -56,9 +56,9 @@ class WC_GZD_Emails {
56
  }
57
 
58
  // Set email filters
59
- add_filter( 'woocommerce_order_item_product', array( $this, 'set_order_email_filters' ), 0, 1 );
60
  // Remove them after total has been displayed
61
- add_action( 'woocommerce_email_after_order_table', array( $this, 'remove_order_email_filters' ), 10, 1 );
62
 
63
  // Pay now button
64
  add_action( 'woocommerce_email_before_order_table', array( $this, 'email_pay_now_button' ), 0, 1 );
@@ -125,20 +125,19 @@ class WC_GZD_Emails {
125
  return false;
126
  }
127
 
128
- public function set_order_email_filters( $product ) {
129
 
130
  $current = $this->get_current_email_object();
131
 
132
  if ( ! $current || empty( $current ) )
133
- return $product;
134
 
135
  // Add order item name actions
136
  add_action( 'woocommerce_order_item_name', 'wc_gzd_cart_product_units', wc_gzd_get_hook_priority( 'email_product_units' ), 2 );
137
  add_action( 'woocommerce_order_item_name', 'wc_gzd_cart_product_delivery_time', wc_gzd_get_hook_priority( 'email_product_delivery_time' ), 2 );
138
  add_action( 'woocommerce_order_item_name', 'wc_gzd_cart_product_item_desc', wc_gzd_get_hook_priority( 'email_product_item_desc' ), 2 );
139
  add_filter( 'woocommerce_order_formatted_line_subtotal', 'wc_gzd_cart_product_unit_price', wc_gzd_get_hook_priority( 'email_product_unit_price' ), 2 );
140
-
141
- return $product;
142
  }
143
 
144
  public function remove_order_email_filters() {
56
  }
57
 
58
  // Set email filters
59
+ add_action( 'woocommerce_email_before_order_table', array( $this, 'set_order_email_filters' ), 10 );
60
  // Remove them after total has been displayed
61
+ add_action( 'woocommerce_email_after_order_table', array( $this, 'remove_order_email_filters' ), 10 );
62
 
63
  // Pay now button
64
  add_action( 'woocommerce_email_before_order_table', array( $this, 'email_pay_now_button' ), 0, 1 );
125
  return false;
126
  }
127
 
128
+ public function set_order_email_filters() {
129
 
130
  $current = $this->get_current_email_object();
131
 
132
  if ( ! $current || empty( $current ) )
133
+ return;
134
 
135
  // Add order item name actions
136
  add_action( 'woocommerce_order_item_name', 'wc_gzd_cart_product_units', wc_gzd_get_hook_priority( 'email_product_units' ), 2 );
137
  add_action( 'woocommerce_order_item_name', 'wc_gzd_cart_product_delivery_time', wc_gzd_get_hook_priority( 'email_product_delivery_time' ), 2 );
138
  add_action( 'woocommerce_order_item_name', 'wc_gzd_cart_product_item_desc', wc_gzd_get_hook_priority( 'email_product_item_desc' ), 2 );
139
  add_filter( 'woocommerce_order_formatted_line_subtotal', 'wc_gzd_cart_product_unit_price', wc_gzd_get_hook_priority( 'email_product_unit_price' ), 2 );
140
+
 
141
  }
142
 
143
  public function remove_order_email_filters() {
includes/class-wc-gzd-install.php CHANGED
@@ -149,6 +149,9 @@ class WC_GZD_Install {
149
  update_option( 'woocommerce_tax_classes', implode( "\n", $tax_classes ) );
150
  }
151
 
 
 
 
152
  // Queue upgrades
153
  $current_version = get_option( 'woocommerce_gzd_version', null );
154
  $current_db_version = get_option( 'woocommerce_gzd_db_version', null );
149
  update_option( 'woocommerce_tax_classes', implode( "\n", $tax_classes ) );
150
  }
151
 
152
+ // Delete plugin header data for dependency check
153
+ delete_option( 'woocommerce_gzd_plugin_header_data' );
154
+
155
  // Queue upgrades
156
  $current_version = get_option( 'woocommerce_gzd_version', null );
157
  $current_db_version = get_option( 'woocommerce_gzd_db_version', null );
includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit-encryption-helper.php CHANGED
@@ -17,7 +17,10 @@ class WC_GZD_Gateway_Direct_Debit_Encryption_Helper {
17
  }
18
 
19
  private function __construct() {
20
-
 
 
 
21
  }
22
 
23
  public function get_random_key() {
17
  }
18
 
19
  private function __construct() {
20
+ // Make sure that random_int exists
21
+ if ( ! function_exists( 'random_int' ) ) {
22
+ include_once( trailingslashit( WC_germanized()->plugin_path() ) . 'includes/gateways/direct-debit/libraries/random-compat/lib/random.php' );
23
+ }
24
  }
25
 
26
  public function get_random_key() {
includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php CHANGED
@@ -101,15 +101,14 @@ Please notice: Period for pre-information of the SEPA direct debit is shortened
101
  add_action( 'wp_ajax_nopriv_show_direct_debit', array( $this, 'generate_mandate' ) );
102
  add_filter( 'woocommerce_email_classes', array( $this, 'add_email_template' ) );
103
 
 
 
104
  // Pay for Order
105
  add_action( 'woocommerce_pay_order_before_submit', array( $this, 'checkbox' ) );
106
 
107
  // Order Meta
108
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'set_order_meta' ), 10, 2 );
109
 
110
- // Customer Meta
111
- add_action( 'woocommerce_checkout_update_user_meta', array( $this, 'set_customer_meta' ), 10, 2 );
112
-
113
  // Customer Emails
114
  add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
115
  add_action( 'woocommerce_germanized_order_confirmation_sent', array( $this, 'send_mail' ) );
@@ -644,14 +643,6 @@ Please notice: Period for pre-information of the SEPA direct debit is shortened
644
 
645
  }
646
 
647
- public function validate_form_pay() {
648
-
649
- }
650
-
651
- public function validate_checkbox( $posted ) {
652
-
653
- }
654
-
655
  public function validate_fields() {
656
 
657
  if ( ! $this->is_available() || ! isset( $_POST[ 'payment_method' ] ) || $_POST[ 'payment_method' ] != $this->id )
@@ -681,12 +672,17 @@ Please notice: Period for pre-information of the SEPA direct debit is shortened
681
  if ( ! preg_match( '/^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/', $bic ) )
682
  wc_add_notice( __( 'Your BIC seems to be invalid.', 'woocommerce-germanized' ), 'error' );
683
 
684
- if ( ! isset( $_POST[ 'woocommerce_checkout_update_totals' ] ) ) {
 
 
 
 
 
685
 
686
- if ( ! isset( $_POST[ 'direct_debit_legal' ] ) && empty( $_POST[ 'direct_debit_legal' ] ) )
687
- wc_add_notice( __( 'Please accept the direct debit mandate.', 'woocommerce-germanized' ), 'error' );
688
 
689
- }
 
690
 
691
  }
692
 
101
  add_action( 'wp_ajax_nopriv_show_direct_debit', array( $this, 'generate_mandate' ) );
102
  add_filter( 'woocommerce_email_classes', array( $this, 'add_email_template' ) );
103
 
104
+ add_action( 'woocommerce_after_checkout_validation', array( $this, 'validate_checkbox' ) );
105
+
106
  // Pay for Order
107
  add_action( 'woocommerce_pay_order_before_submit', array( $this, 'checkbox' ) );
108
 
109
  // Order Meta
110
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'set_order_meta' ), 10, 2 );
111
 
 
 
 
112
  // Customer Emails
113
  add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
114
  add_action( 'woocommerce_germanized_order_confirmation_sent', array( $this, 'send_mail' ) );
643
 
644
  }
645
 
 
 
 
 
 
 
 
 
646
  public function validate_fields() {
647
 
648
  if ( ! $this->is_available() || ! isset( $_POST[ 'payment_method' ] ) || $_POST[ 'payment_method' ] != $this->id )
672
  if ( ! preg_match( '/^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/', $bic ) )
673
  wc_add_notice( __( 'Your BIC seems to be invalid.', 'woocommerce-germanized' ), 'error' );
674
 
675
+ // Make sure that checkbox gets validated if on woocommerce_pay for order page
676
+ if ( isset( $_POST['woocommerce_pay'] ) ) {
677
+ $this->validate_checkbox();
678
+ }
679
+
680
+ }
681
 
682
+ public function validate_checkbox() {
 
683
 
684
+ if ( $this->enable_checkbox === 'yes' && ( ! isset( $_POST[ 'direct_debit_legal' ] ) && empty( $_POST[ 'direct_debit_legal' ] ) ) )
685
+ wc_add_notice( __( 'Please accept the direct debit mandate.', 'woocommerce-germanized' ), 'error' );
686
 
687
  }
688
 
includes/gateways/direct-debit/libraries/random-compat/LICENSE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Paragon Initiative Enterprises
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
includes/gateways/direct-debit/libraries/random-compat/lib/byte_safe_strings.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!function_exists('RandomCompat_strlen')) {
30
+ if (
31
+ defined('MB_OVERLOAD_STRING') &&
32
+ ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING
33
+ ) {
34
+ /**
35
+ * strlen() implementation that isn't brittle to mbstring.func_overload
36
+ *
37
+ * This version uses mb_strlen() in '8bit' mode to treat strings as raw
38
+ * binary rather than UTF-8, ISO-8859-1, etc
39
+ *
40
+ * @param string $binary_string
41
+ *
42
+ * @throws TypeError
43
+ *
44
+ * @return int
45
+ */
46
+ function RandomCompat_strlen($binary_string)
47
+ {
48
+ if (!is_string($binary_string)) {
49
+ throw new TypeError(
50
+ 'RandomCompat_strlen() expects a string'
51
+ );
52
+ }
53
+
54
+ return mb_strlen($binary_string, '8bit');
55
+ }
56
+
57
+ } else {
58
+ /**
59
+ * strlen() implementation that isn't brittle to mbstring.func_overload
60
+ *
61
+ * This version just used the default strlen()
62
+ *
63
+ * @param string $binary_string
64
+ *
65
+ * @throws TypeError
66
+ *
67
+ * @return int
68
+ */
69
+ function RandomCompat_strlen($binary_string)
70
+ {
71
+ if (!is_string($binary_string)) {
72
+ throw new TypeError(
73
+ 'RandomCompat_strlen() expects a string'
74
+ );
75
+ }
76
+ return strlen($binary_string);
77
+ }
78
+ }
79
+ }
80
+
81
+ if (!function_exists('RandomCompat_substr')) {
82
+
83
+ if (
84
+ defined('MB_OVERLOAD_STRING')
85
+ &&
86
+ ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING
87
+ ) {
88
+ /**
89
+ * substr() implementation that isn't brittle to mbstring.func_overload
90
+ *
91
+ * This version uses mb_substr() in '8bit' mode to treat strings as raw
92
+ * binary rather than UTF-8, ISO-8859-1, etc
93
+ *
94
+ * @param string $binary_string
95
+ * @param int $start
96
+ * @param int $length (optional)
97
+ *
98
+ * @throws TypeError
99
+ *
100
+ * @return string
101
+ */
102
+ function RandomCompat_substr($binary_string, $start, $length = null)
103
+ {
104
+ if (!is_string($binary_string)) {
105
+ throw new TypeError(
106
+ 'RandomCompat_substr(): First argument should be a string'
107
+ );
108
+ }
109
+
110
+ if (!is_int($start)) {
111
+ throw new TypeError(
112
+ 'RandomCompat_substr(): Second argument should be an integer'
113
+ );
114
+ }
115
+
116
+ if ($length === null) {
117
+ /**
118
+ * mb_substr($str, 0, NULL, '8bit') returns an empty string on
119
+ * PHP 5.3, so we have to find the length ourselves.
120
+ */
121
+ $length = RandomCompat_strlen($length) - $start;
122
+ } elseif (!is_int($length)) {
123
+ throw new TypeError(
124
+ 'RandomCompat_substr(): Third argument should be an integer, or omitted'
125
+ );
126
+ }
127
+
128
+ // Consistency with PHP's behavior
129
+ if ($start === RandomCompat_strlen($binary_string) && $length === 0) {
130
+ return '';
131
+ }
132
+ if ($start > RandomCompat_strlen($binary_string)) {
133
+ return false;
134
+ }
135
+
136
+ return mb_substr($binary_string, $start, $length, '8bit');
137
+ }
138
+
139
+ } else {
140
+
141
+ /**
142
+ * substr() implementation that isn't brittle to mbstring.func_overload
143
+ *
144
+ * This version just uses the default substr()
145
+ *
146
+ * @param string $binary_string
147
+ * @param int $start
148
+ * @param int $length (optional)
149
+ *
150
+ * @throws TypeError
151
+ *
152
+ * @return string
153
+ */
154
+ function RandomCompat_substr($binary_string, $start, $length = null)
155
+ {
156
+ if (!is_string($binary_string)) {
157
+ throw new TypeError(
158
+ 'RandomCompat_substr(): First argument should be a string'
159
+ );
160
+ }
161
+
162
+ if (!is_int($start)) {
163
+ throw new TypeError(
164
+ 'RandomCompat_substr(): Second argument should be an integer'
165
+ );
166
+ }
167
+
168
+ if ($length !== null) {
169
+ if (!is_int($length)) {
170
+ throw new TypeError(
171
+ 'RandomCompat_substr(): Third argument should be an integer, or omitted'
172
+ );
173
+ }
174
+
175
+ return substr($binary_string, $start, $length);
176
+ }
177
+
178
+ return substr($binary_string, $start);
179
+ }
180
+ }
181
+ }
includes/gateways/direct-debit/libraries/random-compat/lib/cast_to_int.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!function_exists('RandomCompat_intval')) {
30
+
31
+ /**
32
+ * Cast to an integer if we can, safely.
33
+ *
34
+ * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
35
+ * (non-inclusive), it will sanely cast it to an int. If you it's equal to
36
+ * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
37
+ * lose precision, so the <= and => operators might accidentally let a float
38
+ * through.
39
+ *
40
+ * @param int|float $number The number we want to convert to an int
41
+ * @param boolean $fail_open Set to true to not throw an exception
42
+ *
43
+ * @return int (or float if $fail_open)
44
+ *
45
+ * @throws TypeError
46
+ */
47
+ function RandomCompat_intval($number, $fail_open = false)
48
+ {
49
+ if (is_numeric($number)) {
50
+ $number += 0;
51
+ }
52
+
53
+ if (
54
+ is_float($number)
55
+ &&
56
+ $number > ~PHP_INT_MAX
57
+ &&
58
+ $number < PHP_INT_MAX
59
+ ) {
60
+ $number = (int) $number;
61
+ }
62
+
63
+ if (is_int($number) || $fail_open) {
64
+ return $number;
65
+ }
66
+
67
+ throw new TypeError(
68
+ 'Expected an integer.'
69
+ );
70
+ }
71
+ }
includes/gateways/direct-debit/libraries/random-compat/lib/error_polyfill.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!class_exists('Error', false)) {
30
+ // We can't really avoid making this extend Exception in PHP 5.
31
+ class Error extends Exception
32
+ {
33
+
34
+ }
35
+ }
36
+
37
+ if (!class_exists('TypeError', false)) {
38
+ if (is_subclass_of('Error', 'Exception')) {
39
+ class TypeError extends Error
40
+ {
41
+
42
+ }
43
+ } else {
44
+ class TypeError extends Exception
45
+ {
46
+
47
+ }
48
+ }
49
+ }
includes/gateways/direct-debit/libraries/random-compat/lib/random.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * @version 2.0.2
7
+ * @released 2016-04-03
8
+ *
9
+ * The MIT License (MIT)
10
+ *
11
+ * Copyright (c) 2015 Paragon Initiative Enterprises
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in
21
+ * all copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+
32
+ if (!defined('PHP_VERSION_ID')) {
33
+ // This constant was introduced in PHP 5.2.7
34
+ $RandomCompatversion = explode('.', PHP_VERSION);
35
+ define(
36
+ 'PHP_VERSION_ID',
37
+ $RandomCompatversion[0] * 10000
38
+ + $RandomCompatversion[1] * 100
39
+ + $RandomCompatversion[2]
40
+ );
41
+ $RandomCompatversion = null;
42
+ }
43
+
44
+ if (PHP_VERSION_ID < 70000) {
45
+
46
+ if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
47
+ define('RANDOM_COMPAT_READ_BUFFER', 8);
48
+ }
49
+
50
+ $RandomCompatDIR = dirname(__FILE__);
51
+
52
+ require_once $RandomCompatDIR.'/byte_safe_strings.php';
53
+ require_once $RandomCompatDIR.'/cast_to_int.php';
54
+ require_once $RandomCompatDIR.'/error_polyfill.php';
55
+
56
+ if (!function_exists('random_bytes')) {
57
+ /**
58
+ * PHP 5.2.0 - 5.6.x way to implement random_bytes()
59
+ *
60
+ * We use conditional statements here to define the function in accordance
61
+ * to the operating environment. It's a micro-optimization.
62
+ *
63
+ * In order of preference:
64
+ * 1. Use libsodium if available.
65
+ * 2. fread() /dev/urandom if available (never on Windows)
66
+ * 3. mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM)
67
+ * 4. COM('CAPICOM.Utilities.1')->GetRandom()
68
+ * 5. openssl_random_pseudo_bytes() (absolute last resort)
69
+ *
70
+ * See ERRATA.md for our reasoning behind this particular order
71
+ */
72
+ if (extension_loaded('libsodium')) {
73
+ // See random_bytes_libsodium.php
74
+ if (PHP_VERSION_ID >= 50300 && function_exists('\\Sodium\\randombytes_buf')) {
75
+ require_once $RandomCompatDIR.'/random_bytes_libsodium.php';
76
+ } elseif (method_exists('Sodium', 'randombytes_buf')) {
77
+ require_once $RandomCompatDIR.'/random_bytes_libsodium_legacy.php';
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Reading directly from /dev/urandom:
83
+ */
84
+ if (DIRECTORY_SEPARATOR === '/') {
85
+ // DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast
86
+ // way to exclude Windows.
87
+ $RandomCompatUrandom = true;
88
+ $RandomCompat_basedir = ini_get('open_basedir');
89
+
90
+ if (!empty($RandomCompat_basedir)) {
91
+ $RandomCompat_open_basedir = explode(
92
+ PATH_SEPARATOR,
93
+ strtolower($RandomCompat_basedir)
94
+ );
95
+ $RandomCompatUrandom = (array() !== array_intersect(
96
+ array('/dev', '/dev/', '/dev/urandom'),
97
+ $RandomCompat_open_basedir
98
+ ));
99
+ $RandomCompat_open_basedir = null;
100
+ }
101
+
102
+ if (
103
+ !function_exists('random_bytes')
104
+ &&
105
+ $RandomCompatUrandom
106
+ &&
107
+ @is_readable('/dev/urandom')
108
+ ) {
109
+ // Error suppression on is_readable() in case of an open_basedir
110
+ // or safe_mode failure. All we care about is whether or not we
111
+ // can read it at this point. If the PHP environment is going to
112
+ // panic over trying to see if the file can be read in the first
113
+ // place, that is not helpful to us here.
114
+
115
+ // See random_bytes_dev_urandom.php
116
+ require_once $RandomCompatDIR.'/random_bytes_dev_urandom.php';
117
+ }
118
+ // Unset variables after use
119
+ $RandomCompat_basedir = null;
120
+ } else {
121
+ $RandomCompatUrandom = false;
122
+ }
123
+
124
+ /**
125
+ * mcrypt_create_iv()
126
+ */
127
+ if (
128
+ !function_exists('random_bytes')
129
+ &&
130
+ PHP_VERSION_ID >= 50307
131
+ &&
132
+ extension_loaded('mcrypt')
133
+ &&
134
+ (DIRECTORY_SEPARATOR !== '/' || $RandomCompatUrandom)
135
+ ) {
136
+ // Prevent this code from hanging indefinitely on non-Windows;
137
+ // see https://bugs.php.net/bug.php?id=69833
138
+ if (
139
+ DIRECTORY_SEPARATOR !== '/' ||
140
+ (PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613)
141
+ ) {
142
+ // See random_bytes_mcrypt.php
143
+ require_once $RandomCompatDIR.'/random_bytes_mcrypt.php';
144
+ }
145
+ }
146
+ $RandomCompatUrandom = null;
147
+
148
+ if (
149
+ !function_exists('random_bytes')
150
+ &&
151
+ extension_loaded('com_dotnet')
152
+ &&
153
+ class_exists('COM')
154
+ ) {
155
+ $RandomCompat_disabled_classes = preg_split(
156
+ '#\s*,\s*#',
157
+ strtolower(ini_get('disable_classes'))
158
+ );
159
+
160
+ if (!in_array('com', $RandomCompat_disabled_classes)) {
161
+ try {
162
+ $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
163
+ if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
164
+ // See random_bytes_com_dotnet.php
165
+ require_once $RandomCompatDIR.'/random_bytes_com_dotnet.php';
166
+ }
167
+ } catch (com_exception $e) {
168
+ // Don't try to use it.
169
+ }
170
+ }
171
+ $RandomCompat_disabled_classes = null;
172
+ $RandomCompatCOMtest = null;
173
+ }
174
+
175
+ /**
176
+ * throw new Exception
177
+ */
178
+ if (!function_exists('random_bytes')) {
179
+ /**
180
+ * We don't have any more options, so let's throw an exception right now
181
+ * and hope the developer won't let it fail silently.
182
+ */
183
+ function random_bytes($length)
184
+ {
185
+ throw new Exception(
186
+ 'There is no suitable CSPRNG installed on your system'
187
+ );
188
+ }
189
+ }
190
+ }
191
+
192
+ if (!function_exists('random_int')) {
193
+ require_once $RandomCompatDIR.'/random_int.php';
194
+ }
195
+
196
+ $RandomCompatDIR = null;
197
+ }
includes/gateways/direct-debit/libraries/random-compat/lib/random_bytes_com_dotnet.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ /**
30
+ * Windows with PHP < 5.3.0 will not have the function
31
+ * openssl_random_pseudo_bytes() available, so let's use
32
+ * CAPICOM to work around this deficiency.
33
+ *
34
+ * @param int $bytes
35
+ *
36
+ * @throws Exception
37
+ *
38
+ * @return string
39
+ */
40
+ function random_bytes($bytes)
41
+ {
42
+ try {
43
+ $bytes = RandomCompat_intval($bytes);
44
+ } catch (TypeError $ex) {
45
+ throw new TypeError(
46
+ 'random_bytes(): $bytes must be an integer'
47
+ );
48
+ }
49
+
50
+ if ($bytes < 1) {
51
+ throw new Error(
52
+ 'Length must be greater than 0'
53
+ );
54
+ }
55
+
56
+ $buf = '';
57
+ $util = new COM('CAPICOM.Utilities.1');
58
+ $execCount = 0;
59
+
60
+ /**
61
+ * Let's not let it loop forever. If we run N times and fail to
62
+ * get N bytes of random data, then CAPICOM has failed us.
63
+ */
64
+ do {
65
+ $buf .= base64_decode($util->GetRandom($bytes, 0));
66
+ if (RandomCompat_strlen($buf) >= $bytes) {
67
+ /**
68
+ * Return our random entropy buffer here:
69
+ */
70
+ return RandomCompat_substr($buf, 0, $bytes);
71
+ }
72
+ ++$execCount;
73
+ } while ($execCount < $bytes);
74
+
75
+ /**
76
+ * If we reach here, PHP has failed us.
77
+ */
78
+ throw new Exception(
79
+ 'Could not gather sufficient random data'
80
+ );
81
+ }
includes/gateways/direct-debit/libraries/random-compat/lib/random_bytes_dev_urandom.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
30
+ define('RANDOM_COMPAT_READ_BUFFER', 8);
31
+ }
32
+
33
+ /**
34
+ * Unless open_basedir is enabled, use /dev/urandom for
35
+ * random numbers in accordance with best practices
36
+ *
37
+ * Why we use /dev/urandom and not /dev/random
38
+ * @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers
39
+ *
40
+ * @param int $bytes
41
+ *
42
+ * @throws Exception
43
+ *
44
+ * @return string
45
+ */
46
+ function random_bytes($bytes)
47
+ {
48
+ static $fp = null;
49
+ /**
50
+ * This block should only be run once
51
+ */
52
+ if (empty($fp)) {
53
+ /**
54
+ * We use /dev/urandom if it is a char device.
55
+ * We never fall back to /dev/random
56
+ */
57
+ $fp = fopen('/dev/urandom', 'rb');
58
+ if (!empty($fp)) {
59
+ $st = fstat($fp);
60
+ if (($st['mode'] & 0170000) !== 020000) {
61
+ fclose($fp);
62
+ $fp = false;
63
+ }
64
+ }
65
+
66
+ if (!empty($fp)) {
67
+ /**
68
+ * stream_set_read_buffer() does not exist in HHVM
69
+ *
70
+ * If we don't set the stream's read buffer to 0, PHP will
71
+ * internally buffer 8192 bytes, which can waste entropy
72
+ *
73
+ * stream_set_read_buffer returns 0 on success
74
+ */
75
+ if (function_exists('stream_set_read_buffer')) {
76
+ stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
77
+ }
78
+ if (function_exists('stream_set_chunk_size')) {
79
+ stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER);
80
+ }
81
+ }
82
+ }
83
+
84
+ try {
85
+ $bytes = RandomCompat_intval($bytes);
86
+ } catch (TypeError $ex) {
87
+ throw new TypeError(
88
+ 'random_bytes(): $bytes must be an integer'
89
+ );
90
+ }
91
+
92
+ if ($bytes < 1) {
93
+ throw new Error(
94
+ 'Length must be greater than 0'
95
+ );
96
+ }
97
+
98
+ /**
99
+ * This if() block only runs if we managed to open a file handle
100
+ *
101
+ * It does not belong in an else {} block, because the above
102
+ * if (empty($fp)) line is logic that should only be run once per
103
+ * page load.
104
+ */
105
+ if (!empty($fp)) {
106
+ $remaining = $bytes;
107
+ $buf = '';
108
+
109
+ /**
110
+ * We use fread() in a loop to protect against partial reads
111
+ */
112
+ do {
113
+ $read = fread($fp, $remaining);
114
+ if ($read === false) {
115
+ /**
116
+ * We cannot safely read from the file. Exit the
117
+ * do-while loop and trigger the exception condition
118
+ */
119
+ $buf = false;
120
+ break;
121
+ }
122
+ /**
123
+ * Decrease the number of bytes returned from remaining
124
+ */
125
+ $remaining -= RandomCompat_strlen($read);
126
+ $buf .= $read;
127
+ } while ($remaining > 0);
128
+
129
+ /**
130
+ * Is our result valid?
131
+ */
132
+ if ($buf !== false) {
133
+ if (RandomCompat_strlen($buf) === $bytes) {
134
+ /**
135
+ * Return our random entropy buffer here:
136
+ */
137
+ return $buf;
138
+ }
139
+ }
140
+ }
141
+
142
+ /**
143
+ * If we reach here, PHP has failed us.
144
+ */
145
+ throw new Exception(
146
+ 'Error reading from source device'
147
+ );
148
+ }
includes/gateways/direct-debit/libraries/random-compat/lib/random_bytes_libsodium.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ /**
30
+ * If the libsodium PHP extension is loaded, we'll use it above any other
31
+ * solution.
32
+ *
33
+ * libsodium-php project:
34
+ * @ref https://github.com/jedisct1/libsodium-php
35
+ *
36
+ * @param int $bytes
37
+ *
38
+ * @throws Exception
39
+ *
40
+ * @return string
41
+ */
42
+ function random_bytes($bytes)
43
+ {
44
+ try {
45
+ $bytes = RandomCompat_intval($bytes);
46
+ } catch (TypeError $ex) {
47
+ throw new TypeError(
48
+ 'random_bytes(): $bytes must be an integer'
49
+ );
50
+ }
51
+
52
+ if ($bytes < 1) {
53
+ throw new Error(
54
+ 'Length must be greater than 0'
55
+ );
56
+ }
57
+
58
+ /**
59
+ * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
60
+ * generated in one invocation.
61
+ */
62
+ if ($bytes > 2147483647) {
63
+ $buf = '';
64
+ for ($i = 0; $i < $bytes; $i += 1073741824) {
65
+ $n = ($bytes - $i) > 1073741824
66
+ ? 1073741824
67
+ : $bytes - $i;
68
+ $buf .= \Sodium\randombytes_buf($n);
69
+ }
70
+ } else {
71
+ $buf = \Sodium\randombytes_buf($bytes);
72
+ }
73
+
74
+ if ($buf !== false) {
75
+ if (RandomCompat_strlen($buf) === $bytes) {
76
+ return $buf;
77
+ }
78
+ }
79
+
80
+ /**
81
+ * If we reach here, PHP has failed us.
82
+ */
83
+ throw new Exception(
84
+ 'Could not gather sufficient random data'
85
+ );
86
+ }
includes/gateways/direct-debit/libraries/random-compat/lib/random_bytes_libsodium_legacy.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ /**
30
+ * If the libsodium PHP extension is loaded, we'll use it above any other
31
+ * solution.
32
+ *
33
+ * libsodium-php project:
34
+ * @ref https://github.com/jedisct1/libsodium-php
35
+ *
36
+ * @param int $bytes
37
+ *
38
+ * @throws Exception
39
+ *
40
+ * @return string
41
+ */
42
+ function random_bytes($bytes)
43
+ {
44
+ try {
45
+ $bytes = RandomCompat_intval($bytes);
46
+ } catch (TypeError $ex) {
47
+ throw new TypeError(
48
+ 'random_bytes(): $bytes must be an integer'
49
+ );
50
+ }
51
+
52
+ if ($bytes < 1) {
53
+ throw new Error(
54
+ 'Length must be greater than 0'
55
+ );
56
+ }
57
+
58
+ /**
59
+ * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
60
+ * generated in one invocation.
61
+ */
62
+ if ($bytes > 2147483647) {
63
+ $buf = '';
64
+ for ($i = 0; $i < $bytes; $i += 1073741824) {
65
+ $n = ($bytes - $i) > 1073741824
66
+ ? 1073741824
67
+ : $bytes - $i;
68
+ $buf .= Sodium::randombytes_buf($n);
69
+ }
70
+ } else {
71
+ $buf = Sodium::randombytes_buf($bytes);
72
+ }
73
+
74
+ if ($buf !== false) {
75
+ if (RandomCompat_strlen($buf) === $bytes) {
76
+ return $buf;
77
+ }
78
+ }
79
+
80
+ /**
81
+ * If we reach here, PHP has failed us.
82
+ */
83
+ throw new Exception(
84
+ 'Could not gather sufficient random data'
85
+ );
86
+ }
includes/gateways/direct-debit/libraries/random-compat/lib/random_bytes_mcrypt.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+
30
+ /**
31
+ * Powered by ext/mcrypt (and thankfully NOT libmcrypt)
32
+ *
33
+ * @ref https://bugs.php.net/bug.php?id=55169
34
+ * @ref https://github.com/php/php-src/blob/c568ffe5171d942161fc8dda066bce844bdef676/ext/mcrypt/mcrypt.c#L1321-L1386
35
+ *
36
+ * @param int $bytes
37
+ *
38
+ * @throws Exception
39
+ *
40
+ * @return string
41
+ */
42
+ function random_bytes($bytes)
43
+ {
44
+ try {
45
+ $bytes = RandomCompat_intval($bytes);
46
+ } catch (TypeError $ex) {
47
+ throw new TypeError(
48
+ 'random_bytes(): $bytes must be an integer'
49
+ );
50
+ }
51
+
52
+ if ($bytes < 1) {
53
+ throw new Error(
54
+ 'Length must be greater than 0'
55
+ );
56
+ }
57
+
58
+ $buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM);
59
+ if (
60
+ $buf !== false
61
+ &&
62
+ RandomCompat_strlen($buf) === $bytes
63
+ ) {
64
+ /**
65
+ * Return our random entropy buffer here:
66
+ */
67
+ return $buf;
68
+ }
69
+
70
+ /**
71
+ * If we reach here, PHP has failed us.
72
+ */
73
+ throw new Exception(
74
+ 'Could not gather sufficient random data'
75
+ );
76
+ }
includes/gateways/direct-debit/libraries/random-compat/lib/random_int.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ /**
30
+ * Fetch a random integer between $min and $max inclusive
31
+ *
32
+ * @param int $min
33
+ * @param int $max
34
+ *
35
+ * @throws Exception
36
+ *
37
+ * @return int
38
+ */
39
+ function random_int($min, $max)
40
+ {
41
+ /**
42
+ * Type and input logic checks
43
+ *
44
+ * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
45
+ * (non-inclusive), it will sanely cast it to an int. If you it's equal to
46
+ * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
47
+ * lose precision, so the <= and => operators might accidentally let a float
48
+ * through.
49
+ */
50
+
51
+ try {
52
+ $min = RandomCompat_intval($min);
53
+ } catch (TypeError $ex) {
54
+ throw new TypeError(
55
+ 'random_int(): $min must be an integer'
56
+ );
57
+ }
58
+
59
+ try {
60
+ $max = RandomCompat_intval($max);
61
+ } catch (TypeError $ex) {
62
+ throw new TypeError(
63
+ 'random_int(): $max must be an integer'
64
+ );
65
+ }
66
+
67
+ /**
68
+ * Now that we've verified our weak typing system has given us an integer,
69
+ * let's validate the logic then we can move forward with generating random
70
+ * integers along a given range.
71
+ */
72
+ if ($min > $max) {
73
+ throw new Error(
74
+ 'Minimum value must be less than or equal to the maximum value'
75
+ );
76
+ }
77
+
78
+ if ($max === $min) {
79
+ return $min;
80
+ }
81
+
82
+ /**
83
+ * Initialize variables to 0
84
+ *
85
+ * We want to store:
86
+ * $bytes => the number of random bytes we need
87
+ * $mask => an integer bitmask (for use with the &) operator
88
+ * so we can minimize the number of discards
89
+ */
90
+ $attempts = $bits = $bytes = $mask = $valueShift = 0;
91
+
92
+ /**
93
+ * At this point, $range is a positive number greater than 0. It might
94
+ * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to
95
+ * a float and we will lose some precision.
96
+ */
97
+ $range = $max - $min;
98
+
99
+ /**
100
+ * Test for integer overflow:
101
+ */
102
+ if (!is_int($range)) {
103
+
104
+ /**
105
+ * Still safely calculate wider ranges.
106
+ * Provided by @CodesInChaos, @oittaa
107
+ *
108
+ * @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435
109
+ *
110
+ * We use ~0 as a mask in this case because it generates all 1s
111
+ *
112
+ * @ref https://eval.in/400356 (32-bit)
113
+ * @ref http://3v4l.org/XX9r5 (64-bit)
114
+ */
115
+ $bytes = PHP_INT_SIZE;
116
+ $mask = ~0;
117
+
118
+ } else {
119
+
120
+ /**
121
+ * $bits is effectively ceil(log($range, 2)) without dealing with
122
+ * type juggling
123
+ */
124
+ while ($range > 0) {
125
+ if ($bits % 8 === 0) {
126
+ ++$bytes;
127
+ }
128
+ ++$bits;
129
+ $range >>= 1;
130
+ $mask = $mask << 1 | 1;
131
+ }
132
+ $valueShift = $min;
133
+ }
134
+
135
+ /**
136
+ * Now that we have our parameters set up, let's begin generating
137
+ * random integers until one falls between $min and $max
138
+ */
139
+ do {
140
+ /**
141
+ * The rejection probability is at most 0.5, so this corresponds
142
+ * to a failure probability of 2^-128 for a working RNG
143
+ */
144
+ if ($attempts > 128) {
145
+ throw new Exception(
146
+ 'random_int: RNG is broken - too many rejections'
147
+ );
148
+ }
149
+
150
+ /**
151
+ * Let's grab the necessary number of random bytes
152
+ */
153
+ $randomByteString = random_bytes($bytes);
154
+ if ($randomByteString === false) {
155
+ throw new Exception(
156
+ 'Random number generator failure'
157
+ );
158
+ }
159
+
160
+ /**
161
+ * Let's turn $randomByteString into an integer
162
+ *
163
+ * This uses bitwise operators (<< and |) to build an integer
164
+ * out of the values extracted from ord()
165
+ *
166
+ * Example: [9F] | [6D] | [32] | [0C] =>
167
+ * 159 + 27904 + 3276800 + 201326592 =>
168
+ * 204631455
169
+ */
170
+ $val = 0;
171
+ for ($i = 0; $i < $bytes; ++$i) {
172
+ $val |= ord($randomByteString[$i]) << ($i * 8);
173
+ }
174
+
175
+ /**
176
+ * Apply mask
177
+ */
178
+ $val &= $mask;
179
+ $val += $valueShift;
180
+
181
+ ++$attempts;
182
+ /**
183
+ * If $val overflows to a floating point number,
184
+ * ... or is larger than $max,
185
+ * ... or smaller than $min,
186
+ * then try again.
187
+ */
188
+ } while (!is_int($val) || $val > $max || $val < $min);
189
+
190
+ return (int) $val;
191
+ }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: vendidero
3
  Tags: woocommerce, german market, german, germany, deutsch, deutschland, de, de_DE, shop, commerce, e-commerce, ecommerce, woothemes, sepa, invoice
4
  Requires at least: 3.8
5
  Tested up to: 4.5
6
- Stable tag: 1.6.6
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -157,6 +157,15 @@ Bug reports may be filed via our [GitHub repository](https://github.com/vendider
157
 
158
  == Changelog ==
159
 
 
 
 
 
 
 
 
 
 
160
  = 1.6.6 =
161
  * Feature - WooCommerce 2.6 Support
162
  * Feature - WooCommerce REST API Support
3
  Tags: woocommerce, german market, german, germany, deutsch, deutschland, de, de_DE, shop, commerce, e-commerce, ecommerce, woothemes, sepa, invoice
4
  Requires at least: 3.8
5
  Tested up to: 4.5
6
+ Stable tag: 1.6.7
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
157
 
158
  == Changelog ==
159
 
160
+ = 1.6.7 =
161
+ * Fix - Free Shipping Auto Select WC 2.6
162
+ * Fix - Payment Gateways Shortcode
163
+ * Fix - Fallback Library random_compat for Direct Debit Gateway Encryption
164
+ * Fix - Removed Unused Hook from Direct Debit Gateway
165
+ * Fix - Better Order Email Filter Removal
166
+ * Fix - Direct Debit Checkbox Validation
167
+ * Fix - Better Dependency Management
168
+
169
  = 1.6.6 =
170
  * Feature - WooCommerce 2.6 Support
171
  * Feature - WooCommerce REST API Support
templates/global/payment-methods.php CHANGED
@@ -11,11 +11,15 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  ?>
13
 
14
- <?php if ( $available_gateways = WC()->payment_gateways->get_available_payment_gateways() ) : ?>
15
 
16
  <ul class="payment_methods methods">
17
 
18
- <?php foreach ( $available_gateways as $gateway ) : ?>
 
 
 
 
19
 
20
  <li class="payment_method_<?php echo $gateway->id; ?>">
21
  <label for="payment_method_<?php echo $gateway->id; ?>"><?php echo $gateway->get_title(); ?> <?php echo $gateway->get_icon(); ?></label>
11
 
12
  ?>
13
 
14
+ <?php if ( $gateways = WC()->payment_gateways()->payment_gateways() ) : ?>
15
 
16
  <ul class="payment_methods methods">
17
 
18
+ <?php foreach ( $gateways as $gateway ) :
19
+
20
+ if ( $gateway->enabled !== 'yes' )
21
+ continue;
22
+ ?>
23
 
24
  <li class="payment_method_<?php echo $gateway->id; ?>">
25
  <label for="payment_method_<?php echo $gateway->id; ?>"><?php echo $gateway->get_title(); ?> <?php echo $gateway->get_icon(); ?></label>
woocommerce-germanized.php CHANGED
@@ -3,11 +3,13 @@
3
  * Plugin Name: WooCommerce Germanized
4
  * Plugin URI: https://www.vendidero.de/woocommerce-germanized
5
  * Description: Extends WooCommerce to become a legally compliant store for the german market.
6
- * Version: 1.6.6
7
  * Author: Vendidero
8
  * Author URI: https://vendidero.de
9
  * Requires at least: 3.8
10
  * Tested up to: 4.5
 
 
11
  *
12
  * Text Domain: woocommerce-germanized
13
  * Domain Path: /i18n/languages/
@@ -26,7 +28,7 @@ final class WooCommerce_Germanized {
26
  *
27
  * @var string
28
  */
29
- public $version = '1.6.6';
30
 
31
  /**
32
  * Single instance of WooCommerce Germanized Main Class
@@ -114,9 +116,9 @@ final class WooCommerce_Germanized {
114
  spl_autoload_register( array( $this, 'autoload' ) );
115
 
116
  add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) );
117
-
118
  // Check if dependecies are installed
119
- $init = WC_GZD_Dependencies::instance();
120
 
121
  if ( ! $init->is_loadable() )
122
  return;
3
  * Plugin Name: WooCommerce Germanized
4
  * Plugin URI: https://www.vendidero.de/woocommerce-germanized
5
  * Description: Extends WooCommerce to become a legally compliant store for the german market.
6
+ * Version: 1.6.7
7
  * Author: Vendidero
8
  * Author URI: https://vendidero.de
9
  * Requires at least: 3.8
10
  * Tested up to: 4.5
11
+ * Requires at least WooCommerce: 2.4
12
+ * Tested up to WooCommerce: 2.6
13
  *
14
  * Text Domain: woocommerce-germanized
15
  * Domain Path: /i18n/languages/
28
  *
29
  * @var string
30
  */
31
+ public $version = '1.6.7';
32
 
33
  /**
34
  * Single instance of WooCommerce Germanized Main Class
116
  spl_autoload_register( array( $this, 'autoload' ) );
117
 
118
  add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) );
119
+
120
  // Check if dependecies are installed
121
+ $init = WC_GZD_Dependencies::instance( $this );
122
 
123
  if ( ! $init->is_loadable() )
124
  return;