Completed
Push — master ( e21aca...50b935 )
by
unknown
13:22
created
includes/modules/wps_coupon/controller/wps_coupon_ctr.php 2 patches
Braces   +15 added lines, -22 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
 class wps_coupon_ctr {
3 5
 	/** Define the main directory containing the template for the current plugin
4 6
 	 * @var string
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
 	 * Save custom informations on Save post action
131 133
 	 */
132 134
 	function save_coupon_custom_informations( $post_id ) {
133
-		if ( wp_is_post_revision( $post_id ) )
134
-			return;
135
+		if ( wp_is_post_revision( $post_id ) ) {
136
+					return;
137
+		}
135 138
 
136 139
 		if( !empty($post_id) && (get_post_type($post_id) == WPSHOP_NEWTYPE_IDENTIFIER_COUPON) ) {
137 140
 			$wps_coupon_mdl = new wps_coupon_model();
@@ -201,8 +204,7 @@  discard block
 block discarded – undo
201 204
 					if ( in_array($current_user_id, $coupon_individual_usage) ) {
202 205
 						$individual_usage = true;
203 206
 					}
204
-				}
205
-				else {
207
+				} else {
206 208
 					$individual_usage = true;
207 209
 				}
208 210
 
@@ -213,16 +215,13 @@  discard block
 block discarded – undo
213 215
 
214 216
 						if( ( !empty($coupon_usage) && array_key_exists($current_user_id, $coupon_usage) ) || empty($coupon_usage ) || empty($coupon_usage[$current_user_id]) ) {
215 217
 							$usage_limit = ( ( !empty($coupon_usage_limit) && $coupon_usage[$current_user_id] < $coupon_usage_limit) || empty($coupon_usage) || empty($coupon_usage[$current_user_id])  ) ? true : false;
216
-						}
217
-						elseif( empty($coupon_usage) ) {
218
+						} elseif( empty($coupon_usage) ) {
218 219
 							$usage_limit = true;
219 220
 						}
220
-					}
221
-					else {
221
+					} else {
222 222
 						$usage_limit = true;
223 223
 					}
224
-				}
225
-				else {
224
+				} else {
226 225
 					return array('status' => false, 'message' => __('You are not allowed to use this coupon','wpshop'));
227 226
 				}
228 227
 
@@ -237,9 +236,7 @@  discard block
 block discarded – undo
237 236
 						if ( !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'shipping_cost' && $_SESSION['cart']['order_grand_total_before_discount'] < $coupon_order_amount_mini['amount'] ) {
238 237
 							$coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ','wpshop').' '.$coupon_order_amount_mini['amount'].' '.$default_currency );
239 238
 							$order_amount_limit = false;
240
-						}
241
-
242
-						elseif(  !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'no_shipping_cost' && $_SESSION['cart']['order_total_ttc'] < $coupon_order_amount_mini['amount'] ) {
239
+						} elseif(  !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'no_shipping_cost' && $_SESSION['cart']['order_total_ttc'] < $coupon_order_amount_mini['amount'] ) {
243 240
 							$coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ','wpshop').' '.$coupon_order_amount_mini['amount'].' '.$default_currency.' '.__('without shipping cost', 'wpshop') );
244 241
 							$order_amount_limit = false;
245 242
 						}
@@ -249,18 +246,15 @@  discard block
 block discarded – undo
249 246
 						$_SESSION['cart']['coupon_id'] = $result->post_id;
250 247
 						$coupon_infos = array('status' => true, 'message' => '');
251 248
 					}
252
-				}
253
-				else {
249
+				} else {
254 250
 					$coupon_infos = array('status' => false, 'message' => __('You are not allowed to use this coupon','wpshop') );
255 251
 				}
256 252
 
257
-			}
258
-			else {
253
+			} else {
259 254
 				$coupon_infos = array('status' => false, 'message' => __('This coupon is not valid','wpshop'));
260 255
 			}
261 256
 
262
-		}
263
-		else {
257
+		} else {
264 258
 			$coupon_infos = array('status' => false, 'message' => __('This coupon doesn`t exist','wpshop'));
265 259
 		}
266 260
 		return $coupon_infos;
@@ -299,8 +293,7 @@  discard block
 block discarded – undo
299 293
 			$output .= ob_get_contents();
300 294
 			ob_end_clean();
301 295
 
302
-		}
303
-		else {
296
+		} else {
304 297
 			$output = '<div class="wps-alert-info">' .__( 'Sorry ! No available coupon', 'wpshop' ) .'</div>';
305 298
 		}
