WooCommerce Germanized - Version 2.3.4

Version Description

  • Improvement: Hook into payment gateways later so that we can make sure the order button text replacement is loaded
  • Fix: Shipping address field warning with Woo >
Download this release

Release Info

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

Code changes from version 2.3.3 to 2.3.4

includes/class-wc-gzd-checkout.php CHANGED
@@ -751,6 +751,10 @@ class WC_GZD_Checkout {
751
  }
752
 
753
  public function set_formatted_shipping_address( $fields, $order ) {
 
 
 
 
754
 
755
  if ( 'yes' !== get_option( 'woocommerce_gzd_checkout_address_field' ) ) {
756
  return $fields;
751
  }
752
 
753
  public function set_formatted_shipping_address( $fields, $order ) {
754
+
755
+ if ( empty( $fields ) || ! is_array( $fields ) ) {
756
+ return $fields;
757
+ }
758
 
759
  if ( 'yes' !== get_option( 'woocommerce_gzd_checkout_address_field' ) ) {
760
  return $fields;
includes/class-wc-gzd-dhl-parcel-shops.php CHANGED
@@ -138,17 +138,21 @@ class WC_GZD_DHL_Parcel_Shops {
138
  }
139
 
140
  public function set_formatted_shipping_address( $fields, $order ) {
141
- $fields['parcelshop_post_number'] = '';
 
142
 
143
- if ( wc_gzd_get_crud_data( $order, 'shipping_parcelshop_post_number' ) ) {
144
- $fields['parcelshop_post_number'] = wc_gzd_get_crud_data( $order, 'shipping_parcelshop_post_number' );
 
145
  }
146
 
147
  return $fields;
148
  }
149
 
150
  public function set_formatted_billing_address( $fields, $order ) {
151
- $fields['parcelshop_post_number'] = '';
 
 
152
 
153
  return $fields;
154
  }
138
  }
139
 
140
  public function set_formatted_shipping_address( $fields, $order ) {
141
+ if ( ! empty( $fields ) && is_array( $fields ) ) {
142
+ $fields['parcelshop_post_number'] = '';
143
 
144
+ if ( wc_gzd_get_crud_data( $order, 'shipping_parcelshop_post_number' ) ) {
145
+ $fields['parcelshop_post_number'] = wc_gzd_get_crud_data( $order, 'shipping_parcelshop_post_number' );
146
+ }
147
  }
148
 
149
  return $fields;
150
  }
151
 
152
  public function set_formatted_billing_address( $fields, $order ) {
153
+ if ( ! empty( $fields ) && is_array( $fields ) ) {
154
+ $fields['parcelshop_post_number'] = '';
155
+ }
156
 
157
  return $fields;
158
  }
includes/class-wc-gzd-payment-gateways.php CHANGED
@@ -26,13 +26,16 @@ class WC_GZD_Payment_Gateways {
26
 
27
  // Init gateway fields
28
  add_action( 'woocommerce_settings_checkout', array( $this, 'init_fields' ), 0 );
29
- add_action( 'woocommerce_calculate_totals', array( $this, 'checkout' ) );
30
- add_action( 'woocommerce_cart_calculate_fees', array( $this, 'init_fee' ), 0 );
 
31
 
32
  // Gateway admin export
33
  add_action( 'current_screen', array( $this, 'gateway_admin_init' ), 20 );
 
34
  // AJAX
35
  add_action( 'init', array( $this, 'gateway_ajax_init' ), 30 );
 
36
  // Init upon Pay action
37
  add_action( 'woocommerce_before_pay_action', array( $this, 'gateway_pay_init' ), 5 );
38
  }
@@ -66,9 +69,9 @@ class WC_GZD_Payment_Gateways {
66
  * Manipulate payment gateway description if has a fee and init gateway title filter
67
  */
68
  public function checkout() {
69
-
70
- if ( is_admin() )
71
  return;
 
72
 
73
  $this->manipulate_gateways();
74
  }
@@ -86,35 +89,35 @@ class WC_GZD_Payment_Gateways {
86
  return in_array( $id, apply_filters( 'woocommerce_gzd_fee_supporting_gateways', array( 'cod' ) ) ) ? true : false;
87
  }
88
 
89
- public function manipulate_gateways() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
 
91
  $gateways = WC()->payment_gateways->get_available_payment_gateways();
92
 
93
  foreach( $gateways as $gateway ) {
94
 
95
  $this->maybe_set_gateway_data( $gateway );
96
-
97
- if ( ! isset( $gateway->force_order_button_text ) || $gateway->force_order_button_text ) {
98
-
99
- /**
100
- * Filter to adjust the forced order submit button text per gateway.
101
- * By default Woo allows gateways to adjust the submit button text.
102
- * This behaviour does not comply with the button solution - that is why Germanized adds the
103
- * option-based static text by default.
104
- *
105
- * @since 1.0.0
106
- *
107
- * @param string $button_text The static button text from within the options.
108
- * @param string $gateway_id The gateway id.
109
- */
110
- $gateway->order_button_text = apply_filters( 'woocommerce_gzd_order_button_payment_gateway_text', __( get_option( 'woocommerce_gzd_order_submit_btn_text' ), 'woocommerce-germanized' ), $gateway->id );
111
- }
112
 
113
  if ( $this->gateway_supports_fees( $gateway->id ) && $gateway->get_option( 'fee' ) ) {
114
 
115
  $gateway_description = $this->gateway_data[ $gateway->id ][ 'description' ];
116
-
117
- $desc = sprintf( __( '%s payment charge', 'woocommerce-germanized' ), wc_price( $gateway->get_option( 'fee' ) ) ) . '.';
118
 
119
  if ( $gateway->get_option( 'forwarding_fee' ) ) {
120
  $desc .= ' ' . sprintf( __( 'Plus %s forwarding fee (charged by the transport agent)', 'woocommerce-germanized' ), wc_price( $gateway->get_option( 'forwarding_fee' ) ) ) . '.';
@@ -137,8 +140,9 @@ class WC_GZD_Payment_Gateways {
137
 
138
  private function maybe_set_gateway_data( $gateway ) {
139
  if ( ! isset( $this->gateway_data[ $gateway->id ] ) ) {
140
- $this->gateway_data[ $gateway->id ] = array(
141
- 'title' => $gateway->title,
 
142
  'description' => $gateway->description,
143
  );
144
  }
@@ -155,8 +159,9 @@ class WC_GZD_Payment_Gateways {
155
 
156
  foreach ( $gateways as $gateway ) {
157
 
158
- if ( $gateway->id != $id )
159
  continue;
 
160
 
161
  if ( ! $this->gateway_supports_fees( $gateway->id ) ) {
162
  return $title;
@@ -164,10 +169,11 @@ class WC_GZD_Payment_Gateways {
164
 
165
  $this->maybe_set_gateway_data( $gateway );
166
 
167
- $title = $this->gateway_data[ $gateway->id ][ 'title' ];
168
 
169
- if ( $gateway->get_option( 'fee' ) && ( is_payment_methods() || ( is_checkout() || ( defined( 'DOING_AJAX' ) && isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'woocommerce_update_order_review' ) ) ) )
170
  $title = $title . ' <span class="small">(' . sprintf( __( '%s payment charge', 'woocommerce-germanized' ), wc_price( $gateway->get_option( 'fee' ) ) ) . ')</span>';
 
171
 
172
  return $title;
173
  }
@@ -180,13 +186,13 @@ class WC_GZD_Payment_Gateways {
180
  $gateways = WC()->payment_gateways->payment_gateways;
181
 
182
  if ( ! empty( $gateways ) ) {
183
- foreach ( $gateways as $key => $gateway ) {
184
 
185
- if ( ! $this->gateway_supports_fees( $gateway->id ) ) {
186
- continue;
187
- }
188
 
189
- add_filter( 'woocommerce_settings_api_form_fields_' . $gateway->id, array( $this, "set_fields" ) );
190
  }
191
  }
192
  }
@@ -197,17 +203,17 @@ class WC_GZD_Payment_Gateways {
197
  * @param array $fields
198
  */
199
  public function set_fields( $fields ) {
 
200
 
201
- $gateway = isset( $_GET[ 'section' ] ) ? wc_clean( $_GET[ 'section' ] ) : '';
202
-
203
- $fields[ 'fee' ] = array(
204
  'title' => __( 'Fee', 'woocommerce-germanized' ),
205
  'type' => 'decimal',
206
  'description' => __( 'This fee is being added if customer selects payment method within checkout.', 'woocommerce-germanized' ),
207
  'default' => 0,
208
  'desc_tip' => true,
209
  );
210
- $fields[ 'fee_is_taxable' ] = array(
 
211
  'title' => __( 'Fee is taxable?', 'woocommerce-germanized' ),
212
  'type' => 'checkbox',
213
  'label' => __( 'Check if fee is taxable.', 'woocommerce-germanized' ),
@@ -215,15 +221,13 @@ class WC_GZD_Payment_Gateways {
215
  );
216
 
217
  if ( 'wc_gateway_cod' === $gateway || 'cod' === $gateway ) {
218
-
219
- $fields[ 'forwarding_fee' ] = array(
220
  'title' => __( 'Forwarding Fee', 'woocommerce-germanized' ),
221
  'type' => 'decimal',
222
  'desc_tip' => true,
223
  'description' => __( 'Forwarding fee will be charged by the transport agent in addition to the cash of delivery fee e.g. DHL - tax free.', 'woocommerce-germanized' ),
224
  'default' => 0,
225
  );
226
-
227
  }
228
 
229
  return $fields;
@@ -235,8 +239,9 @@ class WC_GZD_Payment_Gateways {
235
  public function init_fee() {
236
  $gateways = WC()->payment_gateways()->get_available_payment_gateways();
237
 
238
- if ( ! ( $key = WC()->session->get('chosen_payment_method') ) || ! isset( $gateways[ $key ] ) )
239
  return;
 
240
 
241
  $gateway = $gateways[ $key ];
242
 
@@ -244,8 +249,9 @@ class WC_GZD_Payment_Gateways {
244
  return;
245
  }
246
 
247
- if ( $gateway->get_option( 'fee' ) )
248
  $this->set_fee( $gateway );
 
249
  }
250
 
251
  /**
@@ -266,7 +272,6 @@ class WC_GZD_Payment_Gateways {
266
 
267
  WC()->cart->add_fee( __( 'Payment charge', 'woocommerce-germanized' ), $fee, $is_taxable );
268
  }
269
-
270
  }
271
 
272
  return WC_GZD_Payment_Gateways::instance();
26
 
27
  // Init gateway fields
28
  add_action( 'woocommerce_settings_checkout', array( $this, 'init_fields' ), 0 );
29
+ add_action( 'woocommerce_after_calculate_totals', array( $this, 'checkout' ) );
30
+
31
+ add_action( 'woocommerce_cart_calculate_fees', array( $this, 'init_fee' ), 0 );
32
 
33
  // Gateway admin export
34
  add_action( 'current_screen', array( $this, 'gateway_admin_init' ), 20 );
35
+
36
  // AJAX
37
  add_action( 'init', array( $this, 'gateway_ajax_init' ), 30 );
38
+
39
  // Init upon Pay action
40
  add_action( 'woocommerce_before_pay_action', array( $this, 'gateway_pay_init' ), 5 );
41
  }
69
  * Manipulate payment gateway description if has a fee and init gateway title filter
70
  */
71
  public function checkout() {
72
+ if ( is_admin() ) {
 
73
  return;
74
+ }
75
 
76
  $this->manipulate_gateways();
77
  }
89
  return in_array( $id, apply_filters( 'woocommerce_gzd_fee_supporting_gateways', array( 'cod' ) ) ) ? true : false;
90
  }
91
 
92
+ protected function maybe_force_gateway_button_text( $gateway ) {
93
+ if ( ! isset( $gateway->force_order_button_text ) || $gateway->force_order_button_text ) {
94
+ /**
95
+ * Filter to adjust the forced order submit button text per gateway.
96
+ * By default Woo allows gateways to adjust the submit button text.
97
+ * This behaviour does not comply with the button solution - that is why Germanized adds the
98
+ * option-based static text by default.
99
+ *
100
+ * @since 1.0.0
101
+ *
102
+ * @param string $button_text The static button text from within the options.
103
+ * @param string $gateway_id The gateway id.
104
+ */
105
+ $gateway->order_button_text = apply_filters( 'woocommerce_gzd_order_button_payment_gateway_text', __( get_option( 'woocommerce_gzd_order_submit_btn_text' ), 'woocommerce-germanized' ), $gateway->id );
106
+ }
107
+ }
108
 
109
+ public function manipulate_gateways() {
110
  $gateways = WC()->payment_gateways->get_available_payment_gateways();
111
 
112
  foreach( $gateways as $gateway ) {
113
 
114
  $this->maybe_set_gateway_data( $gateway );
115
+ $this->maybe_force_gateway_button_text( $gateway );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
  if ( $this->gateway_supports_fees( $gateway->id ) && $gateway->get_option( 'fee' ) ) {
118
 
119
  $gateway_description = $this->gateway_data[ $gateway->id ][ 'description' ];
120
+ $desc = sprintf( __( '%s payment charge', 'woocommerce-germanized' ), wc_price( $gateway->get_option( 'fee' ) ) ) . '.';
 
121
 
122
  if ( $gateway->get_option( 'forwarding_fee' ) ) {
123
  $desc .= ' ' . sprintf( __( 'Plus %s forwarding fee (charged by the transport agent)', 'woocommerce-germanized' ), wc_price( $gateway->get_option( 'forwarding_fee' ) ) ) . '.';
140
 
141
  private function maybe_set_gateway_data( $gateway ) {
142
  if ( ! isset( $this->gateway_data[ $gateway->id ] ) ) {
143
+
144
+ $this->gateway_data[ $gateway->id ] = array(
145
+ 'title' => $gateway->title,
146
  'description' => $gateway->description,
147
  );
148
  }
159
 
160
  foreach ( $gateways as $gateway ) {
161
 
162
+ if ( $gateway->id != $id ) {
163
  continue;
164
+ }
165
 
166
  if ( ! $this->gateway_supports_fees( $gateway->id ) ) {
167
  return $title;
169
 
170
  $this->maybe_set_gateway_data( $gateway );
171
 
172
+ $title = $this->gateway_data[ $gateway->id ]['title'];
173
 
174
+ if ( $gateway->get_option( 'fee' ) && ( is_payment_methods() || ( is_checkout() || ( defined( 'DOING_AJAX' ) && isset( $_POST['action'] ) && $_POST['action'] == 'woocommerce_update_order_review' ) ) ) ) {
175
  $title = $title . ' <span class="small">(' . sprintf( __( '%s payment charge', 'woocommerce-germanized' ), wc_price( $gateway->get_option( 'fee' ) ) ) . ')</span>';
176
+ }
177
 
178
  return $title;
179
  }
186
  $gateways = WC()->payment_gateways->payment_gateways;
187
 
188
  if ( ! empty( $gateways ) ) {
189
+ foreach ( $gateways as $key => $gateway ) {
190
 
191
+ if ( ! $this->gateway_supports_fees( $gateway->id ) ) {
192
+ continue;
193
+ }
194
 
195
+ add_filter( 'woocommerce_settings_api_form_fields_' . $gateway->id, array( $this, "set_fields" ) );
196
  }
197
  }
198
  }
203
  * @param array $fields
204
  */
205
  public function set_fields( $fields ) {
206
+ $gateway = isset( $_GET['section'] ) ? wc_clean( $_GET['section'] ) : '';
207
 
208
+ $fields['fee'] = array(
 
 
209
  'title' => __( 'Fee', 'woocommerce-germanized' ),
210
  'type' => 'decimal',
211
  'description' => __( 'This fee is being added if customer selects payment method within checkout.', 'woocommerce-germanized' ),
212
  'default' => 0,
213
  'desc_tip' => true,
214
  );
215
+
216
+ $fields['fee_is_taxable'] = array(
217
  'title' => __( 'Fee is taxable?', 'woocommerce-germanized' ),
218
  'type' => 'checkbox',
219
  'label' => __( 'Check if fee is taxable.', 'woocommerce-germanized' ),
221
  );
222
 
223
  if ( 'wc_gateway_cod' === $gateway || 'cod' === $gateway ) {
224
+ $fields['forwarding_fee'] = array(
 
225
  'title' => __( 'Forwarding Fee', 'woocommerce-germanized' ),
226
  'type' => 'decimal',
227
  'desc_tip' => true,
228
  'description' => __( 'Forwarding fee will be charged by the transport agent in addition to the cash of delivery fee e.g. DHL - tax free.', 'woocommerce-germanized' ),
229
  'default' => 0,
230
  );
 
231
  }
232
 
233
  return $fields;
239
  public function init_fee() {
240
  $gateways = WC()->payment_gateways()->get_available_payment_gateways();
241
 
242
+ if ( ! ( $key = WC()->session->get('chosen_payment_method') ) || ! isset( $gateways[ $key ] ) ) {
243
  return;
244
+ }
245
 
246
  $gateway = $gateways[ $key ];
247
 
249
  return;
250
  }
251
 
252
+ if ( $gateway->get_option( 'fee' ) ) {
253
  $this->set_fee( $gateway );
254
+ }
255
  }
256
 
257
  /**
272
 
273
  WC()->cart->add_fee( __( 'Payment charge', 'woocommerce-germanized' ), $fee, $is_taxable );
274
  }
 
275
  }
276
 
277
  return WC_GZD_Payment_Gateways::instance();
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 3.8
5
  Tested up to: 5.2
6
  WC requires at least: 2.4
7
  WC tested up to: 3.7
8
- Stable tag: 2.3.3
9
  Requires PHP: 5.3
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -181,6 +181,10 @@ Bug reports may be filed via our [GitHub repository](https://github.com/vendider
181
 
182
  == Changelog ==
183
 
 
 
 
 
184
  = 2.3.3 =
185
  * Feature: Option to manually resend paid for order email
186
  * Feature: WooCommerce 3.7 support
5
  Tested up to: 5.2
6
  WC requires at least: 2.4
7
  WC tested up to: 3.7
8
+ Stable tag: 2.3.4
9
  Requires PHP: 5.3
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
181
 
182
  == Changelog ==
183
 
184
+ = 2.3.4 =
185
+ * Improvement: Hook into payment gateways later so that we can make sure the order button text replacement is loaded
186
+ * Fix: Shipping address field warning with Woo >= 3.7
187
+
188
  = 2.3.3 =
189
  * Feature: Option to manually resend paid for order email
190
  * Feature: WooCommerce 3.7 support
woocommerce-germanized.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Germanized for WooCommerce
4
  * Plugin URI: https://www.vendidero.de/woocommerce-germanized
5
  * Description: Germanized for WooCommerce extends WooCommerce to become a legally compliant store in the german market.
6
- * Version: 2.3.3
7
  * Author: Vendidero
8
  * Author URI: https://vendidero.de
9
  * Requires at least: 3.8
@@ -31,7 +31,7 @@ final class WooCommerce_Germanized {
31
  *
32
  * @var string
33
  */
34
- public $version = '2.3.3';
35
 
36
  /**
37
  * Single instance of WooCommerce Germanized Main Class
@@ -129,26 +129,26 @@ final class WooCommerce_Germanized {
129
 
130
  spl_autoload_register( array( $this, 'autoload' ) );
131
 
132
- /**
133
- * Filter the Germanized dependency manager instance.
134
- *
135
- * @since 1.0.0
136
- *
137
- * @param WC_GZD_Dependencies $dependency The dependency manager instance.
138
- */
139
  $dependencies = apply_filters( 'woocommerce_gzd_dependencies_instance', WC_GZD_Dependencies::instance( $this ) );
140
 
141
  if ( ! $dependencies->is_loadable() ) {
142
  return;
143
  }
144
 
145
- /**
146
- * Before startup.
147
- *
148
- * This hook fires right before Germanized includes relevant files for startup.
149
- *
150
- * @since 1.0.0
151
- */
152
  do_action( 'woocommerce_germanized_before_load' );
153
 
154
  $this->includes();
@@ -171,13 +171,13 @@ final class WooCommerce_Germanized {
171
  $this->units = new WC_GZD_Units();
172
  $this->price_labels = new WC_GZD_Price_Labels();
173
 
174
- /**
175
- * After startup.
176
- *
177
- * This hook fires right after all relevant files for Germanized has been loaded.
178
- *
179
- * @since 1.0.0
180
- */
181
  do_action( 'woocommerce_germanized_loaded' );
182
 
183
  if ( did_action( 'woocommerce_loaded' ) ) {
@@ -201,13 +201,13 @@ final class WooCommerce_Germanized {
201
  */
202
  public function init() {
203
 
204
- /**
205
- * Initialize Germanized
206
- *
207
- * This hook fires as soon as Germanized initializes.
208
- *
209
- * @since 1.0.0
210
- */
211
  do_action( 'before_woocommerce_germanized_init' );
212
 
213
  $this->load_plugin_textdomain();
@@ -248,14 +248,14 @@ final class WooCommerce_Germanized {
248
 
249
  $this->emails = new WC_GZD_Emails();
250
 
251
- /**
252
- * Initialized Germanized
253
- *
254
- * This hook fires after Germanized has been initialized e.g. textdomain has been loaded and relevant
255
- * have been placed.
256
- *
257
- * @since 1.0.0
258
- */
259
  do_action( 'woocommerce_germanized_init' );
260
  }
261
 
@@ -267,21 +267,21 @@ final class WooCommerce_Germanized {
267
  */
268
  public function autoload( $class ) {
269
 
270
- $original_class = $class;
271
- $class = strtolower( $class );
272
 
273
- $matcher = array(
274
- 'wc_gzd_',
275
- 'ekomi\\',
276
- 'digitick\sepa',
277
- 'defuse\crypto',
278
- );
279
 
280
- $is_match = ( str_replace( $matcher, '', $class ) != $class );
281
 
282
- if ( ! $is_match ) {
283
- return;
284
- }
285
 
286
  $path = $this->plugin_path() . '/includes/';
287
  $file = 'class-' . str_replace( '_', '-', $class ) . '.php';
@@ -336,19 +336,19 @@ final class WooCommerce_Germanized {
336
  * @return string
337
  */
338
  public function template_path() {
339
- /**
340
- * Filter the default Germanized template path folder.
341
- *
342
- * ```php
343
- * function ex_filter_template_path( $path ) {
344
- * return 'woocommerce-germanized-test/';
345
- * }
346
- * add_filter( 'woocommerce_gzd_template_path', 'ex_filter_template_path', 10, 1 );
347
- *
348
- * @since 1.0.0
349
- *
350
- * @param string $path The relative path within your theme directory.
351
- */
352
  return apply_filters( 'woocommerce_gzd_template_path', 'woocommerce-germanized/' );
353
  }
354
 
@@ -383,7 +383,7 @@ final class WooCommerce_Germanized {
383
 
384
  include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin.php';
385
  include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin-welcome.php';
386
- include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin-order.php';
387
  include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin-notices.php';
388
  include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin-customer.php';
389
  include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin-legal-checkboxes.php';
@@ -463,10 +463,10 @@ final class WooCommerce_Germanized {
463
  include_once WC_GERMANIZED_ABSPATH . 'includes/class-wc-gzd-legal-checkbox-manager.php';
464
 
465
  // Product Attribute
466
- if ( wc_gzd_get_dependencies()->woocommerce_version_supports_crud() ) {
467
- include_once WC_GERMANIZED_ABSPATH . 'includes/class-wc-gzd-product-attribute.php';
468
- include_once WC_GERMANIZED_ABSPATH . 'includes/class-wc-gzd-product-attribute-helper.php';
469
- }
470
  }
471
 
472
  public function is_frontend() {
@@ -474,34 +474,34 @@ final class WooCommerce_Germanized {
474
  }
475
 
476
  public function is_rest_api_request() {
477
- if ( function_exists( 'WC' ) ) {
478
- $wc = WC();
479
 
480
- if ( is_callable( array( $wc, 'is_rest_api_request' ) ) ) {
481
- return $wc->is_rest_api_request();
482
- }
483
- }
484
 
485
- return false;
486
- }
487
 
488
  public function setup_compatibility() {
489
 
490
- /**
491
- * Filter compatibility classes.
492
- *
493
- * This filter allows third party developers to register compatibility scripts
494
- * for certain plugins or themes. Class prefix: `WC_GZD_Compatibility_` is expected.
495
- * Make sure to include your class accordingly.
496
- *
497
- * @since 1.9.1
498
- *
499
- * @param array[string] $comp Array containing the compatibilities.
500
- */
501
  $plugins = apply_filters( 'woocommerce_gzd_compatibilities',
502
  array(
503
  'wpml',
504
- 'wpml-string-translation',
505
  'polylang',
506
  'woo-poly-integration',
507
  'woocommerce-dynamic-pricing',
@@ -512,7 +512,7 @@ final class WooCommerce_Germanized {
512
  'woocommerce-subscriptions',
513
  'woo-paypalplus',
514
  'dhl-for-woocommerce',
515
- 'elementor-pro',
516
  )
517
  );
518
 
@@ -526,8 +526,8 @@ final class WooCommerce_Germanized {
526
  }
527
 
528
  public function get_compatibility( $name ) {
529
- return ( isset( $this->compatibilities[ $name ] ) ? $this->compatibilities[ $name ] : false );
530
- }
531
 
532
  /**
533
  * Include required frontend files.
@@ -560,47 +560,47 @@ final class WooCommerce_Germanized {
560
 
561
  $GLOBALS['wc_gzd_template_name'][] = $template_name;
562
 
563
- // Check for Theme overrides
564
- $theme_template = locate_template( array(
565
- trailingslashit( $template_path ) . $template_name,
566
- ) );
567
-
568
- /**
569
- * Filters the template name.
570
- *
571
- * @since 1.0.0
572
- *
573
- * @param string $template_name The template name e.g. checkboxes/default.php
574
- */
575
  $template_name = apply_filters( 'woocommerce_gzd_template_name', $template_name );
576
 
577
  /** This filter is documented in woocommerce-germanized.php */
578
  if ( ! $theme_template && file_exists( apply_filters( 'woocommerce_gzd_default_plugin_template', $this->plugin_path() . '/templates/' . $template_name, $template_name ) ) ) {
579
- /**
580
- * Filter the default plugin template file.
581
- *
582
- * This file is being loaded as a default template if no theme template was found.
583
- *
584
- * @since 1.0.0
585
- *
586
- * @params string $path The absolute path to the template.
587
- */
588
- $template = apply_filters( 'woocommerce_gzd_default_plugin_template', $this->plugin_path() . '/templates/' . $template_name, $template_name );
589
  } elseif ( $theme_template ) {
590
  $template = $theme_template;
591
  }
592
 
593
- /**
594
- * Filters the actual loaded template.
595
- *
596
- * This filter allows filtering the located template path (whether theme or plugin).
597
- *
598
- * @since 1.0.0
599
- *
600
- * @params string $template The path to the template.
601
- * @params string $template_name The template name e.g. checkboxes/default.php.
602
- * @params string $template_path Germanized template path.
603
- */
604
  return apply_filters( 'woocommerce_germanized_filter_template', $template, $template_name, $template_path );
605
  }
606
 
@@ -610,13 +610,13 @@ final class WooCommerce_Germanized {
610
  * @return array
611
  */
612
  public function get_critical_templates() {
613
- /**
614
- * Filters critical template which should be prevented from overriding.
615
- *
616
- * @since 1.0.0
617
- *
618
- * @param array $templates Array containing the template names.
619
- */
620
  return apply_filters( 'woocommerce_gzd_important_templates', array() );
621
  }
622
 
@@ -738,8 +738,8 @@ final class WooCommerce_Germanized {
738
  $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
739
  $locale = apply_filters( 'plugin_locale', $locale, 'woocommerce-germanized' );
740
 
741
- unload_textdomain( 'woocommerce-germanized' );
742
- load_textdomain( 'woocommerce-germanized', trailingslashit( WP_LANG_DIR ) . 'woocommerce-germanized/woocommerce-germanized-' . $locale . '.mo' );
743
  load_plugin_textdomain( 'woocommerce-germanized', false, plugin_basename( dirname( __FILE__ ) ) . '/i18n/languages/' );
744
  }
745
 
@@ -802,18 +802,18 @@ final class WooCommerce_Germanized {
802
  wp_register_style( 'woocommerce-gzd-layout', $assets_path . 'css/woocommerce-gzd-layout' . $suffix . '.css', array(), WC_GERMANIZED_VERSION );
803
  wp_enqueue_style( 'woocommerce-gzd-layout' );
804
 
805
- /**
806
- * Register frontend scripts and styles.
807
- *
808
- * This hook executes right after Germanized has registered and enqueued relevant scripts and styles for the
809
- * frontend.
810
- *
811
- * @since 1.0.0
812
- *
813
- * @param string $suffix The asset suffix e.g. .min in non-debugging mode.
814
- * @param string $frontend_script_path The absolute URL to the plugins JS files.
815
- * @param string $assets_path The absolute URL to the plugins asset files.
816
- */
817
  do_action( 'woocommerce_gzd_registered_scripts', $suffix, $frontend_script_path, $assets_path );
818
  }
819
 
@@ -843,13 +843,13 @@ final class WooCommerce_Germanized {
843
 
844
  $this->localized_scripts[] = 'wc-gzd-revocation';
845
 
846
- /**
847
- * Filters script localization paramaters for the `wc-gzd-revocation` script.
848
- *
849
- * @since 1.0.0
850
- *
851
- * @param array $params Key => value array containing parameter name and value.
852
- */
853
  wp_localize_script( 'wc-gzd-revocation', 'wc_gzd_revocation_params', apply_filters( 'wc_gzd_revocation_params', array(
854
  'ajax_url' => WC()->ajax_url(),
855
  'wc_ajax_url' => WC_AJAX::get_endpoint( "%%endpoint%%" ),
@@ -861,13 +861,13 @@ final class WooCommerce_Germanized {
861
 
862
  $this->localized_scripts[] = 'wc-gzd-add-to-cart-variation';
863
 
864
- /**
865
- * Filters script localization paramaters for the `wc-gzd-add-to-cart-variation` script.
866
- *
867
- * @since 1.0.0
868
- *
869
- * @param array $params Key => value array containing parameter name and value.
870
- */
871
  wp_localize_script( 'wc-gzd-add-to-cart-variation', 'wc_gzd_add_to_cart_variation_params', apply_filters( 'woocommerce_gzd_add_to_cart_variation_params', array(
872
  'wrapper' => '.type-product',
873
  'price_selector' => '.price',
@@ -881,13 +881,13 @@ final class WooCommerce_Germanized {
881
 
882
  $this->localized_scripts[] = 'wc-gzd-force-pay-order';
883
 
884
- /**
885
- * Filters script localization paramaters for the `wc-gzd-force-pay-order` script.
886
- *
887
- * @since 1.0.0
888
- *
889
- * @param array $params Key => value array containing parameter name and value.
890
- */
891
  wp_localize_script( 'wc-gzd-force-pay-order', 'wc_gzd_force_pay_order_params', apply_filters( 'wc_gzd_force_pay_order_params', array(
892
  'order_id' => $order_id,
893
  'gateway' => wc_gzd_get_crud_data( $order, 'payment_method' ),
@@ -906,13 +906,13 @@ final class WooCommerce_Germanized {
906
  $hide_input = $checkbox->hide_input();
907
  }
908
 
909
- /**
910
- * Filters script localization paramaters for the `wc-gzd-checkout` script.
911
- *
912
- * @since 1.0.0
913
- *
914
- * @param array $params Key => value array containing parameter name and value.
915
- */
916
  wp_localize_script( 'wc-gzd-checkout', 'wc_gzd_checkout_params', apply_filters( 'wc_gzd_checkout_params', array(
917
  'adjust_heading' => true,
918
  'checkbox_id' => $html_id,
@@ -920,15 +920,15 @@ final class WooCommerce_Germanized {
920
  ) ) );
921
  }
922
 
923
- /**
924
- * Localized scripts.
925
- *
926
- * This hook fires after Germanized has localized it's scripts.
927
- *
928
- * @since 1.0.0
929
- *
930
- * @param string $assets_path The absolute URL to the plugins assets.
931
- */
932
  do_action( 'woocommerce_gzd_localized_scripts', $assets_path );
933
  }
934
 
@@ -991,7 +991,7 @@ final class WooCommerce_Germanized {
991
  $mails['WC_Email_Customer_On_Hold_Order'] = include 'includes/emails/class-wc-gzd-email-customer-on-hold-order.php';
992
  }
993
  }
994
-
995
  return $mails;
996
  }
997
 
@@ -1009,15 +1009,15 @@ final class WooCommerce_Germanized {
1009
  $core_file = $this->plugin_path() . '/templates/' . $template;
1010
  }
1011
 
1012
- /**
1013
- * Filters email templates.
1014
- *
1015
- * @since 1.0.0
1016
- *
1017
- * @param string $core_file The core template file.
1018
- * @param string $template The template name.
1019
- * @param string $template_base The template base folder.
1020
- */
1021
  return apply_filters( 'woocommerce_germanized_email_template_hook', $core_file, $template, $template_base );
1022
  }
1023
 
@@ -1132,7 +1132,7 @@ final class WooCommerce_Germanized {
1132
  'utm_content' => 'WOOCOMMERCEGERMANIZED',
1133
  ),
1134
  'signup_url' => 'http://www.trustbadge.com/de/Preise/',
1135
- ) );
1136
  }
1137
  }
1138
 
3
  * Plugin Name: Germanized for WooCommerce
4
  * Plugin URI: https://www.vendidero.de/woocommerce-germanized
5
  * Description: Germanized for WooCommerce extends WooCommerce to become a legally compliant store in the german market.
6
+ * Version: 2.3.4
7
  * Author: Vendidero
8
  * Author URI: https://vendidero.de
9
  * Requires at least: 3.8
31
  *
32
  * @var string
33
  */
34
+ public $version = '2.3.4';
35
 
36
  /**
37
  * Single instance of WooCommerce Germanized Main Class
129
 
130
  spl_autoload_register( array( $this, 'autoload' ) );
131
 
132
+ /**
133
+ * Filter the Germanized dependency manager instance.
134
+ *
135
+ * @since 1.0.0
136
+ *
137
+ * @param WC_GZD_Dependencies $dependency The dependency manager instance.
138
+ */
139
  $dependencies = apply_filters( 'woocommerce_gzd_dependencies_instance', WC_GZD_Dependencies::instance( $this ) );
140
 
141
  if ( ! $dependencies->is_loadable() ) {
142
  return;
143
  }
144
 
145
+ /**
146
+ * Before startup.
147
+ *
148
+ * This hook fires right before Germanized includes relevant files for startup.
149
+ *
150
+ * @since 1.0.0
151
+ */
152
  do_action( 'woocommerce_germanized_before_load' );
153
 
154
  $this->includes();
171
  $this->units = new WC_GZD_Units();
172
  $this->price_labels = new WC_GZD_Price_Labels();
173
 
174
+ /**
175
+ * After startup.
176
+ *
177
+ * This hook fires right after all relevant files for Germanized has been loaded.
178
+ *
179
+ * @since 1.0.0
180
+ */
181
  do_action( 'woocommerce_germanized_loaded' );
182
 
183
  if ( did_action( 'woocommerce_loaded' ) ) {
201
  */
202
  public function init() {
203
 
204
+ /**
205
+ * Initialize Germanized
206
+ *
207
+ * This hook fires as soon as Germanized initializes.
208
+ *
209
+ * @since 1.0.0
210
+ */
211
  do_action( 'before_woocommerce_germanized_init' );
212
 
213
  $this->load_plugin_textdomain();
248
 
249
  $this->emails = new WC_GZD_Emails();
250
 
251
+ /**
252
+ * Initialized Germanized
253
+ *
254
+ * This hook fires after Germanized has been initialized e.g. textdomain has been loaded and relevant
255
+ * have been placed.
256
+ *
257
+ * @since 1.0.0
258
+ */
259
  do_action( 'woocommerce_germanized_init' );
260
  }
261
 
267
  */
268
  public function autoload( $class ) {
269
 
270
+ $original_class = $class;
271
+ $class = strtolower( $class );
272
 
273
+ $matcher = array(
274
+ 'wc_gzd_',
275
+ 'ekomi\\',
276
+ 'digitick\sepa',
277
+ 'defuse\crypto',
278
+ );
279
 
280
+ $is_match = ( str_replace( $matcher, '', $class ) != $class );
281
 
282
+ if ( ! $is_match ) {
283
+ return;
284
+ }
285
 
286
  $path = $this->plugin_path() . '/includes/';
287
  $file = 'class-' . str_replace( '_', '-', $class ) . '.php';
336
  * @return string
337
  */
338
  public function template_path() {
339
+ /**
340
+ * Filter the default Germanized template path folder.
341
+ *
342
+ * ```php
343
+ * function ex_filter_template_path( $path ) {
344
+ * return 'woocommerce-germanized-test/';
345
+ * }
346
+ * add_filter( 'woocommerce_gzd_template_path', 'ex_filter_template_path', 10, 1 );
347
+ *
348
+ * @since 1.0.0
349
+ *
350
+ * @param string $path The relative path within your theme directory.
351
+ */
352
  return apply_filters( 'woocommerce_gzd_template_path', 'woocommerce-germanized/' );
353
  }
354
 
383
 
384
  include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin.php';
385
  include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin-welcome.php';
386
+ include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin-order.php';
387
  include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin-notices.php';
388
  include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin-customer.php';
389
  include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin-legal-checkboxes.php';
463
  include_once WC_GERMANIZED_ABSPATH . 'includes/class-wc-gzd-legal-checkbox-manager.php';
464
 
465
  // Product Attribute
466
+ if ( wc_gzd_get_dependencies()->woocommerce_version_supports_crud() ) {
467
+ include_once WC_GERMANIZED_ABSPATH . 'includes/class-wc-gzd-product-attribute.php';
468
+ include_once WC_GERMANIZED_ABSPATH . 'includes/class-wc-gzd-product-attribute-helper.php';
469
+ }
470
  }
471
 
472
  public function is_frontend() {
474
  }
475
 
476
  public function is_rest_api_request() {
477
+ if ( function_exists( 'WC' ) ) {
478
+ $wc = WC();
479
 
480
+ if ( is_callable( array( $wc, 'is_rest_api_request' ) ) ) {
481
+ return $wc->is_rest_api_request();
482
+ }
483
+ }
484
 
485
+ return false;
486
+ }
487
 
488
  public function setup_compatibility() {
489
 
490
+ /**
491
+ * Filter compatibility classes.
492
+ *
493
+ * This filter allows third party developers to register compatibility scripts
494
+ * for certain plugins or themes. Class prefix: `WC_GZD_Compatibility_` is expected.
495
+ * Make sure to include your class accordingly.
496
+ *
497
+ * @since 1.9.1
498
+ *
499
+ * @param array[string] $comp Array containing the compatibilities.
500
+ */
501
  $plugins = apply_filters( 'woocommerce_gzd_compatibilities',
502
  array(
503
  'wpml',
504
+ 'wpml-string-translation',
505
  'polylang',
506
  'woo-poly-integration',
507
  'woocommerce-dynamic-pricing',
512
  'woocommerce-subscriptions',
513
  'woo-paypalplus',
514
  'dhl-for-woocommerce',
515
+ 'elementor-pro',
516
  )
517
  );
518
 
526
  }
527
 
528
  public function get_compatibility( $name ) {
529
+ return ( isset( $this->compatibilities[ $name ] ) ? $this->compatibilities[ $name ] : false );
530
+ }
531
 
532
  /**
533
  * Include required frontend files.
560
 
561
  $GLOBALS['wc_gzd_template_name'][] = $template_name;
562
 
563
+ // Check for Theme overrides
564
+ $theme_template = locate_template( array(
565
+ trailingslashit( $template_path ) . $template_name,
566
+ ) );
567
+
568
+ /**
569
+ * Filters the template name.
570
+ *
571
+ * @since 1.0.0
572
+ *
573
+ * @param string $template_name The template name e.g. checkboxes/default.php
574
+ */
575
  $template_name = apply_filters( 'woocommerce_gzd_template_name', $template_name );
576
 
577
  /** This filter is documented in woocommerce-germanized.php */
578
  if ( ! $theme_template && file_exists( apply_filters( 'woocommerce_gzd_default_plugin_template', $this->plugin_path() . '/templates/' . $template_name, $template_name ) ) ) {
579
+ /**
580
+ * Filter the default plugin template file.
581
+ *
582
+ * This file is being loaded as a default template if no theme template was found.
583
+ *
584
+ * @since 1.0.0
585
+ *
586
+ * @params string $path The absolute path to the template.
587
+ */
588
+ $template = apply_filters( 'woocommerce_gzd_default_plugin_template', $this->plugin_path() . '/templates/' . $template_name, $template_name );
589
  } elseif ( $theme_template ) {
590
  $template = $theme_template;
591
  }
592
 
593
+ /**
594
+ * Filters the actual loaded template.
595
+ *
596
+ * This filter allows filtering the located template path (whether theme or plugin).
597
+ *
598
+ * @since 1.0.0
599
+ *
600
+ * @params string $template The path to the template.
601
+ * @params string $template_name The template name e.g. checkboxes/default.php.
602
+ * @params string $template_path Germanized template path.
603
+ */
604
  return apply_filters( 'woocommerce_germanized_filter_template', $template, $template_name, $template_path );
605
  }
606
 
610
  * @return array
611
  */
612
  public function get_critical_templates() {
613
+ /**
614
+ * Filters critical template which should be prevented from overriding.
615
+ *
616
+ * @since 1.0.0
617
+ *
618
+ * @param array $templates Array containing the template names.
619
+ */
620
  return apply_filters( 'woocommerce_gzd_important_templates', array() );
621
  }
622
 
738
  $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
739
  $locale = apply_filters( 'plugin_locale', $locale, 'woocommerce-germanized' );
740
 
741
+ unload_textdomain( 'woocommerce-germanized' );
742
+ load_textdomain( 'woocommerce-germanized', trailingslashit( WP_LANG_DIR ) . 'woocommerce-germanized/woocommerce-germanized-' . $locale . '.mo' );
743
  load_plugin_textdomain( 'woocommerce-germanized', false, plugin_basename( dirname( __FILE__ ) ) . '/i18n/languages/' );
744
  }
745
 
802
  wp_register_style( 'woocommerce-gzd-layout', $assets_path . 'css/woocommerce-gzd-layout' . $suffix . '.css', array(), WC_GERMANIZED_VERSION );
803
  wp_enqueue_style( 'woocommerce-gzd-layout' );
804
 
805
+ /**
806
+ * Register frontend scripts and styles.
807
+ *
808
+ * This hook executes right after Germanized has registered and enqueued relevant scripts and styles for the
809
+ * frontend.
810
+ *
811
+ * @since 1.0.0
812
+ *
813
+ * @param string $suffix The asset suffix e.g. .min in non-debugging mode.
814
+ * @param string $frontend_script_path The absolute URL to the plugins JS files.
815
+ * @param string $assets_path The absolute URL to the plugins asset files.
816
+ */
817
  do_action( 'woocommerce_gzd_registered_scripts', $suffix, $frontend_script_path, $assets_path );
818
  }
819
 
843
 
844
  $this->localized_scripts[] = 'wc-gzd-revocation';
845
 
846
+ /**
847
+ * Filters script localization paramaters for the `wc-gzd-revocation` script.
848
+ *
849
+ * @since 1.0.0
850
+ *
851
+ * @param array $params Key => value array containing parameter name and value.
852
+ */
853
  wp_localize_script( 'wc-gzd-revocation', 'wc_gzd_revocation_params', apply_filters( 'wc_gzd_revocation_params', array(
854
  'ajax_url' => WC()->ajax_url(),
855
  'wc_ajax_url' => WC_AJAX::get_endpoint( "%%endpoint%%" ),
861
 
862
  $this->localized_scripts[] = 'wc-gzd-add-to-cart-variation';
863
 
864
+ /**
865
+ * Filters script localization paramaters for the `wc-gzd-add-to-cart-variation` script.
866
+ *
867
+ * @since 1.0.0
868
+ *
869
+ * @param array $params Key => value array containing parameter name and value.
870
+ */
871
  wp_localize_script( 'wc-gzd-add-to-cart-variation', 'wc_gzd_add_to_cart_variation_params', apply_filters( 'woocommerce_gzd_add_to_cart_variation_params', array(
872
  'wrapper' => '.type-product',
873
  'price_selector' => '.price',
881
 
882
  $this->localized_scripts[] = 'wc-gzd-force-pay-order';
883
 
884
+ /**
885
+ * Filters script localization paramaters for the `wc-gzd-force-pay-order` script.
886
+ *
887
+ * @since 1.0.0
888
+ *
889
+ * @param array $params Key => value array containing parameter name and value.
890
+ */
891
  wp_localize_script( 'wc-gzd-force-pay-order', 'wc_gzd_force_pay_order_params', apply_filters( 'wc_gzd_force_pay_order_params', array(
892
  'order_id' => $order_id,
893
  'gateway' => wc_gzd_get_crud_data( $order, 'payment_method' ),
906
  $hide_input = $checkbox->hide_input();
907
  }
908
 
909
+ /**
910
+ * Filters script localization paramaters for the `wc-gzd-checkout` script.
911
+ *
912
+ * @since 1.0.0
913
+ *
914
+ * @param array $params Key => value array containing parameter name and value.
915
+ */
916
  wp_localize_script( 'wc-gzd-checkout', 'wc_gzd_checkout_params', apply_filters( 'wc_gzd_checkout_params', array(
917
  'adjust_heading' => true,
918
  'checkbox_id' => $html_id,
920
  ) ) );
921
  }
922
 
923
+ /**
924
+ * Localized scripts.
925
+ *
926
+ * This hook fires after Germanized has localized it's scripts.
927
+ *
928
+ * @since 1.0.0
929
+ *
930
+ * @param string $assets_path The absolute URL to the plugins assets.
931
+ */
932
  do_action( 'woocommerce_gzd_localized_scripts', $assets_path );
933
  }
934
 
991
  $mails['WC_Email_Customer_On_Hold_Order'] = include 'includes/emails/class-wc-gzd-email-customer-on-hold-order.php';
992
  }
993
  }
994
+
995
  return $mails;
996
  }
997
 
1009
  $core_file = $this->plugin_path() . '/templates/' . $template;
1010
  }
1011
 
1012
+ /**
1013
+ * Filters email templates.
1014
+ *
1015
+ * @since 1.0.0
1016
+ *
1017
+ * @param string $core_file The core template file.
1018
+ * @param string $template The template name.
1019
+ * @param string $template_base The template base folder.
1020
+ */
1021
  return apply_filters( 'woocommerce_germanized_email_template_hook', $core_file, $template, $template_base );
1022
  }
1023
 
1132
  'utm_content' => 'WOOCOMMERCEGERMANIZED',
1133
  ),
1134
  'signup_url' => 'http://www.trustbadge.com/de/Preise/',
1135
+ ) );
1136
  }
1137
  }
1138