@@ -257,8 +257,6 @@ |
||
257 | 257 | * |
258 | 258 | * @param int $product_id L'id du produit |
259 | 259 | * @param string $type Peut être varchar, integer, text, options, decimal, datetime |
260 | - * @param string $attribute_name Le code d'un attribut |
|
261 | - * @param string $attribute_value La valeur à mêttre à jour |
|
262 | 260 | */ |
263 | 261 | public function update_the_attribute_for_product($product_id, $type, $name_attribute, $value_attribute) { |
264 | 262 | global $wpdb; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | class wps_product_ctr { |
3 | 3 | |
4 | 4 | /** |
@@ -8,19 +8,19 @@ discard block |
||
8 | 8 | * @return void |
9 | 9 | */ |
10 | 10 | function __construct() { |
11 | - add_action( 'admin_enqueue_scripts', array( &$this, 'callback_admin_enqueue_scripts' ) ); |
|
11 | + add_action('admin_enqueue_scripts', array(&$this, 'callback_admin_enqueue_scripts')); |
|
12 | 12 | |
13 | - add_shortcode( 'wps_product_caracteristics', array( $this, 'display_product_caracteristics_tab' ) ); |
|
14 | - add_shortcode( 'wpshop_product_caracteristics', array( $this, 'display_product_caracteristics_tab' ) ); |
|
15 | - add_shortcode( 'wps_product_discount_chip', array( $this, 'display_discount_chip' ) ); |
|
16 | - add_shortcode( 'wpshop_product_discount_chip', array( $this, 'display_discount_chip' ) ); |
|
13 | + add_shortcode('wps_product_caracteristics', array($this, 'display_product_caracteristics_tab')); |
|
14 | + add_shortcode('wpshop_product_caracteristics', array($this, 'display_product_caracteristics_tab')); |
|
15 | + add_shortcode('wps_product_discount_chip', array($this, 'display_discount_chip')); |
|
16 | + add_shortcode('wpshop_product_discount_chip', array($this, 'display_discount_chip')); |
|
17 | 17 | |
18 | - add_shortcode( 'wpshop_product_title', array( $this, 'wpshop_product_title' ) ); |
|
19 | - add_shortcode( 'wpshop_product_content', array( $this, 'wpshop_product_content' ) ); |
|
20 | - add_shortcode( 'wpshop_product_thumbnail', array( $this, 'wpshop_product_thumbnail' ) ); |
|
18 | + add_shortcode('wpshop_product_title', array($this, 'wpshop_product_title')); |
|
19 | + add_shortcode('wpshop_product_content', array($this, 'wpshop_product_content')); |
|
20 | + add_shortcode('wpshop_product_thumbnail', array($this, 'wpshop_product_thumbnail')); |
|
21 | 21 | |
22 | 22 | /** Product sheet Page **/ |
23 | - add_action( 'admin_post_wps_product_sheet', array( $this, 'wpshop_product_sheet_output' ) ); |
|
23 | + add_action('admin_post_wps_product_sheet', array($this, 'wpshop_product_sheet_output')); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -31,26 +31,26 @@ discard block |
||
31 | 31 | $module_folder = WPS_PRODUCT_PATH . '/modules/'; |
32 | 32 | |
33 | 33 | /** Check if the defined directory exists for reading and including the different modules */ |
34 | - if( is_dir( $module_folder ) ) { |
|
35 | - $parent_folder_content = scandir( $module_folder ); |
|
36 | - foreach ( $parent_folder_content as $folder ) { |
|
37 | - if ( $folder && substr( $folder, 0, 1) != '.' && is_dir( $module_folder . $folder ) ) { |
|
38 | - $child_folder_content = scandir( $module_folder . $folder ); |
|
39 | - if ( file_exists( $module_folder . $folder . '/' . $folder . '.php') ) { |
|
40 | - $f = $module_folder . $folder . '/' . $folder . '.php'; |
|
41 | - include( $f ); |
|
34 | + if (is_dir($module_folder)) { |
|
35 | + $parent_folder_content = scandir($module_folder); |
|
36 | + foreach ($parent_folder_content as $folder) { |
|
37 | + if ($folder && substr($folder, 0, 1) != '.' && is_dir($module_folder . $folder)) { |
|
38 | + $child_folder_content = scandir($module_folder . $folder); |
|
39 | + if (file_exists($module_folder . $folder . '/' . $folder . '.php')) { |
|
40 | + $f = $module_folder . $folder . '/' . $folder . '.php'; |
|
41 | + include($f); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - public function callback_admin_enqueue_scripts( $hook ) { |
|
49 | - wp_enqueue_script( 'wps_backend_product_js', WPS_PRODUCT_URL . '/asset/js/backend-product.js', array( "jquery", "jquery-form" ), WPS_PRODUCT_VERSION ); |
|
50 | - if( $hook != 'tools_page_wpshop_tools' ) |
|
48 | + public function callback_admin_enqueue_scripts($hook) { |
|
49 | + wp_enqueue_script('wps_backend_product_js', WPS_PRODUCT_URL . '/asset/js/backend-product.js', array("jquery", "jquery-form"), WPS_PRODUCT_VERSION); |
|
50 | + if ($hook != 'tools_page_wpshop_tools') |
|
51 | 51 | return; |
52 | 52 | |
53 | - wp_enqueue_script( 'wps_product_js', WPS_PRODUCT_URL . '/asset/js/backend.js', array( "jquery", "jquery-form" ), WPS_PRODUCT_VERSION ); |
|
53 | + wp_enqueue_script('wps_product_js', WPS_PRODUCT_URL . '/asset/js/backend.js', array("jquery", "jquery-form"), WPS_PRODUCT_VERSION); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | * @param array $args |
59 | 59 | * @return string |
60 | 60 | */ |
61 | - function display_product_caracteristics_tab( $args ) { |
|
61 | + function display_product_caracteristics_tab($args) { |
|
62 | 62 | $output = ''; |
63 | - if( !empty($args) && !empty($args['pid']) ) { |
|
63 | + if (!empty($args) && !empty($args['pid'])) { |
|
64 | 64 | $wps_product_mdl = new wps_product_mdl(); |
65 | - $product_atts_def = $wps_product_mdl->get_product_atts_def( $args['pid'] ); |
|
66 | - if( !empty($product_atts_def) ) { |
|
65 | + $product_atts_def = $wps_product_mdl->get_product_atts_def($args['pid']); |
|
66 | + if (!empty($product_atts_def)) { |
|
67 | 67 | ob_start(); |
68 | - require( wpshop_tools::get_template_part( WPS_PRODUCT_DIR, WPS_PRODUCT_TEMPLATES_MAIN_DIR, "frontend", "product_caracteristics_tab") ); |
|
68 | + require(wpshop_tools::get_template_part(WPS_PRODUCT_DIR, WPS_PRODUCT_TEMPLATES_MAIN_DIR, "frontend", "product_caracteristics_tab")); |
|
69 | 69 | $output = ob_get_contents(); |
70 | 70 | ob_end_clean(); |
71 | 71 | } |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | * @param array $args |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - function display_discount_chip( $args ) { |
|
81 | + function display_discount_chip($args) { |
|
82 | 82 | $output = ''; |
83 | - if( !empty($args) && !empty($args['pid']) ) { |
|
83 | + if (!empty($args) && !empty($args['pid'])) { |
|
84 | 84 | $wps_price = new wpshop_prices(); |
85 | - $discount_data = wpshop_prices::check_discount_for_product( $args['pid'] ); |
|
86 | - if( !empty($discount_data) ) { |
|
85 | + $discount_data = wpshop_prices::check_discount_for_product($args['pid']); |
|
86 | + if (!empty($discount_data)) { |
|
87 | 87 | ob_start(); |
88 | - require( wpshop_tools::get_template_part( WPS_PRODUCT_DIR, WPS_PRODUCT_TEMPLATES_MAIN_DIR, "frontend", "product_discount_chip") ); |
|
88 | + require(wpshop_tools::get_template_part(WPS_PRODUCT_DIR, WPS_PRODUCT_TEMPLATES_MAIN_DIR, "frontend", "product_discount_chip")); |
|
89 | 89 | $output = ob_get_contents(); |
90 | 90 | ob_end_clean(); |
91 | 91 | } |
@@ -103,39 +103,39 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function check_stock($product_id, $cart_asked_quantity, $combined_variation_id = '') { |
105 | 105 | // Checking if combined variation ID exist and it is a simple option |
106 | - if( !empty($combined_variation_id) && ( strpos($combined_variation_id, '__') !== false ) ) { |
|
107 | - $var_id = explode( '__', $combined_variation_id); |
|
106 | + if (!empty($combined_variation_id) && (strpos($combined_variation_id, '__') !== false)) { |
|
107 | + $var_id = explode('__', $combined_variation_id); |
|
108 | 108 | $combined_variation_id = $var_id[1]; |
109 | 109 | } |
110 | 110 | |
111 | 111 | |
112 | - if ( !empty($combined_variation_id) ) { |
|
112 | + if (!empty($combined_variation_id)) { |
|
113 | 113 | |
114 | - $variation_metadata = get_post_meta( $combined_variation_id, '_wpshop_product_metadata', true ); |
|
115 | - if ( isset($variation_metadata['product_stock']) ) { |
|
114 | + $variation_metadata = get_post_meta($combined_variation_id, '_wpshop_product_metadata', true); |
|
115 | + if (isset($variation_metadata['product_stock'])) { |
|
116 | 116 | $product_id = $combined_variation_id; |
117 | 117 | } else { |
118 | - $product_id = wp_get_post_parent_id( $combined_variation_id ); |
|
119 | - $product_id = ( $product_id ) ? $product_id : $combined_variation_id; |
|
118 | + $product_id = wp_get_post_parent_id($combined_variation_id); |
|
119 | + $product_id = ($product_id) ? $product_id : $combined_variation_id; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | $product_data = wpshop_products::get_product_data($product_id, false, '"publish", "free_product"'); |
123 | 123 | |
124 | - if(!empty($product_data)) { |
|
124 | + if (!empty($product_data)) { |
|
125 | 125 | $manage_stock = !empty($product_data['manage_stock']) ? $product_data['manage_stock'] : ''; |
126 | 126 | |
127 | - $product_post_type = get_post_type( $product_id ); |
|
127 | + $product_post_type = get_post_type($product_id); |
|
128 | 128 | |
129 | - if ( $product_post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION ) { |
|
130 | - $parent_def = wpshop_products::get_parent_variation( $product_id ); |
|
131 | - if ( !empty($parent_def) && !empty($parent_def['parent_post']) ) { |
|
129 | + if ($product_post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) { |
|
130 | + $parent_def = wpshop_products::get_parent_variation($product_id); |
|
131 | + if (!empty($parent_def) && !empty($parent_def['parent_post'])) { |
|
132 | 132 | $parent_post = $parent_def['parent_post']; |
133 | 133 | $parent_product_data = wpshop_products::get_product_data($parent_post->ID); |
134 | - $manage_stock = empty( $manage_stock ) ? $parent_product_data['manage_stock'] : $manage_stock; |
|
134 | + $manage_stock = empty($manage_stock) ? $parent_product_data['manage_stock'] : $manage_stock; |
|
135 | 135 | } |
136 | 136 | } |
137 | - $manage_stock_is_activated = (!empty($manage_stock) && ( strtolower(__($manage_stock, 'wpshop')) == strtolower(__('Yes', 'wpshop')) )) ? true : false; |
|
138 | - $the_qty_is_in_stock = ( !empty($product_data['product_stock']) && $product_data['product_stock'] >= $cart_asked_quantity ) ? true : false ; |
|
137 | + $manage_stock_is_activated = (!empty($manage_stock) && (strtolower(__($manage_stock, 'wpshop')) == strtolower(__('Yes', 'wpshop')))) ? true : false; |
|
138 | + $the_qty_is_in_stock = (!empty($product_data['product_stock']) && $product_data['product_stock'] >= $cart_asked_quantity) ? true : false; |
|
139 | 139 | |
140 | 140 | if (($manage_stock_is_activated && $the_qty_is_in_stock) OR !$manage_stock_is_activated) { |
141 | 141 | return true; |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | public static function get_inconsistent_product() { |
151 | - $price_piloting_option = get_option( 'wpshop_shop_price_piloting' ); |
|
151 | + $price_piloting_option = get_option('wpshop_shop_price_piloting'); |
|
152 | 152 | |
153 | - $entity_id = wpshop_entities::get_entity_identifier_from_code( 'wpshop_product' ); |
|
153 | + $entity_id = wpshop_entities::get_entity_identifier_from_code('wpshop_product'); |
|
154 | 154 | |
155 | - $attribute_def = wpshop_attributes::getElement( ( $price_piloting_option == 'TTC' ) ? 'product_price' : 'price_ht', "'valid'", 'code' ); |
|
156 | - $attribute_id = $attribute_def->id; |
|
155 | + $attribute_def = wpshop_attributes::getElement(($price_piloting_option == 'TTC') ? 'product_price' : 'price_ht', "'valid'", 'code'); |
|
156 | + $attribute_id = $attribute_def->id; |
|
157 | 157 | |
158 | 158 | global $wpdb; |
159 | 159 | |
160 | 160 | $wpdb->query('SET SESSION group_concat_max_len = 10000'); |
161 | 161 | |
162 | - $query = " |
|
162 | + $query = " |
|
163 | 163 | SELECT post.ID, post.post_title, attr_val_dec.value as price_attribute, GROUP_CONCAT(postmeta.meta_key, '&sep&', postmeta.meta_value, '&&' ORDER BY postmeta.meta_key) as price |
164 | 164 | FROM $wpdb->posts as post |
165 | 165 | JOIN $wpdb->postmeta as postmeta |
@@ -172,15 +172,15 @@ discard block |
||
172 | 172 | AND postmeta.meta_key IN( '_product_price', '_wps_price_infos', '_wpshop_displayed_price', '_wpshop_product_metadata' ) |
173 | 173 | GROUP BY post.ID"; |
174 | 174 | |
175 | - $list_product = $wpdb->get_results( $wpdb->prepare( $query, array( $entity_id, $attribute_id ) ) ); |
|
175 | + $list_product = $wpdb->get_results($wpdb->prepare($query, array($entity_id, $attribute_id))); |
|
176 | 176 | |
177 | - if( !empty( $list_product ) ) { |
|
178 | - foreach( $list_product as $key_product => &$product ) { |
|
177 | + if (!empty($list_product)) { |
|
178 | + foreach ($list_product as $key_product => &$product) { |
|
179 | 179 | $product->price = explode('&&,', $product->price); |
180 | - if(!empty($product->price) && is_array($product->price)) { |
|
180 | + if (!empty($product->price) && is_array($product->price)) { |
|
181 | 181 | $array_price = array(); |
182 | - foreach($product->price as &$price) { |
|
183 | - if(strpos( $price, '&&' )) |
|
182 | + foreach ($product->price as &$price) { |
|
183 | + if (strpos($price, '&&')) |
|
184 | 184 | $price = substr($price, 0, -2); |
185 | 185 | |
186 | 186 | $tmp_price = explode('&sep&', $price); |
@@ -188,35 +188,35 @@ discard block |
||
188 | 188 | $price = maybe_unserialize($tmp_price[1]); |
189 | 189 | |
190 | 190 | /** _wpshop_product_metadata */ |
191 | - if( $key == '_wpshop_product_metadata' ) { |
|
192 | - $array_price[$key] = ( $price_piloting_option == 'TTC' ) ? $price['product_price'] : $price['price_ht']; |
|
191 | + if ($key == '_wpshop_product_metadata') { |
|
192 | + $array_price[$key] = ($price_piloting_option == 'TTC') ? $price['product_price'] : $price['price_ht']; |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** _wps_price_infos */ |
196 | - if( $key == '_wps_price_infos' ) { |
|
197 | - $array_price[$key] = !empty( $price['PRODUCT_PRICE'] ) ? $price['PRODUCT_PRICE'] : '-'; |
|
196 | + if ($key == '_wps_price_infos') { |
|
197 | + $array_price[$key] = !empty($price['PRODUCT_PRICE']) ? $price['PRODUCT_PRICE'] : '-'; |
|
198 | 198 | } |
199 | 199 | |
200 | - if( $key == '_product_price' ) { |
|
201 | - $array_price[$key] = ( $price_piloting_option == 'TTC' ) ? $price : '-'; |
|
200 | + if ($key == '_product_price') { |
|
201 | + $array_price[$key] = ($price_piloting_option == 'TTC') ? $price : '-'; |
|
202 | 202 | } |
203 | 203 | |
204 | - if ( $key == '_wpshop_displayed_price' ) { |
|
204 | + if ($key == '_wpshop_displayed_price') { |
|
205 | 205 | $array_price[$key] = $price; |
206 | 206 | } |
207 | 207 | unset($price); |
208 | 208 | } |
209 | 209 | |
210 | - $array_meta_list = array( '_product_price', '_wps_price_infos', '_wpshop_displayed_price', '_wpshop_product_metadata', ); |
|
210 | + $array_meta_list = array('_product_price', '_wps_price_infos', '_wpshop_displayed_price', '_wpshop_product_metadata',); |
|
211 | 211 | |
212 | - foreach( $array_meta_list as $meta_list ) { |
|
213 | - if( !array_key_exists( $meta_list, $array_price ) ) { |
|
212 | + foreach ($array_meta_list as $meta_list) { |
|
213 | + if (!array_key_exists($meta_list, $array_price)) { |
|
214 | 214 | $array_price[$meta_list] = 0; |
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | 218 | $product->price = $array_price; |
219 | - if( $product->price_attribute === $product->price['_wpshop_product_metadata'] ) { |
|
219 | + if ($product->price_attribute === $product->price['_wpshop_product_metadata']) { |
|
220 | 220 | unset($list_product[$key_product]); |
221 | 221 | } |
222 | 222 | |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | * @param int $pid L'id du produit |
235 | 235 | * @return WP_Post |
236 | 236 | */ |
237 | - public function get_thumbnail ( $pid ) { |
|
238 | - if( empty( $pid ) ) |
|
237 | + public function get_thumbnail($pid) { |
|
238 | + if (empty($pid)) |
|
239 | 239 | return null; |
240 | 240 | |
241 | - $thumbnail_id = get_post_meta( $pid, '_thumbnail_id', true ); |
|
241 | + $thumbnail_id = get_post_meta($pid, '_thumbnail_id', true); |
|
242 | 242 | |
243 | - if( empty( $thumbnail_id ) ) |
|
243 | + if (empty($thumbnail_id)) |
|
244 | 244 | return null; |
245 | 245 | |
246 | 246 | return $thumbnail_id; |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | * @param array $array_data The array data [integer][barcode] = 0111100001 |
254 | 254 | */ |
255 | 255 | public function update_attributes_for_product($product_id, $array_data) { |
256 | - if(!empty($array_data)) { |
|
257 | - foreach($array_data as $type => $array) { |
|
258 | - foreach($array as $name_attribute => $value_attribute) { |
|
256 | + if (!empty($array_data)) { |
|
257 | + foreach ($array_data as $type => $array) { |
|
258 | + foreach ($array as $name_attribute => $value_attribute) { |
|
259 | 259 | $this->update_the_attribute_for_product($product_id, $type, $name_attribute, $value_attribute); |
260 | 260 | } |
261 | 261 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $attribute_id = $wpdb->get_var($wpdb->prepare('SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE . ' WHERE code="%s"', array($name_attribute))); |
280 | 280 | |
281 | 281 | /** On vérifie s'il existe si c'est le cas, on update sinon on insert */ |
282 | - if(count($wpdb->get_row($wpdb->prepare('SELECT value_id FROM ' . WPSHOP_DBT_ATTRIBUTE . '_value_' . $type . ' WHERE entity_id=%d AND attribute_id IN(SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE . ' WHERE code="%s")', array($product_id, $name_attribute)))) > 0) { |
|
282 | + if (count($wpdb->get_row($wpdb->prepare('SELECT value_id FROM ' . WPSHOP_DBT_ATTRIBUTE . '_value_' . $type . ' WHERE entity_id=%d AND attribute_id IN(SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE . ' WHERE code="%s")', array($product_id, $name_attribute)))) > 0) { |
|
283 | 283 | $wpdb->query( |
284 | 284 | $wpdb->prepare('UPDATE ' . WPSHOP_DBT_ATTRIBUTE . '_value_' . $type . ' SET value="%s" WHERE entity_id=%d AND attribute_id=%d', |
285 | 285 | array($value_attribute, $product_id, $attribute_id) |
@@ -305,13 +305,13 @@ discard block |
||
305 | 305 | * @param array $args [ 'id' ] L'id du produit |
306 | 306 | * @return string |
307 | 307 | */ |
308 | - public function wpshop_product_title( $args ) { |
|
309 | - $output = __( 'No product has been found.', 'wpshop' ); |
|
308 | + public function wpshop_product_title($args) { |
|
309 | + $output = __('No product has been found.', 'wpshop'); |
|
310 | 310 | |
311 | - if ( !empty( $args ) && !empty( $args['pid'] ) ) { |
|
311 | + if (!empty($args) && !empty($args['pid'])) { |
|
312 | 312 | global $wpdb; |
313 | 313 | $query = "SELECT post_title FROM {$wpdb->posts} WHERE ID = %d"; |
314 | - $output = $wpdb->get_var( $wpdb->prepare( $query, $args['pid'] ) ); |
|
314 | + $output = $wpdb->get_var($wpdb->prepare($query, $args['pid'])); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | return $output; |
@@ -322,16 +322,16 @@ discard block |
||
322 | 322 | * @param array $args [ 'id' ] L'id du produit |
323 | 323 | * @return string |
324 | 324 | */ |
325 | - public function wpshop_product_content( $args ) { |
|
326 | - $output = __( 'No product has been found.', 'wpshop' ); |
|
325 | + public function wpshop_product_content($args) { |
|
326 | + $output = __('No product has been found.', 'wpshop'); |
|
327 | 327 | |
328 | - if ( !empty( $args ) && !empty( $args['pid'] ) ) { |
|
328 | + if (!empty($args) && !empty($args['pid'])) { |
|
329 | 329 | global $wpdb; |
330 | 330 | $query = "SELECT post_content FROM {$wpdb->posts} WHERE ID = %d"; |
331 | - $output = $wpdb->get_var( $wpdb->prepare( $query, $args['pid'] ) ); |
|
331 | + $output = $wpdb->get_var($wpdb->prepare($query, $args['pid'])); |
|
332 | 332 | } |
333 | 333 | |
334 | - return nl2br( $output ); |
|
334 | + return nl2br($output); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | * [ size ] La taille de l'image. Peut être défini comme : small, medium ou full |
342 | 342 | * @return string |
343 | 343 | */ |
344 | - public function wpshop_product_thumbnail( $args ) { |
|
344 | + public function wpshop_product_thumbnail($args) { |
|
345 | 345 | $url_thumbnail = WPSHOP_DEFAULT_PRODUCT_PICTURE; |
346 | 346 | $size = '20%'; |
347 | 347 | |
348 | - if ( !empty( $args ) && !empty( $args['size'] ) ) { |
|
349 | - switch ( $args['size'] ) { |
|
348 | + if (!empty($args) && !empty($args['size'])) { |
|
349 | + switch ($args['size']) { |
|
350 | 350 | case 'small': |
351 | 351 | $size = '20%'; |
352 | 352 | break; |
@@ -361,20 +361,20 @@ discard block |
||
361 | 361 | } |
362 | 362 | } |
363 | 363 | |
364 | - if ( !empty( $args ) && !empty( $args['pid'] ) ) { |
|
365 | - $thumbnail_id = $this->get_thumbnail( $args['pid'] ); |
|
364 | + if (!empty($args) && !empty($args['pid'])) { |
|
365 | + $thumbnail_id = $this->get_thumbnail($args['pid']); |
|
366 | 366 | |
367 | - if( !empty( $thumbnail_id ) ) { |
|
368 | - $attachment = get_post( $thumbnail_id ); |
|
367 | + if (!empty($thumbnail_id)) { |
|
368 | + $attachment = get_post($thumbnail_id); |
|
369 | 369 | |
370 | - if( !empty( $attachment ) && !empty( $attachment->guid ) ) { |
|
370 | + if (!empty($attachment) && !empty($attachment->guid)) { |
|
371 | 371 | $url_thumbnail = $attachment->guid; |
372 | 372 | } |
373 | 373 | } |
374 | 374 | } |
375 | 375 | |
376 | 376 | ob_start(); |
377 | - require( wpshop_tools::get_template_part( WPS_PRODUCT_DIR, WPS_PRODUCT_TEMPLATES_MAIN_DIR, "frontend", "product_thumbnail" ) ); |
|
377 | + require(wpshop_tools::get_template_part(WPS_PRODUCT_DIR, WPS_PRODUCT_TEMPLATES_MAIN_DIR, "frontend", "product_thumbnail")); |
|
378 | 378 | $output = ob_get_clean(); |
379 | 379 | |
380 | 380 | return $output; |
@@ -384,19 +384,19 @@ discard block |
||
384 | 384 | * Output product sheet to PDF |
385 | 385 | */ |
386 | 386 | public function wpshop_product_sheet_output() { |
387 | - $product_id = ( !empty($_GET['pid']) ) ? (int) $_GET['pid'] : null; |
|
387 | + $product_id = (!empty($_GET['pid'])) ? (int)$_GET['pid'] : null; |
|
388 | 388 | $user_id = get_current_user_id(); |
389 | - if( !empty($product_id) && get_post_type( $product_id ) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT && $user_id != 0 && current_user_can( 'manage_options' ) ) { |
|
389 | + if (!empty($product_id) && get_post_type($product_id) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT && $user_id != 0 && current_user_can('manage_options')) { |
|
390 | 390 | $wps_product_administration_ctr = new wps_product_administration_ctr(); |
391 | - $html_content = $wps_product_administration_ctr->generate_product_sheet_datas( $product_id ); |
|
392 | - $product_post = get_post( $product_id ); |
|
393 | - require_once(WPSHOP_LIBRAIRIES_DIR.'HTML2PDF/html2pdf.class.php'); |
|
391 | + $html_content = $wps_product_administration_ctr->generate_product_sheet_datas($product_id); |
|
392 | + $product_post = get_post($product_id); |
|
393 | + require_once(WPSHOP_LIBRAIRIES_DIR . 'HTML2PDF/html2pdf.class.php'); |
|
394 | 394 | try { |
395 | 395 | $html2pdf = new HTML2PDF('P', 'A4', 'fr'); |
396 | 396 | $html2pdf->pdf->SetDisplayMode('fullpage'); |
397 | 397 | $html2pdf->setDefaultFont('Arial'); |
398 | 398 | $html2pdf->writeHTML($html_content); |
399 | - $html2pdf->Output('product-' .$product_id.'-'.$product_post->post_name.'.pdf', 'D'); |
|
399 | + $html2pdf->Output('product-' . $product_id . '-' . $product_post->post_name . '.pdf', 'D'); |
|
400 | 400 | } |
401 | 401 | catch (HTML2PDF_exception $e) { |
402 | 402 | echo $e; |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | class wps_product_ctr { |
3 | 5 | |
4 | 6 | /** |
@@ -47,8 +49,9 @@ discard block |
||
47 | 49 | |
48 | 50 | public function callback_admin_enqueue_scripts( $hook ) { |
49 | 51 | wp_enqueue_script( 'wps_backend_product_js', WPS_PRODUCT_URL . '/asset/js/backend-product.js', array( "jquery", "jquery-form" ), WPS_PRODUCT_VERSION ); |
50 | - if( $hook != 'tools_page_wpshop_tools' ) |
|
51 | - return; |
|
52 | + if( $hook != 'tools_page_wpshop_tools' ) { |
|
53 | + return; |
|
54 | + } |
|
52 | 55 | |
53 | 56 | wp_enqueue_script( 'wps_product_js', WPS_PRODUCT_URL . '/asset/js/backend.js', array( "jquery", "jquery-form" ), WPS_PRODUCT_VERSION ); |
54 | 57 | } |
@@ -139,8 +142,7 @@ discard block |
||
139 | 142 | |
140 | 143 | if (($manage_stock_is_activated && $the_qty_is_in_stock) OR !$manage_stock_is_activated) { |
141 | 144 | return true; |
142 | - } |
|
143 | - else { |
|
145 | + } else { |
|
144 | 146 | return __('You cannot add that amount to the cart since there is not enough stock.', 'wpshop'); |
145 | 147 | } |
146 | 148 | } |
@@ -180,8 +182,9 @@ discard block |
||
180 | 182 | if(!empty($product->price) && is_array($product->price)) { |
181 | 183 | $array_price = array(); |
182 | 184 | foreach($product->price as &$price) { |
183 | - if(strpos( $price, '&&' )) |
|
184 | - $price = substr($price, 0, -2); |
|
185 | + if(strpos( $price, '&&' )) { |
|
186 | + $price = substr($price, 0, -2); |
|
187 | + } |
|
185 | 188 | |
186 | 189 | $tmp_price = explode('&sep&', $price); |
187 | 190 | $key = $tmp_price[0]; |
@@ -235,13 +238,15 @@ discard block |
||
235 | 238 | * @return WP_Post |
236 | 239 | */ |
237 | 240 | public function get_thumbnail ( $pid ) { |
238 | - if( empty( $pid ) ) |
|
239 | - return null; |
|
241 | + if( empty( $pid ) ) { |
|
242 | + return null; |
|
243 | + } |
|
240 | 244 | |
241 | 245 | $thumbnail_id = get_post_meta( $pid, '_thumbnail_id', true ); |
242 | 246 | |
243 | - if( empty( $thumbnail_id ) ) |
|
244 | - return null; |
|
247 | + if( empty( $thumbnail_id ) ) { |
|
248 | + return null; |
|
249 | + } |
|
245 | 250 | |
246 | 251 | return $thumbnail_id; |
247 | 252 | } |
@@ -285,8 +290,7 @@ discard block |
||
285 | 290 | array($value_attribute, $product_id, $attribute_id) |
286 | 291 | ) |
287 | 292 | ); |
288 | - } |
|
289 | - else { |
|
293 | + } else { |
|
290 | 294 | /** Insert avec toutes les informations requise */ |
291 | 295 | $wpdb->insert(WPSHOP_DBT_ATTRIBUTE . '_value_' . $type, array( |
292 | 296 | 'attribute_id' => $attribute_id, |
@@ -397,8 +401,7 @@ discard block |
||
397 | 401 | $html2pdf->setDefaultFont('Arial'); |
398 | 402 | $html2pdf->writeHTML($html_content); |
399 | 403 | $html2pdf->Output('product-' .$product_id.'-'.$product_post->post_name.'.pdf', 'D'); |
400 | - } |
|
401 | - catch (HTML2PDF_exception $e) { |
|
404 | + } catch (HTML2PDF_exception $e) { |
|
402 | 405 | echo $e; |
403 | 406 | } |
404 | 407 | } |
@@ -9,29 +9,29 @@ |
||
9 | 9 | * @version 3.0.0.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if (!defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | $WPS_Customers_Contacts = new WPS_Customers_Contacts(); |
17 | -$contacts = $WPS_Customers_Contacts->get_customer_contact_list( $customer_post ); |
|
17 | +$contacts = $WPS_Customers_Contacts->get_customer_contact_list($customer_post); |
|
18 | 18 | |
19 | 19 | ?> |
20 | -<?php foreach ( $contacts as $user_id => $user ) : ?> |
|
21 | -<?php $current_user_datas = get_userdata( $user_id ); ?> |
|
20 | +<?php foreach ($contacts as $user_id => $user) : ?> |
|
21 | +<?php $current_user_datas = get_userdata($user_id); ?> |
|
22 | 22 | <div class="wps-customer-name-container" > |
23 | - <a target="_wps_wpuser_edition_page" href="<?php echo esc_url( admin_url( 'user-edit.php?user_id=' . $user_id ) ); ?>" ><?php echo esc_html( $current_user_datas->user_email ); ?></a> |
|
23 | + <a target="_wps_wpuser_edition_page" href="<?php echo esc_url(admin_url('user-edit.php?user_id=' . $user_id)); ?>" ><?php echo esc_html($current_user_datas->user_email); ?></a> |
|
24 | 24 | <?php |
25 | 25 | $contact_names = ''; |
26 | - if ( ! empty( $current_user_datas->last_name ) ) { |
|
27 | - $contact_names .= strtoupper( $current_user_datas->last_name ); |
|
26 | + if (!empty($current_user_datas->last_name)) { |
|
27 | + $contact_names .= strtoupper($current_user_datas->last_name); |
|
28 | 28 | } |
29 | - if ( ! empty( $current_user_datas->first_name ) ) { |
|
30 | - $contact_names .= empty( $contact_names ) ? '' : ' '; |
|
31 | - $contact_names .= ucfirst( strtolower( $current_user_datas->first_name ) ); |
|
29 | + if (!empty($current_user_datas->first_name)) { |
|
30 | + $contact_names .= empty($contact_names) ? '' : ' '; |
|
31 | + $contact_names .= ucfirst(strtolower($current_user_datas->first_name)); |
|
32 | 32 | } |
33 | - $contact_names = empty( $contact_names ) ? $contact_names : ' - ' . $contact_names; |
|
34 | - echo esc_html( $contact_names ); |
|
33 | + $contact_names = empty($contact_names) ? $contact_names : ' - ' . $contact_names; |
|
34 | + echo esc_html($contact_names); |
|
35 | 35 | ?> |
36 | 36 | </div> |
37 | 37 | <?php endforeach; ?> |
@@ -9,28 +9,28 @@ discard block |
||
9 | 9 | * @version 3.0.0.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if (!defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | $default_user = 0; |
17 | 17 | ob_start(); |
18 | -require( wpshop_tools::get_template_part( WPS_CUST_CONTACT_DIR, WPS_CUST_CONTACT_TPL, 'backend', 'contact' ) ); |
|
18 | +require(wpshop_tools::get_template_part(WPS_CUST_CONTACT_DIR, WPS_CUST_CONTACT_TPL, 'backend', 'contact')); |
|
19 | 19 | $output = ob_get_clean(); |
20 | 20 | |
21 | 21 | ?><table class="wp-list-table widefat fixed striped users" |
22 | - data-dissociate-nonce="<?php echo esc_attr( wp_create_nonce( 'wps_customer_contacts_dissociate' ) ); ?>" |
|
23 | - data-change-default-nonce="<?php echo esc_attr( wp_create_nonce( 'wps_customer_contacts_change_default' ) ); ?>" |
|
24 | - data-default-user-id="<?php echo esc_attr( $default_user ); ?>" > |
|
22 | + data-dissociate-nonce="<?php echo esc_attr(wp_create_nonce('wps_customer_contacts_dissociate')); ?>" |
|
23 | + data-change-default-nonce="<?php echo esc_attr(wp_create_nonce('wps_customer_contacts_change_default')); ?>" |
|
24 | + data-default-user-id="<?php echo esc_attr($default_user); ?>" > |
|
25 | 25 | |
26 | 26 | <thead> |
27 | - <tr data-customer-id="<?php echo esc_attr( $customer->ID ); ?>" data-user-id="<?php echo esc_attr( $user_id ); ?>" > |
|
28 | - <td><?php esc_html_e( 'ID', 'wpshop' ); ?></td> |
|
29 | - <td><?php esc_html_e( 'Last name', 'wpshop' ); ?></td> |
|
30 | - <td><?php esc_html_e( 'First name', 'wpshop' ); ?></td> |
|
31 | - <td><?php esc_html_e( 'Display name' ); ?></td> |
|
32 | - <td><?php esc_html_e( 'Email' ); ?></td> |
|
33 | - <td><?php esc_html_e( 'Phone', 'wpshop' ); ?></td> |
|
27 | + <tr data-customer-id="<?php echo esc_attr($customer->ID); ?>" data-user-id="<?php echo esc_attr($user_id); ?>" > |
|
28 | + <td><?php esc_html_e('ID', 'wpshop'); ?></td> |
|
29 | + <td><?php esc_html_e('Last name', 'wpshop'); ?></td> |
|
30 | + <td><?php esc_html_e('First name', 'wpshop'); ?></td> |
|
31 | + <td><?php esc_html_e('Display name'); ?></td> |
|
32 | + <td><?php esc_html_e('Email'); ?></td> |
|
33 | + <td><?php esc_html_e('Phone', 'wpshop'); ?></td> |
|
34 | 34 | <td class="wps-customer-contacts-actions" > </td> |
35 | 35 | </tr> |
36 | 36 | </thead> |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | <tr> |
44 | 44 | <td colspan="7" class="wps-customer-associate-contact-container" > |
45 | 45 | <span class="wps-customer-contact-association-opener" ><i class="dashicons dashicons-plus" ></i></span> |
46 | - <input type="text" class="wps-customer-autocomplete-input hidden" placeholder="<?php esc_html_e( 'Start typing for user searching', 'wpshop' ); ?>" |
|
47 | - data-search-nonce="<?php echo esc_attr( wp_create_nonce( 'wps_customer_search' ) ); ?>" |
|
46 | + <input type="text" class="wps-customer-autocomplete-input hidden" placeholder="<?php esc_html_e('Start typing for user searching', 'wpshop'); ?>" |
|
47 | + data-search-nonce="<?php echo esc_attr(wp_create_nonce('wps_customer_search')); ?>" |
|
48 | 48 | data-types="users" |
49 | - data-customer="<?php echo esc_attr( $customer->ID ); ?>" |
|
50 | - data-associate-nonce="<?php echo esc_attr( wp_create_nonce( 'wps_customer_contacts_associate' ) ); ?>" /> |
|
49 | + data-customer="<?php echo esc_attr($customer->ID); ?>" |
|
50 | + data-associate-nonce="<?php echo esc_attr(wp_create_nonce('wps_customer_contacts_associate')); ?>" /> |
|
51 | 51 | </td> |
52 | 52 | </tr> |
53 | 53 | </tfoot> |
@@ -9,38 +9,38 @@ |
||
9 | 9 | * @version 3.0.0.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if (!defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | ?> |
16 | -<?php foreach ( $users as $user_id => $user ) : ?> |
|
17 | - <?php if ( 0 !== $user_id ) : ?> |
|
18 | - <?php if ( true === $user['is_default'] ) : ?> |
|
16 | +<?php foreach ($users as $user_id => $user) : ?> |
|
17 | + <?php if (0 !== $user_id) : ?> |
|
18 | + <?php if (true === $user['is_default']) : ?> |
|
19 | 19 | <?php $default_user = $user_id; ?> |
20 | 20 | <?php endif; ?> |
21 | - <tr data-customer-id="<?php echo esc_attr( $customer->ID ); ?>" data-user-id="<?php echo esc_attr( $user_id ); ?>" > |
|
22 | - <td>#<?php echo esc_html( $user_id ); ?></td> |
|
23 | - <td><?php echo empty( $user['last_name'] ) ? '—' : esc_html( $user['last_name'] ); ?></td> |
|
24 | - <td><?php echo empty( $user['first_name'] ) ? '—' : esc_html( $user['first_name'] ); ?></td> |
|
25 | - <td><?php echo esc_html( $user['display_name'] ); ?></td> |
|
26 | - <td><?php echo esc_html( $user['user_email'] ); ?></td> |
|
27 | - <td><?php echo ( isset( $user['metas']['wps_phone'] ) && ! empty( $user['metas']['wps_phone'] ) ? esc_html( implode( ',', $user['metas']['wps_phone'] ) ) : '—' ); ?></td> |
|
21 | + <tr data-customer-id="<?php echo esc_attr($customer->ID); ?>" data-user-id="<?php echo esc_attr($user_id); ?>" > |
|
22 | + <td>#<?php echo esc_html($user_id); ?></td> |
|
23 | + <td><?php echo empty($user['last_name']) ? '—' : esc_html($user['last_name']); ?></td> |
|
24 | + <td><?php echo empty($user['first_name']) ? '—' : esc_html($user['first_name']); ?></td> |
|
25 | + <td><?php echo esc_html($user['display_name']); ?></td> |
|
26 | + <td><?php echo esc_html($user['user_email']); ?></td> |
|
27 | + <td><?php echo (isset($user['metas']['wps_phone']) && !empty($user['metas']['wps_phone']) ? esc_html(implode(',', $user['metas']['wps_phone'])) : '—'); ?></td> |
|
28 | 28 | |
29 | 29 | <td class="wps-customer-contacts-actions" > |
30 | - <?php do_action( 'wps_customer_contacts_list_action', $user_id ); ?> |
|
30 | + <?php do_action('wps_customer_contacts_list_action', $user_id); ?> |
|
31 | 31 | |
32 | - <?php if ( true === $user['is_default'] ) : ?> |
|
33 | - <i title="<?php esc_attr_e( 'This is the main contact / customer creator', 'wpshop' ); ?>" class="dashicons dashicons-star-filled" ></i> |
|
32 | + <?php if (true === $user['is_default']) : ?> |
|
33 | + <i title="<?php esc_attr_e('This is the main contact / customer creator', 'wpshop'); ?>" class="dashicons dashicons-star-filled" ></i> |
|
34 | 34 | <?php else : ?> |
35 | - <i title="<?php esc_attr_e( 'Change to default customer', 'wpshop' ); ?>" class="dashicons dashicons-star-empty" ></i> |
|
35 | + <i title="<?php esc_attr_e('Change to default customer', 'wpshop'); ?>" class="dashicons dashicons-star-empty" ></i> |
|
36 | 36 | <?php endif; ?> |
37 | 37 | |
38 | - <a title="<?php esc_attr_e( 'User account edition', 'wpshop' ); ?>" href="<?php echo esc_url( get_edit_user_link( $user_id ) ); ?>" target="wps_contact_edition" ><i class="dashicons dashicons-edit" ></i></a> |
|
38 | + <a title="<?php esc_attr_e('User account edition', 'wpshop'); ?>" href="<?php echo esc_url(get_edit_user_link($user_id)); ?>" target="wps_contact_edition" ><i class="dashicons dashicons-edit" ></i></a> |
|
39 | 39 | |
40 | - <?php if ( true === $user['is_default'] ) : ?> |
|
41 | - <i title="<?php esc_attr_e( 'This is the main contact, you can\'t unlink it', 'wpshop' ); ?>" class="dashicons dashicons-lock" ></i> |
|
40 | + <?php if (true === $user['is_default']) : ?> |
|
41 | + <i title="<?php esc_attr_e('This is the main contact, you can\'t unlink it', 'wpshop'); ?>" class="dashicons dashicons-lock" ></i> |
|
42 | 42 | <?php else : ?> |
43 | - <i title="<?php esc_attr_e( 'Unlink this user', 'wpshop' ); ?>" class="dashicons dashicons-editor-unlink" ></i> |
|
43 | + <i title="<?php esc_attr_e('Unlink this user', 'wpshop'); ?>" class="dashicons dashicons-editor-unlink" ></i> |
|
44 | 44 | <?php endif; ?> |
45 | 45 | </td> |
46 | 46 | </tr> |
@@ -1,19 +1,19 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | - if( !empty($messages_histo) && is_array($messages_histo) ) :?> |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | + if (!empty($messages_histo) && is_array($messages_histo)) :?> |
|
3 | 3 | <div class="wps-table wps-my-message"> |
4 | 4 | <div class="wps-table-header wps-table-row"> |
5 | - <div class="wps-table-cell"><?php _e( 'Message title', 'wpshop' ); ?></div> |
|
6 | - <div class="wps-table-cell"><?php _e( 'Send date', 'wpshop' ); ?></div> |
|
5 | + <div class="wps-table-cell"><?php _e('Message title', 'wpshop'); ?></div> |
|
6 | + <div class="wps-table-cell"><?php _e('Send date', 'wpshop'); ?></div> |
|
7 | 7 | </div> |
8 | - <?php $page_message_histo = isset( $_GET['page_message_histo'] ) ? (int) $_GET['page_message_histo'] : 1; |
|
9 | - $nb_pages_messages_histo = ceil( count( $messages_histo ) / wps_message_ctr::$mails_display ); |
|
10 | - $messages_histo = array_slice( $messages_histo, ( $page_message_histo - 1 ) * wps_message_ctr::$mails_display, wps_message_ctr::$mails_display ); |
|
11 | - reset( $messages_histo ); |
|
12 | - while( $messages = current( $messages_histo ) ) : |
|
13 | - $first_send_date = key( $messages_histo ); |
|
14 | - reset( $messages ); |
|
15 | - while( $message = current( $messages ) ) : |
|
16 | - $key = key( $messages ); ?> |
|
8 | + <?php $page_message_histo = isset($_GET['page_message_histo']) ? (int)$_GET['page_message_histo'] : 1; |
|
9 | + $nb_pages_messages_histo = ceil(count($messages_histo) / wps_message_ctr::$mails_display); |
|
10 | + $messages_histo = array_slice($messages_histo, ($page_message_histo - 1) * wps_message_ctr::$mails_display, wps_message_ctr::$mails_display); |
|
11 | + reset($messages_histo); |
|
12 | + while ($messages = current($messages_histo)) : |
|
13 | + $first_send_date = key($messages_histo); |
|
14 | + reset($messages); |
|
15 | + while ($message = current($messages)) : |
|
16 | + $key = key($messages); ?> |
|
17 | 17 | <div class="wps-table-content wps-table-row" data-date="<?php echo substr($first_send_date, 0, 7); ?>" > |
18 | 18 | <div class="wps-table-cell wps-message-title-container"> |
19 | 19 | <?php $message_special_id = rand(); ?> |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | <div id="wps-customer-message-<?php echo $message_special_id; ?>" style="display:none;" ><?php echo $message['message']; ?></div> |
22 | 22 | </div> |
23 | 23 | <div class="wps-table-cell"> |
24 | - <?php if( !empty($message['dates']) ) : ?> |
|
24 | + <?php if (!empty($message['dates'])) : ?> |
|
25 | 25 | <ul> |
26 | - <?php foreach( $message['dates'] as $date ) : ?> |
|
27 | - <li><?php echo mysql2date( get_option('date_format') . ' ' . get_option('time_format') , $date, true ); ?></li> |
|
26 | + <?php foreach ($message['dates'] as $date) : ?> |
|
27 | + <li><?php echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $date, true); ?></li> |
|
28 | 28 | <?php endforeach; ?> |
29 | 29 | </ul> |
30 | 30 | <?php endif; ?> |
31 | 31 | </div> |
32 | 32 | </div> |
33 | - <?php next( $messages ); |
|
33 | + <?php next($messages); |
|
34 | 34 | endwhile; |
35 | - next( $messages_histo ); |
|
35 | + next($messages_histo); |
|
36 | 36 | endwhile; ?> |
37 | 37 | </div> |
38 | 38 | <div class="wps-my-message tablenav-pages" style="margin: 7px;text-align: right;"> |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | 'base' => '%_%', |
47 | 47 | 'format' => '?page_message_histo=%#%', |
48 | 48 | 'total' => $nb_pages_messages_histo, |
49 | - 'current' => max( 1, $page_message_histo ), |
|
49 | + 'current' => max(1, $page_message_histo), |
|
50 | 50 | 'show_all' => false, |
51 | 51 | 'end_size' => 1, |
52 | 52 | 'mid_size' => 2, |
53 | 53 | 'prev_next' => true, |
54 | - 'prev_text' => esc_html__( '« Previous' ), |
|
55 | - 'next_text' => esc_html__( 'Next »' ), |
|
54 | + 'prev_text' => esc_html__('« Previous'), |
|
55 | + 'next_text' => esc_html__('Next »'), |
|
56 | 56 | 'type' => 'plain', |
57 | 57 | 'add_args' => false, |
58 | 58 | 'add_fragment' => '', |
@@ -64,6 +64,6 @@ discard block |
||
64 | 64 | </div> |
65 | 65 | <?php else: ?> |
66 | 66 | <div class="wps-alert-info"> |
67 | - <?php _e( 'No email was sent.', 'wpshop' ); ?> |
|
67 | + <?php _e('No email was sent.', 'wpshop'); ?> |
|
68 | 68 | </div> |
69 | 69 | <?php endif; ?> |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | if( !empty($messages_histo) && is_array($messages_histo) ) :?> |
3 | 5 | <div class="wps-table wps-my-message"> |
4 | 6 | <div class="wps-table-header wps-table-row"> |
@@ -62,8 +64,11 @@ discard block |
||
62 | 64 | ); |
63 | 65 | ?> |
64 | 66 | </div> |
65 | -<?php else: ?> |
|
67 | +<?php else { |
|
68 | + : ?> |
|
66 | 69 | <div class="wps-alert-info"> |
67 | - <?php _e( 'No email was sent.', 'wpshop' ); ?> |
|
70 | + <?php _e( 'No email was sent.', 'wpshop' ); |
|
71 | +} |
|
72 | +?> |
|
68 | 73 | </div> |
69 | 74 | <?php endif; ?> |