306 299
 		return $output;
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 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
 class wps_coupon_ctr {
3 3
 	/** Define the main directory containing the template for the current plugin
4 4
 	 * @var string
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 
13 13
 	function __construct() {
14 14
 		$this->template_dir = WPS_COUPON_PATH . WPS_COUPON_DIR . "/templates/";
15
-		add_shortcode( 'wps_coupon', array($this, 'display_coupons') );
15
+		add_shortcode('wps_coupon', array($this, 'display_coupons'));
16 16
 
17 17
 		$wpshop_shop_type = get_option('wpshop_shop_type', WPSHOP_DEFAULT_SHOP_TYPE);
18
-		if ( $wpshop_shop_type == 'sale' ) {
19
-			add_action( 'init', array( $this, 'create_coupon_custom_type' ) );
20
-			add_action('add_meta_boxes', array( $this, 'add_meta_boxes') );
21
-			add_action('manage_'.WPSHOP_NEWTYPE_IDENTIFIER_COUPON.'_posts_custom_column',  array( $this, 'wps_coupons_custom_columns'));
22
-			add_filter('manage_edit-'.WPSHOP_NEWTYPE_IDENTIFIER_COUPON.'_columns', array( $this, 'wps_coupons_edit_columns'));
18
+		if ($wpshop_shop_type == 'sale') {
19
+			add_action('init', array($this, 'create_coupon_custom_type'));
20
+			add_action('add_meta_boxes', array($this, 'add_meta_boxes'));
21
+			add_action('manage_' . WPSHOP_NEWTYPE_IDENTIFIER_COUPON . '_posts_custom_column', array($this, 'wps_coupons_custom_columns'));
22
+			add_filter('manage_edit-' . WPSHOP_NEWTYPE_IDENTIFIER_COUPON . '_columns', array($this, 'wps_coupons_edit_columns'));
23 23
 			add_action('save_post', array($this, 'save_coupon_custom_informations'));
24 24
 		}
25 25
 	}
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 				'capability_type' 				=> 'post',
51 51
 				'publicly_queryable' 			=> false,
52 52
 				'exclude_from_search' 			=> true,
53
-				'show_in_menu' 					=> 'edit.php?post_type='.WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
53
+				'show_in_menu' 					=> 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
54 54
 				'show_in_admin_bar'				=> false,
55 55
 				'hierarchical' 					=> false,
56 56
 				'show_in_nav_menus' 			=> false,
57 57
 				'rewrite' 						=> false,
58 58
 				'query_var' 					=> true,
59
-				'supports' 						=> array( 'title', ),
59
+				'supports' 						=> array('title',),
60 60
 				'has_archive' 					=> false
61 61
 		));
62 62
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * Add Meta box to Coupon cutom post type
66 66
 	 */
67 67
 	function add_meta_boxes() {
68
-		add_meta_box('wpshop_coupon_main_info', __('Informations', 'wpshop'), array( $this, 'wps_coupon_info_box'), WPSHOP_NEWTYPE_IDENTIFIER_COUPON, 'normal', 'high');
68
+		add_meta_box('wpshop_coupon_main_info', __('Informations', 'wpshop'), array($this, 'wps_coupon_info_box'), WPSHOP_NEWTYPE_IDENTIFIER_COUPON, 'normal', 'high');
69 69
 	}
70 70
 
71 71
 	/**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	function wps_coupon_info_box() {
75 75
 		$output = '';
76
-		$default_currency = wpshop_tools::wpshop_get_currency( false );
76
+		$default_currency = wpshop_tools::wpshop_get_currency(false);
77 77
 		// Coupon Datas
78 78
 		$metadata = get_post_custom();
79 79
 		$coupon_code = !empty($metadata['wpshop_coupon_code'][0]) ? $metadata['wpshop_coupon_code'][0] : null;
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 		$coupon_receiver = !empty($metadata['wpshop_coupon_individual_use'][0]) ? unserialize($metadata['wpshop_coupon_individual_use'][0]) : array();
84 84
 		$coupon_limit_usage = !empty($metadata['wpshop_coupon_usage_limit'][0]) ? $metadata['wpshop_coupon_usage_limit'][0] : '';
85 85
 
86
-		$wpshop_coupon_minimum_amount = ( !empty($metadata['wpshop_coupon_minimum_amount'][0]) ) ? $metadata['wpshop_coupon_minimum_amount'][0] : '';
87
-		$wpshop_coupon_minimum_amount = unserialize( $wpshop_coupon_minimum_amount );
86
+		$wpshop_coupon_minimum_amount = (!empty($metadata['wpshop_coupon_minimum_amount'][0])) ? $metadata['wpshop_coupon_minimum_amount'][0] : '';
87
+		$wpshop_coupon_minimum_amount = unserialize($wpshop_coupon_minimum_amount);
88 88
 		ob_start();
89
-		require( wpshop_tools::get_template_part( WPS_COUPON_DIR, $this->template_dir, "backend", "coupon-metabox") );
89
+		require(wpshop_tools::get_template_part(WPS_COUPON_DIR, $this->template_dir, "backend", "coupon-metabox"));
90 90
 		$output = ob_get_contents();
91 91
 		ob_end_clean();
92 92
 
@@ -96,18 +96,18 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * Add custom columns to coupons list in administration
98 98
 	 */
99
-	function wps_coupons_custom_columns( $column ) {
99
+	function wps_coupons_custom_columns($column) {
100 100
 		global $post;
101 101
 
102 102
 		$metadata = get_post_custom();
103 103
 		$wpshop_coupon_discount_type = !empty($metadata['wpshop_coupon_discount_type'][0]) ? $metadata['wpshop_coupon_discount_type'][0] : null;
104
-		switch( $column ){
104
+		switch ($column) {
105 105
 			case "coupon_code":
106 106
 				echo $metadata['wpshop_coupon_code'][0];
107 107
 				break;
108 108
 			case "coupon_discount_amount":
109
-				$currency = wpshop_tools::wpshop_get_currency( false );
110
-				echo $metadata['wpshop_coupon_discount_value'][0].' '.( (!empty($wpshop_coupon_discount_type) && $wpshop_coupon_discount_type == 'percent') ? '%' : $currency) ;
109
+				$currency = wpshop_tools::wpshop_get_currency(false);
110
+				echo $metadata['wpshop_coupon_discount_value'][0] . ' ' . ((!empty($wpshop_coupon_discount_type) && $wpshop_coupon_discount_type == 'percent') ? '%' : $currency);
111 111
 				break;
112 112
 		}
113 113
 	}
@@ -129,25 +129,25 @@  discard block
 block discarded – undo
129 129
 	/**
130 130
 	 * Save custom informations on Save post action
131 131
 	 */
132
-	function save_coupon_custom_informations( $post_id ) {
133
-		if ( wp_is_post_revision( $post_id ) )
132
+	function save_coupon_custom_informations($post_id) {
133
+		if (wp_is_post_revision($post_id))
134 134
 			return;
135 135
 
136
-		if( !empty($post_id) && (get_post_type($post_id) == WPSHOP_NEWTYPE_IDENTIFIER_COUPON) ) {
136
+		if (!empty($post_id) && (get_post_type($post_id) == WPSHOP_NEWTYPE_IDENTIFIER_COUPON)) {
137 137
 			$wps_coupon_mdl = new wps_coupon_model();
138 138
 
139 139
 			$data = array(
140
-				'wpshop_coupon_mini_amount' => !empty( $_POST['wpshop_coupon_mini_amount'] ) ? sanitize_text_field( $_POST['wpshop_coupon_mini_amount'] ) : '',
141
-				'wpshop_coupon_min_mount_shipping_rule' => !empty( $_POST['wpshop_coupon_min_mount_shipping_rule'] ) ? sanitize_text_field( $_POST['wpshop_coupon_min_mount_shipping_rule'] ) : '',
142
-				'coupon_code' => !empty( $_POST['coupon_code'] ) ? sanitize_text_field( $_POST['coupon_code'] ) : '',
143
-				'coupon_discount_amount' => !empty( $_POST['coupon_discount_amount'] ) ? sanitize_text_field( $_POST['coupon_discount_amount'] ) : '',
144
-				'wpshop_coupon_discount_type' => !empty( $_POST['coupon_type'] ) ? sanitize_text_field( $_POST['coupon_type'] ) : '',
145
-				'coupon_receiver' => !empty( $_POST['coupon_receiver'] ) ? (array) $_POST['coupon_receiver'] : '',
146
-				'coupon_usage_limit' => !empty( $_POST['coupon_usage_limit'] ) ? sanitize_text_field( $_POST['coupon_usage_limit'] ) : '',
140
+				'wpshop_coupon_mini_amount' => !empty($_POST['wpshop_coupon_mini_amount']) ? sanitize_text_field($_POST['wpshop_coupon_mini_amount']) : '',
141
+				'wpshop_coupon_min_mount_shipping_rule' => !empty($_POST['wpshop_coupon_min_mount_shipping_rule']) ? sanitize_text_field($_POST['wpshop_coupon_min_mount_shipping_rule']) : '',
142
+				'coupon_code' => !empty($_POST['coupon_code']) ? sanitize_text_field($_POST['coupon_code']) : '',
143
+				'coupon_discount_amount' => !empty($_POST['coupon_discount_amount']) ? sanitize_text_field($_POST['coupon_discount_amount']) : '',
144
+				'wpshop_coupon_discount_type' => !empty($_POST['coupon_type']) ? sanitize_text_field($_POST['coupon_type']) : '',
145
+				'coupon_receiver' => !empty($_POST['coupon_receiver']) ? (array)$_POST['coupon_receiver'] : '',
146
+				'coupon_usage_limit' => !empty($_POST['coupon_usage_limit']) ? sanitize_text_field($_POST['coupon_usage_limit']) : '',
147 147
 				'post_ID' => $post_id,
148 148
 			);
149 149
 
150
-			$wps_coupon_mdl->save_coupons_informations( $data );
150
+			$wps_coupon_mdl->save_coupons_informations($data);
151 151
 		}
152 152
 	}
153 153
 
@@ -156,19 +156,19 @@  discard block
 block discarded – undo
156 156
 	 * @param string $code
157 157
 	 * @return array
158 158
 	 */
159
-	function applyCoupon( $code ) {
159
+	function applyCoupon($code) {
160 160
 		global $wpdb, $wpshop_cart;
161 161
 
162 162
 		/** Default currency **/
163
-		$default_currency = wpshop_tools::wpshop_get_currency( false );
163
+		$default_currency = wpshop_tools::wpshop_get_currency(false);
164 164
 
165 165
 		$coupon_infos = array();
166 166
 
167 167
 		/** Coupon infos **/
168 168
 		$query = $wpdb->prepare('
169 169
 			SELECT META.post_id
170
-			FROM '.$wpdb->prefix.'postmeta META
171
-			LEFT JOIN '.$wpdb->prefix.'posts POSTS ON POSTS.ID = META.post_id
170
+			FROM '.$wpdb->prefix . 'postmeta META
171
+			LEFT JOIN '.$wpdb->prefix . 'posts POSTS ON POSTS.ID = META.post_id
172 172
 			WHERE
173 173
 				POSTS.post_type = %s AND
174 174
 				META.meta_key = "wpshop_coupon_code" AND
@@ -177,29 +177,29 @@  discard block
 block discarded – undo
177 177
 		', WPSHOP_NEWTYPE_IDENTIFIER_COUPON, $code, 'publish');
178 178
 		$result = $wpdb->get_row($query);
179 179
 
180
-		if ( !empty($result) ) {
181
-			$coupon_amount = get_post_meta( $result->post_id, 'wpshop_coupon_discount_value', true );
180
+		if (!empty($result)) {
181
+			$coupon_amount = get_post_meta($result->post_id, 'wpshop_coupon_discount_value', true);
182 182
 
183
-			if ( !empty($coupon_amount) && $coupon_amount > 0) {
184
-				$coupon_usage = get_post_meta( $result->post_id, '_wpshop_coupon_usage', true );
185
-				$coupon_usage_limit  = get_post_meta( $result->post_id, 'wpshop_coupon_usage_limit', true );
186
-				$coupon_individual_usage  = get_post_meta( $result->post_id, 'wpshop_coupon_individual_use', true );
183
+			if (!empty($coupon_amount) && $coupon_amount > 0) {
184
+				$coupon_usage = get_post_meta($result->post_id, '_wpshop_coupon_usage', true);
185
+				$coupon_usage_limit = get_post_meta($result->post_id, 'wpshop_coupon_usage_limit', true);
186
+				$coupon_individual_usage  = get_post_meta($result->post_id, 'wpshop_coupon_individual_use', true);
187 187
 
188
-				$coupon_order_amount_mini = get_post_meta( $result->post_id, 'wpshop_coupon_minimum_amount', true);
188
+				$coupon_order_amount_mini = get_post_meta($result->post_id, 'wpshop_coupon_minimum_amount', true);
189 189
 
190 190
 				$current_user_id = get_current_user_id();
191 191
 				$individual_usage = $usage_limit = false;
192 192
 
193 193
 
194 194
 				/** Checking coupon params & logged user **/
195
-				if ( (!empty($coupon_individual_usage) || !empty($coupon_usage_limit) ) && $current_user_id == 0) {
196
-					return array('status' => false, 'message' => __('You must be logged to use this coupon','wpshop'));
195
+				if ((!empty($coupon_individual_usage) || !empty($coupon_usage_limit)) && $current_user_id == 0) {
196
+					return array('status' => false, 'message' => __('You must be logged to use this coupon', 'wpshop'));
197 197
 				}
198 198
 
199 199
 				/** Individual use checking **/
200
-				if ( !empty($coupon_individual_usage) ) {
200
+				if (!empty($coupon_individual_usage)) {
201 201
 
202
-					if ( in_array($current_user_id, $coupon_individual_usage) ) {
202
+					if (in_array($current_user_id, $coupon_individual_usage)) {
203 203
 						$individual_usage = true;
204 204
 					}
205 205
 				}
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
 
211 211
 				/** Checking Usage limitation **/
212 212
 				if ($individual_usage) {
213
-					if ( !empty($coupon_usage_limit) ) {
213
+					if (!empty($coupon_usage_limit)) {
214 214
 
215
-						if( ( !empty($coupon_usage) && array_key_exists($current_user_id, $coupon_usage) ) || empty($coupon_usage ) || empty($coupon_usage[$current_user_id]) ) {
216
-							$usage_limit = ( ( !empty($coupon_usage_limit) && $coupon_usage[$current_user_id] < $coupon_usage_limit) || empty($coupon_usage) || empty($coupon_usage[$current_user_id])  ) ? true : false;
215
+						if ((!empty($coupon_usage) && array_key_exists($current_user_id, $coupon_usage)) || empty($coupon_usage) || empty($coupon_usage[$current_user_id])) {
216
+							$usage_limit = ((!empty($coupon_usage_limit) && $coupon_usage[$current_user_id] < $coupon_usage_limit) || empty($coupon_usage) || empty($coupon_usage[$current_user_id])) ? true : false;
217 217
 						}
218
-						elseif( empty($coupon_usage) ) {
218
+						elseif (empty($coupon_usage)) {
219 219
 							$usage_limit = true;
220 220
 						}
221 221
 					}
@@ -224,45 +224,45 @@  discard block
 block discarded – undo
224 224
 					}
225 225
 				}
226 226
 				else {
227
-					return array('status' => false, 'message' => __('You are not allowed to use this coupon','wpshop'));
227
+					return array('status' => false, 'message' => __('You are not allowed to use this coupon', 'wpshop'));
228 228
 				}
229 229
 
230 230
 
231 231
 				/** Apply Coupon **/
232
-				if ( $usage_limit ) {
232
+				if ($usage_limit) {
233 233
 					/** Check orderamount Limit **/
234 234
 					$order_amount_limit = true;
235 235
 
236
-					if ( !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['amount']) ) {
236
+					if (!empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['amount'])) {
237 237
 
238
-						if ( !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'shipping_cost' && $_SESSION['cart']['order_grand_total_before_discount'] < $coupon_order_amount_mini['amount'] ) {
239
-							$coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ','wpshop').' '.$coupon_order_amount_mini['amount'].' '.$default_currency );
238
+						if (!empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'shipping_cost' && $_SESSION['cart']['order_grand_total_before_discount'] < $coupon_order_amount_mini['amount']) {
239
+							$coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ', 'wpshop') . ' ' . $coupon_order_amount_mini['amount'] . ' ' . $default_currency);
240 240
 							$order_amount_limit = false;
241 241
 						}
242 242
 
243
-						elseif(  !empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'no_shipping_cost' && $_SESSION['cart']['order_total_ttc'] < $coupon_order_amount_mini['amount'] ) {
244
-							$coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ','wpshop').' '.$coupon_order_amount_mini['amount'].' '.$default_currency.' '.__('without shipping cost', 'wpshop') );
243
+						elseif (!empty($coupon_order_amount_mini) && !empty($coupon_order_amount_mini['shipping_rule']) && $coupon_order_amount_mini['shipping_rule'] == 'no_shipping_cost' && $_SESSION['cart']['order_total_ttc'] < $coupon_order_amount_mini['amount']) {
244
+							$coupon_infos = array('status' => false, 'message' => __('This coupon is available for an order from ', 'wpshop') . ' ' . $coupon_order_amount_mini['amount'] . ' ' . $default_currency . ' ' . __('without shipping cost', 'wpshop'));
245 245
 							$order_amount_limit = false;
246 246
 						}
247 247
 
248 248
 					}
249
-					if ( $order_amount_limit ) {
249
+					if ($order_amount_limit) {
250 250
 						$_SESSION['cart']['coupon_id'] = $result->post_id;
251 251
 						$coupon_infos = array('status' => true, 'message' => '');
252 252
 					}
253 253
 				}
254 254
 				else {
255
-					$coupon_infos = array('status' => false, 'message' => __('You are not allowed to use this coupon','wpshop') );
255
+					$coupon_infos = array('status' => false, 'message' => __('You are not allowed to use this coupon', 'wpshop'));
256 256
 				}
257 257
 
258 258
 			}
259 259
 			else {
260
-				$coupon_infos = array('status' => false, 'message' => __('This coupon is not valid','wpshop'));
260
+				$coupon_infos = array('status' => false, 'message' => __('This coupon is not valid', 'wpshop'));
261 261
 			}
262 262
 
263 263
 		}
264 264
 		else {
265
-			$coupon_infos = array('status' => false, 'message' => __('This coupon doesn`t exist','wpshop'));
265
+			$coupon_infos = array('status' => false, 'message' => __('This coupon doesn`t exist', 'wpshop'));
266 266
 		}
267 267
 		return $coupon_infos;
268 268
 	}
@@ -272,37 +272,37 @@  discard block
 block discarded – undo
272 272
 	 * @param integer $customer_id
273 273
 	 * @return string
274 274
 	 */
275
-	function display_coupons( $customer_id = '' ) {
276
-		$is_from_admin = ( !empty($customer_id) ) ? true : false;
277
-		$customer_id = ( !empty($customer_id) ) ? $customer_id : get_current_user_id();
275
+	function display_coupons($customer_id = '') {
276
+		$is_from_admin = (!empty($customer_id)) ? true : false;
277
+		$customer_id = (!empty($customer_id)) ? $customer_id : get_current_user_id();
278 278
 		$coupons_mdl = new wps_coupon_model();
279 279
 		$coupons = $coupons_mdl->get_coupons();
280 280
 		$output = $coupons_rows = '';
281 281
 
282
-		if( !empty($coupons) ) {
283
-			foreach( $coupons as $coupon ) {
284
-				$coupon_individual_usage = get_post_meta( $coupon->ID, 'wpshop_coupon_individual_use', true );
285
-				if( empty($coupon_individual_usage) || ( !empty($coupon_individual_usage) && in_array( $customer_id , $coupon_individual_usage) ) ) {
286
-					$coupon_code = get_post_meta( $coupon->ID, 'wpshop_coupon_code', true );
287
-					$coupon_value = get_post_meta( $coupon->ID, 'wpshop_coupon_discount_value', true );
288
-					$discount_type = get_post_meta( $coupon->ID, 'wpshop_coupon_discount_type', true );
289
-					$coupon_date = get_post_meta( $coupon->ID, 'wpshop_coupon_expiry_date', true);
290
-					$coupon_validity_date = ( !empty($coupon_date) ) ? $coupon_date : __( 'No validity date', 'wpshop');
291
-					$coupon_value .= ( !empty($discount_type) && $discount_type == 'amount') ? wpshop_tools::wpshop_get_currency( false ) : '%';
282
+		if (!empty($coupons)) {
283
+			foreach ($coupons as $coupon) {
284
+				$coupon_individual_usage = get_post_meta($coupon->ID, 'wpshop_coupon_individual_use', true);
285
+				if (empty($coupon_individual_usage) || (!empty($coupon_individual_usage) && in_array($customer_id, $coupon_individual_usage))) {
286
+					$coupon_code = get_post_meta($coupon->ID, 'wpshop_coupon_code', true);
287
+					$coupon_value = get_post_meta($coupon->ID, 'wpshop_coupon_discount_value', true);
288
+					$discount_type = get_post_meta($coupon->ID, 'wpshop_coupon_discount_type', true);
289
+					$coupon_date = get_post_meta($coupon->ID, 'wpshop_coupon_expiry_date', true);
290
+					$coupon_validity_date = (!empty($coupon_date)) ? $coupon_date : __('No validity date', 'wpshop');
291
+					$coupon_value .= (!empty($discount_type) && $discount_type == 'amount') ? wpshop_tools::wpshop_get_currency(false) : '%';
292 292
 					ob_start();
293
-					require(  wpshop_tools::get_template_part( WPS_COUPON_DIR, $this->template_dir, "frontend", "coupon") );
293
+					require(wpshop_tools::get_template_part(WPS_COUPON_DIR, $this->template_dir, "frontend", "coupon"));
294 294
 					$coupons_rows .= ob_get_contents();
295 295
 					ob_end_clean();
296 296
 				}
297 297
 			}
298 298
 			ob_start();
299
-			require(  wpshop_tools::get_template_part( WPS_COUPON_DIR, $this->template_dir, "frontend", "coupons") );
299
+			require(wpshop_tools::get_template_part(WPS_COUPON_DIR, $this->template_dir, "frontend", "coupons"));
300 300
 			$output .= ob_get_contents();
301 301
 			ob_end_clean();
302 302
 
303 303
 		}
304 304
 		else {
305
-			$output = '<div class="wps-alert-info">' .__( 'Sorry ! No available coupon', 'wpshop' ) .'</div>';
305
+			$output = '<div class="wps-alert-info">' . __('Sorry ! No available coupon', 'wpshop') . '</div>';
306 306
 		}
307 307
 		return $output;
308 308
 	}
Please login to merge, or discard this patch.
includes/modules/wps_shortcodes/templates/backend/shortcode_help_tab.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
-$shortcode = ( empty($shortcode) ) ? array() : $shortcode;
3
-foreach( $shortcodes as $categorie => $cat_content ) {
1
+<?php if (!defined('ABSPATH')) exit;
2
+$shortcode = (empty($shortcode)) ? array() : $shortcode;
3
+foreach ($shortcodes as $categorie => $cat_content) {
4 4
 	
5 5
 	echo '<h3>' . $categorie . '</h3>';
6 6
 	
7 7
 	echo (!empty($cat_content['desc_cat_' . $categorie])) ? '<p>' . $cat_content['desc_cat_' . $categorie] . '</p>' : '';
8 8
 	
9
-	$cat_content['items'] = ( empty($cat_content['items']) ) ? array() : $cat_content['items'];
10
-	foreach( $cat_content['items'] as $id_shortcode => $shortcode ) {
11
-		if ( !empty($id_shortcode) ) {
9
+	$cat_content['items'] = (empty($cat_content['items'])) ? array() : $cat_content['items'];
10
+	foreach ($cat_content['items'] as $id_shortcode => $shortcode) {
11
+		if (!empty($id_shortcode)) {
12 12
 			
13 13
 			?><p><?php
14 14
 			
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
 			
19 19
 			echo __($id_shortcode);
20 20
 			
21
-			$shortcode['args'] = ( empty($shortcode['args']) ) ? array() : $shortcode['args'];
22
-			foreach( $shortcode['args'] as $argument => $parameter ) {
21
+			$shortcode['args'] = (empty($shortcode['args'])) ? array() : $shortcode['args'];
22
+			foreach ($shortcode['args'] as $argument => $parameter) {
23 23
 				echo ' ' . $argument . '="' . $parameter . '"';
24 24
 			}
25 25
 			
26 26
 			?>]</code> <?php
27 27
 
28
-			echo !empty($shortcode['description']) ?  __($shortcode['description']) . ' ' : '';
28
+			echo !empty($shortcode['description']) ? __($shortcode['description']) . ' ' : '';
29 29
 			
30 30
 			echo '<i style="color:';
31
-			if( $shortcode['active'] == 'true' ) {
31
+			if ($shortcode['active'] == 'true') {
32 32
 				echo 'green">' . __('Active', 'wpshop');
33 33
 			} else {
34 34
 				echo 'red">' . __('Inactive', 'wpshop');
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
 $shortcode = ( empty($shortcode) ) ? array() : $shortcode;
3 5
 foreach( $shortcodes as $categorie => $cat_content ) {
4 6
 	
Please login to merge, or discard this patch.
modules/wps_customer_quick_add/controller/wps_customer_quick_add.ctr.php 2 patches
Spacing   +29 added lines, -29 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
  * Fichier du controlleur principal du module de création de client rapide / Controller file for quick customer creation
4 4
  *
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	public function __construct() {
21 21
 		/**	Affiche un formulaire permettant de créer un client / Display a form allowing to add a new customer	*/
22
-		add_action( 'wp_ajax_wpspos-customer-quick-creation', array( $this, 'customer_creation' ) );
23
-		add_action( 'wp_ajax_wpspos-customer-quick-add', array( $this, 'create_customer' ) );
22
+		add_action('wp_ajax_wpspos-customer-quick-creation', array($this, 'customer_creation'));
23
+		add_action('wp_ajax_wpspos-customer-quick-add', array($this, 'create_customer'));
24 24
 	}
25 25
 
26 26
 
@@ -28,23 +28,23 @@  discard block
 block discarded – undo
28 28
 	 * AJAX - Charge le fomulaire d'ajout rapide d'un client / Load the form for new customer quick add
29 29
 	 */
30 30
 	function customer_creation() {
31
-		$_wpnonce = !empty( $_GET['_wpnonce'] ) ? sanitize_text_field( $_GET['_wpnonce'] ) : '';
31
+		$_wpnonce = !empty($_GET['_wpnonce']) ? sanitize_text_field($_GET['_wpnonce']) : '';
32 32
 
33
-		if ( !wp_verify_nonce( $_wpnonce, 'wps-customer-quick-nonce' ) )
33
+		if (!wp_verify_nonce($_wpnonce, 'wps-customer-quick-nonce'))
34 34
 			wp_die();
35 35
 
36 36
 		// check_ajax_referer( 'wps-customer-quick-nonce', 'wps-nonce' );
37 37
 		global $wpdb;
38 38
 
39
-		$customer_entity_type_id = wpshop_entities::get_entity_identifier_from_code( WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS );
40
-		$query = $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND post_author = %d", WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, get_current_user_id() );
41
-		$cid = $wpdb->get_var( $query );
39
+		$customer_entity_type_id = wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS);
40
+		$query = $wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND post_author = %d", WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, get_current_user_id());
41
+		$cid = $wpdb->get_var($query);
42 42
 
43
-		$customer_attribute_set = !empty( $_GET ) && !empty( $_GET[ 'customer_set_id' ] ) ? (int)$_GET[ 'customer_set_id' ] : null;
43
+		$customer_attribute_set = !empty($_GET) && !empty($_GET['customer_set_id']) ? (int)$_GET['customer_set_id'] : null;
44 44
 
45
-		$customer_attributes = wpshop_attributes_set::getAttributeSetDetails( $customer_attribute_set, "'valid'");
45
+		$customer_attributes = wpshop_attributes_set::getAttributeSetDetails($customer_attribute_set, "'valid'");
46 46
 
47
-		require_once( wpshop_tools::get_template_part( WPSPOSCLTQUICK_DIR, WPSPOSCLTQUICK_TEMPLATES_MAIN_DIR, "backend", "customer", "creation" ) );
47
+		require_once(wpshop_tools::get_template_part(WPSPOSCLTQUICK_DIR, WPSPOSCLTQUICK_TEMPLATES_MAIN_DIR, "backend", "customer", "creation"));
48 48
 		wp_die( );
49 49
 	}
50 50
 
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
 	 * AJAX - Création d'un nouveau client / Create a new customer
54 54
 	 */
55 55
 	function create_customer() {
56
-		$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
56
+		$_wpnonce = !empty($_POST['_wpnonce']) ? sanitize_text_field($_POST['_wpnonce']) : '';
57 57
 
58
-		if ( !wp_verify_nonce( $_wpnonce, 'create_customer' ) )
58
+		if (!wp_verify_nonce($_wpnonce, 'create_customer'))
59 59
 			wp_die();
60 60
 
61 61
 		global $wpdb;
62 62
 		$response = array(
63 63
 			'status' => false,
64
-			'output' => __( 'An error occured while saving customer', 'wpshop' ),
64
+			'output' => __('An error occured while saving customer', 'wpshop'),
65 65
 			'customer_id' => -1,
66 66
 		);
67 67
 
68 68
 		/**	Check if a attribute set id have been sended in order to check if therer are some check to do on sended input	*/
69
-		$customer_attributes = wpshop_attributes_set::getAttributeSetDetails( (int)$_POST[ 'wps-customer-account-set-id' ], "'valid'");
69
+		$customer_attributes = wpshop_attributes_set::getAttributeSetDetails((int)$_POST['wps-customer-account-set-id'], "'valid'");
70 70
 
71 71
 		/**	Read sended values for checking	*/
72 72
 		$email_founded = false;
@@ -75,46 +75,46 @@  discard block
 block discarded – undo
75 75
 
76 76
 
77 77
 		$data = array(
78
-			'attribute' => !empty( $_POST['attribute'] ) ? (array)$_POST['attribute'] : array(),
78
+			'attribute' => !empty($_POST['attribute']) ? (array)$_POST['attribute'] : array(),
79 79
 		);
80 80
 
81
-		$quick_add_customer = wps_customer_ctr::quick_add_customer( $data );
82
-		switch( $quick_add_customer ) {
81
+		$quick_add_customer = wps_customer_ctr::quick_add_customer($data);
82
+		switch ($quick_add_customer) {
83 83
 			case 1:
84
-				$response[ 'output' ] = __('An email address is required', 'wpshop');
84
+				$response['output'] = __('An email address is required', 'wpshop');
85 85
 				break;
86 86
 			case 2:
87
-				$response[ 'output' ] = __('An account is already created with this e-mail address', 'wpshop');
87
+				$response['output'] = __('An account is already created with this e-mail address', 'wpshop');
88 88
 				break;
89 89
 			case is_array($quick_add_customer):
90 90
 				/**	Build a response for customer first letter - Specific action (POS)	*/
91
-				if ( !empty($quick_add_customer['varchar']['last_name']) ) {
91
+				if (!empty($quick_add_customer['varchar']['last_name'])) {
92 92
 					$field_for_letter = $quick_add_customer['varchar']['last_name'];
93 93
 				}
94
-				elseif( !empty($quick_add_customer['varchar']['first_name']) ) {
94
+				elseif (!empty($quick_add_customer['varchar']['first_name'])) {
95 95
 					$field_for_letter = $quick_add_customer['varchar']['first_name'];
96 96
 				}
97 97
 				else {
98 98
 					$field_for_letter = $quick_add_customer['varchar']['user_email'];
99 99
 				}
100
-				$response[ 'letter' ] = substr( $field_for_letter, 0, 1);
100
+				$response['letter'] = substr($field_for_letter, 0, 1);
101 101
 
102 102
 				/**	Build response	*/
103
-				$response[ 'status' ] = true;
104
-				$response[ 'output' ] = __('Customer created succesfully', 'wpshop');
105
-				$response[ 'customer_id' ] = $quick_add_customer['integer']['ID'];
103
+				$response['status'] = true;
104
+				$response['output'] = __('Customer created succesfully', 'wpshop');
105
+				$response['customer_id'] = $quick_add_customer['integer']['ID'];
106 106
 
107 107
 				/** Create customer address from sended data **/
108 108
 				// $_REQUEST['user']['customer_id'] = (int)$quick_add_customer['integer']['ID'];
109 109
 				$attribute_to_save = $data['attribute'];
110
-				$customer_id = !empty( $_POST[ 'wps-customer-account-set-id' ] ) ? (int) $_POST[ 'wps-customer-account-set-id' ] : 0;
110
+				$customer_id = !empty($_POST['wps-customer-account-set-id']) ? (int)$_POST['wps-customer-account-set-id'] : 0;
111 111
 				// unset( $_POST['attribute'] );
112 112
 				// $_POST['attribute'][ (int)$_POST[ 'wps-customer-account-set-id' ] ] = $attribute_to_save;
113
-				wps_address::save_address_infos( $customer_id );
113
+				wps_address::save_address_infos($customer_id);
114 114
 				break;
115 115
 		}
116 116
 
117
-		wp_die( json_encode( $response ) );
117
+		wp_die(json_encode($response));
118 118
 	}
119 119
 
120 120
 }
Please login to merge, or discard this patch.
Braces   +11 added lines, -9 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
  * Fichier du controlleur principal du module de création de client rapide / Controller file for quick customer creation
4 6
  *
@@ -30,8 +32,9 @@  discard block
 block discarded – undo
30 32
 	function customer_creation() {
31 33
 		$_wpnonce = !empty( $_GET['_wpnonce'] ) ? sanitize_text_field( $_GET['_wpnonce'] ) : '';
32 34
 
33
-		if ( !wp_verify_nonce( $_wpnonce, 'wps-customer-quick-nonce' ) )
34
-			wp_die();
35
+		if ( !wp_verify_nonce( $_wpnonce, 'wps-customer-quick-nonce' ) ) {
36
+					wp_die();
37
+		}
35 38
 
36 39
 		// check_ajax_referer( 'wps-customer-quick-nonce', 'wps-nonce' );
37 40
 		global $wpdb;
@@ -55,8 +58,9 @@  discard block
 block discarded – undo
55 58
 	function create_customer() {
56 59
 		$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
57 60
 
58
-		if ( !wp_verify_nonce( $_wpnonce, 'create_customer' ) )
59
-			wp_die();
61
+		if ( !wp_verify_nonce( $_wpnonce, 'create_customer' ) ) {
62
+					wp_die();
63
+		}
60 64
 
61 65
 		global $wpdb;
62 66
 		$response = array(
@@ -90,11 +94,9 @@  discard block
 block discarded – undo
90 94
 				/**	Build a response for customer first letter - Specific action (POS)	*/
91 95
 				if ( !empty($quick_add_customer['varchar']['last_name']) ) {
92 96
 					$field_for_letter = $quick_add_customer['varchar']['last_name'];
93
-				}
94
-				elseif( !empty($quick_add_customer['varchar']['first_name']) ) {
97
+				} elseif( !empty($quick_add_customer['varchar']['first_name']) ) {
95 98
 					$field_for_letter = $quick_add_customer['varchar']['first_name'];
96
-				}
97
-				else {
99
+				} else {
98 100
 					$field_for_letter = $quick_add_customer['varchar']['user_email'];
99 101
 				}
100 102
 				$response[ 'letter' ] = substr( $field_for_letter, 0, 1);
Please login to merge, or discard this patch.
wps-pos-addon/templates/backend/customers/metabox_title-selected.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 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
 <span class="dashicons dashicons-businessman"></span>
17
-<?php _e( 'Selected customer', 'wps-pos-i18n' ); ?>
18
-<a class="thickbox add-new-h2" title="<?php _e( 'New customer creation', 'wps-pos-i18n' ); ?>" href="<?php echo admin_url( 'admin-ajax.php?action=wpspos-customer-quick-creation&_wpnonce=' . 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>
17
+<?php _e('Selected customer', 'wps-pos-i18n'); ?>
18
+<a class="thickbox add-new-h2" title="<?php _e('New customer creation', 'wps-pos-i18n'); ?>" href="<?php echo admin_url('admin-ajax.php?action=wpspos-customer-quick-creation&_wpnonce=' . 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>
19 19
 
20
-<button class="wps-bton-second-mini-rounded wpspos-continue-using-selected-customer alignright" ><?php _e( 'Cancel', 'wps-pos-i18n' ); ?></button>
21
-<button type="button" class="wps-bton-third-mini-rounded alignright" id="wps-pos-change-customer" ><?php _e( 'Change customer', 'wps-pos-i18n' ); ?></button>
20
+<button class="wps-bton-second-mini-rounded wpspos-continue-using-selected-customer alignright" ><?php _e('Cancel', 'wps-pos-i18n'); ?></button>
21
+<button type="button" class="wps-bton-third-mini-rounded alignright" id="wps-pos-change-customer" ><?php _e('Change customer', 'wps-pos-i18n'); ?></button>
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
 	$billing_option = get_option( 'wpshop_billing_address' );
3 5
 	if( !empty( $billing_option ) && is_array( $billing_option ) ) {
4 6
 		$attribute_set_id = $billing_option['choice'];
Please login to merge, or discard this patch.
modules/wps-pos-addon/templates/backend/bank_deposit/bank_deposit_style.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit; ?>
1
+<?php if (!defined('ABSPATH')) exit; ?>
2 2
 <style>
3 3
 	table {
4 4
 		width: 100%;
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,7 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit; ?>
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
4
+?>
2 5
 <style>
3 6
 	table {
4 7
 		width: 100%;
Please login to merge, or discard this patch.
modules/wps-pos-addon/templates/backend/bank_deposit/bank_deposit.php 2 patches
Spacing   +20 added lines, -20 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
 <table class="border">
3 3
 <tr>
4 4
 	<td class="width-15"><?php echo !empty($company['company_name']) ? $company['company_name'] : ''; ?></td>
@@ -15,18 +15,18 @@  discard block
 block discarded – undo
15 15
 	<td class="width-15"><?php echo !empty($company['company_street']) ? $company['company_street'] : ''; ?></td>
16 16
 	<td class="valign-top width-075"><?php _e('Date', 'wpshop'); ?>:</td>
17 17
 	<td class="align-right width-075">
18
-	<?php if( $from_to ) { ?>
19
-		<span class="force-one-line"><?php echo __( 'From', 'wpshop' ) . ' ' . mysql2date( get_option( 'date_format' ), (string) $fromdate->format('Y-m-d'), true ); ?></span>
20
-		<span class="force-one-line"><?php echo __( 'to', 'wpshop' ) . ' ' . mysql2date( get_option( 'date_format' ), $from_to, true ); ?></span>
18
+	<?php if ($from_to) { ?>
19
+		<span class="force-one-line"><?php echo __('From', 'wpshop') . ' ' . mysql2date(get_option('date_format'), (string)$fromdate->format('Y-m-d'), true); ?></span>
20
+		<span class="force-one-line"><?php echo __('to', 'wpshop') . ' ' . mysql2date(get_option('date_format'), $from_to, true); ?></span>
21 21
 	<?php } else { ?>
22
-		<span class="force-one-line"><?php echo mysql2date( get_option( 'date_format' ), (string) $fromdate->format('Y-m-d'), true ); ?></span>
22
+		<span class="force-one-line"><?php echo mysql2date(get_option('date_format'), (string)$fromdate->format('Y-m-d'), true); ?></span>
23 23
 	<?php } ?>
24 24
 	</td>
25 25
 </tr>
26 26
 <tr>
27
-	<td class="width-15"><?php echo ( !empty($company['company_postcode']) ? $company['company_postcode'] : '' ) . ' ' . ( !empty($company['company_country']) ? $company['company_country'] : '' ); ?></td>
28
-	<td class="width-075"><?php _e('Method', 'wpshop' ); ?>:</td>
29
-	<td class="align-right width-075"><?php _e( $method, 'wpshop' ); ?></td>
27
+	<td class="width-15"><?php echo (!empty($company['company_postcode']) ? $company['company_postcode'] : '') . ' ' . (!empty($company['company_country']) ? $company['company_country'] : ''); ?></td>
28
+	<td class="width-075"><?php _e('Method', 'wpshop'); ?>:</td>
29
+	<td class="align-right width-075"><?php _e($method, 'wpshop'); ?></td>
30 30
 </tr>
31 31
 </table>
32 32
 <br>
@@ -34,40 +34,40 @@  discard block
 block discarded – undo
34 34
 <thead class="border">
35 35
 	<tr>
36 36
 		<th class="margin-sides"><?php _e('Invoice', 'wps-pos-i18n'); ?></th>
37
-		<th class="margin-sides"><?php echo ( $from_to ) ? __('Date', 'wps-pos-i18n') : __('Hour', 'wpshop'); ?></th>
37
+		<th class="margin-sides"><?php echo ($from_to) ? __('Date', 'wps-pos-i18n') : __('Hour', 'wpshop'); ?></th>
38 38
 		<th class="margin-sides"><?php _e('Order', 'wpshop'); ?></th>
39 39
 		<th class="width-100"><?php _e('Products', 'wpshop'); ?></th>
40 40
 		<th class="margin-sides"><?php _e('Amount', 'wps-pos-i18n'); ?></th>
41 41
  	</tr>
42 42
 </thead>
43 43
 <tbody class="border">
44
-	<?php if( empty( $orders_date[$method] ) ) { $orders_date[$method] = array(); $orders_date[$method]['list'] = array(); $orders_date[$method]['amount_total'] = 0; } ?>
45
-	<?php foreach( $orders_date[$method]['list'] as $payment_received ) : ?>
44
+	<?php if (empty($orders_date[$method])) { $orders_date[$method] = array(); $orders_date[$method]['list'] = array(); $orders_date[$method]['amount_total'] = 0; } ?>
45
+	<?php foreach ($orders_date[$method]['list'] as $payment_received) : ?>
46 46
 	<tr>
47
-		<td class="margin-sides"><?php echo ( !empty($payment_received['invoice_ref']) ) ? $payment_received['invoice_ref'] : ''; ?></td>
48
-		<td class="force-one-line margin-sides"><?php echo ( !empty($payment_received['date']) && $payment_received_date = $payment_received['date'] ) ? ( $from_to ) ? mysql2date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $payment_received_date, true ) : mysql2date( get_option( 'time_format' ), $payment_received_date, true ) : ''; ?></td>
49
-		<td class="margin-sides"><?php echo ( !empty($payment_received['order']->_order_postmeta['order_key']) ) ? $payment_received['order']->_order_postmeta['order_key'] : ''; ?></td>
47
+		<td class="margin-sides"><?php echo (!empty($payment_received['invoice_ref'])) ? $payment_received['invoice_ref'] : ''; ?></td>
48
+		<td class="force-one-line margin-sides"><?php echo (!empty($payment_received['date']) && $payment_received_date = $payment_received['date']) ? ($from_to) ? mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $payment_received_date, true) : mysql2date(get_option('time_format'), $payment_received_date, true) : ''; ?></td>
49
+		<td class="margin-sides"><?php echo (!empty($payment_received['order']->_order_postmeta['order_key'])) ? $payment_received['order']->_order_postmeta['order_key'] : ''; ?></td>
50 50
 		<td class="max-width align-center force-one-line"><?php
51
-			if( !empty($payment_received['order']->_order_postmeta['order_items']) ) {
51
+			if (!empty($payment_received['order']->_order_postmeta['order_items'])) {
52 52
 				$first = true;
53
-				foreach( $payment_received['order']->_order_postmeta['order_items'] as $item ) {
54
-					if( $first ) {
53
+				foreach ($payment_received['order']->_order_postmeta['order_items'] as $item) {
54
+					if ($first) {
55 55
 						$first = !$first;
56 56
 						echo $item['item_name'];
57 57
 					} else {
58
-						echo ', ' .$item['item_name'];
58
+						echo ', ' . $item['item_name'];
59 59
 					}
60 60
 				}
61 61
 			}
62 62
 		?></td>
63
-		<td class="align-right margin-sides"><?php echo ( !empty($payment_received['received_amount']) ) ?  number_format( $payment_received['received_amount'], 2, '.', '' ) : ''; ?><?php echo wpshop_tools::wpshop_get_currency(); ?></td>
63
+		<td class="align-right margin-sides"><?php echo (!empty($payment_received['received_amount'])) ? number_format($payment_received['received_amount'], 2, '.', '') : ''; ?><?php echo wpshop_tools::wpshop_get_currency(); ?></td>
64 64
 	</tr>
65 65
 	<?php endforeach; ?>
66 66
 </tbody>
67 67
 <tfoot class="border">
68 68
 	<tr>
69 69
 		<td colspan="4" class="margin-sides bold"><?php _e('Bank deposit sum', 'wpshop'); ?></td>
70
-		<td class="align-right border margin-sides bold"><?php echo number_format( $orders_date[$method]['amount_total'], 2, '.', '' ) . wpshop_tools::wpshop_get_currency(); ?></td>
70
+		<td class="align-right border margin-sides bold"><?php echo number_format($orders_date[$method]['amount_total'], 2, '.', '') . wpshop_tools::wpshop_get_currency(); ?></td>
71 71
 	</tr>
72 72
 </tfoot>
73 73
 </table>
74 74
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,7 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit; ?>
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
4
+?>
2 5
 <table class="border">
3 6
 <tr>
4 7
 	<td class="width-15"><?php echo !empty($company['company_name']) ? $company['company_name'] : ''; ?></td>
Please login to merge, or discard this patch.
includes/modules/wps-pos-addon/controller/wps-pos-bank-deposit.php 2 patches
Braces   +4 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
 class wps_pos_addon_bank_deposit {
3 5
 	public function __construct() {
4 6
 		/**	Call metaboxes	*/
@@ -154,8 +156,7 @@  discard block
 block discarded – undo
154 156
 				$html2pdf->writeHTML($html_content);
155 157
 
156 158
 				$html2pdf->Output( __('Bank deposit', 'wpshop') . ' - ' . mysql2date( get_option( 'date_format' ), (string) $fromdate->format('Y-m-d') ) . '.pdf', 'D');
157
-			}
158
-			catch (HTML2PDF_exception $e) {
159
+			} catch (HTML2PDF_exception $e) {
159 160
 				echo $e;
160 161
 			}
161 162
 		} else { ?>
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 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,23 +17,23 @@  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
-			if( !empty( $order->_order_postmeta['order_payment']['received'] ) ) {
31
-				foreach( $order->_order_postmeta['order_payment']['received'] as $payment_received ) {
32
-					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
+			if (!empty($order->_order_postmeta['order_payment']['received'])) {
31
+				foreach ($order->_order_postmeta['order_payment']['received'] as $payment_received) {
32
+					if (isset($payment_received['status']) && $payment_received['status'] == 'payment_received') {
33 33
 						$payments[] = '';
34
-						end( $payments );
35
-						$id = key( $payments );
36
-						$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'] );
34
+						end($payments);
35
+						$id = key($payments);
36
+						$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']);
37 37
 					}
38 38
 				}
39 39
 			}
@@ -41,19 +41,19 @@  discard block
 block discarded – undo
41 41
 
42 42
 		return $payments;
43 43
 	}
44
-	public function row_model( $id, $order_key, $date, $products, $amount, $method ) {
44
+	public function row_model($id, $order_key, $date, $products, $amount, $method) {
45 45
 		$products_simplified = array();
46
-		if( !empty( $products ) && is_array( $products ) ) {
47
-			foreach( $products as $product ) {
48
-				if( isset( $product['item_meta']['variations'] ) ) {
49
-					foreach( $product['item_meta']['variations'] as $key => $value ) {
46
+		if (!empty($products) && is_array($products)) {
47
+			foreach ($products as $product) {
48
+				if (isset($product['item_meta']['variations'])) {
49
+					foreach ($product['item_meta']['variations'] as $key => $value) {
50 50
 						$id_variation = $key;
51 51
 						break;
52 52
 					}
53 53
 					$first = true;
54 54
 					$title = $product['item_name'] . ' - ';
55
-					foreach( $product['item_meta']['variations'][$id_variation]['item_meta']['variation_definition'] as $variation ) {
56
-						if( $first ) {
55
+					foreach ($product['item_meta']['variations'][$id_variation]['item_meta']['variation_definition'] as $variation) {
56
+						if ($first) {
57 57
 							$first = false;
58 58
 						} else {
59 59
 							$title .= ', ';
@@ -66,33 +66,33 @@  discard block
 block discarded – undo
66 66
 				}
67 67
 			}
68 68
 		}
69
-		return array( 'id' => $id, 'order_key' => $order_key, 'date' => $date, 'products' => $products_simplified, 'amount' => $amount, 'method' => $method );
69
+		return array('id' => $id, 'order_key' => $order_key, 'date' => $date, 'products' => $products_simplified, 'amount' => $amount, 'method' => $method);
70 70
 	}
71 71
 	public function vars_js() {
72
-		wp_localize_script( 'wpspos-backend-bank-deposit-js', 'payments', $this->get_payments() );
72
+		wp_localize_script('wpspos-backend-bank-deposit-js', 'payments', $this->get_payments());
73 73
 	}
74 74
 
75 75
 	/**
76 76
 	 *	Output bank deposit
77 77
 	 */
78 78
 	public static function wps_pos_bank_deposit_output() {
79
-		$fromdate = empty( $fromdate ) ? date( 'Y-m-d' ) : sanitize_text_field( $_GET['fromdate'] );
80
-		$method = empty( $_GET['method'] ) ? 'all' : sanitize_text_field( $_GET['method'] );
81
-		$mode = !empty( $_GET['mode'] ) ? sanitize_text_field( $_GET['mode'] ) : '';
79
+		$fromdate = empty($fromdate) ? date('Y-m-d') : sanitize_text_field($_GET['fromdate']);
80
+		$method = empty($_GET['method']) ? 'all' : sanitize_text_field($_GET['method']);
81
+		$mode = !empty($_GET['mode']) ? sanitize_text_field($_GET['mode']) : '';
82 82
 
83 83
 		$valid_dates = array();
84 84
 		$valid_dates['relation'] = 'OR';
85 85
 
86
-		$from_to = !empty( $_GET['todate'] ) ? sanitize_text_field( $_GET['todate'] ) : date( 'Y-m-d' );
86
+		$from_to = !empty($_GET['todate']) ? sanitize_text_field($_GET['todate']) : date('Y-m-d');
87 87
 
88
-		$fromdate = DateTime::createFromFormat( 'Y-m-d', $fromdate );
89
-		$todate = DateTime::createFromFormat( 'Y-m-d', ($from_to) ? $from_to : $fromdate );
90
-		$datePeriod = new DatePeriod( $fromdate, new DateInterval('P1D'), $todate->modify('+1 day') );
88
+		$fromdate = DateTime::createFromFormat('Y-m-d', $fromdate);
89
+		$todate = DateTime::createFromFormat('Y-m-d', ($from_to) ? $from_to : $fromdate);
90
+		$datePeriod = new DatePeriod($fromdate, new DateInterval('P1D'), $todate->modify('+1 day'));
91 91
 
92
-		foreach($datePeriod as $date) {
92
+		foreach ($datePeriod as $date) {
93 93
 			$valid_dates[] = array(
94 94
 				'key'			=> '_order_postmeta',
95
-				'value' 		=> serialize( 'date' ) . 's:19:"' . $date->format( 'Y-m-d' ),
95
+				'value' 		=> serialize('date') . 's:19:"' . $date->format('Y-m-d'),
96 96
 				'compare' 		=> 'LIKE',
97 97
 			);
98 98
 		}
@@ -105,30 +105,30 @@  discard block
 block discarded – undo
105 105
 				'relation' 			=> 'AND',
106 106
 				array(
107 107
 						'key'			=> '_order_postmeta',
108
-						'value' 		=> serialize( 'order_status' ) . serialize( 'pos' ),
108
+						'value' 		=> serialize('order_status') . serialize('pos'),
109 109
 						'compare' 		=> 'LIKE',
110 110
 				),
111 111
 				$valid_dates,
112 112
 			),
113 113
 		);
114
-		if( $method != 'all' ) {
114
+		if ($method != 'all') {
115 115
 			$args['meta_query'][] = array(
116 116
 					'key'			=> '_order_postmeta',
117
-					'value' 		=> serialize( 'method' ) . serialize( $method ),
117
+					'value' 		=> serialize('method') . serialize($method),
118 118
 					'compare' 		=> 'LIKE',
119 119
 			);
120 120
 		}
121
-		$query = new WP_Query( $args );
121
+		$query = new WP_Query($args);
122 122
 
123 123
 		$orders = $query->posts;
124 124
 		$orders_date = array();
125 125
 
126
-		foreach( $orders as $order ) {
127
-			$order->_order_postmeta = get_post_meta( $order->ID, '_order_postmeta', true );
128
-			foreach( $order->_order_postmeta['order_payment']['received'] as $payment_received ) {
129
-				if( $payment_received['status'] == 'payment_received' ) {
126
+		foreach ($orders as $order) {
127
+			$order->_order_postmeta = get_post_meta($order->ID, '_order_postmeta', true);
128
+			foreach ($order->_order_postmeta['order_payment']['received'] as $payment_received) {
129
+				if ($payment_received['status'] == 'payment_received') {
130 130
 					$payment_received['order'] = $order;
131
-					if( !isset( $orders_date[$payment_received['method']] ) ) { $orders_date[$payment_received['method']]['amount_total'] = 0; }
131
+					if (!isset($orders_date[$payment_received['method']])) { $orders_date[$payment_received['method']]['amount_total'] = 0; }
132 132
 					@$orders_date[$payment_received['method']]['amount_total'] += $payment_received['received_amount'];
133 133
 					@$orders_date[$payment_received['method']]['list'][] = $payment_received;
134 134
 					@$orders_date['all']['amount_total'] += $payment_received['received_amount'];
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
 
140 140
 		$company = get_option('wpshop_company_info', array());
141 141
 
142
-		if ( !empty( $mode ) && $mode == 'pdf') {
143
-			require_once(WPSHOP_LIBRAIRIES_DIR.'HTML2PDF/html2pdf.class.php');
142
+		if (!empty($mode) && $mode == 'pdf') {
143
+			require_once(WPSHOP_LIBRAIRIES_DIR . 'HTML2PDF/html2pdf.class.php');
144 144
 			try {
145 145
 				ob_start(); ?>
146
-				<?php require( wpshop_tools::get_template_part( WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/bank_deposit', 'bank_deposit_style' ) ); ?>
146
+				<?php require(wpshop_tools::get_template_part(WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/bank_deposit', 'bank_deposit_style')); ?>
147 147
 				<page>
148
-					<?php require( wpshop_tools::get_template_part( WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/bank_deposit', 'bank_deposit' ) ); ?>
148
+					<?php require(wpshop_tools::get_template_part(WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/bank_deposit', 'bank_deposit')); ?>
149 149
 				</page>
150 150
 				<?php $html_content = ob_get_contents();
151 151
 				ob_end_clean();
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 				$html2pdf->setDefaultFont('Arial');
155 155
 				$html2pdf->writeHTML($html_content);
156 156
 
157
-				$html2pdf->Output( __('Bank deposit', 'wpshop') . ' - ' . mysql2date( get_option( 'date_format' ), (string) $fromdate->format('Y-m-d') ) . '.pdf', 'D');
157
+				$html2pdf->Output(__('Bank deposit', 'wpshop') . ' - ' . mysql2date(get_option('date_format'), (string)$fromdate->format('Y-m-d')) . '.pdf', 'D');
158 158
 			}
159 159
 			catch (HTML2PDF_exception $e) {
160 160
 				echo $e;
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 			<!--<![endif]-->
170 170
 				<head>
171 171
 					<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
172
-					<title><?php _e('Bank deposit', 'wpshop'); ?> - <?php echo mysql2date( get_option( 'date_format' ), (string) $fromdate->format('Y-m-d') ); ?></title>
173
-					<?php require( wpshop_tools::get_template_part( WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/bank_deposit', 'bank_deposit_style' ) ); ?>
172
+					<title><?php _e('Bank deposit', 'wpshop'); ?> - <?php echo mysql2date(get_option('date_format'), (string)$fromdate->format('Y-m-d')); ?></title>
173
+					<?php require(wpshop_tools::get_template_part(WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/bank_deposit', 'bank_deposit_style')); ?>
174 174
 				</head>
175 175
 				<body>
176
-					<?php require( wpshop_tools::get_template_part( WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/bank_deposit', 'bank_deposit' ) ); ?>
176
+					<?php require(wpshop_tools::get_template_part(WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend/bank_deposit', 'bank_deposit')); ?>
177 177
 				</body>
178 178
 			</html>
179 179
 			<?php
Please login to merge, or discard this patch.
includes/librairies/documents/documents.class.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
 class wpshop_documents
26 26
 {
27 27
 	/**
28
-	* This filter translates string before it is displayed
29
-	* specifically for the words 'Use as featured image' with 'Use as Product Thumbnail' when the user is selecting a Product Thumbnail
30
-	* using media gallery.
31
-	*
32
-	* @param $translation The current translation
33
-	* @param $text The text being translated
34
-	* @param $domain The domain for the translation
35
-	*
36
-	* @return string The translated / filtered text.
37
-	*/
28
+	 * This filter translates string before it is displayed
29
+	 * specifically for the words 'Use as featured image' with 'Use as Product Thumbnail' when the user is selecting a Product Thumbnail
30
+	 * using media gallery.
31
+	 *
32
+	 * @param $translation The current translation
33
+	 * @param $text The text being translated
34
+	 * @param $domain The domain for the translation
35
+	 *
36
+	 * @return string The translated / filtered text.
37
+	 */
38 38
 	public static function change_picture_translation($translation, $text, $domain = 'wpshop'){
39 39
 
40 40
 		$post_id = !empty( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	/**
55
-	*
56
-	*/
55
+	 *
56
+	 */
57 57
 	public static function attachment_fields($form_fields, $post){
58 58
 		/*	Get the current post informations	*/
59 59
 		$id = isset($_GET["post_id"]) ? absint( (int) $_GET["post_id"] ) : null;
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	}
70 70
 
71 71
 	/**
72
-	*
73
-	*/
72
+	 *
73
+	 */
74 74
 	public static function galery_manager_css(){
75 75
 		ob_start();
76 76
 		include(WPSHOP_CSS_DIR . 'pages/wpshop_galery.css');
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
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
 /**
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 	*
36 36
 	* @return string The translated / filtered text.
37 37
 	*/
38
-	public static function change_picture_translation($translation, $text, $domain = 'wpshop'){
38
+	public static function change_picture_translation($translation, $text, $domain = 'wpshop') {
39 39
 
40
-		$post_id = !empty( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
40
+		$post_id = !empty($_REQUEST['post_id']) ? (int)$_REQUEST['post_id'] : 0;
41 41
 
42
-		if(($text == 'Use as featured image') && isset($post_id)){
42
+		if (($text == 'Use as featured image') && isset($post_id)) {
43 43
 
44
-			$post = get_post( $post_id );
44
+			$post = get_post($post_id);
45 45
 			if (!empty($post->post_type) && $post->post_type != WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT) return $translation;
46 46
 			$translations = get_translations_for_domain($domain);
47
-			if ( empty($translations->entries['Use as product thumbnail']->translations[0]) ) return $translation;
47
+			if (empty($translations->entries['Use as product thumbnail']->translations[0])) return $translation;
48 48
 			return $translations->entries['Use as product thumbnail']->translations[0];
49 49
 		}
50 50
 
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 	/**
55 55
 	*
56 56
 	*/
57
-	public static function attachment_fields($form_fields, $post){
57
+	public static function attachment_fields($form_fields, $post) {
58 58
 		/*	Get the current post informations	*/
59
-		$id = isset($_GET["post_id"]) ? absint( (int) $_GET["post_id"] ) : null;
60
-		if(isset($id)){
61
-			$parent_post = get_post( $id );
59
+		$id = isset($_GET["post_id"]) ? absint((int)$_GET["post_id"]) : null;
60
+		if (isset($id)) {
61
+			$parent_post = get_post($id);
62 62
 		}
63
-		else{
64
-			$parent_post = get_post( $post->post_parent );
63
+		else {
64
+			$parent_post = get_post($post->post_parent);
65 65
 		}
66 66
 
67 67
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	/**
72 72
 	*
73 73
 	*/
74
-	public static function galery_manager_css(){
74
+	public static function galery_manager_css() {
75 75
 		ob_start();
76 76
 		include(WPSHOP_CSS_DIR . 'pages/wpshop_galery.css');
77 77
 		$wpshop_galery_css = ob_get_contents();
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 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
 /*	Check if file is include. No direct access possible with file url	*/
4 6
 if ( !defined( 'WPSHOP_VERSION' ) ) {
@@ -42,9 +44,13 @@  discard block
 block discarded – undo
42 44
 		if(($text == 'Use as featured image') && isset($post_id)){
43 45
 
44 46
 			$post = get_post( $post_id );
45
-			if (!empty($post->post_type) && $post->post_type != WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT) return $translation;
47
+			if (!empty($post->post_type) && $post->post_type != WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT) {
48
+				return $translation;
49
+			}
46 50
 			$translations = get_translations_for_domain($domain);
47
-			if ( empty($translations->entries['Use as product thumbnail']->translations[0]) ) return $translation;
51
+			if ( empty($translations->entries['Use as product thumbnail']->translations[0]) ) {
52
+				return $translation;
53
+			}
48 54
 			return $translations->entries['Use as product thumbnail']->translations[0];
49 55
 		}
50 56
 
@@ -59,8 +65,7 @@  discard block
 block discarded – undo
59 65
 		$id = isset($_GET["post_id"]) ? absint( (int) $_GET["post_id"] ) : null;
60 66
 		if(isset($id)){
61 67
 			$parent_post = get_post( $id );
62
-		}
63
-		else{
68
+		} else{
64 69
 			$parent_post = get_post( $post->post_parent );
65 70
 		}
66 71
 
Please login to merge, or discard this patch.
includes/modules/wps_address/templates/frontend/address-first.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1
-<div class="wps-<?php echo $address_type; ?>-address" <?php if ( !empty( $first_address_checking ) && !$is_from_admin && $type == 'billing' ) { echo 'style="display: none;"'; } ?> data-nonce="<?php echo wp_create_nonce( 'wps_reload_address_interface' ); ?>" id="wps-address-container-<?php echo $address_type_id; ?>">
1
+<div class="wps-<?php echo $address_type; ?>-address" <?php if (!empty($first_address_checking) && !$is_from_admin && $type == 'billing') { echo 'style="display: none;"'; } ?> data-nonce="<?php echo wp_create_nonce('wps_reload_address_interface'); ?>" id="wps-address-container-<?php echo $address_type_id; ?>">
2 2
 	<div id="wps_address_error_container" ></div>
3
-	<form id="wps_address_form_save_first_address" action="<?php echo admin_url( 'admin-ajax.php' ); ?>" method="post">
4
-		<?php wp_nonce_field( 'wps_save_address' ); ?>
3
+	<form id="wps_address_form_save_first_address" action="<?php echo admin_url('admin-ajax.php'); ?>" method="post">
4
+		<?php wp_nonce_field('wps_save_address'); ?>
5 5
 <?php
6
-		echo self::display_form_fields( $address_type_id, '', '', '', array(), array(), array(), get_current_user_id() );
6
+		echo self::display_form_fields($address_type_id, '', '', '', array(), array(), array(), get_current_user_id());
7 7
 
8 8
 	/** Check if a billing address is already save **/
9
-	if ( $address_type_id != $billing_option['choice'] ) :
9
+	if ($address_type_id != $billing_option['choice']) :
10 10
 ?>
11 11
 		<label class="wps-form" >
12 12
 			<input name="wps-shipping-to-billing" id="wps-shipping_to_billing" checked="checked" type="checkbox" />
13
-			<?php _e( 'Use the same address for billing', 'wpshop' ); ?>
13
+			<?php _e('Use the same address for billing', 'wpshop'); ?>
14 14
 		</label>
15 15
 <?php endif; ?>
16 16
 
Please login to merge, or discard this patch.