@@ -1,24 +1,24 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | class wps_display_options { |
3 | 3 | |
4 | 4 | function __construct() { |
5 | - add_action('admin_init', array( $this, 'declare_display_options')); |
|
6 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts') ); |
|
5 | + add_action('admin_init', array($this, 'declare_display_options')); |
|
6 | + add_action('admin_enqueue_scripts', array($this, 'add_scripts')); |
|
7 | 7 | |
8 | 8 | //Print Scripts in frontend for Customization part |
9 | - add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_frontend') ); |
|
9 | + add_action('wp_enqueue_scripts', array($this, 'add_scripts_frontend')); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | function add_scripts() { |
13 | - wp_enqueue_script( 'jquery'); |
|
13 | + wp_enqueue_script('jquery'); |
|
14 | 14 | //color picker lib |
15 | - wp_enqueue_script( 'iris' ); |
|
16 | - wp_enqueue_script( 'wps_options_display_js', WPS_OPTIONS_URL . WPS_OPTIONS_DIR .'/assets/backend/js/wps_option_display.js', false ); |
|
15 | + wp_enqueue_script('iris'); |
|
16 | + wp_enqueue_script('wps_options_display_js', WPS_OPTIONS_URL . WPS_OPTIONS_DIR . '/assets/backend/js/wps_option_display.js', false); |
|
17 | 17 | |
18 | 18 | } |
19 | 19 | |
20 | 20 | function add_scripts_frontend() { |
21 | - add_action('wp_print_scripts', array( $this, 'create_customizing_css_rules') ); |
|
21 | + add_action('wp_print_scripts', array($this, 'create_customizing_css_rules')); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
@@ -27,32 +27,32 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function declare_display_options() { |
29 | 29 | // Frontend display options |
30 | - register_setting('wpshop_options', 'wpshop_display_option', array( $this, 'display_part_validator')); |
|
31 | - add_settings_section('wpshop_display_options_sections', '<span class="dashicons dashicons-welcome-view-site"></span>'.__('Display options', 'wpshop'), array( $this, 'frontend_display_part_explanation'), 'wpshop_display_option'); |
|
30 | + register_setting('wpshop_options', 'wpshop_display_option', array($this, 'display_part_validator')); |
|
31 | + add_settings_section('wpshop_display_options_sections', '<span class="dashicons dashicons-welcome-view-site"></span>' . __('Display options', 'wpshop'), array($this, 'frontend_display_part_explanation'), 'wpshop_display_option'); |
|
32 | 32 | |
33 | 33 | // Add the different field option for frontend |
34 | - add_settings_field('wpshop_display_cat_sheet_output', __('Display type for category page', 'wpshop'), array( $this, 'wpshop_display_cat_sheet_output'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
35 | - add_settings_field('wpshop_display_list_type', __('Display type for element list', 'wpshop'), array( $this, 'wpshop_display_list_type'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
36 | - add_settings_field('wpshop_display_grid_element_number', __('Number of element by line for grid mode', 'wpshop'), array( $this, 'wpshop_display_grid_element_number'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
37 | - add_settings_field('wpshop_display_element_per_page', __('Number of element per page', 'wpshop'), array( $this, 'wpshop_display_element_per_page'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
38 | - add_settings_field('wpshop_display_latest_products_ordered', __('Number of element in "latest products ordered" part', 'wpshop'), array( $this, 'wpshop_display_latest_products_ordered'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
39 | - add_settings_field('wpshop_hide_admin_bar', __('Hide Wordpress Admin Bar for customers', 'wpshop'), array( $this, 'wpshop_hide_admin_bar'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
40 | - add_settings_field('wpshop_display_delete_order', __('Display delete order for customers', 'wpshop'), array( $this, 'wpshop_display_delete_order'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
34 | + add_settings_field('wpshop_display_cat_sheet_output', __('Display type for category page', 'wpshop'), array($this, 'wpshop_display_cat_sheet_output'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
35 | + add_settings_field('wpshop_display_list_type', __('Display type for element list', 'wpshop'), array($this, 'wpshop_display_list_type'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
36 | + add_settings_field('wpshop_display_grid_element_number', __('Number of element by line for grid mode', 'wpshop'), array($this, 'wpshop_display_grid_element_number'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
37 | + add_settings_field('wpshop_display_element_per_page', __('Number of element per page', 'wpshop'), array($this, 'wpshop_display_element_per_page'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
38 | + add_settings_field('wpshop_display_latest_products_ordered', __('Number of element in "latest products ordered" part', 'wpshop'), array($this, 'wpshop_display_latest_products_ordered'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
39 | + add_settings_field('wpshop_hide_admin_bar', __('Hide Wordpress Admin Bar for customers', 'wpshop'), array($this, 'wpshop_hide_admin_bar'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
40 | + add_settings_field('wpshop_display_delete_order', __('Display delete order for customers', 'wpshop'), array($this, 'wpshop_display_delete_order'), 'wpshop_display_option', 'wpshop_display_options_sections'); |
|
41 | 41 | |
42 | 42 | // Customize WPShop display part |
43 | - register_setting('wpshop_options', 'wpshop_customize_display_option', array( $this, 'customize_color_validator')); |
|
44 | - add_settings_section('wpshop_customize_wpshop_display_option', '<span class="dashicons dashicons-admin-appearance"></span>'.__('Customize your WPShop', 'wpshop'), array( $this, 'customize_wpshop_colors_explanation'), 'wpshop_customize_display_option'); |
|
45 | - add_settings_field('wpshop_customize_first_button_field', __('Change the principal button style', 'wpshop'), array( $this, 'wps_customize_first_button_style'), 'wpshop_customize_display_option', 'wpshop_customize_wpshop_display_option'); |
|
46 | - add_settings_field('wpshop_customize_second_button_field', __('Change the second button style', 'wpshop'), array( $this, 'wps_customize_second_button_style'), 'wpshop_customize_display_option', 'wpshop_customize_wpshop_display_option'); |
|
47 | - add_settings_field('wpshop_customize_account_field', __('Change the customer account elements style', 'wpshop'), array( $this, 'wps_customize_account_style'), 'wpshop_customize_display_option', 'wpshop_customize_wpshop_display_option'); |
|
48 | - add_settings_field('wpshop_customize_shipping_list_field', __('Change The shipping mode choice element style', 'wpshop'), array( $this, 'wps_customize_shipping_style'), 'wpshop_customize_display_option', 'wpshop_customize_wpshop_display_option'); |
|
43 | + register_setting('wpshop_options', 'wpshop_customize_display_option', array($this, 'customize_color_validator')); |
|
44 | + add_settings_section('wpshop_customize_wpshop_display_option', '<span class="dashicons dashicons-admin-appearance"></span>' . __('Customize your WPShop', 'wpshop'), array($this, 'customize_wpshop_colors_explanation'), 'wpshop_customize_display_option'); |
|
45 | + add_settings_field('wpshop_customize_first_button_field', __('Change the principal button style', 'wpshop'), array($this, 'wps_customize_first_button_style'), 'wpshop_customize_display_option', 'wpshop_customize_wpshop_display_option'); |
|
46 | + add_settings_field('wpshop_customize_second_button_field', __('Change the second button style', 'wpshop'), array($this, 'wps_customize_second_button_style'), 'wpshop_customize_display_option', 'wpshop_customize_wpshop_display_option'); |
|
47 | + add_settings_field('wpshop_customize_account_field', __('Change the customer account elements style', 'wpshop'), array($this, 'wps_customize_account_style'), 'wpshop_customize_display_option', 'wpshop_customize_wpshop_display_option'); |
|
48 | + add_settings_field('wpshop_customize_shipping_list_field', __('Change The shipping mode choice element style', 'wpshop'), array($this, 'wps_customize_shipping_style'), 'wpshop_customize_display_option', 'wpshop_customize_wpshop_display_option'); |
|
49 | 49 | |
50 | 50 | // Admin (Back-end) display options |
51 | - register_setting('wpshop_options', 'wpshop_admin_display_option', array( $this, 'admin_part_validator')); |
|
52 | - add_settings_section('wpshop_admin_display_options_sections', '<span class="dashicons dashicons-desktop"></span>'.__('Admin display options', 'wpshop'), array( $this, 'admin_part_explanation'), 'wpshop_admin_display_option'); |
|
53 | - add_settings_field('wpshop_admin_display_attribute_set_layout', __('Attribute set page layout', 'wpshop'), array( $this, 'wpshop_admin_display_attr_set_layout'), 'wpshop_admin_display_option', 'wpshop_admin_display_options_sections'); |
|
54 | - add_settings_field('wpshop_admin_display_attribute_layout', __('Attribute page layout', 'wpshop'), array( $this, 'wpshop_admin_display_attr_layout'), 'wpshop_admin_display_option', 'wpshop_admin_display_options_sections'); |
|
55 | - add_settings_field('wpshop_admin_display_shortcode_product', __('Shortcode display in product page', 'wpshop'), array( $this, 'wpshop_admin_display_shortcode_in_product_page'), 'wpshop_admin_display_option', 'wpshop_admin_display_options_sections'); |
|
51 | + register_setting('wpshop_options', 'wpshop_admin_display_option', array($this, 'admin_part_validator')); |
|
52 | + add_settings_section('wpshop_admin_display_options_sections', '<span class="dashicons dashicons-desktop"></span>' . __('Admin display options', 'wpshop'), array($this, 'admin_part_explanation'), 'wpshop_admin_display_option'); |
|
53 | + add_settings_field('wpshop_admin_display_attribute_set_layout', __('Attribute set page layout', 'wpshop'), array($this, 'wpshop_admin_display_attr_set_layout'), 'wpshop_admin_display_option', 'wpshop_admin_display_options_sections'); |
|
54 | + add_settings_field('wpshop_admin_display_attribute_layout', __('Attribute page layout', 'wpshop'), array($this, 'wpshop_admin_display_attr_layout'), 'wpshop_admin_display_option', 'wpshop_admin_display_options_sections'); |
|
55 | + add_settings_field('wpshop_admin_display_shortcode_product', __('Shortcode display in product page', 'wpshop'), array($this, 'wpshop_admin_display_shortcode_in_product_page'), 'wpshop_admin_display_option', 'wpshop_admin_display_options_sections'); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | * @param array $input |
70 | 70 | * @return array |
71 | 71 | */ |
72 | - function display_part_validator( $input ) { |
|
72 | + function display_part_validator($input) { |
|
73 | 73 | $newinput['wpshop_display_list_type'] = $input['wpshop_display_list_type']; |
74 | - if($input['wpshop_display_grid_element_number'] < WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MIN_RANGE){ |
|
74 | + if ($input['wpshop_display_grid_element_number'] < WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MIN_RANGE) { |
|
75 | 75 | $input['wpshop_display_grid_element_number'] = WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MIN_RANGE; |
76 | 76 | } |
77 | - elseif($input['wpshop_display_grid_element_number'] > WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MAX_RANGE){ |
|
77 | + elseif ($input['wpshop_display_grid_element_number'] > WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MAX_RANGE) { |
|
78 | 78 | $input['wpshop_display_grid_element_number'] = WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MAX_RANGE; |
79 | 79 | } |
80 | 80 | $newinput['wpshop_display_grid_element_number'] = $input['wpshop_display_grid_element_number']; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * EXPLANATIONS - Frontend display option explanantion |
91 | 91 | */ |
92 | 92 | function frontend_display_part_explanation() { |
93 | - _e( 'Manage here your frontend display options', 'wpshop'); |
|
93 | + _e('Manage here your frontend display options', 'wpshop'); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | $wpshop_display_option = get_option('wpshop_display_option'); |
101 | 101 | $field_identifier = 'wpshop_display_cat_sheet_output'; |
102 | 102 | |
103 | - if(current_user_can('wpshop_edit_options')){ |
|
103 | + if (current_user_can('wpshop_edit_options')) { |
|
104 | 104 | $content = array('category_description', 'category_subcategory', 'category_subproduct'); |
105 | 105 | $option_field_output = ''; |
106 | - foreach($content as $content_definition){ |
|
106 | + foreach ($content as $content_definition) { |
|
107 | 107 | $current_value = (is_array($wpshop_display_option['wpshop_display_cat_sheet_output']) && in_array($content_definition, $wpshop_display_option['wpshop_display_cat_sheet_output'])) || !is_array($wpshop_display_option['wpshop_display_cat_sheet_output']) ? $content_definition : ''; |
108 | 108 | |
109 | - switch($content_definition){ |
|
109 | + switch ($content_definition) { |
|
110 | 110 | case 'category_description': |
111 | 111 | { |
112 | 112 | $field_label = __('Display product category description', 'wpshop'); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $option_field_output .= wpshop_form::form_input_check('wpshop_display_option[' . $field_identifier . '][]', $field_identifier . '_' . $content_definition, $content_definition, $current_value, 'checkbox') . '<label for="' . $field_identifier . '_' . $content_definition . '" >' . $field_label . '</label><br/>'; |
132 | 132 | } |
133 | 133 | } |
134 | - else{ |
|
134 | + else { |
|
135 | 135 | $option_field_output = $wpshop_display_option[$field_identifier]; |
136 | 136 | } |
137 | 137 | |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | $wpshop_display_option = get_option('wpshop_display_option'); |
146 | 146 | $field_identifier = 'wpshop_display_list_type'; |
147 | 147 | |
148 | - if(current_user_can('wpshop_edit_options')){ |
|
148 | + if (current_user_can('wpshop_edit_options')) { |
|
149 | 149 | $option_field_output = wpshop_form::form_input_select('wpshop_display_option[' . $field_identifier . ']', $field_identifier, array('grid' => __('Grid', 'wpshop'), 'list' => __('List', 'wpshop')), $wpshop_display_option[$field_identifier], '', 'index'); |
150 | 150 | } |
151 | - else{ |
|
151 | + else { |
|
152 | 152 | $option_field_output = $wpshop_display_option[$field_identifier]; |
153 | 153 | } |
154 | 154 | |
155 | - echo $option_field_output.' <a href="#" title="'.__('Default display mode on shop','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
155 | + echo $option_field_output . ' <a href="#" title="' . __('Default display mode on shop', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | function wpshop_display_grid_element_number() { |
162 | 162 | $wpshop_display_option = get_option('wpshop_display_option'); |
163 | 163 | $field_identifier = 'wpshop_display_grid_element_number'; |
164 | - require( wpshop_tools::get_template_part( WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "backend", "wps_display_options_grid_field") ); |
|
164 | + require(wpshop_tools::get_template_part(WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "backend", "wps_display_options_grid_field")); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | $wpshop_display_option = get_option('wpshop_display_option'); |
172 | 172 | $field_identifier = 'wpshop_display_element_per_page'; |
173 | 173 | |
174 | - if(current_user_can('wpshop_edit_options')){ |
|
174 | + if (current_user_can('wpshop_edit_options')) { |
|
175 | 175 | $option_field_output = wpshop_form::form_input('wpshop_display_option[' . $field_identifier . ']', $field_identifier, !empty($wpshop_display_option[$field_identifier]) ? $wpshop_display_option[$field_identifier] : 20, 'text'); |
176 | 176 | } |
177 | - else{ |
|
177 | + else { |
|
178 | 178 | $option_field_output = $wpshop_display_option[$field_identifier]; |
179 | 179 | } |
180 | 180 | |
181 | - echo $option_field_output.' <a href="#" title="'.__('Number of elements per page','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
181 | + echo $option_field_output . ' <a href="#" title="' . __('Number of elements per page', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function wpshop_display_latest_products_ordered() { |
188 | 188 | $display_option = get_option('wpshop_display_option'); |
189 | - $output = '<input type="text" value="' .( (!empty($display_option) && !empty($display_option['latest_products_ordered']) ) ? $display_option['latest_products_ordered'] : ''). '" name="wpshop_display_option[latest_products_ordered]" id="wpshop_display_latest_products_ordered" />'; |
|
189 | + $output = '<input type="text" value="' . ((!empty($display_option) && !empty($display_option['latest_products_ordered'])) ? $display_option['latest_products_ordered'] : '') . '" name="wpshop_display_option[latest_products_ordered]" id="wpshop_display_latest_products_ordered" />'; |
|
190 | 190 | echo $output; |
191 | 191 | } |
192 | 192 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | function wpshop_hide_admin_bar() { |
197 | 197 | $wpshop_hide_admin_bar_option = get_option('wpshop_display_option'); |
198 | - $output = '<input type="checkbox" name="wpshop_display_option[wpshop_hide_admin_bar]" ' .( (!empty($wpshop_hide_admin_bar_option) && !empty($wpshop_hide_admin_bar_option['wpshop_hide_admin_bar']) ) ? 'checked="checked"' : ''). '/>'; |
|
198 | + $output = '<input type="checkbox" name="wpshop_display_option[wpshop_hide_admin_bar]" ' . ((!empty($wpshop_hide_admin_bar_option) && !empty($wpshop_hide_admin_bar_option['wpshop_hide_admin_bar'])) ? 'checked="checked"' : '') . '/>'; |
|
199 | 199 | echo $output; |
200 | 200 | } |
201 | 201 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function wpshop_display_delete_order() { |
206 | 206 | $wpshop_display_delete_order_option = get_option('wpshop_display_option'); |
207 | - $output = '<input type="checkbox" name="wpshop_display_option[wpshop_display_delete_order]" ' .( (!empty($wpshop_display_delete_order_option) && !empty($wpshop_display_delete_order_option['wpshop_display_delete_order']) ) ? 'checked="checked"' : ''). '/>'; |
|
207 | + $output = '<input type="checkbox" name="wpshop_display_option[wpshop_display_delete_order]" ' . ((!empty($wpshop_display_delete_order_option) && !empty($wpshop_display_delete_order_option['wpshop_display_delete_order'])) ? 'checked="checked"' : '') . '/>'; |
|
208 | 208 | echo $output; |
209 | 209 | } |
210 | 210 | |
@@ -230,47 +230,47 @@ discard block |
||
230 | 230 | * EXPLANATIONS - Display customize WPShop explanantions |
231 | 231 | */ |
232 | 232 | function customize_wpshop_colors_explanation() { |
233 | - _e( 'Here, you can customize your WPShop elements like buttons, customer account parts and selected shipping method colors...', 'wpshop'); |
|
233 | + _e('Here, you can customize your WPShop elements like buttons, customer account parts and selected shipping method colors...', 'wpshop'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
237 | 237 | * FIELDS - Display First button customize option |
238 | 238 | */ |
239 | 239 | function wps_customize_first_button_style() { |
240 | - $wpshop_customize_display_option = get_option( 'wpshop_customize_display_option' ); |
|
241 | - require( wpshop_tools::get_template_part( WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "backend", "wps_display_options_customize_first_button") ); |
|
240 | + $wpshop_customize_display_option = get_option('wpshop_customize_display_option'); |
|
241 | + require(wpshop_tools::get_template_part(WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "backend", "wps_display_options_customize_first_button")); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
245 | 245 | * FIELDS - Display Second button customize option |
246 | 246 | */ |
247 | 247 | function wps_customize_second_button_style() { |
248 | - $wpshop_customize_display_option = get_option( 'wpshop_customize_display_option' ); |
|
249 | - require( wpshop_tools::get_template_part( WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "backend", "wps_display_options_customize_second_button") ); |
|
248 | + $wpshop_customize_display_option = get_option('wpshop_customize_display_option'); |
|
249 | + require(wpshop_tools::get_template_part(WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "backend", "wps_display_options_customize_second_button")); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
253 | 253 | * FIELDS - Dsiplay Customer account customize option |
254 | 254 | */ |
255 | 255 | function wps_customize_account_style() { |
256 | - $wpshop_customize_display_option = get_option( 'wpshop_customize_display_option' ); |
|
257 | - require( wpshop_tools::get_template_part( WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "backend", "wps_display_options_customize_customer_account") ); |
|
256 | + $wpshop_customize_display_option = get_option('wpshop_customize_display_option'); |
|
257 | + require(wpshop_tools::get_template_part(WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "backend", "wps_display_options_customize_customer_account")); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | 261 | * FIELDS - Dsiplay Customer account customize option |
262 | 262 | */ |
263 | 263 | function wps_customize_shipping_style() { |
264 | - $wpshop_customize_display_option = get_option( 'wpshop_customize_display_option' ); |
|
265 | - require( wpshop_tools::get_template_part( WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "backend", "wps_display_options_customize_shipping_list") ); |
|
264 | + $wpshop_customize_display_option = get_option('wpshop_customize_display_option'); |
|
265 | + require(wpshop_tools::get_template_part(WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "backend", "wps_display_options_customize_shipping_list")); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
269 | 269 | * Print Custom CSS Rules in administration |
270 | 270 | */ |
271 | 271 | function create_customizing_css_rules() { |
272 | - $wpshop_customize_display_option = get_option( 'wpshop_customize_display_option' ); |
|
273 | - require( wpshop_tools::get_template_part( WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "frontend", "wps_display_options_customize_css_rules") ); |
|
272 | + $wpshop_customize_display_option = get_option('wpshop_customize_display_option'); |
|
273 | + require(wpshop_tools::get_template_part(WPS_OPTIONS_DIR, WPS_OPTIONS_TEMPLATE_DIR, "frontend", "wps_display_options_customize_css_rules")); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | |
@@ -287,62 +287,62 @@ discard block |
||
287 | 287 | * @param array $input |
288 | 288 | * @return array |
289 | 289 | */ |
290 | - function admin_part_validator($input){ |
|
290 | + function admin_part_validator($input) { |
|
291 | 291 | return $input; |
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
295 | 295 | * EXPLANATIONS - Admin display options explanation |
296 | 296 | */ |
297 | - function admin_part_explanation(){ |
|
297 | + function admin_part_explanation() { |
|
298 | 298 | _e('You can defined some parameters for admin display', 'wpshop'); |
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
302 | 302 | * FIELDS - Display admin option Attributes set layout type |
303 | 303 | */ |
304 | - function wpshop_admin_display_attr_set_layout(){ |
|
304 | + function wpshop_admin_display_attr_set_layout() { |
|
305 | 305 | global $attribute_page_layout_types; |
306 | 306 | $field_identifier = 'wpshop_admin_attr_set_layout'; |
307 | 307 | $wpshop_admin_display_option = get_option('wpshop_admin_display_option', array()); |
308 | 308 | |
309 | - if ( current_user_can('wpshop_edit_options') ) |
|
309 | + if (current_user_can('wpshop_edit_options')) |
|
310 | 310 | $option_field_output = wpshop_form::form_input_select('wpshop_admin_display_option[' . $field_identifier . ']', $field_identifier, $attribute_page_layout_types, WPSHOP_ATTRIBUTE_SET_EDITION_PAGE_LAYOUT, '', 'index'); |
311 | 311 | else |
312 | 312 | $option_field_output = $wpshop_admin_display_option[$field_identifier]; |
313 | 313 | |
314 | - echo $option_field_output.' <a href="#" title="'.__('Define if the attribute set edition page is displayed as tab or as separated bloc','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
314 | + echo $option_field_output . ' <a href="#" title="' . __('Define if the attribute set edition page is displayed as tab or as separated bloc', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
318 | 318 | * FIELDS - Display admin option attributes Layout type |
319 | 319 | */ |
320 | - function wpshop_admin_display_attr_layout(){ |
|
320 | + function wpshop_admin_display_attr_layout() { |
|
321 | 321 | global $attribute_page_layout_types; |
322 | 322 | $field_identifier = 'wpshop_admin_attr_layout'; |
323 | 323 | $wpshop_admin_display_option = get_option('wpshop_admin_display_option', array()); |
324 | 324 | |
325 | - if ( current_user_can('wpshop_edit_options') ) |
|
325 | + if (current_user_can('wpshop_edit_options')) |
|
326 | 326 | $option_field_output = wpshop_form::form_input_select('wpshop_admin_display_option[' . $field_identifier . ']', $field_identifier, $attribute_page_layout_types, WPSHOP_ATTRIBUTE_EDITION_PAGE_LAYOUT, '', 'index'); |
327 | 327 | else |
328 | 328 | $option_field_output = $wpshop_admin_display_option[$field_identifier]; |
329 | 329 | |
330 | - echo $option_field_output.' <a href="#" title="'.__('Define if the attribute edition page is displayed as tab or as separated bloc','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
330 | + echo $option_field_output . ' <a href="#" title="' . __('Define if the attribute edition page is displayed as tab or as separated bloc', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
334 | 334 | * FIELDS - Display admin options Shortcode layout display |
335 | 335 | */ |
336 | - function wpshop_admin_display_shortcode_in_product_page(){ |
|
336 | + function wpshop_admin_display_shortcode_in_product_page() { |
|
337 | 337 | global $product_page_layout_types; |
338 | 338 | $field_identifier = 'wpshop_admin_product_shortcode_display'; |
339 | 339 | $wpshop_admin_display_option = get_option('wpshop_admin_display_option', array()); |
340 | 340 | |
341 | - if ( current_user_can('wpshop_edit_options') ) |
|
341 | + if (current_user_can('wpshop_edit_options')) |
|
342 | 342 | $option_field_output = wpshop_form::form_input_select('wpshop_admin_display_option[' . $field_identifier . ']', $field_identifier, $product_page_layout_types, WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE, '', 'index'); |
343 | 343 | else |
344 | 344 | $option_field_output = $wpshop_admin_display_option[$field_identifier]; |
345 | 345 | |
346 | - echo $option_field_output.' <a href="#" title="'.__('Define how to display the shortcode summary in product edition page','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
346 | + echo $option_field_output . ' <a href="#" title="' . __('Define how to display the shortcode summary in product edition page', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | \ No newline at end of file |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | class wps_display_options { |
3 | 5 | |
4 | 6 | function __construct() { |
@@ -73,8 +75,7 @@ discard block |
||
73 | 75 | $newinput['wpshop_display_list_type'] = $input['wpshop_display_list_type']; |
74 | 76 | if($input['wpshop_display_grid_element_number'] < WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MIN_RANGE){ |
75 | 77 | $input['wpshop_display_grid_element_number'] = WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MIN_RANGE; |
76 | - } |
|
77 | - elseif($input['wpshop_display_grid_element_number'] > WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MAX_RANGE){ |
|
78 | + } elseif($input['wpshop_display_grid_element_number'] > WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MAX_RANGE){ |
|
78 | 79 | $input['wpshop_display_grid_element_number'] = WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MAX_RANGE; |
79 | 80 | } |
80 | 81 | $newinput['wpshop_display_grid_element_number'] = $input['wpshop_display_grid_element_number']; |
@@ -130,8 +131,7 @@ discard block |
||
130 | 131 | } |
131 | 132 | $option_field_output .= wpshop_form::form_input_check('wpshop_display_option[' . $field_identifier . '][]', $field_identifier . '_' . $content_definition, $content_definition, $current_value, 'checkbox') . '<label for="' . $field_identifier . '_' . $content_definition . '" >' . $field_label . '</label><br/>'; |
132 | 133 | } |
133 | - } |
|
134 | - else{ |
|
134 | + } else{ |
|
135 | 135 | $option_field_output = $wpshop_display_option[$field_identifier]; |
136 | 136 | } |
137 | 137 | |
@@ -147,8 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | if(current_user_can('wpshop_edit_options')){ |
149 | 149 | $option_field_output = wpshop_form::form_input_select('wpshop_display_option[' . $field_identifier . ']', $field_identifier, array('grid' => __('Grid', 'wpshop'), 'list' => __('List', 'wpshop')), $wpshop_display_option[$field_identifier], '', 'index'); |
150 | - } |
|
151 | - else{ |
|
150 | + } else{ |
|
152 | 151 | $option_field_output = $wpshop_display_option[$field_identifier]; |
153 | 152 | } |
154 | 153 | |
@@ -173,8 +172,7 @@ discard block |
||
173 | 172 | |
174 | 173 | if(current_user_can('wpshop_edit_options')){ |
175 | 174 | $option_field_output = wpshop_form::form_input('wpshop_display_option[' . $field_identifier . ']', $field_identifier, !empty($wpshop_display_option[$field_identifier]) ? $wpshop_display_option[$field_identifier] : 20, 'text'); |
176 | - } |
|
177 | - else{ |
|
175 | + } else{ |
|
178 | 176 | $option_field_output = $wpshop_display_option[$field_identifier]; |
179 | 177 | } |
180 | 178 | |
@@ -306,10 +304,11 @@ discard block |
||
306 | 304 | $field_identifier = 'wpshop_admin_attr_set_layout'; |
307 | 305 | $wpshop_admin_display_option = get_option('wpshop_admin_display_option', array()); |
308 | 306 | |
309 | - if ( current_user_can('wpshop_edit_options') ) |
|
310 | - $option_field_output = wpshop_form::form_input_select('wpshop_admin_display_option[' . $field_identifier . ']', $field_identifier, $attribute_page_layout_types, WPSHOP_ATTRIBUTE_SET_EDITION_PAGE_LAYOUT, '', 'index'); |
|
311 | - else |
|
312 | - $option_field_output = $wpshop_admin_display_option[$field_identifier]; |
|
307 | + if ( current_user_can('wpshop_edit_options') ) { |
|
308 | + $option_field_output = wpshop_form::form_input_select('wpshop_admin_display_option[' . $field_identifier . ']', $field_identifier, $attribute_page_layout_types, WPSHOP_ATTRIBUTE_SET_EDITION_PAGE_LAYOUT, '', 'index'); |
|
309 | + } else { |
|
310 | + $option_field_output = $wpshop_admin_display_option[$field_identifier]; |
|
311 | + } |
|
313 | 312 | |
314 | 313 | echo $option_field_output.' <a href="#" title="'.__('Define if the attribute set edition page is displayed as tab or as separated bloc','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
315 | 314 | } |
@@ -322,10 +321,11 @@ discard block |
||
322 | 321 | $field_identifier = 'wpshop_admin_attr_layout'; |
323 | 322 | $wpshop_admin_display_option = get_option('wpshop_admin_display_option', array()); |
324 | 323 | |
325 | - if ( current_user_can('wpshop_edit_options') ) |
|
326 | - $option_field_output = wpshop_form::form_input_select('wpshop_admin_display_option[' . $field_identifier . ']', $field_identifier, $attribute_page_layout_types, WPSHOP_ATTRIBUTE_EDITION_PAGE_LAYOUT, '', 'index'); |
|
327 | - else |
|
328 | - $option_field_output = $wpshop_admin_display_option[$field_identifier]; |
|
324 | + if ( current_user_can('wpshop_edit_options') ) { |
|
325 | + $option_field_output = wpshop_form::form_input_select('wpshop_admin_display_option[' . $field_identifier . ']', $field_identifier, $attribute_page_layout_types, WPSHOP_ATTRIBUTE_EDITION_PAGE_LAYOUT, '', 'index'); |
|
326 | + } else { |
|
327 | + $option_field_output = $wpshop_admin_display_option[$field_identifier]; |
|
328 | + } |
|
329 | 329 | |
330 | 330 | echo $option_field_output.' <a href="#" title="'.__('Define if the attribute edition page is displayed as tab or as separated bloc','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
331 | 331 | } |
@@ -338,10 +338,11 @@ discard block |
||
338 | 338 | $field_identifier = 'wpshop_admin_product_shortcode_display'; |
339 | 339 | $wpshop_admin_display_option = get_option('wpshop_admin_display_option', array()); |
340 | 340 | |
341 | - if ( current_user_can('wpshop_edit_options') ) |
|
342 | - $option_field_output = wpshop_form::form_input_select('wpshop_admin_display_option[' . $field_identifier . ']', $field_identifier, $product_page_layout_types, WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE, '', 'index'); |
|
343 | - else |
|
344 | - $option_field_output = $wpshop_admin_display_option[$field_identifier]; |
|
341 | + if ( current_user_can('wpshop_edit_options') ) { |
|
342 | + $option_field_output = wpshop_form::form_input_select('wpshop_admin_display_option[' . $field_identifier . ']', $field_identifier, $product_page_layout_types, WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE, '', 'index'); |
|
343 | + } else { |
|
344 | + $option_field_output = $wpshop_admin_display_option[$field_identifier]; |
|
345 | + } |
|
345 | 346 | |
346 | 347 | echo $option_field_output.' <a href="#" title="'.__('Define how to display the shortcode summary in product edition page','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
347 | 348 | } |
@@ -1,63 +1,63 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | - if( !empty($wpshop_customize_display_option) ) : ?> |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | + if (!empty($wpshop_customize_display_option)) : ?> |
|
3 | 3 | <!-- WPSHOP CUSTOM CSS RULES --> |
4 | 4 | <style> |
5 | - <?php if( !empty($wpshop_customize_display_option['first']) ) : ?> |
|
5 | + <?php if (!empty($wpshop_customize_display_option['first'])) : ?> |
|
6 | 6 | [class*="wps"][class*="bton"][class*="first"] { |
7 | - <?php if( !empty($wpshop_customize_display_option['first']['background']) ) : ?> |
|
7 | + <?php if (!empty($wpshop_customize_display_option['first']['background'])) : ?> |
|
8 | 8 | background : <?php echo $wpshop_customize_display_option['first']['background']; ?>!important; |
9 | 9 | <?php endif; ?> |
10 | - <?php if( !empty($wpshop_customize_display_option['first']['shadow']) ) : ?> |
|
10 | + <?php if (!empty($wpshop_customize_display_option['first']['shadow'])) : ?> |
|
11 | 11 | box-shadow: 0 0.25em 0 0 <?php echo $wpshop_customize_display_option['first']['shadow']; ?>!important; |
12 | 12 | <?php endif; ?> |
13 | - <?php if( !empty($wpshop_customize_display_option['first']['text']) ) : ?> |
|
13 | + <?php if (!empty($wpshop_customize_display_option['first']['text'])) : ?> |
|
14 | 14 | color : <?php echo $wpshop_customize_display_option['first']['text']; ?>!important; |
15 | 15 | <?php endif; ?> |
16 | 16 | |
17 | 17 | } |
18 | 18 | |
19 | 19 | [class*="wps"][class*="bton"][class*="first"]:hover { |
20 | - <?php if( !empty($wpshop_customize_display_option['first']['background_hover']) ) : ?> |
|
20 | + <?php if (!empty($wpshop_customize_display_option['first']['background_hover'])) : ?> |
|
21 | 21 | background : <?php echo $wpshop_customize_display_option['first']['background_hover']; ?>!important; |
22 | 22 | <?php endif; ?> |
23 | - <?php if( !empty($wpshop_customize_display_option['first']['shadow_hover']) ) : ?> |
|
23 | + <?php if (!empty($wpshop_customize_display_option['first']['shadow_hover'])) : ?> |
|
24 | 24 | box-shadow: 0 0.25em 0 0 <?php echo $wpshop_customize_display_option['first']['shadow_hover']; ?>!important; |
25 | 25 | <?php endif; ?> |
26 | - <?php if( !empty($wpshop_customize_display_option['first']['text_hover']) ) : ?> |
|
26 | + <?php if (!empty($wpshop_customize_display_option['first']['text_hover'])) : ?> |
|
27 | 27 | color : <?php echo $wpshop_customize_display_option['first']['text_hover']; ?>!important; |
28 | 28 | <?php endif; ?> |
29 | 29 | } |
30 | 30 | <?php endif; ?> |
31 | 31 | |
32 | - <?php if( !empty($wpshop_customize_display_option['second']) ) : ?> |
|
32 | + <?php if (!empty($wpshop_customize_display_option['second'])) : ?> |
|
33 | 33 | [class*="wps"][class*="bton"][class*="second"] { |
34 | - <?php if( !empty($wpshop_customize_display_option['second']['background']) ) : ?> |
|
34 | + <?php if (!empty($wpshop_customize_display_option['second']['background'])) : ?> |
|
35 | 35 | background : <?php echo $wpshop_customize_display_option['second']['background']; ?>!important; |
36 | 36 | <?php endif; ?> |
37 | - <?php if( !empty($wpshop_customize_display_option['second']['shadow']) ) : ?> |
|
37 | + <?php if (!empty($wpshop_customize_display_option['second']['shadow'])) : ?> |
|
38 | 38 | box-shadow: 0 0.25em 0 0 <?php echo $wpshop_customize_display_option['second']['shadow']; ?>!important; |
39 | 39 | <?php endif; ?> |
40 | - <?php if( !empty($wpshop_customize_display_option['second']['text']) ) : ?> |
|
40 | + <?php if (!empty($wpshop_customize_display_option['second']['text'])) : ?> |
|
41 | 41 | color : <?php echo $wpshop_customize_display_option['second']['text']; ?>!important; |
42 | 42 | <?php endif; ?> |
43 | 43 | |
44 | 44 | } |
45 | 45 | |
46 | 46 | [class*="wps"][class*="bton"][class*="second"]:hover { |
47 | - <?php if( !empty($wpshop_customize_display_option['second']['background_hover']) ) : ?> |
|
47 | + <?php if (!empty($wpshop_customize_display_option['second']['background_hover'])) : ?> |
|
48 | 48 | background : <?php echo $wpshop_customize_display_option['second']['background_hover']; ?>!important; |
49 | 49 | <?php endif; ?> |
50 | - <?php if( !empty($wpshop_customize_display_option['second']['shadow_hover']) ) : ?> |
|
50 | + <?php if (!empty($wpshop_customize_display_option['second']['shadow_hover'])) : ?> |
|
51 | 51 | box-shadow: 0 0.25em 0 0 <?php echo $wpshop_customize_display_option['second']['shadow_hover']; ?>!important; |
52 | 52 | <?php endif; ?> |
53 | - <?php if( !empty($wpshop_customize_display_option['second']['text_hover']) ) : ?> |
|
53 | + <?php if (!empty($wpshop_customize_display_option['second']['text_hover'])) : ?> |
|
54 | 54 | color : <?php echo $wpshop_customize_display_option['second']['text_hover']; ?>!important; |
55 | 55 | <?php endif; ?> |
56 | 56 | } |
57 | 57 | <?php endif; ?> |
58 | 58 | |
59 | 59 | |
60 | - <?php if( !empty($wpshop_customize_display_option['account']['activ_element_background']) ) : ?> |
|
60 | + <?php if (!empty($wpshop_customize_display_option['account']['activ_element_background'])) : ?> |
|
61 | 61 | .wps-section-taskbar ul li.wps-activ a { |
62 | 62 | background : <?php echo $wpshop_customize_display_option['account']['activ_element_background']; ?>!important |
63 | 63 | } |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | } |
67 | 67 | <?php endif; ?> |
68 | 68 | |
69 | - <?php if( !empty($wpshop_customize_display_option['account']['part_background']) ) : ?> |
|
69 | + <?php if (!empty($wpshop_customize_display_option['account']['part_background'])) : ?> |
|
70 | 70 | .wps-section-taskbar ul li a { |
71 | 71 | background : <?php echo $wpshop_customize_display_option['account']['part_background']; ?>!important; |
72 | 72 | } |
73 | 73 | <?php endif; ?> |
74 | 74 | |
75 | - <?php if( !empty($wpshop_customize_display_option['account']['information_box_background']) ) : ?> |
|
75 | + <?php if (!empty($wpshop_customize_display_option['account']['information_box_background'])) : ?> |
|
76 | 76 | .wps-section-taskbar ul li a span:before { |
77 | 77 | border-right-color : <?php echo $wpshop_customize_display_option['account']['information_box_background']; ?>!important |
78 | 78 | } |
@@ -81,25 +81,25 @@ discard block |
||
81 | 81 | } |
82 | 82 | <?php endif; ?> |
83 | 83 | |
84 | - <?php if( !empty($wpshop_customize_display_option['shipping']['active_element']) ) : ?> |
|
84 | + <?php if (!empty($wpshop_customize_display_option['shipping']['active_element'])) : ?> |
|
85 | 85 | .wps-itemList li.wps-activ { |
86 | 86 | background : <?php echo $wpshop_customize_display_option['shipping']['active_element']; ?>!important; |
87 | 87 | } |
88 | 88 | <?php endif; ?> |
89 | 89 | |
90 | 90 | .wps-itemList li { |
91 | - <?php if( !empty($wpshop_customize_display_option['shipping']['background']) ) : ?> |
|
91 | + <?php if (!empty($wpshop_customize_display_option['shipping']['background'])) : ?> |
|
92 | 92 | background : <?php echo $wpshop_customize_display_option['shipping']['background']; ?>!important; |
93 | 93 | <?php endif; ?> |
94 | 94 | } |
95 | 95 | |
96 | - <?php if( !empty($wpshop_customize_display_option['shipping']['text']) ) : ?> |
|
96 | + <?php if (!empty($wpshop_customize_display_option['shipping']['text'])) : ?> |
|
97 | 97 | .wps-itemList li span { |
98 | 98 | color : <?php echo $wpshop_customize_display_option['shipping']['text']; ?>!important; |
99 | 99 | } |
100 | 100 | |
101 | 101 | .wps-itemList li div { |
102 | - <?php if( !empty($wpshop_customize_display_option['shipping']['active_element']) ) : ?> |
|
102 | + <?php if (!empty($wpshop_customize_display_option['shipping']['active_element'])) : ?> |
|
103 | 103 | background : <?php echo $wpshop_customize_display_option['shipping']['active_element']; ?>!important; |
104 | 104 | <?php endif; ?> |
105 | 105 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,32 +1,32 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-gridwrapper3-padded"> |
4 | 4 | <div> |
5 | 5 | <div class="wps-form-group"> |
6 | - <label><?php _e( 'First button background color', 'wpshop'); ?> :</label> |
|
6 | + <label><?php _e('First button background color', 'wpshop'); ?> :</label> |
|
7 | 7 | <div class="wps-form"> |
8 | - <input type="text" name="wpshop_customize_display_option[first][background]" id="wpshop_customize_display_option_first_background" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['background']) ) ? $wpshop_customize_display_option['first']['background'] : ''; ?>" /> |
|
9 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['background']) ) ? $wpshop_customize_display_option['first']['background'] : ''; ?>"></span> |
|
8 | + <input type="text" name="wpshop_customize_display_option[first][background]" id="wpshop_customize_display_option_first_background" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['background'])) ? $wpshop_customize_display_option['first']['background'] : ''; ?>" /> |
|
9 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['background'])) ? $wpshop_customize_display_option['first']['background'] : ''; ?>"></span> |
|
10 | 10 | </div> |
11 | 11 | </div> |
12 | 12 | </div> |
13 | 13 | |
14 | 14 | <div> |
15 | 15 | <div class="wps-form-group"> |
16 | - <label><?php _e( 'First button shadow color', 'wpshop'); ?> :</label> |
|
16 | + <label><?php _e('First button shadow color', 'wpshop'); ?> :</label> |
|
17 | 17 | <div class="wps-form"> |
18 | - <input type="text" name="wpshop_customize_display_option[first][shadow]" id="wpshop_customize_display_option_first_shadow" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['shadow']) ) ? $wpshop_customize_display_option['first']['shadow'] : ''; ?>" /> |
|
19 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['shadow']) ) ? $wpshop_customize_display_option['first']['shadow'] : ''; ?>"></span> |
|
18 | + <input type="text" name="wpshop_customize_display_option[first][shadow]" id="wpshop_customize_display_option_first_shadow" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['shadow'])) ? $wpshop_customize_display_option['first']['shadow'] : ''; ?>" /> |
|
19 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['shadow'])) ? $wpshop_customize_display_option['first']['shadow'] : ''; ?>"></span> |
|
20 | 20 | </div> |
21 | 21 | </div> |
22 | 22 | </div> |
23 | 23 | |
24 | 24 | <div> |
25 | 25 | <div class="wps-form-group"> |
26 | - <label><?php _e( 'First button text color', 'wpshop'); ?> :</label> |
|
26 | + <label><?php _e('First button text color', 'wpshop'); ?> :</label> |
|
27 | 27 | <div class="wps-form"> |
28 | - <input type="text" name="wpshop_customize_display_option[first][text]" id="wpshop_customize_display_option_first_text" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['text']) ) ? $wpshop_customize_display_option['first']['text'] : ''; ?>"/> |
|
29 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['text']) ) ? $wpshop_customize_display_option['first']['text'] : ''; ?>"></span> |
|
28 | + <input type="text" name="wpshop_customize_display_option[first][text]" id="wpshop_customize_display_option_first_text" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['text'])) ? $wpshop_customize_display_option['first']['text'] : ''; ?>"/> |
|
29 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['text'])) ? $wpshop_customize_display_option['first']['text'] : ''; ?>"></span> |
|
30 | 30 | </div> |
31 | 31 | </div> |
32 | 32 | </div> |
@@ -36,28 +36,28 @@ discard block |
||
36 | 36 | <div class="wps-gridwrapper3-padded"> |
37 | 37 | <div> |
38 | 38 | <div class="wps-form-group"> |
39 | - <label><?php _e( 'First button background color on hover action', 'wpshop'); ?> :</label> |
|
39 | + <label><?php _e('First button background color on hover action', 'wpshop'); ?> :</label> |
|
40 | 40 | <div class="wps-form"> |
41 | - <input type="text" name="wpshop_customize_display_option[first][background_hover]" id="wpshop_customize_display_option_first_hover_background" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['background_hover']) ) ? $wpshop_customize_display_option['first']['background_hover'] : ''; ?>" /> |
|
42 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['background_hover']) ) ? $wpshop_customize_display_option['first']['background_hover'] : ''; ?>"></span> |
|
41 | + <input type="text" name="wpshop_customize_display_option[first][background_hover]" id="wpshop_customize_display_option_first_hover_background" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['background_hover'])) ? $wpshop_customize_display_option['first']['background_hover'] : ''; ?>" /> |
|
42 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['background_hover'])) ? $wpshop_customize_display_option['first']['background_hover'] : ''; ?>"></span> |
|
43 | 43 | </div> |
44 | 44 | </div> |
45 | 45 | </div> |
46 | 46 | |
47 | 47 | <div> |
48 | 48 | <div class="wps-form-group"> |
49 | - <label><?php _e( 'First button shadow color on hover action', 'wpshop'); ?> :</label> |
|
50 | - <div class="wps-form"><input type="text" name="wpshop_customize_display_option[first][shadow_hover]" id="wpshop_customize_display_option_first_hover_shadow" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['shadow_hover']) ) ? $wpshop_customize_display_option['first']['shadow_hover'] : ''; ?>" /> |
|
51 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['shadow_hover']) ) ? $wpshop_customize_display_option['first']['shadow_hover'] : ''; ?>"></span> |
|
49 | + <label><?php _e('First button shadow color on hover action', 'wpshop'); ?> :</label> |
|
50 | + <div class="wps-form"><input type="text" name="wpshop_customize_display_option[first][shadow_hover]" id="wpshop_customize_display_option_first_hover_shadow" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['shadow_hover'])) ? $wpshop_customize_display_option['first']['shadow_hover'] : ''; ?>" /> |
|
51 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['shadow_hover'])) ? $wpshop_customize_display_option['first']['shadow_hover'] : ''; ?>"></span> |
|
52 | 52 | </div> |
53 | 53 | </div> |
54 | 54 | </div> |
55 | 55 | |
56 | 56 | <div> |
57 | 57 | <div class="wps-form-group"> |
58 | - <label><?php _e( 'First button text color on hover action', 'wpshop'); ?> :</label> |
|
59 | - <div class="wps-form"><input type="text" name="wpshop_customize_display_option[first][text_hover]" id="wpshop_customize_display_option_first_hover_text" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['text_hover']) ) ? $wpshop_customize_display_option['first']['text_hover'] : ''; ?>" /> |
|
60 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['text_hover']) ) ? $wpshop_customize_display_option['first']['text_hover'] : ''; ?>"></span> |
|
58 | + <label><?php _e('First button text color on hover action', 'wpshop'); ?> :</label> |
|
59 | + <div class="wps-form"><input type="text" name="wpshop_customize_display_option[first][text_hover]" id="wpshop_customize_display_option_first_hover_text" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['text_hover'])) ? $wpshop_customize_display_option['first']['text_hover'] : ''; ?>" /> |
|
60 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['first']) && !empty($wpshop_customize_display_option['first']['text_hover'])) ? $wpshop_customize_display_option['first']['text_hover'] : ''; ?>"></span> |
|
61 | 61 | </div> |
62 | 62 | </div> |
63 | 63 | </div> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,30 +1,30 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-gridwrapper3-padded"> |
4 | 4 | <div> |
5 | 5 | <div class="wps-form-group"> |
6 | - <label><?php _e( 'Shipping mode list element background', 'wpshop'); ?> :</label> |
|
6 | + <label><?php _e('Shipping mode list element background', 'wpshop'); ?> :</label> |
|
7 | 7 | <div class="wps-form"> |
8 | - <input type="text" name="wpshop_customize_display_option[shipping][background]" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['shipping']['background']) ) ? $wpshop_customize_display_option['shipping']['background'] : ''; ?>" /></div> |
|
9 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['shipping']['background']) ) ? $wpshop_customize_display_option['shipping']['background'] : ''; ?>" /></span> |
|
8 | + <input type="text" name="wpshop_customize_display_option[shipping][background]" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['shipping']['background'])) ? $wpshop_customize_display_option['shipping']['background'] : ''; ?>" /></div> |
|
9 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['shipping']['background'])) ? $wpshop_customize_display_option['shipping']['background'] : ''; ?>" /></span> |
|
10 | 10 | </div> |
11 | 11 | </div> |
12 | 12 | |
13 | 13 | <div> |
14 | 14 | <div class="wps-form-group"> |
15 | - <label><?php _e( 'Selected shipping mode list element background', 'wpshop'); ?> :</label> |
|
15 | + <label><?php _e('Selected shipping mode list element background', 'wpshop'); ?> :</label> |
|
16 | 16 | <div class="wps-form"> |
17 | - <input type="text" name="wpshop_customize_display_option[shipping][active_element]" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['shipping']) && !empty($wpshop_customize_display_option['shipping']['active_element']) ) ? $wpshop_customize_display_option['shipping']['active_element'] : ''; ?>" /></div> |
|
18 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['shipping']) && !empty($wpshop_customize_display_option['shipping']['active_element']) ) ? $wpshop_customize_display_option['shipping']['active_element'] : ''; ?>" /></span> |
|
17 | + <input type="text" name="wpshop_customize_display_option[shipping][active_element]" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['shipping']) && !empty($wpshop_customize_display_option['shipping']['active_element'])) ? $wpshop_customize_display_option['shipping']['active_element'] : ''; ?>" /></div> |
|
18 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['shipping']) && !empty($wpshop_customize_display_option['shipping']['active_element'])) ? $wpshop_customize_display_option['shipping']['active_element'] : ''; ?>" /></span> |
|
19 | 19 | </div> |
20 | 20 | </div> |
21 | 21 | |
22 | 22 | <div> |
23 | 23 | <div class="wps-form-group"> |
24 | - <label><?php _e( 'Shipping mode list element text color', 'wpshop'); ?> :</label> |
|
24 | + <label><?php _e('Shipping mode list element text color', 'wpshop'); ?> :</label> |
|
25 | 25 | <div class="wps-form"> |
26 | - <input type="text" name="wpshop_customize_display_option[shipping][text]" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['shipping']) && !empty($wpshop_customize_display_option['shipping']['text']) ) ? $wpshop_customize_display_option['shipping']['text'] : ''; ?>"/></div> |
|
27 | - <span style="display : inline-block; width : 20px; height : 20px; background :<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['shipping']) && !empty($wpshop_customize_display_option['shipping']['text']) ) ? $wpshop_customize_display_option['shipping']['text'] : ''; ?>" /></span> |
|
26 | + <input type="text" name="wpshop_customize_display_option[shipping][text]" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['shipping']) && !empty($wpshop_customize_display_option['shipping']['text'])) ? $wpshop_customize_display_option['shipping']['text'] : ''; ?>"/></div> |
|
27 | + <span style="display : inline-block; width : 20px; height : 20px; background :<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['shipping']) && !empty($wpshop_customize_display_option['shipping']['text'])) ? $wpshop_customize_display_option['shipping']['text'] : ''; ?>" /></span> |
|
28 | 28 | </div> |
29 | 29 | </div> |
30 | 30 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | - if(current_user_can('wpshop_edit_options') ) : ?> |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | + if (current_user_can('wpshop_edit_options')) : ?> |
|
3 | 3 | <?php |
4 | 4 | $value = ($wpshop_display_option[$field_identifier] <= 0 ? WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MIN_RANGE : $wpshop_display_option[$field_identifier]); |
5 | 5 | ?> |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | wpshop(document).ready(function(){ |
11 | 11 | jQuery('#<?php echo $field_identifier ?>slider').slider({ |
12 | 12 | value : <?php echo $value; ?>, |
13 | - min: <?php echo WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MIN_RANGE ; ?>, |
|
14 | - max: <?php echo WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MAX_RANGE ; ?>, |
|
13 | + min: <?php echo WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MIN_RANGE; ?>, |
|
14 | + max: <?php echo WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MAX_RANGE; ?>, |
|
15 | 15 | range: "min", |
16 | 16 | step: 1, |
17 | 17 | slide: function(event, ui) { |
@@ -27,5 +27,5 @@ discard block |
||
27 | 27 | <?php else : |
28 | 28 | $option_field_output = $wpshop_display_option[$field_identifier]; |
29 | 29 | endif; ?> |
30 | -<a href="#" title="<?php _e('Number of products displayed per line when grid display mode is active','wpshop'); ?>" class="wpshop_infobulle_marker">?</a> |
|
30 | +<a href="#" title="<?php _e('Number of products displayed per line when grid display mode is active', 'wpshop'); ?>" class="wpshop_infobulle_marker">?</a> |
|
31 | 31 | |
32 | 32 | \ No newline at end of file |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | if(current_user_can('wpshop_edit_options') ) : ?> |
3 | 5 | <?php |
4 | 6 | $value = ($wpshop_display_option[$field_identifier] <= 0 ? WPSHOP_DISPLAY_GRID_ELEMENT_NUMBER_PER_LINE_MIN_RANGE : $wpshop_display_option[$field_identifier]); |
@@ -24,8 +26,10 @@ discard block |
||
24 | 26 | }); |
25 | 27 | </script> |
26 | 28 | |
27 | -<?php else : |
|
29 | +<?php else { |
|
30 | + : |
|
28 | 31 | $option_field_output = $wpshop_display_option[$field_identifier]; |
32 | +} |
|
29 | 33 | endif; ?> |
30 | 34 | <a href="#" title="<?php _e('Number of products displayed per line when grid display mode is active','wpshop'); ?>" class="wpshop_infobulle_marker">?</a> |
31 | 35 | |
32 | 36 | \ No newline at end of file |
@@ -1,30 +1,30 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-gridwrapper3-padded"> |
4 | 4 | <div> |
5 | 5 | <div class="wps-form-group"> |
6 | - <label><?php _e( 'Second button background color', 'wpshop'); ?> :</label> |
|
6 | + <label><?php _e('Second button background color', 'wpshop'); ?> :</label> |
|
7 | 7 | <div class="wps-form"> |
8 | - <input type="text" name="wpshop_customize_display_option[second][background]" id="wpshop_customize_display_option_second_background" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['background']) ) ? $wpshop_customize_display_option['second']['background'] : ''; ?>" /></div> |
|
9 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['activ_element_background']) ) ? $wpshop_customize_display_option['account']['activ_element_background'] : ''; ?>"></span> |
|
8 | + <input type="text" name="wpshop_customize_display_option[second][background]" id="wpshop_customize_display_option_second_background" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['background'])) ? $wpshop_customize_display_option['second']['background'] : ''; ?>" /></div> |
|
9 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['activ_element_background'])) ? $wpshop_customize_display_option['account']['activ_element_background'] : ''; ?>"></span> |
|
10 | 10 | </div> |
11 | 11 | </div> |
12 | 12 | |
13 | 13 | <div> |
14 | 14 | <div class="wps-form-group"> |
15 | - <label><?php _e( 'Second button shadow color', 'wpshop'); ?> :</label> |
|
15 | + <label><?php _e('Second button shadow color', 'wpshop'); ?> :</label> |
|
16 | 16 | <div class="wps-form"> |
17 | - <input type="text" name="wpshop_customize_display_option[second][shadow]" id="wpshop_customize_display_option_second_shadow" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['shadow']) ) ? $wpshop_customize_display_option['second']['shadow'] : ''; ?>" /></div> |
|
18 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['shadow']) ) ? $wpshop_customize_display_option['second']['shadow'] : ''; ?>" /></span> |
|
17 | + <input type="text" name="wpshop_customize_display_option[second][shadow]" id="wpshop_customize_display_option_second_shadow" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['shadow'])) ? $wpshop_customize_display_option['second']['shadow'] : ''; ?>" /></div> |
|
18 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['shadow'])) ? $wpshop_customize_display_option['second']['shadow'] : ''; ?>" /></span> |
|
19 | 19 | </div> |
20 | 20 | </div> |
21 | 21 | |
22 | 22 | <div> |
23 | 23 | <div class="wps-form-group"> |
24 | - <label><?php _e( 'Second button text color', 'wpshop'); ?> :</label> |
|
24 | + <label><?php _e('Second button text color', 'wpshop'); ?> :</label> |
|
25 | 25 | <div class="wps-form"> |
26 | - <input type="text" name="wpshop_customize_display_option[second][text]" id="wpshop_customize_display_option_second_text" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['text']) ) ? $wpshop_customize_display_option['second']['text'] : ''; ?>"/></div> |
|
27 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['text']) ) ? $wpshop_customize_display_option['second']['text'] : ''; ?>" /></span> |
|
26 | + <input type="text" name="wpshop_customize_display_option[second][text]" id="wpshop_customize_display_option_second_text" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['text'])) ? $wpshop_customize_display_option['second']['text'] : ''; ?>"/></div> |
|
27 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['text'])) ? $wpshop_customize_display_option['second']['text'] : ''; ?>" /></span> |
|
28 | 28 | </div> |
29 | 29 | </div> |
30 | 30 | |
@@ -33,28 +33,28 @@ discard block |
||
33 | 33 | <div class="wps-gridwrapper3-padded"> |
34 | 34 | <div> |
35 | 35 | <div class="wps-form-group"> |
36 | - <label><?php _e( 'Second button background color on hover action', 'wpshop'); ?> :</label> |
|
36 | + <label><?php _e('Second button background color on hover action', 'wpshop'); ?> :</label> |
|
37 | 37 | <div class="wps-form"> |
38 | - <input type="text" name="wpshop_customize_display_option[second][background_hover]" id="wpshop_customize_display_option_second_hover_background" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['background_hover']) ) ? $wpshop_customize_display_option['second']['background_hover'] : ''; ?>" /></div> |
|
39 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['background_hover']) ) ? $wpshop_customize_display_option['second']['background_hover'] : ''; ?>" /></span> |
|
38 | + <input type="text" name="wpshop_customize_display_option[second][background_hover]" id="wpshop_customize_display_option_second_hover_background" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['background_hover'])) ? $wpshop_customize_display_option['second']['background_hover'] : ''; ?>" /></div> |
|
39 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['background_hover'])) ? $wpshop_customize_display_option['second']['background_hover'] : ''; ?>" /></span> |
|
40 | 40 | </div> |
41 | 41 | </div> |
42 | 42 | |
43 | 43 | <div> |
44 | 44 | <div class="wps-form-group"> |
45 | - <label><?php _e( 'Second button shadow color on hover action', 'wpshop'); ?> :</label> |
|
45 | + <label><?php _e('Second button shadow color on hover action', 'wpshop'); ?> :</label> |
|
46 | 46 | <div class="wps-form"> |
47 | - <input type="text" name="wpshop_customize_display_option[second][shadow_hover]" id="wpshop_customize_display_option_second_hover_shadow" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['shadow_hover']) ) ? $wpshop_customize_display_option['second']['shadow_hover'] : ''; ?>" /></div> |
|
48 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['shadow_hover']) ) ? $wpshop_customize_display_option['second']['shadow_hover'] : ''; ?>" /></span> |
|
47 | + <input type="text" name="wpshop_customize_display_option[second][shadow_hover]" id="wpshop_customize_display_option_second_hover_shadow" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['shadow_hover'])) ? $wpshop_customize_display_option['second']['shadow_hover'] : ''; ?>" /></div> |
|
48 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['shadow_hover'])) ? $wpshop_customize_display_option['second']['shadow_hover'] : ''; ?>" /></span> |
|
49 | 49 | </div> |
50 | 50 | </div> |
51 | 51 | |
52 | 52 | <div> |
53 | 53 | <div class="wps-form-group"> |
54 | - <label><?php _e( 'Second button text color on hover action', 'wpshop'); ?> :</label> |
|
54 | + <label><?php _e('Second button text color on hover action', 'wpshop'); ?> :</label> |
|
55 | 55 | <div class="wps-form"> |
56 | - <input type="text" name="wpshop_customize_display_option[second][text_hover]" id="wpshop_customize_display_option_second_hover_text" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['text_hover']) ) ? $wpshop_customize_display_option['second']['text_hover'] : ''; ?>" /></div> |
|
57 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['text_hover']) ) ? $wpshop_customize_display_option['second']['text_hover'] : ''; ?>" /></span> |
|
56 | + <input type="text" name="wpshop_customize_display_option[second][text_hover]" id="wpshop_customize_display_option_second_hover_text" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['text_hover'])) ? $wpshop_customize_display_option['second']['text_hover'] : ''; ?>" /></div> |
|
57 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['second']) && !empty($wpshop_customize_display_option['second']['text_hover'])) ? $wpshop_customize_display_option['second']['text_hover'] : ''; ?>" /></span> |
|
58 | 58 | </div> |
59 | 59 | </div> |
60 | 60 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,22 +1,22 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-gridwrapper3-padded"> |
4 | 4 | <div> |
5 | 5 | <div class="wps-form-group"> |
6 | - <label><?php _e( 'Selected part element background', 'wpshop'); ?> :</label> |
|
6 | + <label><?php _e('Selected part element background', 'wpshop'); ?> :</label> |
|
7 | 7 | <div class="wps-form"> |
8 | - <input type="text" name="wpshop_customize_display_option[account][activ_element_background]" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['activ_element_background']) ) ? $wpshop_customize_display_option['account']['activ_element_background'] : ''; ?>" /> |
|
9 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['activ_element_background']) ) ? $wpshop_customize_display_option['account']['activ_element_background'] : ''; ?>"></span> |
|
8 | + <input type="text" name="wpshop_customize_display_option[account][activ_element_background]" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['activ_element_background'])) ? $wpshop_customize_display_option['account']['activ_element_background'] : ''; ?>" /> |
|
9 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['activ_element_background'])) ? $wpshop_customize_display_option['account']['activ_element_background'] : ''; ?>"></span> |
|
10 | 10 | </div> |
11 | 11 | </div> |
12 | 12 | </div> |
13 | 13 | |
14 | 14 | <div> |
15 | 15 | <div class="wps-form-group"> |
16 | - <label><?php _e( 'Information box background color', 'wpshop'); ?> :</label> |
|
16 | + <label><?php _e('Information box background color', 'wpshop'); ?> :</label> |
|
17 | 17 | <div class="wps-form"> |
18 | - <input type="text" name="wpshop_customize_display_option[account][information_box_background]" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['information_box_background']) ) ? $wpshop_customize_display_option['account']['information_box_background'] : ''; ?>" /> |
|
19 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['information_box_background']) ) ? $wpshop_customize_display_option['account']['information_box_background'] : ''; ?>"></span> |
|
18 | + <input type="text" name="wpshop_customize_display_option[account][information_box_background]" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['information_box_background'])) ? $wpshop_customize_display_option['account']['information_box_background'] : ''; ?>" /> |
|
19 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['information_box_background'])) ? $wpshop_customize_display_option['account']['information_box_background'] : ''; ?>"></span> |
|
20 | 20 | |
21 | 21 | </div> |
22 | 22 | </div> |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | |
25 | 25 | <div> |
26 | 26 | <div class="wps-form-group"> |
27 | - <label><?php _e( 'Unselected part element background', 'wpshop'); ?> :</label> |
|
27 | + <label><?php _e('Unselected part element background', 'wpshop'); ?> :</label> |
|
28 | 28 | <div class="wps-form"> |
29 | - <input type="text" name="wpshop_customize_display_option[account][part_background]" class="wps-color-picker-field" value="<?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['part_background']) ) ? $wpshop_customize_display_option['account']['part_background'] : ''; ?>"/> |
|
30 | - <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo ( !empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['part_background']) ) ? $wpshop_customize_display_option['account']['part_background'] : ''; ?>"></span> |
|
29 | + <input type="text" name="wpshop_customize_display_option[account][part_background]" class="wps-color-picker-field" value="<?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['part_background'])) ? $wpshop_customize_display_option['account']['part_background'] : ''; ?>"/> |
|
30 | + <span style="display : inline-block; width : 20px; height : 20px; background : <?php echo (!empty($wpshop_customize_display_option) && !empty($wpshop_customize_display_option['account']) && !empty($wpshop_customize_display_option['account']['part_background'])) ? $wpshop_customize_display_option['account']['part_background'] : ''; ?>"></span> |
|
31 | 31 | |
32 | 32 | </div> |
33 | 33 | </div> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * Bootstrap file |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | DEFINE('WPS_COUPON_DIR', basename(dirname(__FILE__))); |
10 | -DEFINE('WPS_COUPON_PATH', str_replace( "\\", "/", str_replace( WPS_COUPON_DIR, "", dirname( __FILE__ ) ) ) ); |
|
11 | -DEFINE('WPS_COUPON_URL', str_replace( str_replace( "\\", "/", ABSPATH), site_url() . '/', WPS_COUPON_PATH ) ); |
|
10 | +DEFINE('WPS_COUPON_PATH', str_replace("\\", "/", str_replace(WPS_COUPON_DIR, "", dirname(__FILE__)))); |
|
11 | +DEFINE('WPS_COUPON_URL', str_replace(str_replace("\\", "/", ABSPATH), site_url() . '/', WPS_COUPON_PATH)); |
|
12 | 12 | |
13 | 13 | |
14 | -include( plugin_dir_path( __FILE__ ).'/controller/wps_coupon_ctr.php' ); |
|
15 | -include( plugin_dir_path( __FILE__ ).'/model/wps_coupon_model.php' ); |
|
14 | +include(plugin_dir_path(__FILE__) . '/controller/wps_coupon_ctr.php'); |
|
15 | +include(plugin_dir_path(__FILE__) . '/model/wps_coupon_model.php'); |
|
16 | 16 | $wps_coupon = new wps_coupon_ctr(); |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | class wps_coupon_ctr { |
3 | 5 | /** Define the main directory containing the template for the current plugin |
4 | 6 | * @var string |
@@ -188,8 +190,7 @@ discard block |
||
188 | 190 | if ( in_array($current_user_id, $coupon_individual_usage) ) { |
189 | 191 | $individual_usage = true; |
190 | 192 | } |
191 | - } |
|
192 | - else { |
|
193 | + } else { |
|
193 | 194 | $individual_usage = true; |
194 | 195 | } |
195 | 196 | |
@@ -200,16 +201,13 @@ discard block |
||
200 | 201 | |
201 | 202 | if( ( !empty($coupon_usage) && array_key_exists($current_user_id, $coupon_usage) ) || empty($coupon_usage ) || empty($coupon_usage[$current_user_id]) ) { |
202 | 203 | $usage_limit = ( ( !empty($coupon_usage_limit) && $coupon_usage[$current_user_id] < $coupon_usage_limit) || empty($coupon_usage) || empty($coupon_usage[$current_user_id]) ) ? true : false; |
203 | - } |
|
204 | - elseif( empty($coupon_usage) ) { |
|
204 | + } elseif( empty($coupon_usage) ) { |
|
205 | 205 | $usage_limit = true; |
206 | 206 | } |
207 | - } |
|
208 | - else { |
|
207 | + } else { |
|
209 | 208 | $usage_limit = true; |
210 | 209 | } |
211 | - } |
|
212 | - else { |
|
210 | + } else { |
|
213 | 211 | return array('status' => false, 'message' => __('You are not allowed to use this coupon','wpshop')); |
214 | 212 | } |
215 | 213 | |
@@ -224,9 +222,7 @@ discard block |
||
224 | 222 | if ( !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'shipping_cost' && $_SESSION['cart']['order_grand_total_before_discount'] < $coupon_order_amount_mini['amount'] ) { |
225 | 223 | $coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ','wpshop').' '.$coupon_order_amount_mini['amount'].' '.$default_currency ); |
226 | 224 | $order_amount_limit = false; |
227 | - } |
|
228 | - |
|
229 | - elseif( !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'no_shipping_cost' && $_SESSION['cart']['order_total_ttc'] < $coupon_order_amount_mini['amount'] ) { |
|
225 | + } elseif( !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'no_shipping_cost' && $_SESSION['cart']['order_total_ttc'] < $coupon_order_amount_mini['amount'] ) { |
|
230 | 226 | $coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ','wpshop').' '.$coupon_order_amount_mini['amount'].' '.$default_currency.' '.__('without shipping cost', 'wpshop') ); |
231 | 227 | $order_amount_limit = false; |
232 | 228 | } |
@@ -236,18 +232,15 @@ discard block |
||
236 | 232 | $_SESSION['cart']['coupon_id'] = $result->post_id; |
237 | 233 | $coupon_infos = array('status' => true, 'message' => ''); |
238 | 234 | } |
239 | - } |
|
240 | - else { |
|
235 | + } else { |
|
241 | 236 | $coupon_infos = array('status' => false, 'message' => __('You are not allowed to use this coupon','wpshop') ); |
242 | 237 | } |
243 | 238 | |
244 | - } |
|
245 | - else { |
|
239 | + } else { |
|
246 | 240 | $coupon_infos = array('status' => false, 'message' => __('This coupon is not valid','wpshop')); |
247 | 241 | } |
248 | 242 | |
249 | - } |
|
250 | - else { |
|
243 | + } else { |
|
251 | 244 | $coupon_infos = array('status' => false, 'message' => __('This coupon doesn`t exist','wpshop')); |
252 | 245 | } |
253 | 246 | return $coupon_infos; |
@@ -286,8 +279,7 @@ discard block |
||
286 | 279 | $output .= ob_get_contents(); |
287 | 280 | ob_end_clean(); |
288 | 281 | |
289 | - } |
|
290 | - else { |
|
282 | + } else { |
|
291 | 283 | $output = '<div class="wps-alert-info">' .__( 'Sorry ! No available coupon', 'wpshop' ) .'</div>'; |
292 | 284 | } |
293 | 285 | return $output; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | class wps_coupon_ctr { |
3 | 3 | /** Define the main directory containing the template for the current plugin |
4 | 4 | * @var string |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | |
13 | 13 | function __construct() { |
14 | 14 | $this->template_dir = WPS_COUPON_PATH . WPS_COUPON_DIR . "/templates/"; |
15 | - add_shortcode( 'wps_coupon', array($this, 'display_coupons') ); |
|
15 | + add_shortcode('wps_coupon', array($this, 'display_coupons')); |
|
16 | 16 | |
17 | 17 | $wpshop_shop_type = get_option('wpshop_shop_type', WPSHOP_DEFAULT_SHOP_TYPE); |
18 | - if ( $wpshop_shop_type == 'sale' ) { |
|
19 | - add_action( 'init', array( $this, 'create_coupon_custom_type' ) ); |
|
20 | - add_action('add_meta_boxes', array( $this, 'add_meta_boxes') ); |
|
21 | - add_action('manage_'.WPSHOP_NEWTYPE_IDENTIFIER_COUPON.'_posts_custom_column', array( $this, 'wps_coupons_custom_columns')); |
|
22 | - add_filter('manage_edit-'.WPSHOP_NEWTYPE_IDENTIFIER_COUPON.'_columns', array( $this, 'wps_coupons_edit_columns')); |
|
18 | + if ($wpshop_shop_type == 'sale') { |
|
19 | + add_action('init', array($this, 'create_coupon_custom_type')); |
|
20 | + add_action('add_meta_boxes', array($this, 'add_meta_boxes')); |
|
21 | + add_action('manage_' . WPSHOP_NEWTYPE_IDENTIFIER_COUPON . '_posts_custom_column', array($this, 'wps_coupons_custom_columns')); |
|
22 | + add_filter('manage_edit-' . WPSHOP_NEWTYPE_IDENTIFIER_COUPON . '_columns', array($this, 'wps_coupons_edit_columns')); |
|
23 | 23 | add_action('save_post', array($this, 'save_coupon_custom_informations')); |
24 | 24 | } |
25 | 25 | } |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | 'capability_type' => 'post', |
51 | 51 | 'publicly_queryable' => false, |
52 | 52 | 'exclude_from_search' => true, |
53 | - 'show_in_menu' => 'edit.php?post_type='.WPSHOP_NEWTYPE_IDENTIFIER_ORDER, |
|
53 | + 'show_in_menu' => 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER, |
|
54 | 54 | 'show_in_admin_bar' => false, |
55 | 55 | 'hierarchical' => false, |
56 | 56 | 'show_in_nav_menus' => false, |
57 | 57 | 'rewrite' => false, |
58 | 58 | 'query_var' => true, |
59 | - 'supports' => array('title','editor'), |
|
59 | + 'supports' => array('title', 'editor'), |
|
60 | 60 | 'has_archive' => false |
61 | 61 | )); |
62 | 62 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * Add Meta box to Coupon cutom post type |
66 | 66 | */ |
67 | 67 | function add_meta_boxes() { |
68 | - add_meta_box('wpshop_coupon_main_info', __('Informations', 'wpshop'), array( $this, 'wps_coupon_info_box'), WPSHOP_NEWTYPE_IDENTIFIER_COUPON, 'normal', 'high'); |
|
68 | + add_meta_box('wpshop_coupon_main_info', __('Informations', 'wpshop'), array($this, 'wps_coupon_info_box'), WPSHOP_NEWTYPE_IDENTIFIER_COUPON, 'normal', 'high'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | function wps_coupon_info_box() { |
75 | 75 | $output = ''; |
76 | - $default_currency = wpshop_tools::wpshop_get_currency( false ); |
|
76 | + $default_currency = wpshop_tools::wpshop_get_currency(false); |
|
77 | 77 | // Coupon Datas |
78 | 78 | $metadata = get_post_custom(); |
79 | 79 | $coupon_code = !empty($metadata['wpshop_coupon_code'][0]) ? $metadata['wpshop_coupon_code'][0] : null; |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | $coupon_receiver = !empty($metadata['wpshop_coupon_individual_use'][0]) ? unserialize($metadata['wpshop_coupon_individual_use'][0]) : array(); |
84 | 84 | $coupon_limit_usage = !empty($metadata['wpshop_coupon_usage_limit'][0]) ? $metadata['wpshop_coupon_usage_limit'][0] : ''; |
85 | 85 | |
86 | - $wpshop_coupon_minimum_amount = ( !empty($metadata['wpshop_coupon_minimum_amount'][0]) ) ? $metadata['wpshop_coupon_minimum_amount'][0] : ''; |
|
87 | - $wpshop_coupon_minimum_amount = unserialize( $wpshop_coupon_minimum_amount ); |
|
86 | + $wpshop_coupon_minimum_amount = (!empty($metadata['wpshop_coupon_minimum_amount'][0])) ? $metadata['wpshop_coupon_minimum_amount'][0] : ''; |
|
87 | + $wpshop_coupon_minimum_amount = unserialize($wpshop_coupon_minimum_amount); |
|
88 | 88 | ob_start(); |
89 | - require( wpshop_tools::get_template_part( WPS_COUPON_DIR, $this->template_dir, "backend", "coupon-metabox") ); |
|
89 | + require(wpshop_tools::get_template_part(WPS_COUPON_DIR, $this->template_dir, "backend", "coupon-metabox")); |
|
90 | 90 | $output = ob_get_contents(); |
91 | 91 | ob_end_clean(); |
92 | 92 | |
@@ -96,18 +96,18 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * Add custom columns to coupons list in administration |
98 | 98 | */ |
99 | - function wps_coupons_custom_columns( $column ) { |
|
99 | + function wps_coupons_custom_columns($column) { |
|
100 | 100 | global $post; |
101 | 101 | |
102 | 102 | $metadata = get_post_custom(); |
103 | 103 | $wpshop_coupon_discount_type = !empty($metadata['wpshop_coupon_discount_type'][0]) ? $metadata['wpshop_coupon_discount_type'][0] : null; |
104 | - switch( $column ){ |
|
104 | + switch ($column) { |
|
105 | 105 | case "coupon_code": |
106 | 106 | echo $metadata['wpshop_coupon_code'][0]; |
107 | 107 | break; |
108 | 108 | case "coupon_discount_amount": |
109 | - $currency = wpshop_tools::wpshop_get_currency( false ); |
|
110 | - echo $metadata['wpshop_coupon_discount_value'][0].' '.( (!empty($wpshop_coupon_discount_type) && $wpshop_coupon_discount_type == 'percent') ? '%' : $currency) ; |
|
109 | + $currency = wpshop_tools::wpshop_get_currency(false); |
|
110 | + echo $metadata['wpshop_coupon_discount_value'][0] . ' ' . ((!empty($wpshop_coupon_discount_type) && $wpshop_coupon_discount_type == 'percent') ? '%' : $currency); |
|
111 | 111 | break; |
112 | 112 | } |
113 | 113 | } |
@@ -131,20 +131,20 @@ discard block |
||
131 | 131 | * @TODO REQUEST |
132 | 132 | */ |
133 | 133 | function save_coupon_custom_informations() { |
134 | - $post_ID = !empty( $_REQUEST['post_ID'] ) ? (int) $_REQUEST['post_ID'] : 0; |
|
135 | - if( !empty($post_ID) && (get_post_type($post_ID) == WPSHOP_NEWTYPE_IDENTIFIER_COUPON) ) { |
|
134 | + $post_ID = !empty($_REQUEST['post_ID']) ? (int)$_REQUEST['post_ID'] : 0; |
|
135 | + if (!empty($post_ID) && (get_post_type($post_ID) == WPSHOP_NEWTYPE_IDENTIFIER_COUPON)) { |
|
136 | 136 | $wps_coupon_mdl = new wps_coupon_model(); |
137 | 137 | |
138 | 138 | $data = array( |
139 | - 'wpshop_coupon_mini_amount' => !empty( $_REQUEST['wpshop_coupon_mini_amount'] ) ? sanitize_text_field( $_REQUEST['wpshop_coupon_mini_amount'] ) : '', |
|
140 | - 'wpshop_coupon_min_mount_shipping_rule' => !empty( $_REQUEST['wpshop_coupon_min_mount_shipping_rule'] ) ? sanitize_text_field( $_REQUEST['wpshop_coupon_min_mount_shipping_rule'] ) : '', |
|
141 | - 'coupon_code' => !empty( $_REQUEST['coupon_code'] ) ? sanitize_text_field( $_REQUEST['coupon_code'] ) : '', |
|
142 | - 'coupon_discount_amount' => !empty( $_REQUEST['coupon_discount_amount'] ) ? sanitize_text_field( $_REQUEST['coupon_discount_amount'] ) : '', |
|
143 | - 'wpshop_coupon_discount_type' => !empty( $_REQUEST['wpshop_coupon_discount_type'] ) ? sanitize_text_field( $_REQUEST['wpshop_coupon_discount_type'] ) : '', |
|
144 | - 'coupon_receiver' => !empty( $_REQUEST['coupon_receiver'] ) ? sanitize_text_field( $_REQUEST['coupon_receiver'] ) : '', |
|
145 | - 'coupon_usage_limit' => !empty( $_REQUEST['coupon_usage_limit'] ) ? sanitize_text_field( $_REQUEST['coupon_usage_limit'] ) : '', |
|
139 | + 'wpshop_coupon_mini_amount' => !empty($_REQUEST['wpshop_coupon_mini_amount']) ? sanitize_text_field($_REQUEST['wpshop_coupon_mini_amount']) : '', |
|
140 | + 'wpshop_coupon_min_mount_shipping_rule' => !empty($_REQUEST['wpshop_coupon_min_mount_shipping_rule']) ? sanitize_text_field($_REQUEST['wpshop_coupon_min_mount_shipping_rule']) : '', |
|
141 | + 'coupon_code' => !empty($_REQUEST['coupon_code']) ? sanitize_text_field($_REQUEST['coupon_code']) : '', |
|
142 | + 'coupon_discount_amount' => !empty($_REQUEST['coupon_discount_amount']) ? sanitize_text_field($_REQUEST['coupon_discount_amount']) : '', |
|
143 | + 'wpshop_coupon_discount_type' => !empty($_REQUEST['wpshop_coupon_discount_type']) ? sanitize_text_field($_REQUEST['wpshop_coupon_discount_type']) : '', |
|
144 | + 'coupon_receiver' => !empty($_REQUEST['coupon_receiver']) ? sanitize_text_field($_REQUEST['coupon_receiver']) : '', |
|
145 | + 'coupon_usage_limit' => !empty($_REQUEST['coupon_usage_limit']) ? sanitize_text_field($_REQUEST['coupon_usage_limit']) : '', |
|
146 | 146 | ); |
147 | - $wps_coupon_mdl->save_coupons_informations( $data ); |
|
147 | + $wps_coupon_mdl->save_coupons_informations($data); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
@@ -153,19 +153,19 @@ discard block |
||
153 | 153 | * @param string $code |
154 | 154 | * @return array |
155 | 155 | */ |
156 | - function applyCoupon( $code ) { |
|
156 | + function applyCoupon($code) { |
|
157 | 157 | global $wpdb, $wpshop_cart; |
158 | 158 | |
159 | 159 | /** Default currency **/ |
160 | - $default_currency = wpshop_tools::wpshop_get_currency( false ); |
|
160 | + $default_currency = wpshop_tools::wpshop_get_currency(false); |
|
161 | 161 | |
162 | 162 | $coupon_infos = array(); |
163 | 163 | |
164 | 164 | /** Coupon infos **/ |
165 | 165 | $query = $wpdb->prepare(' |
166 | 166 | SELECT META.post_id |
167 | - FROM '.$wpdb->prefix.'postmeta META |
|
168 | - LEFT JOIN '.$wpdb->prefix.'posts POSTS ON POSTS.ID = META.post_id |
|
167 | + FROM '.$wpdb->prefix . 'postmeta META |
|
168 | + LEFT JOIN '.$wpdb->prefix . 'posts POSTS ON POSTS.ID = META.post_id |
|
169 | 169 | WHERE |
170 | 170 | POSTS.post_type = %s AND |
171 | 171 | META.meta_key = "wpshop_coupon_code" AND |
@@ -174,29 +174,29 @@ discard block |
||
174 | 174 | ', WPSHOP_NEWTYPE_IDENTIFIER_COUPON, $code, 'publish'); |
175 | 175 | $result = $wpdb->get_row($query); |
176 | 176 | |
177 | - if ( !empty($result) ) { |
|
178 | - $coupon_amount = get_post_meta( $result->post_id, 'wpshop_coupon_discount_value', true ); |
|
177 | + if (!empty($result)) { |
|
178 | + $coupon_amount = get_post_meta($result->post_id, 'wpshop_coupon_discount_value', true); |
|
179 | 179 | |
180 | - if ( !empty($coupon_amount) && $coupon_amount > 0) { |
|
181 | - $coupon_usage = get_post_meta( $result->post_id, '_wpshop_coupon_usage', true ); |
|
182 | - $coupon_usage_limit = get_post_meta( $result->post_id, 'wpshop_coupon_usage_limit', true ); |
|
183 | - $coupon_individual_usage = get_post_meta( $result->post_id, 'wpshop_coupon_individual_use', true ); |
|
180 | + if (!empty($coupon_amount) && $coupon_amount > 0) { |
|
181 | + $coupon_usage = get_post_meta($result->post_id, '_wpshop_coupon_usage', true); |
|
182 | + $coupon_usage_limit = get_post_meta($result->post_id, 'wpshop_coupon_usage_limit', true); |
|
183 | + $coupon_individual_usage = get_post_meta($result->post_id, 'wpshop_coupon_individual_use', true); |
|
184 | 184 | |
185 | - $coupon_order_amount_mini = get_post_meta( $result->post_id, 'wpshop_coupon_minimum_amount', true); |
|
185 | + $coupon_order_amount_mini = get_post_meta($result->post_id, 'wpshop_coupon_minimum_amount', true); |
|
186 | 186 | |
187 | 187 | $current_user_id = get_current_user_id(); |
188 | 188 | $individual_usage = $usage_limit = false; |
189 | 189 | |
190 | 190 | |
191 | 191 | /** Checking coupon params & logged user **/ |
192 | - if ( (!empty($coupon_individual_usage) || !empty($coupon_usage_limit) ) && $current_user_id == 0) { |
|
193 | - return array('status' => false, 'message' => __('You must be logged to use this coupon','wpshop')); |
|
192 | + if ((!empty($coupon_individual_usage) || !empty($coupon_usage_limit)) && $current_user_id == 0) { |
|
193 | + return array('status' => false, 'message' => __('You must be logged to use this coupon', 'wpshop')); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** Individual use checking **/ |
197 | - if ( !empty($coupon_individual_usage) ) { |
|
197 | + if (!empty($coupon_individual_usage)) { |
|
198 | 198 | |
199 | - if ( in_array($current_user_id, $coupon_individual_usage) ) { |
|
199 | + if (in_array($current_user_id, $coupon_individual_usage)) { |
|
200 | 200 | $individual_usage = true; |
201 | 201 | } |
202 | 202 | } |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | |
208 | 208 | /** Checking Usage limitation **/ |
209 | 209 | if ($individual_usage) { |
210 | - if ( !empty($coupon_usage_limit) ) { |
|
210 | + if (!empty($coupon_usage_limit)) { |
|
211 | 211 | |
212 | - if( ( !empty($coupon_usage) && array_key_exists($current_user_id, $coupon_usage) ) || empty($coupon_usage ) || empty($coupon_usage[$current_user_id]) ) { |
|
213 | - $usage_limit = ( ( !empty($coupon_usage_limit) && $coupon_usage[$current_user_id] < $coupon_usage_limit) || empty($coupon_usage) || empty($coupon_usage[$current_user_id]) ) ? true : false; |
|
212 | + if ((!empty($coupon_usage) && array_key_exists($current_user_id, $coupon_usage)) || empty($coupon_usage) || empty($coupon_usage[$current_user_id])) { |
|
213 | + $usage_limit = ((!empty($coupon_usage_limit) && $coupon_usage[$current_user_id] < $coupon_usage_limit) || empty($coupon_usage) || empty($coupon_usage[$current_user_id])) ? true : false; |
|
214 | 214 | } |
215 | - elseif( empty($coupon_usage) ) { |
|
215 | + elseif (empty($coupon_usage)) { |
|
216 | 216 | $usage_limit = true; |
217 | 217 | } |
218 | 218 | } |
@@ -221,45 +221,45 @@ discard block |
||
221 | 221 | } |
222 | 222 | } |
223 | 223 | else { |
224 | - return array('status' => false, 'message' => __('You are not allowed to use this coupon','wpshop')); |
|
224 | + return array('status' => false, 'message' => __('You are not allowed to use this coupon', 'wpshop')); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
228 | 228 | /** Apply Coupon **/ |
229 | - if ( $usage_limit ) { |
|
229 | + if ($usage_limit) { |
|
230 | 230 | /** Check orderamount Limit **/ |
231 | 231 | $order_amount_limit = true; |
232 | 232 | |
233 | - if ( !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['amount']) ) { |
|
233 | + if (!empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['amount'])) { |
|
234 | 234 | |
235 | - if ( !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'shipping_cost' && $_SESSION['cart']['order_grand_total_before_discount'] < $coupon_order_amount_mini['amount'] ) { |
|
236 | - $coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ','wpshop').' '.$coupon_order_amount_mini['amount'].' '.$default_currency ); |
|
235 | + if (!empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'shipping_cost' && $_SESSION['cart']['order_grand_total_before_discount'] < $coupon_order_amount_mini['amount']) { |
|
236 | + $coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ', 'wpshop') . ' ' . $coupon_order_amount_mini['amount'] . ' ' . $default_currency); |
|
237 | 237 | $order_amount_limit = false; |
238 | 238 | } |
239 | 239 | |
240 | - elseif( !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'no_shipping_cost' && $_SESSION['cart']['order_total_ttc'] < $coupon_order_amount_mini['amount'] ) { |
|
241 | - $coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ','wpshop').' '.$coupon_order_amount_mini['amount'].' '.$default_currency.' '.__('without shipping cost', 'wpshop') ); |
|
240 | + elseif (!empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'no_shipping_cost' && $_SESSION['cart']['order_total_ttc'] < $coupon_order_amount_mini['amount']) { |
|
241 | + $coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ', 'wpshop') . ' ' . $coupon_order_amount_mini['amount'] . ' ' . $default_currency . ' ' . __('without shipping cost', 'wpshop')); |
|
242 | 242 | $order_amount_limit = false; |
243 | 243 | } |
244 | 244 | |
245 | 245 | } |
246 | - if ( $order_amount_limit ) { |
|
246 | + if ($order_amount_limit) { |
|
247 | 247 | $_SESSION['cart']['coupon_id'] = $result->post_id; |
248 | 248 | $coupon_infos = array('status' => true, 'message' => ''); |
249 | 249 | } |
250 | 250 | } |
251 | 251 | else { |
252 | - $coupon_infos = array('status' => false, 'message' => __('You are not allowed to use this coupon','wpshop') ); |
|
252 | + $coupon_infos = array('status' => false, 'message' => __('You are not allowed to use this coupon', 'wpshop')); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | } |
256 | 256 | else { |
257 | - $coupon_infos = array('status' => false, 'message' => __('This coupon is not valid','wpshop')); |
|
257 | + $coupon_infos = array('status' => false, 'message' => __('This coupon is not valid', 'wpshop')); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | } |
261 | 261 | else { |
262 | - $coupon_infos = array('status' => false, 'message' => __('This coupon doesn`t exist','wpshop')); |
|
262 | + $coupon_infos = array('status' => false, 'message' => __('This coupon doesn`t exist', 'wpshop')); |
|
263 | 263 | } |
264 | 264 | return $coupon_infos; |
265 | 265 | } |
@@ -269,37 +269,37 @@ discard block |
||
269 | 269 | * @param integer $customer_id |
270 | 270 | * @return string |
271 | 271 | */ |
272 | - function display_coupons( $customer_id = '' ) { |
|
273 | - $is_from_admin = ( !empty($customer_id) ) ? true : false; |
|
274 | - $customer_id = ( !empty($customer_id) ) ? $customer_id : get_current_user_id(); |
|
272 | + function display_coupons($customer_id = '') { |
|
273 | + $is_from_admin = (!empty($customer_id)) ? true : false; |
|
274 | + $customer_id = (!empty($customer_id)) ? $customer_id : get_current_user_id(); |
|
275 | 275 | $coupons_mdl = new wps_coupon_model(); |
276 | 276 | $coupons = $coupons_mdl->get_coupons(); |
277 | 277 | $output = $coupons_rows = ''; |
278 | 278 | |
279 | - if( !empty($coupons) ) { |
|
280 | - foreach( $coupons as $coupon ) { |
|
281 | - $coupon_individual_usage = get_post_meta( $coupon->ID, 'wpshop_coupon_individual_use', true ); |
|
282 | - if( empty($coupon_individual_usage) || ( !empty($coupon_individual_usage) && in_array( $customer_id , $coupon_individual_usage) ) ) { |
|
283 | - $coupon_code = get_post_meta( $coupon->ID, 'wpshop_coupon_code', true ); |
|
284 | - $coupon_value = get_post_meta( $coupon->ID, 'wpshop_coupon_discount_value', true ); |
|
285 | - $discount_type = get_post_meta( $coupon->ID, 'wpshop_coupon_discount_type', true ); |
|
286 | - $coupon_date = get_post_meta( $coupon->ID, 'wpshop_coupon_expiry_date', true); |
|
287 | - $coupon_validity_date = ( !empty($coupon_date) ) ? $coupon_date : __( 'No validity date', 'wpshop'); |
|
288 | - $coupon_value .= ( !empty($discount_type) && $discount_type == 'amount') ? wpshop_tools::wpshop_get_currency( false ) : '%'; |
|
279 | + if (!empty($coupons)) { |
|
280 | + foreach ($coupons as $coupon) { |
|
281 | + $coupon_individual_usage = get_post_meta($coupon->ID, 'wpshop_coupon_individual_use', true); |
|
282 | + if (empty($coupon_individual_usage) || (!empty($coupon_individual_usage) && in_array($customer_id, $coupon_individual_usage))) { |
|
283 | + $coupon_code = get_post_meta($coupon->ID, 'wpshop_coupon_code', true); |
|
284 | + $coupon_value = get_post_meta($coupon->ID, 'wpshop_coupon_discount_value', true); |
|
285 | + $discount_type = get_post_meta($coupon->ID, 'wpshop_coupon_discount_type', true); |
|
286 | + $coupon_date = get_post_meta($coupon->ID, 'wpshop_coupon_expiry_date', true); |
|
287 | + $coupon_validity_date = (!empty($coupon_date)) ? $coupon_date : __('No validity date', 'wpshop'); |
|
288 | + $coupon_value .= (!empty($discount_type) && $discount_type == 'amount') ? wpshop_tools::wpshop_get_currency(false) : '%'; |
|
289 | 289 | ob_start(); |
290 | - require( wpshop_tools::get_template_part( WPS_COUPON_DIR, $this->template_dir, "frontend", "coupon") ); |
|
290 | + require(wpshop_tools::get_template_part(WPS_COUPON_DIR, $this->template_dir, "frontend", "coupon")); |
|
291 | 291 | $coupons_rows .= ob_get_contents(); |
292 | 292 | ob_end_clean(); |
293 | 293 | } |
294 | 294 | } |
295 | 295 | ob_start(); |
296 | - require( wpshop_tools::get_template_part( WPS_COUPON_DIR, $this->template_dir, "frontend", "coupons") ); |
|
296 | + require(wpshop_tools::get_template_part(WPS_COUPON_DIR, $this->template_dir, "frontend", "coupons")); |
|
297 | 297 | $output .= ob_get_contents(); |
298 | 298 | ob_end_clean(); |
299 | 299 | |
300 | 300 | } |
301 | 301 | else { |
302 | - $output = '<div class="wps-alert-info">' .__( 'Sorry ! No available coupon', 'wpshop' ) .'</div>'; |
|
302 | + $output = '<div class="wps-alert-info">' . __('Sorry ! No available coupon', 'wpshop') . '</div>'; |
|
303 | 303 | } |
304 | 304 | return $output; |
305 | 305 | } |