WooCommerce Multilingual – run WooCommerce with WPML - Version 3.9.1.1

Version Description

  • Bug fix: Fixed a bug causing fatal error on older PHP versions (before 5.6)
Download this release

Release Info

Developer mihaimihai
Plugin Icon 128x128 WooCommerce Multilingual – run WooCommerce with WPML
Version 3.9.1.1
Comparing to
See all releases

Code changes from version 3.9.1 to 3.9.1.1

inc/template-classes/class-wcml-custom-currency-options.php DELETED
@@ -1,147 +0,0 @@
1
- <?php
2
-
3
- class WCML_Custom_Currency_Options extends WPML_Templates_Factory {
4
-
5
- private $woocommerce_wpml;
6
- private $args;
7
-
8
- function __construct( &$args, &$woocommerce_wpml ){
9
-
10
- $functions = array(
11
- new Twig_SimpleFunction( 'get_currency_symbol', array( $this, 'get_currency_symbol' ) ),
12
- );
13
-
14
- parent::__construct( $functions );
15
- $this->woocommerce_wpml = $woocommerce_wpml;
16
- $this->args = $args;
17
-
18
- add_action( 'wcml_before_multi_currency_ui', array($this, 'render') );
19
- }
20
-
21
- public function get_model(){
22
-
23
- $currencies_not_used = array_diff( array_keys( $this->args['wc_currencies'] ),
24
- array_keys( $this->args['currencies'] ), array( $this->args['default_currency'] ) );
25
- $current_currency = empty($this->args['currency_code']) ? current( $currencies_not_used ) : $this->args['currency_code'];
26
-
27
- $model = array(
28
-
29
- 'args' => $this->args,
30
- 'form' => array(
31
- 'select' => __( 'Select currency', 'woocommerce-multilingual' ),
32
- 'rate' => array(
33
- 'label' => __( 'Exchange Rate', 'woocommerce-multilingual' ),
34
- 'only_numeric' => __( 'Only numeric', 'woocommerce-multilingual' ),
35
- 'set_on' => empty($this->args['currency']['updated'] ) ? '' :
36
- sprintf( __( 'Set on %s', 'woocommerce-multilingual' ),
37
- date( 'F j, Y, H:i', strtotime( $this->args['currency']['updated'] ) ) )
38
- ),
39
- 'preview' => array(
40
- 'label' => __( 'Currency Preview', 'woocommerce-multilingual' ),
41
- 'value' => $this->get_price_preview( $current_currency )
42
- ),
43
- 'position' => array(
44
- 'label' => __( 'Currency Position', 'woocommerce-multilingual' ),
45
- 'left' => __( 'Left', 'woocommerce-multilingual' ),
46
- 'right' => __( 'Right', 'woocommerce-multilingual' ),
47
- 'left_space' => __( 'Left with space', 'woocommerce-multilingual' ),
48
- 'right_space' => __( 'Right with space', 'woocommerce-multilingual' ),
49
- ),
50
- 'thousand_sep' => array(
51
- 'label' => __( 'Thousand Separator', 'woocommerce-multilingual' )
52
- ),
53
- 'decimal_sep' => array(
54
- 'label' =>__( 'Decimal Separator', 'woocommerce-multilingual' )
55
- ),
56
- 'num_decimals' => array(
57
- 'label' => __( 'Number of Decimals', 'woocommerce-multilingual' ),
58
- 'only_numeric' => __( 'Only numeric', 'woocommerce-multilingual' )
59
- ),
60
- 'rounding' => array(
61
- 'label' => __( 'Rounding to the nearest integer', 'woocommerce-multilingual' ),
62
- 'disabled' => __( 'Disabled', 'woocommerce-multilingual' ),
63
- 'up' => __( 'Up', 'woocommerce-multilingual' ),
64
- 'down' => __( 'Down', 'woocommerce-multilingual' ),
65
- 'nearest' => __( 'Nearest', 'woocommerce-multilingual' ),
66
- 'increment' => __( 'Increment for nearest integer', 'woocommerce-multilingual' )
67
- ),
68
- 'autosubtract' => array(
69
- 'label' => __( 'Autosubtract amount', 'woocommerce-multilingual' ),
70
- 'only_numeric' => __( 'Only numeric', 'woocommerce-multilingual' )
71
- ),
72
-
73
- 'cancel' => __( 'Cancel', 'woocommerce-multilingual' ),
74
- 'save' => __( 'Save', 'woocommerce-multilingual' )
75
-
76
-
77
- ),
78
- 'current_currency' => $current_currency
79
-
80
-
81
- );
82
-
83
- return $model;
84
- }
85
-
86
- public function render(){
87
- echo $this->get_view();
88
- }
89
-
90
- protected function init_template_base_dir() {
91
- $this->template_paths = array(
92
- WCML_PLUGIN_PATH . '/templates/multi-currency/',
93
- );
94
- }
95
-
96
- public function get_template() {
97
- return 'custom-currency-options.twig';
98
- }
99
-
100
- public function get_currency_symbol( $code ) {
101
- return get_woocommerce_currency_symbol( $code );
102
- }
103
-
104
- public function get_price_preview( $currency ){
105
-
106
- if( isset( $this->args['currencies'][$currency] ) ) {
107
-
108
- $this->current_currency_for_preview =& $currency;
109
-
110
- add_filter( 'option_woocommerce_currency_pos', array($this, 'filter_currency_pos') );
111
-
112
- $args = array(
113
- 'currency' => $currency,
114
- 'decimal_separator' => $this->args['currencies'][$currency]['decimal_sep'],
115
- 'thousand_separator' => $this->args['currencies'][$currency]['thousand_sep'],
116
- 'decimals' => $this->args['currencies'][$currency]['num_decimals'],
117
- 'price_format' => get_woocommerce_price_format()
118
- );
119
- $price = wc_price( '1234.56', $args );
120
-
121
- remove_filter( 'option_woocommerce_currency_pos', array($this, 'filter_currency_pos') );
122
-
123
- unset($this->current_currency_for_preview);
124
-
125
- } else {
126
- $args = array(
127
- 'currency' => $currency,
128
- 'price_format' => get_woocommerce_price_format()
129
- );
130
- $price = wc_price( '1234.56', $args );
131
- }
132
-
133
- return $price;
134
- }
135
-
136
- public function filter_currency_pos( $value ){
137
-
138
- if( isset( $this->args['currencies'][ $this->current_currency_for_preview ]['position'] ) ){
139
- $value = $this->args['currencies'][ $this->current_currency_for_preview ]['position'];
140
- }
141
-
142
- return $value;
143
-
144
- }
145
-
146
-
147
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/template-classes/class-wcml-custom-prices-ui.php DELETED
@@ -1,173 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Created by OnTheGo Systems
5
- */
6
- class WCML_Custom_Prices_UI extends WPML_Templates_Factory {
7
-
8
- private $woocommerce_wpml;
9
- private $product_id;
10
- private $custom_prices;
11
- private $is_variation;
12
-
13
-
14
- function __construct( &$woocommerce_wpml, $product_id ){
15
- parent::__construct();
16
-
17
- $this->woocommerce_wpml = $woocommerce_wpml;
18
- $this->product_id = $product_id;
19
- $this->is_variation = get_post_type( $product_id) == 'product_variation' ? true : false;
20
- $this->custom_prices = get_post_custom( $product_id );
21
- $this->custom_prices_fields = apply_filters( 'wcml_custom_prices_fields', array( '_regular_price', '_sale_price' ), $product_id );
22
- $this->custom_prices_fields_labels = apply_filters( 'wcml_custom_prices_fields_labels', array( '_regular_price' => __( 'Regular Price', 'woocommerce-multilingual' ), '_sale_price' => __( 'Sale Price', 'woocommerce-multilingual' ) ), $product_id );
23
-
24
- }
25
-
26
- public function get_model() {
27
- $model = array(
28
- 'product_id' => $this->product_id,
29
- 'currencies' => $this->get_currencies_info(),
30
- 'checked_calc_auto' => !isset($this->custom_prices['_wcml_custom_prices_status']) || (isset($this->custom_prices['_wcml_custom_prices_status']) && $this->custom_prices['_wcml_custom_prices_status'][0] == 0)? 'checked="checked"' : ' ' ,
31
- 'checked_calc_manually' => isset($this->custom_prices['_wcml_custom_prices_status']) && $this->custom_prices['_wcml_custom_prices_status'][0] == 1?'checked="checked"':' ',
32
- 'wc_currencies' => get_woocommerce_currencies(),
33
- 'is_variation' => $this->is_variation,
34
- 'html_id' => $this->is_variation ? '['.$this->product_id.']' : '',
35
- 'strings' => apply_filters( 'wcml_custom_prices_strings', array(
36
- 'not_set' => sprintf( __( 'Multi-currency is enabled but no secondary currencies have been set. %sAdd secondary currencies%s.',
37
- 'woocommerce-multilingual' ), '<a href="' . admin_url('admin.php?page=wpml-wcml&tab=multi-currency') . '">', '</a>' ),
38
- 'calc_auto' => __( 'Calculate prices in other currencies automatically', 'woocommerce-multilingual' ),
39
- 'see_prices' => __( 'Click to see the prices in the other currencies as they are currently shown on the front end.', 'woocommerce-multilingual' ),
40
- 'show' => __( 'Show', 'woocommerce-multilingual' ),
41
- 'hide' => __( 'Hide', 'woocommerce-multilingual' ),
42
- 'set_manually' => __( 'Set prices in other currencies manually', 'woocommerce-multilingual' ),
43
- 'enter_prices' => __( 'Enter prices in other currencies', 'woocommerce-multilingual' ),
44
- 'hide_prices' => __( 'Hide prices in other currencies', 'woocommerce-multilingual' ),
45
- 'det_auto' => __( 'Determined automatically based on exchange rate', 'woocommerce-multilingual' ),
46
- '_regular_price' => __( 'Regular Price', 'woocommerce-multilingual' ),
47
- '_sale_price' => __( 'Sale Price', 'woocommerce-multilingual' ),
48
- 'schedule' => __( 'Schedule', 'woocommerce-multilingual' ),
49
- 'same_as_def' => __( 'Same as default currency', 'woocommerce-multilingual' ),
50
- 'set_dates' => __( 'Set dates', 'woocommerce-multilingual' ),
51
- 'collapse' => __( 'Collapse', 'woocommerce-multilingual' ),
52
- 'from' => __( 'From&hellip;', 'woocommerce-multilingual' ),
53
- 'to' => __( 'To&hellip;', 'woocommerce-multilingual' ),
54
- 'enter_price' => __( 'Please enter in a value less than the regular price', 'woocommerce-multilingual' ) ),
55
- $this->product_id
56
- )
57
- );
58
-
59
- return $model;
60
- }
61
-
62
-
63
- public function get_currencies_info( ){
64
-
65
- $currencies = $this->woocommerce_wpml->multi_currency->get_currencies();
66
- $wc_currencies = get_woocommerce_currencies();
67
-
68
- foreach( $currencies as $key => $currency ){
69
-
70
- $currencies[ $key ][ 'currency_code' ] = $key;
71
-
72
- foreach( $this->custom_prices_fields as $price_field ){
73
- $currencies[ $key ][ 'readonly_price' ][ $price_field ] = '';
74
- $currencies[ $key ][ 'custom_price' ][ $price_field ] = '';
75
- }
76
-
77
- if( $this->product_id ){
78
-
79
- foreach( $this->custom_prices_fields as $price_field ){
80
- $currencies[ $key ][ 'readonly_price' ][ $price_field ] = get_post_meta( $this->product_id, $price_field, true );
81
- if( $currencies[ $key ][ 'readonly_price' ][ $price_field ] ){
82
- $currencies[ $key ][ 'readonly_price' ][ $price_field ] = $currencies[ $key ][ 'readonly_price' ][ $price_field ]*$currency['rate'];
83
- }
84
- }
85
-
86
- }
87
-
88
- if( isset( $this->custom_prices[ '_wcml_custom_prices_status' ] ) ){
89
-
90
- foreach( $this->custom_prices_fields as $price_field ){
91
- if( isset( $this->custom_prices[ $price_field.'_'.$key ][ 0 ] ) ){
92
- $currencies[ $key ][ 'custom_price' ][ $price_field ] = $this->custom_prices[ $price_field.'_'.$key ][ 0 ];
93
- }
94
- }
95
-
96
- }
97
-
98
- $currencies[ $key ][ 'currency_format' ] = $wc_currencies[ $key ].' ( '.get_woocommerce_currency_symbol( $key ).' )';
99
- $currencies[ $key ][ 'currency_symbol' ] = get_woocommerce_currency_symbol( $key );
100
-
101
- if( $this->is_variation ){
102
- $currencies[ $key ][ 'custom_id' ] = '['.$key.']['.$this->product_id.']';
103
- $currencies[ $key ][ 'wc_input_type' ] = 'text';
104
-
105
- }else{
106
- $currencies[ $key ][ 'custom_id' ] = '['.$key.']';
107
-
108
- $wc_input = array();
109
-
110
- $wc_input['custom_attributes'] = array() ;
111
- $wc_input['type_name'] = 'data_type';
112
- $wc_input['type_val'] = 'price';
113
-
114
- foreach( $this->custom_prices_fields as $price_field ){
115
- ob_start();
116
- woocommerce_wp_text_input(
117
- array(
118
- 'id' => '_custom'.$price_field.'['.$key.']',
119
- 'value'=> $currencies[ $key ][ 'custom_price' ][ $price_field ] ,
120
- 'class' => 'wc_input_price wcml_input_price short wcml'.$price_field,
121
- 'label' => $this->custom_prices_fields_labels[ $price_field ] . ' ('. $currencies[ $key ][ 'currency_symbol' ].')',
122
- $wc_input['type_name'] => $wc_input['type_val'],
123
- 'custom_attributes' => $wc_input['custom_attributes']
124
- )
125
- );
126
- $currencies[ $key ][ 'custom_html' ][ $price_field ] = ob_get_contents();
127
- ob_end_clean();
128
- }
129
-
130
- $wc_input['custom_attributes'] = array( 'readonly' => 'readonly', 'rel'=> $currency['rate'] ) ;
131
-
132
- foreach( $this->custom_prices_fields as $price_field ){
133
- ob_start();
134
- woocommerce_wp_text_input(
135
- array(
136
- 'id' => '_readonly'.$price_field,
137
- 'value'=> $currencies[ $key ][ 'readonly_price' ][ $price_field ],
138
- 'class' => 'wc_input_price short',
139
- 'label' => $this->custom_prices_fields_labels[ $price_field ] . ' ('. $currencies[ $key ][ 'currency_symbol' ] .')',
140
- $wc_input['type_name'] => $wc_input['type_val'],
141
- 'custom_attributes' => $wc_input['custom_attributes']
142
- )
143
- );
144
- $currencies[ $key ][ 'readonly_html' ][ $price_field ] = ob_get_contents();
145
- ob_end_clean();
146
- }
147
- }
148
-
149
- $currencies[ $key ][ 'schedule_auto_checked' ] = (!isset($this->custom_prices['_wcml_schedule_'.$key]) || (isset($this->custom_prices['_wcml_schedule_'.$key]) && $this->custom_prices['_wcml_schedule_'.$key][0] == 0))?'checked="checked"':' ';
150
- $currencies[ $key ][ 'schedule_man_checked' ] = isset($this->custom_prices['_wcml_schedule_'.$key]) && $this->custom_prices['_wcml_schedule_'.$key][0] == 1?'checked="checked"':' ';
151
-
152
-
153
- $currencies[ $key ][ 'sale_price_dates_from' ] = (isset($this->custom_prices['_sale_price_dates_from_'.$key]) && $this->custom_prices['_sale_price_dates_from_'.$key][0] != '') ? date_i18n( 'Y-m-d', $this->custom_prices['_sale_price_dates_from_'.$key][0] ) : '';
154
- $currencies[ $key ][ 'sale_price_dates_to' ] = (isset($this->custom_prices['_sale_price_dates_to_'.$key]) && $this->custom_prices['_sale_price_dates_to_'.$key][0] != '') ? date_i18n( 'Y-m-d', $this->custom_prices['_sale_price_dates_to_'.$key][0] ) : '';
155
-
156
- }
157
-
158
- return $currencies;
159
-
160
- }
161
-
162
-
163
- public function init_template_base_dir() {
164
- $this->template_paths = array(
165
- WCML_PLUGIN_PATH . '/templates/multi-currency/',
166
- );
167
- }
168
-
169
- public function get_template() {
170
- return 'custom-prices.twig';
171
- }
172
-
173
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/template-classes/class-wcml-multi-currency-ui.php DELETED
@@ -1,261 +0,0 @@
1
- <?php
2
-
3
- class WCML_Multi_Currency_UI extends WPML_Templates_Factory {
4
-
5
- private $woocommerce_wpml;
6
- private $sitepress;
7
- private $currencies;
8
- private $wc_currencies;
9
- private $wc_currency;
10
-
11
- function __construct( &$woocommerce_wpml, &$sitepress ){
12
-
13
- $functions = array(
14
- new Twig_SimpleFunction( 'get_flag_url', array( $this, 'get_flag_url' ) ),
15
- new Twig_SimpleFunction( 'get_rate', array( $this, 'get_rate' ) ),
16
- new Twig_SimpleFunction( 'is_currency_on', array( $this, 'is_currency_on' ) ),
17
- new Twig_SimpleFunction( 'get_language_currency', array( $this, 'get_language_currency' ) ),
18
- new Twig_SimpleFunction( 'get_currency_symbol', array( $this, 'get_currency_symbol' ) ),
19
- new Twig_SimpleFunction( 'wp_do_action', array( $this, 'wp_do_action' ) )
20
- );
21
-
22
- parent::__construct( $functions );
23
- $this->woocommerce_wpml = $woocommerce_wpml;
24
- $this->sitepress = $sitepress;
25
-
26
- $this->currencies = $this->woocommerce_wpml->multi_currency->get_currencies();
27
- $this->wc_currencies = get_woocommerce_currencies();
28
- $this->wc_currency = get_option( 'woocommerce_currency' );
29
-
30
- $this->load_custom_currency_option_boxes();
31
-
32
- }
33
-
34
- public function get_model(){
35
-
36
- $currencies_positions = array();
37
- foreach ( $this->currencies as $code => $currency ){
38
- $currencies_positions[$code] = $this->price_position_format( $currency['position'], $code );
39
- }
40
-
41
-
42
- $model = array(
43
- 'strings' => array(
44
- 'headers' => array(
45
- 'enable_disable' => __( 'Enable/disable', 'woocommerce-multilingual' ),
46
- 'currencies' => __( 'Currencies', 'woocommerce-multilingual' ),
47
- ),
48
- 'add_currency_button' => __( 'Add currency', 'woocommerce-multilingual' ),
49
- 'currencies_table' => array(
50
- 'head_currency' => __('Currency', 'woocommerce-multilingual'),
51
- 'head_rate' => __('Rate', 'woocommerce-multilingual'),
52
- 'default' => __( 'default', 'woocommerce-multilingual' ),
53
- 'edit' => __( 'Edit', 'woocommerce-multilingual' ),
54
- 'default_currency' => __( 'Default currency', 'woocommerce-multilingual' ),
55
- 'default_cur_tip' => __( 'Switch to this currency when switching language in the front-end', 'woocommerce-multilingual' ),
56
- 'keep_currency' => __( 'Keep', 'woocommerce-multilingual' ),
57
- 'delete' => __( 'Delete', 'woocommerce-multilingual' ),
58
- )
59
-
60
- ),
61
- 'currencies' => $this->currencies,
62
- 'currencies_positions' => $currencies_positions,
63
- 'wc_currency' => $this->wc_currency,
64
- 'wc_currencies' => $this->wc_currencies,
65
- 'positioned_price' => sprintf( __( ' (%s)', 'woocommerce-multilingual' ), $this->get_positioned_price( $this->wc_currency ) ) ,
66
-
67
- 'active_languages' => $this->sitepress->get_active_languages(),
68
-
69
- 'multi_currency_on' => $this->woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT,
70
-
71
- 'wc_currency_empty_warn' => sprintf(__('The multi-currency mode cannot be enabled as a specific currency was not set. Go to the %sWooCommerce settings%s page and select the default currency for your store.',
72
- 'woocommerce-multilingual'), '<a href="' . admin_url('admin.php?page=wc-settings') . '">', '</a>'),
73
- 'wcml_settings' => $this->woocommerce_wpml->settings,
74
- 'form' => array(
75
- 'action' => $_SERVER['REQUEST_URI'],
76
- 'nonce' => wp_nonce_field( 'wcml_mc_options', 'wcml_nonce', true, false ),
77
- 'save_currency_nonce' => wp_create_nonce( 'save_currency' ),
78
- 'del_currency_nonce' => wp_create_nonce( 'wcml_delete_currency' ),
79
- 'multi_currency_option' => WCML_MULTI_CURRENCIES_INDEPENDENT,
80
- 'mco_disabled' => empty($wc_currency),
81
- 'label_mco' => __( "Enable the multi-currency mode", 'woocommerce-multilingual' ),
82
- 'label_mco_learn_url' => WCML_Links::generate_tracking_link( 'https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/', 'multi-currency-support-woocommerce', 'documentation' ),
83
- 'label_mco_learn_txt' => __( 'Learn more', 'woocommerce-multilingual' ),
84
- 'update_currency_lang_nonce'=> wp_create_nonce( 'wcml_update_currency_lang' ),
85
- 'wpdate_default_cur_nonce' => wp_create_nonce( 'wcml_update_default_currency' ),
86
- 'custom_prices_select' => array(
87
- 'checked' => $this->woocommerce_wpml->settings['display_custom_prices'] == 1,
88
- 'label' => __( 'Show only products with custom prices in secondary currencies', 'woocommerce-multilingual' ),
89
- 'tip' => __( 'When this option is on, when you switch to a secondary currency on the front end, only the products with custom prices in that currency are being displayed. Products with prices determined based on the exchange rate are hidden.', 'woocommerce-multilingual' )
90
- ),
91
- 'submit' => __( 'Save changes', 'woocommerce-multilingual' ),
92
- 'navigate_warn' => __( 'The changes you made will be lost if you navigate away from this page.', 'woocommerce-multilingual' ),
93
- 'cur_lang_warn' => __( 'At least one currency must be enabled for this language!', 'woocommerce-multilingual' )
94
-
95
- ),
96
-
97
- 'currency_switcher' => array(
98
- 'headers' => array(
99
- 'main' => __('Currency switcher options', 'woocommerce-multilingual'),
100
- 'style' => __('Currency switcher style', 'woocommerce-multilingual'),
101
- 'order' => __( 'Currency order', 'woocommerce-multilingual' ),
102
- 'parameters'=> __( 'Available parameters', 'woocommerce-multilingual' ),
103
- 'template' => __( 'Template for currency switcher', 'woocommerce-multilingual' ),
104
- 'visibility'=> __('Visibility', 'woocommerce-multilingual')
105
- ),
106
- 'preview_nonce' => wp_create_nonce( 'wcml_currencies_switcher_preview' ),
107
- 'preview' => $this->woocommerce_wpml->multi_currency->currency_switcher->currency_switcher( array('echo' => false) ),
108
- 'preview_text' => __( 'Currency switcher preview', 'woocommerce-multilingual' ),
109
- 'style' => isset($this->woocommerce_wpml->settings['currency_switcher_style']) ? $this->woocommerce_wpml->settings['currency_switcher_style'] : false,
110
- 'options' => array(
111
- 'dropdown' => __('Drop-down menu', 'woocommerce-multilingual'),
112
- 'list' => __('List of currencies', 'woocommerce-multilingual'),
113
- 'vertical' => __('Vertical', 'woocommerce-multilingual'),
114
- 'horizontal' => __('Horizontal', 'woocommerce-multilingual')
115
- ),
116
- 'orientation' => isset($this->woocommerce_wpml->settings['wcml_curr_sel_orientation']) ?
117
- $this->woocommerce_wpml->settings['wcml_curr_sel_orientation'] : 'vertical',
118
- 'order' => !isset( $this->woocommerce_wpml->settings['currencies_order'] ) ?
119
- $this->woocommerce_wpml->multi_currency->get_currency_codes() :
120
- $this->woocommerce_wpml->settings['currencies_order'],
121
- 'order_nonce' => wp_create_nonce( 'set_currencies_order_nonce' ),
122
- 'order_tip' => __( 'Drag the currencies to change their order', 'woocommerce-multilingual' ),
123
- 'parameters_tip' => __( '%name%, %symbol%, %code%', 'woocommerce-multilingual' ),
124
- 'template' => isset($this->woocommerce_wpml->settings['wcml_curr_template']) ?
125
- $this->woocommerce_wpml->settings['wcml_curr_template'] : '',
126
- 'template_tip' => __( 'Default: %name% (%symbol%) - %code%', 'woocommerce-multilingual' ),
127
- 'template_default' => '%name% (%symbol%) - %code%',
128
- 'visibility_label' => __('Show a currency selector on the product page template', 'woocommerce-multilingual'),
129
- 'visibility_on' => isset($this->woocommerce_wpml->settings['currency_switcher_product_visibility']) ?
130
- $this->woocommerce_wpml->settings['currency_switcher_product_visibility']:1
131
- )
132
- );
133
-
134
- return $model;
135
-
136
- }
137
-
138
- protected function init_template_base_dir() {
139
- $this->template_paths = array(
140
- WCML_PLUGIN_PATH . '/templates/multi-currency/',
141
- );
142
- }
143
-
144
- public function get_template() {
145
- return 'multi-currency.twig';
146
- }
147
-
148
- protected function get_positioned_price( $wc_currency ){
149
-
150
- $woocommerce_currency_pos = get_option( 'woocommerce_currency_pos' );
151
- $positioned_price = '';
152
-
153
- switch ( $woocommerce_currency_pos ) {
154
- case 'left':
155
- $positioned_price = sprintf( '%s99.99', get_woocommerce_currency_symbol( $wc_currency ) );
156
- break;
157
- case 'right':
158
- $positioned_price = sprintf( '99.99%s', get_woocommerce_currency_symbol( $wc_currency ) );
159
- break;
160
- case 'left_space':
161
- $positioned_price = sprintf( '%s 99.99', get_woocommerce_currency_symbol( $wc_currency ) );
162
- break;
163
- case 'right_space':
164
- $positioned_price = sprintf( '99.99 %s', get_woocommerce_currency_symbol( $wc_currency ) );
165
- break;
166
- }
167
-
168
- return $positioned_price;
169
-
170
- }
171
-
172
- protected function price_position_format( $position, $code ){
173
-
174
- $positioned_price = '';
175
- switch ( $position ) {
176
- case 'left':
177
- $positioned_price = sprintf( '%s99.99', get_woocommerce_currency_symbol( $code ) );
178
- break;
179
- case 'right':
180
- $positioned_price = sprintf( '99.99%s', get_woocommerce_currency_symbol( $code ) );
181
- break;
182
- case 'left_space':
183
- $positioned_price = sprintf( '%s 99.99', get_woocommerce_currency_symbol( $code ) );
184
- break;
185
- case 'right_space':
186
- $positioned_price = sprintf( '99.99 %s', get_woocommerce_currency_symbol( $code ) );
187
- break;
188
- }
189
-
190
- return $positioned_price;
191
-
192
- }
193
-
194
- public function get_flag_url( $code ){
195
- return $this->sitepress->get_flag_url( $code );
196
- }
197
-
198
- public function get_rate($wc_currency, $rate, $code){
199
- return sprintf( '1 %s = %s %s', $wc_currency, $rate, $code );
200
- }
201
-
202
- public function is_currency_on($currency, $language) {
203
- return $this->woocommerce_wpml->settings['currency_options'][ $currency ]['languages'][ $language ];
204
- }
205
-
206
- public function get_language_currency( $language ) {
207
- return $this->woocommerce_wpml->settings['default_currencies'][ $language ];
208
- }
209
-
210
- public function get_currency_symbol( $code ) {
211
- return get_woocommerce_currency_symbol( $code );
212
- }
213
-
214
- public function load_custom_currency_option_boxes(){
215
-
216
- $args = array(
217
- 'title' => __('Add new currency', 'woocommerce-multilingual'),
218
- 'default_currency' => $this->wc_currency,
219
- 'currencies' => $this->currencies,
220
- 'wc_currencies' => $this->wc_currencies,
221
- 'currency_code' => '',
222
- 'currency_name' => '',
223
- 'currency_symbol' => '',
224
- 'currency' => array(
225
- 'rate' => 1,
226
- 'position' => 'left',
227
- 'thousand_sep' => ',',
228
- 'decimal_sep' => '.',
229
- 'num_decimals' => 2,
230
- 'rounding' => 'disabled',
231
- 'rounding_increment' => 1,
232
- 'auto_subtract' => 0,
233
- 'updated' => 0
234
- ),
235
- 'current_currency' => current( array_diff( array_keys( $this->wc_currencies ), array_keys( $this->currencies ), array ( $this->wc_currency ) ) )
236
- );
237
-
238
- new WCML_Custom_Currency_Options($args, $this->woocommerce_wpml);
239
-
240
- foreach($this->currencies as $code => $currency){
241
- $args['currency_code'] = $code;
242
- $args['currency_name'] = $args['wc_currencies'][$args['currency_code']];
243
- $args['currency_symbol'] = get_woocommerce_currency_symbol( $args['currency_code'] );
244
- $args['currency'] = $currency;
245
- $args['title'] = sprintf( __( 'Update settings for %s', 'woocommerce-multilingual' ), $args['currency_name'] . ' (' . $args['currency_symbol'] . ')' );
246
-
247
- $args['current_currency'] = $args['currency_code'];
248
-
249
- new WCML_Custom_Currency_Options($args, $this->woocommerce_wpml);
250
-
251
- }
252
-
253
-
254
- }
255
-
256
- public function wp_do_action( $hook ){
257
- do_action( $hook );
258
- }
259
-
260
-
261
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/template-classes/setup/class-wcml-setup-translation-interface-ui.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
-
3
- class WCML_Setup_Translation_Interface_UI extends WPML_Templates_Factory {
4
-
5
- private $woocommerce_wpml;
6
-
7
- function __construct( &$woocommerce_wpml, $next_step_url){
8
- parent::__construct();
9
-
10
- $this->woocommerce_wpml = &$woocommerce_wpml;
11
- $this->next_step_url = $next_step_url;
12
-
13
- }
14
-
15
- public function get_model(){
16
-
17
- $model = array(
18
- 'strings' => array(
19
- 'heading' => __('Select the translation interface', 'woocommerce-multilingual'),
20
- 'description' => __('The recommended way is using the WPML Translation Editor. It is streamlined for making the translation process much easier while also providing a much better integration with various WooCommerce extensions.', 'woocommerce-multilingual'),
21
- 'continue' => __('Continue', 'woocommerce-multilingual'),
22
- ),
23
-
24
- 'translation_interface' => $this->woocommerce_wpml->settings['trnsl_interface'],
25
- 'translation_interface_native' => WCML_TRANSLATION_METHOD_MANUAL,
26
- 'translation_interface_wpml' => WCML_TRANSLATION_METHOD_EDITOR,
27
- 'label_wpml_editor' => __('WPML Translation Editor', 'woocommerce-multilingual'),
28
- 'label_native_editor' => __('Native WooCommerce product editing screen' , 'woocommerce-multilingual'),
29
-
30
-
31
- 'continue_url' => $this->next_step_url
32
- );
33
-
34
- return $model;
35
-
36
- }
37
-
38
- protected function init_template_base_dir() {
39
- $this->template_paths = array(
40
- WCML_PLUGIN_PATH . '/templates/',
41
- );
42
- }
43
-
44
- public function get_template() {
45
- return '/setup/translation-interface.twig';
46
- }
47
-
48
-
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multili
5
  License: GPLv2
6
  Requires at least: 3.9
7
  Tested up to: 4.6.1
8
- Stable tag: 3.9.1
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
@@ -26,11 +26,11 @@ This 'glue' plugin makes it possible to run fully multilingual e-commerce sites
26
 
27
  Almost every WooCommerce store uses some extensions. WooCommerce Multilingual is fully compatible with popular extensions, including:
28
 
29
- * WooCommerce Bookings
30
- * WooCommerce Table Rate Shipping
31
- * WooCommerce Subscriptions
32
- * WooCommerce Product Add-ons
33
- * WooCommerce Tab Manager
34
 
35
  Looking for other extensions that are tested and compatible with WPML? See the complete [list of WooCommerce extensions that are compatible with WPML](https://wpml.org/documentation/woocommerce-extensions-compatibility/).
36
 
@@ -142,6 +142,9 @@ WooCommerce Multilingual is compatible with all major WooCommerce extensions. We
142
 
143
  == Changelog ==
144
 
 
 
 
145
  = 3.9.1 =
146
  * Fixed a bug related to the stock information not syncing correctly across translations
147
  * Bug fix: and incorrect value for products out of stock was show on the dashboard
5
  License: GPLv2
6
  Requires at least: 3.9
7
  Tested up to: 4.6.1
8
+ Stable tag: 3.9.1.1
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
26
 
27
  Almost every WooCommerce store uses some extensions. WooCommerce Multilingual is fully compatible with popular extensions, including:
28
 
29
+ * [WooCommerce Bookings](https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-bookings-woocommerce-multilingual/)
30
+ * [WooCommerce Table Rate Shipping](https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-table-rate-shipping-woocommerce-multilingual/)
31
+ * [WooCommerce Subscriptions](https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-subscriptions-woocommerce-multilingual/)
32
+ * [WooCommerce Product Add-ons](https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-product-add-ons-woocommerce-multilingual/)
33
+ * [WooCommerce Tab Manager](https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-tab-manager-woocommerce-multilingual/)
34
 
35
  Looking for other extensions that are tested and compatible with WPML? See the complete [list of WooCommerce extensions that are compatible with WPML](https://wpml.org/documentation/woocommerce-extensions-compatibility/).
36
 
142
 
143
  == Changelog ==
144
 
145
+ = 3.9.1.1 =
146
+ * Bug fix: Fixed a bug causing fatal error on older PHP versions (before 5.6)
147
+
148
  = 3.9.1 =
149
  * Fixed a bug related to the stock information not syncing correctly across translations
150
  * Bug fix: and incorrect value for products out of stock was show on the dashboard
templates/products-list/admin-notice.twig DELETED
@@ -1,10 +0,0 @@
1
- {% if show_notice %}
2
- <div class="notice notice-info is-dismissible" id="{{ div_id }}">
3
- <p>{{ first_line }}<br>{{ second_line | raw }}</p>
4
- <p>
5
- <a id="translations_control" class="translations_control button-secondary" href="{{ button_url | raw }}">
6
- {{ button_text }}
7
- </a>
8
- </p>
9
- </div>
10
- {% endif %}
 
 
 
 
 
 
 
 
 
 
templates/setup/translation-interface.twig DELETED
@@ -1,27 +0,0 @@
1
- <h1>{{ strings.heading }}</h1>
2
-
3
- <p>{{ strings.description }}</p>
4
-
5
- <ul class="no-bullets">
6
- <li>
7
- <label>
8
- <input type="radio" name="translation_interface" value="{{ translation_interface_wpml }}"
9
- {% if translation_interface == translation_interface_wpml %} checked="checked"{% endif %} />
10
- {{ label_wpml_editor }}
11
- </label>
12
- </li>
13
- <li>
14
- <label>
15
- <input type="radio" name="translation_interface" value="{{ translation_interface_native }}"
16
- {% if translation_interface == translation_interface_native %} checked="checked"{% endif %} />
17
- {{ label_native_editor }}
18
- </label>
19
- </li>
20
- </ul>
21
-
22
-
23
- <p class="wcml-setup-actions step">
24
- <a href="{{ continue_url }}" class="button button-primary button-large submit">{{ strings.continue }}</a>
25
- </p>
26
-
27
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpml-woocommerce.php CHANGED
@@ -6,12 +6,12 @@
6
  Author: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com/
8
  Text Domain: woocommerce-multilingual
9
- Version: 3.9.1
10
  */
11
 
12
  if( defined( 'WCML_VERSION' ) ) return;
13
 
14
- define( 'WCML_VERSION', '3.9.1' );
15
  define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
16
  define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
17
  define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );
6
  Author: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com/
8
  Text Domain: woocommerce-multilingual
9
+ Version: 3.9.1.1
10
  */
11
 
12
  if( defined( 'WCML_VERSION' ) ) return;
13
 
14
+ define( 'WCML_VERSION', '3.9.1.1' );
15
  define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
16
  define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
17
  define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );