Completed
Pull Request — master (#2)
by Jimmy
1216:52 queued 1185:43
created
modules/wps_statistics/templates/backend/wps_statistics_best_customers.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
- if ( !empty($customer_recap) ) : ?>
3
-<?php arsort( $customer_recap ); ?>
1
+<?php if (!defined('ABSPATH')) exit;
2
+ if (!empty($customer_recap)) : ?>
3
+<?php arsort($customer_recap); ?>
4 4
 <canvas id="wps_best_customers" width="" height=""></canvas>
5 5
 <script type="text/javascript">
6 6
 	jQuery( document ).ready( function() {
7 7
 		var pieData = [
8 8
 						<?php 
9 9
 						$i = 0;
10
-						foreach( $customer_recap as $customer_id => $customer ): ?>
11
-						<?php if( $i < 8 ) : ?>
10
+						foreach ($customer_recap as $customer_id => $customer): ?>
11
+						<?php if ($i < 8) : ?>
12 12
 						{value:<?php echo round($customer, 2); ?>, color:"<?php echo $colors[$i]; ?>"},	
13 13
 						<?php endif; ?>
14 14
 						<?php endforeach; ?>
@@ -19,19 +19,19 @@  discard block
 block discarded – undo
19 19
 <ul class="wps_statistics_legend">
20 20
 <?php 
21 21
 	$i = 0;
22
-	foreach( $customer_recap as $customer_id => $customer ):
23
-		if( $i < 8 ) :
24
-			$user_data = get_userdata( $customer_id );
25
-			$customer_name = ( !empty($user_data) && !empty($user_data->last_name) ) ? strtoupper( $user_data->last_name) : '';
26
-			$customer_name .= ( !empty($user_data) && !empty($user_data->first_name) ) ? ' '.$user_data->first_name : '';
27
-			$customer_email = ( !empty($user_data) && !empty($user_data->user_email) ) ? ' - '.$user_data->user_email : '';
22
+	foreach ($customer_recap as $customer_id => $customer):
23
+		if ($i < 8) :
24
+			$user_data = get_userdata($customer_id);
25
+			$customer_name = (!empty($user_data) && !empty($user_data->last_name)) ? strtoupper($user_data->last_name) : '';
26
+			$customer_name .= (!empty($user_data) && !empty($user_data->first_name)) ? ' ' . $user_data->first_name : '';
27
+			$customer_email = (!empty($user_data) && !empty($user_data->user_email)) ? ' - ' . $user_data->user_email : '';
28 28
 		?>
29
-			<li><div style="background : <?php echo $colors[$i]; ?>;" class="legend_indicator"></div><?php echo $customer_name.' '.$customer_email.' (' .number_format($customer, 2, '.', '').' '.wpshop_tools::wpshop_get_currency( false ); ?>)</li>
29
+			<li><div style="background : <?php echo $colors[$i]; ?>;" class="legend_indicator"></div><?php echo $customer_name . ' ' . $customer_email . ' (' . number_format($customer, 2, '.', '') . ' ' . wpshop_tools::wpshop_get_currency(false); ?>)</li>
30 30
 		<?php
31 31
 		endif;
32 32
 	endforeach;
33 33
 ?>
34 34
 </ul>
35 35
 <?php else : ?>
36
-<div class="wps-alert-info"><?php _e( 'There is no best customer for the moment', 'wpshop'); ?></div>
36
+<div class="wps-alert-info"><?php _e('There is no best customer for the moment', 'wpshop'); ?></div>
37 37
 <?php endif; ?>
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
  if ( !empty($customer_recap) ) : ?>
3 5
 <?php arsort( $customer_recap ); ?>
4 6
 <canvas id="wps_best_customers" width="" height=""></canvas>
@@ -32,6 +34,9 @@  discard block
 block discarded – undo
32 34
 	endforeach;
33 35
 ?>
34 36
 </ul>
35
-<?php else : ?>
36
-<div class="wps-alert-info"><?php _e( 'There is no best customer for the moment', 'wpshop'); ?></div>
37
+<?php else {
38
+	: ?>
39
+<div class="wps-alert-info"><?php _e( 'There is no best customer for the moment', 'wpshop');
40
+}
41
+?></div>
37 42
 <?php endif; ?>
Please login to merge, or discard this patch.
modules/wps_statistics/templates/backend/wps_statistics_orders_moment.php 2 patches
Braces   +16 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 if( !empty($datadate) ) : 
3 5
 krsort($datadate);
4 6
 $tmp_array = array();
@@ -6,8 +8,7 @@  discard block
 block discarded – undo
6 8
 	foreach( $day_data as $hour => $d ) {
7 9
 		if( empty($tmp_array[$hour]) ) {
8 10
 			$tmp_array[$hour] = $day_data[$hour];
9
-		}
10
-		else {
11
+		} else {
11 12
 			$tmp_array[$hour] += $day_data[$hour];
12 13
 		}
13 14
 	}
@@ -15,14 +16,16 @@  discard block
 block discarded – undo
15 16
 
16 17
 $tmp_value = 0;
17 18
 foreach ($tmp_array as $values){
18
-	if ($values > $tmp_value)
19
-		$tmp_value = $values;
20
-}
19
+	if ($values > $tmp_value) {
20
+			$tmp_value = $values;
21
+	}
22
+	}
21 23
 
22
-if ($tmp_value / 2 >= 25)
24
+if ($tmp_value / 2 >= 25) {
23 25
 	$scaleStepWidth = $tmp_value / 2;
24
-else
26
+} else {
25 27
 	$scaleStepWidth = $tmp_value;
28
+}
26 29
 ?>
27 30
 <canvas id="wps_hourly_orders_canvas" width="<?php echo ( !empty($args['width']) ) ? $args['width'] : ''; ?>" height="<?php echo ( !empty($args['height']) ) ? $args['height'] : ''; ?>"></canvas>
28 31
 <script type="text/javascript">
@@ -56,8 +59,11 @@  discard block
 block discarded – undo
56 59
 </script>
57 60
 
58 61
 
59
-<?php else : ?>
60
-<div class="wps-alert-info"><?php _e( 'No orders have been created', 'wpshop' ); ?></div>
62
+<?php else {
63
+	: ?>
64
+<div class="wps-alert-info"><?php _e( 'No orders have been created', 'wpshop' );
65
+}
66
+?></div>
61 67
 <?php endif; ?>
62 68
 <div class="wps-form-group">
63 69
 <label><?php _e( 'Choose the day', 'wpshop'); ?></label>
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
-if( !empty($datadate) ) :
1
+<?php if (!defined('ABSPATH')) exit;
2
+if (!empty($datadate)) :
3 3
 krsort($datadate);
4 4
 $tmp_array = array();
5
-foreach( $datadate as $day_name => $day_data ) {
6
-	foreach( $day_data as $hour => $d ) {
7
-		if( empty($tmp_array[$hour]) ) {
5
+foreach ($datadate as $day_name => $day_data) {
6
+	foreach ($day_data as $hour => $d) {
7
+		if (empty($tmp_array[$hour])) {
8 8
 			$tmp_array[$hour] = $day_data[$hour];
9 9
 		}
10 10
 		else {
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 }
15 15
 
16 16
 $tmp_value = 0;
17
-foreach ($tmp_array as $values){
17
+foreach ($tmp_array as $values) {
18 18
 	if ($values > $tmp_value)
19 19
 		$tmp_value = $values;
20 20
 }
@@ -24,17 +24,17 @@  discard block
 block discarded – undo
24 24
 else
25 25
 	$scaleStepWidth = $tmp_value;
26 26
 ?>
27
-<canvas id="wps_hourly_orders_canvas" width="<?php echo ( !empty($args['width']) ) ? $args['width'] : ''; ?>" height="<?php echo ( !empty($args['height']) ) ? $args['height'] : ''; ?>"></canvas>
27
+<canvas id="wps_hourly_orders_canvas" width="<?php echo (!empty($args['width'])) ? $args['width'] : ''; ?>" height="<?php echo (!empty($args['height'])) ? $args['height'] : ''; ?>"></canvas>
28 28
 <script type="text/javascript">
29 29
 	jQuery( document ).ready( function() {
30 30
 		var data = {labels: [
31 31
 							<?php
32
-							for( $i = 0; $i <= 23; $i++ ) {
33
-								echo '"'.( ($i < 10 ) ? '0' : '' ).$i.'",';
32
+							for ($i = 0; $i <= 23; $i++) {
33
+								echo '"' . (($i < 10) ? '0' : '') . $i . '",';
34 34
 							} ?>
35 35
 							],
36 36
 					datasets:
37
-						[{label : "<?php _e( 'Datas', 'wpshop' ); ?>",
37
+						[{label : "<?php _e('Datas', 'wpshop'); ?>",
38 38
 						  fillColor: "#9AE5F4",
39 39
 						  strokeColor: "#0074A2",
40 40
 						  pointColor: "#0074A2",
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 						  pointHighlightStroke: "#0074A2",
44 44
 						  data : [
45 45
 							<?php
46
-							for( $i = 0; $i <= 23; $i++ ) {
47
-								echo ( !empty($tmp_array[$i]) ) ? $tmp_array[$i].',' : '0,';
46
+							for ($i = 0; $i <= 23; $i++) {
47
+								echo (!empty($tmp_array[$i])) ? $tmp_array[$i] . ',' : '0,';
48 48
 							}
49 49
 								?>
50 50
 								]
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
 
58 58
 
59 59
 <?php else : ?>
60
-<div class="wps-alert-info"><?php _e( 'No orders have been created', 'wpshop' ); ?></div>
60
+<div class="wps-alert-info"><?php _e('No orders have been created', 'wpshop'); ?></div>
61 61
 <?php endif; ?>
62 62
 <div class="wps-form-group">
63
-<label><?php _e( 'Choose the day', 'wpshop'); ?></label>
63
+<label><?php _e('Choose the day', 'wpshop'); ?></label>
64 64
 <div class="wps-form">
65
-<select id="wps-statistics-orders-moment-selectbox" data-nonce="<?php echo wp_create_nonce( 'wps_hourly_order_day' ); ?>">
66
-	<option value=""><?php _e( 'All days', 'wpshop' ); ?></option>
67
-	<?php foreach( $days as $day ) : ?>
68
-	<option value="<?php echo $day; ?>"<?php echo ( !empty($args['choosen_day']) && $args['choosen_day'] == $day ) ? ' selected' : ''; ?>><?php _e( $day, 'wpshop'); ?></option>
65
+<select id="wps-statistics-orders-moment-selectbox" data-nonce="<?php echo wp_create_nonce('wps_hourly_order_day'); ?>">
66
+	<option value=""><?php _e('All days', 'wpshop'); ?></option>
67
+	<?php foreach ($days as $day) : ?>
68
+	<option value="<?php echo $day; ?>"<?php echo (!empty($args['choosen_day']) && $args['choosen_day'] == $day) ? ' selected' : ''; ?>><?php _e($day, 'wpshop'); ?></option>
69 69
 	<?php endforeach; ?>
70 70
 </select>
71 71
 </div>
Please login to merge, or discard this patch.
modules/wps_statistics/templates/backend/wps_statistics_orders_by_month.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?>
3 3
 <canvas id="wps_orders_summary" width="" height=""></canvas>
4
-<?php if( !empty($order_recap) ) : ?>
4
+<?php if (!empty($order_recap)) : ?>
5 5
 <?php 
6 6
 $i = 0;
7
-$order_recap = array_slice( $order_recap, 0, 2, true );
8
-$order_recap = array_reverse( $order_recap, true );
7
+$order_recap = array_slice($order_recap, 0, 2, true);
8
+$order_recap = array_reverse($order_recap, true);
9 9
 ?>
10 10
 <script type="text/javascript">
11 11
 jQuery( document ).ready( function() {
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
 					bezierCurve : false,
14 14
 					labels : ["<?php _e('January', 'wpshop'); ?>","<?php _e('February', 'wpshop'); ?>","<?php _e('March', 'wpshop'); ?>","<?php _e('April', 'wpshop'); ?>","<?php _e('May', 'wpshop'); ?>","<?php _e('June', 'wpshop'); ?>","<?php _e('July', 'wpshop'); ?>","<?php _e('August', 'wpshop'); ?>" ,"<?php _e('September', 'wpshop'); ?>" ,"<?php _e('October', 'wpshop'); ?>","<?php _e('November', 'wpshop'); ?>","<?php _e('December', 'wpshop'); ?>"],
15 15
 					datasets : [
16
-								<?php foreach( $order_recap as $y => $year ) : 
17
-										if ( $i < 2 ) :
16
+								<?php foreach ($order_recap as $y => $year) : 
17
+										if ($i < 2) :
18 18
 								?>
19 19
 											{fillColor : "<?php echo $colors[$i][0]; ?>",pointStrokeColor : "#fff",strokeColor :"<?php echo $colors[$i][1]; ?>", pointColor :"<?php echo $colors[$i][1]; ?>",
20 20
 												data : [
21
-														<?php for( $j = 1; $j <= 12; $j++) { 	
22
-															if( !empty($year[$j]) ) :
23
-																echo round($year[$j]).','; 
21
+														<?php for ($j = 1; $j <= 12; $j++) { 	
22
+															if (!empty($year[$j])) :
23
+																echo round($year[$j]) . ','; 
24 24
 															else :
25 25
 																echo '0,';
26 26
 															endif;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 });
39 39
 </script>
40 40
 <?php else : ?>
41
-<div class="wps-alert-info"><?php _e( 'No order has been made on your shop', 'wpshop'); ?></div>
41
+<div class="wps-alert-info"><?php _e('No order has been made on your shop', 'wpshop'); ?></div>
42 42
 <?php endif; ?>
43 43
 
44 44
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 ?>
3 5
 <canvas id="wps_orders_summary" width="" height=""></canvas>
4 6
 <?php if( !empty($order_recap) ) : ?>
@@ -21,8 +23,10 @@  discard block
 block discarded – undo
21 23
 														<?php for( $j = 1; $j <= 12; $j++) { 	
22 24
 															if( !empty($year[$j]) ) :
23 25
 																echo round($year[$j]).','; 
24
-															else :
26
+															else {
27
+																:
25 28
 																echo '0,';
29
+															}
26 30
 															endif;
27 31
 														 	} ?>
28 32
 													]
@@ -37,8 +41,11 @@  discard block
 block discarded – undo
37 41
 	var LineOrders = new Chart(document.getElementById("wps_orders_summary").getContext("2d")).Line(data);
38 42
 });
39 43
 </script>
40
-<?php else : ?>
41
-<div class="wps-alert-info"><?php _e( 'No order has been made on your shop', 'wpshop'); ?></div>
44
+<?php else {
45
+	: ?>
46
+<div class="wps-alert-info"><?php _e( 'No order has been made on your shop', 'wpshop');
47
+}
48
+?></div>
42 49
 <?php endif; ?>
43 50
 
44 51
 
Please login to merge, or discard this patch.
includes/modules/wps_statistics/templates/backend/wps-statistics.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?>
3 3
 <div class="wrap">
4
-	<h2><span class="dashicons dashicons-chart-area" style="font-size : 30px; width : 30px; height : 30px"></span> <?php _e( 'WPShop Statistics', 'wpshop' )?></h2>
4
+	<h2><span class="dashicons dashicons-chart-area" style="font-size : 30px; width : 30px; height : 30px"></span> <?php _e('WPShop Statistics', 'wpshop')?></h2>
5 5
 	<div class="wps-boxed">
6 6
 		<form method="post" action="">
7
-		<span class="wps-h5"><?php _e( 'Configure your date statistics results', 'wpshop'); ?></span>
7
+		<span class="wps-h5"><?php _e('Configure your date statistics results', 'wpshop'); ?></span>
8 8
 		<div class="wps-gridwrapper3-padded">
9 9
 			<div>
10 10
 				<div class="wps-form_group">
11
-					<label><?php _e( 'Begin date', 'wpshop'); ?></label>
12
-					<div class="wps-form"><input type="text" id="wps_statistics_begin_date" name="begin_date" class="date" value="<?php echo ( ( !empty($_POST['begin_date']) )  ? sanitize_text_field( $_POST['begin_date'] ) : date( 'Y-m-d', strtotime( '1 months ago') ) ); ?>"/></div>
11
+					<label><?php _e('Begin date', 'wpshop'); ?></label>
12
+					<div class="wps-form"><input type="text" id="wps_statistics_begin_date" name="begin_date" class="date" value="<?php echo ((!empty($_POST['begin_date'])) ? sanitize_text_field($_POST['begin_date']) : date('Y-m-d', strtotime('1 months ago'))); ?>"/></div>
13 13
 				</div>
14 14
 			</div>
15 15
 
16 16
 			<div>
17 17
 				<div class="wps-form_group">
18
-					<label><?php _e( 'End date', 'wpshop'); ?></label>
19
-					<div class="wps-form"><input type="text" id="wps_statistics_end_date" name="end_date" class="date" value="<?php echo ( ( !empty($_POST['end_date']) )  ? sanitize_text_field( $_POST['end_date'] ) : date( 'Y-m-d') ); ?>"/></div>
18
+					<label><?php _e('End date', 'wpshop'); ?></label>
19
+					<div class="wps-form"><input type="text" id="wps_statistics_end_date" name="end_date" class="date" value="<?php echo ((!empty($_POST['end_date'])) ? sanitize_text_field($_POST['end_date']) : date('Y-m-d')); ?>"/></div>
20 20
 				</div>
21 21
 			</div>
22 22
 
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 				<div class="wps-form_group">
25 25
 					<label><br/></label>
26 26
 					<div class="wps-form">
27
-						<!--  <button class="wps-bton-mini-first-rounded" id="wps_change_statistics_date"><?php _e( 'Reload statistics', 'wpshop'); ?></button> -->
28
-						<input type="submit" class="wps-bton-mini-first-rounded" value="<?php _e( 'Reload statistics', 'wpshop'); ?>" />
27
+						<!--  <button class="wps-bton-mini-first-rounded" id="wps_change_statistics_date"><?php _e('Reload statistics', 'wpshop'); ?></button> -->
28
+						<input type="submit" class="wps-bton-mini-first-rounded" value="<?php _e('Reload statistics', 'wpshop'); ?>" />
29 29
 					</div>
30 30
 				</div>
31 31
 			</div>
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	</div>
35 35
 
36 36
 	<div class="wps-gridwrapper2-padded metabox-holder wps-statistics-container" >
37
-		<div><?php do_meta_boxes('wpshop_statistics','left_column', ''); ?></div>
38
-		<div><?php do_meta_boxes('wpshop_statistics','right_column', ''); ?></div>
37
+		<div><?php do_meta_boxes('wpshop_statistics', 'left_column', ''); ?></div>
38
+		<div><?php do_meta_boxes('wpshop_statistics', 'right_column', ''); ?></div>
39 39
 	</div>
40 40
 
41 41
 </div>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
includes/modules/wps_statistics/model/wps_statisticsmdl.php 2 patches
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 	/** Get hourly orders ***/
3 3
 	class wps_statistics_mdl {
4 4
 		private $wps_orders_all = null;
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 		function wps_most_viewed_products_datas() {
13 13
 			global $wpdb;
14 14
 			$output = '';
15
-			$query = $wpdb->prepare( 'SELECT post_id, meta_value FROM '. $wpdb->postmeta .', ' .$wpdb->posts. ' WHERE post_id = ID AND post_status = %s AND meta_key = %s ORDER BY CAST( meta_value AS SIGNED ) DESC LIMIT 8', 'publish', '_wpshop_product_view_nb');
16
-			$products = $wpdb->get_results( $query );
15
+			$query = $wpdb->prepare('SELECT post_id, meta_value FROM ' . $wpdb->postmeta . ', ' . $wpdb->posts . ' WHERE post_id = ID AND post_status = %s AND meta_key = %s ORDER BY CAST( meta_value AS SIGNED ) DESC LIMIT 8', 'publish', '_wpshop_product_view_nb');
16
+			$products = $wpdb->get_results($query);
17 17
 			return $products;
18 18
 		}
19 19
 		
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 		 * Returns all orders and save in variable
22 22
 		 */
23 23
 		function wps_orders_all() {
24
-			if( !isset( $this->wps_orders_all ) ) {
25
-				$orders = get_posts( array('posts_per_page' => -1, 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'post_status' => 'publish') );
26
-				foreach( $orders as $order ) {
27
-					$order->_order_postmeta = get_post_meta( $order->ID, '_order_postmeta', true );
24
+			if (!isset($this->wps_orders_all)) {
25
+				$orders = get_posts(array('posts_per_page' => -1, 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'post_status' => 'publish'));
26
+				foreach ($orders as $order) {
27
+					$order->_order_postmeta = get_post_meta($order->ID, '_order_postmeta', true);
28 28
 				}
29 29
 				$this->wps_orders_all = $orders;
30 30
 			}
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 		 * @param string $enddate
38 38
 		 * @return array
39 39
 		 */
40
-		function wps_best_sales_datas( $begindate, $enddate) {
41
-			$begindate = new DateTime( $begindate.' 00:00:00' );
42
-			$enddate = new DateTime( $enddate.' 23:59:59' );
40
+		function wps_best_sales_datas($begindate, $enddate) {
41
+			$begindate = new DateTime($begindate . ' 00:00:00');
42
+			$enddate = new DateTime($enddate . ' 23:59:59');
43 43
 			$orders = $this->wps_orders_all();
44
-			if ( !empty($orders) ) {
44
+			if (!empty($orders)) {
45 45
 				$products = array();
46
-				foreach( $orders as $order ) {
47
-					$date_order = new DateTime( $order->post_date );
48
-					if( $begindate <= $date_order && $date_order <= $enddate ) {
46
+				foreach ($orders as $order) {
47
+					$date_order = new DateTime($order->post_date);
48
+					if ($begindate <= $date_order && $date_order <= $enddate) {
49 49
 						$order_meta = $order->_order_postmeta;
50
-						if( !empty($order_meta) && !empty($order_meta['order_items']) ) {
51
-							foreach( $order_meta['order_items'] as $item_id => $item ) {
52
-								if( !empty($item) && !empty($item['item_qty']) && !empty($item['item_id'])  ) {
53
-									if( !empty($products[ $item['item_id'] ]) ) {
54
-										$products[ $item['item_id'] ] += $item['item_qty'];
50
+						if (!empty($order_meta) && !empty($order_meta['order_items'])) {
51
+							foreach ($order_meta['order_items'] as $item_id => $item) {
52
+								if (!empty($item) && !empty($item['item_qty']) && !empty($item['item_id'])) {
53
+									if (!empty($products[$item['item_id']])) {
54
+										$products[$item['item_id']] += $item['item_qty'];
55 55
 									}
56 56
 									else {
57
-										$products[ $item['item_id'] ] = $item['item_qty'];
57
+										$products[$item['item_id']] = $item['item_qty'];
58 58
 									}
59 59
 								}
60 60
 							}
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
 			$output = '';
74 74
 			$order_recap = array();
75 75
 			$orders = $this->wps_orders_all();
76
-			if ( !empty($orders) ) {
77
-				foreach( $orders as $order ) {
78
-					$order_year = date( 'Y', strtotime( $order->post_date) );
79
-					$order_month = date( 'n', strtotime( $order->post_date) );
80
-					if ( empty($order_recap[$order_year]) ) {
76
+			if (!empty($orders)) {
77
+				foreach ($orders as $order) {
78
+					$order_year = date('Y', strtotime($order->post_date));
79
+					$order_month = date('n', strtotime($order->post_date));
80
+					if (empty($order_recap[$order_year])) {
81 81
 						$order_recap[$order_year] = array();
82 82
 					}
83 83
 					$order_meta = $order->_order_postmeta;
84
-					if ( !empty($order_meta) && !empty($order_meta['order_grand_total']) ) {
85
-						if ( empty($order_recap[$order_year][ $order_month ]) ) {
86
-							$order_recap[$order_year][ $order_month ] = $order_meta['order_grand_total'];
84
+					if (!empty($order_meta) && !empty($order_meta['order_grand_total'])) {
85
+						if (empty($order_recap[$order_year][$order_month])) {
86
+							$order_recap[$order_year][$order_month] = $order_meta['order_grand_total'];
87 87
 						}
88 88
 						else {
89
-							$order_recap[$order_year][ $order_month ] += $order_meta['order_grand_total'];
89
+							$order_recap[$order_year][$order_month] += $order_meta['order_grand_total'];
90 90
 						}
91 91
 					}
92 92
 				}
@@ -99,24 +99,24 @@  discard block
 block discarded – undo
99 99
 		 * Orders Status
100 100
 		 * @return Array
101 101
 		 */
102
-		function wps_order_status( $begin_date, $end_date ) {
103
-			$begin_date = new DateTime( $begin_date.' 00:00:00' );
104
-			$end_date = new DateTime( $end_date.' 23:59:59' );
102
+		function wps_order_status($begin_date, $end_date) {
103
+			$begin_date = new DateTime($begin_date . ' 00:00:00');
104
+			$end_date = new DateTime($end_date . ' 23:59:59');
105 105
 			$output = '';
106 106
 			$orders = $this->wps_orders_all();
107
-			if ( !empty($orders) ) {
107
+			if (!empty($orders)) {
108 108
 				$orders_status = array();
109 109
 				/** Collect datas **/
110
-				foreach( $orders as $order ) {
111
-					$date_order = new DateTime( $order->post_date );
112
-					if( $begin_date <= $date_order && $date_order <= $end_date ) {
110
+				foreach ($orders as $order) {
111
+					$date_order = new DateTime($order->post_date);
112
+					if ($begin_date <= $date_order && $date_order <= $end_date) {
113 113
 						$order_meta = $order->_order_postmeta;
114
-						if ( !empty($order_meta) && !empty($order_meta['order_status']) ) {
115
-							if ( !empty($orders_status[ $order_meta['order_status'] ]) ) {
116
-								$orders_status[ $order_meta['order_status'] ]++;
114
+						if (!empty($order_meta) && !empty($order_meta['order_status'])) {
115
+							if (!empty($orders_status[$order_meta['order_status']])) {
116
+								$orders_status[$order_meta['order_status']]++;
117 117
 							}
118 118
 							else {
119
-								$orders_status[ $order_meta['order_status'] ] = 1;
119
+								$orders_status[$order_meta['order_status']] = 1;
120 120
 							}
121 121
 						}
122 122
 					}
@@ -131,32 +131,32 @@  discard block
 block discarded – undo
131 131
 		 * @param string $end_date
132 132
 		 * @return array
133 133
 		 */
134
-		function wps_best_customers( $begin_date, $end_date ) {
134
+		function wps_best_customers($begin_date, $end_date) {
135 135
 				$output = '';
136 136
 				$customer_recap = array();
137 137
 				
138
-				$begin_date = new DateTime( $begin_date.' 00:00:00' );
139
-				$end_date = new DateTime( $end_date.' 23:59:59' );
138
+				$begin_date = new DateTime($begin_date . ' 00:00:00');
139
+				$end_date = new DateTime($end_date . ' 23:59:59');
140 140
 				$orders = $this->wps_orders_all();
141 141
 		
142
-				if ( !empty($orders) ) {
143
-					foreach( $orders as $order ) {
144
-						$date_order = new DateTime( $order->post_date );
145
-						if( $begin_date <= $date_order && $date_order <= $end_date ) {
142
+				if (!empty($orders)) {
143
+					foreach ($orders as $order) {
144
+						$date_order = new DateTime($order->post_date);
145
+						if ($begin_date <= $date_order && $date_order <= $end_date) {
146 146
 							$order_meta = $order->_order_postmeta;
147
-							if ( !empty($order_meta) && !empty($order_meta['customer_id']) && !empty($order_meta['order_grand_total']) ) {
147
+							if (!empty($order_meta) && !empty($order_meta['customer_id']) && !empty($order_meta['order_grand_total'])) {
148 148
 								/** Check if user is administrator **/
149
-								$user_def = get_user_by( 'id', $order_meta['customer_id'] );
150
-								$wps_statistics_exclude_customer = get_user_meta( $order_meta['customer_id'], 'wps_statistics_exclude_customer', true );
151
-								$excluded_from_statistics = ( !empty($wps_statistics_exclude_customer) ) ? true : false;
149
+								$user_def = get_user_by('id', $order_meta['customer_id']);
150
+								$wps_statistics_exclude_customer = get_user_meta($order_meta['customer_id'], 'wps_statistics_exclude_customer', true);
151
+								$excluded_from_statistics = (!empty($wps_statistics_exclude_customer)) ? true : false;
152 152
 		
153 153
 		
154
-								if ( !empty($user_def) && !empty($user_def->caps) && is_array($user_def->caps) && array_key_exists( 'customer', $user_def->caps) && $excluded_from_statistics === false ) {
155
-									if ( empty($customer_recap[ $order_meta['customer_id'] ] ) ) {
156
-										$customer_recap[ $order_meta['customer_id'] ] = $order_meta['order_grand_total'];
154
+								if (!empty($user_def) && !empty($user_def->caps) && is_array($user_def->caps) && array_key_exists('customer', $user_def->caps) && $excluded_from_statistics === false) {
155
+									if (empty($customer_recap[$order_meta['customer_id']])) {
156
+										$customer_recap[$order_meta['customer_id']] = $order_meta['order_grand_total'];
157 157
 									}
158 158
 									else {
159
-										$customer_recap[ $order_meta['customer_id'] ] += $order_meta['order_grand_total'];
159
+										$customer_recap[$order_meta['customer_id']] += $order_meta['order_grand_total'];
160 160
 									}
161 161
 								}
162 162
 							}
@@ -169,22 +169,22 @@  discard block
 block discarded – undo
169 169
 		
170 170
 		
171 171
 		
172
-		function wps_get_orders_by_hours( $begindate, $enddate, $choosenday = '', $ajax_origin = false ) {
173
-			$begin_date = new DateTime( $begindate.' 00:00:00' );
174
-			$end_date = new DateTime( $enddate.' 23:59:59' );
172
+		function wps_get_orders_by_hours($begindate, $enddate, $choosenday = '', $ajax_origin = false) {
173
+			$begin_date = new DateTime($begindate . ' 00:00:00');
174
+			$end_date = new DateTime($enddate . ' 23:59:59');
175 175
 			$resultarray = $this->wps_orders_all();
176 176
 			
177 177
 			$datadate = array();
178
-			foreach ($resultarray as $array){
179
-				$date = new DateTime( $array->post_date );
180
-				if( $begin_date <= $date && $date <= $end_date ) {
178
+			foreach ($resultarray as $array) {
179
+				$date = new DateTime($array->post_date);
180
+				if ($begin_date <= $date && $date <= $end_date) {
181 181
 					$day = $date->format('l');
182 182
 					$day = strtolower($day);
183 183
 					$choosenday = strtolower($choosenday);
184
-					if( empty($choosenday) || ( !empty($choosenday) && $choosenday ==  $day ) ) {
184
+					if (empty($choosenday) || (!empty($choosenday) && $choosenday == $day)) {
185 185
 						$hour = $date->format('G');
186
-						if ( empty($datadate[$day])){
187
-							if	(empty($datadate[$day][$hour])){
186
+						if (empty($datadate[$day])) {
187
+							if (empty($datadate[$day][$hour])) {
188 188
 								$datadate[$day][$hour] = 1;	
189 189
 							}
190 190
 							else {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 							}
193 193
 						}
194 194
 						else {
195
-							if	(empty($datadate[$day][$hour])){
195
+							if (empty($datadate[$day][$hour])) {
196 196
 								$datadate[$day][$hour] = 1;	
197 197
 							}
198 198
 							else {
Please login to merge, or discard this patch.
Braces   +10 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 	/** Get hourly orders ***/
3 5
 	class wps_statistics_mdl {
4 6
 		private $wps_orders_all = null;
@@ -52,8 +54,7 @@  discard block
 block discarded – undo
52 54
 								if( !empty($item) && !empty($item['item_qty']) && !empty($item['item_id'])  ) {
53 55
 									if( !empty($products[ $item['item_id'] ]) ) {
54 56
 										$products[ $item['item_id'] ] += $item['item_qty'];
55
-									}
56
-									else {
57
+									} else {
57 58
 										$products[ $item['item_id'] ] = $item['item_qty'];
58 59
 									}
59 60
 								}
@@ -84,8 +85,7 @@  discard block
 block discarded – undo
84 85
 					if ( !empty($order_meta) && !empty($order_meta['order_grand_total']) ) {
85 86
 						if ( empty($order_recap[$order_year][ $order_month ]) ) {
86 87
 							$order_recap[$order_year][ $order_month ] = $order_meta['order_grand_total'];
87
-						}
88
-						else {
88
+						} else {
89 89
 							$order_recap[$order_year][ $order_month ] += $order_meta['order_grand_total'];
90 90
 						}
91 91
 					}
@@ -114,8 +114,7 @@  discard block
 block discarded – undo
114 114
 						if ( !empty($order_meta) && !empty($order_meta['order_status']) ) {
115 115
 							if ( !empty($orders_status[ $order_meta['order_status'] ]) ) {
116 116
 								$orders_status[ $order_meta['order_status'] ]++;
117
-							}
118
-							else {
117
+							} else {
119 118
 								$orders_status[ $order_meta['order_status'] ] = 1;
120 119
 							}
121 120
 						}
@@ -154,8 +153,7 @@  discard block
 block discarded – undo
154 153
 								if ( !empty($user_def) && !empty($user_def->caps) && is_array($user_def->caps) && array_key_exists( 'customer', $user_def->caps) && $excluded_from_statistics === false ) {
155 154
 									if ( empty($customer_recap[ $order_meta['customer_id'] ] ) ) {
156 155
 										$customer_recap[ $order_meta['customer_id'] ] = $order_meta['order_grand_total'];
157
-									}
158
-									else {
156
+									} else {
159 157
 										$customer_recap[ $order_meta['customer_id'] ] += $order_meta['order_grand_total'];
160 158
 									}
161 159
 								}
@@ -186,16 +184,13 @@  discard block
 block discarded – undo
186 184
 						if ( empty($datadate[$day])){
187 185
 							if	(empty($datadate[$day][$hour])){
188 186
 								$datadate[$day][$hour] = 1;	
189
-							}
190
-							else {
187
+							} else {
191 188
 								$datadate[$day][$hour] += 1;
192 189
 							}
193
-						}
194
-						else {
190
+						} else {
195 191
 							if	(empty($datadate[$day][$hour])){
196 192
 								$datadate[$day][$hour] = 1;	
197
-							}
198
-							else {
193
+							} else {
199 194
 								$datadate[$day][$hour] += 1;
200 195
 							}
201 196
 						}
Please login to merge, or discard this patch.
includes/modules/wps-pos-addon/controller/wps-pos-bank-deposit.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 class wps_pos_addon_bank_deposit {
3 3
 	public function __construct() {
4 4
 		/**	Call metaboxes	*/
5
-		add_action( 'admin_init', array( $this, 'metaboxes' ) );
6
-		add_action( 'admin_enqueue_scripts', array( $this, 'vars_js' ), 11 );
5
+		add_action('admin_init', array($this, 'metaboxes'));
6
+		add_action('admin_enqueue_scripts', array($this, 'vars_js'), 11);
7 7
 	}
8 8
 	public function metaboxes() {
9
-		add_meta_box( 'wpspos-bank-deposit-metabox', __( 'Create your bank deposit', 'wps-pos-i18n' ), array( $this, 'metabox' ), 'wpspos-bank-deposit', 'wpspos-bank-deposit-left' );
9
+		add_meta_box('wpspos-bank-deposit-metabox', __('Create your bank deposit', 'wps-pos-i18n'), array($this, 'metabox'), 'wpspos-bank-deposit', 'wpspos-bank-deposit-left');
10 10
 	}
11 11
 	public function metabox() {
12
-		require( wpshop_tools::get_template_part( WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/bank_deposit', 'metabox', 'bank_deposit' ) );
12
+		require(wpshop_tools::get_template_part(WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/bank_deposit', 'metabox', 'bank_deposit'));
13 13
 	}
14 14
 	public function get_payments() {
15 15
 		$args = array(
@@ -17,41 +17,41 @@  discard block
 block discarded – undo
17 17
 				'post_type'			=> WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
18 18
 				'post_status' 		=> 'publish',
19 19
 				'meta_key'			=> '_order_postmeta',
20
-				'meta_value'		=> serialize( 'received' ) . serialize( array() ),
20
+				'meta_value'		=> serialize('received') . serialize(array()),
21 21
 				'meta_compare'		=> 'NOT LIKE',
22 22
 		);
23
-		$query = new WP_Query( $args );
23
+		$query = new WP_Query($args);
24 24
 		
25 25
 		$orders = $query->posts;
26 26
 		$payments = array();
27 27
 		
28
-		foreach( $orders as $order ) {
29
-			$order->_order_postmeta = get_post_meta( $order->ID, '_order_postmeta', true );
30
-			foreach( $order->_order_postmeta['order_payment']['received'] as $payment_received ) {
31
-				if( isset( $payment_received['status'] ) && $payment_received['status'] == 'payment_received' ) {
28
+		foreach ($orders as $order) {
29
+			$order->_order_postmeta = get_post_meta($order->ID, '_order_postmeta', true);
30
+			foreach ($order->_order_postmeta['order_payment']['received'] as $payment_received) {
31
+				if (isset($payment_received['status']) && $payment_received['status'] == 'payment_received') {
32 32
 					$payments[] = '';
33
-					end( $payments );
34
-					$id = key( $payments );
35
-					$payments[$id] = $this->row_model( $id, isset( $order->_order_postmeta['order_key'] ) ?	$order->_order_postmeta['order_key'] : $order->_order_postmeta['order_temporary_key'], $payment_received['date'], isset( $order->_order_postmeta['cart']['order_items'] ) ? $order->_order_postmeta['cart']['order_items'] : ( isset( $order->_order_postmeta['order_items'] ) ? $order->_order_postmeta['order_items'] : array() ), $payment_received['received_amount'], $payment_received['method'] );
33
+					end($payments);
34
+					$id = key($payments);
35
+					$payments[$id] = $this->row_model($id, isset($order->_order_postmeta['order_key']) ? $order->_order_postmeta['order_key'] : $order->_order_postmeta['order_temporary_key'], $payment_received['date'], isset($order->_order_postmeta['cart']['order_items']) ? $order->_order_postmeta['cart']['order_items'] : (isset($order->_order_postmeta['order_items']) ? $order->_order_postmeta['order_items'] : array()), $payment_received['received_amount'], $payment_received['method']);
36 36
 				}
37 37
 			}
38 38
 		}
39 39
 		
40 40
 		return $payments;
41 41
 	}
42
-	public function row_model( $id, $order_key, $date, $products, $amount, $method ) {
42
+	public function row_model($id, $order_key, $date, $products, $amount, $method) {
43 43
 		$products_simplified = array();
44
-		if( !empty( $products ) && is_array( $products ) ) {
45
-			foreach( $products as $product ) {
46
-				if( isset( $product['item_meta']['variations'] ) ) {
47
-					foreach( $product['item_meta']['variations'] as $key => $value ) {
44
+		if (!empty($products) && is_array($products)) {
45
+			foreach ($products as $product) {
46
+				if (isset($product['item_meta']['variations'])) {
47
+					foreach ($product['item_meta']['variations'] as $key => $value) {
48 48
 						$id_variation = $key;
49 49
 						break;
50 50
 					}
51 51
 					$first = true;
52 52
 					$title = $product['item_name'] . ' - ';
53
-					foreach( $product['item_meta']['variations'][$id_variation]['item_meta']['variation_definition'] as $variation ) {
54
-						if( $first ) {
53
+					foreach ($product['item_meta']['variations'][$id_variation]['item_meta']['variation_definition'] as $variation) {
54
+						if ($first) {
55 55
 							$first = false;
56 56
 						} else {
57 57
 							$title .= ', ';
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 				}
65 65
 			}			
66 66
 		}
67
-		return array( 'id' => $id, 'order_key' => $order_key, 'date' => $date, 'products' => $products_simplified, 'amount' => $amount, 'method' => $method );
67
+		return array('id' => $id, 'order_key' => $order_key, 'date' => $date, 'products' => $products_simplified, 'amount' => $amount, 'method' => $method);
68 68
 	}
69 69
 	public function vars_js() {
70
-		wp_localize_script( 'wpspos-backend-bank-deposit-js', 'payments', $this->get_payments() );
70
+		wp_localize_script('wpspos-backend-bank-deposit-js', 'payments', $this->get_payments());
71 71
 	}
72 72
 }
73 73
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
includes/modules/wps-pos-addon/templates/backend/products/products.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?>
3 3
 <table class="table table-striped wps-pos-element-table">
4 4
 	<tr>
@@ -6,9 +6,9 @@  discard block
 block discarded – undo
6 6
 		<th><?php _e('Product price', 'wps-pos-i18n'); ?></th>
7 7
 		<th><?php _e('Action', 'wps-pos-i18n'); ?></th>
8 8
 	</tr>
9
-	<?php foreach ( $product_list as $product ) : ?>
10
-		<?php $product_data = wpshop_products::get_product_data( $product['ID'] ); ?>
11
-		<?php $product_variation_definition = wpshop_products::get_variation( $product['ID'] );?>
12
-		<?php require( wpshop_tools::get_template_part( WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/products', 'product' ) ); ?>
9
+	<?php foreach ($product_list as $product) : ?>
10
+		<?php $product_data = wpshop_products::get_product_data($product['ID']); ?>
11
+		<?php $product_variation_definition = wpshop_products::get_variation($product['ID']); ?>
12
+		<?php require(wpshop_tools::get_template_part(WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/products', 'product')); ?>
13 13
 	<?php endforeach; ?>
14 14
 </table>
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
modules/wps-pos-addon/templates/backend/products/modal-variation.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
- if ( !empty( $product_id ) ) : ?>
3
-	<?php echo wpshop_products::wpshop_variation( $product_id ); ?>
1
+<?php if (!defined('ABSPATH')) exit;
2
+ if (!empty($product_id)) : ?>
3
+	<?php echo wpshop_products::wpshop_variation($product_id); ?>
4 4
 	<div class="wpspos-product-variation-selector" >
5
-		<button class="wps-bton-first-mini-rounded alignRight" id="wpspos-product-with-variation-add-to-cart" ><?php _e( 'Add product', 'wpshop'); ?></button>
5
+		<button class="wps-bton-first-mini-rounded alignRight" id="wpspos-product-with-variation-add-to-cart" ><?php _e('Add product', 'wpshop'); ?></button>
6 6
 	</div>
7 7
 <?php else : ?>
8
-	<?php _e( 'We are unable to detect the product you want to add to order', 'wps-pos-i18n' ); ?>
8
+	<?php _e('We are unable to detect the product you want to add to order', 'wps-pos-i18n'); ?>
9 9
 <?php endif; ?>
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,14 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
  if ( !empty( $product_id ) ) : ?>
3 5
 	<?php echo wpshop_products::wpshop_variation( $product_id ); ?>
4 6
 	<div class="wpspos-product-variation-selector" >
5 7
 		<button class="wps-bton-first-mini-rounded alignRight" id="wpspos-product-with-variation-add-to-cart" ><?php _e( 'Add product', 'wpshop'); ?></button>
6 8
 	</div>
7
-<?php else : ?>
8
-	<?php _e( 'We are unable to detect the product you want to add to order', 'wps-pos-i18n' ); ?>
9
+<?php else {
10
+	: ?>
11
+	<?php _e( 'We are unable to detect the product you want to add to order', 'wps-pos-i18n' );
12
+}
13
+?>
9 14
 <?php endif; ?>
10 15
\ No newline at end of file
Please login to merge, or discard this patch.
modules/wps-pos-addon/templates/backend/customers/customer-not_found.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
-	$billing_option = get_option( 'wpshop_billing_address' );
3
-	if( !empty( $billing_option ) && is_array( $billing_option ) ) {
1
+<?php if (!defined('ABSPATH')) exit;
2
+	$billing_option = get_option('wpshop_billing_address');
3
+	if (!empty($billing_option) && is_array($billing_option)) {
4 4
 		$attribute_set_id = $billing_option['choice'];
5 5
 	} else {
6 6
 		global $wpdb;
7
-		$query = $wpdb->prepare( "SELECT id FROM " . WPSHOP_DBT_ATTRIBUTE_SET . " WHERE name = %s", __( 'Billing address', 'wpshop' ) );
8
-		$attribute_set_id = $wpdb->get_var( $query );
9
-		if( empty( $attribute_set_id ) ) {
7
+		$query = $wpdb->prepare("SELECT id FROM " . WPSHOP_DBT_ATTRIBUTE_SET . " WHERE name = %s", __('Billing address', 'wpshop'));
8
+		$attribute_set_id = $wpdb->get_var($query);
9
+		if (empty($attribute_set_id)) {
10 10
 			global $wpdb;
11
-			$query = $wpdb->prepare( "SELECT id FROM " . WPSHOP_DBT_ATTRIBUTE_SET . " WHERE name = %s", 'Billing address' );
12
-			$attribute_set_id = $wpdb->get_var( $query );
11
+			$query = $wpdb->prepare("SELECT id FROM " . WPSHOP_DBT_ATTRIBUTE_SET . " WHERE name = %s", 'Billing address');
12
+			$attribute_set_id = $wpdb->get_var($query);
13 13
 		}
14 14
 	}
15 15
 ?>
16 16
 	<tr>
17 17
 		<td>
18
-			<?php _e( 'No user has been found for current search.', 'wps-pos-i18n' ); ?>
18
+			<?php _e('No user has been found for current search.', 'wps-pos-i18n'); ?>
19 19
 		</td>
20 20
 		<td>
21
-			<a class="thickbox wps-bton-third-rounded" title="<?php _e( 'New customer creation', 'wps-pos-i18n' ); ?>" href="<?php echo admin_url( 'admin-ajax.php?action=wps-customer-quick-creation&wps-nonce=' . wp_create_nonce( 'wps-customer-quick-nonce' ) . '&width=550&height=600&customer_set_id=' . $attribute_set_id ); ?>"><?php _e('Create a customer', 'wps-pos-i18n'); ?></a>
21
+			<a class="thickbox wps-bton-third-rounded" title="<?php _e('New customer creation', 'wps-pos-i18n'); ?>" href="<?php echo admin_url('admin-ajax.php?action=wps-customer-quick-creation&wps-nonce=' . wp_create_nonce('wps-customer-quick-nonce') . '&width=550&height=600&customer_set_id=' . $attribute_set_id); ?>"><?php _e('Create a customer', 'wps-pos-i18n'); ?></a>
22 22
 		</td>
23 23
 	</tr>
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.