Persian Woocommerce - Version 2.6.3

Version Description

*

Download this release

Release Info

Developer hannanstd
Plugin Icon 128x128 Persian Woocommerce
Version 2.6.3
Comparing to
See all releases

Code changes from version 2.6.2 to 2.6.3

include/class-yahoo-download-problem.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
  if ( ! defined( 'ABSPATH' ) )
3
  exit; // Exit if accessed directly
4
 
1
+ <?php
2
  if ( ! defined( 'ABSPATH' ) )
3
  exit; // Exit if accessed directly
4
 
include/persian-woocommerce.php CHANGED
@@ -1,231 +1,300 @@
1
  <?php
2
 
3
- class Persian_Wooommerce_Plugin {
4
-
5
- public $table_lang;
6
- public $plugin_version;
7
- public $woo_is_active = false;
8
- public $file_dir;
9
- public $iran_address;
10
- public $currencies;
11
- public $rtl;
12
- public $widget;
13
- public $tools;
14
-
15
- private $options;
16
-
17
- public function __construct( $file ) {
18
-
19
- if(!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))))
20
- add_action('admin_notices', array($this, 'enable_woocommerce_notify') );
21
- else
22
- $this->woo_is_active = true;
23
-
24
- global $wpdb;
25
-
26
- $this->table_lang = $wpdb->prefix . "woocommerce_ir";
27
- $this->plugin_version = defined('PERSIAN_WOOCOMMERCE_VERSION') ? PERSIAN_WOOCOMMERCE_VERSION : '2.5';
28
- $this->file_dir = $file;
29
- $this->options = get_option("PW_Options");
30
-
31
- // Actions
32
- add_action('wp_ajax_nopriv_persian_wc_replace_texts', array($this,'replace_texts_callback') );
33
- add_action('wp_ajax_persian_wc_replace_texts', array($this,'replace_texts_callback') );
34
- add_action('plugins_loaded', array($this, 'persian_woo_plugin_loaded') );
35
- add_action('activated_plugin', array($this, 'persian_woo_activate'), 10, 1);
36
- add_action('admin_menu', array($this, 'persian_wc_create_menu') );
37
- add_action('WC_Gateway_Payment_Actions', array($this, 'pw_gateway_copyright') );
38
-
39
- // Filters
40
- add_filter('woocommerce_admin_field_multi_select_states', array($this, 'persian_wc_output_fields') );
41
- add_filter('gettext_with_context', array($this, 'persian_wc_gettext') );
42
- add_filter('ngettext_with_context', array($this, 'persian_wc_gettext') );
43
- add_filter('gettext', array($this, 'persian_wc_gettext') );
44
- add_filter('ngettext', array($this, 'persian_wc_gettext') );
45
-
46
- }
47
-
48
- public function plugin_url( $path = null ){
49
- return untrailingslashit(plugins_url( is_null($path) ? '/' : $path , $this->file_dir));
50
- }
51
-
52
- public function get_options( $option_name = null, $default = false){
53
-
54
- if(is_null($option_name))
55
- return $this->options;
56
-
57
- $default_options = $this->tools->get_tools_default();
58
-
59
- if(isset($this->options[$option_name]))
60
- return $this->options[$option_name];
61
- elseif(isset($default_options["PW_Options[$option_name]"]))
62
- return $default_options["PW_Options[$option_name]"];
63
- else
64
- return $default;
65
- }
66
-
67
- // Action functions
68
- public function enable_woocommerce_notify() {
69
- if(current_user_can('install_plugins'))
70
- echo sprintf('<div id="message" class="notice notice-info is-dismissible"><p>ووکامرس فارسی با موفقیت نصب و فعالسازی شده است . لطفا افزونه ووکامرس را از <a href="%s" target="_blank">اینجا</a> فعال کنید.</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">بستن این اعلان.</span></button></div>', admin_url('plugins.php'));
71
- }
72
-
73
- public function replace_texts_callback(){
74
- global $wpdb;
75
- $json = array(
76
- 'status' => 'NO',
77
- 'rand' => mt_rand(),
78
- 'msg' => 'مشکلی هنگام افزودن حلقه رخ داد . لطفا مجددا تلاش کنید.'
79
- );
80
-
81
- if(isset($_POST['text1'] , $_POST['text2']))
82
- if(!empty($_POST['text1'])){
83
- $insert = $wpdb->insert($this->table_lang , array('text1' => $_POST['text1'] , 'text2' => $_POST['text2']));
84
- if($insert) {
85
- $json['status'] = 'OK';
86
- $json['msg'] = sprintf('<div id="setting-error-persian_wc_msg_%d" class="updated settings-error notice is-dismissible"><p><strong>حلقه (%s => %s) با موفقیت افزوده شد.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">بستن این اعلان.</span></button></div>', $json['rand'], $_POST['text1'], $_POST['text2']);
87
- $json['code'] = sprintf('<tr><th scope="row" class="check-column"><input name="text_delete_id[]" value="%d" type="checkbox"></th><td class="text1 column-text1 has-row-actions column-primary" data-colname="حلقه‌ی اصلی">%s<button type="button" class="toggle-row"><span class="screen-reader-text">نمایش جزئیات بیشتر</span></button></td><td class="text2 column-text2" data-colname="حلقه‌ی جایگزین شده">%s</td></tr>', $wpdb->insert_id , $_POST['text1'], $_POST['text2']);
88
- $json['count'] = $wpdb->get_var("SELECT COUNT(*) FROM $this->table_lang") . " مورد";
89
- }
90
- else
91
- $json['msg'] = sprintf('<div id="setting-error-persian_wc_msg_%d" class="error settings-error notice is-dismissible"><p><strong>خطایی در زمان افزودن حلقه (%s => %s) به دیتابیس رخ داده است. لطفا مجددا تلاش کنید</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">بستن این اعلان.</span></button></div>', $json['rand'], $_POST['text1'], $_POST['text2']);
92
- }
93
- else
94
- $json['msg'] = sprintf('<div id="setting-error-persian_wc_msg_%d" class="error settings-error notice is-dismissible"><p><strong>پر کردن فیلد کلمه‌ی مورد نظر اجباری می باشد.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">بستن این اعلان.</span></button></div>', $json['rand']);
95
-
96
- die(json_encode($json));
97
- }
98
-
99
-
100
- public function persian_woo_plugin_loaded() {
101
-
102
- $dir = dirname( plugin_dir_path( __FILE__ ));
103
- $language = get_option('WPLANG', defined('WPLANG') ? WPLANG : "");
104
- $is_persian = ($language == 'fa' || $language == 'fa_IR');
105
-
106
- if(defined('ICL_LANGUAGE_CODE'))
107
- $is_persian = (ICL_LANGUAGE_CODE == 'fa');
108
-
109
- if($is_persian || substr(get_bloginfo('language'), 0, 2) == 'fa')
110
- load_textdomain('woocommerce', $dir.'/languages/woocommerce-fa_IR.mo');
111
-
112
- global $wpdb;
113
-
114
- if(!get_option("pw_delete_city_table_2_5")) {
115
- $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}Woo_Iran_Cities_By_HANNANStd");
116
- $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_ir_cities");
117
- delete_option("is_cities_installed");
118
- delete_option("persian_woocommerce_rename_old_table");
119
- delete_option("redirect_to_woo_persian_about_page");
120
- update_option("pw_delete_city_table_2_5", $this->plugin_version);
121
- }
122
- }
123
-
124
- public function persian_woo_activate( $plugin ) {
125
- if($plugin !== "persian-woocommerce/persian-woocommerce.php")
126
- return;
127
-
128
- if(!headers_sent()){
129
- wp_redirect(admin_url('admin.php?page=persian-wc-about'));
130
- die();
131
- }
132
- }
133
-
134
- public function persian_wc_create_menu() {
135
- add_menu_page('ووکامرس فارسی', 'ووکامرس فارسی', 'manage_options', 'persian-wc', array($this, 'persian_wc_text'), $this->plugin_url('include/assets/images/logo.png'), '55.6');
136
- add_submenu_page('persian-wc', 'حلقه های ترجمه', 'حلقه های ترجمه', 'manage_options', 'persian-wc', array($this, 'persian_wc_text'));
137
-
138
- if($this->woo_is_active){
139
- $tools_page = add_submenu_page('persian-wc', 'ابزار ها', 'ابزار ها', 'manage_options', 'persian-wc-tools', array($this, 'persian_wc_tools'));
140
- add_action( "load-{$tools_page}", array($this, 'persian_wc_tools_save') );
141
- }
142
-
143
- do_action("PW_Menu");
144
- add_submenu_page('persian-wc', 'درباره ما', 'درباره ما', 'manage_options', 'persian-wc-about', array($this, 'persian_wc_about'));
145
- }
146
-
147
- public function persian_wc_text() {
148
- global $wpdb;
149
- include_once('persian-woocommerce-text.php');
150
- }
151
-
152
- public function persian_wc_tools(){
153
- $this->tools->settings_page();
154
- }
155
-
156
- public function persian_wc_tools_save(){
157
- if( isset($_POST["pw-settings-submit"]) && $_POST["pw-settings-submit"] == 'Y') {
158
- $settings = $this->tools->get_tools();
159
- $tab = $_POST['pw-tab'];
160
- $section = $_POST['pw-section'];
161
- check_admin_referer("persian-wc-tools");
162
- do_action("PW_before_save_tools", $_POST, $settings, $tab, $section);
163
- WC_Admin_Settings::save_fields( empty($section) ? $settings[$tab] : $settings[$tab][$section] );
164
- do_action("PW_after_save_tools", $_POST, $settings, $tab, $section);
165
- $url_parameters = empty($section) ? 'updated=true&tab='.$tab : 'updated=true&tab='.$tab.'&section='.$section;
166
- wp_redirect(admin_url('admin.php?page=persian-wc-tools&'.$url_parameters));
167
- exit;
168
- }
169
- }
170
-
171
- public function persian_wc_about() {
172
- include_once('persian-woocommerce-about.php');
173
- }
174
-
175
- public function pw_gateway_copyright( $arg ) {
176
- if( base64_encode(strtolower($arg)) != 'd29vY29tbWVyY2UuaXI=' )
177
- die(base64_decode('2KfbjNmGINiv2LHar9in2Ycg2b7Ysdiv2KfYrtiqINqp2KfZhdmE2Kcg2qnZvtuMINio2LHYr9in2LHbjCDYtNiv2Ycg2KfYsiDYr9ix2q/Yp9mHINmH2KfbjCDYt9ix2KfYrduMINi02K/ZhyDYqtmI2LPYtyDZiNmI2qnYp9mF2LHYsyDZvtin2LHYs9uMINin2LPYqiDZiCDYp9uM2YYg2LnZhdmEINio2K/ZiNmGINin2KzYp9iy2Ycg2KjYsdmG2KfZhdmHINmG2YjbjNizINin2YbYrNin2YUg2LTYr9mHINin2LPYqi4='));
178
- }
179
-
180
- // register hook functions
181
- static function persian_wc_install() {
182
- global $wpdb;
183
-
184
- $woocommerce_ir_sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}woocommerce_ir` (
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  `id` int(11) NOT NULL AUTO_INCREMENT,
186
  `text1` text CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
187
  `text2` text CHARACTER SET utf8 COLLATE utf8_persian_ci,
188
  PRIMARY KEY (`id`)
189
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
190
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
191
- dbDelta($woocommerce_ir_sql);
192
- }
193
-
194
- // Filter functions
195
- public function persian_wc_output_fields( $value ){
196
-
197
- $selections = (array) $this->get_options('specific_allowed_states');
198
-
199
- ?><tr valign="top">
200
- <th scope="row" class="titledesc">
201
- <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
202
- </th>
203
- <td class="forminp">
204
- <select multiple="multiple" name="<?php echo esc_attr( $value['id'] ); ?>[]" style="width:350px" data-placeholder="استان (ها) مورد نظر خود را انتخاب کنید ..." title="استان" class="wc-enhanced-select">
205
- <?php
206
- if ( ! empty( $this->iran_address->states ) )
207
- foreach ( $this->iran_address->states as $key => $val )
208
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( in_array( $key, $selections ), true, false ).'>' . $val . '</option>';
209
- ?>
210
- </select> </br><a class="select_all button" href="#"><?php _e( 'Select all', 'woocommerce' ); ?></a> <a class="select_none button" href="#"><?php _e( 'Select none', 'woocommerce' ); ?></a>
211
- </td>
212
- </tr><?php
213
- }
214
-
215
- public function persian_wc_gettext( $text ) {
216
- static $replace, $keys;
217
- global $wpdb;
218
- if(!is_array($replace)) {
219
- $replace = array();
220
- $query = $wpdb->get_results("SELECT * FROM {$this->table_lang};");
221
-
222
- if($wpdb->num_rows)
223
- foreach($query as $txt)
224
- $replace[$txt->text1] = $txt->text2;
225
-
226
- $keys = array_keys($replace);
227
- }
228
-
229
- return str_replace($keys, $replace, $text);
230
- }
 
 
 
 
 
 
231
  }
1
  <?php
2
 
3
+ class Persian_Wooommerce_Plugin
4
+ {
5
+
6
+ public $table_lang;
7
+ public $plugin_version;
8
+ public $woo_is_active = false;
9
+ public $file_dir;
10
+ public $iran_address;
11
+ public $currencies;
12
+ public $rtl;
13
+ public $widget;
14
+ public $tools;
15
+ public $gw;
16
+
17
+ private $options;
18
+
19
+ public function __construct($file)
20
+ {
21
+
22
+ if (!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))))
23
+ add_action('admin_notices', array($this, 'enable_woocommerce_notify'));
24
+ else
25
+ $this->woo_is_active = true;
26
+
27
+ global $wpdb;
28
+
29
+ $this->gw = base64_decode('emFy');
30
+
31
+ $this->table_lang = $wpdb->prefix . "woocommerce_ir";
32
+ $this->plugin_version = defined('PERSIAN_WOOCOMMERCE_VERSION') ? PERSIAN_WOOCOMMERCE_VERSION : '2.5';
33
+ $this->file_dir = $file;
34
+ $this->options = get_option("PW_Options");
35
+
36
+ // Actions
37
+ add_action('wp_ajax_nopriv_persian_wc_replace_texts', array($this, 'replace_texts_callback'));
38
+ add_action('wp_ajax_persian_wc_replace_texts', array($this, 'replace_texts_callback'));
39
+ add_action('plugins_loaded', array($this, 'persian_woo_plugin_loaded'));
40
+ add_action('activated_plugin', array($this, 'persian_woo_activate'), 10, 1);
41
+ add_action('admin_menu', array($this, 'persian_wc_create_menu'));
42
+ add_action('WC_Gateway_Payment_Actions', array($this, 'pw_gateway_copyright'));
43
+
44
+ // Filters
45
+ add_filter('woocommerce_admin_field_multi_select_states', array($this, 'persian_wc_output_fields'));
46
+ add_filter('gettext_with_context', array($this, 'persian_wc_gettext'));
47
+ add_filter('ngettext_with_context', array($this, 'persian_wc_gettext'));
48
+ add_filter('gettext', array($this, 'persian_wc_gettext'));
49
+ add_filter('ngettext', array($this, 'persian_wc_gettext'));
50
+
51
+ }
52
+
53
+ public function plugin_url($path = null)
54
+ {
55
+ return untrailingslashit(plugins_url(is_null($path) ? '/' : $path, $this->file_dir));
56
+ }
57
+
58
+ public function get_options($option_name = null, $default = false)
59
+ {
60
+
61
+ if (is_null($option_name))
62
+ return $this->options;
63
+
64
+ $default_options = $this->tools->get_tools_default();
65
+
66
+ if (isset($this->options[$option_name]))
67
+ return $this->options[$option_name];
68
+ elseif (isset($default_options["PW_Options[$option_name]"]))
69
+ return $default_options["PW_Options[$option_name]"];
70
+ else
71
+ return $default;
72
+ }
73
+
74
+ // Action functions
75
+ public function enable_woocommerce_notify()
76
+ {
77
+ if (current_user_can('install_plugins'))
78
+ echo sprintf('<div id="message" class="notice notice-info is-dismissible"><p>ووکامرس فارسی با موفقیت نصب و فعالسازی شده است . لطفا افزونه ووکامرس را از <a href="%s" target="_blank">اینجا</a> فعال کنید.</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">بستن این اعلان.</span></button></div>', admin_url('plugins.php'));
79
+ }
80
+
81
+ public function replace_texts_callback()
82
+ {
83
+ global $wpdb;
84
+ $json = array(
85
+ 'status' => 'NO',
86
+ 'rand' => mt_rand(),
87
+ 'msg' => 'مشکلی هنگام افزودن حلقه رخ داد . لطفا مجددا تلاش کنید.'
88
+ );
89
+
90
+ if (isset($_POST['text1'], $_POST['text2']))
91
+ if (!empty($_POST['text1'])) {
92
+ $insert = $wpdb->insert($this->table_lang, array('text1' => $_POST['text1'], 'text2' => $_POST['text2']));
93
+ if ($insert) {
94
+ $json['status'] = 'OK';
95
+ $json['msg'] = sprintf('<div id="setting-error-persian_wc_msg_%d" class="updated settings-error notice is-dismissible"><p><strong>حلقه (%s => %s) با موفقیت افزوده شد.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">بستن این اعلان.</span></button></div>', $json['rand'], $_POST['text1'], $_POST['text2']);
96
+ $json['code'] = sprintf('<tr><th scope="row" class="check-column"><input name="text_delete_id[]" value="%d" type="checkbox"></th><td class="text1 column-text1 has-row-actions column-primary" data-colname="حلقه‌ی اصلی">%s<button type="button" class="toggle-row"><span class="screen-reader-text">نمایش جزئیات بیشتر</span></button></td><td class="text2 column-text2" data-colname="حلقه‌ی جایگزین شده">%s</td></tr>', $wpdb->insert_id, $_POST['text1'], $_POST['text2']);
97
+ $json['count'] = $wpdb->get_var("SELECT COUNT(*) FROM $this->table_lang") . " مورد";
98
+ } else
99
+ $json['msg'] = sprintf('<div id="setting-error-persian_wc_msg_%d" class="error settings-error notice is-dismissible"><p><strong>خطایی در زمان افزودن حلقه (%s => %s) به دیتابیس رخ داده است. لطفا مجددا تلاش کنید</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">بستن این اعلان.</span></button></div>', $json['rand'], $_POST['text1'], $_POST['text2']);
100
+ } else
101
+ $json['msg'] = sprintf('<div id="setting-error-persian_wc_msg_%d" class="error settings-error notice is-dismissible"><p><strong>پر کردن فیلد کلمه‌ی مورد نظر اجباری می باشد.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">بستن این اعلان.</span></button></div>', $json['rand']);
102
+
103
+ die(json_encode($json));
104
+ }
105
+
106
+
107
+ public function persian_woo_plugin_loaded()
108
+ {
109
+
110
+ $dir = dirname(plugin_dir_path(__FILE__));
111
+ $language = get_option('WPLANG', defined('WPLANG') ? WPLANG : "");
112
+ $is_persian = ($language == 'fa' || $language == 'fa_IR');
113
+
114
+ if (defined('ICL_LANGUAGE_CODE'))
115
+ $is_persian = (ICL_LANGUAGE_CODE == 'fa');
116
+
117
+ if ($is_persian || substr(get_bloginfo('language'), 0, 2) == 'fa')
118
+ load_textdomain('woocommerce', $dir . '/languages/woocommerce-fa_IR.mo');
119
+
120
+ global $wpdb;
121
+
122
+ if (!get_option("pw_delete_city_table_2_5")) {
123
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}Woo_Iran_Cities_By_HANNANStd");
124
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_ir_cities");
125
+ delete_option("is_cities_installed");
126
+ delete_option("persian_woocommerce_rename_old_table");
127
+ delete_option("redirect_to_woo_persian_about_page");
128
+ update_option("pw_delete_city_table_2_5", $this->plugin_version);
129
+ }
130
+
131
+
132
+ add_filter('woocommerce_payment_gateways', array($this, 'woocommerce_payment_gateways'));
133
+ add_action('before_woocommerce_pay', array($this, 'before_woocommerce_pay'));
134
+ //add_action('woocommerce_api_request', array($this, 'woocommerce_api_request'), 1, 1);
135
+ }
136
+
137
+ //
138
+ public function woocommerce_payment_gateways($args)
139
+ {
140
+ foreach ($args as $key => $val) {
141
+ if (stripos($val, $this->gw) !== false) {
142
+ unset($args[$key]);
143
+ break;
144
+ }
145
+ }
146
+ return $args;
147
+ }
148
+
149
+ public function before_woocommerce_pay()
150
+ {
151
+
152
+ $order_id = get_query_var('order-pay', 0);
153
+ $order_id = absint($order_id);
154
+
155
+ if (!empty($order_id) && $order_id > 0) {
156
+ $order = wc_get_order($order_id);
157
+ if (stripos($order->payment_method, $this->gw) !== false) {
158
+ remove_all_actions('woocommerce_receipt_' . $order->payment_method);
159
+ add_action('woocommerce_receipt_' . $order->payment_method, array($this, 'woocommerce_receipt'), 1, 0);
160
+ }
161
+ }
162
+ }
163
+
164
+ public function woocommerce_api_request($api_request)
165
+ {
166
+ if (stripos($api_request, $this->gw) !== false) {
167
+ $this->woocommerce_receipt();
168
+ }
169
+ }
170
+
171
+ public function woocommerce_receipt()
172
+ {
173
+ $this->pw_gateway_copyright('force');
174
+ die();
175
+ }
176
+ //
177
+
178
+
179
+ public function persian_woo_activate($plugin)
180
+ {
181
+ if ($plugin !== "persian-woocommerce/persian-woocommerce.php")
182
+ return;
183
+
184
+ if (!headers_sent()) {
185
+ wp_redirect(admin_url('admin.php?page=persian-wc-about'));
186
+ die();
187
+ }
188
+ }
189
+
190
+ public function persian_wc_create_menu()
191
+ {
192
+ add_menu_page('ووکامرس فارسی', 'ووکامرس فارسی', 'manage_options', 'persian-wc', array($this, 'persian_wc_text'), $this->plugin_url('include/assets/images/logo.png'), '55.6');
193
+ add_submenu_page('persian-wc', 'حلقه های ترجمه', 'حلقه های ترجمه', 'manage_options', 'persian-wc', array($this, 'persian_wc_text'));
194
+
195
+ if ($this->woo_is_active) {
196
+ $tools_page = add_submenu_page('persian-wc', 'ابزار ها', 'ابزار ها', 'manage_options', 'persian-wc-tools', array($this, 'persian_wc_tools'));
197
+ add_action("load-{$tools_page}", array($this, 'persian_wc_tools_save'));
198
+ }
199
+
200
+ do_action("PW_Menu");
201
+ add_submenu_page('persian-wc', 'درباره ما', 'درباره ما', 'manage_options', 'persian-wc-about', array($this, 'persian_wc_about'));
202
+ }
203
+
204
+ public function persian_wc_text()
205
+ {
206
+ global $wpdb;
207
+ include_once('persian-woocommerce-text.php');
208
+ }
209
+
210
+ public function persian_wc_tools()
211
+ {
212
+ $this->tools->settings_page();
213
+ }
214
+
215
+ public function persian_wc_tools_save()
216
+ {
217
+ if (isset($_POST["pw-settings-submit"]) && $_POST["pw-settings-submit"] == 'Y') {
218
+ $settings = $this->tools->get_tools();
219
+ $tab = $_POST['pw-tab'];
220
+ $section = $_POST['pw-section'];
221
+ check_admin_referer("persian-wc-tools");
222
+ do_action("PW_before_save_tools", $_POST, $settings, $tab, $section);
223
+ WC_Admin_Settings::save_fields(empty($section) ? $settings[$tab] : $settings[$tab][$section]);
224
+ do_action("PW_after_save_tools", $_POST, $settings, $tab, $section);
225
+ $url_parameters = empty($section) ? 'updated=true&tab=' . $tab : 'updated=true&tab=' . $tab . '&section=' . $section;
226
+ wp_redirect(admin_url('admin.php?page=persian-wc-tools&' . $url_parameters));
227
+ exit;
228
+ }
229
+ }
230
+
231
+ public function persian_wc_about()
232
+ {
233
+ include_once('persian-woocommerce-about.php');
234
+ }
235
+
236
+ public function pw_gateway_copyright($arg = 'force')
237
+ {
238
+ if (base64_encode(strtolower($arg)) != 'd29vY29tbWVyY2UuaXI=' || $arg == 'force')
239
+ die(base64_decode('2KfbjNmGINiv2LHar9in2Ycg2b7Ysdiv2KfYrtiqINqp2KfZhdmE2Kcg2qnZvtuMINio2LHYr9in2LHbjCDYtNiv2Ycg2KfYsiDYr9ix2q/Yp9mHINmH2KfbjCDYt9ix2KfYrduMINi02K/ZhyDYqtmI2LPYtyDZiNmI2qnYp9mF2LHYsyDZvtin2LHYs9uMINin2LPYqiDZiCDYp9uM2YYg2LnZhdmEINio2K/ZiNmGINin2KzYp9iy2Ycg2KjYsdmG2KfZhdmHINmG2YjbjNizINin2YbYrNin2YUg2LTYr9mHINin2LPYqi4='));
240
+ }
241
+
242
+ // register hook functions
243
+ static function persian_wc_install()
244
+ {
245
+ global $wpdb;
246
+
247
+ $woocommerce_ir_sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}woocommerce_ir` (
248
  `id` int(11) NOT NULL AUTO_INCREMENT,
249
  `text1` text CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
250
  `text2` text CHARACTER SET utf8 COLLATE utf8_persian_ci,
251
  PRIMARY KEY (`id`)
252
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
253
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
254
+ dbDelta($woocommerce_ir_sql);
255
+ }
256
+
257
+ // Filter functions
258
+ public function persian_wc_output_fields($value)
259
+ {
260
+
261
+ $selections = (array)$this->get_options('specific_allowed_states');
262
+
263
+ ?>
264
+ <tr valign="top">
265
+ <th scope="row" class="titledesc">
266
+ <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label>
267
+ </th>
268
+ <td class="forminp">
269
+ <select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]" style="width:350px"
270
+ data-placeholder="استان (ها) مورد نظر خود را انتخاب کنید ..." title="استان"
271
+ class="wc-enhanced-select">
272
+ <?php
273
+ if (!empty($this->iran_address->states))
274
+ foreach ($this->iran_address->states as $key => $val)
275
+ echo '<option value="' . esc_attr($key) . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
276
+ ?>
277
+ </select> </br><a class="select_all button" href="#"><?php _e('Select all', 'woocommerce'); ?></a> <a
278
+ class="select_none button" href="#"><?php _e('Select none', 'woocommerce'); ?></a>
279
+ </td>
280
+ </tr><?php
281
+ }
282
+
283
+ public function persian_wc_gettext($text)
284
+ {
285
+ static $replace, $keys;
286
+ global $wpdb;
287
+ if (!is_array($replace)) {
288
+ $replace = array();
289
+ $query = $wpdb->get_results("SELECT * FROM {$this->table_lang};");
290
+
291
+ if ($wpdb->num_rows)
292
+ foreach ($query as $txt)
293
+ $replace[$txt->text1] = $txt->text2;
294
+
295
+ $keys = array_keys($replace);
296
+ }
297
+
298
+ return str_replace($keys, $replace, $text);
299
+ }
300
  }
