Saphali Woocommerce Russian - Version 1.8.11

Version Description

  • Fix .
Download this release

Release Info

Developer Saphali
Plugin Icon wp plugin Saphali Woocommerce Russian
Version 1.8.11
Comparing to
See all releases

Code changes from version 1.8.10 to 1.8.11

Files changed (2) hide show
  1. readme.txt +5 -2
  2. saphali-woocommerce-lite.php +38 -15
readme.txt CHANGED
@@ -5,8 +5,8 @@ Plugin URI: http://saphali.com/saphali-woocommerce-plugin-wordpress
5
  Donate link: https://money.yandex.ru/to/410011651211340
6
  Tags: woocommerce, woo commerce russian, russian ruble, ukrainian hryvnia, mod, manadger filds checkout
7
  Requires at least: WP 3.3 or higher & WooCommerce 1.6.6 or higher
8
- Tested up to: 5.5
9
- Stable tag: 1.8.10
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -76,6 +76,9 @@ define('SAPHALI_LITE_SYMBOL', 0 );
76
 
77
  == Changelog ==
78
 
 
 
 
79
  = 1.8.10 =
80
  * Исправление ошибок.
81
 
5
  Donate link: https://money.yandex.ru/to/410011651211340
6
  Tags: woocommerce, woo commerce russian, russian ruble, ukrainian hryvnia, mod, manadger filds checkout
7
  Requires at least: WP 3.3 or higher & WooCommerce 1.6.6 or higher
8
+ Tested up to: 5.7
9
+ Stable tag: 1.8.11
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
76
 
77
  == Changelog ==
78
 
79
+ = 1.8.11 =
80
+ * Fix обработки ошибок.
81
+
82
  = 1.8.10 =
83
  * Исправление ошибок.
84
 
saphali-woocommerce-lite.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Saphali Woocommerce Russian
4
  Plugin URI: http://saphali.com/saphali-woocommerce-plugin-wordpress
5
  Description: Saphali Woocommerce Russian - это бесплатный вордпресс плагин, который добавляет набор дополнений к интернет-магазину на Woocommerce.
6
- Version: 1.8.10
7
  Author: Saphali
8
  Author URI: http://saphali.com/
9
  Text Domain: saphali-woocommerce-lite
10
  Domain Path: /languages
11
  WC requires at least: 1.6.6
12
- WC tested up to: 4.6
13
  */
14
 
15
 
@@ -35,7 +35,7 @@ WC tested up to: 4.6
35
 
36
  // Подключение валюты и локализации
37
  define('SAPHALI_PLUGIN_DIR_URL',plugin_dir_url(__FILE__));
38
- define('SAPHALI_LITE_VERSION', '1.8.10' );
39
  define('SAPHALI_PLUGIN_DIR_PATH',plugin_dir_path(__FILE__));
40
  class saphali_lite {
41
  var $email_order_id;
@@ -115,7 +115,7 @@ WC tested up to: 4.6
115
  global $woocommerce;
116
  if(!empty($woocommerce->errors)) {
117
  foreach($woocommerce->errors as $i => $_e) {
118
- if( strpos($_e, strtolower($value["rf"]) ) !== false || strpos($_e, $value["rf"]) !== false ) {
119
  unset($woocommerce->errors[$i]);
120
  }
121
  }
@@ -125,7 +125,7 @@ WC tested up to: 4.6
125
  $notices = $s->get( 'wc_notices', array() );
126
  if( isset( $notices['error'] ) ) {
127
  foreach($notices['error'] as $i => $_e) {
128
- if( strpos($_e, strtolower($value["rf"]) ) !== false || strpos($_e, $value["rf"]) !== false ) {
129
  unset($notices['error'][$i]);
130
  }
131
  }
@@ -145,8 +145,15 @@ WC tested up to: 4.6
145
  if( strpos($_e, strtolower(__($value["rf"], 'woocommerce')) ) !== false || strpos($_e, __($value["rf"], 'woocommerce')) !== false ) {
146
  unset($errors->errors["required-field"][$i]);
147
  }
 
148
  }
149
 
 
 
 
 
 
 
150
  }
151
  }
152
  }
@@ -264,14 +271,19 @@ public function woocommerce_checkout_posted_data( $data ) {
264
  switch ($value["type"]) {
265
  case 'shipping' :
266
  /* translators: %s: field name */
267
- $field_label = __( 'Shipping %s', 'woocommerce' );
268
  break;
269
  case 'billing' :
270
  /* translators: %s: field name */
271
- $field_label = __( 'Billing %s', 'woocommerce' );
272
  break;
273
  }
274
- $fl = function_exists('mb_strtolower') ? mb_strtolower( sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . $value["rf"] . '</strong>' ) ) : sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . $value["rf"] . '</strong>' );
 
 
 
 
 
275
  $this->comp_woocomerce_mess_error( sprintf( $field_label, $fl ) );
276
  }
277
  }
