Completed
Pull Request — master (#2)
by Jimmy
1003:35 queued 970:52
created
includes/modules/wps_barcode/controller/wps_barcode_settings.ctr.php 2 patches
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 class wps_barcode_settings {
4 4
 	public function __construct() {
5 5
 		add_filter('wpshop_options', array(&$this, 'add_options'), 10);
6
-		add_action( 'admin_init', array( &$this, 'declare_options' ) );
6
+		add_action('admin_init', array(&$this, 'declare_options'));
7 7
 	}
8 8
 
9 9
 	/**
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public function add_options($option_group) {
15 15
 		$option_group['wpshop_barcode_options'] =
16
-		array(	'label' => __('Barcode', 'wps_barcode'),
16
+		array('label' => __('Barcode', 'wps_barcode'),
17 17
 				'subgroups' => array(
18 18
 						'wpshop_barcode_options' => array('class' =>
19 19
 								' wpshop_admin_box_options_barcode'),
@@ -32,16 +32,16 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function declare_options() {
34 34
 		register_setting('wpshop_options', 'wps_barcode',
35
-		array( $this, 'validate_options') );
35
+		array($this, 'validate_options'));
36 36
 		
37 37
 		add_settings_section('wpshop_barcode_type_options',
38
-			'<span class="dashicons dashicons-format-chat"></span>'.
38
+			'<span class="dashicons dashicons-format-chat"></span>' .
39 39
 			__('WPShop Barcode configuration', 'wps_barcode'),
40 40
 			array($this, 'welcome_msg'), 'wpshop_barcode_options');
41 41
 		
42 42
 		add_settings_field('wpshop_barcode_type_field',
43
-			__( 'Type of EAN-13 Barcode', 'wps_barcode'),
44
-			array( $this, 'add_type_field'), 'wpshop_barcode_options',
43
+			__('Type of EAN-13 Barcode', 'wps_barcode'),
44
+			array($this, 'add_type_field'), 'wpshop_barcode_options',
45 45
 			'wpshop_barcode_type_options');
46 46
 		
47 47
 		add_settings_field('wpshop_barcode_display_field',
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		
52 52
 		
53 53
 			add_settings_section('wpshop_barcode_internal_ccode_options',
54
-			'<span class="dashicons dashicons-format-chat"></span>'.
54
+			'<span class="dashicons dashicons-format-chat"></span>' .
55 55
 			__('WPShop Barcode internal code configuration', 'wps_barcode'),
56 56
 			array($this, 'internal_code_section'), 'wpshop_barcode_options_internal');
57 57
 			
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 			array($this, 'add_do_provider_field'), 'wpshop_barcode_options_internal',
101 101
 			'wpshop_barcode_internal_ccode_options');
102 102
 			add_settings_section('wpshop_barcode_normal_code_options',
103
-			'<span class="dashicons dashicons-format-chat"></span>'.
103
+			'<span class="dashicons dashicons-format-chat"></span>' .
104 104
 			__('WPShop Barcode normal code configuration', 'wps_barcode'),
105 105
 			array($this, 'normal_code_section'), 'wpshop_barcode_options_normal');
106 106
 			
@@ -149,35 +149,35 @@  discard block
 block discarded – undo
149 149
 		$internal['normal_enterprise_code'] = isset($input['normal_enterprise_code']) ? $input['normal_enterprise_code'] : '';
150 150
 		
151 151
 		/*Verifiy if 3 or 2 digits are presents*/
152
-		if ( !empty($internal['internal_client']) || !empty($internal['internal_provider']) || !empty($internal['internal_invoice_client']) || !empty($internal['internal_do_client']) || !empty($internal['internal_product']) || !empty($internal['internal_invoice_provider']) || !empty($internal['internal_do_provider'])  || !empty($internal['normal_country_code']) || !empty($internal['normal_enterprise_code']) ) {
153
-			$internal['internal_client'] = strlen($internal['internal_client']) === 2 ? '0'.$internal['internal_client'] : ( strlen($internal['internal_client']) === 3 ? $internal['internal_client'] : '');
152
+		if (!empty($internal['internal_client']) || !empty($internal['internal_provider']) || !empty($internal['internal_invoice_client']) || !empty($internal['internal_do_client']) || !empty($internal['internal_product']) || !empty($internal['internal_invoice_provider']) || !empty($internal['internal_do_provider']) || !empty($internal['normal_country_code']) || !empty($internal['normal_enterprise_code'])) {
153
+			$internal['internal_client'] = strlen($internal['internal_client']) === 2 ? '0' . $internal['internal_client'] : (strlen($internal['internal_client']) === 3 ? $internal['internal_client'] : '');
154 154
 			
155
-			$internal['internal_provider'] = strlen($internal['internal_provider']) === 2 ? '0'.$internal['internal_provider'] : (strlen($internal['internal_provider']) === 3 ? $internal['internal_provider'] : '');
155
+			$internal['internal_provider'] = strlen($internal['internal_provider']) === 2 ? '0' . $internal['internal_provider'] : (strlen($internal['internal_provider']) === 3 ? $internal['internal_provider'] : '');
156 156
 			
157
-			$internal['internal_invoice_client'] = strlen($internal['internal_invoice_client']) === 2 ? '0'.$internal['internal_invoice_client'] : (strlen($internal['internal_invoice_client']) === 3 ? $internal['internal_invoice_client'] : '');
157
+			$internal['internal_invoice_client'] = strlen($internal['internal_invoice_client']) === 2 ? '0' . $internal['internal_invoice_client'] : (strlen($internal['internal_invoice_client']) === 3 ? $internal['internal_invoice_client'] : '');
158 158
 			
159
-			$internal['internal_do_client'] = strlen($internal['internal_do_client']) === 2 ? '0'.$internal['internal_do_client'] : (strlen($internal['internal_do_client']) === 3 ? $internal['internal_do_client'] : '');
159
+			$internal['internal_do_client'] = strlen($internal['internal_do_client']) === 2 ? '0' . $internal['internal_do_client'] : (strlen($internal['internal_do_client']) === 3 ? $internal['internal_do_client'] : '');
160 160
 			
161
-			$internal['internal_product'] = strlen($internal['internal_product']) === 2 ? '0'.$internal['internal_product'] : (strlen($internal['internal_product']) === 3 ? $internal['internal_product'] : '');
161
+			$internal['internal_product'] = strlen($internal['internal_product']) === 2 ? '0' . $internal['internal_product'] : (strlen($internal['internal_product']) === 3 ? $internal['internal_product'] : '');
162 162
 			
163
-			$internal['internal_assets_client'] = strlen($internal['internal_assets_client']) === 2 ? '0'.$internal['internal_assets_client'] : (strlen($internal['internal_assets_client']) === 3 ? $internal['internal_assets_client'] : '');
163
+			$internal['internal_assets_client'] = strlen($internal['internal_assets_client']) === 2 ? '0' . $internal['internal_assets_client'] : (strlen($internal['internal_assets_client']) === 3 ? $internal['internal_assets_client'] : '');
164 164
 			
165
-			$internal['internal_coupons'] = strlen($internal['internal_coupons']) === 2 ? '0'.$internal['internal_coupons'] : (strlen($internal['internal_coupons']) === 3 ? $internal['internal_coupons'] : '');
165
+			$internal['internal_coupons'] = strlen($internal['internal_coupons']) === 2 ? '0' . $internal['internal_coupons'] : (strlen($internal['internal_coupons']) === 3 ? $internal['internal_coupons'] : '');
166 166
 			
167
-			$internal['internal_invoice_provider'] = strlen($internal['internal_invoice_provider']) === 2 ? '0'.$internal['internal_invoice_provider'] : (strlen($internal['internal_invoice_provider']) === 3 ? $internal['internal_invoice_provider'] : '');
167
+			$internal['internal_invoice_provider'] = strlen($internal['internal_invoice_provider']) === 2 ? '0' . $internal['internal_invoice_provider'] : (strlen($internal['internal_invoice_provider']) === 3 ? $internal['internal_invoice_provider'] : '');
168 168
 			
169
-			$internal['internal_do_provider'] = strlen($internal['internal_do_provider']) === 2 ? '0'.$internal['internal_do_provider'] : (strlen($internal['internal_do_provider']) === 3 ? $internal['internal_do_provider'] : '');
169
+			$internal['internal_do_provider'] = strlen($internal['internal_do_provider']) === 2 ? '0' . $internal['internal_do_provider'] : (strlen($internal['internal_do_provider']) === 3 ? $internal['internal_do_provider'] : '');
170 170
 			
171
-			$internal['normal_country_code'] = strlen($internal['normal_country_code']) === 2 ? '0'.$internal['normal_country_code'] : (strlen($internal['normal_country_code']) === 3 ? $internal['normal_country_code'] : '');
171
+			$internal['normal_country_code'] = strlen($internal['normal_country_code']) === 2 ? '0' . $internal['normal_country_code'] : (strlen($internal['normal_country_code']) === 3 ? $internal['normal_country_code'] : '');
172 172
 			
173
-			if ( strlen($internal['normal_enterprise_code']) === 1 ) {
174
-				$internal['normal_enterprise_code'] = '000'.$internal['normal_enterprise_code'];
173
+			if (strlen($internal['normal_enterprise_code']) === 1) {
174
+				$internal['normal_enterprise_code'] = '000' . $internal['normal_enterprise_code'];
175 175
 			}
176
-			else if ( strlen($internal['normal_enterprise_code']) === 2 ) {
177
-				$internal['normal_enterprise_code'] = '00'.$internal['normal_enterprise_code'];
176
+			else if (strlen($internal['normal_enterprise_code']) === 2) {
177
+				$internal['normal_enterprise_code'] = '00' . $internal['normal_enterprise_code'];
178 178
 			}
179
-			else if ( strlen($internal['normal_enterprise_code']) === 3 ) {
180
-				$internal['normal_enterprise_code'] = '0'.$internal['normal_enterprise_code'];
179
+			else if (strlen($internal['normal_enterprise_code']) === 3) {
180
+				$internal['normal_enterprise_code'] = '0' . $internal['normal_enterprise_code'];
181 181
 			}
182 182
 			else {
183 183
 				$internal['normal_enterprise_code'] = $internal['normal_enterprise_code'];
@@ -185,84 +185,84 @@  discard block
 block discarded – undo
185 185
 		}
186 186
 		
187 187
 		/*Verify if range respected*/
188
-		if ( $internal['internal_client'] !== '') {
188
+		if ($internal['internal_client'] !== '') {
189 189
 			$val = intval($internal['internal_client']);
190
-			if ( $val < 40 || $val > 49) {
190
+			if ($val < 40 || $val > 49) {
191 191
 				unset($internal['internal_client']);
192 192
 				unset($input['client']);
193 193
 			}
194 194
 		}
195 195
 		
196
-		if ( $internal['internal_provider'] !== '') {
196
+		if ($internal['internal_provider'] !== '') {
197 197
 			$val = intval($internal['internal_provider']);
198
-			if ( $val < 40 || $val > 49) {
198
+			if ($val < 40 || $val > 49) {
199 199
 				unset($internal['internal_provider']);
200 200
 				unset($input['provider']);
201 201
 			}
202 202
 		}
203 203
 		
204
-		if ( $internal['internal_invoice_client'] !== '') {
204
+		if ($internal['internal_invoice_client'] !== '') {
205 205
 			$val = intval($internal['internal_invoice_client']);
206
-			if ( $val < 40 || $val > 49) {
206
+			if ($val < 40 || $val > 49) {
207 207
 				unset($internal['internal_invoice_client']);
208 208
 				unset($input['invoice_client']);
209 209
 			}
210 210
 		}
211 211
 		
212
-		if ( $internal['internal_do_client'] !== '') {
212
+		if ($internal['internal_do_client'] !== '') {
213 213
 			$val = intval($internal['internal_do_client']);
214
-			if ( $val < 40 || $val > 49) {
214
+			if ($val < 40 || $val > 49) {
215 215
 				unset($internal['internal_do_client']);
216 216
 				unset($input['do_client']);
217 217
 			}
218 218
 		}
219 219
 		
220
-		if ( $internal['internal_product'] !== '') {
220
+		if ($internal['internal_product'] !== '') {
221 221
 			$val = intval($internal['internal_product']);
222
-			if ( $val < 40 || $val > 49) {
222
+			if ($val < 40 || $val > 49) {
223 223
 				unset($internal['internal_product']);
224 224
 				unset($input['product']);
225 225
 			}
226 226
 		}
227 227
 		
228
-		if ( $internal['internal_assets_client'] !== '') {
228
+		if ($internal['internal_assets_client'] !== '') {
229 229
 			$val = intval($internal['internal_assets_client']);
230
-			if ( $val < 50 || $val > 59) {
230
+			if ($val < 50 || $val > 59) {
231 231
 				unset($internal['internal_assets_client']);
232 232
 				unset($input['assets_client']);
233 233
 			}
234 234
 		}
235 235
 		
236
-		if ( $internal['internal_coupons'] !== '') {
236
+		if ($internal['internal_coupons'] !== '') {
237 237
 			$val = intval($internal['internal_coupons']);
238
-			if ( $val < 50 || $val > 59) {
238
+			if ($val < 50 || $val > 59) {
239 239
 				unset($internal['internal_coupons']);
240 240
 				unset($input['coupons']);
241 241
 			}
242 242
 		}
243 243
 		
244
-		if ( $internal['internal_invoice_provider'] !== '') {
244
+		if ($internal['internal_invoice_provider'] !== '') {
245 245
 			$val = intval($internal['internal_invoice_provider']);
246
-			if ( $val < 40 || $val > 49) {
246
+			if ($val < 40 || $val > 49) {
247 247
 				unset($internal['internal_invoice_provider']);
248 248
 				unset($input['invoice_provider']);
249 249
 			}
250 250
 		}
251 251
 		
252
-		if ( $internal['internal_do_provider'] !== '') {
252
+		if ($internal['internal_do_provider'] !== '') {
253 253
 			$val = intval($internal['internal_do_provider']);
254
-			if ( $val < 40 || $val > 49) {
254
+			if ($val < 40 || $val > 49) {
255 255
 				unset($internal['internal_do_provider']);
256 256
 				unset($input['do_provider']);
257 257
 			}
258 258
 		}
259 259
 		
260
-		if ( $internal['normal_country_code'] === '' ) {
260
+		if ($internal['normal_country_code'] === '') {
261 261
 			unset($internal['normal_country_code']);
262 262
 			unset($input['normal_country_code']);
263 263
 		}
264 264
 		
265
-		if ( $internal['normal_enterprise_code'] === '' ) {
265
+		if ($internal['normal_enterprise_code'] === '') {
266 266
 			unset($internal['normal_enterprise_code']);
267 267
 			unset($input['normal_enterprise_code']);
268 268
 		}
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
 	 * Display message for internal code section
277 277
 	 */
278 278
 	public function internal_code_section() {
279
-		_e("Configure your internal codes for automatically generate barcode. The codes are 2 digits, its normal. ".
280
-				"You can put 3 without problems. Please respect the range number following: 040 up to 049.".
279
+		_e("Configure your internal codes for automatically generate barcode. The codes are 2 digits, its normal. " .
280
+				"You can put 3 without problems. Please respect the range number following: 040 up to 049." .
281 281
 				" For coupons, the range is: 050 up to 059.", 'wps_barcode');
282 282
 	}
283 283
 	
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 	public function add_display_field() {
292 292
 		$field = get_option('wps_barcode');
293 293
 		
294
-		$checked = ( isset($field['generate_barcode']) && $field['generate_barcode'] === 'on') ? 'checked' : '';
294
+		$checked = (isset($field['generate_barcode']) && $field['generate_barcode'] === 'on') ? 'checked' : '';
295 295
 		
296
-		echo '<input type="checkbox" name="wps_barcode[generate_barcode]" id="barcode_display"'.$checked.'>';
296
+		echo '<input type="checkbox" name="wps_barcode[generate_barcode]" id="barcode_display"' . $checked . '>';
297 297
 	}
298 298
 	
299 299
 	/**
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 				
308 308
 		echo '<select name="wps_barcode[type]" id="barcode_type">';
309 309
 		
310
-		if ( !empty($field) && ($field['type'] == 'internal') ) {
311
-			echo '<option value="internal" selected>'.__('Internal', 'wps_barcode').'</option>';
312
-			echo '<option value="normal">'.__('Normal', 'wps_barcode').'</option>';
310
+		if (!empty($field) && ($field['type'] == 'internal')) {
311
+			echo '<option value="internal" selected>' . __('Internal', 'wps_barcode') . '</option>';
312
+			echo '<option value="normal">' . __('Normal', 'wps_barcode') . '</option>';
313 313
 		}
314
-		else if ( !empty($field) && ($field['type'] == 'normal') ) {
315
-			echo '<option value="internal">'.__('Internal', 'wps_barcode').'</option>';
316
-			echo '<option value="normal" selected>'.__('Normal', 'wps_barcode').'</option>';
314
+		else if (!empty($field) && ($field['type'] == 'normal')) {
315
+			echo '<option value="internal">' . __('Internal', 'wps_barcode') . '</option>';
316
+			echo '<option value="normal" selected>' . __('Normal', 'wps_barcode') . '</option>';
317 317
 		}
318 318
 		
319 319
 		echo '</select>';
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	public function welcome_msg() {
328 328
 		//include(WPS_BARCODE_TEMPLATES_MAIN_DIR.'backend/welcome.tpl.php');
329
-		require( wpshop_tools::get_template_part(WPS_BARCODE_PATH,
330
-			WPS_BARCODE_TEMPLATES_TPL_DIR, 'backend', 'welcome/welcome') );
329
+		require(wpshop_tools::get_template_part(WPS_BARCODE_PATH,
330
+			WPS_BARCODE_TEMPLATES_TPL_DIR, 'backend', 'welcome/welcome'));
331 331
 	}
332 332
 	
333 333
 	/**
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	public function add_client_field() {
337 337
 		$field = get_option('wps_barcode');
338 338
 		
339
-		echo '<input type="number" name="wps_barcode[internal_client]" '.
340
-				'min=40 max=49 value="'.$field['internal_client'].'" />';
339
+		echo '<input type="number" name="wps_barcode[internal_client]" ' .
340
+				'min=40 max=49 value="' . $field['internal_client'] . '" />';
341 341
 	}
342 342
 	
343 343
 	/**
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
 	public function add_provider_field() {
347 347
 		$field = get_option('wps_barcode');
348 348
 	
349
-		echo '<input type="number" name="wps_barcode[internal_provider]" '.
350
-				'min=40 max=49 value="'.$field['internal_provider'].'" />';
349
+		echo '<input type="number" name="wps_barcode[internal_provider]" ' .
350
+				'min=40 max=49 value="' . $field['internal_provider'] . '" />';
351 351
 	}
352 352
 	
353 353
 	/**
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
 	public function add_invoice_client_field() {
357 357
 		$field = get_option('wps_barcode');
358 358
 	
359
-		echo '<input type="number" name="wps_barcode[internal_invoice_client]" '.
360
-				'min=40 max=49 value="'.$field['internal_invoice_client'].'" />';
359
+		echo '<input type="number" name="wps_barcode[internal_invoice_client]" ' .
360
+				'min=40 max=49 value="' . $field['internal_invoice_client'] . '" />';
361 361
 	}
362 362
 	
363 363
 	/**
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 	public function add_do_client_field() {
367 367
 		$field = get_option('wps_barcode');
368 368
 
369
-		echo '<input type="number" name="wps_barcode[internal_do_client]" '.
370
-				'min=40 max=49 value="'.$field['internal_do_client'].'" />';
369
+		echo '<input type="number" name="wps_barcode[internal_do_client]" ' .
370
+				'min=40 max=49 value="' . $field['internal_do_client'] . '" />';
371 371
 	}
372 372
 	
373 373
 	/**
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 	public function add_product_field() {
377 377
 		$field = get_option('wps_barcode');
378 378
 	
379
-		echo '<input type="number" name="wps_barcode[internal_product]" '.
380
-				'min=40 max=49 value="'.$field['internal_product'].'" />';
379
+		echo '<input type="number" name="wps_barcode[internal_product]" ' .
380
+				'min=40 max=49 value="' . $field['internal_product'] . '" />';
381 381
 	}
382 382
 	
383 383
 	/**
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
 	public function add_assets_client_field() {
387 387
 		$field = get_option('wps_barcode');
388 388
 	
389
-		echo '<input type="number" name="wps_barcode[internal_assets_client]" '.
390
-				'min=50 max=59 value="'.$field['internal_assets_client'].'" />';
389
+		echo '<input type="number" name="wps_barcode[internal_assets_client]" ' .
390
+				'min=50 max=59 value="' . $field['internal_assets_client'] . '" />';
391 391
 	}
392 392
 	
393 393
 	/**
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
 	public function add_coupons_field() {
397 397
 		$field = get_option('wps_barcode');
398 398
 	
399
-		echo '<input type="number" name="wps_barcode[internal_coupons]" '.
400
-				'min=50 max=59 value="'.$field['internal_coupons'].'" />';
399
+		echo '<input type="number" name="wps_barcode[internal_coupons]" ' .
400
+				'min=50 max=59 value="' . $field['internal_coupons'] . '" />';
401 401
 	}
402 402
 	
403 403
 	/**
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 	public function add_invoice_provider_field() {
407 407
 		$field = get_option('wps_barcode');
408 408
 	
409
-		echo '<input type="number" name="wps_barcode[internal_invoice_provider]" '.
410
-				'min=40 max=49 value="'.$field['internal_invoice_provider'].'" />';
409
+		echo '<input type="number" name="wps_barcode[internal_invoice_provider]" ' .
410
+				'min=40 max=49 value="' . $field['internal_invoice_provider'] . '" />';
411 411
 	}
412 412
 	
413 413
 	/**
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
 	public function add_do_provider_field() {
417 417
 		$field = get_option('wps_barcode');
418 418
 	
419
-		echo '<input type="number" name="wps_barcode[internal_do_provider]" '.
420
-				'min=40 max=49 value="'.$field['internal_do_provider'].'" />';
419
+		echo '<input type="number" name="wps_barcode[internal_do_provider]" ' .
420
+				'min=40 max=49 value="' . $field['internal_do_provider'] . '" />';
421 421
 	}
422 422
 	
423 423
 	/**
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 	public function add_country_code_field() {
427 427
 		$field = get_option('wps_barcode');
428 428
 		
429
-		echo '<input type="number" name="wps_barcode[normal_country_code]" '.
430
-				'value="'.$field['normal_country_code'].'" />';
429
+		echo '<input type="number" name="wps_barcode[normal_country_code]" ' .
430
+				'value="' . $field['normal_country_code'] . '" />';
431 431
 	}
432 432
 	
433 433
 	/**
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 	public function add_enterprise_code_field() {
437 437
 		$field = get_option('wps_barcode');
438 438
 		
439
-		echo '<input type="number" name="wps_barcode[normal_enterprise_code]" '.
440
-				'value="'.$field['normal_enterprise_code'].'" />';
439
+		echo '<input type="number" name="wps_barcode[normal_enterprise_code]" ' .
440
+				'value="' . $field['normal_enterprise_code'] . '" />';
441 441
 	}
442 442
 }
443 443
 
Please login to merge, or discard this patch.
Braces   +7 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
 class wps_barcode_settings {
4 6
 	public function __construct() {
@@ -172,14 +174,11 @@  discard block
 block discarded – undo
172 174
 			
173 175
 			if ( strlen($internal['normal_enterprise_code']) === 1 ) {
174 176
 				$internal['normal_enterprise_code'] = '000'.$internal['normal_enterprise_code'];
175
-			}
176
-			else if ( strlen($internal['normal_enterprise_code']) === 2 ) {
177
+			} else if ( strlen($internal['normal_enterprise_code']) === 2 ) {
177 178
 				$internal['normal_enterprise_code'] = '00'.$internal['normal_enterprise_code'];
178
-			}
179
-			else if ( strlen($internal['normal_enterprise_code']) === 3 ) {
179
+			} else if ( strlen($internal['normal_enterprise_code']) === 3 ) {
180 180
 				$internal['normal_enterprise_code'] = '0'.$internal['normal_enterprise_code'];
181
-			}
182
-			else {
181
+			} else {
183 182
 				$internal['normal_enterprise_code'] = $internal['normal_enterprise_code'];
184 183
 			}
185 184
 		}
@@ -310,8 +309,7 @@  discard block
 block discarded – undo
310 309
 		if ( !empty($field) && ($field['type'] == 'internal') ) {
311 310
 			echo '<option value="internal" selected>'.__('Internal', 'wps_barcode').'</option>';
312 311
 			echo '<option value="normal">'.__('Normal', 'wps_barcode').'</option>';
313
-		}
314
-		else if ( !empty($field) && ($field['type'] == 'normal') ) {
312
+		} else if ( !empty($field) && ($field['type'] == 'normal') ) {
315 313
 			echo '<option value="internal">'.__('Internal', 'wps_barcode').'</option>';
316 314
 			echo '<option value="normal" selected>'.__('Normal', 'wps_barcode').'</option>';
317 315
 		}
Please login to merge, or discard this patch.
includes/modules/wps_orders/controller/wps_orders_in_back_office.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -261,7 +261,7 @@
 block discarded – undo
261 261
 				$wps_message->wpshop_prepared_email($email,
262 262
 						'WPSHOP_QUOTATION_UPDATE_MESSAGE',
263 263
 						array(  'order_id' => $object['object_id'],
264
-							    'customer_first_name' => $first_name,
264
+								'customer_first_name' => $first_name,
265 265
 								'customer_last_name' => $last_name,
266 266
 								'order_date' => current_time('mysql', 0),
267 267
 								'order_content' => '',
Please login to merge, or discard this patch.
Spacing   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -1,132 +1,132 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 class wps_orders_in_back_office {
3 3
 
4 4
 	function __construct() {
5 5
 		// Template loading
6 6
 		$this->template_dir = WPS_ORDERS_PATH . WPS_ORDERS_DIR . "/templates/";
7
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes') );
7
+		add_action('add_meta_boxes', array($this, 'add_meta_boxes'));
8 8
 
9 9
 		// Ajax actions
10
-		add_action('wp_ajax_wpshop_add_private_comment_to_order', array( $this, 'wpshop_add_private_comment_to_order' ) );
11
-		add_action('wp_ajax_wps_order_refresh_product_listing', array( $this, 'refresh_product_list' ) );
12
-		add_action('wp_ajax_wps_add_product_to_order_admin', array( $this, 'wps_add_product_to_order_admin' ) );
13
-		add_action('wp_ajax_wps_refresh_cart_order', array( $this, 'refresh_cart_order' ) );
14
-		add_action('wp_ajax_wps_refresh_payments_order', array( $this, 'refresh_payments_order' ) );
15
-		add_action('wp_ajax_wps_update_product_qty_in_admin', array( $this, 'wps_update_product_qty_in_admin' ) );
16
-		add_action('wp_ajax_wps_order_load_product_variations', array( $this, 'wps_order_load_product_variations' ) );
17
-		add_action('wp_ajax_wps-orders-update-cart-informations', array( $this, 'wps_orders_update_cart_informations' ) );
18
-		add_action('wp_ajax_wps_reverify_payment_invoice_ref', array( $this, 'wps_reverify_payment_invoice_ref' ) );
10
+		add_action('wp_ajax_wpshop_add_private_comment_to_order', array($this, 'wpshop_add_private_comment_to_order'));
11
+		add_action('wp_ajax_wps_order_refresh_product_listing', array($this, 'refresh_product_list'));
12
+		add_action('wp_ajax_wps_add_product_to_order_admin', array($this, 'wps_add_product_to_order_admin'));
13
+		add_action('wp_ajax_wps_refresh_cart_order', array($this, 'refresh_cart_order'));
14
+		add_action('wp_ajax_wps_refresh_payments_order', array($this, 'refresh_payments_order'));
15
+		add_action('wp_ajax_wps_update_product_qty_in_admin', array($this, 'wps_update_product_qty_in_admin'));
16
+		add_action('wp_ajax_wps_order_load_product_variations', array($this, 'wps_order_load_product_variations'));
17
+		add_action('wp_ajax_wps-orders-update-cart-informations', array($this, 'wps_orders_update_cart_informations'));
18
+		add_action('wp_ajax_wps_reverify_payment_invoice_ref', array($this, 'wps_reverify_payment_invoice_ref'));
19 19
 
20 20
 		// WP General actions
21
-		add_action( 'admin_enqueue_scripts', array( $this, 'wps_orders_scripts') );
22
-		add_action( 'admin_enqueue_scripts', array( $this, 'wps_orders_scripts_texts' ), 20 );
23
-		add_action('save_post', array( $this, 'save_order_custom_informations'));
21
+		add_action('admin_enqueue_scripts', array($this, 'wps_orders_scripts'));
22
+		add_action('admin_enqueue_scripts', array($this, 'wps_orders_scripts_texts'), 20);
23
+		add_action('save_post', array($this, 'save_order_custom_informations'));
24 24
 
25 25
 		// WP Filters
26
-		add_filter( 'wps_order_saving_admin_extra_action', array( $this, 'wps_notif_user_on_order_saving'), 100, 2 );
26
+		add_filter('wps_order_saving_admin_extra_action', array($this, 'wps_notif_user_on_order_saving'), 100, 2);
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * Add scripts
31 31
 	 */
32 32
 	function wps_orders_scripts() {
33
-		wp_enqueue_script( 'wps_orders_backend', WPS_ORDERS_URL.WPS_ORDERS_DIR.'/assets/backend/js/wps_orders.js' );
33
+		wp_enqueue_script('wps_orders_backend', WPS_ORDERS_URL . WPS_ORDERS_DIR . '/assets/backend/js/wps_orders.js');
34 34
 	}
35 35
 
36 36
 	function wps_orders_scripts_texts() {
37
-		wp_localize_script( 'wps_orders_backend', 'message_confirm_reload', __( 'Are you sure you want to refresh your browser?', 'wpshop' ) );
38
-		wp_localize_script( 'wps_orders_backend', 'message_error_reverify_payment_invoice_ref', __( 'Error detected.', 'wpshop' ) );
37
+		wp_localize_script('wps_orders_backend', 'message_confirm_reload', __('Are you sure you want to refresh your browser?', 'wpshop'));
38
+		wp_localize_script('wps_orders_backend', 'message_error_reverify_payment_invoice_ref', __('Error detected.', 'wpshop'));
39 39
 	}
40 40
 	/**
41 41
 	 * Add meta boxes
42 42
 	 */
43 43
 	function add_meta_boxes() {
44 44
 		global $post;
45
-		$order_post_meta = get_post_meta( $post->ID, '_wpshop_order_status', true );
45
+		$order_post_meta = get_post_meta($post->ID, '_wpshop_order_status', true);
46 46
 
47 47
 		/** Box  Order Payments **/
48
-		add_meta_box('wpshop_order_payment', '<span class="dashicons dashicons-money"></span> '.__('Order payment', 'wpshop'),array($this, 'display_order_payments_box'),WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'low');
48
+		add_meta_box('wpshop_order_payment', '<span class="dashicons dashicons-money"></span> ' . __('Order payment', 'wpshop'), array($this, 'display_order_payments_box'), WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'low');
49 49
 		/**	Box for customer order comment */
50
-		add_meta_box('wpshop_order_customer_comment', '<span class="dashicons dashicons-format-status"></span> '.__('Order customer comment', 'wpshop'),array( $this, 'order_customer_comment_box'),WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'low');
50
+		add_meta_box('wpshop_order_customer_comment', '<span class="dashicons dashicons-format-status"></span> ' . __('Order customer comment', 'wpshop'), array($this, 'order_customer_comment_box'), WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'low');
51 51
 		/** Historic sales **/
52
-		add_meta_box('wpshop_product_order_historic', __('Sales informations', 'wpshop'), array( $this, 'meta_box_product_sale_informations'), WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'normal', 'low');
52
+		add_meta_box('wpshop_product_order_historic', __('Sales informations', 'wpshop'), array($this, 'meta_box_product_sale_informations'), WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'normal', 'low');
53 53
 		/**	Box with the complete order content	*/
54
-		if ( 'completed' != $order_post_meta && 'pos' != $order_post_meta ) :
55
-			add_meta_box('wpshop_product_list', '<span class="dashicons dashicons-archive"></span> ' . __('Product List', 'wpshop'),array($this, 'wps_products_listing_for_quotation'),WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'normal', 'low');
54
+		if ('completed' != $order_post_meta && 'pos' != $order_post_meta) :
55
+			add_meta_box('wpshop_product_list', '<span class="dashicons dashicons-archive"></span> ' . __('Product List', 'wpshop'), array($this, 'wps_products_listing_for_quotation'), WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'normal', 'low');
56 56
 		endif;
57 57
 		/**	Box with the complete order content	*/
58
-		add_meta_box( 'wpshop_order_content', '<span class="dashicons dashicons-cart"></span> '.__('Order content', 'wpshop'), array( $this, 'meta_box_order_content'), WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'normal', 'low');
58
+		add_meta_box('wpshop_order_content', '<span class="dashicons dashicons-cart"></span> ' . __('Order content', 'wpshop'), array($this, 'meta_box_order_content'), WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'normal', 'low');
59 59
 		/** Box Private order comments **/
60
-		add_meta_box('wpshop_order_private_comments', '<span class="dashicons dashicons-format-chat"></span> '.__('Comments', 'wpshop'), array( $this, 'meta_box_private_comment'), WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'normal', 'low');
60
+		add_meta_box('wpshop_order_private_comments', '<span class="dashicons dashicons-format-chat"></span> ' . __('Comments', 'wpshop'), array($this, 'meta_box_private_comment'), WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'normal', 'low');
61 61
 	}
62 62
 
63 63
 	/**
64 64
 	 * METABOX CONTENT - Display Customer comments on order in administration panel
65 65
 	 * @param object $order
66 66
 	 */
67
-	function order_customer_comment_box( $order ) {
67
+	function order_customer_comment_box($order) {
68 68
 		global $wpdb;
69 69
 		$output = '';
70
-		if ( !empty($order) && !empty($order->ID) ) {
71
-			$query = $wpdb->prepare('SELECT post_excerpt FROM ' .$wpdb->posts. ' WHERE ID = %d', $order->ID);
72
-			$comment = $wpdb->get_var( $query );
73
-			require_once( wpshop_tools::get_template_part( WPS_ORDERS_DIR, $this->template_dir, "backend", "customer_comment_on_order_box") );
70
+		if (!empty($order) && !empty($order->ID)) {
71
+			$query = $wpdb->prepare('SELECT post_excerpt FROM ' . $wpdb->posts . ' WHERE ID = %d', $order->ID);
72
+			$comment = $wpdb->get_var($query);
73
+			require_once(wpshop_tools::get_template_part(WPS_ORDERS_DIR, $this->template_dir, "backend", "customer_comment_on_order_box"));
74 74
 		}
75 75
 	}
76 76
 
77 77
 	/**
78 78
 	 * METABOX CONTENT - Display an order historic of product in administration product panel
79 79
 	 */
80
-	function meta_box_product_sale_informations () {
80
+	function meta_box_product_sale_informations() {
81 81
 		global $post;
82 82
 		$product_id = $post->ID;
83
-		$variations = wpshop_products::get_variation( $product_id );
84
-		$order_status = unserialize( WPSHOP_ORDER_STATUS );
85
-		$color_label = array( 'awaiting_payment' => 'jaune', 'canceled' => 'rouge', 'partially_paid' => 'orange', 'incorrect_amount' => 'orange', 'denied' => 'rouge', 'shipped' => 'bleu', 'payment_refused' => 'rouge', 'completed' => 'vert', 'refunded' => 'rouge', 'pos' => 'bleu');
83
+		$variations = wpshop_products::get_variation($product_id);
84
+		$order_status = unserialize(WPSHOP_ORDER_STATUS);
85
+		$color_label = array('awaiting_payment' => 'jaune', 'canceled' => 'rouge', 'partially_paid' => 'orange', 'incorrect_amount' => 'orange', 'denied' => 'rouge', 'shipped' => 'bleu', 'payment_refused' => 'rouge', 'completed' => 'vert', 'refunded' => 'rouge', 'pos' => 'bleu');
86 86
 		// Get datas
87 87
 		$sales_informations = array();
88 88
 		/** Query **/
89
-		$data_to_compare = '"item_id";s:' .strlen($product_id). ':"' .$product_id. '";';
90
-		$query_args = array( 'posts_per_page' => -1, 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'meta_query' => array( array('key' => '_order_postmeta', 'value' => $data_to_compare, 'compare' => 'LIKE') ) );
91
-		$orders = new WP_Query( $query_args );
92
-		if ( !empty($orders) && !empty($orders->posts) ) {
93
-			foreach( $orders->posts as $order ) {
94
-				$order_meta = get_post_meta( $order->ID, '_order_postmeta', true );
95
-				$order_info = get_post_meta( $order->ID, '_order_info', true );
89
+		$data_to_compare = '"item_id";s:' . strlen($product_id) . ':"' . $product_id . '";';
90
+		$query_args = array('posts_per_page' => -1, 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'meta_query' => array(array('key' => '_order_postmeta', 'value' => $data_to_compare, 'compare' => 'LIKE')));
91
+		$orders = new WP_Query($query_args);
92
+		if (!empty($orders) && !empty($orders->posts)) {
93
+			foreach ($orders->posts as $order) {
94
+				$order_meta = get_post_meta($order->ID, '_order_postmeta', true);
95
+				$order_info = get_post_meta($order->ID, '_order_info', true);
96 96
 				$sales_informations[] = array(
97
-						'order_key' => ( !empty($order_meta) && !empty($order_meta['order_key']) ) ? $order_meta['order_key'] : '',
98
-						'order_date' => ( !empty($order_meta) && !empty($order_meta['order_date']) ) ? $order_meta['order_date'] : '',
99
-						'customer_firstname' => ( !empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']) && !empty($order_info['billing']['address']['address_first_name']) ) ? $order_info['billing']['address']['address_first_name'] : '',
100
-						'customer_name' => ( !empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']) && !empty($order_info['billing']['address']['address_last_name']) ) ? $order_info['billing']['address']['address_last_name'] : '',
101
-						'customer_email' => ( !empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']) && !empty($order_info['billing']['address']['address_user_email']) ) ? $order_info['billing']['address']['address_user_email'] : '',
97
+						'order_key' => (!empty($order_meta) && !empty($order_meta['order_key'])) ? $order_meta['order_key'] : '',
98
+						'order_date' => (!empty($order_meta) && !empty($order_meta['order_date'])) ? $order_meta['order_date'] : '',
99
+						'customer_firstname' => (!empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']) && !empty($order_info['billing']['address']['address_first_name'])) ? $order_info['billing']['address']['address_first_name'] : '',
100
+						'customer_name' => (!empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']) && !empty($order_info['billing']['address']['address_last_name'])) ? $order_info['billing']['address']['address_last_name'] : '',
101
+						'customer_email' => (!empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']) && !empty($order_info['billing']['address']['address_user_email'])) ? $order_info['billing']['address']['address_user_email'] : '',
102 102
 						'order_id' => $order->ID,
103 103
 						'order_status' => $order_meta['order_status']
104 104
 				);
105 105
 			}
106 106
 		}
107 107
 		// Display results
108
-		require_once( wpshop_tools::get_template_part( WPS_ORDERS_DIR, $this->template_dir, "backend", "product_order_historic") );
108
+		require_once(wpshop_tools::get_template_part(WPS_ORDERS_DIR, $this->template_dir, "backend", "product_order_historic"));
109 109
 	}
110 110
 
111 111
 	/**
112 112
 	 * METABOX CONTENT - Payments Box in Orders panel
113 113
 	 * @param string $order
114 114
 	 */
115
-	function display_order_payments_box( $order ) {
115
+	function display_order_payments_box($order) {
116 116
 		$order_status = unserialize(WPSHOP_ORDER_STATUS);
117 117
 		$order_postmeta = get_post_meta($order->ID, '_order_postmeta', true);
118
-		require( wpshop_tools::get_template_part( WPS_ORDERS_DIR, $this->template_dir, "backend", "wps_order_payment_box") );
118
+		require(wpshop_tools::get_template_part(WPS_ORDERS_DIR, $this->template_dir, "backend", "wps_order_payment_box"));
119 119
 	}
120 120
 
121 121
 	/**
122 122
 	 * METABOX CONTENT - Display an lsiting of products to make quotation in backend
123 123
 	 */
124 124
 	function wps_products_listing_for_quotation($post) {
125
-		$letters = array( 'ALL', 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
126
-		$current_letter = sanitize_title( $letters[1] );
125
+		$letters = array('ALL', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
126
+		$current_letter = sanitize_title($letters[1]);
127 127
 		$wps_product_mdl = new wps_product_mdl();
128
-		$products = $wps_product_mdl->get_products_by_letter( $current_letter );
129
-		require( wpshop_tools::get_template_part( WPS_ORDERS_DIR, $this->template_dir, "backend", "product-listing/wps_orders_product_listing") );
128
+		$products = $wps_product_mdl->get_products_by_letter($current_letter);
129
+		require(wpshop_tools::get_template_part(WPS_ORDERS_DIR, $this->template_dir, "backend", "product-listing/wps_orders_product_listing"));
130 130
 	}
131 131
 
132 132
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	function meta_box_private_comment() {
136 136
 		global $post;
137
-		require( wpshop_tools::get_template_part( WPS_ORDERS_DIR, $this->template_dir, "backend", "order-private-comments/wps_orders_private_comments") );
137
+		require(wpshop_tools::get_template_part(WPS_ORDERS_DIR, $this->template_dir, "backend", "order-private-comments/wps_orders_private_comments"));
138 138
 	}
139 139
 
140 140
 	/**
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	function meta_box_order_content() {
144 144
 		global $post_id;
145
-		unset( $_SESSION['cart'] );
146
-		echo do_shortcode( '[wps_cart oid="' .$post_id. '" cart_type="admin-panel"]');
145
+		unset($_SESSION['cart']);
146
+		echo do_shortcode('[wps_cart oid="' . $post_id . '" cart_type="admin-panel"]');
147 147
 	}
148 148
 
149 149
 
@@ -153,68 +153,68 @@  discard block
 block discarded – undo
153 153
 	function save_order_custom_informations() {
154 154
 		global $wpdb;
155 155
 
156
-		$post_ID = !empty( $_REQUEST['post_ID'] ) ? (int) $_REQUEST['post_ID'] : 0;
156
+		$post_ID = !empty($_REQUEST['post_ID']) ? (int)$_REQUEST['post_ID'] : 0;
157 157
 		// Check if it is an order save action
158
-		if ( !empty($post_ID) && ( get_post_type($post_ID) == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) ) {
158
+		if (!empty($post_ID) && (get_post_type($post_ID) == WPSHOP_NEWTYPE_IDENTIFIER_ORDER)) {
159 159
 			//Define Customer ID
160
-			$user_id = ( !empty( $_REQUEST['wps_customer_id'] ) ) ? (int) $_REQUEST['wps_customer_id'] : get_current_user_id();
160
+			$user_id = (!empty($_REQUEST['wps_customer_id'])) ? (int)$_REQUEST['wps_customer_id'] : get_current_user_id();
161 161
 
162 162
 			// Order MetaData
163
-			$order_meta = get_post_meta( $post_ID, '_order_postmeta', true);
163
+			$order_meta = get_post_meta($post_ID, '_order_postmeta', true);
164 164
 
165 165
 			// Save General information of order's attached customer
166
-			$wpdb->update( $wpdb->posts, array('post_parent' => $user_id, 'post_status' => 'publish'),  array('ID' => $post_ID) );
167
-			update_post_meta( $post_ID, '_wpshop_order_customer_id', $user_id );
166
+			$wpdb->update($wpdb->posts, array('post_parent' => $user_id, 'post_status' => 'publish'), array('ID' => $post_ID));
167
+			update_post_meta($post_ID, '_wpshop_order_customer_id', $user_id);
168 168
 			$order_meta['customer_id'] = $user_id;
169
-			if ( empty($order_meta['order_key']) ) {
170
-				$order_meta['order_key'] = !empty($order_meta['order_key']) ? $order_meta['order_key'] : (!empty($order_meta['order_status']) && ($order_meta['order_status']!='awaiting_payment') ? wpshop_orders::get_new_order_reference() : '');
169
+			if (empty($order_meta['order_key'])) {
170
+				$order_meta['order_key'] = !empty($order_meta['order_key']) ? $order_meta['order_key'] : (!empty($order_meta['order_status']) && ($order_meta['order_status'] != 'awaiting_payment') ? wpshop_orders::get_new_order_reference() : '');
171 171
 				$order_meta['order_temporary_key'] = (isset($order_meta['order_temporary_key']) && ($order_meta['order_temporary_key'] != '')) ? $order_meta['order_temporary_key'] : wpshop_orders::get_new_pre_order_reference();
172 172
 			}
173 173
 			$order_meta['order_status'] = (isset($order_meta['order_status']) && ($order_meta['order_status'] != '')) ? $order_meta['order_status'] : 'awaiting_payment';
174 174
 			$order_meta['order_date'] = (isset($order_meta['order_date']) && ($order_meta['order_date'] != '')) ? $order_meta['order_date'] : current_time('mysql', 0);
175 175
 			$order_meta['order_currency'] = wpshop_tools::wpshop_get_currency(true);
176 176
 
177
-			$billing_adress_id = ( !empty( $_REQUEST['wps_order_selected_address'] ) && empty( $_REQUEST['wps_order_selected_address']['billing'] ) ) ? (int) $_REQUEST['wps_order_selected_address']['billing'] : 0;
177
+			$billing_adress_id = (!empty($_REQUEST['wps_order_selected_address']) && empty($_REQUEST['wps_order_selected_address']['billing'])) ? (int)$_REQUEST['wps_order_selected_address']['billing'] : 0;
178 178
 
179 179
 			// Order Attached Addresses save
180
-			if( !empty( $billing_adress_id ) ) {
180
+			if (!empty($billing_adress_id)) {
181 181
 				// Informations
182
-				$order_informations = get_post_meta( $post_ID, '_order_info', true );
183
-				$order_informations = ( !empty($order_informations) ) ? $order_informations : array();
184
-				$billing_address_option = get_option( 'wpshop_billing_address' );
185
-				$billing_address_option = ( !empty($billing_address_option) && !empty( $billing_address_option['choice'] ) ) ? $billing_address_option['choice'] : '';
182
+				$order_informations = get_post_meta($post_ID, '_order_info', true);
183
+				$order_informations = (!empty($order_informations)) ? $order_informations : array();
184
+				$billing_address_option = get_option('wpshop_billing_address');
185
+				$billing_address_option = (!empty($billing_address_option) && !empty($billing_address_option['choice'])) ? $billing_address_option['choice'] : '';
186 186
 
187 187
 				// Billing datas
188
-				$order_informations['billing'] = array( 'id' => $billing_address_option,
188
+				$order_informations['billing'] = array('id' => $billing_address_option,
189 189
 						'address_id' => $billing_adress_id,
190
-						'address' => get_post_meta( $billing_adress_id, '_wpshop_address_metadata', true )
190
+						'address' => get_post_meta($billing_adress_id, '_wpshop_address_metadata', true)
191 191
 				);
192 192
 				// Shipping datas
193
-				$shipping_adress_id = ( !empty( $_REQUEST['wps_order_selected_address'] ) && empty( $_REQUEST['wps_order_selected_address']['shipping'] ) ) ? (int) $_REQUEST['wps_order_selected_address']['shipping'] : 0;
193
+				$shipping_adress_id = (!empty($_REQUEST['wps_order_selected_address']) && empty($_REQUEST['wps_order_selected_address']['shipping'])) ? (int)$_REQUEST['wps_order_selected_address']['shipping'] : 0;
194 194
 
195
-				if( !empty( $shipping_adress_id ) ) {
196
-					$shipping_address_option = get_option( 'wpshop_shipping_address_choice' );
197
-					$shipping_address_option = ( !empty($shipping_address_option) && !empty($shipping_address_option['choice']) ) ? $shipping_address_option['choice'] : '';
198
-					$order_informations['shipping'] = array( 'id' => $shipping_address_option,
195
+				if (!empty($shipping_adress_id)) {
196
+					$shipping_address_option = get_option('wpshop_shipping_address_choice');
197
+					$shipping_address_option = (!empty($shipping_address_option) && !empty($shipping_address_option['choice'])) ? $shipping_address_option['choice'] : '';
198
+					$order_informations['shipping'] = array('id' => $shipping_address_option,
199 199
 							'address_id' => $shipping_adress_id,
200
-							'address' => get_post_meta( $shipping_adress_id, '_wpshop_address_metadata', true )
200
+							'address' => get_post_meta($shipping_adress_id, '_wpshop_address_metadata', true)
201 201
 					);
202 202
 				}
203
-				update_post_meta( $post_ID, '_order_info', $order_informations );
203
+				update_post_meta($post_ID, '_order_info', $order_informations);
204 204
 			}
205 205
 
206
-			$wpshop_admin_order_payment_received = !empty( $_REQUEST['wpshop_admin_order_payment_received'] ) ? (array)$_REQUEST['wpshop_admin_order_payment_received'] : array();
207
-			$wpshop_admin_order_payment_received['method'] = !empty( $wpshop_admin_order_payment_received['method'] ) ? sanitize_text_field( $wpshop_admin_order_payment_received['method'] ) : '';
208
-			$wpshop_admin_order_payment_received['payment_reference'] = !empty( $wpshop_admin_order_payment_received['payment_reference'] ) ? sanitize_text_field( $wpshop_admin_order_payment_received['payment_reference'] ) : '';
209
-			$wpshop_admin_order_payment_received['date'] = !empty( $wpshop_admin_order_payment_received['date'] ) ? sanitize_text_field( $wpshop_admin_order_payment_received['date'] ) : '';
210
-			$wpshop_admin_order_payment_received['received_amount'] = !empty( $wpshop_admin_order_payment_received['received_amount'] ) ? sanitize_text_field( $wpshop_admin_order_payment_received['received_amount'] ) : '';
211
-			$action_triggered_from = !empty( $_REQUEST['action_triggered_from'] ) ? sanitize_text_field( $action_triggered_from ) : '';
212
-			$whsop_admin_order_payment_reference = !empty( $_REQUEST['wpshop_admin_order_payment_reference'] ) ? sanitize_text_field( $_REQUEST['wpshop_admin_order_payment_reference'] ) : '';
206
+			$wpshop_admin_order_payment_received = !empty($_REQUEST['wpshop_admin_order_payment_received']) ? (array)$_REQUEST['wpshop_admin_order_payment_received'] : array();
207
+			$wpshop_admin_order_payment_received['method'] = !empty($wpshop_admin_order_payment_received['method']) ? sanitize_text_field($wpshop_admin_order_payment_received['method']) : '';
208
+			$wpshop_admin_order_payment_received['payment_reference'] = !empty($wpshop_admin_order_payment_received['payment_reference']) ? sanitize_text_field($wpshop_admin_order_payment_received['payment_reference']) : '';
209
+			$wpshop_admin_order_payment_received['date'] = !empty($wpshop_admin_order_payment_received['date']) ? sanitize_text_field($wpshop_admin_order_payment_received['date']) : '';
210
+			$wpshop_admin_order_payment_received['received_amount'] = !empty($wpshop_admin_order_payment_received['received_amount']) ? sanitize_text_field($wpshop_admin_order_payment_received['received_amount']) : '';
211
+			$action_triggered_from = !empty($_REQUEST['action_triggered_from']) ? sanitize_text_field($action_triggered_from) : '';
212
+			$whsop_admin_order_payment_reference = !empty($_REQUEST['wpshop_admin_order_payment_reference']) ? sanitize_text_field($_REQUEST['wpshop_admin_order_payment_reference']) : '';
213 213
 
214 214
 			// Add a Payment to Order MetaData
215
-			if ( !empty($wpshop_admin_order_payment_received['wpshop_admin_order_payment_received']) && !empty($wpshop_admin_order_payment_received['wpshop_admin_order_payment_received']['method'])
215
+			if (!empty($wpshop_admin_order_payment_received['wpshop_admin_order_payment_received']) && !empty($wpshop_admin_order_payment_received['wpshop_admin_order_payment_received']['method'])
216 216
 					&& !empty($wpshop_admin_order_payment_received['wpshop_admin_order_payment_received']['date']) && !empty($wpshop_admin_order_payment_received['wpshop_admin_order_payment_received']['received_amount']) &&
217
-					( $action_triggered_from == 'add_payment' || !empty($whsop_admin_order_payment_reference) ) ) {
217
+					($action_triggered_from == 'add_payment' || !empty($whsop_admin_order_payment_reference))) {
218 218
 
219 219
 				$received_payment_amount = $wpshop_admin_order_payment_received['received_amount'];
220 220
 				// Payment Params
@@ -227,34 +227,34 @@  discard block
 block discarded – undo
227 227
 						'date' 				=> current_time('mysql', 0),
228 228
 						'received_amount' 	=> $received_payment_amount
229 229
 				);
230
-				$order_meta = wpshop_payment::check_order_payment_total_amount($post_ID, $params_array, 'completed', $order_meta, false );
230
+				$order_meta = wpshop_payment::check_order_payment_total_amount($post_ID, $params_array, 'completed', $order_meta, false);
231 231
 			}
232 232
 
233 233
 			//Round final amount
234
-			$order_meta['order_grand_total'] = number_format( round($order_meta['order_grand_total'], 2), 2, '.', '');
235
-			$order_meta['order_total_ttc'] = number_format( round($order_meta['order_total_ttc'], 2), 2, '.', '');
236
-			$order_meta['order_amount_to_pay_now'] = number_format( round($order_meta['order_amount_to_pay_now'], 2), 2, '.', '');
234
+			$order_meta['order_grand_total'] = number_format(round($order_meta['order_grand_total'], 2), 2, '.', '');
235
+			$order_meta['order_total_ttc'] = number_format(round($order_meta['order_total_ttc'], 2), 2, '.', '');
236
+			$order_meta['order_amount_to_pay_now'] = number_format(round($order_meta['order_amount_to_pay_now'], 2), 2, '.', '');
237 237
 
238 238
 			// Payment Pre-Fill
239
-			if ( empty( $order_meta['order_payment'] ) ) {
239
+			if (empty($order_meta['order_payment'])) {
240 240
 				$order_meta['order_payment']['customer_choice']['method'] = '';
241
-				$order_meta['order_payment']['received'][] = array('waited_amount' => ( !empty($order_meta) && !empty($order_meta['order_grand_total']) ) ? number_format($order_meta['order_grand_total'],2,'.', '') : 0 );
241
+				$order_meta['order_payment']['received'][] = array('waited_amount' => (!empty($order_meta) && !empty($order_meta['order_grand_total'])) ? number_format($order_meta['order_grand_total'], 2, '.', '') : 0);
242 242
 			}
243 243
 
244
-			$data['post_ID'] = !empty( $_REQUEST['post_ID'] ) ? (int) $_REQUEST['post_ID'] : 0;
245
-			$data['markascanceled_order_hidden_indicator'] = !empty( $_REQUEST['markascanceled_order_hidden_indicator' ] ) ? sanitize_text_field( $_REQUEST['markascanceled_order_hidden_indicator'] ) : '';
246
-			$data['resendordertocustomer_order_hidden_indicator'] = !empty( $_REQUEST['resendordertocustomer_order_hidden_indicator' ] ) ? sanitize_text_field( $_REQUEST['resendordertocustomer_order_hidden_indicator'] ) : '';
247
-			$data['action_triggered_from'] = !empty( $_REQUEST['action_triggered_from' ] ) ? sanitize_text_field( $_REQUEST['action_triggered_from'] ) : '';
248
-			$data['notif_the_customer'] = !empty( $_REQUEST['notif_the_customer' ] ) ? sanitize_text_field( $_REQUEST['notif_the_customer'] ) : '';
244
+			$data['post_ID'] = !empty($_REQUEST['post_ID']) ? (int)$_REQUEST['post_ID'] : 0;
245
+			$data['markascanceled_order_hidden_indicator'] = !empty($_REQUEST['markascanceled_order_hidden_indicator']) ? sanitize_text_field($_REQUEST['markascanceled_order_hidden_indicator']) : '';
246
+			$data['resendordertocustomer_order_hidden_indicator'] = !empty($_REQUEST['resendordertocustomer_order_hidden_indicator']) ? sanitize_text_field($_REQUEST['resendordertocustomer_order_hidden_indicator']) : '';
247
+			$data['action_triggered_from'] = !empty($_REQUEST['action_triggered_from']) ? sanitize_text_field($_REQUEST['action_triggered_from']) : '';
248
+			$data['notif_the_customer'] = !empty($_REQUEST['notif_the_customer']) ? sanitize_text_field($_REQUEST['notif_the_customer']) : '';
249 249
 			// Apply a filter to make credit, notificate the customer and generate billing actions
250
-			$order_meta = apply_filters( 'wps_order_saving_admin_extra_action', $order_meta, $data );
250
+			$order_meta = apply_filters('wps_order_saving_admin_extra_action', $order_meta, $data);
251 251
 
252 252
 			// Save Shipping informations & Order status
253
-			update_post_meta( $post_ID, '_wpshop_order_shipping_date', $order_meta['order_shipping_date']);
254
-			update_post_meta( $post_ID, '_wpshop_order_status', $order_meta['order_status']);
253
+			update_post_meta($post_ID, '_wpshop_order_shipping_date', $order_meta['order_shipping_date']);
254
+			update_post_meta($post_ID, '_wpshop_order_status', $order_meta['order_status']);
255 255
 
256 256
 			// Save Metadata
257
-			update_post_meta( $post_ID, '_order_postmeta', $order_meta);
257
+			update_post_meta($post_ID, '_order_postmeta', $order_meta);
258 258
 		}
259 259
 	}
260 260
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 	 * @param array $posted_datas
265 265
 	 * @return array
266 266
 	 */
267
-	function wps_notif_user_on_order_saving( $order_metadata, $posted_datas ) {
268
-		if( !empty($posted_datas['notif_the_customer']) && $posted_datas['notif_the_customer']=='on' ) {
267
+	function wps_notif_user_on_order_saving($order_metadata, $posted_datas) {
268
+		if (!empty($posted_datas['notif_the_customer']) && $posted_datas['notif_the_customer'] == 'on') {
269 269
 			$wps_message = new wps_message_ctr();
270 270
 			/*	Get order current content	*/
271 271
 			$user = get_post_meta($posted_datas['post_ID'], '_order_info', true);
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 			$first_name = $user['billing']['address']['address_first_name'];
275 275
 			$last_name = $user['billing']['address']['address_last_name'];
276 276
 
277
-			$object = array('object_type'=>'order','object_id'=>(int)$_REQUEST['post_ID']);
277
+			$object = array('object_type'=>'order', 'object_id'=>(int)$_REQUEST['post_ID']);
278 278
 			/* Envoie du message de confirmation de commande au client	*/
279
-			if ( empty( $order_metadata['order_key'] ) ) {
279
+			if (empty($order_metadata['order_key'])) {
280 280
 				$wps_message->wpshop_prepared_email($email,
281 281
 						'WPSHOP_QUOTATION_UPDATE_MESSAGE',
282
-						array(  'order_id' => $object['object_id'],
282
+						array('order_id' => $object['object_id'],
283 283
 							    'customer_first_name' => $first_name,
284 284
 								'customer_last_name' => $last_name,
285 285
 								'order_date' => current_time('mysql', 0),
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 				$wps_message->wpshop_prepared_email(
295 295
 						$email,
296 296
 						'WPSHOP_ORDER_UPDATE_MESSAGE',
297
-						array(  'customer_first_name' => $first_name,
297
+						array('customer_first_name' => $first_name,
298 298
 								'customer_last_name' => $last_name,
299 299
 								'order_key' => $order_metadata['order_key'],
300 300
 								'order_billing_address' => '',
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 								'order_addresses' => '',
303 303
 								'order_addresses' => '',
304 304
 								'order_billing_address' => '',
305
-								'order_shipping_address' => '' ),
305
+								'order_shipping_address' => ''),
306 306
 						$object);
307 307
 			}
308 308
 		}
@@ -313,25 +313,25 @@  discard block
 block discarded – undo
313 313
 	 * AJAX - Add a private comment to order
314 314
 	 */
315 315
 	function wpshop_add_private_comment_to_order() {
316
-		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
316
+		$_wponce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : '';
317 317
 
318
-		if ( !wp_verify_nonce( $_wpnonce, 'wpshop_add_private_comment_to_order' ) )
318
+		if (!wp_verify_nonce($_wpnonce, 'wpshop_add_private_comment_to_order'))
319 319
 			wp_die();
320 320
 
321 321
 		$status = false; $result = '';
322
-		$order_id = ( !empty($_POST['oid']) ) ? intval($_POST['oid']) : null;
323
-		$comment = ( !empty($_POST['comment']) ) ? wpshop_tools::varSanitizer($_POST['comment']) : null;
324
-		$send_email = ( !empty($_POST['send_email']) ) ? wpshop_tools::varSanitizer($_POST['send_email']) : null;
325
-		$copy_to_administrator = ( !empty($_POST['copy_to_administrator']) ) ? wpshop_tools::varSanitizer($_POST['copy_to_administrator']) : null;
322
+		$order_id = (!empty($_POST['oid'])) ? intval($_POST['oid']) : null;
323
+		$comment = (!empty($_POST['comment'])) ? wpshop_tools::varSanitizer($_POST['comment']) : null;
324
+		$send_email = (!empty($_POST['send_email'])) ? wpshop_tools::varSanitizer($_POST['send_email']) : null;
325
+		$copy_to_administrator = (!empty($_POST['copy_to_administrator'])) ? wpshop_tools::varSanitizer($_POST['copy_to_administrator']) : null;
326 326
 
327
-		if ( !empty($comment) && !empty($order_id) ) {
327
+		if (!empty($comment) && !empty($order_id)) {
328 328
 			$wps_back_office_orders_mdl = new wps_back_office_orders_mdl();
329
-			$new_comment = $wps_back_office_orders_mdl->add_private_comment($order_id, $comment, $send_email, false, $copy_to_administrator );
330
-			if($new_comment) {
331
-				$order_private_comment = get_post_meta( $order_id, '_order_private_comments', true );
329
+			$new_comment = $wps_back_office_orders_mdl->add_private_comment($order_id, $comment, $send_email, false, $copy_to_administrator);
330
+			if ($new_comment) {
331
+				$order_private_comment = get_post_meta($order_id, '_order_private_comments', true);
332 332
 				$oid = $order_id;
333 333
 				ob_start();
334
-				require( wpshop_tools::get_template_part( WPS_ORDERS_DIR, $this->template_dir, "backend", "order-private-comments/wps_orders_sended_private_comments") );
334
+				require(wpshop_tools::get_template_part(WPS_ORDERS_DIR, $this->template_dir, "backend", "order-private-comments/wps_orders_sended_private_comments"));
335 335
 				$result = ob_get_contents();
336 336
 				ob_end_clean();
337 337
 				$status = true;
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 			$result = __('An error was occured', 'wpshop');
342 342
 		}
343 343
 
344
-		$response = array( 'status' => $status, 'response' => $result );
345
-		echo json_encode( $response );
344
+		$response = array('status' => $status, 'response' => $result);
345
+		echo json_encode($response);
346 346
 		wp_die();
347 347
 	}
348 348
 
@@ -350,29 +350,29 @@  discard block
 block discarded – undo
350 350
 	 * AJAX - Refresh product listing in order back-office
351 351
 	 */
352 352
 	function refresh_product_list() {
353
-		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
353
+		$_wponce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : '';
354 354
 
355
-		if ( !wp_verify_nonce( $_wpnonce, 'refresh_product_list' ) )
355
+		if (!wp_verify_nonce($_wpnonce, 'refresh_product_list'))
356 356
 			wp_die();
357 357
 
358 358
 		$status = false; $response = '';
359
-		$letter = ( !empty($_POST['letter']) ) ? sanitize_title( $_POST['letter'] ) : '';
360
-		$oid = !empty( $_POST['oid'] ) ? (int) $_POST['oid'] : 0;
359
+		$letter = (!empty($_POST['letter'])) ? sanitize_title($_POST['letter']) : '';
360
+		$oid = !empty($_POST['oid']) ? (int)$_POST['oid'] : 0;
361 361
 
362
-		if( !empty($oid) ) {
363
-			$post = get_post( $oid );
362
+		if (!empty($oid)) {
363
+			$post = get_post($oid);
364 364
 		}
365
-		if( !empty($letter) ) {
365
+		if (!empty($letter)) {
366 366
 			$current_letter = $letter;
367 367
 			$wps_product_mdl = new wps_product_mdl();
368
-			$products = $wps_product_mdl->get_products_by_letter( $letter );
368
+			$products = $wps_product_mdl->get_products_by_letter($letter);
369 369
 			ob_start();
370
-			require( wpshop_tools::get_template_part( WPS_ORDERS_DIR, $this->template_dir, "backend", "product-listing/wps_orders_product_listing_table") );
370
+			require(wpshop_tools::get_template_part(WPS_ORDERS_DIR, $this->template_dir, "backend", "product-listing/wps_orders_product_listing_table"));
371 371
 			$response = ob_get_contents();
372 372
 			ob_end_clean();
373 373
 			$status = true;
374 374
 		}
375
-		echo json_encode( array( 'status' => $status, 'response' => $response ) );
375
+		echo json_encode(array('status' => $status, 'response' => $response));
376 376
 		wp_die();
377 377
 	}
378 378
 
@@ -380,41 +380,41 @@  discard block
 block discarded – undo
380 380
 	 * AJAX - Add product to order in back-office panel
381 381
 	 */
382 382
 	function wps_add_product_to_order_admin() {
383
-		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
383
+		$_wponce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : '';
384 384
 
385
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_add_product_to_order_admin' ) )
385
+		if (!wp_verify_nonce($_wpnonce, 'wps_add_product_to_order_admin'))
386 386
 			wp_die();
387 387
 
388 388
 		$status = false; $response = ''; $product_have_variations = false;
389 389
 		// Sended vars
390
-		$product_id = ( !empty($_POST['pid']) ) ? intval( $_POST['pid']) : null;
391
-		$order_id = ( !empty($_POST['oid']) ) ? intval( $_POST['oid']) : null;
392
-		$product_qty = ( !empty($_POST['qty']) ) ? intval( $_POST['qty']) : 1;
390
+		$product_id = (!empty($_POST['pid'])) ? intval($_POST['pid']) : null;
391
+		$order_id = (!empty($_POST['oid'])) ? intval($_POST['oid']) : null;
392
+		$product_qty = (!empty($_POST['qty'])) ? intval($_POST['qty']) : 1;
393 393
 
394
-		if( !empty($order_id) && !empty($product_id) ) {
394
+		if (!empty($order_id) && !empty($product_id)) {
395 395
 			$wps_orders = new wps_orders_ctr();
396 396
 			$product_datas = wpshop_products::get_product_data($product_id, false, '"publish", "free_product"');
397 397
 			// Check if product have variations
398
-			$have_variations_checking = wpshop_products::get_variation( $product_id );
399
-			if( !empty($have_variations_checking) ) {
398
+			$have_variations_checking = wpshop_products::get_variation($product_id);
399
+			if (!empty($have_variations_checking)) {
400 400
 				$product_have_variations = true;
401 401
 			}
402 402
 			else {
403 403
 				// Get Metadatas
404
-				$order_metadata = get_post_meta( $order_id, '_order_postmeta', true );
404
+				$order_metadata = get_post_meta($order_id, '_order_postmeta', true);
405 405
 				// Calcul cart informations
406 406
 				$wps_cart = new wps_cart();
407
-				$order_metadata = $wps_cart->calcul_cart_information( array( $product_id => array( 'product_id' => $product_id, 'product_qty' => $product_qty ) ), '', $order_metadata, true, false );
407
+				$order_metadata = $wps_cart->calcul_cart_information(array($product_id => array('product_id' => $product_id, 'product_qty' => $product_qty)), '', $order_metadata, true, false);
408 408
 				// Update Metadatas
409
-				update_post_meta( $order_id, '_order_postmeta', $order_metadata );
409
+				update_post_meta($order_id, '_order_postmeta', $order_metadata);
410 410
 				$status = true;
411 411
 			}
412 412
 			$status = true;
413 413
 		}
414 414
 
415
-		$_wpnonce = wp_create_nonce( 'wps_order_load_product_variations' );
415
+		$_wpnonce = wp_create_nonce('wps_order_load_product_variations');
416 416
 
417
-		echo json_encode( array( '_wpnonce' => $_wpnonce, 'status' => $status, 'response' => $response, 'variations_exist' => $product_have_variations ) );
417
+		echo json_encode(array('_wpnonce' => $_wpnonce, 'status' => $status, 'response' => $response, 'variations_exist' => $product_have_variations));
418 418
 		wp_die();
419 419
 	}
420 420
 
@@ -422,18 +422,18 @@  discard block
 block discarded – undo
422 422
 	 * AJAX - Refresh cart in administration
423 423
 	 */
424 424
 	function refresh_cart_order() {
425
-		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
425
+		$_wponce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : '';
426 426
 
427
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_pos_order_content' ) )
427
+		if (!wp_verify_nonce($_wpnonce, 'wps_pos_order_content'))
428 428
 			wp_die();
429 429
 
430 430
 		$status = false; $response = '';
431
-		$order_id = ( !empty($_POST['order_id']) ) ? intval($_POST['order_id']) : null;
432
-		if( !empty($order_id) ) {
433
-			$response = do_shortcode( '[wps_cart oid="' .$order_id. '" cart_type="admin-panel"]');
431
+		$order_id = (!empty($_POST['order_id'])) ? intval($_POST['order_id']) : null;
432
+		if (!empty($order_id)) {
433
+			$response = do_shortcode('[wps_cart oid="' . $order_id . '" cart_type="admin-panel"]');
434 434
 			$status = true;
435 435
 		}
436
-		echo json_encode( array( 'status' => $status, 'response' => $response ) );
436
+		echo json_encode(array('status' => $status, 'response' => $response));
437 437
 		wp_die();
438 438
 	}
439 439
 
@@ -441,21 +441,21 @@  discard block
 block discarded – undo
441 441
 	 * AJAX - Refresh cart in administration
442 442
 	 */
443 443
 	function refresh_payments_order() {
444
-		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
444
+		$_wponce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : '';
445 445
 
446
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_pos_order_content' ) )
446
+		if (!wp_verify_nonce($_wpnonce, 'wps_pos_order_content'))
447 447
 			wp_die();
448 448
 
449 449
 		$status = false; $response = '';
450
-		$order_id = ( !empty($_POST['order_id']) ) ? intval($_POST['order_id']) : null;
451
-		if( !empty($order_id) ) {
450
+		$order_id = (!empty($_POST['order_id'])) ? intval($_POST['order_id']) : null;
451
+		if (!empty($order_id)) {
452 452
 			ob_start();
453
-			echo $this->display_order_payments_box( get_post( $order_id ) );
453
+			echo $this->display_order_payments_box(get_post($order_id));
454 454
 			$response = ob_get_contents();
455 455
 			ob_end_clean();
456 456
 			$status = true;
457 457
 		}
458
-		echo json_encode( array( 'status' => $status, 'response' => $response ) );
458
+		echo json_encode(array('status' => $status, 'response' => $response));
459 459
 		wp_die();
460 460
 	}
461 461
 
@@ -463,28 +463,28 @@  discard block
 block discarded – undo
463 463
 	 * AJAX - Update product Quantity in Back-office Panel
464 464
 	 */
465 465
 	function wps_update_product_qty_in_admin() {
466
-		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
466
+		$_wponce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : '';
467 467
 
468
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_pos_order_content' ) )
468
+		if (!wp_verify_nonce($_wpnonce, 'wps_pos_order_content'))
469 469
 			wp_die();
470 470
 
471 471
 		$status = false; $response = '';
472
-		$product_id = ( !empty($_POST['product_id']) ) ? wpshop_tools::varSanitizer( $_POST['product_id'] ) : null;
473
-		$order_id = ( !empty($_POST['order_id']) ) ? intval( $_POST['order_id'] ) : null;
474
-		$product_qty = ( !empty($_POST['qty']) ) ? intval( $_POST['qty'] ) : 0;
472
+		$product_id = (!empty($_POST['product_id'])) ? wpshop_tools::varSanitizer($_POST['product_id']) : null;
473
+		$order_id = (!empty($_POST['order_id'])) ? intval($_POST['order_id']) : null;
474
+		$product_qty = (!empty($_POST['qty'])) ? intval($_POST['qty']) : 0;
475 475
 
476
-		if( !empty($product_id) && !empty($order_id) ) {
476
+		if (!empty($product_id) && !empty($order_id)) {
477 477
 			// Get Metadatas
478
-			$order_metadata = get_post_meta( $order_id, '_order_postmeta', true );
478
+			$order_metadata = get_post_meta($order_id, '_order_postmeta', true);
479 479
 			// Calcul cart informations
480 480
 			$wps_cart = new wps_cart();
481
-			$order_metadata = $wps_cart->calcul_cart_information( array( $product_id => array( 'product_id' => $product_id, 'product_qty' => $product_qty ) ), '', $order_metadata, true, false );
481
+			$order_metadata = $wps_cart->calcul_cart_information(array($product_id => array('product_id' => $product_id, 'product_qty' => $product_qty)), '', $order_metadata, true, false);
482 482
 			// Update Metadatas
483
-			update_post_meta( $order_id, '_order_postmeta', $order_metadata );
483
+			update_post_meta($order_id, '_order_postmeta', $order_metadata);
484 484
 			$status = true;
485 485
 		}
486 486
 
487
-		echo json_encode( array( 'status' => $status ) );
487
+		echo json_encode(array('status' => $status));
488 488
 		wp_die();
489 489
 	}
490 490
 
@@ -492,15 +492,15 @@  discard block
 block discarded – undo
492 492
 	 * AJAX - Load Product Variations in ThickBox on Add product to order action
493 493
 	 */
494 494
 	function wps_order_load_product_variations() {
495
-		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
495
+		$_wponce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : '';
496 496
 
497
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_order_load_product_variations' ) )
497
+		if (!wp_verify_nonce($_wpnonce, 'wps_order_load_product_variations'))
498 498
 			wp_die();
499 499
 
500
-		$product_id = ( !empty($_GET['pid']) ) ? intval( $_GET['pid']) : null;
501
-		$order_id = ( !empty($_GET['oid']) ) ? intval( $_GET['oid']) : null;
502
-		$qty = ( !empty($_GET['qty']) ) ? intval( $_GET['qty']) : 1;
503
-		echo '<div class="wps-boxed"><span class="wps-h5">'.__( 'Select your variations', 'wpshop' ).'</span>'.wpshop_products::wpshop_variation($product_id, true, $order_id, $qty ).'<a href="#" class="wps-bton-first-mini-rounded alignRight wps-orders-add_variation_product"><i class="wps-icon-basket"></i> ' .__( 'Add to cart', 'wpshop' ). '</a>'.'</div>';
500
+		$product_id = (!empty($_GET['pid'])) ? intval($_GET['pid']) : null;
501
+		$order_id = (!empty($_GET['oid'])) ? intval($_GET['oid']) : null;
502
+		$qty = (!empty($_GET['qty'])) ? intval($_GET['qty']) : 1;
503
+		echo '<div class="wps-boxed"><span class="wps-h5">' . __('Select your variations', 'wpshop') . '</span>' . wpshop_products::wpshop_variation($product_id, true, $order_id, $qty) . '<a href="#" class="wps-bton-first-mini-rounded alignRight wps-orders-add_variation_product"><i class="wps-icon-basket"></i> ' . __('Add to cart', 'wpshop') . '</a>' . '</div>';
504 504
 		wp_die();
505 505
 	}
506 506
 
@@ -508,67 +508,67 @@  discard block
 block discarded – undo
508 508
 	 * AJAX - Update cart informations
509 509
 	 */
510 510
 	function wps_orders_update_cart_informations() {
511
-		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
511
+		$_wponce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : '';
512 512
 
513
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_orders_update_cart_informations' ) )
513
+		if (!wp_verify_nonce($_wpnonce, 'wps_orders_update_cart_informations'))
514 514
 			wp_die();
515 515
 
516 516
 		$status = false;
517
-		$order_id = ( !empty($_POST['order_id']) ) ? intval($_POST['order_id']) : '';
518
-		$shipping_cost = ( !empty($_POST['shipping_cost']) ) ? wpshop_tools::varSanitizer($_POST['shipping_cost']) : '';
519
-		$discount_value = ( !empty($_POST['discount_amount']) ) ? wpshop_tools::varSanitizer($_POST['discount_amount']) : '';
520
-		$discount_type = ( !empty($_POST['discount_type']) ) ? wpshop_tools::varSanitizer($_POST['discount_type']) : '';
517
+		$order_id = (!empty($_POST['order_id'])) ? intval($_POST['order_id']) : '';
518
+		$shipping_cost = (!empty($_POST['shipping_cost'])) ? wpshop_tools::varSanitizer($_POST['shipping_cost']) : '';
519
+		$discount_value = (!empty($_POST['discount_amount'])) ? wpshop_tools::varSanitizer($_POST['discount_amount']) : '';
520
+		$discount_type = (!empty($_POST['discount_type'])) ? wpshop_tools::varSanitizer($_POST['discount_type']) : '';
521 521
 
522 522
 
523
-		if( !empty($order_id) ) {
524
-			$order_meta = get_post_meta( $order_id, '_order_postmeta', true );
523
+		if (!empty($order_id)) {
524
+			$order_meta = get_post_meta($order_id, '_order_postmeta', true);
525 525
 			$order_meta['order_shipping_cost'] = $shipping_cost;
526 526
 
527 527
 			//Add discounts if exists
528
-			if( !empty($discount_value) && !empty($discount_type) ) {
528
+			if (!empty($discount_value) && !empty($discount_type)) {
529 529
 				$order_meta['order_discount_type'] = $discount_type;
530 530
 				$order_meta['order_discount_value'] = $discount_value;
531 531
 			}
532 532
 			$wps_cart = new wps_cart();
533
-			$order_meta = $wps_cart->calcul_cart_information( array(), '', $order_meta, true );
534
-			update_post_meta( $order_id, '_order_postmeta', $order_meta );
533
+			$order_meta = $wps_cart->calcul_cart_information(array(), '', $order_meta, true);
534
+			update_post_meta($order_id, '_order_postmeta', $order_meta);
535 535
 			$status = true;
536 536
 		}
537 537
 
538
-		echo json_encode( array( 'status' => $status) );
538
+		echo json_encode(array('status' => $status));
539 539
 		wp_die();
540 540
 	}
541 541
 
542 542
 	function wps_reverify_payment_invoice_ref() {
543
-		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
543
+		$_wponce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : '';
544 544
 
545
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_reverify_payment_invoice_ref' ) )
545
+		if (!wp_verify_nonce($_wpnonce, 'wps_reverify_payment_invoice_ref'))
546 546
 			wp_die();
547 547
 
548 548
 		$status = true;
549
-		$inputs = !empty( $_POST['inputs'] ) ? (array) $_POST['inputs'] : false;
549
+		$inputs = !empty($_POST['inputs']) ? (array)$_POST['inputs'] : false;
550 550
 
551 551
 		if (!$inputs)
552 552
 			$status = false;
553 553
 
554
-		if( $status ) {
554
+		if ($status) {
555 555
 			$inputs_clone = $inputs;
556 556
 			$inputs = array();
557
-			foreach( $inputs_clone as $var ) {
558
-				if( isset( $var['key'] ) && isset( $var['value'] ) ) {
557
+			foreach ($inputs_clone as $var) {
558
+				if (isset($var['key']) && isset($var['value'])) {
559 559
 					$inputs[$var['key']] = $var['value'];
560 560
 				}
561 561
 			}
562 562
 
563
-			( isset( $inputs['order_id'] ) ) ? $order_id = $inputs['order_id'] : $status = $order_id = false;
564
-			( isset( $inputs['index_payment'] ) ) ? $index_payment = $inputs['index_payment'] : $status = $index_payment = false;
563
+			(isset($inputs['order_id'])) ? $order_id = $inputs['order_id'] : $status = $order_id = false;
564
+			(isset($inputs['index_payment'])) ? $index_payment = $inputs['index_payment'] : $status = $index_payment = false;
565 565
 		}
566 566
 
567
-		if( $status ) {
568
-			$status = wpshop_payment::reverify_payment_invoice_ref( $order_id, $index_payment );
567
+		if ($status) {
568
+			$status = wpshop_payment::reverify_payment_invoice_ref($order_id, $index_payment);
569 569
 		}
570 570
 
571
-		echo json_encode( array( 'status' => $status ) );
571
+		echo json_encode(array('status' => $status));
572 572
 		wp_die();
573 573
 	}
574 574
 }
Please login to merge, or discard this patch.
Braces   +36 added lines, -27 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_orders_in_back_office {
3 5
 
4 6
 	function __construct() {
@@ -289,8 +291,7 @@  discard block
 block discarded – undo
289 291
 								'order_shipping_address' => ''
290 292
 								)
291 293
 						);
292
-			}
293
-			else {
294
+			} else {
294 295
 				$wps_message->wpshop_prepared_email(
295 296
 						$email,
296 297
 						'WPSHOP_ORDER_UPDATE_MESSAGE',
@@ -315,8 +316,9 @@  discard block
 block discarded – undo
315 316
 	function wpshop_add_private_comment_to_order() {
316 317
 		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
317 318
 
318
-		if ( !wp_verify_nonce( $_wpnonce, 'wpshop_add_private_comment_to_order' ) )
319
-			wp_die();
319
+		if ( !wp_verify_nonce( $_wpnonce, 'wpshop_add_private_comment_to_order' ) ) {
320
+					wp_die();
321
+		}
320 322
 
321 323
 		$status = false; $result = '';
322 324
 		$order_id = ( !empty($_POST['oid']) ) ? intval($_POST['oid']) : null;
@@ -336,8 +338,7 @@  discard block
 block discarded – undo
336 338
 				ob_end_clean();
337 339
 				$status = true;
338 340
 			}
339
-		}
340
-		else {
341
+		} else {
341 342
 			$result = __('An error was occured', 'wpshop');
342 343
 		}
343 344
 
@@ -352,8 +353,9 @@  discard block
 block discarded – undo
352 353
 	function refresh_product_list() {
353 354
 		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
354 355
 
355
-		if ( !wp_verify_nonce( $_wpnonce, 'refresh_product_list' ) )
356
-			wp_die();
356
+		if ( !wp_verify_nonce( $_wpnonce, 'refresh_product_list' ) ) {
357
+					wp_die();
358
+		}
357 359
 
358 360
 		$status = false; $response = '';
359 361
 		$letter = ( !empty($_POST['letter']) ) ? sanitize_title( $_POST['letter'] ) : '';
@@ -382,8 +384,9 @@  discard block
 block discarded – undo
382 384
 	function wps_add_product_to_order_admin() {
383 385
 		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
384 386
 
385
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_add_product_to_order_admin' ) )
386
-			wp_die();
387
+		if ( !wp_verify_nonce( $_wpnonce, 'wps_add_product_to_order_admin' ) ) {
388
+					wp_die();
389
+		}
387 390
 
388 391
 		$status = false; $response = ''; $product_have_variations = false;
389 392
 		// Sended vars
@@ -398,8 +401,7 @@  discard block
 block discarded – undo
398 401
 			$have_variations_checking = wpshop_products::get_variation( $product_id );
399 402
 			if( !empty($have_variations_checking) ) {
400 403
 				$product_have_variations = true;
401
-			}
402
-			else {
404
+			} else {
403 405
 				// Get Metadatas
404 406
 				$order_metadata = get_post_meta( $order_id, '_order_postmeta', true );
405 407
 				// Calcul cart informations
@@ -424,8 +426,9 @@  discard block
 block discarded – undo
424 426
 	function refresh_cart_order() {
425 427
 		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
426 428
 
427
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_pos_order_content' ) )
428
-			wp_die();
429
+		if ( !wp_verify_nonce( $_wpnonce, 'wps_pos_order_content' ) ) {
430
+					wp_die();
431
+		}
429 432
 
430 433
 		$status = false; $response = '';
431 434
 		$order_id = ( !empty($_POST['order_id']) ) ? intval($_POST['order_id']) : null;
@@ -443,8 +446,9 @@  discard block
 block discarded – undo
443 446
 	function refresh_payments_order() {
444 447
 		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
445 448
 
446
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_pos_order_content' ) )
447
-			wp_die();
449
+		if ( !wp_verify_nonce( $_wpnonce, 'wps_pos_order_content' ) ) {
450
+					wp_die();
451
+		}
448 452
 
449 453
 		$status = false; $response = '';
450 454
 		$order_id = ( !empty($_POST['order_id']) ) ? intval($_POST['order_id']) : null;
@@ -465,8 +469,9 @@  discard block
 block discarded – undo
465 469
 	function wps_update_product_qty_in_admin() {
466 470
 		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
467 471
 
468
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_pos_order_content' ) )
469
-			wp_die();
472
+		if ( !wp_verify_nonce( $_wpnonce, 'wps_pos_order_content' ) ) {
473
+					wp_die();
474
+		}
470 475
 
471 476
 		$status = false; $response = '';
472 477
 		$product_id = ( !empty($_POST['product_id']) ) ? wpshop_tools::varSanitizer( $_POST['product_id'] ) : null;
@@ -494,8 +499,9 @@  discard block
 block discarded – undo
494 499
 	function wps_order_load_product_variations() {
495 500
 		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
496 501
 
497
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_order_load_product_variations' ) )
498
-			wp_die();
502
+		if ( !wp_verify_nonce( $_wpnonce, 'wps_order_load_product_variations' ) ) {
503
+					wp_die();
504
+		}
499 505
 
500 506
 		$product_id = ( !empty($_GET['pid']) ) ? intval( $_GET['pid']) : null;
501 507
 		$order_id = ( !empty($_GET['oid']) ) ? intval( $_GET['oid']) : null;
@@ -510,8 +516,9 @@  discard block
 block discarded – undo
510 516
 	function wps_orders_update_cart_informations() {
511 517
 		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
512 518
 
513
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_orders_update_cart_informations' ) )
514
-			wp_die();
519
+		if ( !wp_verify_nonce( $_wpnonce, 'wps_orders_update_cart_informations' ) ) {
520
+					wp_die();
521
+		}
515 522
 
516 523
 		$status = false;
517 524
 		$order_id = ( !empty($_POST['order_id']) ) ? intval($_POST['order_id']) : '';
@@ -542,14 +549,16 @@  discard block
 block discarded – undo
542 549
 	function wps_reverify_payment_invoice_ref() {
543 550
 		$_wponce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
544 551
 
545
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_reverify_payment_invoice_ref' ) )
546
-			wp_die();
552
+		if ( !wp_verify_nonce( $_wpnonce, 'wps_reverify_payment_invoice_ref' ) ) {
553
+					wp_die();
554
+		}
547 555
 
548 556
 		$status = true;
549 557
 		$inputs = !empty( $_POST['inputs'] ) ? (array) $_POST['inputs'] : false;
550 558
 
551
-		if (!$inputs)
552
-			$status = false;
559
+		if (!$inputs) {
560
+					$status = false;
561
+		}
553 562
 
554 563
 		if( $status ) {
555 564
 			$inputs_clone = $inputs;
Please login to merge, or discard this patch.
includes/modules/wps_orders/templates/frontend/orders_list_in_account.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,32 +1,32 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
-if ( !empty($orders) ) :
3
-	$permalink_option = get_option( 'permalink_structure' );
1
+<?php if (!defined('ABSPATH')) exit;
2
+if (!empty($orders)) :
3
+	$permalink_option = get_option('permalink_structure');
4 4
 	$account_page_id = get_option('wpshop_myaccount_page_id');
5 5
 ?>
6 6
 
7 7
 
8
-<?php if( !$from_admin ): ?>
9
-<span class="wps-h5"><?php _e( 'My last orders', 'wpshop'); ?></span>
8
+<?php if (!$from_admin): ?>
9
+<span class="wps-h5"><?php _e('My last orders', 'wpshop'); ?></span>
10 10
 <?php endif; ?>
11 11
 
12 12
 <div class="wps-table">
13 13
 	<div class="wps-table-header wps-table-row">
14
-		<div class="wps-table-cell"><?php _e( 'Date', 'wpshop'); ?></div>
15
-		<div class="wps-table-cell"><?php _e( 'Reference', 'wpshop'); ?></div>
16
-		<div class="wps-table-cell"><?php _e( 'Total', 'wpshop'); ?></div>
17
-		<div class="wps-table-cell"><?php _e( 'Status', 'wpshop'); ?></div>
18
-		<div class="wps-table-cell"><?php _e( 'Tracking number', 'wpshop'); ?></div>
19
-		<div class="wps-table-cell"><?php _e( 'Actions', 'wpshop'); ?></div>
14
+		<div class="wps-table-cell"><?php _e('Date', 'wpshop'); ?></div>
15
+		<div class="wps-table-cell"><?php _e('Reference', 'wpshop'); ?></div>
16
+		<div class="wps-table-cell"><?php _e('Total', 'wpshop'); ?></div>
17
+		<div class="wps-table-cell"><?php _e('Status', 'wpshop'); ?></div>
18
+		<div class="wps-table-cell"><?php _e('Tracking number', 'wpshop'); ?></div>
19
+		<div class="wps-table-cell"><?php _e('Actions', 'wpshop'); ?></div>
20 20
 	</div>
21 21
 	<?php
22
-	foreach( $orders as $order ) {
22
+	foreach ($orders as $order) {
23 23
 		$order_id = $order->ID;
24
-		$order_meta = get_post_meta( $order_id, '_order_postmeta', true );
25
-		require( wpshop_tools::get_template_part( WPS_ORDERS_DIR, $this->template_dir, "frontend", "order_row_in_account") );
24
+		$order_meta = get_post_meta($order_id, '_order_postmeta', true);
25
+		require(wpshop_tools::get_template_part(WPS_ORDERS_DIR, $this->template_dir, "frontend", "order_row_in_account"));
26 26
 	} ?>
27 27
 </div>
28 28
 <?php else : ?>
29
-<div class="wps-alert-info"><?php _e( 'No order have been created for the moment', 'wpshop'); ?></div>
29
+<div class="wps-alert-info"><?php _e('No order have been created for the moment', 'wpshop'); ?></div>
30 30
 <?php endif; ?>
31 31
 
32 32
 
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($orders) ) :
3 5
 	$permalink_option = get_option( 'permalink_structure' );
4 6
 	$account_page_id = get_option('wpshop_myaccount_page_id');
@@ -25,8 +27,11 @@  discard block
 block discarded – undo
25 27
 		require( wpshop_tools::get_template_part( WPS_ORDERS_DIR, $this->template_dir, "frontend", "order_row_in_account") );
26 28
 	} ?>
27 29
 </div>
28
-<?php else : ?>
29
-<div class="wps-alert-info"><?php _e( 'No order have been created for the moment', 'wpshop'); ?></div>
30
+<?php else {
31
+	: ?>
32
+<div class="wps-alert-info"><?php _e( 'No order have been created for the moment', 'wpshop');
33
+}
34
+?></div>
30 35
 <?php endif; ?>
31 36
 
32 37
 
Please login to merge, or discard this patch.
modules/wps_orders/templates/backend/wps_order_customer_informations.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
-if( !empty($order_metadata) ) : 
1
+<?php if (!defined('ABSPATH')) exit;
2
+if (!empty($order_metadata)) : 
3 3
 ?>
4 4
 <div class="wps-gridwrapper3-padded">
5 5
 	<div>
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
 
10 10
 	<div>
11 11
 		<div class="wps-boxed summary_shipping_boxed">
12
-			<div class="wps-h5"><?php _e( 'Billing address', 'wpshop')?></div>
12
+			<div class="wps-h5"><?php _e('Billing address', 'wpshop')?></div>
13 13
 			<?php 
14
-			if( !empty($billing_address_content) ) : 
14
+			if (!empty($billing_address_content)) : 
15 15
 				echo $billing_address_content; 
16 16
 			else : 
17 17
 			?>
18
-				<div class="wps-alert-error"><?php _e( 'No billing address informations are found', 'wpshop'); ?></div>
18
+				<div class="wps-alert-error"><?php _e('No billing address informations are found', 'wpshop'); ?></div>
19 19
 			<?php 
20 20
 			endif;
21 21
 			?>
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 	</div>
24 24
 	<div>
25 25
 		<div class="wps-boxed summary_shipping_boxed">
26
-			<div class="wps-h5"><?php _e( 'Shipping address', 'wpshop')?></div>
26
+			<div class="wps-h5"><?php _e('Shipping address', 'wpshop')?></div>
27 27
 			<?php 
28
-			if( !empty($shipping_address_content) ) : 
28
+			if (!empty($shipping_address_content)) : 
29 29
 				echo $shipping_address_content; 
30 30
 			else : 
31 31
 			?>
32
-				<div class="wps-alert-error"><?php _e( 'No shipping address informations are found', 'wpshop'); ?></div>
32
+				<div class="wps-alert-error"><?php _e('No shipping address informations are found', 'wpshop'); ?></div>
33 33
 			<?php 
34 34
 			endif;
35 35
 			?>
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 <?php 
42 42
 else :
43 43
 ?>
44
-<div class="wps-alert-info"><?php _e( 'Please choose a customer or create one', 'wpshop'); ?></div>
44
+<div class="wps-alert-info"><?php _e('Please choose a customer or create one', 'wpshop'); ?></div>
45 45
 <?php 
46 46
 endif;
47 47
 ?>
Please login to merge, or discard this patch.
Braces   +18 added lines, -7 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($order_metadata) ) : 
3 5
 ?>
4 6
 <div class="wps-gridwrapper3-padded">
@@ -13,9 +15,12 @@  discard block
 block discarded – undo
13 15
 			<?php 
14 16
 			if( !empty($billing_address_content) ) : 
15 17
 				echo $billing_address_content; 
16
-			else : 
18
+			else {
19
+				: 
17 20
 			?>
18
-				<div class="wps-alert-error"><?php _e( 'No billing address informations are found', 'wpshop'); ?></div>
21
+				<div class="wps-alert-error"><?php _e( 'No billing address informations are found', 'wpshop');
22
+			}
23
+			?></div>
19 24
 			<?php 
20 25
 			endif;
21 26
 			?>
@@ -27,9 +32,12 @@  discard block
 block discarded – undo
27 32
 			<?php 
28 33
 			if( !empty($shipping_address_content) ) : 
29 34
 				echo $shipping_address_content; 
30
-			else : 
35
+			else {
36
+				: 
31 37
 			?>
32
-				<div class="wps-alert-error"><?php _e( 'No shipping address informations are found', 'wpshop'); ?></div>
38
+				<div class="wps-alert-error"><?php _e( 'No shipping address informations are found', 'wpshop');
39
+			}
40
+			?></div>
33 41
 			<?php 
34 42
 			endif;
35 43
 			?>
@@ -39,9 +47,12 @@  discard block
 block discarded – undo
39 47
 </div>
40 48
 
41 49
 <?php 
42
-else :
50
+else {
51
+	:
43 52
 ?>
44
-<div class="wps-alert-info"><?php _e( 'Please choose a customer or create one', 'wpshop'); ?></div>
53
+<div class="wps-alert-info"><?php _e( 'Please choose a customer or create one', 'wpshop');
54
+}
55
+?></div>
45 56
 <?php 
46 57
 endif;
47 58
 ?>
Please login to merge, or discard this patch.
modules/wps_orders/templates/backend/customer_comment_on_order_box.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
- if( !empty($comment) ) : ?>
1
+<?php if (!defined('ABSPATH')) exit;
2
+ if (!empty($comment)) : ?>
3 3
 	<div class="wps-boxed"><?php echo $comment; ?></div>
4 4
 <?php else : ?>
5 5
 	<div class="wps-alert-info">
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($comment) ) : ?>
3 5
 	<div class="wps-boxed"><?php echo $comment; ?></div>
4
-<?php else : ?>
6
+<?php else {
7
+	: ?>
5 8
 	<div class="wps-alert-info">
6
-		<?php _e('No comment for this order', 'wpshop'); ?>
9
+		<?php _e('No comment for this order', 'wpshop');
10
+}
11
+?>
7 12
 	</div>
8 13
 <?php endif; ?>
9 14
 
Please login to merge, or discard this patch.
includes/modules/wps_orders/templates/backend/wps_order_payment_box.php 2 patches
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,11 +1,16 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
  if ( !empty($order_postmeta['order_payment']) ) :
3 5
 $total_amount = ( !empty($order_postmeta['order_grand_total']) ) ? $order_postmeta['order_grand_total'] : '';
4 6
 $waited_amount_sum = $received_amount_sum = $i = 0;
5 7
 ?>
6 8
 	<?php $payment_modes = get_option( 'wps_payment_mode' ); ?>
7
-	<?php if( !empty( $order_postmeta['order_payment']['customer_choice'] ) && !empty( $order_postmeta['order_payment']['customer_choice']['method'] ) )?>
8
-		<div class="wps-alert-info"><strong><?php _e( 'Payment method customer select', 'wpshop'); ?> : </strong><br/>
9
+	<?php if( !empty( $order_postmeta['order_payment']['customer_choice'] ) && !empty( $order_postmeta['order_payment']['customer_choice']['method'] ) ) {
10
+	?>
11
+		<div class="wps-alert-info"><strong><?php _e( 'Payment method customer select', 'wpshop');
12
+}
13
+?> : </strong><br/>
9 14
 		<?php echo ( !empty( $order_postmeta ) &&  !empty(  $order_postmeta['order_payment']['customer_choice']['method'] ) && !empty( $payment_modes['mode'][ strtolower( (string)$order_postmeta['order_payment']['customer_choice']['method'] ) ][ 'name' ] ) ?  $payment_modes['mode'][ strtolower( (string)$order_postmeta['order_payment']['customer_choice']['method'] ) ]['name'] : sprintf( __( 'Unknow (%s)', 'wpshop'), strtolower( (string)$order_postmeta['order_payment']['customer_choice']['method'] ) ) ); ?></div>
10 15
 
11 16
 	<?php
@@ -43,8 +48,11 @@  discard block
 block discarded – undo
43 48
 							<span class="wps-label-orange"><?php _e( 'Incorrect amount', 'wpshop'); ?></span>
44 49
 						<?php elseif( $received_payment['status'] == 'waiting_payment') : ?>
45 50
 							<span class="wps-label-rouge"><?php _e( 'Waiting payment', 'wpshop'); ?></span>
46
-						<?php else : ?>
47
-							<span class="wps-label-rouge"><?php echo $received_payment['status']; ?></span>
51
+						<?php else {
52
+	: ?>
53
+							<span class="wps-label-rouge"><?php echo $received_payment['status'];
54
+}
55
+?></span>
48 56
 						<?php endif; ?>
49 57
 					</div>
50 58
 				</div>
@@ -144,6 +152,9 @@  discard block
 block discarded – undo
144 152
 		<div class="wps-alert-<?php echo ( ( ($order_postmeta['order_amount_to_pay_now']) <= 0 ) ? 'success': 'warning' ); ?>"><u><?php _e( 'Due amount for this order', 'wpshop'); ?></u> : <span class="alignright"><strong><?php echo $order_postmeta['order_amount_to_pay_now'];?> <?php echo wpshop_tools::wpshop_get_currency(); ?></strong></span></div>
145 153
 
146 154
 	<?php endif; ?>
147
-<?php else: ?>
148
-	<div class="wps-alert-info"><?php _e('No information available for this order payment', 'wpshop'); ?></div>
155
+<?php else {
156
+	: ?>
157
+	<div class="wps-alert-info"><?php _e('No information available for this order payment', 'wpshop');
158
+}
159
+?></div>
149 160
 <?php endif;?>
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,91 +1,91 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
- if ( !empty($order_postmeta['order_payment']) ) :
3
-$total_amount = ( !empty($order_postmeta['order_grand_total']) ) ? $order_postmeta['order_grand_total'] : '';
1
+<?php if (!defined('ABSPATH')) exit;
2
+ if (!empty($order_postmeta['order_payment'])) :
3
+$total_amount = (!empty($order_postmeta['order_grand_total'])) ? $order_postmeta['order_grand_total'] : '';
4 4
 $waited_amount_sum = $received_amount_sum = $i = 0;
5 5
 ?>
6
-	<?php $payment_modes = get_option( 'wps_payment_mode' ); ?>
7
-	<?php if( !empty( $order_postmeta['order_payment']['customer_choice'] ) && !empty( $order_postmeta['order_payment']['customer_choice']['method'] ) )?>
8
-		<div class="wps-alert-info"><strong><?php _e( 'Payment method customer select', 'wpshop'); ?> : </strong><br/>
9
-		<?php echo ( !empty( $order_postmeta ) &&  !empty(  $order_postmeta['order_payment']['customer_choice']['method'] ) && !empty( $payment_modes['mode'][ strtolower( (string)$order_postmeta['order_payment']['customer_choice']['method'] ) ][ 'name' ] ) ?  $payment_modes['mode'][ strtolower( (string)$order_postmeta['order_payment']['customer_choice']['method'] ) ]['name'] : sprintf( __( 'Unknow (%s)', 'wpshop'), strtolower( (string)$order_postmeta['order_payment']['customer_choice']['method'] ) ) ); ?></div>
6
+	<?php $payment_modes = get_option('wps_payment_mode'); ?>
7
+	<?php if (!empty($order_postmeta['order_payment']['customer_choice']) && !empty($order_postmeta['order_payment']['customer_choice']['method']))?>
8
+		<div class="wps-alert-info"><strong><?php _e('Payment method customer select', 'wpshop'); ?> : </strong><br/>
9
+		<?php echo (!empty($order_postmeta) && !empty($order_postmeta['order_payment']['customer_choice']['method']) && !empty($payment_modes['mode'][strtolower((string)$order_postmeta['order_payment']['customer_choice']['method'])]['name']) ? $payment_modes['mode'][strtolower((string)$order_postmeta['order_payment']['customer_choice']['method'])]['name'] : sprintf(__('Unknow (%s)', 'wpshop'), strtolower((string)$order_postmeta['order_payment']['customer_choice']['method']))); ?></div>
10 10
 
11 11
 	<?php
12
-		$payment_method_filter = apply_filters( 'wps_administration_order_payment_informations', $order->ID );
13
-		if ( $order->ID != $payment_method_filter ) {
12
+		$payment_method_filter = apply_filters('wps_administration_order_payment_informations', $order->ID);
13
+		if ($order->ID != $payment_method_filter) {
14 14
 			echo $payment_method_filter;
15 15
 		}
16 16
 	?>
17 17
 
18
-	<?php if( !empty( $order_postmeta['order_payment']['received'] ) ) : ?>
18
+	<?php if (!empty($order_postmeta['order_payment']['received'])) : ?>
19 19
 		<div class="wps-boxed">
20
-			<div class="wps-h2"><?php _e( 'Received payments', 'wpshop'); ?></div>
21
-		<?php foreach( $order_postmeta['order_payment']['received'] as $index_payment => $received_payment ) :
22
-				if( !empty( $received_payment['method'] ) ) :
20
+			<div class="wps-h2"><?php _e('Received payments', 'wpshop'); ?></div>
21
+		<?php foreach ($order_postmeta['order_payment']['received'] as $index_payment => $received_payment) :
22
+				if (!empty($received_payment['method'])) :
23 23
 				$i++;
24 24
 		?>
25 25
 			<?php
26
-			if ( !empty($received_payment['waited_amount']) ) {
26
+			if (!empty($received_payment['waited_amount'])) {
27 27
 				$waited_amount_sum += $received_payment['waited_amount'];
28 28
 			}
29
-			if ( !empty($received_payment['received_amount']) && ($received_payment['status'] == 'payment_received') ) {
29
+			if (!empty($received_payment['received_amount']) && ($received_payment['status'] == 'payment_received')) {
30 30
 				$received_amount_sum += $received_payment['received_amount'];
31 31
 			}
32 32
 			?>
33 33
 			<div>
34
-				<div class="wps-h5"><span class="dashicons dashicons-arrow-right"></span><strong><?php echo ( !empty( $received_payment ) &&  !empty(  $received_payment['method'] ) && !empty( $payment_modes['mode'][ strtolower( $received_payment['method'] ) ] ) && !empty( $payment_modes['mode'][ strtolower( $received_payment['method'] ) ][ 'name' ] ) ?  $payment_modes['mode'][ strtolower( $received_payment['method'] ) ]['name'] : sprintf( __( 'Unknow (%s)', 'wpshop'), strtolower( $received_payment['method'] ) ) ); ?></strong></div>
34
+				<div class="wps-h5"><span class="dashicons dashicons-arrow-right"></span><strong><?php echo (!empty($received_payment) && !empty($received_payment['method']) && !empty($payment_modes['mode'][strtolower($received_payment['method'])]) && !empty($payment_modes['mode'][strtolower($received_payment['method'])]['name']) ? $payment_modes['mode'][strtolower($received_payment['method'])]['name'] : sprintf(__('Unknow (%s)', 'wpshop'), strtolower($received_payment['method']))); ?></strong></div>
35 35
 				<div class="wps-product-section">
36
-					<div><strong><?php _e( 'Payment date', 'wpshop'); ?> :</strong> <?php echo ( !empty( $received_payment ) && !empty($received_payment['date']) ) ? mysql2date('d F Y H:i', $received_payment['date'], true) : __( 'Unknow', 'wpshop'); ?></div>
37
-					<div><strong><?php _e( 'Payment reference', 'wpshop'); ?> :</strong> <?php echo ( !empty( $received_payment ) && !empty($received_payment['payment_reference']) ) ? $received_payment['payment_reference'] : __( 'Unknow', 'wpshop'); ?></div>
38
-					<div><strong><?php _e( 'Amount', 'wpshop'); ?> :</strong> <?php echo ( !empty( $received_payment ) && !empty($received_payment['received_amount']) ) ? $received_payment['received_amount'].' '.wpshop_tools::wpshop_get_currency() : __( 'Unknow', 'wpshop'); ?></div>
39
-					<div><strong><?php _e( 'Status', 'wpshop'); ?> :</strong>
40
-						<?php if( !empty($received_payment['status']) && $received_payment['status'] == 'payment_received' ) : ?>
41
-							<span class="wps-label-vert"><?php _e( 'Received payment', 'wpshop'); ?></span>
42
-						<?php elseif( $received_payment['status'] == 'incorrect_amount' )  : ?>
43
-							<span class="wps-label-orange"><?php _e( 'Incorrect amount', 'wpshop'); ?></span>
44
-						<?php elseif( $received_payment['status'] == 'waiting_payment') : ?>
45
-							<span class="wps-label-rouge"><?php _e( 'Waiting payment', 'wpshop'); ?></span>
36
+					<div><strong><?php _e('Payment date', 'wpshop'); ?> :</strong> <?php echo (!empty($received_payment) && !empty($received_payment['date'])) ? mysql2date('d F Y H:i', $received_payment['date'], true) : __('Unknow', 'wpshop'); ?></div>
37
+					<div><strong><?php _e('Payment reference', 'wpshop'); ?> :</strong> <?php echo (!empty($received_payment) && !empty($received_payment['payment_reference'])) ? $received_payment['payment_reference'] : __('Unknow', 'wpshop'); ?></div>
38
+					<div><strong><?php _e('Amount', 'wpshop'); ?> :</strong> <?php echo (!empty($received_payment) && !empty($received_payment['received_amount'])) ? $received_payment['received_amount'] . ' ' . wpshop_tools::wpshop_get_currency() : __('Unknow', 'wpshop'); ?></div>
39
+					<div><strong><?php _e('Status', 'wpshop'); ?> :</strong>
40
+						<?php if (!empty($received_payment['status']) && $received_payment['status'] == 'payment_received') : ?>
41
+							<span class="wps-label-vert"><?php _e('Received payment', 'wpshop'); ?></span>
42
+						<?php elseif ($received_payment['status'] == 'incorrect_amount')  : ?>
43
+							<span class="wps-label-orange"><?php _e('Incorrect amount', 'wpshop'); ?></span>
44
+						<?php elseif ($received_payment['status'] == 'waiting_payment') : ?>
45
+							<span class="wps-label-rouge"><?php _e('Waiting payment', 'wpshop'); ?></span>
46 46
 						<?php else : ?>
47 47
 							<span class="wps-label-rouge"><?php echo $received_payment['status']; ?></span>
48 48
 						<?php endif; ?>
49 49
 					</div>
50 50
 				</div>
51
-				<?php if( !empty( $received_payment ) && !empty($received_payment['invoice_ref']) ) { ?>
51
+				<?php if (!empty($received_payment) && !empty($received_payment['invoice_ref'])) { ?>
52 52
 					<div>
53
-					<div class="wps-product-section"><a href="<?php echo WPSHOP_TEMPLATES_URL; ?>invoice.php?order_id=<?php echo $order->ID; ?>&invoice_ref=<?php echo $received_payment['invoice_ref']; ?>&mode=pdf" target="_blank" class="wps-bton-second-mini-rounded" role="button"><i class="dashicons dashicons-download"></i><?php _e( 'Download invoice', 'wpshop' ); ?></a></div>
54
-					<div class="wps-product-section"><a href="<?php echo WPSHOP_TEMPLATES_URL; ?>invoice.php?order_id=<?php echo $order->ID; ?>&invoice_ref=<?php echo $received_payment['invoice_ref']; ?>" target="_blank" class="wps-bton-fourth-mini-third" role="button"><i class="dashicons dashicons-welcome-view-site"></i><?php _e( 'Watch invoice', 'wpshop' ); ?></a></div>
53
+					<div class="wps-product-section"><a href="<?php echo WPSHOP_TEMPLATES_URL; ?>invoice.php?order_id=<?php echo $order->ID; ?>&invoice_ref=<?php echo $received_payment['invoice_ref']; ?>&mode=pdf" target="_blank" class="wps-bton-second-mini-rounded" role="button"><i class="dashicons dashicons-download"></i><?php _e('Download invoice', 'wpshop'); ?></a></div>
54
+					<div class="wps-product-section"><a href="<?php echo WPSHOP_TEMPLATES_URL; ?>invoice.php?order_id=<?php echo $order->ID; ?>&invoice_ref=<?php echo $received_payment['invoice_ref']; ?>" target="_blank" class="wps-bton-fourth-mini-third" role="button"><i class="dashicons dashicons-welcome-view-site"></i><?php _e('Watch invoice', 'wpshop'); ?></a></div>
55 55
 					</div>
56
-				<?php } elseif( !empty( $received_payment ) && empty( $received_payment['invoice_ref'] ) && $received_payment['status'] == 'payment_received' ) { ?>
56
+				<?php } elseif (!empty($received_payment) && empty($received_payment['invoice_ref']) && $received_payment['status'] == 'payment_received') { ?>
57 57
 					<div>
58 58
 					<input type="hidden" name="order_id" class="wps-regerate-invoice-payment-input<?php $idregen = uniqid(); echo $idregen; ?>" value="<?php echo $order->ID; ?>">
59 59
 					<input type="hidden" name="index_payment" class="wps-regerate-invoice-payment-input<?php echo $idregen; ?>" value="<?php echo $index_payment; ?>">
60
-					<div class="wps-product-section"><button data-nonce="<?php echo wp_create_nonce( 'wps_reverify_payment_invoice_ref' ); ?>" id="wps-regerate-invoice-payment-btn" class="wps-bton-fourth-mini-third" data-class="<?php echo $idregen; ?>"><i class="dashicons dashicons-controls-repeat"></i><?php _e( 'Regerate invoice payment', 'wpshop' ); ?></button></div>
60
+					<div class="wps-product-section"><button data-nonce="<?php echo wp_create_nonce('wps_reverify_payment_invoice_ref'); ?>" id="wps-regerate-invoice-payment-btn" class="wps-bton-fourth-mini-third" data-class="<?php echo $idregen; ?>"><i class="dashicons dashicons-controls-repeat"></i><?php _e('Regerate invoice payment', 'wpshop'); ?></button></div>
61 61
 					</div>
62 62
 				<?php } ?>
63 63
 				<br/>
64 64
 			</div>
65 65
 		<?php
66 66
 			endif;
67
-		endforeach;?>
67
+		endforeach; ?>
68 68
 
69
-		<?php if( $i == 0 ) : ?>
70
-			<div class="wps-alert-info"><?php _e( 'No received payment for the moment', 'wpshop'); ?></div>
71
-		<?php endif;?>
69
+		<?php if ($i == 0) : ?>
70
+			<div class="wps-alert-info"><?php _e('No received payment for the moment', 'wpshop'); ?></div>
71
+		<?php endif; ?>
72 72
 		</div>
73 73
 
74
-		<?php if ( ( ($total_amount - $received_amount_sum ) > 0) && ($order_postmeta['order_grand_total'] > 0) ) : ?>
74
+		<?php if ((($total_amount - $received_amount_sum) > 0) && ($order_postmeta['order_grand_total'] > 0)) : ?>
75 75
 		<div class="wps-boxed">
76
-			<div class="wps-h5"><?php _e( 'Add a new payment', 'wpshop'); ?></div>
76
+			<div class="wps-h5"><?php _e('Add a new payment', 'wpshop'); ?></div>
77 77
 			<div class="wps-gridwrapper2-padded">
78 78
 				<div class="wps-form-group">
79 79
 					<label><?php _e('Method', 'wpshop'); ?> :</label>
80 80
 					<div class="wps-form">
81 81
 						<select name="wpshop_admin_order_payment_received[method]">
82
-							<?php if(!empty( $payment_modes ) && !empty($payment_modes['mode'])  ) : ?>
83
-								<?php foreach( $payment_modes['mode'] as $mode_id => $mode ) : ?>
84
-									<?php if( !empty($mode['active']) ) : ?>
82
+							<?php if (!empty($payment_modes) && !empty($payment_modes['mode'])) : ?>
83
+								<?php foreach ($payment_modes['mode'] as $mode_id => $mode) : ?>
84
+									<?php if (!empty($mode['active'])) : ?>
85 85
 										<option value="<?php echo $mode_id; ?>"><?php echo $mode['name']; ?></option>
86
-									<?php endif;?>
86
+									<?php endif; ?>
87 87
 								<?php endforeach; ?>
88
-							<?php endif;?>
88
+							<?php endif; ?>
89 89
 						</select>
90 90
 					</div>
91 91
 				</div>
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 				</div>
116 116
 
117 117
 			</div>
118
-			<input type="hidden" value="<?php echo ($waited_amount_sum - $received_amount_sum ); ?>" id="wpshop_admin_order_due_amount" />
118
+			<input type="hidden" value="<?php echo ($waited_amount_sum - $received_amount_sum); ?>" id="wpshop_admin_order_due_amount" />
119 119
 			<input type="hidden" value="" id="action_triggered_from" name="action_triggered_from" />
120
-			<div><button class="wps-bton-first-mini-rounded" id="wpshop_order_arrived_payment_amount_add_button"><?php _e( 'Add the payment', 'wpshop' ); ?></button></div>
120
+			<div><button class="wps-bton-first-mini-rounded" id="wpshop_order_arrived_payment_amount_add_button"><?php _e('Add the payment', 'wpshop'); ?></button></div>
121 121
 		</div>
122 122
 
123 123
 		<script type="text/javascript" >
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 
142 142
 
143 143
 		<?php endif; ?>
144
-		<div class="wps-alert-<?php echo ( ( ($order_postmeta['order_amount_to_pay_now']) <= 0 ) ? 'success': 'warning' ); ?>"><u><?php _e( 'Due amount for this order', 'wpshop'); ?></u> : <span class="alignright"><strong><?php echo $order_postmeta['order_amount_to_pay_now'];?> <?php echo wpshop_tools::wpshop_get_currency(); ?></strong></span></div>
144
+		<div class="wps-alert-<?php echo ((($order_postmeta['order_amount_to_pay_now']) <= 0) ? 'success' : 'warning'); ?>"><u><?php _e('Due amount for this order', 'wpshop'); ?></u> : <span class="alignright"><strong><?php echo $order_postmeta['order_amount_to_pay_now']; ?> <?php echo wpshop_tools::wpshop_get_currency(); ?></strong></span></div>
145 145
 
146 146
 	<?php endif; ?>
147 147
 <?php else: ?>
148 148
 	<div class="wps-alert-info"><?php _e('No information available for this order payment', 'wpshop'); ?></div>
149
-<?php endif;?>
149
+<?php endif; ?>
Please login to merge, or discard this patch.
includes/modules/wps_orders/templates/backend/product_order_historic.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
- if( !empty($sales_informations) ): ?>
1
+<?php if (!defined('ABSPATH')) exit;
2
+ if (!empty($sales_informations)): ?>
3 3
 <div class="wps-table">
4 4
 	<div class="wps-table-header wps-table-row">
5
-		<div class="wps-table-cell"><?php _e( 'Date', 'wpshop'); ?></div>
6
-		<div class="wps-table-cell"><?php _e( 'Order ID', 'wpshop'); ?></div>
7
-		<div class="wps-table-cell"><?php _e( 'Customer', 'wpshop'); ?></div>
8
-		<div class="wps-table-cell"><?php _e( 'Order Status', 'wpshop'); ?></div>
5
+		<div class="wps-table-cell"><?php _e('Date', 'wpshop'); ?></div>
6
+		<div class="wps-table-cell"><?php _e('Order ID', 'wpshop'); ?></div>
7
+		<div class="wps-table-cell"><?php _e('Customer', 'wpshop'); ?></div>
8
+		<div class="wps-table-cell"><?php _e('Order Status', 'wpshop'); ?></div>
9 9
 		<div class="wps-table-cell"></div>
10 10
 	</div>
11
-	<?php foreach( $sales_informations as $sale_informations) : ?>
11
+	<?php foreach ($sales_informations as $sale_informations) : ?>
12 12
 		<div class="wps-table-content wps-table-row">
13
-			<div class="wps-table-cell"><?php echo mysql2date('d F Y, H:i:s',$sale_informations['order_date'], true);?></div>
13
+			<div class="wps-table-cell"><?php echo mysql2date('d F Y, H:i:s', $sale_informations['order_date'], true); ?></div>
14 14
 			<div class="wps-table-cell"><?php echo $sale_informations['order_key']; ?></div>
15
-			<div class="wps-table-cell"><?php echo $sale_informations['customer_name']. ' '.$sale_informations['customer_firstname'].' ('.$sale_informations['customer_email'].')'; ?></div>
16
-			<div class="wps-table-cell"><span class="wps-label-<?php echo $color_label[ strtolower($sale_informations['order_status']) ]; ?>"><?php _e( $order_status[ strtolower($sale_informations['order_status']) ], 'wpshop' ); ?></span></div>
17
-			<div class="wps-table-cell"><a href="<?php echo admin_url('post.php?post=' .$sale_informations['order_id']. '&action=edit'); ?>" class="wps-bton-mini-rounded-first" target="_blank"><?php _e( 'See the order', 'wpshop'); ?></a></div>
15
+			<div class="wps-table-cell"><?php echo $sale_informations['customer_name'] . ' ' . $sale_informations['customer_firstname'] . ' (' . $sale_informations['customer_email'] . ')'; ?></div>
16
+			<div class="wps-table-cell"><span class="wps-label-<?php echo $color_label[strtolower($sale_informations['order_status'])]; ?>"><?php _e($order_status[strtolower($sale_informations['order_status'])], 'wpshop'); ?></span></div>
17
+			<div class="wps-table-cell"><a href="<?php echo admin_url('post.php?post=' . $sale_informations['order_id'] . '&action=edit'); ?>" class="wps-bton-mini-rounded-first" target="_blank"><?php _e('See the order', 'wpshop'); ?></a></div>
18 18
 		</div>
19 19
 	<?php endforeach; ?>
20 20
 </div>
21 21
 <?php else : ?>
22
-	<div class="wps-alert-info"><?php _e( 'This product has never been ordered', 'wpshop'); ?></div>
22
+	<div class="wps-alert-info"><?php _e('This product has never been ordered', 'wpshop'); ?></div>
23 23
 <?php endif; ?>
24 24
 
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($sales_informations) ): ?>
3 5
 <div class="wps-table">
4 6
 	<div class="wps-table-header wps-table-row">
@@ -18,7 +20,10 @@  discard block
 block discarded – undo
18 20
 		</div>
19 21
 	<?php endforeach; ?>
20 22
 </div>
21
-<?php else : ?>
22
-	<div class="wps-alert-info"><?php _e( 'This product has never been ordered', 'wpshop'); ?></div>
23
+<?php else {
24
+	: ?>
25
+	<div class="wps-alert-info"><?php _e( 'This product has never been ordered', 'wpshop');
26
+}
27
+?></div>
23 28
 <?php endif; ?>
24 29
 
Please login to merge, or discard this patch.
backend/order-private-comments/wps_orders_sended_private_comments.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
- $order_private_comments = get_post_meta( $oid, '_order_private_comments', true); ?>
3
-<?php if( !empty($order_private_comments) ) : ?>
1
+<?php if (!defined('ABSPATH')) exit;
2
+ $order_private_comments = get_post_meta($oid, '_order_private_comments', true); ?>
3
+<?php if (!empty($order_private_comments)) : ?>
4 4
 <?php $order_private_comments = array_reverse($order_private_comments); 
5 5
 ?>
6
-	<?php foreach($order_private_comments as $order_private_comment ) : ?>
6
+	<?php foreach ($order_private_comments as $order_private_comment) : ?>
7 7
 	<div class="wps_private_comment">
8 8
 		<div class="wps_private_comment_avatar">
9
-			<?php $user_id = ( !empty($order_private_comment) && !empty($order_private_comment['author']) ) ? $order_private_comment['author'] : get_current_user_id() ; ?>
10
-			<?php echo get_avatar( $user_id, 30 ); ?>
11
-			<?php $user_data = get_userdata( $user_id ); ?>
9
+			<?php $user_id = (!empty($order_private_comment) && !empty($order_private_comment['author'])) ? $order_private_comment['author'] : get_current_user_id(); ?>
10
+			<?php echo get_avatar($user_id, 30); ?>
11
+			<?php $user_data = get_userdata($user_id); ?>
12 12
 		</div>
13 13
 		<div class="wps_private_comment_author_informations">
14 14
 			<span class="wps_private_comment_author">
15
-			<?php echo ( !empty($order_private_comment['send_email']) && $order_private_comment['send_email'] === true ) ? '<span class="dashicons dashicons-email-alt"></span>' : ''; ?> 
16
-			<?php printf( __( '%s says on', 'wpshop'), $user_data->user_login ); ?></span> 
15
+			<?php echo (!empty($order_private_comment['send_email']) && $order_private_comment['send_email'] === true) ? '<span class="dashicons dashicons-email-alt"></span>' : ''; ?> 
16
+			<?php printf(__('%s says on', 'wpshop'), $user_data->user_login); ?></span> 
17 17
 			<span class="wps_private_comment_date"><?php echo mysql2date('d F Y H:i:s', $order_private_comment['comment_date'], true); ?></span>
18 18
 		</div>
19 19
 		<div class="wps_private_comment_message"><?php echo $order_private_comment['comment']; ?></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.
templates/backend/product-listing/wps_orders_product_listing_table.php 2 patches
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
  $order_post_meta = !empty($post) ? get_post_meta( $post->ID, '_wpshop_order_status', true ) : ""; ?>
3 5
 <div class="wps-table">
4 6
 	<div class="wps-table-header wps-table-row">
@@ -39,8 +41,11 @@  discard block
 block discarded – undo
39 41
 		<?php endif; ?>
40 42
 	</div>
41 43
 	<?php endforeach; ?>
42
-	<?php else :
43
-	$letter_display = ( strtoupper( $current_letter ) != 'ALL' ) ? $current_letter : __('ALL', 'wpshop' ); ?>
44
+	<?php else {
45
+	:
46
+	$letter_display = ( strtoupper( $current_letter ) != 'ALL' ) ? $current_letter : __('ALL', 'wpshop' );
47
+}
48
+?>
44 49
 	<div class="wps-alert-info"><?php printf( __( 'No products corresponds to the letter <strong>"%s"</strong> search', 'wpshop'), strtoupper( $letter_display ) ); ?></div>
45 50
 	<?php endif; ?>
46 51
 </div>
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,46 +1,46 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
- $order_post_meta = !empty($post) ? get_post_meta( $post->ID, '_wpshop_order_status', true ) : ""; ?>
1
+<?php if (!defined('ABSPATH')) exit;
2
+ $order_post_meta = !empty($post) ? get_post_meta($post->ID, '_wpshop_order_status', true) : ""; ?>
3 3
 <div class="wps-table">
4 4
 	<div class="wps-table-header wps-table-row">
5
-		<div class="wps-table-cell"><?php _e( 'Picture', 'wpshop'); ?></div>
6
-		<div class="wps-table-cell"><?php _e( 'Product reference', 'wpshop'); ?></div>
7
-		<div class="wps-table-cell"><?php _e( 'Product name', 'wpshop'); ?></div>
8
-		<div class="wps-table-cell"><?php _e( 'Price', 'wpshop'); ?></div>
5
+		<div class="wps-table-cell"><?php _e('Picture', 'wpshop'); ?></div>
6
+		<div class="wps-table-cell"><?php _e('Product reference', 'wpshop'); ?></div>
7
+		<div class="wps-table-cell"><?php _e('Product name', 'wpshop'); ?></div>
8
+		<div class="wps-table-cell"><?php _e('Price', 'wpshop'); ?></div>
9 9
 
10
-		<?php if ( 'completed' != $order_post_meta ) : ?>
11
-			<div class="wps-table-cell"><?php _e( 'Quantity', 'wpshop'); ?></div>
12
-			<div class="wps-table-cell"><?php _e( 'Add to order', 'wpshop'); ?></div>
10
+		<?php if ('completed' != $order_post_meta) : ?>
11
+			<div class="wps-table-cell"><?php _e('Quantity', 'wpshop'); ?></div>
12
+			<div class="wps-table-cell"><?php _e('Add to order', 'wpshop'); ?></div>
13 13
 		<?php endif; ?>
14 14
 	</div>
15
-	<?php if( !empty($products) ) : ?>
16
-	<?php foreach ( $products as $product ) :
15
+	<?php if (!empty($products)) : ?>
16
+	<?php foreach ($products as $product) :
17 17
 	$pid = $product->ID;
18 18
 	?>
19
-	<?php $product_metadata = get_post_meta( $product->ID, '_wpshop_product_metadata', true ); ?>
19
+	<?php $product_metadata = get_post_meta($product->ID, '_wpshop_product_metadata', true); ?>
20 20
 	<div class="wps-table-content wps-table-row">
21
-		<div class="wps-table-cell  wps-cart-item-img"><?php echo get_the_post_thumbnail( $product->ID, 'thumbnail' ); ?></div>
22
-		<div class="wps-table-cell"><?php echo ( !empty( $product_metadata) && $product_metadata['product_reference']) ? $product_metadata['product_reference'] : ''; ?></div>
21
+		<div class="wps-table-cell  wps-cart-item-img"><?php echo get_the_post_thumbnail($product->ID, 'thumbnail'); ?></div>
22
+		<div class="wps-table-cell"><?php echo (!empty($product_metadata) && $product_metadata['product_reference']) ? $product_metadata['product_reference'] : ''; ?></div>
23 23
 		<div class="wps-table-cell"><?php echo $product->post_title; ?></div>
24 24
 		<div class="wps-table-cell">
25 25
 		<?php
26 26
 			$product = wpshop_products::get_product_data($product->ID);
27
-			echo wpshop_prices::get_product_price($product, 'price_display', array('mini_output', 'grid') );
27
+			echo wpshop_prices::get_product_price($product, 'price_display', array('mini_output', 'grid'));
28 28
 		?>
29 29
 		</div>
30
-		<?php if ( 'completed' != $order_post_meta ) : ?>
30
+		<?php if ('completed' != $order_post_meta) : ?>
31 31
 			<div class="wps-table-cell">
32 32
 				<a class="wps-bton-icon-minus-small wps-cart-reduce-product-qty" href=""></a>
33 33
 				<input id="wps-cart-product-qty-<?php echo $pid; ?>" class="wps-cart-product-qty" type="text" value="1" name="french-hens" size="3" style="text-align : center">
34 34
 				<a class="wps-bton-icon-plus-small wps-cart-add-product-qty" href=""></a>
35 35
 			</div>
36 36
 			<div class="wps-table-cell">
37
-				<a href="#" data-nonce="<?php echo wp_create_nonce( 'wps_add_product_to_order_admin' ); ?>" class="wps-bton-first-mini-rounded wps-order-add-product" id="wps-order-add-product-<?php echo $pid; ?>"><i class="wps-icon-basket"></i> <?php _e( 'Add to order', 'wpshop'); ?></a>
37
+				<a href="#" data-nonce="<?php echo wp_create_nonce('wps_add_product_to_order_admin'); ?>" class="wps-bton-first-mini-rounded wps-order-add-product" id="wps-order-add-product-<?php echo $pid; ?>"><i class="wps-icon-basket"></i> <?php _e('Add to order', 'wpshop'); ?></a>
38 38
 			</div>
39 39
 		<?php endif; ?>
40 40
 	</div>
41 41
 	<?php endforeach; ?>
42 42
 	<?php else :
43
-	$letter_display = ( strtoupper( $current_letter ) != 'ALL' ) ? $current_letter : __('ALL', 'wpshop' ); ?>
44
-	<div class="wps-alert-info"><?php printf( __( 'No products corresponds to the letter <strong>"%s"</strong> search', 'wpshop'), strtoupper( $letter_display ) ); ?></div>
43
+	$letter_display = (strtoupper($current_letter) != 'ALL') ? $current_letter : __('ALL', 'wpshop'); ?>
44
+	<div class="wps-alert-info"><?php printf(__('No products corresponds to the letter <strong>"%s"</strong> search', 'wpshop'), strtoupper($letter_display)); ?></div>
45 45
 	<?php endif; ?>
46 46
 </div>
Please login to merge, or discard this patch.