@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | ?> |
3 | 5 | <span class="wps-mini-cart-body-title"> |
4 | 6 | <strong><?php echo $total_cart_item; ?></strong><?php _e( 'item(s)', 'wpshop'); ?><span><strong><?php echo number_format( $total_cart, 2, '.', ''); ?></strong><?php echo $currency; ?></span> |
@@ -12,8 +14,7 @@ discard block |
||
12 | 14 | $parent_post = $parent_def['parent_post']; |
13 | 15 | $item_id = $parent_post->ID; |
14 | 16 | $item_title = $parent_post->post_title; |
15 | - } |
|
16 | - else { |
|
17 | + } else { |
|
17 | 18 | $item_title = $item['item_name']; |
18 | 19 | } |
19 | 20 | ?> |
@@ -1,31 +1,31 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | |
3 | 3 | class wps_download_file_ctr { |
4 | 4 | public function __construct() { |
5 | - add_action( 'admin_post_download_file', array( $this, 'wpshop_download_file' ) ); |
|
5 | + add_action('admin_post_download_file', array($this, 'wpshop_download_file')); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | // Download product downloadable |
9 | 9 | public function wpshop_download_file() { |
10 | - $download = !empty( $_GET['download'] ) ? sanitize_text_field( $_GET['download'] ) : ''; |
|
11 | - $oid = !empty( $_GET['oid'] ) ? (int) $_GET['oid'] : 0; |
|
10 | + $download = !empty($_GET['download']) ? sanitize_text_field($_GET['download']) : ''; |
|
11 | + $oid = !empty($_GET['oid']) ? (int)$_GET['oid'] : 0; |
|
12 | 12 | |
13 | - if ( !empty( $download ) && !empty( $oid ) ) { |
|
13 | + if (!empty($download) && !empty($oid)) { |
|
14 | 14 | $variation_id = ''; |
15 | - if(is_user_logged_in()) { |
|
15 | + if (is_user_logged_in()) { |
|
16 | 16 | $user_id = get_current_user_id(); |
17 | 17 | $order = get_post_meta($oid, '_order_postmeta', true); |
18 | - if(!empty($order)) { |
|
19 | - $download_codes = get_user_meta($user_id, '_order_download_codes_'.$oid, true); |
|
20 | - if ( !empty($download_codes) && is_array($download_codes) ) { |
|
21 | - foreach ( $download_codes as $downloadable_product_id => $d ) { |
|
18 | + if (!empty($order)) { |
|
19 | + $download_codes = get_user_meta($user_id, '_order_download_codes_' . $oid, true); |
|
20 | + if (!empty($download_codes) && is_array($download_codes)) { |
|
21 | + foreach ($download_codes as $downloadable_product_id => $d) { |
|
22 | 22 | $is_encrypted = false; |
23 | - if ( $d['download_code'] == $download ) { |
|
24 | - wpshop_tools::create_custom_hook ('encrypt_actions_for_downloadable_product', array( 'order_id' => $oid, 'download_product_id' => $downloadable_product_id ) ); |
|
23 | + if ($d['download_code'] == $download) { |
|
24 | + wpshop_tools::create_custom_hook('encrypt_actions_for_downloadable_product', array('order_id' => $oid, 'download_product_id' => $downloadable_product_id)); |
|
25 | 25 | |
26 | - if ( get_post_type( $downloadable_product_id ) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION ) { |
|
27 | - $parent_def = wpshop_products::get_parent_variation( $downloadable_product_id ); |
|
28 | - if ( !empty($parent_def) && !empty($parent_def['parent_post']) ) { |
|
26 | + if (get_post_type($downloadable_product_id) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) { |
|
27 | + $parent_def = wpshop_products::get_parent_variation($downloadable_product_id); |
|
28 | + if (!empty($parent_def) && !empty($parent_def['parent_post'])) { |
|
29 | 29 | $parent_post = $parent_def['parent_post']; |
30 | 30 | $variation_id = $downloadable_product_id; |
31 | 31 | $downloadable_product_id = $parent_post->ID; |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | 'is_downloadable_', 'file_url', $order |
39 | 39 | ); |
40 | 40 | |
41 | - if ( $link !== false ) { |
|
41 | + if ($link !== false) { |
|
42 | 42 | $uploads = wp_upload_dir(); |
43 | 43 | $basedir = $uploads['basedir']; |
44 | 44 | $pos = strpos($link, 'uploads'); |
45 | - $link = $basedir.substr($link,$pos+7); |
|
45 | + $link = $basedir . substr($link, $pos + 7); |
|
46 | 46 | /** If plugin is encrypted **/ |
47 | - $encrypted_plugin_path = get_post_meta( $oid, '_download_file_path_'.$oid.'_'.( ( !empty( $variation_id ) && get_post_type( $variation_id ) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION ) ? $variation_id : $downloadable_product_id ), true); |
|
48 | - if ( !empty($encrypted_plugin_path) ) { |
|
49 | - $link = WPSHOP_UPLOAD_DIR.$encrypted_plugin_path; |
|
47 | + $encrypted_plugin_path = get_post_meta($oid, '_download_file_path_' . $oid . '_' . ((!empty($variation_id) && get_post_type($variation_id) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) ? $variation_id : $downloadable_product_id), true); |
|
48 | + if (!empty($encrypted_plugin_path)) { |
|
49 | + $link = WPSHOP_UPLOAD_DIR . $encrypted_plugin_path; |
|
50 | 50 | $is_encrypted = true; |
51 | 51 | } |
52 | 52 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | } |
60 | 60 | else { |
61 | - wp_redirect( get_permalink( wpshop_tools::get_page_id( get_option('wpshop_myaccount_page_id') ) ) ); |
|
61 | + wp_redirect(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id')))); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | echo __('Impossible to download the file you requested', 'wpshop'); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Plugin force download |
4 | 4 | * |
@@ -8,5 +8,5 @@ discard block |
||
8 | 8 | * @subpackage includes |
9 | 9 | */ |
10 | 10 | |
11 | -require_once( dirname( __FILE__ ) . '/controller/wps_download_file_ctr.php' ); |
|
11 | +require_once(dirname(__FILE__) . '/controller/wps_download_file_ctr.php'); |
|
12 | 12 | new wps_download_file_ctr(); |
13 | 13 | \ No newline at end of file |
@@ -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,8 +1,8 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | |
3 | 3 | /* Check if file is include. No direct access possible with file url */ |
4 | -if ( !defined( 'WPSHOP_VERSION' ) ) { |
|
5 | - die( __('Access is not allowed by this way', 'wpshop') ); |
|
4 | +if (!defined('WPSHOP_VERSION')) { |
|
5 | + die(__('Access is not allowed by this way', 'wpshop')); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | class wpshop_dashboard { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | <td class="first b"><a href="edit.php?post_type=<?php echo WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT; ?>"><?php |
31 | 31 | $num_posts = wp_count_posts(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT); |
32 | - $number_of_products = number_format_i18n( $num_posts->publish ); |
|
32 | + $number_of_products = number_format_i18n($num_posts->publish); |
|
33 | 33 | echo $number_of_products; |
34 | 34 | ?></a></td> |
35 | 35 | <td class="t"><a href="edit.php?post_type=<?php echo WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT; ?>"><?php _e('Products', 'wpshop'); ?></a></td> |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | if ($orders) { |
68 | 68 | foreach ($orders as $o) { |
69 | 69 | $order = get_post_meta($o->ID, '_order_postmeta', true); |
70 | - if(!empty($order['order_status'])){ |
|
71 | - switch($order['order_status']) { |
|
70 | + if (!empty($order['order_status'])) { |
|
71 | + switch ($order['order_status']) { |
|
72 | 72 | case 'completed': $order_completed++; break; |
73 | 73 | case 'shipped': $order_shipped++; break; |
74 | 74 | case 'awaiting_payment': $order_awaiting_payment++; break; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | <?php |
130 | 130 | // New customers |
131 | - $query = $wpdb->prepare('SELECT COUNT(*) FROM '.$wpdb->users.' WHERE user_registered > (NOW()-INTERVAL 7 DAY)', ''); |
|
131 | + $query = $wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->users . ' WHERE user_registered > (NOW()-INTERVAL 7 DAY)', ''); |
|
132 | 132 | $result = $wpdb->get_var($query); |
133 | 133 | ?> |
134 | 134 | <span class="alignright"><?php echo $result; ?></span> |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | <?php |
138 | 138 | // Number of customers who ordered |
139 | - $query = $wpdb->prepare('SELECT COUNT(DISTINCT post_author) FROM '.$wpdb->posts.' WHERE post_type="'.WPSHOP_NEWTYPE_IDENTIFIER_ORDER.'"', ''); |
|
139 | + $query = $wpdb->prepare('SELECT COUNT(DISTINCT post_author) FROM ' . $wpdb->posts . ' WHERE post_type="' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER . '"', ''); |
|
140 | 140 | $result = $wpdb->get_var($query); |
141 | 141 | ?> |
142 | 142 | <span class="alignright"><?php echo $result; ?></span> |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | $query = $wpdb->prepare("SELECT user_id, meta_value FROM " . $wpdb->usermeta . " WHERE meta_key = %s", 'user_preferences'); |
148 | 148 | $user_preferences = $wpdb->get_results($query); |
149 | 149 | $nb_of_customer_for_newsletter = $nb_of_customer_for_newsletter_partners = 0; |
150 | - foreach ( $user_preferences as $meta_values ) { |
|
151 | - $user_prefs = unserialize( $meta_values->meta_value ); |
|
150 | + foreach ($user_preferences as $meta_values) { |
|
151 | + $user_prefs = unserialize($meta_values->meta_value); |
|
152 | 152 | |
153 | - if ( !empty($user_prefs['newsletters_site']) && $user_prefs['newsletters_site'] ) { |
|
153 | + if (!empty($user_prefs['newsletters_site']) && $user_prefs['newsletters_site']) { |
|
154 | 154 | $nb_of_customer_for_newsletter++; |
155 | 155 | } |
156 | - else if ( !empty($user_prefs['newsletters_site_partners']) && $user_prefs['newsletters_site_partners'] ) { |
|
156 | + else if (!empty($user_prefs['newsletters_site_partners']) && $user_prefs['newsletters_site_partners']) { |
|
157 | 157 | $nb_of_customer_for_newsletter_partners++; |
158 | 158 | } |
159 | 159 | } |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | <h3 class="hndle"><span><?php _e('Quick Links', 'wpshop') ?></span></h3> |
172 | 172 | <div class="inside"> |
173 | 173 | <ul id="wps_dashboard_quick_links"> |
174 | - <li><a href="<?php echo admin_url( 'post-new.php?post_type=wpshop_product' ); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>icon_create_product.jpg" alt="<?php _e( 'Create a new product', 'wpshop'); ?>" /><br/><?php _e('Create a product', 'wpshop'); ?></a></li> |
|
175 | - <li><a href="<?php echo admin_url( 'post-new.php?post_type=wpshop_shop_order' ); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>icon_create_order.jpg" alt="<?php _e( 'Create order', 'wpshop'); ?>" /><br/><?php _e('Create an order', 'wpshop'); ?></a></li> |
|
176 | - <li><a href="<?php echo admin_url( 'post-new.php?post_type=wpshop_shop_coupon' ); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>icon_create_coupon.jpg" alt="<?php _e( 'Create a coupon', 'wpshop'); ?>" /><br/><?php _e('Create a coupon', 'wpshop'); ?></a></li> |
|
177 | - <li><a href="<?php echo admin_url( 'admin.php?page=wpshop_statistics' ); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>icon_statistics.jpg" alt="<?php _e( 'Statistics', 'wpshop'); ?>" /><br/><?php _e('Statistics', 'wpshop'); ?></a></li> |
|
174 | + <li><a href="<?php echo admin_url('post-new.php?post_type=wpshop_product'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>icon_create_product.jpg" alt="<?php _e('Create a new product', 'wpshop'); ?>" /><br/><?php _e('Create a product', 'wpshop'); ?></a></li> |
|
175 | + <li><a href="<?php echo admin_url('post-new.php?post_type=wpshop_shop_order'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>icon_create_order.jpg" alt="<?php _e('Create order', 'wpshop'); ?>" /><br/><?php _e('Create an order', 'wpshop'); ?></a></li> |
|
176 | + <li><a href="<?php echo admin_url('post-new.php?post_type=wpshop_shop_coupon'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>icon_create_coupon.jpg" alt="<?php _e('Create a coupon', 'wpshop'); ?>" /><br/><?php _e('Create a coupon', 'wpshop'); ?></a></li> |
|
177 | + <li><a href="<?php echo admin_url('admin.php?page=wpshop_statistics'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>icon_statistics.jpg" alt="<?php _e('Statistics', 'wpshop'); ?>" /><br/><?php _e('Statistics', 'wpshop'); ?></a></li> |
|
178 | 178 | </ul> |
179 | 179 | <?php |
180 | 180 | // Number of products on sale |
@@ -257,15 +257,15 @@ discard block |
||
257 | 257 | <?php |
258 | 258 | global $current_month_offset; |
259 | 259 | |
260 | - $current_month_offset = (isset($_GET['month'])) ? (int) $_GET['month'] : (int) date('m'); |
|
260 | + $current_month_offset = (isset($_GET['month'])) ? (int)$_GET['month'] : (int)date('m'); |
|
261 | 261 | |
262 | 262 | ?> |
263 | 263 | <div class="postbox stats" id="wpshop-stats"> |
264 | 264 | <h3 class="hndle"> |
265 | - <?php if ($current_month_offset!=date('m')) : ?> |
|
266 | - <a href="admin.php?page=wpshop_dashboard&month=<?php echo $current_month_offset+1; ?>" class="next"><?php echo __('Next Month','wpshop'); ?> →</a> |
|
265 | + <?php if ($current_month_offset != date('m')) : ?> |
|
266 | + <a href="admin.php?page=wpshop_dashboard&month=<?php echo $current_month_offset + 1; ?>" class="next"><?php echo __('Next Month', 'wpshop'); ?> →</a> |
|
267 | 267 | <?php endif; ?> |
268 | - <a href="admin.php?page=wpshop_dashboard&month=<?php echo $current_month_offset-1; ?>" class="previous">← <?php echo __('Previous Month','wpshop'); ?></a> |
|
268 | + <a href="admin.php?page=wpshop_dashboard&month=<?php echo $current_month_offset - 1; ?>" class="previous">← <?php echo __('Previous Month', 'wpshop'); ?></a> |
|
269 | 269 | <span><?php _e('Monthly Sales', 'wpshop') ?></span></h3> |
270 | 270 | <div class="inside"> |
271 | 271 | <div id="placeholder" style="width:100%; height:300px; position:relative;"></div> |
@@ -295,11 +295,11 @@ discard block |
||
295 | 295 | |
296 | 296 | <?php |
297 | 297 | |
298 | - function orders_this_month( $where = '' ) { |
|
298 | + function orders_this_month($where = '') { |
|
299 | 299 | global $current_month_offset; |
300 | 300 | |
301 | 301 | $month = $current_month_offset; |
302 | - $year = (int) date('Y'); |
|
302 | + $year = (int)date('Y'); |
|
303 | 303 | |
304 | 304 | $first_day = strtotime("{$year}-{$month}-01"); |
305 | 305 | $last_day = strtotime('-1 second', strtotime('+1 month', $first_day)); |
@@ -312,29 +312,29 @@ discard block |
||
312 | 312 | |
313 | 313 | return $where; |
314 | 314 | } |
315 | - add_filter( 'posts_where', 'orders_this_month' ); |
|
315 | + add_filter('posts_where', 'orders_this_month'); |
|
316 | 316 | |
317 | 317 | $args = array( |
318 | 318 | 'numberposts' => -1, |
319 | 319 | 'orderby' => 'post_date', |
320 | 320 | 'order' => 'DESC', |
321 | 321 | 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, |
322 | - 'post_status' => 'publish' , |
|
322 | + 'post_status' => 'publish', |
|
323 | 323 | 'suppress_filters' => false |
324 | 324 | ); |
325 | - $orders = get_posts( $args ); |
|
325 | + $orders = get_posts($args); |
|
326 | 326 | |
327 | 327 | $order_counts = array(); |
328 | 328 | $order_amounts = array(); |
329 | 329 | |
330 | 330 | // Blank date ranges to begin |
331 | 331 | $month = $current_month_offset; |
332 | - $year = (int) date('Y'); |
|
332 | + $year = (int)date('Y'); |
|
333 | 333 | |
334 | 334 | $first_day = strtotime("{$year}-{$month}-01"); |
335 | 335 | $last_day = strtotime('-1 second', strtotime('+1 month', $first_day)); |
336 | 336 | |
337 | - if ((date('m') - $current_month_offset)==0) : |
|
337 | + if ((date('m') - $current_month_offset) == 0) : |
|
338 | 338 | $up_to = date('d', strtotime('NOW')); |
339 | 339 | else : |
340 | 340 | $up_to = date('d', $last_day); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | while ($count < $up_to) : |
345 | 345 | |
346 | - $time = strtotime(date('Ymd', strtotime('+ '.$count.' DAY', $first_day))).'000'; |
|
346 | + $time = strtotime(date('Ymd', strtotime('+ ' . $count . ' DAY', $first_day))) . '000'; |
|
347 | 347 | |
348 | 348 | $order_counts[$time] = 0; |
349 | 349 | $order_amounts[$time] = 0; |
@@ -356,9 +356,9 @@ discard block |
||
356 | 356 | |
357 | 357 | $order_data = get_post_meta($order->ID, '_order_postmeta', true); |
358 | 358 | |
359 | - if ($order_data['order_status']=='denied' || $order_data['order_status']=='awaiting_payment') continue; |
|
359 | + if ($order_data['order_status'] == 'denied' || $order_data['order_status'] == 'awaiting_payment') continue; |
|
360 | 360 | |
361 | - $time = strtotime(date('Ymd', strtotime($order_data['order_date']))).'000'; |
|
361 | + $time = strtotime(date('Ymd', strtotime($order_data['order_date']))) . '000'; |
|
362 | 362 | |
363 | 363 | $order_grand_total = !empty($order_data['order_grand_total']) ? $order_data['order_grand_total'] : 0; |
364 | 364 | |
@@ -366,12 +366,12 @@ discard block |
||
366 | 366 | else : $order_counts[$time] = 1; endif; |
367 | 367 | |
368 | 368 | if (isset($order_amounts[$time])) $order_amounts[$time] = $order_amounts[$time] + $order_grand_total; |
369 | - else $order_amounts[$time] = (float) $order_grand_total; |
|
369 | + else $order_amounts[$time] = (float)$order_grand_total; |
|
370 | 370 | |
371 | 371 | endforeach; |
372 | 372 | endif; |
373 | 373 | |
374 | - remove_filter( 'posts_where', 'orders_this_month' ); |
|
374 | + remove_filter('posts_where', 'orders_this_month'); |
|
375 | 375 | ?> |
376 | 376 | |
377 | 377 | var d = [ |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | |
395 | 395 | for (var i = 0; i < d2.length; ++i) d2[i][0] += 60 * 60 * 1000; |
396 | 396 | |
397 | - var plot = jQuery.plot(jQuery("#placeholder"), [ { label: "<?php echo __('Number of sales','wpshop'); ?>", data: d }, { label: "<?php echo __('Sales amount','wpshop'); ?>", data: d2, yaxis: 2 } ], { |
|
397 | + var plot = jQuery.plot(jQuery("#placeholder"), [ { label: "<?php echo __('Number of sales', 'wpshop'); ?>", data: d }, { label: "<?php echo __('Sales amount', 'wpshop'); ?>", data: d2, yaxis: 2 } ], { |
|
398 | 398 | series: { |
399 | 399 | lines: { show: true }, |
400 | 400 | points: { show: true } |
@@ -441,10 +441,10 @@ discard block |
||
441 | 441 | |
442 | 442 | jQuery("#tooltip").remove(); |
443 | 443 | |
444 | - if (item.series.label=="<?php echo __('Number of sales','wpshop'); ?>") { |
|
444 | + if (item.series.label=="<?php echo __('Number of sales', 'wpshop'); ?>") { |
|
445 | 445 | |
446 | 446 | var y = item.datapoint[1]; |
447 | - showTooltip(item.pageX, item.pageY, y+" <?php echo __('sales','wpshop'); ?>"); |
|
447 | + showTooltip(item.pageX, item.pageY, y+" <?php echo __('sales', 'wpshop'); ?>"); |
|
448 | 448 | |
449 | 449 | } else { |
450 | 450 | |
@@ -490,13 +490,13 @@ discard block |
||
490 | 490 | <label><?php _e('Number of active order', 'wpshop'); ?></label><br /> |
491 | 491 | |
492 | 492 | <?php |
493 | - $result=0; |
|
493 | + $result = 0; |
|
494 | 494 | // Number of orders the last 7 days |
495 | - $query = $wpdb->prepare('SELECT ID FROM '.$wpdb->posts.' WHERE post_type="'.WPSHOP_NEWTYPE_IDENTIFIER_ORDER.'" AND post_date > (NOW()-INTERVAL 7 DAY)', ''); |
|
495 | + $query = $wpdb->prepare('SELECT ID FROM ' . $wpdb->posts . ' WHERE post_type="' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER . '" AND post_date > (NOW()-INTERVAL 7 DAY)', ''); |
|
496 | 496 | $data = $wpdb->get_results($query, ARRAY_A); |
497 | - foreach($data as $d) { |
|
497 | + foreach ($data as $d) { |
|
498 | 498 | $postmeta = get_post_meta($d['ID'], '_order_postmeta', true); |
499 | - if(!empty($postmeta) && !empty($postmeta['order_key']) && substr($postmeta['order_key'],0,2)=='OR') |
|
499 | + if (!empty($postmeta) && !empty($postmeta['order_key']) && substr($postmeta['order_key'], 0, 2) == 'OR') |
|
500 | 500 | $result++; |
501 | 501 | } |
502 | 502 | ?> |
@@ -504,17 +504,17 @@ discard block |
||
504 | 504 | <label><?php _e('Number of orders the last 7 days', 'wpshop'); ?></label><br /> |
505 | 505 | |
506 | 506 | <?php |
507 | - $result=0; |
|
507 | + $result = 0; |
|
508 | 508 | // Number of orders the last 7 days |
509 | - $query = $wpdb->prepare('SELECT ID FROM '.$wpdb->posts.' WHERE post_type="'.WPSHOP_NEWTYPE_IDENTIFIER_ORDER.'" AND post_date > (NOW()-INTERVAL 7 DAY)', ''); |
|
509 | + $query = $wpdb->prepare('SELECT ID FROM ' . $wpdb->posts . ' WHERE post_type="' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER . '" AND post_date > (NOW()-INTERVAL 7 DAY)', ''); |
|
510 | 510 | $data = $wpdb->get_results($query, ARRAY_A); |
511 | - foreach($data as $d) { |
|
511 | + foreach ($data as $d) { |
|
512 | 512 | $postmeta = get_post_meta($d['ID'], '_order_postmeta', true); |
513 | - if(!empty($postmeta) && !empty($postmeta['order_grand_total'])) |
|
514 | - $result+=$postmeta['order_grand_total']; |
|
513 | + if (!empty($postmeta) && !empty($postmeta['order_grand_total'])) |
|
514 | + $result += $postmeta['order_grand_total']; |
|
515 | 515 | } |
516 | - if(count($data)>0) |
|
517 | - $result = round($result/count($data),2); |
|
516 | + if (count($data) > 0) |
|
517 | + $result = round($result / count($data), 2); |
|
518 | 518 | ?> |
519 | 519 | <span class="alignright"><?php echo wpshop_tools::wpshop_get_currency(); ?> <?php echo $result; ?></span> |
520 | 520 | <label><?php _e('Cart price average', 'wpshop'); ?></label> |
@@ -529,9 +529,9 @@ discard block |
||
529 | 529 | <table width="100%"> |
530 | 530 | <tr> |
531 | 531 | <td><?php self::wpshop_rss_tutorial_videos(); ?></td> |
532 | - <td valign="top" cellpadding="20" ><h2 class="wps_dashboard"><?php _e('Need help with WPShop', 'wpshop' ); ?> ?</h2> |
|
533 | - <p><?php _e( 'You need help with WPShop ? You some questions ?', 'wpshop' ); ?></p> |
|
534 | - <p><h3 class="wps_dashboard"><?php _e( 'Two solutions', 'wpshop'); ?></h3></p> |
|
532 | + <td valign="top" cellpadding="20" ><h2 class="wps_dashboard"><?php _e('Need help with WPShop', 'wpshop'); ?> ?</h2> |
|
533 | + <p><?php _e('You need help with WPShop ? You some questions ?', 'wpshop'); ?></p> |
|
534 | + <p><h3 class="wps_dashboard"><?php _e('Two solutions', 'wpshop'); ?></h3></p> |
|
535 | 535 | <p><center><br/><a href="http://shop.eoxia.com/ecommerce/modules-wpshop/assistance/" title="<?php _e('WPShop Assistance', 'wpshop'); ?>" target="_blank"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>assistance_wpshop.jpg" alt="<?php _e('WPShop Assistance', 'wpshop'); ?>" /></a><br/> |
536 | 536 | <a href="http://forums.eoxia.com/" title="<?php _e('WPShop Forum', 'wpshop'); ?>" target="_blank"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>forum_wpshop.jpg" alt="<?php _e('WPShop Forum', 'wpshop'); ?>" /></a></center></p> |
537 | 537 | </td> |
@@ -575,44 +575,44 @@ discard block |
||
575 | 575 | |
576 | 576 | function wpshop_dashboard_orders() { |
577 | 577 | $output = ''; |
578 | - $orders = get_posts( array( 'posts_per_page' => 10, 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'post_status' => 'publish', 'orderby' => 'post_date', 'order' => 'DESC') ); |
|
579 | - if ( !empty($orders) ) { |
|
580 | - $payment_status = unserialize( WPSHOP_ORDER_STATUS ); |
|
578 | + $orders = get_posts(array('posts_per_page' => 10, 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'post_status' => 'publish', 'orderby' => 'post_date', 'order' => 'DESC')); |
|
579 | + if (!empty($orders)) { |
|
580 | + $payment_status = unserialize(WPSHOP_ORDER_STATUS); |
|
581 | 581 | |
582 | 582 | $output .= '<table id="wps_dashboard_orders_summary">'; |
583 | - $output .= '<tr><th class="wps_dashboard_order_date">' .__('Date', 'wpshop'). '</th><th class="wps_dashboard_order_customer_name">' .__('Customer', 'wpshop'). '</th><th class="wps_dashboard_order_amount">' .__('Amount', 'wpshop'). '</th><th class="wps_dashboard_order_status">' .__('Status', 'wpshop'). '</th><th class="wps_dashboard_order_actions"></th></tr>'; |
|
583 | + $output .= '<tr><th class="wps_dashboard_order_date">' . __('Date', 'wpshop') . '</th><th class="wps_dashboard_order_customer_name">' . __('Customer', 'wpshop') . '</th><th class="wps_dashboard_order_amount">' . __('Amount', 'wpshop') . '</th><th class="wps_dashboard_order_status">' . __('Status', 'wpshop') . '</th><th class="wps_dashboard_order_actions"></th></tr>'; |
|
584 | 584 | $stried = false; |
585 | - foreach( $orders as $order ) { |
|
586 | - $stried = ( $stried == false ) ? true : false; |
|
585 | + foreach ($orders as $order) { |
|
586 | + $stried = ($stried == false) ? true : false; |
|
587 | 587 | $additionnal_class = ($stried) ? 'wps_stried_line' : ''; |
588 | - $output .= '<tr class="' .$additionnal_class. '">'; |
|
589 | - $order_meta = get_post_meta( $order->ID, '_order_postmeta', true ); |
|
590 | - $order_info = get_post_meta( $order->ID, '_order_info', true ); |
|
588 | + $output .= '<tr class="' . $additionnal_class . '">'; |
|
589 | + $order_meta = get_post_meta($order->ID, '_order_postmeta', true); |
|
590 | + $order_info = get_post_meta($order->ID, '_order_info', true); |
|
591 | 591 | |
592 | - if ( !empty($order_meta) ) { |
|
593 | - $output .= '<td>' .( (!empty($order_meta) && !empty($order_meta['order_date']) ) ? date( 'd-m-Y', strtotime($order_meta['order_date']) ): '' ). '</td>'; |
|
594 | - $output .= '<td>' .( (!empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']) && !empty($order_info['billing']['address']['address_last_name']) && !empty($order_info['billing']['address']['address_first_name']) ) ? strtoupper($order_info['billing']['address']['address_last_name']).' '.$order_info['billing']['address']['address_first_name']: '' ). '</td>'; |
|
592 | + if (!empty($order_meta)) { |
|
593 | + $output .= '<td>' . ((!empty($order_meta) && !empty($order_meta['order_date'])) ? date('d-m-Y', strtotime($order_meta['order_date'])) : '') . '</td>'; |
|
594 | + $output .= '<td>' . ((!empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']) && !empty($order_info['billing']['address']['address_last_name']) && !empty($order_info['billing']['address']['address_first_name'])) ? strtoupper($order_info['billing']['address']['address_last_name']) . ' ' . $order_info['billing']['address']['address_first_name'] : '') . '</td>'; |
|
595 | 595 | |
596 | - $output .= '<td>' .( (!empty($order_meta['order_grand_total']) ) ? number_format( $order_meta['order_grand_total'], 2, '.', '' ).' '.wpshop_tools::wpshop_get_currency( false ) : '-' ). '</td>'; |
|
597 | - $output .= '<td><span class="wps_dashboard_' .$order_meta['order_status']. '">' .__($payment_status[ $order_meta['order_status'] ], 'wpshop' ). '</span></td>'; |
|
596 | + $output .= '<td>' . ((!empty($order_meta['order_grand_total'])) ? number_format($order_meta['order_grand_total'], 2, '.', '') . ' ' . wpshop_tools::wpshop_get_currency(false) : '-') . '</td>'; |
|
597 | + $output .= '<td><span class="wps_dashboard_' . $order_meta['order_status'] . '">' . __($payment_status[$order_meta['order_status']], 'wpshop') . '</span></td>'; |
|
598 | 598 | $output .= '<td>'; |
599 | - $output .= '<a href="' .admin_url('/post.php?post=' .$order->ID. '&action=edit'). '"><img src="' .WPSHOP_MEDIAS_ICON_URL. 'icon_loupe.png" alt="' .__('See', 'wpshop'). '" /></a>'; |
|
599 | + $output .= '<a href="' . admin_url('/post.php?post=' . $order->ID . '&action=edit') . '"><img src="' . WPSHOP_MEDIAS_ICON_URL . 'icon_loupe.png" alt="' . __('See', 'wpshop') . '" /></a>'; |
|
600 | 600 | |
601 | 601 | $invoice_ref = ''; |
602 | - if ( !empty($order_meta['order_invoice_ref']) ) { |
|
602 | + if (!empty($order_meta['order_invoice_ref'])) { |
|
603 | 603 | $invoice_ref = $order_meta['order_invoice_ref']; |
604 | 604 | } |
605 | - if ( !empty($invoice_ref) ) { |
|
606 | - if( !empty($order_meta) && !empty($order_meta['order_payment']) && !empty($order_meta['order_payment']['received']) ) { |
|
607 | - $invoice_ref = $order_meta['order_payment']['received'][ count($order_meta['order_payment']['received']) - 1 ]['invoice_ref']; |
|
605 | + if (!empty($invoice_ref)) { |
|
606 | + if (!empty($order_meta) && !empty($order_meta['order_payment']) && !empty($order_meta['order_payment']['received'])) { |
|
607 | + $invoice_ref = $order_meta['order_payment']['received'][count($order_meta['order_payment']['received']) - 1]['invoice_ref']; |
|
608 | 608 | } |
609 | 609 | } |
610 | 610 | |
611 | - if ( ( $order_meta['order_status'] == 'partially_paid' || $order_meta['order_status'] == 'completed' || $order_meta['order_status'] == 'shipped' ) && !empty($invoice_ref) ) { |
|
612 | - $output .= ' <a href="' .WPSHOP_TEMPLATES_URL. 'invoice.php?order_id=' .$order->ID. '&invoice_ref&=' .$invoice_ref. '&mode=pdf"><img src="' .WPSHOP_MEDIAS_ICON_URL. 'icon_invoice.png" alt="' .__('Invoice', 'wpshop'). '" /></a>'; |
|
611 | + if (($order_meta['order_status'] == 'partially_paid' || $order_meta['order_status'] == 'completed' || $order_meta['order_status'] == 'shipped') && !empty($invoice_ref)) { |
|
612 | + $output .= ' <a href="' . WPSHOP_TEMPLATES_URL . 'invoice.php?order_id=' . $order->ID . '&invoice_ref&=' . $invoice_ref . '&mode=pdf"><img src="' . WPSHOP_MEDIAS_ICON_URL . 'icon_invoice.png" alt="' . __('Invoice', 'wpshop') . '" /></a>'; |
|
613 | 613 | } |
614 | - if ( $order_meta['order_status'] == 'shipped' ) { |
|
615 | - $output .= ' <a href="'.WPSHOP_TEMPLATES_URL. 'invoice.php?order_id=' .$order->ID. '&bon_colisage=ok&mode=pdf"><img src="' .WPSHOP_MEDIAS_ICON_URL. 'bon_colisage_icon.png" alt="' .__('Shipping Slip', 'wpshop'). '" /></a>'; |
|
614 | + if ($order_meta['order_status'] == 'shipped') { |
|
615 | + $output .= ' <a href="' . WPSHOP_TEMPLATES_URL . 'invoice.php?order_id=' . $order->ID . '&bon_colisage=ok&mode=pdf"><img src="' . WPSHOP_MEDIAS_ICON_URL . 'bon_colisage_icon.png" alt="' . __('Shipping Slip', 'wpshop') . '" /></a>'; |
|
616 | 616 | } |
617 | 617 | $output .= '</td>'; |
618 | 618 | } |
@@ -626,24 +626,24 @@ discard block |
||
626 | 626 | |
627 | 627 | function wpshop_rss_feed() { |
628 | 628 | $output = ''; |
629 | - include_once( ABSPATH . WPINC . '/feed.php' ); |
|
629 | + include_once(ABSPATH . WPINC . '/feed.php'); |
|
630 | 630 | |
631 | - $rss = fetch_feed( 'http://www.wpshop.fr/feed/' ); |
|
632 | - if( ! is_wp_error( $rss ) ){ |
|
633 | - $maxitems = $rss->get_item_quantity( 4 ); |
|
634 | - $rss_items = $rss->get_items( 0, $maxitems ); |
|
631 | + $rss = fetch_feed('http://www.wpshop.fr/feed/'); |
|
632 | + if (!is_wp_error($rss)) { |
|
633 | + $maxitems = $rss->get_item_quantity(4); |
|
634 | + $rss_items = $rss->get_items(0, $maxitems); |
|
635 | 635 | } |
636 | 636 | else { |
637 | 637 | $output .= '<p>' . __('WPShop News cannot be loaded', 'wpshop') . '</p>'; |
638 | 638 | } |
639 | 639 | |
640 | - if ( $maxitems == 0 ) { |
|
640 | + if ($maxitems == 0) { |
|
641 | 641 | $output .= '<p>' . __('No WPShop new has been found', 'wpshop') . '</p>'; |
642 | 642 | } |
643 | 643 | else { |
644 | 644 | $output .= '<ul class="recent-orders">'; |
645 | - foreach ( $rss_items as $item ) { |
|
646 | - $output .= '<li><a href="' .$item->get_permalink() . '" title="' .$item->get_title(). '" target="_blank">' .$item->get_title(). '</a><br/>'; |
|
645 | + foreach ($rss_items as $item) { |
|
646 | + $output .= '<li><a href="' . $item->get_permalink() . '" title="' . $item->get_title() . '" target="_blank">' . $item->get_title() . '</a><br/>'; |
|
647 | 647 | $output .= $item->get_content(); |
648 | 648 | $output .= '</li>'; |
649 | 649 | } |
@@ -654,39 +654,39 @@ discard block |
||
654 | 654 | |
655 | 655 | |
656 | 656 | function wpshop_rss_tutorial_videos() { |
657 | - $ini_get_checking = ini_get( 'allow_url_fopen' ); |
|
658 | - if ( $ini_get_checking != 0 ) { |
|
657 | + $ini_get_checking = ini_get('allow_url_fopen'); |
|
658 | + if ($ini_get_checking != 0) { |
|
659 | 659 | $content = file_get_contents('http://www.wpshop.fr/rss_video.xml'); |
660 | 660 | $videos_rss = new SimpleXmlElement($content); |
661 | - if ( !empty($videos_rss) && !empty($videos_rss->channel) ) { |
|
661 | + if (!empty($videos_rss) && !empty($videos_rss->channel)) { |
|
662 | 662 | $videos_items = array(); |
663 | - foreach( $videos_rss->channel->item as $i => $item ) { |
|
663 | + foreach ($videos_rss->channel->item as $i => $item) { |
|
664 | 664 | $videos_items[] = $item; |
665 | 665 | } |
666 | - $rand_element = array_rand( $videos_items ); |
|
666 | + $rand_element = array_rand($videos_items); |
|
667 | 667 | $output = '<div class="wps_dashboard_video_container">'; |
668 | - $output .= '<div class="wps_dashboard_video_title">' .$videos_items[ $rand_element ]->title. '</div>'; |
|
669 | - $output .= '<div class="wps_dashboard_video"><iframe width="400" height="290" src="' .$videos_items[ $rand_element ]->embed_link. '" frameborder="0" allowfullscreen></iframe></div>'; |
|
670 | - $output .= '<div class="wps_dashboard_video_description">' .$videos_items[ $rand_element ]->description. '</div>'; |
|
668 | + $output .= '<div class="wps_dashboard_video_title">' . $videos_items[$rand_element]->title . '</div>'; |
|
669 | + $output .= '<div class="wps_dashboard_video"><iframe width="400" height="290" src="' . $videos_items[$rand_element]->embed_link . '" frameborder="0" allowfullscreen></iframe></div>'; |
|
670 | + $output .= '<div class="wps_dashboard_video_description">' . $videos_items[$rand_element]->description . '</div>'; |
|
671 | 671 | $output .= '</div>'; |
672 | 672 | |
673 | 673 | } |
674 | 674 | else { |
675 | - $output =__('No tutorial videos can be loaded', 'wpshop' ); |
|
675 | + $output = __('No tutorial videos can be loaded', 'wpshop'); |
|
676 | 676 | } |
677 | 677 | } |
678 | 678 | else { |
679 | - $output = __( 'Your servor doesn\'t allow to open external files', 'wpshop'); |
|
679 | + $output = __('Your servor doesn\'t allow to open external files', 'wpshop'); |
|
680 | 680 | } |
681 | 681 | echo $output; |
682 | 682 | } |
683 | 683 | |
684 | 684 | function wpshop_dashboard_get_changelog() { |
685 | - $readme_file = fopen( WPSHOP_DIR.'/readme.txt', 'r' ); |
|
686 | - if ( $readme_file ) { |
|
687 | - $txt = file_get_contents( WPSHOP_DIR.'/readme.txt' ); |
|
688 | - $pre_change_log = explode( '== Changelog ==', $txt ); |
|
689 | - $versions = explode( '= Version', $pre_change_log[1] ); |
|
685 | + $readme_file = fopen(WPSHOP_DIR . '/readme.txt', 'r'); |
|
686 | + if ($readme_file) { |
|
687 | + $txt = file_get_contents(WPSHOP_DIR . '/readme.txt'); |
|
688 | + $pre_change_log = explode('== Changelog ==', $txt); |
|
689 | + $versions = explode('= Version', $pre_change_log[1]); |
|
690 | 690 | |
691 | 691 | echo $versions[1]; |
692 | 692 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /* Check if file is include. No direct access possible with file url */ |
4 | 6 | if ( !defined( 'WPSHOP_VERSION' ) ) { |
@@ -152,8 +154,7 @@ discard block |
||
152 | 154 | |
153 | 155 | if ( !empty($user_prefs['newsletters_site']) && $user_prefs['newsletters_site'] ) { |
154 | 156 | $nb_of_customer_for_newsletter++; |
155 | - } |
|
156 | - else if ( !empty($user_prefs['newsletters_site_partners']) && $user_prefs['newsletters_site_partners'] ) { |
|
157 | + } else if ( !empty($user_prefs['newsletters_site_partners']) && $user_prefs['newsletters_site_partners'] ) { |
|
157 | 158 | $nb_of_customer_for_newsletter_partners++; |
158 | 159 | } |
159 | 160 | } |
@@ -336,8 +337,10 @@ discard block |
||
336 | 337 | |
337 | 338 | if ((date('m') - $current_month_offset)==0) : |
338 | 339 | $up_to = date('d', strtotime('NOW')); |
339 | - else : |
|
340 | + else { |
|
341 | + : |
|
340 | 342 | $up_to = date('d', $last_day); |
343 | + } |
|
341 | 344 | endif; |
342 | 345 | $count = 0; |
343 | 346 | |
@@ -356,17 +359,25 @@ discard block |
||
356 | 359 | |
357 | 360 | $order_data = get_post_meta($order->ID, '_order_postmeta', true); |
358 | 361 | |
359 | - if ($order_data['order_status']=='denied' || $order_data['order_status']=='awaiting_payment') continue; |
|
362 | + if ($order_data['order_status']=='denied' || $order_data['order_status']=='awaiting_payment') { |
|
363 | + continue; |
|
364 | + } |
|
360 | 365 | |
361 | 366 | $time = strtotime(date('Ymd', strtotime($order_data['order_date']))).'000'; |
362 | 367 | |
363 | 368 | $order_grand_total = !empty($order_data['order_grand_total']) ? $order_data['order_grand_total'] : 0; |
364 | 369 | |
365 | 370 | if (isset($order_counts[$time])) : $order_counts[$time]++; |
366 | - else : $order_counts[$time] = 1; endif; |
|
371 | + else { |
|
372 | + : $order_counts[$time] = 1; |
|
373 | + } |
|
374 | + endif; |
|
367 | 375 | |
368 | - if (isset($order_amounts[$time])) $order_amounts[$time] = $order_amounts[$time] + $order_grand_total; |
|
369 | - else $order_amounts[$time] = (float) $order_grand_total; |
|
376 | + if (isset($order_amounts[$time])) { |
|
377 | + $order_amounts[$time] = $order_amounts[$time] + $order_grand_total; |
|
378 | + } else { |
|
379 | + $order_amounts[$time] = (float) $order_grand_total; |
|
380 | + } |
|
370 | 381 | |
371 | 382 | endforeach; |
372 | 383 | endif; |
@@ -377,7 +388,9 @@ discard block |
||
377 | 388 | var d = [ |
378 | 389 | <?php |
379 | 390 | $values = array(); |
380 | - foreach ($order_counts as $key => $value) $values[] = "[$key, $value]"; |
|
391 | + foreach ($order_counts as $key => $value) { |
|
392 | + $values[] = "[$key, $value]"; |
|
393 | + } |
|
381 | 394 | echo implode(',', $values); |
382 | 395 | ?> |
383 | 396 | ]; |
@@ -387,7 +400,9 @@ discard block |
||
387 | 400 | var d2 = [ |
388 | 401 | <?php |
389 | 402 | $values = array(); |
390 | - foreach ($order_amounts as $key => $value) $values[] = "[$key, $value]"; |
|
403 | + foreach ($order_amounts as $key => $value) { |
|
404 | + $values[] = "[$key, $value]"; |
|
405 | + } |
|
391 | 406 | echo implode(',', $values); |
392 | 407 | ?> |
393 | 408 | ]; |
@@ -496,8 +511,9 @@ discard block |
||
496 | 511 | $data = $wpdb->get_results($query, ARRAY_A); |
497 | 512 | foreach($data as $d) { |
498 | 513 | $postmeta = get_post_meta($d['ID'], '_order_postmeta', true); |
499 | - if(!empty($postmeta) && !empty($postmeta['order_key']) && substr($postmeta['order_key'],0,2)=='OR') |
|
500 | - $result++; |
|
514 | + if(!empty($postmeta) && !empty($postmeta['order_key']) && substr($postmeta['order_key'],0,2)=='OR') { |
|
515 | + $result++; |
|
516 | + } |
|
501 | 517 | } |
502 | 518 | ?> |
503 | 519 | <span class="alignright"><?php echo $result; ?></span> |
@@ -510,11 +526,13 @@ discard block |
||
510 | 526 | $data = $wpdb->get_results($query, ARRAY_A); |
511 | 527 | foreach($data as $d) { |
512 | 528 | $postmeta = get_post_meta($d['ID'], '_order_postmeta', true); |
513 | - if(!empty($postmeta) && !empty($postmeta['order_grand_total'])) |
|
514 | - $result+=$postmeta['order_grand_total']; |
|
529 | + if(!empty($postmeta) && !empty($postmeta['order_grand_total'])) { |
|
530 | + $result+=$postmeta['order_grand_total']; |
|
531 | + } |
|
532 | + } |
|
533 | + if(count($data)>0) { |
|
534 | + $result = round($result/count($data),2); |
|
515 | 535 | } |
516 | - if(count($data)>0) |
|
517 | - $result = round($result/count($data),2); |
|
518 | 536 | ?> |
519 | 537 | <span class="alignright"><?php echo wpshop_tools::wpshop_get_currency(); ?> <?php echo $result; ?></span> |
520 | 538 | <label><?php _e('Cart price average', 'wpshop'); ?></label> |
@@ -632,15 +650,13 @@ discard block |
||
632 | 650 | if( ! is_wp_error( $rss ) ){ |
633 | 651 | $maxitems = $rss->get_item_quantity( 4 ); |
634 | 652 | $rss_items = $rss->get_items( 0, $maxitems ); |
635 | - } |
|
636 | - else { |
|
653 | + } else { |
|
637 | 654 | $output .= '<p>' . __('WPShop News cannot be loaded', 'wpshop') . '</p>'; |
638 | 655 | } |
639 | 656 | |
640 | 657 | if ( $maxitems == 0 ) { |
641 | 658 | $output .= '<p>' . __('No WPShop new has been found', 'wpshop') . '</p>'; |
642 | - } |
|
643 | - else { |
|
659 | + } else { |
|
644 | 660 | $output .= '<ul class="recent-orders">'; |
645 | 661 | foreach ( $rss_items as $item ) { |
646 | 662 | $output .= '<li><a href="' .$item->get_permalink() . '" title="' .$item->get_title(). '" target="_blank">' .$item->get_title(). '</a><br/>'; |
@@ -670,12 +686,10 @@ discard block |
||
670 | 686 | $output .= '<div class="wps_dashboard_video_description">' .$videos_items[ $rand_element ]->description. '</div>'; |
671 | 687 | $output .= '</div>'; |
672 | 688 | |
673 | - } |
|
674 | - else { |
|
689 | + } else { |
|
675 | 690 | $output =__('No tutorial videos can be loaded', 'wpshop' ); |
676 | 691 | } |
677 | - } |
|
678 | - else { |
|
692 | + } else { |
|
679 | 693 | $output = __( 'Your servor doesn\'t allow to open external files', 'wpshop'); |
680 | 694 | } |
681 | 695 | echo $output; |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | ?> |
3 | 5 | <div class="wrap wpshopMainWrap" > |
4 | 6 | <div id="wpshopLoadingPicture" class="wpshopHide" ><img src="<?php echo WPSHOP_LOADING_ICON; ?>" alt="loading picture" class="wpshopPageMessage_Icon" /></div> |
@@ -285,8 +287,10 @@ discard block |
||
285 | 287 | |
286 | 288 | if ((date('m') - $current_month_offset)==0) : |
287 | 289 | $up_to = date('d', strtotime('NOW')); |
288 | - else : |
|
290 | + else { |
|
291 | + : |
|
289 | 292 | $up_to = date('d', $last_day); |
293 | + } |
|
290 | 294 | endif; |
291 | 295 | $count = 0; |
292 | 296 | |
@@ -305,17 +309,25 @@ discard block |
||
305 | 309 | |
306 | 310 | $order_data = get_post_meta($order->ID, '_order_postmeta', true); |
307 | 311 | |
308 | - if ($order_data['order_status']=='denied' || $order_data['order_status']=='awaiting_payment') continue; |
|
312 | + if ($order_data['order_status']=='denied' || $order_data['order_status']=='awaiting_payment') { |
|
313 | + continue; |
|
314 | + } |
|
309 | 315 | |
310 | 316 | $time = strtotime(date('Ymd', strtotime($order_data['order_date']))).'000'; |
311 | 317 | |
312 | 318 | $order_grand_total = !empty($order_data['order_grand_total']) ? $order_data['order_grand_total'] : 0; |
313 | 319 | |
314 | 320 | if (isset($order_counts[$time])) : $order_counts[$time]++; |
315 | - else : $order_counts[$time] = 1; endif; |
|
321 | + else { |
|
322 | + : $order_counts[$time] = 1; |
|
323 | + } |
|
324 | + endif; |
|
316 | 325 | |
317 | - if (isset($order_amounts[$time])) $order_amounts[$time] = $order_amounts[$time] + $order_grand_total; |
|
318 | - else $order_amounts[$time] = (float) $order_grand_total; |
|
326 | + if (isset($order_amounts[$time])) { |
|
327 | + $order_amounts[$time] = $order_amounts[$time] + $order_grand_total; |
|
328 | + } else { |
|
329 | + $order_amounts[$time] = (float) $order_grand_total; |
|
330 | + } |
|
319 | 331 | |
320 | 332 | endforeach; |
321 | 333 | endif; |
@@ -326,7 +338,9 @@ discard block |
||
326 | 338 | var d = [ |
327 | 339 | <?php |
328 | 340 | $values = array(); |
329 | - foreach ($order_counts as $key => $value) $values[] = "[$key, $value]"; |
|
341 | + foreach ($order_counts as $key => $value) { |
|
342 | + $values[] = "[$key, $value]"; |
|
343 | + } |
|
330 | 344 | echo implode(',', $values); |
331 | 345 | ?> |
332 | 346 | ]; |
@@ -336,7 +350,9 @@ discard block |
||
336 | 350 | var d2 = [ |
337 | 351 | <?php |
338 | 352 | $values = array(); |
339 | - foreach ($order_amounts as $key => $value) $values[] = "[$key, $value]"; |
|
353 | + foreach ($order_amounts as $key => $value) { |
|
354 | + $values[] = "[$key, $value]"; |
|
355 | + } |
|
340 | 356 | echo implode(',', $values); |
341 | 357 | ?> |
342 | 358 | ]; |
@@ -1,16 +1,16 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wrap wpshopMainWrap" > |
4 | 4 | <div id="wpshopLoadingPicture" class="wpshopHide" ><img src="<?php echo WPSHOP_LOADING_ICON; ?>" alt="loading picture" class="wpshopPageMessage_Icon" /></div> |
5 | - <div id="wpshopMessage" class="fade below-h2 wpshopPageMessage <?php echo ( !empty( $actionInformationMessage ) ? 'wpshopPageMessage_Updated' : ''); ?>" ><?php !empty( $actionInformationMessage ) ? _e( $actionInformationMessage, 'wpshop' ) : ''; ?></div> |
|
5 | + <div id="wpshopMessage" class="fade below-h2 wpshopPageMessage <?php echo (!empty($actionInformationMessage) ? 'wpshopPageMessage_Updated' : ''); ?>" ><?php !empty($actionInformationMessage) ? _e($actionInformationMessage, 'wpshop') : ''; ?></div> |
|
6 | 6 | |
7 | 7 | <div class="pageTitle" id="pageTitleContainer" > |
8 | - <h2 ><?php _e( 'Shop dashboard', 'wpshop'); ?></h2> |
|
8 | + <h2 ><?php _e('Shop dashboard', 'wpshop'); ?></h2> |
|
9 | 9 | </div> |
10 | 10 | <div id="champsCaches" class="wpshop_cls wpshopHide" ></div> |
11 | 11 | <div class="wpshop_cls" id="wpshopMainContent" > |
12 | 12 | |
13 | - <?php apply_filters( 'wps-dashboard-notice', '' ); ?> |
|
13 | + <?php apply_filters('wps-dashboard-notice', ''); ?> |
|
14 | 14 | |
15 | 15 | <div id="wpshop_dashboard"> |
16 | 16 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | <td class="first b"><a href="edit.php?post_type=<?php echo WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT; ?>"><?php |
32 | 32 | $num_posts = wp_count_posts(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT); |
33 | - $number_of_products = number_format_i18n( $num_posts->publish ); |
|
33 | + $number_of_products = number_format_i18n($num_posts->publish); |
|
34 | 34 | echo $number_of_products; |
35 | 35 | ?></a></td> |
36 | 36 | <td class="t"><a href="edit.php?post_type=<?php echo WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT; ?>"><?php _e('Products', 'wpshop'); ?></a></td> |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | </tr> |
47 | 47 | <tr> |
48 | 48 | <?php |
49 | - $query = $wpdb->prepare( "SELECT COUNT( DISTINCT us.ID ) FROM {$wpdb->users} us JOIN {$wpdb->posts} ON us.ID = post_author AND post_type = %s", 'wpshop_shop_order' ); |
|
49 | + $query = $wpdb->prepare("SELECT COUNT( DISTINCT us.ID ) FROM {$wpdb->users} us JOIN {$wpdb->posts} ON us.ID = post_author AND post_type = %s", 'wpshop_shop_order'); |
|
50 | 50 | $result = $wpdb->get_var($query); |
51 | 51 | ?> |
52 | 52 | <td class="first b"><a href="users.php"><?php echo $result; ?></a></td> |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | if ($orders) { |
77 | 77 | foreach ($orders as $o) { |
78 | 78 | $order = get_post_meta($o->ID, '_order_postmeta', true); |
79 | - if(!empty($order['order_status'])){ |
|
80 | - switch($order['order_status']) { |
|
79 | + if (!empty($order['order_status'])) { |
|
80 | + switch ($order['order_status']) { |
|
81 | 81 | case 'completed': $order_completed++; break; |
82 | 82 | case 'shipped': $order_shipped++; break; |
83 | 83 | case 'awaiting_payment': $order_awaiting_payment++; break; |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | <h3 class="hndle"><span class="dashicons dashicons-performance"></span> <span><?php _e('Quick Links', 'wpshop') ?></span></h3> |
137 | 137 | <div class="inside"> |
138 | 138 | <div class="wps-gridwrapper5-padded wpshop-gridwrapper-quick-link"> |
139 | - <div><div class="wps_quick_link_icon"><a href="<?php echo admin_url( 'post-new.php?post_type=wpshop_product' ); ?>"><span class="dashicons dashicons-archive"></span></a></div><center><a href="<?php echo admin_url( 'post-new.php?post_type=wpshop_product' ); ?>"><?php _e( 'Create a new product', 'wpshop'); ?></a></center></div> |
|
140 | - <div><div class="wps_quick_link_icon"><a href="<?php echo admin_url( 'post-new.php?post_type=wpshop_shop_order' ); ?>"><span class="dashicons dashicons-cart"></span></a></div><center><a href="<?php echo admin_url( 'post-new.php?post_type=wpshop_shop_order' ); ?>"><?php _e( 'Create order', 'wpshop'); ?></a></center></div> |
|
141 | - <div><div class="wps_quick_link_icon"><a href="<?php echo admin_url( 'post-new.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS ); ?>"><span class="dashicons dashicons-businessman"></span></a></div><center><a href="<?php echo admin_url( 'post-new.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS ); ?>"><?php _e( 'Create a customer', 'wpshop'); ?></a></center></div> |
|
142 | - <div><div class="wps_quick_link_icon"><a href="<?php echo admin_url( 'admin.php?page=wpshop_statistics' ); ?>"><span class="dashicons dashicons-chart-line"></span></a></div><center><a href="<?php echo admin_url( 'admin.php?page=wpshop_statistics' ); ?>"><?php _e( 'Statistics', 'wpshop'); ?></a></center></div> |
|
143 | - <div><div class="wps_quick_link_icon"><a href="<?php echo admin_url( 'options-general.php?page=wpshop_option#wpshop_display_option' ); ?>"><span class="dashicons dashicons-admin-appearance"></span></a></div><center><a href="<?php echo admin_url( 'options-general.php?page=wpshop_option' ); ?>"><?php _e( 'Customize your shop', 'wpshop'); ?></a></center></div> |
|
139 | + <div><div class="wps_quick_link_icon"><a href="<?php echo admin_url('post-new.php?post_type=wpshop_product'); ?>"><span class="dashicons dashicons-archive"></span></a></div><center><a href="<?php echo admin_url('post-new.php?post_type=wpshop_product'); ?>"><?php _e('Create a new product', 'wpshop'); ?></a></center></div> |
|
140 | + <div><div class="wps_quick_link_icon"><a href="<?php echo admin_url('post-new.php?post_type=wpshop_shop_order'); ?>"><span class="dashicons dashicons-cart"></span></a></div><center><a href="<?php echo admin_url('post-new.php?post_type=wpshop_shop_order'); ?>"><?php _e('Create order', 'wpshop'); ?></a></center></div> |
|
141 | + <div><div class="wps_quick_link_icon"><a href="<?php echo admin_url('post-new.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS); ?>"><span class="dashicons dashicons-businessman"></span></a></div><center><a href="<?php echo admin_url('post-new.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS); ?>"><?php _e('Create a customer', 'wpshop'); ?></a></center></div> |
|
142 | + <div><div class="wps_quick_link_icon"><a href="<?php echo admin_url('admin.php?page=wpshop_statistics'); ?>"><span class="dashicons dashicons-chart-line"></span></a></div><center><a href="<?php echo admin_url('admin.php?page=wpshop_statistics'); ?>"><?php _e('Statistics', 'wpshop'); ?></a></center></div> |
|
143 | + <div><div class="wps_quick_link_icon"><a href="<?php echo admin_url('options-general.php?page=wpshop_option#wpshop_display_option'); ?>"><span class="dashicons dashicons-admin-appearance"></span></a></div><center><a href="<?php echo admin_url('options-general.php?page=wpshop_option'); ?>"><?php _e('Customize your shop', 'wpshop'); ?></a></center></div> |
|
144 | 144 | </div> |
145 | 145 | </div> |
146 | 146 | </div><!-- postbox end --> |
@@ -155,36 +155,36 @@ discard block |
||
155 | 155 | <div class="wps-table-header wps-table-row"> |
156 | 156 | <div class="wps-table-cell"><?php _e('Number of users', 'wpshop'); ?></div> |
157 | 157 | <div class="wps-table-cell"><?php $result = count(get_users()); echo $result; ?></div> |
158 | - <div class="wps-table-cell"><?php echo ( !empty($result) ) ? '<a href="' . admin_url(). 'admin.php?page=wpshop_dashboard&download_users=users_all" role="button" id="download_all_users_contacts" class="wps-bton-first-rounded">' .__( 'Download the list', 'wpshop' ). '</a>' : ''; ?></div> |
|
158 | + <div class="wps-table-cell"><?php echo (!empty($result)) ? '<a href="' . admin_url() . 'admin.php?page=wpshop_dashboard&download_users=users_all" role="button" id="download_all_users_contacts" class="wps-bton-first-rounded">' . __('Download the list', 'wpshop') . '</a>' : ''; ?></div> |
|
159 | 159 | </div> |
160 | 160 | |
161 | 161 | |
162 | 162 | |
163 | 163 | <div class="wps-table-header wps-table-row"> |
164 | 164 | <?php |
165 | - $query = $wpdb->prepare( "SELECT COUNT( DISTINCT user_id ) FROM {$wpdb->usermeta} JOIN {$wpdb->posts} ON post_author = user_id AND post_type = %s WHERE meta_key = %s AND ( meta_value LIKE ('%%%s%%') || meta_value LIKE ('%%%s%%') )", 'wpshop_shop_order', 'user_preferences', 's:16:"newsletters_site";i:1;', 's:16:"newsletters_site";b:1;' ); |
|
165 | + $query = $wpdb->prepare("SELECT COUNT( DISTINCT user_id ) FROM {$wpdb->usermeta} JOIN {$wpdb->posts} ON post_author = user_id AND post_type = %s WHERE meta_key = %s AND ( meta_value LIKE ('%%%s%%') || meta_value LIKE ('%%%s%%') )", 'wpshop_shop_order', 'user_preferences', 's:16:"newsletters_site";i:1;', 's:16:"newsletters_site";b:1;'); |
|
166 | 166 | $nbcustomers_site = $wpdb->get_var($query); |
167 | 167 | ?> |
168 | 168 | <div class="wps-table-cell"><?php _e('Number of customers who wants to receive shop newsletters', 'wpshop'); ?></div> |
169 | 169 | <div class="wps-table-cell"><?php echo $nbcustomers_site; ?></div> |
170 | - <div class="wps-table-cell"><?php echo ( !empty($nbcustomers_site) ) ? '<a href="' . admin_url(). 'admin.php?page=wpshop_dashboard&download_users=newsletters_site" role="button" id="download_newsletter_contacts" class="wps-bton-first-rounded">' .__( 'Download the list', 'wpshop' ). '</a>' : ''; ?></div> |
|
170 | + <div class="wps-table-cell"><?php echo (!empty($nbcustomers_site)) ? '<a href="' . admin_url() . 'admin.php?page=wpshop_dashboard&download_users=newsletters_site" role="button" id="download_newsletter_contacts" class="wps-bton-first-rounded">' . __('Download the list', 'wpshop') . '</a>' : ''; ?></div> |
|
171 | 171 | </div> |
172 | 172 | |
173 | 173 | <div class="wps-table-header wps-table-row"> |
174 | 174 | <?php |
175 | - $query = $wpdb->prepare( "SELECT COUNT( DISTINCT user_id ) FROM {$wpdb->usermeta} JOIN {$wpdb->posts} ON post_author = user_id AND post_type = %s WHERE meta_key = %s AND ( meta_value LIKE ('%%%s%%') || meta_value LIKE ('%%%s%%') )", 'wpshop_shop_order', 'user_preferences', 's:25:"newsletters_site_partners";i:1;', 's:25:"newsletters_site_partners";b:1;' ); |
|
175 | + $query = $wpdb->prepare("SELECT COUNT( DISTINCT user_id ) FROM {$wpdb->usermeta} JOIN {$wpdb->posts} ON post_author = user_id AND post_type = %s WHERE meta_key = %s AND ( meta_value LIKE ('%%%s%%') || meta_value LIKE ('%%%s%%') )", 'wpshop_shop_order', 'user_preferences', 's:25:"newsletters_site_partners";i:1;', 's:25:"newsletters_site_partners";b:1;'); |
|
176 | 176 | $nbcustomers_site_partners = $wpdb->get_var($query); |
177 | 177 | ?> |
178 | 178 | <div class="wps-table-cell"><?php _e('Number of customers who wants to receive partners newsletters', 'wpshop'); ?></div> |
179 | 179 | <div class="wps-table-cell"><?php echo $nbcustomers_site_partners; ?></div> |
180 | - <div class="wps-table-cell"><?php echo ( !empty($nbcustomers_site_partners) ) ? '<a href="' . admin_url(). 'admin.php?page=wpshop_dashboard&download_users=newsletters_site_partners" role="button" id="download_newsletter_partners_contacts" class="wps-bton-first-rounded">' .__( 'Download the list', 'wpshop' ). '</a>' : ''; ?></div> |
|
180 | + <div class="wps-table-cell"><?php echo (!empty($nbcustomers_site_partners)) ? '<a href="' . admin_url() . 'admin.php?page=wpshop_dashboard&download_users=newsletters_site_partners" role="button" id="download_newsletter_partners_contacts" class="wps-bton-first-rounded">' . __('Download the list', 'wpshop') . '</a>' : ''; ?></div> |
|
181 | 181 | </div> |
182 | 182 | </div> |
183 | 183 | </div> |
184 | 184 | </div><!-- postbox end --> |
185 | 185 | |
186 | 186 | <?php |
187 | - if( class_exists('wps_export_ctr') ) { |
|
187 | + if (class_exists('wps_export_ctr')) { |
|
188 | 188 | $wps_export = new wps_export_ctr(); |
189 | 189 | $wps_export->wps_export_tpl(); |
190 | 190 | } |
@@ -206,15 +206,15 @@ discard block |
||
206 | 206 | <?php |
207 | 207 | global $current_month_offset; |
208 | 208 | |
209 | - $current_month_offset = (int) date('m'); |
|
210 | - $current_month_offset = isset( $_GET['month'] ) ? (int) $_GET['month'] : $current_month_offset; |
|
209 | + $current_month_offset = (int)date('m'); |
|
210 | + $current_month_offset = isset($_GET['month']) ? (int)$_GET['month'] : $current_month_offset; |
|
211 | 211 | ?> |
212 | 212 | <div class="postbox stats" id="wpshop-stats"> |
213 | 213 | <h3 class="hndle"><span class="dashicons dashicons-chart-area"></span> |
214 | - <?php if ($current_month_offset!=date('m')) : ?> |
|
215 | - <a href="admin.php?page=wpshop_dashboard&month=<?php echo $current_month_offset+1; ?>" class="next"><?php echo __('Next Month','wpshop'); ?> →</a> |
|
214 | + <?php if ($current_month_offset != date('m')) : ?> |
|
215 | + <a href="admin.php?page=wpshop_dashboard&month=<?php echo $current_month_offset + 1; ?>" class="next"><?php echo __('Next Month', 'wpshop'); ?> →</a> |
|
216 | 216 | <?php endif; ?> |
217 | - <a href="admin.php?page=wpshop_dashboard&month=<?php echo $current_month_offset-1; ?>" class="previous">← <?php echo __('Previous Month','wpshop'); ?></a> |
|
217 | + <a href="admin.php?page=wpshop_dashboard&month=<?php echo $current_month_offset - 1; ?>" class="previous">← <?php echo __('Previous Month', 'wpshop'); ?></a> |
|
218 | 218 | <span><?php _e('Monthly Sales', 'wpshop') ?></span></h3> |
219 | 219 | <div class="inside"> |
220 | 220 | <div id="placeholder" style="width:100%; height:300px; position:relative;"></div> |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | |
245 | 245 | <?php |
246 | 246 | |
247 | - function orders_this_month( $where = '' ) { |
|
247 | + function orders_this_month($where = '') { |
|
248 | 248 | global $current_month_offset; |
249 | 249 | |
250 | 250 | $month = $current_month_offset; |
251 | - $year = (int) date('Y'); |
|
251 | + $year = (int)date('Y'); |
|
252 | 252 | |
253 | 253 | $first_day = strtotime("{$year}-{$month}-01"); |
254 | 254 | $last_day = strtotime('-1 second', strtotime('+1 month', $first_day)); |
@@ -261,29 +261,29 @@ discard block |
||
261 | 261 | |
262 | 262 | return $where; |
263 | 263 | } |
264 | - add_filter( 'posts_where', 'orders_this_month' ); |
|
264 | + add_filter('posts_where', 'orders_this_month'); |
|
265 | 265 | |
266 | 266 | $args = array( |
267 | 267 | 'numberposts' => -1, |
268 | 268 | 'orderby' => 'post_date', |
269 | 269 | 'order' => 'DESC', |
270 | 270 | 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, |
271 | - 'post_status' => 'publish' , |
|
271 | + 'post_status' => 'publish', |
|
272 | 272 | 'suppress_filters' => false |
273 | 273 | ); |
274 | - $orders = get_posts( $args ); |
|
274 | + $orders = get_posts($args); |
|
275 | 275 | |
276 | 276 | $order_counts = array(); |
277 | 277 | $order_amounts = array(); |
278 | 278 | |
279 | 279 | // Blank date ranges to begin |
280 | 280 | $month = $current_month_offset; |
281 | - $year = (int) date('Y'); |
|
281 | + $year = (int)date('Y'); |
|
282 | 282 | |
283 | 283 | $first_day = strtotime("{$year}-{$month}-01"); |
284 | 284 | $last_day = strtotime('-1 second', strtotime('+1 month', $first_day)); |
285 | 285 | |
286 | - if ((date('m') - $current_month_offset)==0) : |
|
286 | + if ((date('m') - $current_month_offset) == 0) : |
|
287 | 287 | $up_to = date('d', strtotime('NOW')); |
288 | 288 | else : |
289 | 289 | $up_to = date('d', $last_day); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | |
293 | 293 | while ($count < $up_to) : |
294 | 294 | |
295 | - $time = strtotime(date('Ymd', strtotime('+ '.$count.' DAY', $first_day))).'000'; |
|
295 | + $time = strtotime(date('Ymd', strtotime('+ ' . $count . ' DAY', $first_day))) . '000'; |
|
296 | 296 | |
297 | 297 | $order_counts[$time] = 0; |
298 | 298 | $order_amounts[$time] = 0; |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | |
306 | 306 | $order_data = get_post_meta($order->ID, '_order_postmeta', true); |
307 | 307 | |
308 | - if ($order_data['order_status']=='denied' || $order_data['order_status']=='awaiting_payment') continue; |
|
308 | + if ($order_data['order_status'] == 'denied' || $order_data['order_status'] == 'awaiting_payment') continue; |
|
309 | 309 | |
310 | - $time = strtotime(date('Ymd', strtotime($order_data['order_date']))).'000'; |
|
310 | + $time = strtotime(date('Ymd', strtotime($order_data['order_date']))) . '000'; |
|
311 | 311 | |
312 | 312 | $order_grand_total = !empty($order_data['order_grand_total']) ? $order_data['order_grand_total'] : 0; |
313 | 313 | |
@@ -315,12 +315,12 @@ discard block |
||
315 | 315 | else : $order_counts[$time] = 1; endif; |
316 | 316 | |
317 | 317 | if (isset($order_amounts[$time])) $order_amounts[$time] = $order_amounts[$time] + $order_grand_total; |
318 | - else $order_amounts[$time] = (float) $order_grand_total; |
|
318 | + else $order_amounts[$time] = (float)$order_grand_total; |
|
319 | 319 | |
320 | 320 | endforeach; |
321 | 321 | endif; |
322 | 322 | |
323 | - remove_filter( 'posts_where', 'orders_this_month' ); |
|
323 | + remove_filter('posts_where', 'orders_this_month'); |
|
324 | 324 | ?> |
325 | 325 | |
326 | 326 | var d = [ |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | for (var i = 0; i < d2.length; ++i) d2[i][0] += 60 * 60 * 1000; |
345 | 345 | |
346 | - var plot = jQuery.plot(jQuery("#placeholder"), [ { label: "<?php echo __('Number of sales','wpshop'); ?>", data: d }, { label: "<?php echo __('Sales amount','wpshop'); ?>", data: d2, yaxis: 2 } ], { |
|
346 | + var plot = jQuery.plot(jQuery("#placeholder"), [ { label: "<?php echo __('Number of sales', 'wpshop'); ?>", data: d }, { label: "<?php echo __('Sales amount', 'wpshop'); ?>", data: d2, yaxis: 2 } ], { |
|
347 | 347 | series: { |
348 | 348 | lines: { show: true }, |
349 | 349 | points: { show: true } |
@@ -390,10 +390,10 @@ discard block |
||
390 | 390 | |
391 | 391 | jQuery("#tooltip").remove(); |
392 | 392 | |
393 | - if (item.series.label=="<?php echo __('Number of sales','wpshop'); ?>") { |
|
393 | + if (item.series.label=="<?php echo __('Number of sales', 'wpshop'); ?>") { |
|
394 | 394 | |
395 | 395 | var y = item.datapoint[1]; |
396 | - showTooltip(item.pageX, item.pageY, y+" <?php echo __('sales','wpshop'); ?>"); |
|
396 | + showTooltip(item.pageX, item.pageY, y+" <?php echo __('sales', 'wpshop'); ?>"); |
|
397 | 397 | |
398 | 398 | } else { |
399 | 399 | |
@@ -424,15 +424,15 @@ discard block |
||
424 | 424 | <div class="inside"> |
425 | 425 | |
426 | 426 | <div class="wps-boxed"> |
427 | - <span class="wps-h5"><?php _e( 'WPSHOP is also...', 'wpshop'); ?></span> |
|
427 | + <span class="wps-h5"><?php _e('WPSHOP is also...', 'wpshop'); ?></span> |
|
428 | 428 | <div class="wps-gridwrapper4-padded"> |
429 | - <div><a href="http://shop.eoxia.com/ecommerce/wpshop_product/assistance-wordpress/" target="_blank" title="<?php _e( 'Assistance', 'wpshop'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>assistance_wpshop.jpg" alt="WPSHOP Assistance" /></a><div class="wps-h5"><center><?php _e( 'Assistance', 'wpshop'); ?></center></div><center><?php _e('To assist you in your WPShop Experience', 'wpshop'); ?></center></div> |
|
430 | - <div><a href="http://shop.eoxia.com/boutique/shop/themes-wpshop/" target="_blank" title="<?php _e( 'WPSHOP Themes', 'wpshop'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>themes_wpshop.jpg" alt="WPSHOP Themes" /></a><div class="wps-h5"><center><?php _e( 'WPSHOP Themes', 'wpshop'); ?></center></div><center><?php _e('To offer to your customer all WPShop\'s powerful experience', 'wpshop'); ?></center></div> |
|
431 | - <div><a href="http://shop.eoxia.com/boutique/shop/modules-wpshop/" target="_blank" title="<?php _e( 'WPSHOP\'s add-ons', 'wpshop'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>modules_wpshop.jpg" alt="WPSHOP Assistance" /></a><div class="wps-h5"><center><?php _e( 'WPSHOP\'s add-ons', 'wpshop'); ?></center></div><center><?php _e('To boost your shop with new functions', 'wpshop'); ?></center></div> |
|
432 | - <div><a href="http://forums.eoxia.com/forum/wpshop" target="_blank" title="<?php _e( 'WPSHOP\'s Forum', 'wpshop'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>forum_wpshop.jpg" alt="Forum Assistance" /></a><div class="wps-h5"><center><?php _e( 'WPSHOP\'s Forum', 'wpshop'); ?></center></div><center><?php _e('To respond at your questions', 'wpshop'); ?></center></div> |
|
429 | + <div><a href="http://shop.eoxia.com/ecommerce/wpshop_product/assistance-wordpress/" target="_blank" title="<?php _e('Assistance', 'wpshop'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>assistance_wpshop.jpg" alt="WPSHOP Assistance" /></a><div class="wps-h5"><center><?php _e('Assistance', 'wpshop'); ?></center></div><center><?php _e('To assist you in your WPShop Experience', 'wpshop'); ?></center></div> |
|
430 | + <div><a href="http://shop.eoxia.com/boutique/shop/themes-wpshop/" target="_blank" title="<?php _e('WPSHOP Themes', 'wpshop'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>themes_wpshop.jpg" alt="WPSHOP Themes" /></a><div class="wps-h5"><center><?php _e('WPSHOP Themes', 'wpshop'); ?></center></div><center><?php _e('To offer to your customer all WPShop\'s powerful experience', 'wpshop'); ?></center></div> |
|
431 | + <div><a href="http://shop.eoxia.com/boutique/shop/modules-wpshop/" target="_blank" title="<?php _e('WPSHOP\'s add-ons', 'wpshop'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>modules_wpshop.jpg" alt="WPSHOP Assistance" /></a><div class="wps-h5"><center><?php _e('WPSHOP\'s add-ons', 'wpshop'); ?></center></div><center><?php _e('To boost your shop with new functions', 'wpshop'); ?></center></div> |
|
432 | + <div><a href="http://forums.eoxia.com/forum/wpshop" target="_blank" title="<?php _e('WPSHOP\'s Forum', 'wpshop'); ?>"><img src="<?php echo WPSHOP_MEDIAS_IMAGES_URL; ?>forum_wpshop.jpg" alt="Forum Assistance" /></a><div class="wps-h5"><center><?php _e('WPSHOP\'s Forum', 'wpshop'); ?></center></div><center><?php _e('To respond at your questions', 'wpshop'); ?></center></div> |
|
433 | 433 | </div> |
434 | 434 | <br/><br/> |
435 | - <span class="wps-h6"><?php _e( 'Be connected', 'wpshop'); ?></span> |
|
435 | + <span class="wps-h6"><?php _e('Be connected', 'wpshop'); ?></span> |
|
436 | 436 | <div class="wps-gridwrapper2-padded"> |
437 | 437 | <div> |
438 | 438 | <div class="fb-like" data-href="https://fr-fr.facebook.com/wpshopplugin" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div> |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | </div> |
446 | 446 | |
447 | 447 | <div class="wps-boxed"> |
448 | - <span class="wps-h5"><?php _e( 'WPSHOP\'s Video Tutorials', 'wpshop')?></span> |
|
448 | + <span class="wps-h5"><?php _e('WPSHOP\'s Video Tutorials', 'wpshop')?></span> |
|
449 | 449 | <div><?php $this->wpshop_rss_tutorial_videos(); ?></div> |
450 | 450 | </div> |
451 | 451 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | class wps_customer_group { |
3 | 5 | function __construct() { |
4 | 6 | add_action('admin_menu', array( $this, 'register_customer_groups_submenu' ) ); |
@@ -47,8 +49,9 @@ discard block |
||
47 | 49 | |
48 | 50 | // Redirect |
49 | 51 | wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP.'&action=edit&code='.$code)); |
52 | + } else { |
|
53 | + echo __('This group already exist','wpshop'); |
|
50 | 54 | } |
51 | - else echo __('This group already exist','wpshop'); |
|
52 | 55 | } |
53 | 56 | // EDITION |
54 | 57 | elseif (!empty($editrole) && !empty($code)) { |
@@ -67,8 +70,9 @@ discard block |
||
67 | 70 | $this->unaffectUsersToGroup($code); // !important |
68 | 71 | $this->affectUsersToGroup($code, $group_users); |
69 | 72 | } |
73 | + } else { |
|
74 | + wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP)); |
|
70 | 75 | } |
71 | - else wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP)); |
|
72 | 76 | } |
73 | 77 | } |
74 | 78 | |
@@ -295,10 +299,8 @@ discard block |
||
295 | 299 | } |
296 | 300 | } |
297 | 301 | } |
298 | - } |
|
299 | - else {wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP));exit;} |
|
300 | - } |
|
301 | - else {wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP));exit;} |
|
302 | + } else {wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP));exit;} |
|
303 | + } else {wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP));exit;} |
|
302 | 304 | |
303 | 305 | break; |
304 | 306 | |
@@ -350,8 +352,7 @@ discard block |
||
350 | 352 | </form> |
351 | 353 | '; |
352 | 354 | |
353 | - } |
|
354 | - else { |
|
355 | + } else { |
|
355 | 356 | |
356 | 357 | |
357 | 358 | $wpshop_list_table = new wpshop_groups_custom_List_table(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Affecte des utilisateurs � un role |
77 | - * @param $code identifiant du role |
|
77 | + * @param string $code identifiant du role |
|
78 | 78 | * @param $users liste d'utilisateurs a affecter |
79 | 79 | */ |
80 | 80 | function affectUsersToGroup($code, $users) |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | /** |
101 | 101 | * D�saffecte des utilisateurs � un role |
102 | - * @param $code identifiant du role |
|
102 | + * @param string $code identifiant du role |
|
103 | 103 | */ |
104 | 104 | function unaffectUsersToGroup($code) |
105 | 105 | { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Enregistre les metas pour un role donn� |
128 | - * @param $code identifiant du role |
|
128 | + * @param string $code identifiant du role |
|
129 | 129 | * @param $desc description du role |
130 | 130 | * @param $parent parent du role |
131 | 131 | */ |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Enregistre les droits pour un role donn� |
167 | - * @param $code identifiant du role |
|
167 | + * @param string $code identifiant du role |
|
168 | 168 | * @param $role identifiant du role actuel sur lequel le role est bas� |
169 | 169 | * @param $newrole identifiant du role sur lequel le role doit etre bas� |
170 | 170 | */ |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Retourne les infos sur le role donn� |
198 | - * @param $code identifiant du role |
|
198 | + * @param string $code identifiant du role |
|
199 | 199 | */ |
200 | 200 | function getRole($code) |
201 | 201 | { |
@@ -1,7 +1,7 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | class wps_customer_group { |
3 | 3 | function __construct() { |
4 | - add_action('admin_menu', array( $this, 'register_customer_groups_submenu' ) ); |
|
4 | + add_action('admin_menu', array($this, 'register_customer_groups_submenu')); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | function register_customer_groups_submenu() { |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | * Gérer les actions $_POST |
15 | 15 | */ |
16 | 16 | function manage_post() { |
17 | - $addrole = !empty( $_POST['addrole'] ) ? sanitize_text_field( $_POST['addrole'] ) : ''; |
|
18 | - $editrole = !empty( $_POST['editrole'] ) ? sanitize_text_field( $_POST['editrole'] ) : ''; |
|
19 | - $group_name = !empty( $_POST['group-name'] ) ? sanitize_text_field( $_POST['group-name'] ) : ''; |
|
20 | - $group_parent = !empty( $_POST['group-parent'] ) ? sanitize_text_field( $_POST['group-parent'] ) : ''; |
|
21 | - $group_description = !empty( $_POST['group-description'] ) ? sanitize_text_field( $_POST['group-description'] ) : ''; |
|
22 | - $group_users = !empty( $_POST['group-users'] ) ? (array) $_POST['group-users'] : array(); |
|
23 | - $code = !empty( $_GET['code'] ) ? sanitize_text_field( $_GET['code'] ) : ''; |
|
17 | + $addrole = !empty($_POST['addrole']) ? sanitize_text_field($_POST['addrole']) : ''; |
|
18 | + $editrole = !empty($_POST['editrole']) ? sanitize_text_field($_POST['editrole']) : ''; |
|
19 | + $group_name = !empty($_POST['group-name']) ? sanitize_text_field($_POST['group-name']) : ''; |
|
20 | + $group_parent = !empty($_POST['group-parent']) ? sanitize_text_field($_POST['group-parent']) : ''; |
|
21 | + $group_description = !empty($_POST['group-description']) ? sanitize_text_field($_POST['group-description']) : ''; |
|
22 | + $group_users = !empty($_POST['group-users']) ? (array)$_POST['group-users'] : array(); |
|
23 | + $code = !empty($_GET['code']) ? sanitize_text_field($_GET['code']) : ''; |
|
24 | 24 | |
25 | 25 | if ((!empty($addrole) || !empty($editrole)) && !empty($group_name)) { |
26 | 26 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | // AJOUT |
31 | 31 | if (!empty($addrole)) { |
32 | 32 | |
33 | - $code = 'wpshop_'.str_replace('-', '_', sanitize_title($group_name)); |
|
33 | + $code = 'wpshop_' . str_replace('-', '_', sanitize_title($group_name)); |
|
34 | 34 | |
35 | 35 | // Si le role n'existe pas |
36 | 36 | if (!isset($roles[$code])) { |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | add_role($code, sanitize_text_field($group_name), $rights); |
41 | 41 | |
42 | 42 | // On enregistre les metas du groupe |
43 | - $this->setGroupMetas($code, sanitize_text_field( $group_description ), sanitize_text_field( $group_parent ) ); |
|
43 | + $this->setGroupMetas($code, sanitize_text_field($group_description), sanitize_text_field($group_parent)); |
|
44 | 44 | |
45 | 45 | // On affecte des utilisateurs au role |
46 | 46 | $this->affectUsersToGroup($code, $group_users); |
47 | 47 | |
48 | 48 | // Redirect |
49 | - wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP.'&action=edit&code='.$code)); |
|
49 | + wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_GROUP . '&action=edit&code=' . $code)); |
|
50 | 50 | } |
51 | - else echo __('This group already exist','wpshop'); |
|
51 | + else echo __('This group already exist', 'wpshop'); |
|
52 | 52 | } |
53 | 53 | // EDITION |
54 | 54 | elseif (!empty($editrole) && !empty($code)) { |
@@ -58,17 +58,17 @@ discard block |
||
58 | 58 | |
59 | 59 | $current_role = $this->getRole($code); |
60 | 60 | |
61 | - $this->setNewRoleRights($code, $current_role['parent'], sanitize_text_field( $group_parent ) ); |
|
61 | + $this->setNewRoleRights($code, $current_role['parent'], sanitize_text_field($group_parent)); |
|
62 | 62 | |
63 | 63 | // On enregistre les metas du groupe |
64 | - $this->setGroupMetas($code, sanitize_text_field( $group_description ) , sanitize_text_field( $group_parent ) ); |
|
64 | + $this->setGroupMetas($code, sanitize_text_field($group_description), sanitize_text_field($group_parent)); |
|
65 | 65 | |
66 | 66 | // On affecte des utilisateurs au role |
67 | 67 | $this->unaffectUsersToGroup($code); // !important |
68 | 68 | $this->affectUsersToGroup($code, $group_users); |
69 | 69 | } |
70 | 70 | } |
71 | - else wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP)); |
|
71 | + else wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_GROUP)); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | if (isset($roles[$code])) { |
111 | 111 | $wps_customer_mdl = new wps_customer_mdl(); |
112 | 112 | $users = $wps_customer_mdl->getUserList(); |
113 | - if( !empty($users) ) { |
|
114 | - foreach($users as $user) { |
|
113 | + if (!empty($users)) { |
|
114 | + foreach ($users as $user) { |
|
115 | 115 | $u = new WP_User($user->ID); |
116 | 116 | // Si l'utilisateur poss�de le role, on le retire de sa liste de droits |
117 | - if (isset($u->roles[0]) && $u->roles[0]==$code) { |
|
117 | + if (isset($u->roles[0]) && $u->roles[0] == $code) { |
|
118 | 118 | $u->remove_role($u->roles[0]); |
119 | 119 | $u->add_role('subscriber'); |
120 | 120 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | // On retire les anciens droits |
178 | 178 | $rights = $this->getRoleRights($role); |
179 | 179 | if (!empty($rights)) { |
180 | - foreach($rights as $c => $b) { |
|
180 | + foreach ($rights as $c => $b) { |
|
181 | 181 | $wp_roles->remove_cap($code, $c); |
182 | 182 | } |
183 | 183 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | // On ajoute les nouveaux droits |
186 | 186 | $rights = $this->getRoleRights($newrole); |
187 | 187 | if (!empty($rights)) { |
188 | - foreach($rights as $c => $b) { |
|
188 | + foreach ($rights as $c => $b) { |
|
189 | 189 | $wp_roles->add_cap($code, $c); |
190 | 190 | } |
191 | 191 | } |
@@ -226,22 +226,22 @@ discard block |
||
226 | 226 | self::manage_post(); |
227 | 227 | |
228 | 228 | ob_start(); |
229 | - wpshop_display::displayPageHeader(__('Groups', 'wpshop'), '', __('Groups', 'wpshop'), __('Groups', 'wpshop'), true, 'admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP.'&action=add', ''); |
|
229 | + wpshop_display::displayPageHeader(__('Groups', 'wpshop'), '', __('Groups', 'wpshop'), __('Groups', 'wpshop'), true, 'admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_GROUP . '&action=add', ''); |
|
230 | 230 | $content = ob_get_contents(); |
231 | 231 | ob_end_clean(); |
232 | 232 | $wps_customer_mdl = new wps_customer_mdl(); |
233 | - $action = !empty( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ''; |
|
234 | - $code = !empty( $_GET['code'] ) ? sanitize_text_field( $_GET['code'] ) : ''; |
|
233 | + $action = !empty($_GET['action']) ? sanitize_text_field($_GET['action']) : ''; |
|
234 | + $code = !empty($_GET['code']) ? sanitize_text_field($_GET['code']) : ''; |
|
235 | 235 | // Si on re�oit une action |
236 | - if ( !empty( $action ) ) { |
|
236 | + if (!empty($action)) { |
|
237 | 237 | |
238 | 238 | $readonly_name_field = ''; |
239 | 239 | |
240 | - switch ( $action ) { |
|
240 | + switch ($action) { |
|
241 | 241 | |
242 | 242 | case 'delete': |
243 | 243 | |
244 | - if ( !empty( $code ) ) { |
|
244 | + if (!empty($code)) { |
|
245 | 245 | |
246 | 246 | $roles = get_option('wp_user_roles', array()); |
247 | 247 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | - wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP)); |
|
255 | + wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_GROUP)); |
|
256 | 256 | |
257 | 257 | break; |
258 | 258 | |
@@ -269,36 +269,36 @@ discard block |
||
269 | 269 | $group_name = $role['name']; |
270 | 270 | $group_description = $role['description']; |
271 | 271 | $group_parent = $role['parent']; |
272 | - $submit_button_value = __('Edit the group','wpshop'); |
|
272 | + $submit_button_value = __('Edit the group', 'wpshop'); |
|
273 | 273 | $submit_button_name = 'editrole'; |
274 | 274 | |
275 | 275 | // ROLES |
276 | 276 | $roles = get_option('wp_user_roles', array()); |
277 | 277 | $select_parent = '<option value="">--</option>'; |
278 | 278 | |
279 | - foreach($roles as $code => $role) { |
|
279 | + foreach ($roles as $code => $role) { |
|
280 | 280 | if ($code != $code) { |
281 | - $selected = $group_parent==$code ? 'selected' : ''; |
|
282 | - $select_parent .= '<option value="'.$code.'" '.$selected.'>'.$role['name'].'</option>'; |
|
281 | + $selected = $group_parent == $code ? 'selected' : ''; |
|
282 | + $select_parent .= '<option value="' . $code . '" ' . $selected . '>' . $role['name'] . '</option>'; |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
286 | 286 | // USERS |
287 | 287 | $users = $wps_customer_mdl->getUserList(); |
288 | - if( !empty($users) ) { |
|
288 | + if (!empty($users)) { |
|
289 | 289 | $select_users = ''; |
290 | - foreach($users as $user) { |
|
290 | + foreach ($users as $user) { |
|
291 | 291 | if ($user->ID != 1) { |
292 | 292 | $u = new WP_User($user->ID); |
293 | - $selected = isset($u->roles[0]) && $u->roles[0]==$code ? 'selected' : ''; |
|
294 | - $select_users .= '<option value="'.$user->ID.'" '.$selected.'>'.$user->user_login.'</option>'; |
|
293 | + $selected = isset($u->roles[0]) && $u->roles[0] == $code ? 'selected' : ''; |
|
294 | + $select_users .= '<option value="' . $user->ID . '" ' . $selected . '>' . $user->user_login . '</option>'; |
|
295 | 295 | } |
296 | 296 | } |
297 | 297 | } |
298 | 298 | } |
299 | - else {wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP));exit;} |
|
299 | + else {wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_GROUP)); exit; } |
|
300 | 300 | } |
301 | - else {wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP));exit;} |
|
301 | + else {wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_GROUP)); exit; } |
|
302 | 302 | |
303 | 303 | break; |
304 | 304 | |
@@ -306,23 +306,23 @@ discard block |
||
306 | 306 | |
307 | 307 | |
308 | 308 | $group_name = $group_description = ''; |
309 | - $submit_button_value = __('Create the group','wpshop'); |
|
309 | + $submit_button_value = __('Create the group', 'wpshop'); |
|
310 | 310 | $submit_button_name = 'addrole'; |
311 | 311 | |
312 | 312 | // ROLES |
313 | 313 | $roles = get_option('wp_user_roles', array()); |
314 | - $select_parent = '<option value="">--</option>';; |
|
315 | - foreach($roles as $code => $role) { |
|
316 | - $select_parent .= '<option value="'.$code.'">'.$role['name'].'</option>'; |
|
314 | + $select_parent = '<option value="">--</option>'; ; |
|
315 | + foreach ($roles as $code => $role) { |
|
316 | + $select_parent .= '<option value="' . $code . '">' . $role['name'] . '</option>'; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | // USERS |
320 | 320 | $users = $wps_customer_mdl->getUserList(); |
321 | 321 | $select_users = ''; |
322 | - if( !empty($users) ) { |
|
323 | - foreach($users as $user) { |
|
322 | + if (!empty($users)) { |
|
323 | + foreach ($users as $user) { |
|
324 | 324 | if ($user->ID != 1) { |
325 | - $select_users .= '<option value="'.$user->ID.'">'.$user->user_login.'</option>'; |
|
325 | + $select_users .= '<option value="' . $user->ID . '">' . $user->user_login . '</option>'; |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | } |
@@ -332,21 +332,21 @@ discard block |
||
332 | 332 | |
333 | 333 | $content .= ' |
334 | 334 | <form method="post"> |
335 | - <label>'.__('Name','wpshop').'</label><br /><input type="text" name="group-name" style="width:500px;" value="'.$group_name.'" '.$readonly_name_field.' /><br /><br /> |
|
335 | + <label>'.__('Name', 'wpshop') . '</label><br /><input type="text" name="group-name" style="width:500px;" value="' . $group_name . '" ' . $readonly_name_field . ' /><br /><br /> |
|
336 | 336 | |
337 | - <label>'.__('Parent','wpshop').'</label><br /> |
|
337 | + <label>'.__('Parent', 'wpshop') . '</label><br /> |
|
338 | 338 | <select name="group-parent" class="chosen_select" style="width:500px;"> |
339 | - '.$select_parent.' |
|
339 | + '.$select_parent . ' |
|
340 | 340 | </select><br /><br /> |
341 | 341 | |
342 | - <label>'.__('Users','wpshop').'</label><br /> |
|
342 | + <label>'.__('Users', 'wpshop') . '</label><br /> |
|
343 | 343 | <select name="group-users[]" class="chosen_select" multiple style="width:500px;"> |
344 | - '.$select_users.' |
|
344 | + '.$select_users . ' |
|
345 | 345 | </select><br /><br /> |
346 | 346 | |
347 | - <label>'.__('Description','wpshop').'</label><br /><textarea name="group-description" style="width:500px;">'.$group_description.'</textarea><br /><br /> |
|
347 | + <label>'.__('Description', 'wpshop') . '</label><br /><textarea name="group-description" style="width:500px;">' . $group_description . '</textarea><br /><br /> |
|
348 | 348 | |
349 | - <input type="submit" class="button-primary" name="'.$submit_button_name.'" value="'.$submit_button_value.'" /> <a href="admin.php?page='.WPSHOP_NEWTYPE_IDENTIFIER_GROUP.'">'.__('Cancel','wpshop').'</a> |
|
349 | + <input type="submit" class="button-primary" name="'.$submit_button_name . '" value="' . $submit_button_value . '" /> <a href="admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_GROUP . '">' . __('Cancel', 'wpshop') . '</a> |
|
350 | 350 | </form> |
351 | 351 | '; |
352 | 352 | |
@@ -356,32 +356,32 @@ discard block |
||
356 | 356 | |
357 | 357 | $wpshop_list_table = new wpshop_groups_custom_List_table(); |
358 | 358 | //Fetch, prepare, sort, and filter our data... |
359 | - $status="'valid'"; |
|
360 | - $attribute_status = !empty( $_REQUEST['attribute_status'] ) ? sanitize_text_field( $_REQUEST['attribute_status'] ) : ''; |
|
361 | - $orderby = !empty( $_REQUEST['orderby'] ) ? sanitize_text_field( $_REQUEST['orderby'] ) : ''; |
|
362 | - $order = !empty( $_REQUEST['order'] ) ? sanitize_text_field( $_REQUEST['order'] ) : ''; |
|
363 | - if(!empty($attribute_status)){ |
|
364 | - switch($attribute_status){ |
|
359 | + $status = "'valid'"; |
|
360 | + $attribute_status = !empty($_REQUEST['attribute_status']) ? sanitize_text_field($_REQUEST['attribute_status']) : ''; |
|
361 | + $orderby = !empty($_REQUEST['orderby']) ? sanitize_text_field($_REQUEST['orderby']) : ''; |
|
362 | + $order = !empty($_REQUEST['order']) ? sanitize_text_field($_REQUEST['order']) : ''; |
|
363 | + if (!empty($attribute_status)) { |
|
364 | + switch ($attribute_status) { |
|
365 | 365 | case 'unactive': |
366 | - $status="'moderated', 'notused'"; |
|
367 | - if(empty($orderby) && empty($order)){ |
|
368 | - $orderby ='status'; |
|
369 | - $order ='asc'; |
|
366 | + $status = "'moderated', 'notused'"; |
|
367 | + if (empty($orderby) && empty($order)) { |
|
368 | + $orderby = 'status'; |
|
369 | + $order = 'asc'; |
|
370 | 370 | } |
371 | 371 | break; |
372 | 372 | default: |
373 | - $status="'".$attribute_status."'"; |
|
373 | + $status = "'" . $attribute_status . "'"; |
|
374 | 374 | break; |
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
378 | 378 | $roles = get_option('wp_user_roles', array()); |
379 | 379 | |
380 | - $i=0; |
|
381 | - $attribute_set_list=array(); |
|
382 | - $group_not_to_display = array('administrator','editor','author','contributor','subscriber'); |
|
380 | + $i = 0; |
|
381 | + $attribute_set_list = array(); |
|
382 | + $group_not_to_display = array('administrator', 'editor', 'author', 'contributor', 'subscriber'); |
|
383 | 383 | $wpshop_groups_meta = get_option('wpshop_groups_meta', array()); |
384 | - foreach($roles as $code => $role) { |
|
384 | + foreach ($roles as $code => $role) { |
|
385 | 385 | if (!in_array($code, $group_not_to_display)) { |
386 | 386 | $description = !empty($wpshop_groups_meta[$code]['description']) ? $wpshop_groups_meta[$code]['description'] : '--'; |
387 | 387 | $attribute_set_list[$i]['name'] = $role['name']; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Plugin configuration file. |
4 | 4 | * |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | /* Check if file is include. No direct access possible with file url */ |
13 | -if ( !defined( 'WPSHOP_VERSION' ) ) { |
|
14 | - die( __('Access is not allowed by this way', 'wpshop') ); |
|
13 | +if (!defined('WPSHOP_VERSION')) { |
|
14 | + die(__('Access is not allowed by this way', 'wpshop')); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /* Declare wordpress database class reference var */ |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | DEFINE('WPSHOP_PRODUCT_VIEW_NB', '_' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT . '_view_nb'); |
92 | 92 | DEFINE('WPSHOP_PRODUCT_FRONT_DISPLAY_CONF', '_' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT . '_attributes_frontend_display'); |
93 | 93 | |
94 | - DEFINE('WPSHOP_DEFAULT_CUSTOM_TYPES', serialize( array(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS) )); |
|
94 | + DEFINE('WPSHOP_DEFAULT_CUSTOM_TYPES', serialize(array(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS))); |
|
95 | 95 | |
96 | 96 | |
97 | 97 | DEFINE('WPSHOP_IDENTIFIER_CUSTOMER', 'U'); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | DEFINE('WPSHOP_COUNTRY_LIST', serialize($wpshop_tab_countries)); |
105 | 105 | |
106 | 106 | |
107 | - DEFINE('WPSHOP_COMMON_ATTRIBUTES_PARENT_VARIATION_PRODUCT', serialize(array('tx_tva')) ); |
|
107 | + DEFINE('WPSHOP_COMMON_ATTRIBUTES_PARENT_VARIATION_PRODUCT', serialize(array('tx_tva'))); |
|
108 | 108 | |
109 | 109 | /* Define database table names */ |
110 | 110 | DEFINE('WPSHOP_DBT_ENTITIES', $wpdb->prefix . 'wpshop__entity'); |
@@ -163,17 +163,17 @@ discard block |
||
163 | 163 | DEFINE('WPSHOP_DISPLAY_LIST_TYPE', $wpshop_display_option['wpshop_display_list_type']); |
164 | 164 | |
165 | 165 | /* ADMIN DISPLAY */ |
166 | - $attribute_page_layout_types=array('tab' => __('Tabs', 'wpshop'), 'separated_bloc' => __('Separated bloc', 'wpshop')); |
|
166 | + $attribute_page_layout_types = array('tab' => __('Tabs', 'wpshop'), 'separated_bloc' => __('Separated bloc', 'wpshop')); |
|
167 | 167 | $wpshop_admin_display_option = get_option('wpshop_admin_display_option', array()); |
168 | - DEFINE('WPSHOP_ATTRIBUTE_SET_EDITION_PAGE_LAYOUT', (!empty($wpshop_admin_display_option['wpshop_admin_attr_set_layout'])?$wpshop_admin_display_option['wpshop_admin_attr_set_layout']:'separated_bloc')); |
|
169 | - DEFINE('WPSHOP_ATTRIBUTE_EDITION_PAGE_LAYOUT', (!empty($wpshop_admin_display_option['wpshop_admin_attr_layout'])?$wpshop_admin_display_option['wpshop_admin_attr_layout']:'tab')); |
|
170 | - $product_page_layout_types=array('movable-tab' => __('Separated box in product page', 'wpshop'), 'fixed-tab' => __('A tab in product data box "Product data"', 'wpshop'), 'each-box' => __('In each attribute group section "Product data"', 'wpshop')); |
|
171 | - DEFINE('WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE', (!empty($wpshop_admin_display_option['wpshop_admin_product_shortcode_display'])?$wpshop_admin_display_option['wpshop_admin_product_shortcode_display']:'each-box')); |
|
168 | + DEFINE('WPSHOP_ATTRIBUTE_SET_EDITION_PAGE_LAYOUT', (!empty($wpshop_admin_display_option['wpshop_admin_attr_set_layout']) ? $wpshop_admin_display_option['wpshop_admin_attr_set_layout'] : 'separated_bloc')); |
|
169 | + DEFINE('WPSHOP_ATTRIBUTE_EDITION_PAGE_LAYOUT', (!empty($wpshop_admin_display_option['wpshop_admin_attr_layout']) ? $wpshop_admin_display_option['wpshop_admin_attr_layout'] : 'tab')); |
|
170 | + $product_page_layout_types = array('movable-tab' => __('Separated box in product page', 'wpshop'), 'fixed-tab' => __('A tab in product data box "Product data"', 'wpshop'), 'each-box' => __('In each attribute group section "Product data"', 'wpshop')); |
|
171 | + DEFINE('WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE', (!empty($wpshop_admin_display_option['wpshop_admin_product_shortcode_display']) ? $wpshop_admin_display_option['wpshop_admin_product_shortcode_display'] : 'each-box')); |
|
172 | 172 | |
173 | 173 | |
174 | 174 | /* Define the default email messages */ |
175 | - DEFINE('WPSHOP_SIGNUP_MESSAGE_OBJECT', __('Account creation confirmation','wpshop')); |
|
176 | - DEFINE('WPSHOP_SIGNUP_MESSAGE', __('Hello [customer_first_name] [customer_last_name], this email confirms that your account has just been created. Thank you for your loyalty. Have a good day.','wpshop')); |
|
175 | + DEFINE('WPSHOP_SIGNUP_MESSAGE_OBJECT', __('Account creation confirmation', 'wpshop')); |
|
176 | + DEFINE('WPSHOP_SIGNUP_MESSAGE', __('Hello [customer_first_name] [customer_last_name], this email confirms that your account has just been created. Thank you for your loyalty. Have a good day.', 'wpshop')); |
|
177 | 177 | |
178 | 178 | DEFINE('WPSHOP_ORDER_CONFIRMATION_MESSAGE_OBJECT', __('Your order has been recorded', 'wpshop')); |
179 | 179 | DEFINE('WPSHOP_ORDER_CONFIRMATION_MESSAGE', __('Hello [customer_first_name] [customer_last_name], this email confirms that your order has been recorded (order date : [order_date]). Thank you for your loyalty. Have a good day.', 'wpshop')); |
@@ -208,14 +208,14 @@ discard block |
||
208 | 208 | DEFINE('WPSHOP_DOWNLOADABLE_FILE_IS_AVAILABLE_OBJECT', __('Your downloadable product is available', 'wpshop')); |
209 | 209 | DEFINE('WPSHOP_DOWNLOADABLE_FILE_IS_AVAILABLE', __('Hello [customer_first_name] [customer_last_name], <br />this email confirms that your downloadable product is available : [download_product_link].<br /><br /> Thank you for your loyalty. Have a good day.', 'wpshop')); |
210 | 210 | |
211 | - DEFINE('WPSHOP_ORDER_IS_CANCELED_OBJECT', __('Your order has been canceled', 'wpshop') ); |
|
211 | + DEFINE('WPSHOP_ORDER_IS_CANCELED_OBJECT', __('Your order has been canceled', 'wpshop')); |
|
212 | 212 | DEFINE('WPSHOP_ORDER_IS_CANCELED', __('Hello [customer_first_name] [customer_last_name], <br />this email confirms your order ( Order key : [order_key] - Date : [order_date] ) has been canceled.<br /><br /> Thank you for your loyalty. Have a good day.', 'wpshop')); |
213 | 213 | |
214 | - DEFINE('WPSHOP_FORGOT_PASSWORD_MESSAGE_OBJECT', __('Renewal of password', 'wpshop') ); |
|
215 | - DEFINE('WPSHOP_FORGOT_PASSWORD_MESSAGE', __('Hello [customer_first_name] [customer_last_name], <br />Somebody has asked a renewal of password for your account.<br/><br/>To renew your password, click on this link : [forgot_password_link].<br/>If you are not at the origin of this request, please ignore this message.', 'wpshop') ); |
|
214 | + DEFINE('WPSHOP_FORGOT_PASSWORD_MESSAGE_OBJECT', __('Renewal of password', 'wpshop')); |
|
215 | + DEFINE('WPSHOP_FORGOT_PASSWORD_MESSAGE', __('Hello [customer_first_name] [customer_last_name], <br />Somebody has asked a renewal of password for your account.<br/><br/>To renew your password, click on this link : [forgot_password_link].<br/>If you are not at the origin of this request, please ignore this message.', 'wpshop')); |
|
216 | 216 | |
217 | - DEFINE('WPSHOP_DIRECT_PAYMENT_LINK_MESSAGE_OBJECT', __('Pay and finalize your order', 'wpshop') ); |
|
218 | - DEFINE('WPSHOP_DIRECT_PAYMENT_LINK_MESSAGE', __('Hello [customer_first_name] [customer_last_name], <br />An order is available for you on our website.<br/>You can click on this link to pay and finalize this order : [direct_payment_link]<br/><br/>[order_content]<br /><br />Thank you for your loyalty. Have a good day.', 'wpshop') ); |
|
217 | + DEFINE('WPSHOP_DIRECT_PAYMENT_LINK_MESSAGE_OBJECT', __('Pay and finalize your order', 'wpshop')); |
|
218 | + DEFINE('WPSHOP_DIRECT_PAYMENT_LINK_MESSAGE', __('Hello [customer_first_name] [customer_last_name], <br />An order is available for you on our website.<br/>You can click on this link to pay and finalize this order : [direct_payment_link]<br/><br/>[order_content]<br /><br />Thank you for your loyalty. Have a good day.', 'wpshop')); |
|
219 | 219 | |
220 | 220 | |
221 | 221 | /* Define debug vars */ |
@@ -225,39 +225,39 @@ discard block |
||
225 | 225 | |
226 | 226 | /* ALLOWED IPS */ |
227 | 227 | $default_ip = array('127.0.0.1', '0.0.0.0'); |
228 | - DEFINE('WPSHOP_DEBUG_MODE_ALLOWED_IP', (!empty($extra_options['WPSHOP_DEBUG_MODE_ALLOWED_IP'])?serialize(array_merge($default_ip, array($extra_options['WPSHOP_DEBUG_MODE_ALLOWED_IP']))):serialize($default_ip))); |
|
228 | + DEFINE('WPSHOP_DEBUG_MODE_ALLOWED_IP', (!empty($extra_options['WPSHOP_DEBUG_MODE_ALLOWED_IP']) ? serialize(array_merge($default_ip, array($extra_options['WPSHOP_DEBUG_MODE_ALLOWED_IP']))) : serialize($default_ip))); |
|
229 | 229 | /* DEBUG MODE */ |
230 | 230 | $debug_mode = false; |
231 | - if ( !empty($extra_options['WPSHOP_DEBUG_MODE']) && ($extra_options['WPSHOP_DEBUG_MODE'] == 'true') || (!empty($_GET['distant_debug_mode']) && sanitize_key($_GET['distant_debug_mode']) == 'eoxia') ) |
|
231 | + if (!empty($extra_options['WPSHOP_DEBUG_MODE']) && ($extra_options['WPSHOP_DEBUG_MODE'] == 'true') || (!empty($_GET['distant_debug_mode']) && sanitize_key($_GET['distant_debug_mode']) == 'eoxia')) |
|
232 | 232 | $debug_mode = true; |
233 | 233 | DEFINE('WPSHOP_DEBUG_MODE', $debug_mode); |
234 | 234 | /* DATA DELETE */ |
235 | 235 | $delete_data = false; |
236 | - if ( !empty($extra_options['WPSHOP_DEBUG_MODE_ALLOW_DATA_DELETION']) && ($extra_options['WPSHOP_DEBUG_MODE_ALLOW_DATA_DELETION'] == 'true') ) |
|
236 | + if (!empty($extra_options['WPSHOP_DEBUG_MODE_ALLOW_DATA_DELETION']) && ($extra_options['WPSHOP_DEBUG_MODE_ALLOW_DATA_DELETION'] == 'true')) |
|
237 | 237 | $delete_data = true; |
238 | 238 | DEFINE('WPSHOP_DEBUG_MODE_ALLOW_DATA_DELETION', $delete_data); |
239 | 239 | |
240 | 240 | /* TOOLS MENU */ |
241 | 241 | $tools_menu_display = false; |
242 | - if ( !empty($extra_options['WPSHOP_DISPLAY_TOOLS_MENU']) && ($extra_options['WPSHOP_DISPLAY_TOOLS_MENU'] == 'true') ) |
|
242 | + if (!empty($extra_options['WPSHOP_DISPLAY_TOOLS_MENU']) && ($extra_options['WPSHOP_DISPLAY_TOOLS_MENU'] == 'true')) |
|
243 | 243 | $tools_menu_display = true; |
244 | 244 | DEFINE('WPSHOP_DISPLAY_TOOLS_MENU', $tools_menu_display); |
245 | 245 | |
246 | 246 | /* ATT VALUE PER USER */ |
247 | 247 | $attr_value_per_user = false; |
248 | - if ( !empty($extra_options['WPSHOP_ATTRIBUTE_VALUE_PER_USER']) && ($extra_options['WPSHOP_ATTRIBUTE_VALUE_PER_USER'] == 'true') ) |
|
248 | + if (!empty($extra_options['WPSHOP_ATTRIBUTE_VALUE_PER_USER']) && ($extra_options['WPSHOP_ATTRIBUTE_VALUE_PER_USER'] == 'true')) |
|
249 | 249 | $attr_value_per_user = true; |
250 | 250 | DEFINE('WPSHOP_ATTRIBUTE_VALUE_PER_USER', $attr_value_per_user); |
251 | 251 | |
252 | 252 | /* DISPLAY AVAILABLE KEYS FOR TEMPLATE */ |
253 | 253 | $display_available_keys_for_template = false; |
254 | - if ( !empty($extra_options['WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE']) && ($extra_options['WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE'] == 'true') ) |
|
254 | + if (!empty($extra_options['WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE']) && ($extra_options['WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE'] == 'true')) |
|
255 | 255 | $display_available_keys_for_template = true; |
256 | 256 | DEFINE('WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE', $display_available_keys_for_template); |
257 | 257 | |
258 | 258 | /* MULTIPLE VALUE PER USER */ |
259 | 259 | $display_value_attribute_type_select = false; |
260 | - if ( !empty($extra_options['WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT']) && ($extra_options['WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT'] == 'true') ) |
|
260 | + if (!empty($extra_options['WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT']) && ($extra_options['WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT'] == 'true')) |
|
261 | 261 | $display_value_attribute_type_select = true; |
262 | 262 | DEFINE('WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT', $display_value_attribute_type_select); |
263 | 263 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | /* Define the different vars used for price calculation */ |
287 | 287 | $wpshop_shop_price_piloting = get_option('wpshop_shop_price_piloting'); |
288 | - DEFINE('WPSHOP_PRODUCT_PRICE_PILOT', ( !empty($wpshop_shop_price_piloting) ? $wpshop_shop_price_piloting : 'TTC')); |
|
288 | + DEFINE('WPSHOP_PRODUCT_PRICE_PILOT', (!empty($wpshop_shop_price_piloting) ? $wpshop_shop_price_piloting : 'TTC')); |
|
289 | 289 | |
290 | 290 | DEFINE('WPSHOP_COST_OF_POSTAGE', 'cost_of_postage'); |
291 | 291 | DEFINE('WPSHOP_PRODUCT_PRICE_HT', 'price_ht'); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | DEFINE('WPSHOP_ATTRIBUTE_UNDELETABLE', serialize(array_merge(array(), unserialize(WPSHOP_ATTRIBUTE_PRICES)))); |
307 | 307 | |
308 | 308 | /* Define the attribute list to hide or variation creation */ |
309 | - DEFINE('WPSHOP_VARIATION_ATTRIBUTE_TO_HIDE', serialize( array_merge(unserialize(WPSHOP_ATTRIBUTE_PRICES), array('product_attribute_set_id', 'product_reference')) ) ); |
|
309 | + DEFINE('WPSHOP_VARIATION_ATTRIBUTE_TO_HIDE', serialize(array_merge(unserialize(WPSHOP_ATTRIBUTE_PRICES), array('product_attribute_set_id', 'product_reference')))); |
|
310 | 310 | |
311 | 311 | /* Define the default currency */ |
312 | 312 | DEFINE('WPSHOP_SHOP_DEFAULT_CURRENCY', 'EUR'); |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | /* Define the shipping default rules */ |
319 | 319 | DEFINE('WPSHOP_SHOP_SHIPPING_RULES', serialize(array( |
320 | - 'min_max' => array('min'=>0,'max'=>30), |
|
320 | + 'min_max' => array('min'=>0, 'max'=>30), |
|
321 | 321 | 'free_from' => 4500 |
322 | 322 | ))); |
323 | 323 | $shipping_fees_array = array( |
@@ -339,20 +339,20 @@ discard block |
||
339 | 339 | |
340 | 340 | /* Define addons modules */ |
341 | 341 | DEFINE('WPSHOP_ADDONS_KEY_IS', '48'); |
342 | - DEFINE('WPSHOP_ADDONS_STATES_CLASS', serialize( array(true => 'wpshop_addons_state wpshop_addons_state_activated', false => 'wpshop_addons_state wpshop_addons_state_deactivated'))); |
|
343 | - DEFINE('WPSHOP_ADDONS_LIST', serialize(array('WPSHOP_ADDONS_QUOTATION' => array(__('Quotation','wpshop'), '48', 'per_site', 'quotation_allowed', 'WPSHOP_NEW_QUOTATION_ADMIN_MESSAGE'), 'WPSHOP_ADDONS_PAYMENT_GATEWAY_CB_CIC' => array(__('Payment gateway CIC','wpshop'), '32', 'per_site', '')/* , 'WPSHOP_ADDONS_PRICE_PER_GROUP' => array(__('Price per user group','wpshop'), '13', 'free') */))); |
|
344 | - DEFINE('WPSHOP_ADDONS_QUOTATION', (!empty($wpshop_addons_state['WPSHOP_ADDONS_QUOTATION']['activate'])?$wpshop_addons_state['WPSHOP_ADDONS_QUOTATION']['activate']:false)); |
|
345 | - DEFINE('WPSHOP_ADDONS_PRICE_PER_GROUP', (!empty($wpshop_addons_state['WPSHOP_ADDONS_PRICE_PER_GROUP']['activate'])?$wpshop_addons_state['WPSHOP_ADDONS_PRICE_PER_GROUP']['activate']:false)); |
|
346 | - DEFINE('WPSHOP_PAYMENT_METHOD_CIC', (!empty($wpshop_addons_state['WPSHOP_ADDONS_PAYMENT_GATEWAY_CB_CIC']['activate'])?$wpshop_addons_state['WPSHOP_ADDONS_PAYMENT_GATEWAY_CB_CIC']['activate']:false)); |
|
342 | + DEFINE('WPSHOP_ADDONS_STATES_CLASS', serialize(array(true => 'wpshop_addons_state wpshop_addons_state_activated', false => 'wpshop_addons_state wpshop_addons_state_deactivated'))); |
|
343 | + DEFINE('WPSHOP_ADDONS_LIST', serialize(array('WPSHOP_ADDONS_QUOTATION' => array(__('Quotation', 'wpshop'), '48', 'per_site', 'quotation_allowed', 'WPSHOP_NEW_QUOTATION_ADMIN_MESSAGE'), 'WPSHOP_ADDONS_PAYMENT_GATEWAY_CB_CIC' => array(__('Payment gateway CIC', 'wpshop'), '32', 'per_site', '')/* , 'WPSHOP_ADDONS_PRICE_PER_GROUP' => array(__('Price per user group','wpshop'), '13', 'free') */))); |
|
344 | + DEFINE('WPSHOP_ADDONS_QUOTATION', (!empty($wpshop_addons_state['WPSHOP_ADDONS_QUOTATION']['activate']) ? $wpshop_addons_state['WPSHOP_ADDONS_QUOTATION']['activate'] : false)); |
|
345 | + DEFINE('WPSHOP_ADDONS_PRICE_PER_GROUP', (!empty($wpshop_addons_state['WPSHOP_ADDONS_PRICE_PER_GROUP']['activate']) ? $wpshop_addons_state['WPSHOP_ADDONS_PRICE_PER_GROUP']['activate'] : false)); |
|
346 | + DEFINE('WPSHOP_PAYMENT_METHOD_CIC', (!empty($wpshop_addons_state['WPSHOP_ADDONS_PAYMENT_GATEWAY_CB_CIC']['activate']) ? $wpshop_addons_state['WPSHOP_ADDONS_PAYMENT_GATEWAY_CB_CIC']['activate'] : false)); |
|
347 | 347 | DEFINE('WPSHOP_ADDONS_QUOTATION_CODE', 'nfdJK-AsBCO-%AZDZA'); |
348 | 348 | DEFINE('WPSHOP_ADDONS_PRICE_PER_GROUP_CODE', '7GnnQ-5FeqZ-BiKz3'); |
349 | 349 | DEFINE('WPSHOP_ADDONS_PAYMENT_GATEWAY_CB_CIC', 'nZYsM-vQ8qC-VfVfA'); |
350 | 350 | |
351 | 351 | /* Define payment method params */ |
352 | 352 | $wpshop_paymentMethod = get_option('wps_payment_mode'); |
353 | - if(WPSHOP_PAYMENT_METHOD_CIC || !empty($wpshop_paymentMethod['mode']) && !empty($wpshop_paymentMethod['mode']['cic']) ) { |
|
353 | + if (WPSHOP_PAYMENT_METHOD_CIC || !empty($wpshop_paymentMethod['mode']) && !empty($wpshop_paymentMethod['mode']['cic'])) { |
|
354 | 354 | $cmcic_params = get_option('wpshop_cmcic_params', array()); |
355 | - if(!empty($cmcic_params)){ |
|
355 | + if (!empty($cmcic_params)) { |
|
356 | 356 | DEFINE("CMCIC_CLE", $cmcic_params['cle']); |
357 | 357 | DEFINE("CMCIC_TPE", $cmcic_params['tpe']); |
358 | 358 | DEFINE("CMCIC_VERSION", $cmcic_params['version']); |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | } |
365 | 365 | |
366 | 366 | /** Civility */ |
367 | -$civility = array(1=>__('Mr.','wpshop'),__('Mrs.','wpshop'),__('Miss','wpshop')); |
|
367 | +$civility = array(1=>__('Mr.', 'wpshop'), __('Mrs.', 'wpshop'), __('Miss', 'wpshop')); |
|
368 | 368 | /** Status */ |
369 | 369 | $order_status = array( |
370 | 370 | '' => __('Awaiting treatment', 'wpshop'), |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | 'show_ui' => 'boolean', |
393 | 393 | 'show_in_nav_menus' => 'boolean', |
394 | 394 | 'show_in_menu' => 'boolean|text', |
395 | - 'capabilities' => array( 'publish_posts', 'edit_posts', 'edit_others_posts', 'delete_posts', 'delete_others_posts', 'read_private_posts', 'edit_post', 'delete_post', 'read_post' ), |
|
395 | + 'capabilities' => array('publish_posts', 'edit_posts', 'edit_others_posts', 'delete_posts', 'delete_others_posts', 'read_private_posts', 'edit_post', 'delete_post', 'read_post'), |
|
396 | 396 | 'hierarchical' => false, |
397 | 397 | 'rewrite' => false, |
398 | 398 | 'query_var' => true, |
399 | 399 | 'supports' => unserialize(WPSHOP_REGISTER_POST_TYPE_SUPPORT) |
400 | 400 | ); |
401 | 401 | DEFINE('WPSHOP_REGISTER_POST_TYPE_ARGS', serialize($register_post_type_args)); |
402 | -DEFINE('WPSHOP_REGISTER_POST_TYPE_MANDATORY_SUPPORTS', serialize( array('title', 'editor', 'thumbnail', 'excerpt') )); |
|
402 | +DEFINE('WPSHOP_REGISTER_POST_TYPE_MANDATORY_SUPPORTS', serialize(array('title', 'editor', 'thumbnail', 'excerpt'))); |
|
403 | 403 | DEFINE('WPSHOP_PRODUCT_HIDDEN_METABOX', serialize(array('formatdiv', 'pageparentdiv', 'postexcerpt', 'trackbacksdiv', 'postcustom', 'commentstatusdiv', 'commentsdiv', 'slugdiv', 'authordiv', 'revisionsdiv'))); |
404 | 404 | |
405 | 405 | /* Shop type */ |
@@ -410,8 +410,8 @@ discard block |
||
410 | 410 | DEFINE('WPSHOP_ATTR_SELECT_TYPE_TOGGLED', serialize(array('custom' => 'internal_data', 'internal' => 'custom_data'))); |
411 | 411 | |
412 | 412 | /* Define the types existing into the current wordpress installation */ |
413 | -$default_to_exclude = array('attachment','revision','nav_menu_item', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE); |
|
414 | -DEFINE('WPSHOP_INTERNAL_TYPES_TO_EXCLUDE', (!empty($extra_options['WPSHOP_INTERNAL_TYPES_TO_EXCLUDE'])?serialize(array_merge(array($extra_options['WPSHOP_INTERNAL_TYPES_TO_EXCLUDE']),$default_to_exclude)):serialize($default_to_exclude))); |
|
413 | +$default_to_exclude = array('attachment', 'revision', 'nav_menu_item', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE); |
|
414 | +DEFINE('WPSHOP_INTERNAL_TYPES_TO_EXCLUDE', (!empty($extra_options['WPSHOP_INTERNAL_TYPES_TO_EXCLUDE']) ? serialize(array_merge(array($extra_options['WPSHOP_INTERNAL_TYPES_TO_EXCLUDE']), $default_to_exclude)) : serialize($default_to_exclude))); |
|
415 | 415 | |
416 | 416 | /* Start form field display config */ |
417 | 417 | /* Get the list of possible posts status */ |
@@ -421,9 +421,9 @@ discard block |
||
421 | 421 | $comboxOptionToHide = array('deleted'); |
422 | 422 | |
423 | 423 | /* Attributes form */ |
424 | - $attribute_displayed_field = array('id', 'status', 'entity_id', 'is_required', 'is_unique', 'is_visible_in_front', 'is_visible_in_front_listing', 'frontend_input', 'backend_input', 'frontend_label', 'default_value', 'is_requiring_unit', '_unit_group_id', '_default_unit', 'is_historisable','is_intrinsic', 'is_filterable', 'code', 'is_used_for_sort_by', 'is_visible_in_advanced_search', 'is_used_in_admin_listing_column', 'is_used_in_quick_add_form', 'frontend_verification', 'is_user_defined', 'is_used_in_variation', 'is_used_for_variation', '_need_verification', '_display_informations_about_value', 'frontend_css_class', 'backend_css_class', 'frontend_help_message', 'is_searchable'); |
|
425 | - $attribute_options_group = array(__('Attribute unit', 'wpshop') => array('is_requiring_unit','_unit_group_id','_default_unit'), __('Frontend option', 'wpshop') => array('is_visible_in_front','is_visible_in_front_listing','is_used_for_sort_by','is_visible_in_advanced_search', 'is_searchable', '_display_informations_about_value'), __('Variations', 'wpshop') => array('is_user_defined', 'is_used_in_variation', 'is_used_for_variation', 'frontend_input')); |
|
426 | - DEFINE('WPSHOP_ATTRIBUTE_DEF_COLUMN_INTO_OPTIONS', serialize( array('_need_verification', 'frontend_verification', 'frontend_css_class', 'backend_css_class', 'frontend_help_message', 'frontend_help_message') )); |
|
424 | + $attribute_displayed_field = array('id', 'status', 'entity_id', 'is_required', 'is_unique', 'is_visible_in_front', 'is_visible_in_front_listing', 'frontend_input', 'backend_input', 'frontend_label', 'default_value', 'is_requiring_unit', '_unit_group_id', '_default_unit', 'is_historisable', 'is_intrinsic', 'is_filterable', 'code', 'is_used_for_sort_by', 'is_visible_in_advanced_search', 'is_used_in_admin_listing_column', 'is_used_in_quick_add_form', 'frontend_verification', 'is_user_defined', 'is_used_in_variation', 'is_used_for_variation', '_need_verification', '_display_informations_about_value', 'frontend_css_class', 'backend_css_class', 'frontend_help_message', 'is_searchable'); |
|
425 | + $attribute_options_group = array(__('Attribute unit', 'wpshop') => array('is_requiring_unit', '_unit_group_id', '_default_unit'), __('Frontend option', 'wpshop') => array('is_visible_in_front', 'is_visible_in_front_listing', 'is_used_for_sort_by', 'is_visible_in_advanced_search', 'is_searchable', '_display_informations_about_value'), __('Variations', 'wpshop') => array('is_user_defined', 'is_used_in_variation', 'is_used_for_variation', 'frontend_input')); |
|
426 | + DEFINE('WPSHOP_ATTRIBUTE_DEF_COLUMN_INTO_OPTIONS', serialize(array('_need_verification', 'frontend_verification', 'frontend_css_class', 'backend_css_class', 'frontend_help_message', 'frontend_help_message'))); |
|
427 | 427 | |
428 | 428 | /* General form */ |
429 | 429 | $attribute_hidden_field = array('position'); |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Plugin configuration file. |
4 | 6 | * |
@@ -228,37 +230,43 @@ discard block |
||
228 | 230 | DEFINE('WPSHOP_DEBUG_MODE_ALLOWED_IP', (!empty($extra_options['WPSHOP_DEBUG_MODE_ALLOWED_IP'])?serialize(array_merge($default_ip, array($extra_options['WPSHOP_DEBUG_MODE_ALLOWED_IP']))):serialize($default_ip))); |
229 | 231 | /* DEBUG MODE */ |
230 | 232 | $debug_mode = false; |
231 | - if ( !empty($extra_options['WPSHOP_DEBUG_MODE']) && ($extra_options['WPSHOP_DEBUG_MODE'] == 'true') || (!empty($_GET['distant_debug_mode']) && sanitize_key($_GET['distant_debug_mode']) == 'eoxia') ) |
|
232 | - $debug_mode = true; |
|
233 | + if ( !empty($extra_options['WPSHOP_DEBUG_MODE']) && ($extra_options['WPSHOP_DEBUG_MODE'] == 'true') || (!empty($_GET['distant_debug_mode']) && sanitize_key($_GET['distant_debug_mode']) == 'eoxia') ) { |
|
234 | + $debug_mode = true; |
|
235 | + } |
|
233 | 236 | DEFINE('WPSHOP_DEBUG_MODE', $debug_mode); |
234 | 237 | /* DATA DELETE */ |
235 | 238 | $delete_data = false; |
236 | - if ( !empty($extra_options['WPSHOP_DEBUG_MODE_ALLOW_DATA_DELETION']) && ($extra_options['WPSHOP_DEBUG_MODE_ALLOW_DATA_DELETION'] == 'true') ) |
|
237 | - $delete_data = true; |
|
239 | + if ( !empty($extra_options['WPSHOP_DEBUG_MODE_ALLOW_DATA_DELETION']) && ($extra_options['WPSHOP_DEBUG_MODE_ALLOW_DATA_DELETION'] == 'true') ) { |
|
240 | + $delete_data = true; |
|
241 | + } |
|
238 | 242 | DEFINE('WPSHOP_DEBUG_MODE_ALLOW_DATA_DELETION', $delete_data); |
239 | 243 | |
240 | 244 | /* TOOLS MENU */ |
241 | 245 | $tools_menu_display = false; |
242 | - if ( !empty($extra_options['WPSHOP_DISPLAY_TOOLS_MENU']) && ($extra_options['WPSHOP_DISPLAY_TOOLS_MENU'] == 'true') ) |
|
243 | - $tools_menu_display = true; |
|
246 | + if ( !empty($extra_options['WPSHOP_DISPLAY_TOOLS_MENU']) && ($extra_options['WPSHOP_DISPLAY_TOOLS_MENU'] == 'true') ) { |
|
247 | + $tools_menu_display = true; |
|
248 | + } |
|
244 | 249 | DEFINE('WPSHOP_DISPLAY_TOOLS_MENU', $tools_menu_display); |
245 | 250 | |
246 | 251 | /* ATT VALUE PER USER */ |
247 | 252 | $attr_value_per_user = false; |
248 | - if ( !empty($extra_options['WPSHOP_ATTRIBUTE_VALUE_PER_USER']) && ($extra_options['WPSHOP_ATTRIBUTE_VALUE_PER_USER'] == 'true') ) |
|
249 | - $attr_value_per_user = true; |
|
253 | + if ( !empty($extra_options['WPSHOP_ATTRIBUTE_VALUE_PER_USER']) && ($extra_options['WPSHOP_ATTRIBUTE_VALUE_PER_USER'] == 'true') ) { |
|
254 | + $attr_value_per_user = true; |
|
255 | + } |
|
250 | 256 | DEFINE('WPSHOP_ATTRIBUTE_VALUE_PER_USER', $attr_value_per_user); |
251 | 257 | |
252 | 258 | /* DISPLAY AVAILABLE KEYS FOR TEMPLATE */ |
253 | 259 | $display_available_keys_for_template = false; |
254 | - if ( !empty($extra_options['WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE']) && ($extra_options['WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE'] == 'true') ) |
|
255 | - $display_available_keys_for_template = true; |
|
260 | + if ( !empty($extra_options['WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE']) && ($extra_options['WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE'] == 'true') ) { |
|
261 | + $display_available_keys_for_template = true; |
|
262 | + } |
|
256 | 263 | DEFINE('WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE', $display_available_keys_for_template); |
257 | 264 | |
258 | 265 | /* MULTIPLE VALUE PER USER */ |
259 | 266 | $display_value_attribute_type_select = false; |
260 | - if ( !empty($extra_options['WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT']) && ($extra_options['WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT'] == 'true') ) |
|
261 | - $display_value_attribute_type_select = true; |
|
267 | + if ( !empty($extra_options['WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT']) && ($extra_options['WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT'] == 'true') ) { |
|
268 | + $display_value_attribute_type_select = true; |
|
269 | + } |
|
262 | 270 | DEFINE('WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT', $display_value_attribute_type_select); |
263 | 271 | |
264 | 272 | /* Define element prefix */ |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * Fichier du controlleur principal de l'extension de caisse pour WP-Shop / Main controller file for point of sale management plugin |
@@ -20,37 +20,37 @@ discard block |
||
20 | 20 | */ |
21 | 21 | function __construct() { |
22 | 22 | /** Declaration des sessions / Call session utilities on init */ |
23 | - add_action( 'init', array( $this, 'wps_pos_addon_session' ) ); |
|
24 | - add_action( 'init', array( $this, 'wps_pos_option_db' ) ); |
|
23 | + add_action('init', array($this, 'wps_pos_addon_session')); |
|
24 | + add_action('init', array($this, 'wps_pos_option_db')); |
|
25 | 25 | |
26 | - $tab = ( !empty( $_GET['tab'] ) ) ? sanitize_text_field( $_GET['tab'] ) : ''; |
|
26 | + $tab = (!empty($_GET['tab'])) ? sanitize_text_field($_GET['tab']) : ''; |
|
27 | 27 | |
28 | - if( !empty( $tab ) || $tab == 'dashboard' ) { |
|
28 | + if (!empty($tab) || $tab == 'dashboard') { |
|
29 | 29 | /** Instanciation des différents composants du logiciel de caisse / Instanciate the different component for POS addon */ |
30 | 30 | $this->wps_pos_customer = new wps_pos_addon_customer(); |
31 | 31 | $this->wps_pos_product = new wps_pos_addon_product(); |
32 | 32 | $this->wps_pos_order = new wps_pos_addon_order(); |
33 | - } elseif( $tab == 'bank_deposit' ) { |
|
33 | + } elseif ($tab == 'bank_deposit') { |
|
34 | 34 | $this->wps_pos_addon_bank_deposit = new wps_pos_addon_bank_deposit(); |
35 | 35 | $this->wps_pos_addon_bank_deposit_histo = new wps_pos_addon_bank_deposit_histo(); |
36 | 36 | |
37 | 37 | /** AJAX Bank Deposit **/ |
38 | - add_action( 'wp_ajax_save_historic_query', array( $this->wps_pos_addon_bank_deposit_histo, 'save_historic_ajax' ) ); |
|
38 | + add_action('wp_ajax_save_historic_query', array($this->wps_pos_addon_bank_deposit_histo, 'save_historic_ajax')); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** Appel des scripts et styles pour le logiciel de caisse / Include styles and scripts for backend */ |
42 | - add_action( 'admin_enqueue_scripts', array( &$this, 'admin_assets' ) ); |
|
43 | - add_action( 'admin_print_scripts', array( &$this, 'print_js') ); |
|
42 | + add_action('admin_enqueue_scripts', array(&$this, 'admin_assets')); |
|
43 | + add_action('admin_print_scripts', array(&$this, 'print_js')); |
|
44 | 44 | |
45 | 45 | /** Appel du point d'accroche de création de menu dans l'administration et redéfinition de l'ordre des menus / Define the administration menu with some arrangements for displaying the created menu under wpshop menu */ |
46 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
47 | - add_action( 'menu_order', array( $this, 'admin_menu_order' ), 11 ); |
|
48 | - add_action( 'custom_menu_order', array( $this, 'admin_custom_menu_order' ) ); |
|
46 | + add_action('admin_menu', array($this, 'admin_menu')); |
|
47 | + add_action('menu_order', array($this, 'admin_menu_order'), 11); |
|
48 | + add_action('custom_menu_order', array($this, 'admin_custom_menu_order')); |
|
49 | 49 | |
50 | 50 | /** AJAX Definition */ |
51 | 51 | /** Recharge la liste d'un élément donné ( client ou produit ) pour une lettre donnée / Load element list corresponding to a given letter */ |
52 | - add_action( 'wp_ajax_wpspos_load_element_from_letter', array( $this, 'ajax_load_element_from_letter' ) ); |
|
53 | - add_action( 'wp_ajax_wpspos_save_config_barcode_only', array( $this, 'ajax_save_config_barcode_only' ) ); |
|
52 | + add_action('wp_ajax_wpspos_load_element_from_letter', array($this, 'ajax_load_element_from_letter')); |
|
53 | + add_action('wp_ajax_wpspos_save_config_barcode_only', array($this, 'ajax_save_config_barcode_only')); |
|
54 | 54 | // add_action( 'wap_ajax_wpspos_state_is_quotation', array( $this, 'ajax_wpspos_state_is_quotation' ) ); |
55 | 55 | // add_action( 'wap_ajax_wpspos_state_is_receipt', array( $this, 'ajax_wpspos_state_is_receipt' ) ); |
56 | 56 | |
@@ -66,17 +66,17 @@ discard block |
||
66 | 66 | function admin_assets() { |
67 | 67 | global $wps_pos_addon_menu; |
68 | 68 | $screen = get_current_screen(); |
69 | - if ( $screen->id == $wps_pos_addon_menu ) { |
|
70 | - wp_register_style( 'wpspos-common-styles', WPSPOS_URL . 'assets/css/backend.css', '', WPSPOS_VERSION ); |
|
71 | - wp_enqueue_style( 'wpspos-common-styles' ); |
|
69 | + if ($screen->id == $wps_pos_addon_menu) { |
|
70 | + wp_register_style('wpspos-common-styles', WPSPOS_URL . 'assets/css/backend.css', '', WPSPOS_VERSION); |
|
71 | + wp_enqueue_style('wpspos-common-styles'); |
|
72 | 72 | |
73 | - $tab = ( !empty( $_GET['tab'] ) ) ? sanitize_text_field( $_GET['tab'] ) : ''; |
|
73 | + $tab = (!empty($_GET['tab'])) ? sanitize_text_field($_GET['tab']) : ''; |
|
74 | 74 | |
75 | - if( empty( $tab ) || $tab == 'bank_deposit' ) { |
|
76 | - wp_enqueue_script('wpspos-backend-bank-deposit-js', WPSPOS_URL . 'assets/js/backend_bank_deposit.js', '', WPSPOS_VERSION); |
|
75 | + if (empty($tab) || $tab == 'bank_deposit') { |
|
76 | + wp_enqueue_script('wpspos-backend-bank-deposit-js', WPSPOS_URL . 'assets/js/backend_bank_deposit.js', '', WPSPOS_VERSION); |
|
77 | 77 | } else { |
78 | - wp_enqueue_script('wpspos-backend-js', WPSPOS_URL . 'assets/js/backend.js', '', WPSPOS_VERSION); |
|
79 | - wp_enqueue_script('wpshop_jquery_chosen', WPSHOP_JS_URL . 'jquery-libs/chosen.jquery.min.js', '', WPSHOP_VERSION); |
|
78 | + wp_enqueue_script('wpspos-backend-js', WPSPOS_URL . 'assets/js/backend.js', '', WPSPOS_VERSION); |
|
79 | + wp_enqueue_script('wpshop_jquery_chosen', WPSHOP_JS_URL . 'jquery-libs/chosen.jquery.min.js', '', WPSHOP_VERSION); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | global $wps_pos_addon_menu; |
89 | 89 | $screen = get_current_screen(); |
90 | 90 | |
91 | - if ( $screen->id == $wps_pos_addon_menu ) { |
|
92 | - require_once( wpshop_tools::get_template_part( WPSPOS_DIR, WPSPOS_PATH . 'assets/', 'js', 'header.js' ) ); |
|
91 | + if ($screen->id == $wps_pos_addon_menu) { |
|
92 | + require_once(wpshop_tools::get_template_part(WPSPOS_DIR, WPSPOS_PATH . 'assets/', 'js', 'header.js')); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | function admin_menu() { |
100 | 100 | global $wps_pos_addon_menu; |
101 | 101 | |
102 | - $wps_pos_addon_menu = add_menu_page( __( 'WP-Shop point of sale interface', 'wps-pos-i18n' ), __( 'WP-Shop POS', 'wps-pos-i18n' ), 'manage_options', 'wps-pos', array( $this, 'display_pos' ), 'dashicons-store' ); |
|
102 | + $wps_pos_addon_menu = add_menu_page(__('WP-Shop point of sale interface', 'wps-pos-i18n'), __('WP-Shop POS', 'wps-pos-i18n'), 'manage_options', 'wps-pos', array($this, 'display_pos'), 'dashicons-store'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -109,19 +109,19 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return array The new admin menu order with the POS addon placed |
111 | 111 | */ |
112 | - function admin_menu_order( $current_menu_order ) { |
|
112 | + function admin_menu_order($current_menu_order) { |
|
113 | 113 | /** Create a new menu order */ |
114 | 114 | $wps_pos_menu_ordered = array(); |
115 | 115 | |
116 | 116 | /** Read the current existing menu order for rearrange it */ |
117 | - foreach ( $current_menu_order as $menu_item ) { |
|
118 | - if ( 'edit.php?post_type=wpshop_shop_order' == $menu_item ) { |
|
117 | + foreach ($current_menu_order as $menu_item) { |
|
118 | + if ('edit.php?post_type=wpshop_shop_order' == $menu_item) { |
|
119 | 119 | $wps_pos_menu_ordered[] = 'wps-pos'; |
120 | 120 | $wps_pos_menu_ordered[] = 'edit.php?post_type=wpshop_shop_order'; |
121 | 121 | |
122 | - unset( $current_menu_order[ array_search( 'wps-pos', $current_menu_order ) ] ); |
|
122 | + unset($current_menu_order[array_search('wps-pos', $current_menu_order)]); |
|
123 | 123 | } |
124 | - else if ( 'wps-pos' != $menu_item ) { |
|
124 | + else if ('wps-pos' != $menu_item) { |
|
125 | 125 | $wps_pos_menu_ordered[] = $menu_item; |
126 | 126 | } |
127 | 127 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @return boolean A boolean var defining if we apply admin menu reorder for current user |
136 | 136 | */ |
137 | 137 | function admin_custom_menu_order() { |
138 | - return current_user_can( 'manage_options' ); |
|
138 | + return current_user_can('manage_options'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -144,20 +144,20 @@ discard block |
||
144 | 144 | function wps_pos_addon_session() { |
145 | 145 | @session_start(); |
146 | 146 | |
147 | - $new_order = ( !empty( $_GET['new_order'] ) ) ? sanitize_text_field( $_GET['new_order'] ) : ''; |
|
148 | - $page = ( !empty( $_GET['page'] ) ) ? sanitize_text_field( $_GET['page'] ) : ''; |
|
147 | + $new_order = (!empty($_GET['new_order'])) ? sanitize_text_field($_GET['new_order']) : ''; |
|
148 | + $page = (!empty($_GET['page'])) ? sanitize_text_field($_GET['page']) : ''; |
|
149 | 149 | |
150 | - if ( 'yes' == $new_order ) { |
|
151 | - unset( $_SESSION[ 'cart' ] ); |
|
152 | - unset( $_SESSION[ 'wps-pos-addon' ] ); |
|
153 | - delete_user_meta( get_current_user_id(), '_wpshop_persistent_cart' ); |
|
150 | + if ('yes' == $new_order) { |
|
151 | + unset($_SESSION['cart']); |
|
152 | + unset($_SESSION['wps-pos-addon']); |
|
153 | + delete_user_meta(get_current_user_id(), '_wpshop_persistent_cart'); |
|
154 | 154 | session_destroy(); |
155 | 155 | |
156 | - wp_safe_redirect( admin_url( 'admin.php?page=wps-pos' ) ); |
|
156 | + wp_safe_redirect(admin_url('admin.php?page=wps-pos')); |
|
157 | 157 | } |
158 | 158 | |
159 | - if( empty( $page ) || ( 'wps-pos' != $page ) ) { |
|
160 | - unset( $_SESSION[ 'wps-pos-addon' ] ); |
|
159 | + if (empty($page) || ('wps-pos' != $page)) { |
|
160 | + unset($_SESSION['wps-pos-addon']); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | } |
@@ -167,12 +167,12 @@ discard block |
||
167 | 167 | */ |
168 | 168 | function wps_pos_option_db() { |
169 | 169 | $option = 'wps_pos_options'; |
170 | - $options = get_option( $option, false ); |
|
171 | - if( $options === false ) { |
|
170 | + $options = get_option($option, false); |
|
171 | + if ($options === false) { |
|
172 | 172 | $values = array( |
173 | 173 | 'only_barcode' => 'checked', |
174 | 174 | ); |
175 | - add_option( $option, $values ); |
|
175 | + add_option($option, $values); |
|
176 | 176 | } else { |
177 | 177 | /** |
178 | 178 | * If want to treat options case by case */ |
@@ -191,45 +191,45 @@ discard block |
||
191 | 191 | global $wpdb; |
192 | 192 | |
193 | 193 | /** Activate Barcode attribute **/ |
194 | - if ( false ) { |
|
195 | - $wpdb->update( WPSHOP_DBT_ATTRIBUTE, array( 'status' => 'valid' ), array( 'code' => 'barcode' ) ); |
|
194 | + if (false) { |
|
195 | + $wpdb->update(WPSHOP_DBT_ATTRIBUTE, array('status' => 'valid'), array('code' => 'barcode')); |
|
196 | 196 | |
197 | 197 | /** Get the product entity id **/ |
198 | - $query = $wpdb->prepare( 'SELECT ID FROM ' .$wpdb->posts. ' WHERE post_type = %s AND post_name = %s', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT); |
|
199 | - $product_entity_id = $wpdb->get_var( $query ); |
|
198 | + $query = $wpdb->prepare('SELECT ID FROM ' . $wpdb->posts . ' WHERE post_type = %s AND post_name = %s', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT); |
|
199 | + $product_entity_id = $wpdb->get_var($query); |
|
200 | 200 | |
201 | 201 | /** Check the barcode attribute id **/ |
202 | - $query = $wpdb->prepare('SELECT id FROM ' .WPSHOP_DBT_ATTRIBUTE. ' WHERE code = %s', 'barcode'); |
|
203 | - $attribute_barcode_id = $wpdb->get_var( $query ); |
|
202 | + $query = $wpdb->prepare('SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE . ' WHERE code = %s', 'barcode'); |
|
203 | + $attribute_barcode_id = $wpdb->get_var($query); |
|
204 | 204 | |
205 | - $query = $wpdb->prepare('SELECT id FROM ' .WPSHOP_DBT_ATTRIBUTE_SET. ' WHERE entity_id = %d', $product_entity_id ); |
|
206 | - $products_groups = $wpdb->get_results( $query ); |
|
205 | + $query = $wpdb->prepare('SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE_SET . ' WHERE entity_id = %d', $product_entity_id); |
|
206 | + $products_groups = $wpdb->get_results($query); |
|
207 | 207 | /** For each attributes groups used for product configuration **/ |
208 | - foreach( $products_groups as $products_group ) { |
|
209 | - $query = $wpdb->prepare( 'SELECT id FROM ' .WPSHOP_DBT_ATTRIBUTE_GROUP. ' WHERE attribute_set_id = %d AND code = %s', $products_group->id, 'general'); |
|
210 | - $attributes_set_sections = $wpdb->get_results( $query ); |
|
211 | - foreach( $attributes_set_sections as $attributes_set_section ) { |
|
212 | - $query = $wpdb->prepare( 'SELECT MAX(position) AS max_position FROM ' .WPSHOP_DBT_ATTRIBUTE_DETAILS. ' WHERE entity_type_id = %d AND attribute_set_id = %d AND attribute_group_id = %d', $product_entity_id, $products_group->id, $attributes_set_section->id); |
|
213 | - $max_position = $wpdb->get_var( $query ); |
|
214 | - |
|
215 | - $query = $wpdb->prepare('SELECT * FROM ' .WPSHOP_DBT_ATTRIBUTE_DETAILS. ' WHERE entity_type_id = %d AND attribute_set_id = %d AND attribute_group_id = %d AND attribute_id = %d', $product_entity_id, $products_group->id, $attributes_set_section->id, $attribute_barcode_id); |
|
216 | - $exist_barcode_details_definition = $wpdb->get_results( $query ); |
|
208 | + foreach ($products_groups as $products_group) { |
|
209 | + $query = $wpdb->prepare('SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE_GROUP . ' WHERE attribute_set_id = %d AND code = %s', $products_group->id, 'general'); |
|
210 | + $attributes_set_sections = $wpdb->get_results($query); |
|
211 | + foreach ($attributes_set_sections as $attributes_set_section) { |
|
212 | + $query = $wpdb->prepare('SELECT MAX(position) AS max_position FROM ' . WPSHOP_DBT_ATTRIBUTE_DETAILS . ' WHERE entity_type_id = %d AND attribute_set_id = %d AND attribute_group_id = %d', $product_entity_id, $products_group->id, $attributes_set_section->id); |
|
213 | + $max_position = $wpdb->get_var($query); |
|
214 | + |
|
215 | + $query = $wpdb->prepare('SELECT * FROM ' . WPSHOP_DBT_ATTRIBUTE_DETAILS . ' WHERE entity_type_id = %d AND attribute_set_id = %d AND attribute_group_id = %d AND attribute_id = %d', $product_entity_id, $products_group->id, $attributes_set_section->id, $attribute_barcode_id); |
|
216 | + $exist_barcode_details_definition = $wpdb->get_results($query); |
|
217 | 217 | /** Insert the barcode attribute details **/ |
218 | - if ( !empty ($max_position) && empty($exist_barcode_details_definition) ) { |
|
219 | - $wpdb->insert( WPSHOP_DBT_ATTRIBUTE_DETAILS, array('status' => 'valid', 'creation_date' => current_time('mysql', 0), 'entity_type_id' => $product_entity_id, 'attribute_set_id' => $products_group->id, 'attribute_group_id' => $attributes_set_section->id, 'attribute_id' => $attribute_barcode_id, 'position' => (int)$max_position +1) ); |
|
218 | + if (!empty ($max_position) && empty($exist_barcode_details_definition)) { |
|
219 | + $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_DETAILS, array('status' => 'valid', 'creation_date' => current_time('mysql', 0), 'entity_type_id' => $product_entity_id, 'attribute_set_id' => $products_group->id, 'attribute_group_id' => $attributes_set_section->id, 'attribute_id' => $attribute_barcode_id, 'position' => (int)$max_position + 1)); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | 225 | /** Activate Barcode for search **/ |
226 | - $wpdb->update( WPSHOP_DBT_ATTRIBUTE, array('is_used_for_sort_by' => 'yes', 'is_used_in_quick_add_form' => 'yes'), array('code' => 'barcode') ); |
|
226 | + $wpdb->update(WPSHOP_DBT_ATTRIBUTE, array('is_used_for_sort_by' => 'yes', 'is_used_in_quick_add_form' => 'yes'), array('code' => 'barcode')); |
|
227 | 227 | |
228 | 228 | /** Activate attribute for the product quick add form **/ |
229 | - $price_piloting_option = get_option( 'wpshop_shop_price_piloting' ); |
|
230 | - $code = ( !empty($price_piloting_option) && $price_piloting_option == 'HT' ) ? 'price_ht' : 'product_price'; |
|
231 | - $wpdb->update( WPSHOP_DBT_ATTRIBUTE, array( 'is_used_in_quick_add_form' => 'yes'), array('code' => $code) ); |
|
232 | - $wpdb->update( WPSHOP_DBT_ATTRIBUTE, array( 'is_used_in_quick_add_form' => 'yes'), array('code' => 'tx_tva' ) ); |
|
229 | + $price_piloting_option = get_option('wpshop_shop_price_piloting'); |
|
230 | + $code = (!empty($price_piloting_option) && $price_piloting_option == 'HT') ? 'price_ht' : 'product_price'; |
|
231 | + $wpdb->update(WPSHOP_DBT_ATTRIBUTE, array('is_used_in_quick_add_form' => 'yes'), array('code' => $code)); |
|
232 | + $wpdb->update(WPSHOP_DBT_ATTRIBUTE, array('is_used_in_quick_add_form' => 'yes'), array('code' => 'tx_tva')); |
|
233 | 233 | |
234 | 234 | /** Check If Shop Customer attribute set exist - Deprecated **/ |
235 | 235 | /* $customer_entity_id = wpshop_entities::get_entity_identifier_from_code( WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS ); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | $exist_attribute_group = 'Nope'; |
240 | 240 | |
241 | - if ( empty($exist_attribute_group) ) { |
|
241 | + if (empty($exist_attribute_group)) { |
|
242 | 242 | /** Create a Attributes Group for POS Customer infos **/ |
243 | 243 | $wpdb->insert( |
244 | 244 | WPSHOP_DBT_ATTRIBUTE_SET, |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | 'creation_date' => current_time('mysql', 0), |
261 | 261 | 'last_update_date' => current_time('mysql', 0), |
262 | 262 | 'attribute_set_id' => $attribute_set_id, |
263 | - 'code' => sanitize_title( __('Shop Customer main infos', 'wps-pos-i18n') ), |
|
263 | + 'code' => sanitize_title(__('Shop Customer main infos', 'wps-pos-i18n')), |
|
264 | 264 | 'name' => __('Shop Customer main infos', 'wps-pos-i18n') |
265 | 265 | ) |
266 | 266 | ); |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | 'creation_date' => current_time('mysql', 0), |
273 | 273 | 'last_update_date' => current_time('mysql', 0), |
274 | 274 | 'attribute_set_id' => $attribute_set_id, |
275 | - 'code' => sanitize_title( __('Shop Customer address infos', 'wps-pos-i18n') ), |
|
275 | + 'code' => sanitize_title(__('Shop Customer address infos', 'wps-pos-i18n')), |
|
276 | 276 | 'name' => __('Shop Customer address infos', 'wps-pos-i18n') |
277 | 277 | ) |
278 | 278 | ); |
279 | 279 | $address_set_id = $wpdb->insert_id; |
280 | 280 | /** Affect Attributes **/ |
281 | - $attributes = array( 'last_name' => $main_set_id, 'first_name' => $main_set_id, 'address_last_name' => $main_set_id, 'address_first_name' => $main_set_id, 'address_user_email' => $main_set_id, 'address' => $address_set_id, 'postcode' => $address_set_id, 'city' => $address_set_id, 'phone' => $address_set_id); |
|
281 | + $attributes = array('last_name' => $main_set_id, 'first_name' => $main_set_id, 'address_last_name' => $main_set_id, 'address_first_name' => $main_set_id, 'address_user_email' => $main_set_id, 'address' => $address_set_id, 'postcode' => $address_set_id, 'city' => $address_set_id, 'phone' => $address_set_id); |
|
282 | 282 | $i = 1; |
283 | - foreach( $attributes as $attribute => $group_id) { |
|
284 | - $attribute_def = wpshop_attributes::getElement( $attribute, "'valid'", 'code'); |
|
285 | - if ( !empty($attribute_def) ) { |
|
283 | + foreach ($attributes as $attribute => $group_id) { |
|
284 | + $attribute_def = wpshop_attributes::getElement($attribute, "'valid'", 'code'); |
|
285 | + if (!empty($attribute_def)) { |
|
286 | 286 | $wpdb->insert( |
287 | 287 | WPSHOP_DBT_ATTRIBUTE_DETAILS, |
288 | 288 | array( |
@@ -302,32 +302,32 @@ discard block |
||
302 | 302 | } |
303 | 303 | |
304 | 304 | $user_name = 'default_customer'; |
305 | - $user_id = username_exists( $user_name ); |
|
306 | - if ( !$user_id ) { |
|
307 | - $random_password = wp_generate_password( $length = 12, $include_standard_special_chars=false ); |
|
308 | - $user_id = wp_create_user( $user_name, $random_password, '[email protected]' ); |
|
309 | - |
|
310 | - if ( !empty($user_id) ) { |
|
311 | - update_user_meta($user_id, 'last_name', __('Default', 'wps-pos-i18n') ); |
|
312 | - update_user_meta($user_id, 'first_name', __('Customer', 'wps-pos-i18n') ); |
|
305 | + $user_id = username_exists($user_name); |
|
306 | + if (!$user_id) { |
|
307 | + $random_password = wp_generate_password($length = 12, $include_standard_special_chars = false); |
|
308 | + $user_id = wp_create_user($user_name, $random_password, '[email protected]'); |
|
309 | + |
|
310 | + if (!empty($user_id)) { |
|
311 | + update_user_meta($user_id, 'last_name', __('Default', 'wps-pos-i18n')); |
|
312 | + update_user_meta($user_id, 'first_name', __('Customer', 'wps-pos-i18n')); |
|
313 | 313 | /** Add the default customer id in Option table **/ |
314 | 314 | update_option('wpshop_pos_addon_default_customer_id', $user_id); |
315 | 315 | } |
316 | 316 | } |
317 | 317 | |
318 | 318 | /** Get post of user id */ |
319 | - $customers_associated_to_user = get_posts( array ( |
|
319 | + $customers_associated_to_user = get_posts(array( |
|
320 | 320 | 'post_status' => 'draft', |
321 | 321 | 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, |
322 | 322 | 'author' => $user_id, |
323 | - ) ); |
|
324 | - $customer_id = !empty( $customers_associated_to_user ) && !empty( $customers_associated_to_user[ 0 ] ) && !empty( $customers_associated_to_user[ 0 ]->ID ) ? $customers_associated_to_user[ 0 ]->ID : null; |
|
323 | + )); |
|
324 | + $customer_id = !empty($customers_associated_to_user) && !empty($customers_associated_to_user[0]) && !empty($customers_associated_to_user[0]->ID) ? $customers_associated_to_user[0]->ID : null; |
|
325 | 325 | |
326 | 326 | $customer_entity_id = wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS); |
327 | 327 | |
328 | - if ( !empty( $customer_id ) ) { |
|
328 | + if (!empty($customer_id)) { |
|
329 | 329 | /** Insert attribute data */ |
330 | - wpshop_attributes::saveAttributeForEntity( array( |
|
330 | + wpshop_attributes::saveAttributeForEntity(array( |
|
331 | 331 | 'varchar' => array( |
332 | 332 | 'last_name' => __('Default', 'wps-pos-i18n'), |
333 | 333 | 'first_name' => __('Customer', 'wps-pos-i18n'), |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | 'city' => __('Default city'), |
341 | 341 | 'phone' => '0000000042', |
342 | 342 | ), |
343 | - ), $customer_entity_id, $customer_id ); |
|
343 | + ), $customer_entity_id, $customer_id); |
|
344 | 344 | } |
345 | 345 | } |
346 | 346 | |
@@ -352,14 +352,14 @@ discard block |
||
352 | 352 | $module_folder = WPSPOS_PATH . 'modules/'; |
353 | 353 | |
354 | 354 | /** Check if the defined directory exists for reading and including the different modules */ |
355 | - if( is_dir( $module_folder ) ) { |
|
356 | - $parent_folder_content = scandir( $module_folder ); |
|
357 | - foreach ( $parent_folder_content as $folder ) { |
|
358 | - if ( $folder && substr( $folder, 0, 1) != '.' && is_dir( $folder ) ) { |
|
359 | - $child_folder_content = scandir( $module_folder . $folder ); |
|
360 | - if ( file_exists( $module_folder . $folder . '/' . $folder . '.php') ) { |
|
361 | - $f = $module_folder . $folder . '/' . $folder . '.php'; |
|
362 | - include( $f ); |
|
355 | + if (is_dir($module_folder)) { |
|
356 | + $parent_folder_content = scandir($module_folder); |
|
357 | + foreach ($parent_folder_content as $folder) { |
|
358 | + if ($folder && substr($folder, 0, 1) != '.' && is_dir($folder)) { |
|
359 | + $child_folder_content = scandir($module_folder . $folder); |
|
360 | + if (file_exists($module_folder . $folder . '/' . $folder . '.php')) { |
|
361 | + $f = $module_folder . $folder . '/' . $folder . '.php'; |
|
362 | + include($f); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | } |
@@ -371,25 +371,25 @@ discard block |
||
371 | 371 | */ |
372 | 372 | function display_pos() { |
373 | 373 | /** Define the current step for current order */ |
374 | - $default_customer_id = get_option( 'wpshop_pos_addon_default_customer_id' ); |
|
374 | + $default_customer_id = get_option('wpshop_pos_addon_default_customer_id'); |
|
375 | 375 | $default_user_exists = false; |
376 | - if ( !empty( $default_customer_id ) ) { |
|
377 | - $default_user = get_user_by( 'id', $default_customer_id ); |
|
378 | - if ( false !== $default_user ) { |
|
376 | + if (!empty($default_customer_id)) { |
|
377 | + $default_user = get_user_by('id', $default_customer_id); |
|
378 | + if (false !== $default_user) { |
|
379 | 379 | $default_user_exists = true; |
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
383 | - if ( !empty( $default_user_exists ) ) { |
|
383 | + if (!empty($default_user_exists)) { |
|
384 | 384 | $current_step = 2; |
385 | - $_SESSION[ 'cart' ][ 'customer_id' ] = $default_customer_id; |
|
385 | + $_SESSION['cart']['customer_id'] = $default_customer_id; |
|
386 | 386 | } |
387 | 387 | else { |
388 | 388 | $current_step = 0; |
389 | - $_SESSION[ 'cart' ][ 'customer_id' ] = null; |
|
389 | + $_SESSION['cart']['customer_id'] = null; |
|
390 | 390 | } |
391 | 391 | |
392 | - require_once( wpshop_tools::get_template_part( WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend', 'pos' ) ); |
|
392 | + require_once(wpshop_tools::get_template_part(WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend', 'pos')); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | /** |
@@ -397,9 +397,9 @@ discard block |
||
397 | 397 | */ |
398 | 398 | function ajax_load_element_from_letter() { |
399 | 399 | |
400 | - $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
|
400 | + $_wpnonce = !empty($_POST['_wpnonce']) ? sanitize_text_field($_POST['_wpnonce']) : ''; |
|
401 | 401 | |
402 | - if ( !wp_verify_nonce( $_wpnonce, 'ajax_load_element_from_letter' ) ) |
|
402 | + if (!wp_verify_nonce($_wpnonce, 'ajax_load_element_from_letter')) |
|
403 | 403 | wp_die(); |
404 | 404 | |
405 | 405 | $response = array( |
@@ -407,37 +407,37 @@ discard block |
||
407 | 407 | 'output' => __('An error occured', 'wps-pos-i18n'), |
408 | 408 | ); |
409 | 409 | |
410 | - $alphabet = unserialize( WPSPOS_ALPHABET_LETTERS ); |
|
411 | - $letter = !empty( $_POST['term'] ) && in_array( $_POST['term'], $alphabet ) ? sanitize_text_field( $_POST['term'] ) : null; |
|
412 | - $element_type = !empty( $_POST['element_type'] ) ? sanitize_text_field( $_POST['element_type'] ) : 'customer'; |
|
413 | - $response[ 'element_type' ] = $element_type; |
|
410 | + $alphabet = unserialize(WPSPOS_ALPHABET_LETTERS); |
|
411 | + $letter = !empty($_POST['term']) && in_array($_POST['term'], $alphabet) ? sanitize_text_field($_POST['term']) : null; |
|
412 | + $element_type = !empty($_POST['element_type']) ? sanitize_text_field($_POST['element_type']) : 'customer'; |
|
413 | + $response['element_type'] = $element_type; |
|
414 | 414 | |
415 | - if ( !empty( $letter ) ) { |
|
415 | + if (!empty($letter)) { |
|
416 | 416 | $error_message = ''; |
417 | - switch ( $element_type ) { |
|
417 | + switch ($element_type) { |
|
418 | 418 | case 'customer': |
419 | - $result = $this->wps_pos_customer->display_customer_list( $letter ); |
|
419 | + $result = $this->wps_pos_customer->display_customer_list($letter); |
|
420 | 420 | break; |
421 | 421 | case 'product': |
422 | 422 | $wps_pos_product = new wps_pos_addon_product(); |
423 | - $result = $this->wps_pos_product->get_product_table_by_alphabet( $letter ); |
|
423 | + $result = $this->wps_pos_product->get_product_table_by_alphabet($letter); |
|
424 | 424 | break; |
425 | 425 | } |
426 | 426 | |
427 | - if ( empty( $result ) ) { |
|
428 | - $response[ 'output' ] = sprintf( __( 'Nothing found in %s for letter %s', 'wps-pos-i18n' ), __( $element_type, 'wps-pos-i18n' ), $letter); |
|
427 | + if (empty($result)) { |
|
428 | + $response['output'] = sprintf(__('Nothing found in %s for letter %s', 'wps-pos-i18n'), __($element_type, 'wps-pos-i18n'), $letter); |
|
429 | 429 | } |
430 | 430 | else { |
431 | - $response[ 'status' ] = true; |
|
432 | - $response[ 'output' ] = $result; |
|
431 | + $response['status'] = true; |
|
432 | + $response['output'] = $result; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | } |
436 | 436 | else { |
437 | - $response[ 'output' ] = sprintf( __( 'THe requested term (%s) to search is invalid. Please check your request and try again', 'wps-pos-i18n' ), $letter ); |
|
437 | + $response['output'] = sprintf(__('THe requested term (%s) to search is invalid. Please check your request and try again', 'wps-pos-i18n'), $letter); |
|
438 | 438 | } |
439 | 439 | |
440 | - wp_die( json_encode( $response ) ); |
|
440 | + wp_die(json_encode($response)); |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | /** |
@@ -445,16 +445,16 @@ discard block |
||
445 | 445 | */ |
446 | 446 | function ajax_save_config_barcode_only() { |
447 | 447 | |
448 | - $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
|
448 | + $_wpnonce = !empty($_POST['_wpnonce']) ? sanitize_text_field($_POST['_wpnonce']) : ''; |
|
449 | 449 | |
450 | - if ( !wp_verify_nonce( $_wpnonce, 'ajax_save_config_barcode_only' ) ) |
|
450 | + if (!wp_verify_nonce($_wpnonce, 'ajax_save_config_barcode_only')) |
|
451 | 451 | wp_die(); |
452 | 452 | |
453 | 453 | $option = 'wps_pos_options'; |
454 | - $values = get_option( $option ); |
|
455 | - if ( !empty( $values['only_barcode'] ) ) { |
|
456 | - $values['only_barcode'] = !empty( $_POST['value_checkbox'] ) ? sanitize_text_field( $_POST['value_checkbox' ] ) : ''; |
|
457 | - update_option( $option, $values ); |
|
454 | + $values = get_option($option); |
|
455 | + if (!empty($values['only_barcode'])) { |
|
456 | + $values['only_barcode'] = !empty($_POST['value_checkbox']) ? sanitize_text_field($_POST['value_checkbox']) : ''; |
|
457 | + update_option($option, $values); |
|
458 | 458 | } |
459 | 459 | wp_die(); |
460 | 460 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /** |
4 | 6 | * Fichier du controlleur principal de l'extension de caisse pour WP-Shop / Main controller file for point of sale management plugin |
@@ -120,8 +122,7 @@ discard block |
||
120 | 122 | $wps_pos_menu_ordered[] = 'edit.php?post_type=wpshop_shop_order'; |
121 | 123 | |
122 | 124 | unset( $current_menu_order[ array_search( 'wps-pos', $current_menu_order ) ] ); |
123 | - } |
|
124 | - else if ( 'wps-pos' != $menu_item ) { |
|
125 | + } else if ( 'wps-pos' != $menu_item ) { |
|
125 | 126 | $wps_pos_menu_ordered[] = $menu_item; |
126 | 127 | } |
127 | 128 | } |
@@ -383,8 +384,7 @@ discard block |
||
383 | 384 | if ( !empty( $default_user_exists ) ) { |
384 | 385 | $current_step = 2; |
385 | 386 | $_SESSION[ 'cart' ][ 'customer_id' ] = $default_customer_id; |
386 | - } |
|
387 | - else { |
|
387 | + } else { |
|
388 | 388 | $current_step = 0; |
389 | 389 | $_SESSION[ 'cart' ][ 'customer_id' ] = null; |
390 | 390 | } |
@@ -399,8 +399,9 @@ discard block |
||
399 | 399 | |
400 | 400 | $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
401 | 401 | |
402 | - if ( !wp_verify_nonce( $_wpnonce, 'ajax_load_element_from_letter' ) ) |
|
403 | - wp_die(); |
|
402 | + if ( !wp_verify_nonce( $_wpnonce, 'ajax_load_element_from_letter' ) ) { |
|
403 | + wp_die(); |
|
404 | + } |
|
404 | 405 | |
405 | 406 | $response = array( |
406 | 407 | 'status' => false, |
@@ -426,14 +427,12 @@ discard block |
||
426 | 427 | |
427 | 428 | if ( empty( $result ) ) { |
428 | 429 | $response[ 'output' ] = sprintf( __( 'Nothing found in %s for letter %s', 'wps-pos-i18n' ), __( $element_type, 'wps-pos-i18n' ), $letter); |
429 | - } |
|
430 | - else { |
|
430 | + } else { |
|
431 | 431 | $response[ 'status' ] = true; |
432 | 432 | $response[ 'output' ] = $result; |
433 | 433 | } |
434 | 434 | |
435 | - } |
|
436 | - else { |
|
435 | + } else { |
|
437 | 436 | $response[ 'output' ] = sprintf( __( 'THe requested term (%s) to search is invalid. Please check your request and try again', 'wps-pos-i18n' ), $letter ); |
438 | 437 | } |
439 | 438 | |
@@ -447,8 +446,9 @@ discard block |
||
447 | 446 | |
448 | 447 | $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
449 | 448 | |
450 | - if ( !wp_verify_nonce( $_wpnonce, 'ajax_save_config_barcode_only' ) ) |
|
451 | - wp_die(); |
|
449 | + if ( !wp_verify_nonce( $_wpnonce, 'ajax_save_config_barcode_only' ) ) { |
|
450 | + wp_die(); |
|
451 | + } |
|
452 | 452 | |
453 | 453 | $option = 'wps_pos_options'; |
454 | 454 | $values = get_option( $option ); |
@@ -1,3 +1,3 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | -<button data-nonce="<?php echo wp_create_nonce( 'ajax_load_element_from_letter' ); ?>" class="wps-bton-<?php echo ( ( __( 'ALL', 'wps-pos-i18n' ) == $alpha ) || ( empty( $available_letters ) || ( in_array( $alpha, explode( ',', $available_letters ) ) ) ) ? ( !empty( $chosen_letter ) && ( $alpha == $chosen_letter ) ? 'third' : 'first' ) : 'second' ); ?>-rounded wps-pos-letter-choice wps-pos-letter-choice-<?php echo $alpha; ?> wps-pos-<?php echo $type; ?>-letter-choice wps-pos-<?php echo $type; ?>-letter-choice-<?php echo $alpha; ?> <?php echo $type; ?>" data-type="<?php echo $type; ?>" data-id="<?php echo $alpha; ?>" type="button" ><?php echo $alpha; ?></button> |
|
3 | +<button data-nonce="<?php echo wp_create_nonce('ajax_load_element_from_letter'); ?>" class="wps-bton-<?php echo ((__('ALL', 'wps-pos-i18n') == $alpha) || (empty($available_letters) || (in_array($alpha, explode(',', $available_letters)))) ? (!empty($chosen_letter) && ($alpha == $chosen_letter) ? 'third' : 'first') : 'second'); ?>-rounded wps-pos-letter-choice wps-pos-letter-choice-<?php echo $alpha; ?> wps-pos-<?php echo $type; ?>-letter-choice wps-pos-<?php echo $type; ?>-letter-choice-<?php echo $alpha; ?> <?php echo $type; ?>" data-type="<?php echo $type; ?>" data-id="<?php echo $alpha; ?>" type="button" ><?php echo $alpha; ?></button> |
@@ -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,20 +1,20 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-table-content wps-table-row"> |
4 | - <?php $order_status = unserialize( WPSHOP_ORDER_STATUS ); ?> |
|
5 | - <?php $color_label = array( 'awaiting_payment' => 'jaune', 'canceled' => 'rouge', 'partially_paid' => 'orange', 'incorrect_amount' => 'orange', 'denied' => 'rouge', 'shipped' => 'bleu', 'payment_refused' => 'rouge', 'completed' => 'vert', 'refunded' => 'rouge', 'pos' => 'bleu' ); ?> |
|
6 | - <?php $currency = wpshop_tools::wpshop_get_currency( false ); ?> |
|
7 | - <div class="wps-table-cell"><?php echo mysql2date( get_option('date_format'), $order_meta['order_date'], true ) . '<br>' . mysql2date( get_option('time_format'), $order_meta['order_date'], true ); ?></div> |
|
4 | + <?php $order_status = unserialize(WPSHOP_ORDER_STATUS); ?> |
|
5 | + <?php $color_label = array('awaiting_payment' => 'jaune', 'canceled' => 'rouge', 'partially_paid' => 'orange', 'incorrect_amount' => 'orange', 'denied' => 'rouge', 'shipped' => 'bleu', 'payment_refused' => 'rouge', 'completed' => 'vert', 'refunded' => 'rouge', 'pos' => 'bleu'); ?> |
|
6 | + <?php $currency = wpshop_tools::wpshop_get_currency(false); ?> |
|
7 | + <div class="wps-table-cell"><?php echo mysql2date(get_option('date_format'), $order_meta['order_date'], true) . '<br>' . mysql2date(get_option('time_format'), $order_meta['order_date'], true); ?></div> |
|
8 | 8 | <div class="wps-table-cell"><?php echo $order_meta['order_key']; ?></div> |
9 | - <div class="wps-table-cell"><?php echo wpshop_tools::formate_number( $order_meta['order_grand_total'] ).' '.$currency; ?></div> |
|
9 | + <div class="wps-table-cell"><?php echo wpshop_tools::formate_number($order_meta['order_grand_total']) . ' ' . $currency; ?></div> |
|
10 | 10 | <div class="wps-table-cell"> |
11 | - <span class="wps-label-<?php echo $color_label[$order_meta['order_status']]; ?>"><?php _e( $order_status[$order_meta['order_status']], 'wpshop' ); ?></span> |
|
11 | + <span class="wps-label-<?php echo $color_label[$order_meta['order_status']]; ?>"><?php _e($order_status[$order_meta['order_status']], 'wpshop'); ?></span> |
|
12 | 12 | </div> |
13 | 13 | <div class="wps-table-cell"> |
14 | - <?php if(!empty($order_meta['order_trackingLink'])):?> |
|
14 | + <?php if (!empty($order_meta['order_trackingLink'])):?> |
|
15 | 15 | <?php /** Check if http:// it's found in the link */ |
16 | 16 | $url = $order_meta['order_trackingLink']; |
17 | - if('http://' != substr($url, 0, 7)) |
|
17 | + if ('http://' != substr($url, 0, 7)) |
|
18 | 18 | $url = 'http://' . $url; |
19 | 19 | ?> |
20 | 20 | <a href="<?php echo $url; ?>" target="_blank"><?php echo !empty($order_meta['order_trackingNumber']) ? $order_meta['order_trackingNumber'] : ""; ?></a> |
@@ -22,25 +22,25 @@ discard block |
||
22 | 22 | <?php _e('No tracking links', 'wpshop'); ?> |
23 | 23 | <?php endif; ?> |
24 | 24 | </div> |
25 | - <?php if( !is_admin() ): ?> |
|
25 | + <?php if (!is_admin()): ?> |
|
26 | 26 | <div class="wps-table-cell wps-customer-order-list-actions"> |
27 | - <button data-nonce="<?php echo wp_create_nonce( 'wps_orders_load_details' ); ?>" class="wps-bton-third wps-orders-details-opener" id="wps-order-details-opener-<?php echo $order_id; ?>"><?php _e( 'Order details', 'wpshop' ); ?></button> |
|
27 | + <button data-nonce="<?php echo wp_create_nonce('wps_orders_load_details'); ?>" class="wps-bton-third wps-orders-details-opener" id="wps-order-details-opener-<?php echo $order_id; ?>"><?php _e('Order details', 'wpshop'); ?></button> |
|
28 | 28 | |
29 | - <?php if( !empty( $order_meta ) && $order_meta['order_status'] != 'canceled' && ( ( !empty($order_meta['cart_type']) && $order_meta['cart_type'] == 'quotation' ) || !empty( $order_meta['order_temporary_key'] ) ) && isset( $order_meta['pay_quotation'] ) && (float) $order_meta['order_amount_to_pay_now'] != (float) 0 ) : ?> |
|
30 | - <button data-nonce="<?php echo wp_create_nonce( 'wps_checkout_quotation' ); ?>" class="wps-bton-third wps-quotation-checkout button-thrid" data-oid="<?php echo $order_id; ?>"><?php _e( 'Pay quotation', 'wpshop' ); ?></button> |
|
29 | + <?php if (!empty($order_meta) && $order_meta['order_status'] != 'canceled' && ((!empty($order_meta['cart_type']) && $order_meta['cart_type'] == 'quotation') || !empty($order_meta['order_temporary_key'])) && isset($order_meta['pay_quotation']) && (float)$order_meta['order_amount_to_pay_now'] != (float)0) : ?> |
|
30 | + <button data-nonce="<?php echo wp_create_nonce('wps_checkout_quotation'); ?>" class="wps-bton-third wps-quotation-checkout button-thrid" data-oid="<?php echo $order_id; ?>"><?php _e('Pay quotation', 'wpshop'); ?></button> |
|
31 | 31 | <?php endif; ?> |
32 | 32 | |
33 | - <?php if ( !empty( $order_meta ) && !empty( $order_meta[ 'order_invoice_ref' ] ) ) : ?> |
|
34 | - <br/><a href="<?php echo WPSHOP_TEMPLATES_URL; ?>invoice.php?order_id=<?php echo $order_id; ?>&invoice_ref=<?php echo $order_meta[ 'order_invoice_ref' ]; ?>&mode=pdf" target="_blank" class="wps-bton-third" role="button"><?php _e( 'Download invoice', 'wpshop' ); ?></a> |
|
33 | + <?php if (!empty($order_meta) && !empty($order_meta['order_invoice_ref'])) : ?> |
|
34 | + <br/><a href="<?php echo WPSHOP_TEMPLATES_URL; ?>invoice.php?order_id=<?php echo $order_id; ?>&invoice_ref=<?php echo $order_meta['order_invoice_ref']; ?>&mode=pdf" target="_blank" class="wps-bton-third" role="button"><?php _e('Download invoice', 'wpshop'); ?></a> |
|
35 | 35 | <?php endif; ?> |
36 | 36 | |
37 | 37 | <!-- Display delete order --> |
38 | 38 | <?php $wpshop_display_delete_order_option = get_option('wpshop_display_option'); ?> |
39 | - <?php if( !empty($wpshop_display_delete_order_option) && !empty($wpshop_display_delete_order_option['wpshop_display_delete_order']) && $wpshop_display_delete_order_option['wpshop_display_delete_order'] && !empty( $order_meta ) && $order_meta['order_status'] == 'awaiting_payment' ):?> |
|
40 | - <br/><button data-nonce="<?php echo wp_create_nonce( 'wps_delete_order' ); ?>" class="wps-bton-first-mini-rounded wps-orders-delete button-secondary" data-id="<?php echo $order_id; ?>"><?php _e( 'Delete order', 'wpshop' ); ?></button> |
|
39 | + <?php if (!empty($wpshop_display_delete_order_option) && !empty($wpshop_display_delete_order_option['wpshop_display_delete_order']) && $wpshop_display_delete_order_option['wpshop_display_delete_order'] && !empty($order_meta) && $order_meta['order_status'] == 'awaiting_payment'):?> |
|
40 | + <br/><button data-nonce="<?php echo wp_create_nonce('wps_delete_order'); ?>" class="wps-bton-first-mini-rounded wps-orders-delete button-secondary" data-id="<?php echo $order_id; ?>"><?php _e('Delete order', 'wpshop'); ?></button> |
|
41 | 41 | <?php endif; ?> |
42 | 42 | </div> |
43 | 43 | <?php else : ?> |
44 | - <div class="wps-table-cell"><a href="<?php echo admin_url( 'post.php?post='.$order_id.'&action=edit' ); ?>" target="_blank" role="button" class="wps-bton-first-mini-rounded" ><?php _e( 'Order details', 'wpshop' ); ?></a></div> |
|
44 | + <div class="wps-table-cell"><a href="<?php echo admin_url('post.php?post=' . $order_id . '&action=edit'); ?>" target="_blank" role="button" class="wps-bton-first-mini-rounded" ><?php _e('Order details', 'wpshop'); ?></a></div> |
|
45 | 45 | <?php endif?> |
46 | 46 | </div> |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | ?> |
3 | 5 | <div class="wps-table-content wps-table-row"> |
4 | 6 | <?php $order_status = unserialize( WPSHOP_ORDER_STATUS ); ?> |
@@ -14,12 +16,16 @@ discard block |
||
14 | 16 | <?php if(!empty($order_meta['order_trackingLink'])):?> |
15 | 17 | <?php /** Check if http:// it's found in the link */ |
16 | 18 | $url = $order_meta['order_trackingLink']; |
17 | - if('http://' != substr($url, 0, 7)) |
|
18 | - $url = 'http://' . $url; |
|
19 | + if('http://' != substr($url, 0, 7)) { |
|
20 | + $url = 'http://' . $url; |
|
21 | + } |
|
19 | 22 | ?> |
20 | 23 | <a href="<?php echo $url; ?>" target="_blank"><?php echo !empty($order_meta['order_trackingNumber']) ? $order_meta['order_trackingNumber'] : ""; ?></a> |
21 | - <?php else: ?> |
|
22 | - <?php _e('No tracking links', 'wpshop'); ?> |
|
24 | + <?php else { |
|
25 | + : ?> |
|
26 | + <?php _e('No tracking links', 'wpshop'); |
|
27 | +} |
|
28 | +?> |
|
23 | 29 | <?php endif; ?> |
24 | 30 | </div> |
25 | 31 | <?php if( !is_admin() ): ?> |
@@ -40,7 +46,10 @@ discard block |
||
40 | 46 | <br/><button data-nonce="<?php echo wp_create_nonce( 'wps_delete_order' ); ?>" class="wps-bton-first-mini-rounded wps-orders-delete button-secondary" data-id="<?php echo $order_id; ?>"><?php _e( 'Delete order', 'wpshop' ); ?></button> |
41 | 47 | <?php endif; ?> |
42 | 48 | </div> |
43 | - <?php else : ?> |
|
44 | - <div class="wps-table-cell"><a href="<?php echo admin_url( 'post.php?post='.$order_id.'&action=edit' ); ?>" target="_blank" role="button" class="wps-bton-first-mini-rounded" ><?php _e( 'Order details', 'wpshop' ); ?></a></div> |
|
49 | + <?php else { |
|
50 | + : ?> |
|
51 | + <div class="wps-table-cell"><a href="<?php echo admin_url( 'post.php?post='.$order_id.'&action=edit' ); |
|
52 | +} |
|
53 | +?>" target="_blank" role="button" class="wps-bton-first-mini-rounded" ><?php _e( 'Order details', 'wpshop' ); ?></a></div> |
|
45 | 54 | <?php endif?> |
46 | 55 | </div> |