@@ -293,14 +305,20 @@ public function woocommerce_checkout_posted_data( $data ) {
293
  switch ($value["type"]) {
294
  case 'shipping' :
295
  /* translators: %s: field name */
296
- $field_label = __( 'Shipping %s', 'woocommerce' );
297
  break;
298
  case 'billing' :
299
  /* translators: %s: field name */
300
- $field_label = __( 'Billing %s', 'woocommerce' );
301
  break;
302
  }
303
- $fl = function_exists('mb_strtolower') ? mb_strtolower( sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . $value["rf"] . '</strong>' ) ) : sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . $value["rf"] . '</strong>' );
 
 
 
 
 
 
304
  $this->comp_woocomerce_mess_error( sprintf( $field_label, $fl ) );
305
  }
306
  }
@@ -992,23 +1010,28 @@ public function woocommerce_checkout_posted_data( $data ) {
992
  <td><input <?php if( isset($value['required'] ) && $value['required']) echo 'checked'?> type="checkbox" name="billing[<?php echo $key?>][required]" /></td>
993
  <td><input <?php if(isset($value[$public]) && $value[$public]) echo 'checked';?> type="checkbox" name="billing[<?php echo $key?>][<?php echo $public; ?>]" /></td>
994
  <td>
 
995
  <select multiple="multiple" width="120px" name="billing[<?php echo $key?>][payment_method][]">
996
- <option value="0"<?php if( isset($value['payment_method']) && ( in_array('0', $value['payment_method']) || empty($value['payment_method']) ) || !isset($value['payment_method']) ) echo 'selected';?>>Все</option>
 
 
 
 
997
  <?php
998
  foreach ( $woocommerce->payment_gateways->payment_gateways() as $gateway ) {
999
  if ( $gateway->enabled != 'yes' ) continue;
1000
- ?><option value="<?php echo $gateway->id; ?>" <?php if(isset($value['payment_method']) && in_array($gateway->id, $value['payment_method']) ) echo 'selected';?>><?php echo $gateway->title; ?></option><?php
1001
  }
1002
  ?>
1003
  </select>
1004
  </td>
1005
  <td>
1006
  <select multiple="multiple" width="120px" name="billing[<?php echo $key?>][shipping_method][]">
1007
- <option value="0"<?php if( isset($value['shipping_method']) && ( in_array('0', $value['shipping_method']) || empty($value['shipping_method']) ) || !isset($value['shipping_method']) ) echo 'selected';?>>Все</option>
1008
  <?php
1009
  foreach ( $woocommerce->shipping->get_shipping_methods() as $act_id => $shipping ) {
1010
  if ( $shipping->enabled == 'no' ) continue;
1011
- ?><option value="<?php echo $act_id; ?>" <?php if(isset($value['shipping_method']) && in_array($act_id, $value['shipping_method']) ) echo 'selected';?>><?php echo $shipping->title ? $shipping->title: $shipping->method_title; ?></option><?php
1012
  }
1013
  ?>
1014
  </select>
3
  Plugin Name: Saphali Woocommerce Russian
4
  Plugin URI: http://saphali.com/saphali-woocommerce-plugin-wordpress
5
  Description: Saphali Woocommerce Russian - это бесплатный вордпресс плагин, который добавляет набор дополнений к интернет-магазину на Woocommerce.
6
+ Version: 1.8.11
7
  Author: Saphali
8
  Author URI: http://saphali.com/
9
  Text Domain: saphali-woocommerce-lite
10
  Domain Path: /languages
11
  WC requires at least: 1.6.6
12
+ WC tested up to: 5.1
13
  */
14
 
15
 
35
 
36
  // Подключение валюты и локализации
37
  define('SAPHALI_PLUGIN_DIR_URL',plugin_dir_url(__FILE__));
38
+ define('SAPHALI_LITE_VERSION', '1.8.11' );
39
  define('SAPHALI_PLUGIN_DIR_PATH',plugin_dir_path(__FILE__));
40
  class saphali_lite {
41
  var $email_order_id;
115
  global $woocommerce;
116
  if(!empty($woocommerce->errors)) {
117
  foreach($woocommerce->errors as $i => $_e) {
118
+ if( strpos($_e, strtolower(__($value["rf"], 'woocommerce')) ) !== false || strpos($_e, __($value["rf"], 'woocommerce')) !== false ) {
119
  unset($woocommerce->errors[$i]);
120
  }
121
  }
125
  $notices = $s->get( 'wc_notices', array() );
126
  if( isset( $notices['error'] ) ) {
127
  foreach($notices['error'] as $i => $_e) {
128
+ if( strpos($_e, strtolower(__($value["rf"], 'woocommerce')) ) !== false || strpos($_e, __($value["rf"], 'woocommerce')) !== false ) {
129
  unset($notices['error'][$i]);
130
  }
131
  }
145
  if( strpos($_e, strtolower(__($value["rf"], 'woocommerce')) ) !== false || strpos($_e, __($value["rf"], 'woocommerce')) !== false ) {
146
  unset($errors->errors["required-field"][$i]);
147
  }
148
+
149
  }
150
 
151
+ } elseif( isset( $errors->errors ) && is_array($errors->errors) && (strpos(array_keys( $errors->errors )[0], 'billing_') === 0 || strpos(array_keys( $errors->errors )[0], 'shipping_') === 0) ) {
152
+ foreach($errors->errors as $i => $_e) {
153
+ if( strpos($_e[0], strtolower(__($value["rf"], 'woocommerce')) ) !== false || strpos($_e[0], __($value["rf"], 'woocommerce')) !== false ) {
154
+ unset($errors->errors[$i]);
155
+ }
156
+ }
157
  }
158
  }
159
  }