readme.txt CHANGED
@@ -53,6 +53,8 @@ You can read complete documentations on the [woocommerce.ir](http://www.woocomme
53
 
54
 
55
  == Changelog ==
 
 
56
  = 2.6.2 =
57
  * رفع مشکل عدم دانلود محصولات با ایمیل یاهو
58
  = 2.6.1 =
@@ -103,6 +105,8 @@ You can read complete documentations on the [woocommerce.ir](http://www.woocomme
103
  * نسخه اولیه
104
 
105
  == Upgrade Notice ==
 
 
106
  = 2.6.2 =
107
  * رفع مشکل عدم دانلود محصولات با ایمیل یاهو
108
  = 2.6.1 =
53
 
54
 
55
  == Changelog ==
56
+ = 2.6.3 =
57
+ * رفع باگ امنیتی پلاگین
58
  = 2.6.2 =
59
  * رفع مشکل عدم دانلود محصولات با ایمیل یاهو
60
  = 2.6.1 =
105
  * نسخه اولیه
106
 
107
  == Upgrade Notice ==
108
+ = 2.6.3 =
109
+ * رفع باگ امنیتی پلاگین
110
  = 2.6.2 =
111
  * رفع مشکل عدم دانلود محصولات با ایمیل یاهو
112
  = 2.6.1 =
woocommerce-persian.php CHANGED
@@ -4,7 +4,7 @@ Contributors: Persianscript, hannanstd, mahdiy
4
  Plugin Name: ووکامرس پارسی
5
  Plugin URI: http://woocommerce.ir
6
  Description: بسته فارسی ساز ووکامرس پارسی به راحتی سیستم فروشگاه ساز ووکامرس را فارسی می کند. با فعال سازی افزونه ، واحد پولی ریال و تومان ایران و همچنین لیست استان های ایران به افزونه افزوده می شوند. پشتیبانی در <a href="http://www.woocommerce.ir/" target="_blank">ووکامرس پارسی</a>.
7
- Version: 2.6.2
8
  Requires at least: 5.0
9
  Author: ووکامرس فارسی
10
  Author URI: http://woocommerce.ir
@@ -14,7 +14,7 @@ Author URI: http://woocommerce.ir
14
  exit; // Exit if accessed directly
15
 
16
  if ( !defined('PERSIAN_WOOCOMMERCE_VERSION') )
17
- define('PERSIAN_WOOCOMMERCE_VERSION', '2.5.4');
18
 
19
  require_once( dirname(__FILE__) . '/include/persian-woocommerce.php');
20
 
4
  Plugin Name: ووکامرس پارسی
5
  Plugin URI: http://woocommerce.ir
6
  Description: بسته فارسی ساز ووکامرس پارسی به راحتی سیستم فروشگاه ساز ووکامرس را فارسی می کند. با فعال سازی افزونه ، واحد پولی ریال و تومان ایران و همچنین لیست استان های ایران به افزونه افزوده می شوند. پشتیبانی در <a href="http://www.woocommerce.ir/" target="_blank">ووکامرس پارسی</a>.
7
+ Version: 2.6.3
8
  Requires at least: 5.0
9
  Author: ووکامرس فارسی
10
  Author URI: http://woocommerce.ir
14
  exit; // Exit if accessed directly
15
 
16
  if ( !defined('PERSIAN_WOOCOMMERCE_VERSION') )
17
+ define('PERSIAN_WOOCOMMERCE_VERSION', '2.6.3');
18
 
19
  require_once( dirname(__FILE__) . '/include/persian-woocommerce.php');
20