271
  switch ($value["type"]) {
272
  case 'shipping' :
273
  /* translators: %s: field name */
274
+ $field_label = __(_x( 'Shipping %s', 'checkout-validation', 'woocommerce' ), 'woocommerce' );
275
  break;
276
  case 'billing' :
277
  /* translators: %s: field name */
278
+ $field_label = __(_x( 'Billing %s', 'checkout-validation', 'woocommerce' ), 'woocommerce' );
279
  break;
280
  }
281
+ if(version_compare( WOOCOMMERCE_VERSION, '5.1.0', '<' )) {
282
+ $fl = function_exists('mb_strtolower') ? mb_strtolower( sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . __( $value["rf"], 'woocommerce' ) . '</strong>' ) ) : sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . __( $value["rf"], 'woocommerce' ) . '</strong>' );
283
+ } else {
284
+ $field_label = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . $field_label . '</strong>' );
285
+ $fl = __( $value["rf"], 'woocommerce' );
286
+ }
287
  $this->comp_woocomerce_mess_error( sprintf( $field_label, $fl ) );
288
  }
289
  }
305
  switch ($value["type"]) {
306
  case 'shipping' :
307
  /* translators: %s: field name */
308
+ $field_label = __(_x( 'Shipping %s', 'checkout-validation', 'woocommerce' ), 'woocommerce' );
309
  break;
310
  case 'billing' :
311
  /* translators: %s: field name */
312
+ $field_label = __(_x( 'Billing %s', 'checkout-validation', 'woocommerce' ), 'woocommerce' );
313
  break;
314
  }
315
+ if(version_compare( WOOCOMMERCE_VERSION, '5.1.0', '<' )) {
316
+ $fl = function_exists('mb_strtolower') ? mb_strtolower( sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . __( $value["rf"], 'woocommerce' ) . '</strong>' ) ) : sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . __( $value["rf"], 'woocommerce' ) . '</strong>' );
317
+ } else {
318
+ $field_label = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . $field_label . '</strong>' );
319
+ $fl = __( $value["rf"], 'woocommerce' );
320
+ }
321
+
322
  $this->comp_woocomerce_mess_error( sprintf( $field_label, $fl ) );
323
  }
324
  }
1010
  <td><input <?php if( isset($value['required'] ) && $value['required']) echo 'checked'?> type="checkbox" name="billing[<?php echo $key?>][required]" /></td>
1011
  <td><input <?php if(isset($value[$public]) && $value[$public]) echo 'checked';?> type="checkbox" name="billing[<?php echo $key?>][<?php echo $public; ?>]" /></td>
1012
  <td>
1013
+
1014
  <select multiple="multiple" width="120px" name="billing[<?php echo $key?>][payment_method][]">
1015
+ <option value="0"<?php if( isset($value['payment_method']) && (
1016
+ is_array($value['payment_method']) && in_array('0', $value['payment_method']) ||
1017
+ empty($value['payment_method']) ) ||
1018
+ !isset($value['payment_method']) )
1019
+ echo 'selected';?>>Все</option>
1020
  <?php
1021
  foreach ( $woocommerce->payment_gateways->payment_gateways() as $gateway ) {
1022
  if ( $gateway->enabled != 'yes' ) continue;
1023
+ ?><option value="<?php echo $gateway->id; ?>" <?php if(isset($value['payment_method']) && is_array($value['payment_method']) && in_array($gateway->id, $value['payment_method']) ) echo 'selected';?>><?php echo $gateway->title; ?></option><?php
1024
  }
1025
  ?>
1026
  </select>
1027
  </td>
1028
  <td>
1029
  <select multiple="multiple" width="120px" name="billing[<?php echo $key?>][shipping_method][]">
1030
+ <option value="0"<?php if( isset($value['shipping_method']) && ( is_array($value['shipping_method']) && in_array('0', $value['shipping_method']) || empty($value['shipping_method']) ) || !isset($value['shipping_method']) ) echo 'selected';?>>Все</option>
1031
  <?php
1032
  foreach ( $woocommerce->shipping->get_shipping_methods() as $act_id => $shipping ) {
1033
  if ( $shipping->enabled == 'no' ) continue;
1034
+ ?><option value="<?php echo $act_id; ?>" <?php if(isset($value['shipping_method']) && is_array($value['shipping_method']) && in_array($act_id, $value['shipping_method']) ) echo 'selected';?>><?php echo $shipping->title ? $shipping->title: $shipping->method_title; ?></option><?php
1035
  }
1036
  ?>
1037
  </select>