Completed
Push — master ( e21aca...50b935 )
by
unknown
13:22
created
includes/librairies/pdf/font/zapfdingbats.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
-$fpdf_charwidths['zapfdingbats']=array(
3
-	chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0,
4
-	chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939,
5
-	','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692,
6
-	'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776,
7
-	'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873,
8
-	'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317,
9
-	chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,
10
-	chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788,
11
-	chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788,
12
-	chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918,
13
-	chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874,
14
-	chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0);
1
+<?php if (!defined('ABSPATH')) exit;
2
+$fpdf_charwidths['zapfdingbats'] = array(
3
+	chr(0)=>0, chr(1)=>0, chr(2)=>0, chr(3)=>0, chr(4)=>0, chr(5)=>0, chr(6)=>0, chr(7)=>0, chr(8)=>0, chr(9)=>0, chr(10)=>0, chr(11)=>0, chr(12)=>0, chr(13)=>0, chr(14)=>0, chr(15)=>0, chr(16)=>0, chr(17)=>0, chr(18)=>0, chr(19)=>0, chr(20)=>0, chr(21)=>0,
4
+	chr(22)=>0, chr(23)=>0, chr(24)=>0, chr(25)=>0, chr(26)=>0, chr(27)=>0, chr(28)=>0, chr(29)=>0, chr(30)=>0, chr(31)=>0, ' '=>278, '!'=>974, '"'=>961, '#'=>974, '$'=>980, '%'=>719, '&'=>789, '\''=>790, '('=>791, ')'=>690, '*'=>960, '+'=>939,
5
+	','=>549, '-'=>855, '.'=>911, '/'=>933, '0'=>911, '1'=>945, '2'=>974, '3'=>755, '4'=>846, '5'=>762, '6'=>761, '7'=>571, '8'=>677, '9'=>763, ':'=>760, ';'=>759, '<'=>754, '='=>494, '>'=>552, '?'=>537, '@'=>577, 'A'=>692,
6
+	'B'=>786, 'C'=>788, 'D'=>788, 'E'=>790, 'F'=>793, 'G'=>794, 'H'=>816, 'I'=>823, 'J'=>789, 'K'=>841, 'L'=>823, 'M'=>833, 'N'=>816, 'O'=>831, 'P'=>923, 'Q'=>744, 'R'=>723, 'S'=>749, 'T'=>790, 'U'=>792, 'V'=>695, 'W'=>776,
7
+	'X'=>768, 'Y'=>792, 'Z'=>759, '['=>707, '\\'=>708, ']'=>682, '^'=>701, '_'=>826, '`'=>815, 'a'=>789, 'b'=>789, 'c'=>707, 'd'=>687, 'e'=>696, 'f'=>689, 'g'=>786, 'h'=>787, 'i'=>713, 'j'=>791, 'k'=>785, 'l'=>791, 'm'=>873,
8
+	'n'=>761, 'o'=>762, 'p'=>762, 'q'=>759, 'r'=>759, 's'=>892, 't'=>892, 'u'=>788, 'v'=>784, 'w'=>438, 'x'=>138, 'y'=>277, 'z'=>415, '{'=>392, '|'=>392, '}'=>668, '~'=>668, chr(127)=>0, chr(128)=>390, chr(129)=>390, chr(130)=>317, chr(131)=>317,
9
+	chr(132)=>276, chr(133)=>276, chr(134)=>509, chr(135)=>509, chr(136)=>410, chr(137)=>410, chr(138)=>234, chr(139)=>234, chr(140)=>334, chr(141)=>334, chr(142)=>0, chr(143)=>0, chr(144)=>0, chr(145)=>0, chr(146)=>0, chr(147)=>0, chr(148)=>0, chr(149)=>0, chr(150)=>0, chr(151)=>0, chr(152)=>0, chr(153)=>0,
10
+	chr(154)=>0, chr(155)=>0, chr(156)=>0, chr(157)=>0, chr(158)=>0, chr(159)=>0, chr(160)=>0, chr(161)=>732, chr(162)=>544, chr(163)=>544, chr(164)=>910, chr(165)=>667, chr(166)=>760, chr(167)=>760, chr(168)=>776, chr(169)=>595, chr(170)=>694, chr(171)=>626, chr(172)=>788, chr(173)=>788, chr(174)=>788, chr(175)=>788,
11
+	chr(176)=>788, chr(177)=>788, chr(178)=>788, chr(179)=>788, chr(180)=>788, chr(181)=>788, chr(182)=>788, chr(183)=>788, chr(184)=>788, chr(185)=>788, chr(186)=>788, chr(187)=>788, chr(188)=>788, chr(189)=>788, chr(190)=>788, chr(191)=>788, chr(192)=>788, chr(193)=>788, chr(194)=>788, chr(195)=>788, chr(196)=>788, chr(197)=>788,
12
+	chr(198)=>788, chr(199)=>788, chr(200)=>788, chr(201)=>788, chr(202)=>788, chr(203)=>788, chr(204)=>788, chr(205)=>788, chr(206)=>788, chr(207)=>788, chr(208)=>788, chr(209)=>788, chr(210)=>788, chr(211)=>788, chr(212)=>894, chr(213)=>838, chr(214)=>1016, chr(215)=>458, chr(216)=>748, chr(217)=>924, chr(218)=>748, chr(219)=>918,
13
+	chr(220)=>927, chr(221)=>928, chr(222)=>928, chr(223)=>834, chr(224)=>873, chr(225)=>828, chr(226)=>924, chr(227)=>924, chr(228)=>917, chr(229)=>930, chr(230)=>931, chr(231)=>463, chr(232)=>883, chr(233)=>836, chr(234)=>836, chr(235)=>867, chr(236)=>867, chr(237)=>696, chr(238)=>696, chr(239)=>874, chr(240)=>0, chr(241)=>874,
14
+	chr(242)=>760, chr(243)=>946, chr(244)=>771, chr(245)=>865, chr(246)=>771, chr(247)=>888, chr(248)=>967, chr(249)=>888, chr(250)=>831, chr(251)=>873, chr(252)=>927, chr(253)=>970, chr(254)=>918, chr(255)=>0);
15 15
 ?>
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
 $fpdf_charwidths['zapfdingbats']=array(
3 5
 	chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0,
4 6
 	chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939,
Please login to merge, or discard this patch.
includes/librairies/display/form_management.class.php 3 patches
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 /*	Check if file is include. No direct access possible with file url	*/
4 6
 if ( !defined( 'WPSHOP_VERSION' ) ) {
@@ -63,8 +65,10 @@  discard block
 block discarded – undo
63 65
 			}
64 66
 			$message .= '</ul></div>';
65 67
 			return $message;
66
-		else :
68
+		else {
69
+			:
67 70
 			return null;
71
+		}
68 72
 		endif;
69 73
 	}
70 74
 
@@ -96,8 +100,7 @@  discard block
 block discarded – undo
96 100
 						$email_exist = email_exists($value);
97 101
 						if(!is_email($value)) {
98 102
 							$this->add_error(sprintf(__('The field "%s" is incorrect','wpshop'),$attribute_definition['label']));
99
-						}
100
-						elseif ( empty($from) && (($user_id > 0 && !empty($email_exist) && $email_exist !== $user_id) || (!empty($email_exist) && $user_id <= 0)) ) {
103
+						} elseif ( empty($from) && (($user_id > 0 && !empty($email_exist) && $email_exist !== $user_id) || (!empty($email_exist) && $user_id <= 0)) ) {
101 104
 							$this->add_error(__('An account is already registered with your email address. Please login.', 'wpshop'));
102 105
 						}
103 106
 					break;
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,43 +26,43 @@  discard block
 block discarded – undo
26 26
 	var $filters = array(); // Stores store filters
27 27
 
28 28
 	/**
29
-	* Add an error
30
-	*/
29
+	 * Add an error
30
+	 */
31 31
 	function add_error( $error ) {
32 32
 		$this->errors[] = $error;
33 33
 	}
34 34
 
35 35
 	/**
36
-	* Add a message
37
-	*/
36
+	 * Add a message
37
+	 */
38 38
 	function add_message( $message ) {
39 39
 		$this->messages[] = $message;
40 40
 	}
41 41
 
42 42
 		/**
43
-		* Add a filter
44
-		*/
43
+		 * Add a filter
44
+		 */
45 45
 		function add_filter( $attribute_frontend_verification, $function ) {
46 46
 			$this->filters[$attribute_frontend_verification] = $function;
47 47
 		}
48 48
 
49 49
 	/**
50
-	* Get error count
51
-	*/
50
+	 * Get error count
51
+	 */
52 52
 	function error_count() {
53 53
 		return sizeof($this->errors);
54 54
 	}
55 55
 
56 56
 	/**
57
-	* Get message count
58
-	*/
57
+	 * Get message count
58
+	 */
59 59
 	function message_count() {
60 60
 		return sizeof($this->messages);
61 61
 	}
62 62
 
63 63
 	/**
64
-	* Output the errors and messages
65
-	*/
64
+	 * Output the errors and messages
65
+	 */
66 66
 	function show_messages() {
67 67
 		if (!empty($this->errors) && $this->error_count()>0) :
68 68
 			$message = '<div class="error_bloc">'.__('Errors were detected', 'wpshop').' :<ul>';
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	}
78 78
 
79 79
 	/** Valide les champs d'un formlaire
80
-	* @param array $array : Champs a lire
81
-	* @return boolean
82
-	*/
80
+	 * @param array $array : Champs a lire
81
+	 * @return boolean
82
+	 */
83 83
 	function validateForm($array, $values = array(), $from = '', $partial = false, $user = 0) {
84 84
 
85 85
 
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 /*	Check if file is include. No direct access possible with file url	*/
4
-if ( !defined( 'WPSHOP_VERSION' ) ) {
5
-	die( __('Access is not allowed by this way', 'wpshop') );
4
+if (!defined('WPSHOP_VERSION')) {
5
+	die(__('Access is not allowed by this way', 'wpshop'));
6 6
 }
7 7
 
8 8
 /**
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	* Add an error
30 30
 	*/
31
-	function add_error( $error ) {
31
+	function add_error($error) {
32 32
 		$this->errors[] = $error;
33 33
 	}
34 34
 
35 35
 	/**
36 36
 	* Add a message
37 37
 	*/
38
-	function add_message( $message ) {
38
+	function add_message($message) {
39 39
 		$this->messages[] = $message;
40 40
 	}
41 41
 
42 42
 		/**
43 43
 		* Add a filter
44 44
 		*/
45
-		function add_filter( $attribute_frontend_verification, $function ) {
45
+		function add_filter($attribute_frontend_verification, $function) {
46 46
 			$this->filters[$attribute_frontend_verification] = $function;
47 47
 		}
48 48
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	* Output the errors and messages
65 65
 	*/
66 66
 	function show_messages() {
67
-		if (!empty($this->errors) && $this->error_count()>0) :
68
-			$message = '<div class="error_bloc">'.__('Errors were detected', 'wpshop').' :<ul>';
69
-			foreach($this->errors as $e) {
70
-				$message .= '<li>'.$e.'</li>';
67
+		if (!empty($this->errors) && $this->error_count() > 0) :
68
+			$message = '<div class="error_bloc">' . __('Errors were detected', 'wpshop') . ' :<ul>';
69
+			foreach ($this->errors as $e) {
70
+				$message .= '<li>' . $e . '</li>';
71 71
 			}
72 72
 			$message .= '</ul></div>';
73 73
 			return $message;
@@ -83,42 +83,42 @@  discard block
 block discarded – undo
83 83
 	function validateForm($array, $values = array(), $from = '', $partial = false, $user = 0) {
84 84
 
85 85
 
86
-		$user_id = empty( $user ) ? get_current_user_id() : $user;
87
-		foreach($array as $attribute_id => $attribute_definition):
88
-			$values_array = !empty($values) ? $values : (array) $_POST['attribute'];
89
-			$value = ( !empty($values_array[$attribute_definition['data_type']][$attribute_definition['name']]) ) ? $values_array[$attribute_definition['data_type']][$attribute_definition['name']] : '';
86
+		$user_id = empty($user) ? get_current_user_id() : $user;
87
+		foreach ($array as $attribute_id => $attribute_definition):
88
+			$values_array = !empty($values) ? $values : (array)$_POST['attribute'];
89
+			$value = (!empty($values_array[$attribute_definition['data_type']][$attribute_definition['name']])) ? $values_array[$attribute_definition['data_type']][$attribute_definition['name']] : '';
90 90
 
91 91
 			// Si le champ est obligatoire
92
-			if ( empty($value) && ($attribute_definition['required'] == 'yes') ) {
93
-				$this->add_error(sprintf(__('The field "%s" is required','wpshop'),__( $attribute_definition['label'], 'wpshop' ) ));
92
+			if (empty($value) && ($attribute_definition['required'] == 'yes')) {
93
+				$this->add_error(sprintf(__('The field "%s" is required', 'wpshop'), __($attribute_definition['label'], 'wpshop')));
94 94
 			}
95
-			if( $partial == false && $attribute_definition['_need_verification'] == 'yes'  ) {
96
-				$value2 = $values_array[$attribute_definition['data_type']][$attribute_definition['name'].'2'];
97
-				if ( $value != $value2) {
98
-					$this->add_error(sprintf(__('The  "%s" confirmation is incorrect','wpshop'),__($attribute_definition['label'], 'wpshop') ));
95
+			if ($partial == false && $attribute_definition['_need_verification'] == 'yes') {
96
+				$value2 = $values_array[$attribute_definition['data_type']][$attribute_definition['name'] . '2'];
97
+				if ($value != $value2) {
98
+					$this->add_error(sprintf(__('The  "%s" confirmation is incorrect', 'wpshop'), __($attribute_definition['label'], 'wpshop')));
99 99
 				}
100 100
 			}
101
-			if(!empty($value) && !empty($attribute_definition['type'])) {
102
-				switch($attribute_definition['frontend_verification']) {
101
+			if (!empty($value) && !empty($attribute_definition['type'])) {
102
+				switch ($attribute_definition['frontend_verification']) {
103 103
 					case 'email':
104 104
 						$email_exist = email_exists($value);
105
-						if(!is_email($value)) {
106
-							$this->add_error(sprintf(__('The field "%s" is incorrect','wpshop'),$attribute_definition['label']));
105
+						if (!is_email($value)) {
106
+							$this->add_error(sprintf(__('The field "%s" is incorrect', 'wpshop'), $attribute_definition['label']));
107 107
 						}
108
-						elseif ( empty($from) && (($user_id > 0 && !empty($email_exist) && $email_exist !== $user_id) || (!empty($email_exist) && $user_id <= 0)) ) {
108
+						elseif (empty($from) && (($user_id > 0 && !empty($email_exist) && $email_exist !== $user_id) || (!empty($email_exist) && $user_id <= 0))) {
109 109
 							$this->add_error(__('An account is already registered with your email address. Please login.', 'wpshop'));
110 110
 						}
111 111
 					break;
112 112
 
113 113
 					case 'postcode':
114
-						if(!wpshop_tools::is_postcode($value)) {
115
-							$this->add_error(sprintf(__('The field "%s" is incorrect','wpshop'),__( $attribute_definition['label'], 'wpshop' ) ));
114
+						if (!wpshop_tools::is_postcode($value)) {
115
+							$this->add_error(sprintf(__('The field "%s" is incorrect', 'wpshop'), __($attribute_definition['label'], 'wpshop')));
116 116
 						}
117 117
 					break;
118 118
 
119 119
 					case 'phone':
120
-						if(!wpshop_tools::is_phone($value)) {
121
-							$this->add_error(sprintf(__('The field "%s" is incorrect','wpshop'), __( $attribute_definition['label'], 'wpshop' ) ));
120
+						if (!wpshop_tools::is_phone($value)) {
121
+							$this->add_error(sprintf(__('The field "%s" is incorrect', 'wpshop'), __($attribute_definition['label'], 'wpshop')));
122 122
 						}
123 123
 					break;
124 124
 
@@ -126,22 +126,22 @@  discard block
 block discarded – undo
126 126
 						$username_exists = username_exists($value);
127 127
 						// On s'assure que le nom d'utilisateur est libre
128 128
 						if (!validate_username($value)) :
129
-							$this->add_error( __('Invalid email/username.', 'wpshop') );
130
-						elseif ( ($user_id > 0) && !empty($username_exists) && ($username_exists !== $user_id) || !empty($username_exists) && ($user_id <= 0) ) :
131
-							$this->add_error( __('An account is already registered with that username. Please choose another.', 'wpshop') );
129
+							$this->add_error(__('Invalid email/username.', 'wpshop'));
130
+						elseif (($user_id > 0) && !empty($username_exists) && ($username_exists !== $user_id) || !empty($username_exists) && ($user_id <= 0)) :
131
+							$this->add_error(__('An account is already registered with that username. Please choose another.', 'wpshop'));
132 132
 						endif;
133 133
 					break;
134 134
 				}
135 135
 				if (array_key_exists($attribute_definition['name'], $this->filters) && is_callable($this->filters[$attribute_definition['name']])) {
136 136
 					$validation = call_user_func($this->filters[$attribute_definition['name']], $value);
137
-					if( !filter_var($validation, FILTER_VALIDATE_BOOLEAN) ) {
138
-						$this->add_error( $validation );
137
+					if (!filter_var($validation, FILTER_VALIDATE_BOOLEAN)) {
138
+						$this->add_error($validation);
139 139
 					}
140 140
 				}
141 141
 			}
142 142
 		endforeach;
143 143
 
144
-		return ($this->error_count()==0);
144
+		return ($this->error_count() == 0);
145 145
 	}
146 146
 
147 147
 }
Please login to merge, or discard this patch.
includes/librairies/notices.class.php 2 patches
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
 /*	Check if file is include. No direct access possible with file url	*/
3 5
 if ( !defined( 'WPSHOP_VERSION' ) ) {
4 6
 	die( __('Access is not allowed by this way', 'wpshop') );
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 /*	Check if file is include. No direct access possible with file url	*/
3
-if ( !defined( 'WPSHOP_VERSION' ) ) {
4
-	die( __('Access is not allowed by this way', 'wpshop') );
3
+if (!defined('WPSHOP_VERSION')) {
4
+	die(__('Access is not allowed by this way', 'wpshop'));
5 5
 }
6 6
 
7 7
 /**
@@ -19,36 +19,36 @@  discard block
 block discarded – undo
19 19
 * @package wpshop
20 20
 * @subpackage librairies
21 21
 */
22
-class wpshop_notices{
22
+class wpshop_notices {
23 23
 
24 24
 	/** Notice the user to install the plugin */
25 25
 	public static function sale_shop_notice() {
26
-		$plug_version = substr( WPSHOP_VERSION, 0, 5 );
26
+		$plug_version = substr(WPSHOP_VERSION, 0, 5);
27 27
 
28 28
 
29
-		$notice_display_user_option = get_user_meta( get_current_user_id(), '_wps_hide_notice_messages_indicator', true);
29
+		$notice_display_user_option = get_user_meta(get_current_user_id(), '_wps_hide_notice_messages_indicator', true);
30 30
 
31 31
 		$notice = '';
32 32
 		$messages_to_hide = '';
33 33
 		/* Check that the user has already choose a payment method */
34
-		$paymentMethod = get_option( 'wps_payment_mode' );
34
+		$paymentMethod = get_option('wps_payment_mode');
35 35
 		$no_payment_mode_configurated = true;
36
-		if ( !empty($paymentMethod ) && !empty($paymentMethod['mode']) ) {
37
-			foreach( $paymentMethod['mode'] as $k => $pm ) {
38
-				if ( !empty($pm['active'] ) ) {
36
+		if (!empty($paymentMethod) && !empty($paymentMethod['mode'])) {
37
+			foreach ($paymentMethod['mode'] as $k => $pm) {
38
+				if (!empty($pm['active'])) {
39 39
 					$no_payment_mode_configurated = false;
40 40
 				}
41 41
 			}
42 42
 		}
43 43
 
44
-		if( $no_payment_mode_configurated ) {
45
-			$notice .= '<li>' . __('Payment method are missing', 'wpshop') . '&nbsp;<a href="' . admin_url('options-general.php?page='.WPSHOP_URL_SLUG_OPTION.'#wpshop_payments_option') . '" class="button-primary wpshop_missing_parameters_button" >' . __('Choose a payment method', 'wpshop') . '</a></li>';
44
+		if ($no_payment_mode_configurated) {
45
+			$notice .= '<li>' . __('Payment method are missing', 'wpshop') . '&nbsp;<a href="' . admin_url('options-general.php?page=' . WPSHOP_URL_SLUG_OPTION . '#wpshop_payments_option') . '" class="button-primary wpshop_missing_parameters_button" >' . __('Choose a payment method', 'wpshop') . '</a></li>';
46 46
 		}
47 47
 
48 48
 		/* Check that the user has already choose a payment method */
49 49
 		$emails = get_option('wpshop_emails', array());
50
-		if(empty($emails)) {
51
-			$notice .= '<li>' . __('Shop emails are misssing', 'wpshop') . '&nbsp;<a href="' . admin_url('options-general.php?page='.WPSHOP_URL_SLUG_OPTION.'#wpshop_emails_option') . '" class="button-primary wpshop_missing_parameters_button" >' . __('Configure shop emails', 'wpshop') . '</a></li>';
50
+		if (empty($emails)) {
51
+			$notice .= '<li>' . __('Shop emails are misssing', 'wpshop') . '&nbsp;<a href="' . admin_url('options-general.php?page=' . WPSHOP_URL_SLUG_OPTION . '#wpshop_emails_option') . '" class="button-primary wpshop_missing_parameters_button" >' . __('Configure shop emails', 'wpshop') . '</a></li>';
52 52
 		}
53 53
 
54 54
 
@@ -58,20 +58,20 @@  discard block
 block discarded – undo
58 58
 			$messages_to_hide .= 'SLICKSHOP,';
59 59
 		}*/
60 60
 
61
-		$install = !empty( $_GET[ 'install' ] ) ? sanitize_text_field( $_GET[ 'install' ] ) : '';
61
+		$install = !empty($_GET['install']) ? sanitize_text_field($_GET['install']) : '';
62 62
 
63
-		if(!empty($notice) && ( empty( $install ) ) ) {
64
-			$notice='<p>'.__('You configure your shop to be a sale shop. But some configuration are missing for this type of shop using', 'wpshop').'</p><ul>'.$notice.'</ul>';
65
-			if ( !empty($messages_to_hide) ) {
66
-				$notice .= '<button data-nonce="' . wp_create_nonce( 'wps_hide_notice_messages' ) . '" class="wps_hide_notice_message button-secondary" id="wps_hide_notice_message">' .__('Hide this message', 'wpshop'). '</button>';
67
-				$notice .= '<input type="hidden" id="hide_messages_indicator" value="' .$messages_to_hide. '"/>';
63
+		if (!empty($notice) && (empty($install))) {
64
+			$notice = '<p>' . __('You configure your shop to be a sale shop. But some configuration are missing for this type of shop using', 'wpshop') . '</p><ul>' . $notice . '</ul>';
65
+			if (!empty($messages_to_hide)) {
66
+				$notice .= '<button data-nonce="' . wp_create_nonce('wps_hide_notice_messages') . '" class="wps_hide_notice_message button-secondary" id="wps_hide_notice_message">' . __('Hide this message', 'wpshop') . '</button>';
67
+				$notice .= '<input type="hidden" id="hide_messages_indicator" value="' . $messages_to_hide . '"/>';
68 68
 			}
69 69
 			self::admin_notice_container($notice, 'wpshop_shop_sale_type_notice');
70 70
 		}
71 71
 	}
72 72
 
73 73
 	/**		*/
74
-	public static function admin_notice_container($message, $container_class = ''){
74
+	public static function admin_notice_container($message, $container_class = '') {
75 75
 		?>
76 76
 		<div class="updated wpshop_admin_notice <?php echo $container_class; ?>" id="<?php echo $container_class; ?>" >
77 77
 			<h3><?php _e('Configure my shop', 'wpshop') ?></h3>
Please login to merge, or discard this patch.
includes/librairies/payments/payment.class.php 4 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 
219 219
 
220 220
 	/**
221
-	* Reduce the stock regarding the order
222
-	*/
221
+	 * Reduce the stock regarding the order
222
+	 */
223 223
 	function the_order_payment_is_completed($order_id, $txn_id = null) {
224 224
 		// Donnees commandes
225 225
 		$order = get_post_meta($order_id, '_order_postmeta', true);
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 	}
294 294
 
295 295
 	/**
296
-	* Get payment method
297
-	*/
296
+	 * Get payment method
297
+	 */
298 298
 	function get_payment_method($post_id){
299 299
 		$pm = __('Nc','wpshop');
300 300
 		$order_postmeta = get_post_meta($post_id, '_order_postmeta', true);
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
 	}
322 322
 
323 323
 	/**
324
-	* Set payment transaction number
325
-	*/
324
+	 * Set payment transaction number
325
+	 */
326 326
 	function display_payment_receiver_interface($post_id) {
327 327
 		$payment_validation = '';
328 328
 		$display_button = false;
Please login to merge, or discard this patch.
Doc Comments   +10 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,6 +38,10 @@  discard block
 block discarded – undo
38 38
 		return $url;
39 39
 	}
40 40
 
41
+	/**
42
+	 * @param string $param
43
+	 * @param string $value
44
+	 */
41 45
 	public static function construct_url_parameters($url, $param, $value) {
42 46
 		$interoguation_marker_pos = strpos($url, '?');
43 47
 		if($interoguation_marker_pos===false)
@@ -86,7 +90,7 @@  discard block
 block discarded – undo
86 90
 	 * Display the list of payment methods available
87 91
 	 *
88 92
 	 * @param integer $order_id The order id if existing - Useful when user does not finish its order and want to validateit later
89
-	 * @return string The different payment method
93
+	 * @return string[] The different payment method
90 94
 	 */
91 95
 	function __display_payment_methods_choice_form($order_id=0, $cart_type = 'cart') {
92 96
 		$output = '';
@@ -250,6 +254,9 @@  discard block
 block discarded – undo
250 254
 	}
251 255
 
252 256
 
257
+	/**
258
+	 * @param string|null $payment_status
259
+	 */
253 260
 	function setOrderPaymentStatus( $order_id, $payment_status ) {
254 261
 		/**	Get order main information	*/
255 262
 		$order = get_post_meta($order_id, '_order_postmeta', true);
@@ -377,7 +384,7 @@  discard block
 block discarded – undo
377 384
 	 * Allows to inform customer that he would pay a partial amount on this order
378 385
 	 *
379 386
 	 * @param float $current_order_total The current order total to pay before partial amount calcul
380
-	 * @return array The amount to pay / A html output with amount to pay and different information
387
+	 * @return string The amount to pay / A html output with amount to pay and different information
381 388
 	 */
382 389
 	function partial_payment_calcul( $current_order_total, $for = 'for_all' ) {
383 390
 		$output = '';
@@ -482,6 +489,7 @@  discard block
 block discarded – undo
482 489
 	 * @param array $order_meta The complete order meta informations
483 490
 	 * @param integer $payment_index The payment to add/update data for
484 491
 	 * @param array $params : infos sended by the bank, array structure : ('method', 'waited amount', 'status', 'author', 'payment reference', 'date', 'received amount')
492
+	 * @param integer $order_id
485 493
 	 * @return array The order new meta informations
486 494
 	 */
487 495
 	public static function add_new_payment_to_order( $order_id, $order_meta, $payment_index, $params, $bank_response ) {
Please login to merge, or discard this patch.
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 /*	Check if file is include. No direct access possible with file url	*/
4
-if ( !defined( 'WPSHOP_VERSION' ) ) {
5
-	die( __('Access is not allowed by this way', 'wpshop') );
4
+if (!defined('WPSHOP_VERSION')) {
5
+	die(__('Access is not allowed by this way', 'wpshop'));
6 6
 }
7 7
 
8 8
 /**
@@ -20,29 +20,29 @@  discard block
 block discarded – undo
20 20
 
21 21
 		$wpshop_paypal = new wpshop_paypal();
22 22
 		// If the CIC payment method is active
23
-		$wpshop_paymentMethod = get_option( 'wps_payment_mode' );
24
-		if(WPSHOP_PAYMENT_METHOD_CIC && ( !empty($wpshop_paymentMethod['mode']) && !empty($wpshop_paymentMethod['mode']['cic']) && !empty($wpshop_paymentMethod['mode']['cic']['active']) ) ) {
23
+		$wpshop_paymentMethod = get_option('wps_payment_mode');
24
+		if (WPSHOP_PAYMENT_METHOD_CIC && (!empty($wpshop_paymentMethod['mode']) && !empty($wpshop_paymentMethod['mode']['cic']) && !empty($wpshop_paymentMethod['mode']['cic']['active']))) {
25 25
 			$wpshop_cic = new wpshop_CIC();
26 26
 		}
27
-		wpshop_tools::create_custom_hook ('wpshop_bankserver_reponse');
27
+		wpshop_tools::create_custom_hook('wpshop_bankserver_reponse');
28 28
 
29 29
 	}
30 30
 
31 31
 	public static function get_success_payment_url() {
32
-		$url = get_permalink( wpshop_tools::get_page_id( get_option('wpshop_payment_return_page_id') ) );
32
+		$url = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_payment_return_page_id')));
33 33
 		return self::construct_url_parameters($url, 'paymentResult', 'success');
34 34
 	}
35 35
 
36 36
 	public static function get_cancel_payment_url() {
37
-		$url = get_permalink( wpshop_tools::get_page_id( get_option('wpshop_payment_return_nok_page_id') ) );
37
+		$url = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_payment_return_nok_page_id')));
38 38
 		return $url;
39 39
 	}
40 40
 
41 41
 	public static function construct_url_parameters($url, $param, $value) {
42 42
 		$interoguation_marker_pos = strpos($url, '?');
43
-		if($interoguation_marker_pos===false)
44
-			return $url.'?'.$param.'='.$value;
45
-		else return $url.'&'.$param.'='.$value;
43
+		if ($interoguation_marker_pos === false)
44
+			return $url . '?' . $param . '=' . $value;
45
+		else return $url . '&' . $param . '=' . $value;
46 46
 	}
47 47
 
48 48
 	/**
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
 	public static function wpshop_payment_result() {
52 52
 		global $wpdb;
53 53
 		$user_ID = get_current_user_id();
54
-		$query = $wpdb->prepare('SELECT MAX(ID) FROM ' .$wpdb->posts. ' WHERE post_type = %s AND post_author = %d', WPSHOP_NEWTYPE_IDENTIFIER_ORDER, $user_ID);
55
-		$order_post_id = $wpdb->get_var( $query );
56
-		if ( !empty($order_post_id) ) {
57
-			$order_postmeta = get_post_meta($order_post_id , '_wpshop_order_status', true);
58
-			if ( !empty($order_postmeta) ) {
59
-				switch ( $order_postmeta ) {
54
+		$query = $wpdb->prepare('SELECT MAX(ID) FROM ' . $wpdb->posts . ' WHERE post_type = %s AND post_author = %d', WPSHOP_NEWTYPE_IDENTIFIER_ORDER, $user_ID);
55
+		$order_post_id = $wpdb->get_var($query);
56
+		if (!empty($order_post_id)) {
57
+			$order_postmeta = get_post_meta($order_post_id, '_wpshop_order_status', true);
58
+			if (!empty($order_postmeta)) {
59
+				switch ($order_postmeta) {
60 60
 					case 'awaiting_payment':
61
-						echo __('We wait your payment.','wpshop');
61
+						echo __('We wait your payment.', 'wpshop');
62 62
 					break;
63 63
 					case 'completed':
64
-						echo __('Thank you ! Your payment has been recorded.','wpshop');
64
+						echo __('Thank you ! Your payment has been recorded.', 'wpshop');
65 65
 					break;
66 66
 					case 'partially_paid':
67
-						echo __('Thank you ! Your first payment has been recorded.','wpshop');
67
+						echo __('Thank you ! Your first payment has been recorded.', 'wpshop');
68 68
 					break;
69 69
 					default:
70
-						echo __('Your payment and your order has been cancelled.','wpshop');
70
+						echo __('Your payment and your order has been cancelled.', 'wpshop');
71 71
 					break;
72 72
 				}
73 73
 			}
@@ -88,56 +88,56 @@  discard block
 block discarded – undo
88 88
 	 * @param integer $order_id The order id if existing - Useful when user does not finish its order and want to validateit later
89 89
 	 * @return string The different payment method
90 90
 	 */
91
-	function __display_payment_methods_choice_form($order_id=0, $cart_type = 'cart') {
91
+	function __display_payment_methods_choice_form($order_id = 0, $cart_type = 'cart') {
92 92
 		$output = '';
93 93
 		/**	Get available payment method	*/
94 94
 		$paymentMethod = get_option('wpshop_paymentMethod', array());
95 95
 
96
-		if(!empty($order_id) && is_numeric($order_id)) {
97
-			$output .= '<input type="hidden" name="order_id" value="'.$order_id.'" />';
96
+		if (!empty($order_id) && is_numeric($order_id)) {
97
+			$output .= '<input type="hidden" name="order_id" value="' . $order_id . '" />';
98 98
 		}
99 99
 
100 100
 		if ($cart_type == 'cart') {
101 101
 			$payment_methods = array();
102
-			if(!empty($paymentMethod['paypal'])) {
102
+			if (!empty($paymentMethod['paypal'])) {
103 103
 				$payment_methods['paypal'] = array('payment_method_name' => __('CB with Paypal', 'wpshop'),
104 104
 														'payment_method_icon' => WPSHOP_TEMPLATES_URL . 'wpshop/medias/paypal.png',
105
-														'payment_method_explanation' => __('<strong>Tips</strong> : If you have a Paypal account, by choosing this payment method, you will be redirected to the secure payment site Paypal to make your payment. Debit your PayPal account, immediate booking products.','wpshop')
105
+														'payment_method_explanation' => __('<strong>Tips</strong> : If you have a Paypal account, by choosing this payment method, you will be redirected to the secure payment site Paypal to make your payment. Debit your PayPal account, immediate booking products.', 'wpshop')
106 106
 								 );
107 107
 			}
108
-			if(!empty($paymentMethod['checks'])) {
108
+			if (!empty($paymentMethod['checks'])) {
109 109
 				$payment_methods['check'] = array('payment_method_name' => __('Check', 'wpshop'),
110 110
 						'payment_method_icon' => WPSHOP_TEMPLATES_URL . 'wpshop/medias/cheque.png',
111
-						'payment_method_explanation' => __('Reservation of products upon receipt of the check.','wpshop')
111
+						'payment_method_explanation' => __('Reservation of products upon receipt of the check.', 'wpshop')
112 112
 				);
113 113
 			}
114
-			if(!empty($paymentMethod['banktransfer'])) {
114
+			if (!empty($paymentMethod['banktransfer'])) {
115 115
 				$payment_methods['banktransfer'] = array('payment_method_name' => __('Bank transfer', 'wpshop'),
116 116
 						'payment_method_icon' => WPSHOP_TEMPLATES_URL . 'wpshop/medias/cheque.png',
117
-						'payment_method_explanation' =>__('Reservation of product receipt of payment.','wpshop')
117
+						'payment_method_explanation' =>__('Reservation of product receipt of payment.', 'wpshop')
118 118
 				);
119 119
 			}
120
-			if(WPSHOP_PAYMENT_METHOD_CIC || !empty($paymentMethod['cic'])) {
120
+			if (WPSHOP_PAYMENT_METHOD_CIC || !empty($paymentMethod['cic'])) {
121 121
 				$payment_methods['cic'] = array('payment_method_name' =>__('Credit card', 'wpshop'),
122 122
 						'payment_method_icon' => WPSHOP_TEMPLATES_URL . 'wpshop/medias/cic_payment_logo.jpg',
123
-						'payment_method_explanation' =>__('Reservation of products upon confirmation of payment.','wpshop')
123
+						'payment_method_explanation' =>__('Reservation of products upon confirmation of payment.', 'wpshop')
124 124
 				);
125 125
 			}
126 126
 			$payment_methods = apply_filters('wpshop_payment_method', $payment_methods);
127 127
 
128 128
 			$payment_method_table = array();
129 129
 
130
-			if ( !empty( $paymentMethod['display_position'] ) ) {
130
+			if (!empty($paymentMethod['display_position'])) {
131 131
 				$position_determinated = false;
132
-				foreach ( $paymentMethod['display_position'] as $key => $position) {
133
-					if ( $position != null) {
132
+				foreach ($paymentMethod['display_position'] as $key => $position) {
133
+					if ($position != null) {
134 134
 						$position_determinated = true;
135 135
 					}
136 136
 				}
137
-				if ( $position_determinated ) {
138
-					for ( $i = 1; $i < count( $paymentMethod['display_position'] ) + 1; $i++) {
139
-						foreach ( $paymentMethod['display_position'] as $key => $position ) {
140
-							if ( $position == $i  && !empty($paymentMethod[$key])) {
137
+				if ($position_determinated) {
138
+					for ($i = 1; $i < count($paymentMethod['display_position']) + 1; $i++) {
139
+						foreach ($paymentMethod['display_position'] as $key => $position) {
140
+							if ($position == $i && !empty($paymentMethod[$key])) {
141 141
 								if ($key == 'checks') {
142 142
 									$key = 'check';
143 143
 								}
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
 					$payment_methods = $payment_method_table;
149 149
 				}
150 150
 			}
151
-			if (!empty($payment_methods) ) {
151
+			if (!empty($payment_methods)) {
152 152
 
153
-				foreach( $payment_methods as  $payment_method_identifier =>  $payment_method_def ) {
153
+				foreach ($payment_methods as  $payment_method_identifier =>  $payment_method_def) {
154 154
 					$tpl_component = array();
155 155
 					$checked = $active = '';
156 156
 					$payment_identifier_for_test = $payment_method_identifier;
157 157
 					if ($payment_method_identifier == 'check') {
158 158
 						$payment_identifier_for_test = 'checks';
159 159
 					}
160
-					if ( !empty($paymentMethod['default_method']) && $paymentMethod['default_method'] == $payment_identifier_for_test) {
160
+					if (!empty($paymentMethod['default_method']) && $paymentMethod['default_method'] == $payment_identifier_for_test) {
161 161
 						$checked = ' checked="checked"';
162 162
 						$active = ' active';
163 163
 
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 					$tpl_component['CHECKOUT_PAYMENT_METHOD_STATE_CLASS'] = $active;
166 166
 					$tpl_component['CHECKOUT_PAYMENT_METHOD_INPUT_STATE'] = $checked;
167 167
 					$tpl_component['CHECKOUT_PAYMENT_METHOD_IDENTIFIER'] = $payment_method_identifier;
168
-					if ( !empty($payment_mode['logo']) && (int)$payment_mode['logo'] != 0 ) {
169
-						$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = ( !empty($payment_method_def['payment_method_icon']) ) ? wp_get_attachment_image( $payment_method_def['payment_method_icon'], 'thumbnail', false, array('class' => 'wps_shipping_mode_logo') ) : '';
168
+					if (!empty($payment_mode['logo']) && (int)$payment_mode['logo'] != 0) {
169
+						$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = (!empty($payment_method_def['payment_method_icon'])) ? wp_get_attachment_image($payment_method_def['payment_method_icon'], 'thumbnail', false, array('class' => 'wps_shipping_mode_logo')) : '';
170 170
 					}
171 171
 					else {
172
-						$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = ( !empty($payment_method_def['payment_method_icon']) ) ? '<img src="' .$payment_method_def['payment_method_icon']. '" alt="" />' : '';
172
+						$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = (!empty($payment_method_def['payment_method_icon'])) ? '<img src="' . $payment_method_def['payment_method_icon'] . '" alt="" />' : '';
173 173
 					}
174 174
 					//$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = $payment_method_def['payment_method_icon'];
175 175
 					$tpl_component['CHECKOUT_PAYMENT_METHOD_NAME'] = $payment_method_def['payment_method_name'];
@@ -180,32 +180,32 @@  discard block
 block discarded – undo
180 180
 			}
181 181
 		}
182 182
 
183
-		return array( $output, $paymentMethod['mode'] );
183
+		return array($output, $paymentMethod['mode']);
184 184
 	}
185 185
 
186 186
 
187
-	public static function display_payment_methods_choice_form($order_id=0, $cart_type = 'cart') {
188
-		$payment_option = get_option( 'wps_payment_mode' );
187
+	public static function display_payment_methods_choice_form($order_id = 0, $cart_type = 'cart') {
188
+		$payment_option = get_option('wps_payment_mode');
189 189
 		$output = '';
190
-		if(!empty($order_id) && is_numeric($order_id)) {
191
-			$output .= '<input type="hidden" name="order_id" value="'.$order_id.'" />';
190
+		if (!empty($order_id) && is_numeric($order_id)) {
191
+			$output .= '<input type="hidden" name="order_id" value="' . $order_id . '" />';
192 192
 		}
193
-		if( $cart_type == 'cart' ) {
194
-			if ( !empty($payment_option) && !empty($payment_option['mode']) ) {
195
-				foreach( $payment_option['mode'] as $payment_id => $payment_config ) {
196
-					if( !empty($payment_config['active']) ) {
197
-						$tpl_component['CHECKOUT_PAYMENT_METHOD_STATE_CLASS'] = ( ( !empty($payment_option['default_choice']) && $payment_option['default_choice'] == $payment_id ) ? ' active' : '');
198
-						$tpl_component['CHECKOUT_PAYMENT_METHOD_INPUT_STATE'] = ( ( !empty($payment_option['default_choice']) && $payment_option['default_choice'] == $payment_id ) ? 'checked="checked"' : '');
193
+		if ($cart_type == 'cart') {
194
+			if (!empty($payment_option) && !empty($payment_option['mode'])) {
195
+				foreach ($payment_option['mode'] as $payment_id => $payment_config) {
196
+					if (!empty($payment_config['active'])) {
197
+						$tpl_component['CHECKOUT_PAYMENT_METHOD_STATE_CLASS'] = ((!empty($payment_option['default_choice']) && $payment_option['default_choice'] == $payment_id) ? ' active' : '');
198
+						$tpl_component['CHECKOUT_PAYMENT_METHOD_INPUT_STATE'] = ((!empty($payment_option['default_choice']) && $payment_option['default_choice'] == $payment_id) ? 'checked="checked"' : '');
199 199
 						$tpl_component['CHECKOUT_PAYMENT_METHOD_IDENTIFIER'] = $payment_id;
200 200
 
201
-						if ( !empty($payment_config['logo']) && (int)$payment_config['logo'] != 0 ) {
202
-							$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = ( !empty($payment_config['logo']) ) ? wp_get_attachment_image( $payment_config['logo'], 'thumbnail', false ) : '';
201
+						if (!empty($payment_config['logo']) && (int)$payment_config['logo'] != 0) {
202
+							$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = (!empty($payment_config['logo'])) ? wp_get_attachment_image($payment_config['logo'], 'thumbnail', false) : '';
203 203
 						}
204 204
 						else {
205
-							$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = ( !empty($payment_config['logo']) ) ? '<img src="' .$payment_config['logo']. '" alt="' .$payment_config['name']. '" />' : '';
205
+							$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = (!empty($payment_config['logo'])) ? '<img src="' . $payment_config['logo'] . '" alt="' . $payment_config['name'] . '" />' : '';
206 206
 						}
207
-						$tpl_component['CHECKOUT_PAYMENT_METHOD_NAME'] = ( !empty($payment_config['name']) ) ? $payment_config['name'] : '';
208
-						$tpl_component['CHECKOUT_PAYMENT_METHOD_EXPLANATION'] = ( !empty($payment_config['description']) ) ? $payment_config['description'] : '';
207
+						$tpl_component['CHECKOUT_PAYMENT_METHOD_NAME'] = (!empty($payment_config['name'])) ? $payment_config['name'] : '';
208
+						$tpl_component['CHECKOUT_PAYMENT_METHOD_EXPLANATION'] = (!empty($payment_config['description'])) ? $payment_config['description'] : '';
209 209
 						$output .= wpshop_display::display_template_element('wpshop_checkout_page_payment_method_bloc', $tpl_component, array('type' => 'payment_method', 'id' => $payment_id));
210 210
 						unset($tpl_component);
211 211
 					}
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$wps_message = new wps_message_ctr();
229 229
 
230
-		if(!empty($order) && !empty($order_info) && empty($order['order_invoice_ref'])) {
231
-			$email = (!empty($order_info['billing']['address']['address_user_email']) ? $order_info['billing']['address']['address_user_email'] : '' );
232
-			$first_name = ( !empty($order_info['billing']['address']['address_first_name']) ? $order_info['billing']['address']['address_first_name'] : '' );
233
-			$last_name = ( !empty($order_info['billing']['address']['address_last_name']) ? $order_info['billing']['address']['address_last_name'] : '' );
230
+		if (!empty($order) && !empty($order_info) && empty($order['order_invoice_ref'])) {
231
+			$email = (!empty($order_info['billing']['address']['address_user_email']) ? $order_info['billing']['address']['address_user_email'] : '');
232
+			$first_name = (!empty($order_info['billing']['address']['address_first_name']) ? $order_info['billing']['address']['address_first_name'] : '');
233
+			$last_name = (!empty($order_info['billing']['address']['address_last_name']) ? $order_info['billing']['address']['address_last_name'] : '');
234 234
 
235 235
 			// Envoie du message de confirmation de paiement au client
236
-			switch($order['payment_method']) {
236
+			switch ($order['payment_method']) {
237 237
 				case 'check':
238 238
 					$wps_message->wpshop_prepared_email($email, 'WPSHOP_OTHERS_PAYMENT_CONFIRMATION_MESSAGE', array('order_key' => $order['order_key'], 'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'order_date' => $order['order_date']));
239 239
 				break;
@@ -250,24 +250,24 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 
253
-	function setOrderPaymentStatus( $order_id, $payment_status ) {
253
+	function setOrderPaymentStatus($order_id, $payment_status) {
254 254
 		/**	Get order main information	*/
255 255
 		$order = get_post_meta($order_id, '_order_postmeta', true);
256 256
 		$send_email = false;
257 257
 
258
-		if ( !empty($order) ) {
258
+		if (!empty($order)) {
259 259
 			/**	Change order status to given status	*/
260 260
 			$order['order_status'] = strtolower($payment_status);
261 261
 			/**	Put order status into a single meta, allowing to use it easily later	*/
262 262
 			update_post_meta($order_id, '_wpshop_order_status', $order['order_status']);
263 263
 
264 264
 			/**	In case the set status is completed, make specific treatment: add the completed date	*/
265
-			if ( $payment_status == 'completed' ) {
265
+			if ($payment_status == 'completed') {
266 266
 				/**	Read order items list, if not empty and check if each item is set to manage stock or not */
267 267
 				if (!empty($order['order_items'])) {
268 268
 					foreach ($order['order_items'] as $o) {
269
-						$product = wpshop_products::get_product_data( $o['item_id'] );
270
-						if (!empty($product) && !empty($product['manage_stock']) && __($product['manage_stock'], 'wpshop') == __('Yes', 'wpshop') ) {
269
+						$product = wpshop_products::get_product_data($o['item_id']);
270
+						if (!empty($product) && !empty($product['manage_stock']) && __($product['manage_stock'], 'wpshop') == __('Yes', 'wpshop')) {
271 271
 							wpshop_products::reduce_product_stock_qty($o['item_id'], $o['item_qty']);
272 272
 						}
273 273
 					}
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 			}
282 282
 
283 283
 			/**	Send email to customer when specific case need it	*/
284
-			if ( $send_email ) {
284
+			if ($send_email) {
285 285
 				/**	Get information about customer that make the order	*/
286 286
 				$order_info = get_post_meta($order_id, '_order_info', true);
287 287
 				$mail_tpl_component = array('order_key' => $order['order_key'], 'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'order_date' => $order['order_date']);
@@ -295,25 +295,25 @@  discard block
 block discarded – undo
295 295
 	/**
296 296
 	* Get payment method
297 297
 	*/
298
-	function get_payment_method($post_id){
299
-		$pm = __('Nc','wpshop');
298
+	function get_payment_method($post_id) {
299
+		$pm = __('Nc', 'wpshop');
300 300
 		$order_postmeta = get_post_meta($post_id, '_order_postmeta', true);
301
-		if ( !empty($order_postmeta['payment_method']) ) {
302
-			switch($order_postmeta['payment_method']){
301
+		if (!empty($order_postmeta['payment_method'])) {
302
+			switch ($order_postmeta['payment_method']) {
303 303
 				case 'check':
304
-					$pm = __('Check','wpshop');
304
+					$pm = __('Check', 'wpshop');
305 305
 				break;
306 306
 				case 'paypal':
307
-					$pm = __('Paypal','wpshop');
307
+					$pm = __('Paypal', 'wpshop');
308 308
 				break;
309 309
 				case 'banktransfer':
310
-					$pm = __('Bank transfer','wpshop');
310
+					$pm = __('Bank transfer', 'wpshop');
311 311
 				break;
312 312
 				case 'cic':
313
-					$pm = __('Credit card','wpshop');
313
+					$pm = __('Credit card', 'wpshop');
314 314
 				break;
315 315
 				default:
316
-					$pm = __('Nc','wpshop');
316
+					$pm = __('Nc', 'wpshop');
317 317
 				break;
318 318
 			}
319 319
 		}
@@ -333,38 +333,38 @@  discard block
 block discarded – undo
333 333
 
334 334
 		$paymentMethod = $paymentMethod['mode'];
335 335
 		$payment_validation .= '
336
-<div id="order_payment_method_'.$post_id.'" class="wpshop_cls wpshopHide" >
337
-	<input type="hidden" id="used_method_payment_'.$post_id.'" value="' . (!empty($order_postmeta['payment_method']) ? $order_postmeta['payment_method'] : 'no_method') . '"/>
338
-	<input type="hidden" id="used_method_payment_transaction_id_'.$post_id.'" value="' . (!empty($transaction_indentifier) ? $transaction_indentifier : 0) . '"/>';
336
+<div id="order_payment_method_'.$post_id . '" class="wpshop_cls wpshopHide" >
337
+	<input type="hidden" id="used_method_payment_'.$post_id . '" value="' . (!empty($order_postmeta['payment_method']) ? $order_postmeta['payment_method'] : 'no_method') . '"/>
338
+	<input type="hidden" id="used_method_payment_transaction_id_'.$post_id . '" value="' . (!empty($transaction_indentifier) ? $transaction_indentifier : 0) . '"/>';
339 339
 
340
-		if(!empty($order_postmeta['payment_method'])){
340
+		if (!empty($order_postmeta['payment_method'])) {
341 341
 			$payment_validation .= sprintf(__('Selected payment method: %s', 'wpshop'), __($order_postmeta['payment_method'], 'wpshop')) . '<br/>';
342 342
 		}
343 343
 
344
-		if(!empty($paymentMethod['paypal']) && empty($order_postmeta['payment_method'])) {
344
+		if (!empty($paymentMethod['paypal']) && empty($order_postmeta['payment_method'])) {
345 345
 			$payment_validation .= '<input type="radio" class="payment_method" name="payment_method" value="paypal" id="payment_method_paypal" /><label for="payment_method_paypal" >' . __('Paypal', 'wpshop') . '</label><br/>';
346 346
 			$display_button = true;
347 347
 		}
348 348
 
349
-		if(!empty($paymentMethod['checks']) && empty($order_postmeta['payment_method'])) {
349
+		if (!empty($paymentMethod['checks']) && empty($order_postmeta['payment_method'])) {
350 350
 			$payment_validation .= '<input type="radio" class="payment_method" name="payment_method" value="check" id="payment_method_check" /><label for="payment_method_check" >' . __('Check', 'wpshop') . '</label><br/>';
351 351
 			$display_button = true;
352 352
 		}
353 353
 
354
-		$wpshop_paymentMethod = get_option( 'wps_payment_mode' );
355
-		if((WPSHOP_PAYMENT_METHOD_CIC || (!empty($wpshop_paymentMethod['mode']) && !empty($wpshop_paymentMethod['mode']['cic'])) ) && empty($order_postmeta['payment_method'])) {
354
+		$wpshop_paymentMethod = get_option('wps_payment_mode');
355
+		if ((WPSHOP_PAYMENT_METHOD_CIC || (!empty($wpshop_paymentMethod['mode']) && !empty($wpshop_paymentMethod['mode']['cic']))) && empty($order_postmeta['payment_method'])) {
356 356
 			$payment_validation .= '<input type="radio" class="payment_method" name="payment_method" value="cb" id="payment_method_cb" /><label for="payment_method_cb" >' . __('Credit card', 'wpshop') . '</label><br/>';
357 357
 			$display_button = true;
358 358
 		}
359 359
 
360
-		if(empty($payment_transaction)){
361
-			$payment_validation .= '<hr/>' . __('Transaction number', 'wpshop') . '&nbsp;:&nbsp;<input type="text" value="" name="payment_method_transaction_number" id="payment_method_transaction_number_'.$post_id.'" />';
360
+		if (empty($payment_transaction)) {
361
+			$payment_validation .= '<hr/>' . __('Transaction number', 'wpshop') . '&nbsp;:&nbsp;<input type="text" value="" name="payment_method_transaction_number" id="payment_method_transaction_number_' . $post_id . '" />';
362 362
 			$display_button = true;
363 363
 		}
364 364
 
365
-		if($display_button){
365
+		if ($display_button) {
366 366
 			$payment_validation .= '
367
-		<br/><br/><a class="button payment_method_validate order_'.$post_id.' wpshop_clear" >'.__('Validate payment method', 'wpshop').'</a>';
367
+		<br/><br/><a class="button payment_method_validate order_'.$post_id . ' wpshop_clear" >' . __('Validate payment method', 'wpshop') . '</a>';
368 368
 		}
369 369
 
370 370
 		$payment_validation .= '
@@ -379,21 +379,21 @@  discard block
 block discarded – undo
379 379
 	 * @param float $current_order_total The current order total to pay before partial amount calcul
380 380
 	 * @return array The amount to pay / A html output with amount to pay and different information
381 381
 	 */
382
-	function partial_payment_calcul( $current_order_total, $for = 'for_all' ) {
382
+	function partial_payment_calcul($current_order_total, $for = 'for_all') {
383 383
 		$output = '';
384 384
 		$tpl_component = array();
385 385
 
386 386
 		/**	Get current configuration	*/
387 387
 		$partial_payment_configuration = get_option('wpshop_payment_partial', array($for => array(), 'for_quotation' => array()));
388
-		if ( !empty($partial_payment_configuration[$for]) && (!empty($partial_payment_configuration[$for]['activate'])) && ($partial_payment_configuration[$for]['activate'] == 'on') ) {
388
+		if (!empty($partial_payment_configuration[$for]) && (!empty($partial_payment_configuration[$for]['activate'])) && ($partial_payment_configuration[$for]['activate'] == 'on')) {
389 389
 			$amount_of_partial_payment = 0;
390
-			if ( !empty($partial_payment_configuration[$for]['value']) && !empty($partial_payment_configuration[$for]['activate']) ) {
390
+			if (!empty($partial_payment_configuration[$for]['value']) && !empty($partial_payment_configuration[$for]['activate'])) {
391 391
 				$amount_of_partial_payment = $partial_payment_configuration[$for]['value'];
392 392
 			}
393 393
 
394 394
 			$partial_amount_to_pay = 0;
395 395
 			$type_of_partial_payment = null;
396
-			if (!empty($partial_payment_configuration[$for]) && !empty($partial_payment_configuration[$for]['type']) ) {
396
+			if (!empty($partial_payment_configuration[$for]) && !empty($partial_payment_configuration[$for]['type'])) {
397 397
 				switch ($partial_payment_configuration[$for]['type']) {
398 398
 					case 'percentage':
399 399
 						$type_of_partial_payment = '%';
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	function set_payment_transaction_number($order_id, $transaction_number) {
454 454
 		$order_postmeta = get_post_meta($order_id, '_order_postmeta', true);
455 455
 
456
-		if ( !empty($order_postmeta['order_payment']['received']) ) {
456
+		if (!empty($order_postmeta['order_payment']['received'])) {
457 457
 			if (count($order_postmeta['order_payment']['received']) == 1) {
458 458
 				$order_postmeta['order_payment']['received'][0]['payment_reference'] = $transaction_number;
459 459
 			}
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
 	 *
468 468
 	 * @param integer $order_id
469 469
 	 */
470
-	function save_payment_return_data( $order_id ) {
470
+	function save_payment_return_data($order_id) {
471 471
 		$data = wpshop_tools::getMethode();
472 472
 
473
-		$current_payment_return = get_post_meta( $order_id, '_wpshop_payment_return_data', true);
473
+		$current_payment_return = get_post_meta($order_id, '_wpshop_payment_return_data', true);
474 474
 		$current_payment_return[] = $data;
475 475
 
476 476
 		update_post_meta($order_id, '_wpshop_payment_return_data', $current_payment_return);
@@ -484,23 +484,23 @@  discard block
 block discarded – undo
484 484
 	 * @param array $params : infos sended by the bank, array structure : ('method', 'waited amount', 'status', 'author', 'payment reference', 'date', 'received amount')
485 485
 	 * @return array The order new meta informations
486 486
 	 */
487
-	public static function add_new_payment_to_order( $order_id, $order_meta, $payment_index, $params, $bank_response ) {
488
-
489
-		$order_meta['order_payment']['received'][$payment_index]['method'] = ( !empty($params['method']) ) ? $params['method'] : null;
490
-		$order_meta['order_payment']['received'][$payment_index]['waited_amount'] = ( !empty($params['waited_amount']) ) ? $params['waited_amount'] : null;
491
-		$order_meta['order_payment']['received'][$payment_index]['status'] = ( !empty($params['status']) ) ? $params['status'] : null;
492
-		$order_meta['order_payment']['received'][$payment_index]['author'] = ( !empty($params['author']) ) ? $params['author'] : get_current_user_id();
493
-		$order_meta['order_payment']['received'][$payment_index]['payment_reference'] =( !empty($params['payment_reference']) ) ? $params['payment_reference'] : null;
494
-		$order_meta['order_payment']['received'][$payment_index]['date'] = ( !empty($params['date']) ) ? $params['date'] : null;
495
-		$order_meta['order_payment']['received'][$payment_index]['received_amount'] = ( !empty($params['received_amount']) ) ? $params['received_amount'] : null;
487
+	public static function add_new_payment_to_order($order_id, $order_meta, $payment_index, $params, $bank_response) {
488
+
489
+		$order_meta['order_payment']['received'][$payment_index]['method'] = (!empty($params['method'])) ? $params['method'] : null;
490
+		$order_meta['order_payment']['received'][$payment_index]['waited_amount'] = (!empty($params['waited_amount'])) ? $params['waited_amount'] : null;
491
+		$order_meta['order_payment']['received'][$payment_index]['status'] = (!empty($params['status'])) ? $params['status'] : null;
492
+		$order_meta['order_payment']['received'][$payment_index]['author'] = (!empty($params['author'])) ? $params['author'] : get_current_user_id();
493
+		$order_meta['order_payment']['received'][$payment_index]['payment_reference'] = (!empty($params['payment_reference'])) ? $params['payment_reference'] : null;
494
+		$order_meta['order_payment']['received'][$payment_index]['date'] = (!empty($params['date'])) ? $params['date'] : null;
495
+		$order_meta['order_payment']['received'][$payment_index]['received_amount'] = (!empty($params['received_amount'])) ? $params['received_amount'] : null;
496 496
 		$order_meta['order_payment']['received'][$payment_index]['comment'] = '';
497 497
 
498 498
 		$order_info = get_post_meta($order_id, '_order_info', true);
499
-		if(!empty($order_meta) && !empty($order_info) && ($bank_response == 'completed')) {
499
+		if (!empty($order_meta) && !empty($order_info) && ($bank_response == 'completed')) {
500 500
 
501 501
 			/**	Generate an invoice number for the current payment. Check if the payment is complete or not	*/
502
-			if ( empty($order_meta['order_invoice_ref']) ) {
503
-				$order_meta['order_payment']['received'][$payment_index]['invoice_ref'] = wpshop_modules_billing::generate_invoice_number( $order_id );
502
+			if (empty($order_meta['order_invoice_ref'])) {
503
+				$order_meta['order_payment']['received'][$payment_index]['invoice_ref'] = wpshop_modules_billing::generate_invoice_number($order_id);
504 504
 			}
505 505
 		}
506 506
 
@@ -513,13 +513,13 @@  discard block
 block discarded – undo
513 513
 	 * @param string $payment_method
514 514
 	 * @return integer $key : array id of [order_payment][received] in the order postmeta
515 515
 	 */
516
-	public static function get_order_waiting_payment_array_id ( $oid, $payment_method ) {
516
+	public static function get_order_waiting_payment_array_id($oid, $payment_method) {
517 517
 		$key = 0;
518
-		$order_meta = get_post_meta( $oid, '_order_postmeta', true);
519
-		if ( !empty($order_meta) ) {
520
-			$key = count( $order_meta['order_payment']['received'] );
521
-			foreach ( $order_meta['order_payment']['received'] as $k => $payment_test) {
522
-				if ( !array_key_exists('received_amount', $payment_test) /* && $order_meta['order_payment']['received'][$k]['method'] == $payment_method */ ) {
518
+		$order_meta = get_post_meta($oid, '_order_postmeta', true);
519
+		if (!empty($order_meta)) {
520
+			$key = count($order_meta['order_payment']['received']);
521
+			foreach ($order_meta['order_payment']['received'] as $k => $payment_test) {
522
+				if (!array_key_exists('received_amount', $payment_test) /* && $order_meta['order_payment']['received'][$k]['method'] == $payment_method */) {
523 523
 					$key = $k;
524 524
 				}
525 525
 			}
@@ -534,52 +534,52 @@  discard block
 block discarded – undo
534 534
 	 * @param array $params_array
535 535
 	 * @return string
536 536
 	 */
537
-	public static function check_order_payment_total_amount($order_id, $params_array, $bank_response, $order_meta = array(), $save_metadata = true ) {
537
+	public static function check_order_payment_total_amount($order_id, $params_array, $bank_response, $order_meta = array(), $save_metadata = true) {
538 538
 		global $wpshop_payment; global $wpdb;
539
-		$order_meta = ( !empty($order_meta) ) ? $order_meta : get_post_meta( $order_id, '_order_postmeta', true);
539
+		$order_meta = (!empty($order_meta)) ? $order_meta : get_post_meta($order_id, '_order_postmeta', true);
540 540
 
541 541
 		$wps_message = new wps_message_ctr();
542
-		if ( !empty($order_meta) ) {
542
+		if (!empty($order_meta)) {
543 543
 			$order_info = get_post_meta($order_id, '_order_info', true);
544
-			$user_data = get_userdata( $order_meta['customer_id'] );
545
-			$email = ( !empty($user_data) && !empty($user_data->user_email) ) ? $user_data->user_email : '';
544
+			$user_data = get_userdata($order_meta['customer_id']);
545
+			$email = (!empty($user_data) && !empty($user_data->user_email)) ? $user_data->user_email : '';
546 546
 // 			$email = ( !empty($order_info) &&  !empty($order_info['billing']) && !empty($order_info['billing']['address']['address_user_email']) ) ? $order_info['billing']['address']['address_user_email'] : '' ;
547
-			$first_name = (!empty($order_info) && !empty($order_info['billing']) &&  !empty($order_info['billing']['address']['address_first_name']) ? $order_info['billing']['address']['address_first_name'] : '' );
548
-			$last_name = ( !empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']['address_last_name']) ? $order_info['billing']['address']['address_last_name'] : '' );
547
+			$first_name = (!empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']['address_first_name']) ? $order_info['billing']['address']['address_first_name'] : '');
548
+			$last_name = (!empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']['address_last_name']) ? $order_info['billing']['address']['address_last_name'] : '');
549 549
 
550
-			$key = self::get_order_waiting_payment_array_id( $order_id, $params_array['method']);
550
+			$key = self::get_order_waiting_payment_array_id($order_id, $params_array['method']);
551 551
 			$order_grand_total = $order_meta['order_grand_total'];
552
-			$total_received = ( ( !empty($params_array['status']) && ( $params_array['status'] == 'payment_received') && ($bank_response == 'completed') && !empty($params_array['received_amount']) ) ? $params_array['received_amount'] : 0 );
553
-			foreach ( $order_meta['order_payment']['received'] as $received ) {
554
-				$total_received += ( ( !empty($received['status']) && ( $received['status'] == 'payment_received') && ($bank_response == 'completed') && !empty($received['received_amount']) ) ? $received['received_amount'] : 0 );
552
+			$total_received = ((!empty($params_array['status']) && ($params_array['status'] == 'payment_received') && ($bank_response == 'completed') && !empty($params_array['received_amount'])) ? $params_array['received_amount'] : 0);
553
+			foreach ($order_meta['order_payment']['received'] as $received) {
554
+				$total_received += ((!empty($received['status']) && ($received['status'] == 'payment_received') && ($bank_response == 'completed') && !empty($received['received_amount'])) ? $received['received_amount'] : 0);
555 555
 			}
556 556
 			$order_meta['order_amount_to_pay_now'] = $order_grand_total - $total_received;
557
-			$order_meta['order_payment']['received'][$key] = self::add_new_payment_to_order( $order_id, $order_meta, $key, $params_array, $bank_response );
557
+			$order_meta['order_payment']['received'][$key] = self::add_new_payment_to_order($order_id, $order_meta, $key, $params_array, $bank_response);
558 558
 
559 559
 			if ($bank_response == 'completed') {
560 560
 
561
-				if ( number_format((float)$total_received, 2, '.', '') >= number_format((float)$order_grand_total,2, '.', '') ) {
561
+				if (number_format((float)$total_received, 2, '.', '') >= number_format((float)$order_grand_total, 2, '.', '')) {
562 562
 					$payment_status = 'completed';
563 563
 
564
-					$order_meta['order_invoice_ref'] = ( empty ($order_meta['order_invoice_ref'] ) && !empty($order_meta['order_payment']['received'][$key]) && !empty($order_meta['order_payment']['received'][$key]['invoice_ref']) ) ? $order_meta['order_payment']['received'][$key]['invoice_ref'] : ( empty($order_meta['order_invoice_ref']) ? null : $order_meta['order_invoice_ref'] ) ;
564
+					$order_meta['order_invoice_ref'] = (empty ($order_meta['order_invoice_ref']) && !empty($order_meta['order_payment']['received'][$key]) && !empty($order_meta['order_payment']['received'][$key]['invoice_ref'])) ? $order_meta['order_payment']['received'][$key]['invoice_ref'] : (empty($order_meta['order_invoice_ref']) ? null : $order_meta['order_invoice_ref']);
565 565
 					$order_meta['order_invoice_date'] = current_time('mysql', 0);
566 566
 
567 567
 					if (!empty($order_meta['order_items'])) {
568 568
 						foreach ($order_meta['order_items'] as $item_id => $o) {
569 569
 							$pid = $o['item_id'];
570
-							if (strpos($item_id,'__') !== false) {
571
-								$product_data_id = explode( '__', $item_id );
572
-								$pid = ( !empty($product_data_id) && !empty($product_data_id[1]) ) ? $product_data_id[1] : $pid;
570
+							if (strpos($item_id, '__') !== false) {
571
+								$product_data_id = explode('__', $item_id);
572
+								$pid = (!empty($product_data_id) && !empty($product_data_id[1])) ? $product_data_id[1] : $pid;
573 573
 							}
574
-							$product = wpshop_products::get_product_data( $pid );
575
-							if ( get_post_type( $pid ) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION ) {
576
-								$parent_def = wpshop_products::get_parent_variation ( $pid );
574
+							$product = wpshop_products::get_product_data($pid);
575
+							if (get_post_type($pid) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
576
+								$parent_def = wpshop_products::get_parent_variation($pid);
577 577
 								$parent_post = $parent_def['parent_post'];
578
-								$product = wpshop_products::get_product_data( $parent_post->ID );
578
+								$product = wpshop_products::get_product_data($parent_post->ID);
579 579
 							}
580 580
 
581
-							if (!empty($product) && !empty($product['manage_stock']) && strtolower( __($product['manage_stock'], 'wpshop') ) == strtolower( __('Yes', 'wpshop') ) ) {
582
-								wpshop_products::reduce_product_stock_qty($product['product_id'], $o['item_qty'], $pid );
581
+							if (!empty($product) && !empty($product['manage_stock']) && strtolower(__($product['manage_stock'], 'wpshop')) == strtolower(__('Yes', 'wpshop'))) {
582
+								wpshop_products::reduce_product_stock_qty($product['product_id'], $o['item_qty'], $pid);
583 583
 							}
584 584
 						}
585 585
 					}
@@ -588,15 +588,15 @@  discard block
 block discarded – undo
588 588
 					update_post_meta($order_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER . '_completed_date', current_time('mysql', 0));
589 589
 
590 590
 					// Send confirmation e-mail to administrator
591
-					if ( empty($_SESSION['wps-pos-addon']) ) {
591
+					if (empty($_SESSION['wps-pos-addon'])) {
592 592
 						$email_option = get_option('wpshop_emails');
593
-						if(  !empty($email_option) && !empty($email_option['send_confirmation_order_message']) ){
594
-							wpshop_checkout::send_order_email_to_administrator( $order_id, $user_data );
593
+						if (!empty($email_option) && !empty($email_option['send_confirmation_order_message'])) {
594
+							wpshop_checkout::send_order_email_to_administrator($order_id, $user_data);
595 595
 						}
596 596
 					}
597 597
 
598 598
 					// POS Status
599
-					if( !empty($order_meta['order_payment']) && !empty($order_meta['order_payment']['shipping_method']) && $order_meta['order_payment']['shipping_method'] == 'default_shipping_mode_for_pos' ) {
599
+					if (!empty($order_meta['order_payment']) && !empty($order_meta['order_payment']['shipping_method']) && $order_meta['order_payment']['shipping_method'] == 'default_shipping_mode_for_pos') {
600 600
 						$payment_status = 'pos';
601 601
 					}
602 602
 				}
@@ -605,27 +605,27 @@  discard block
 block discarded – undo
605 605
 				}
606 606
 
607 607
 				$order_meta['order_status'] = $payment_status;
608
-				update_post_meta( $order_id, '_order_postmeta', $order_meta);
608
+				update_post_meta($order_id, '_order_postmeta', $order_meta);
609 609
 				$save_metadata = false;
610 610
 
611
-				$allow_send_invoice = get_option( 'wpshop_send_invoice' );
612
-				$invoice_attachment_file = ( !empty($allow_send_invoice) ) ? wpshop_modules_billing::generate_invoice_for_email( $order_id, empty( $order_meta['order_payment']['received'][$key]['invoice_ref'] ) ? $order_meta['order_invoice_ref'] : $order_meta['order_payment']['received'][$key]['invoice_ref'] ) : '';
611
+				$allow_send_invoice = get_option('wpshop_send_invoice');
612
+				$invoice_attachment_file = (!empty($allow_send_invoice)) ? wpshop_modules_billing::generate_invoice_for_email($order_id, empty($order_meta['order_payment']['received'][$key]['invoice_ref']) ? $order_meta['order_invoice_ref'] : $order_meta['order_payment']['received'][$key]['invoice_ref']) : '';
613 613
 
614
-				$email_option = get_option( 'wpshop_emails' );
614
+				$email_option = get_option('wpshop_emails');
615 615
 
616
-				$shipping_mode_option = get_option( 'wps_shipping_mode' );
617
-				$shipping_method = ( !empty($order_meta['order_payment']['shipping_method']) && !empty($shipping_mode_option) && !empty($shipping_mode_option['modes']) && is_array($shipping_mode_option['modes']) && array_key_exists($order_meta['order_payment']['shipping_method'], $shipping_mode_option['modes'])) ? $shipping_mode_option['modes'][$order_meta['order_payment']['shipping_method']]['name'] : ( (!empty($order_meta['order_payment']['shipping_method']) ) ? $order_meta['order_payment']['shipping_method'] : '' );
616
+				$shipping_mode_option = get_option('wps_shipping_mode');
617
+				$shipping_method = (!empty($order_meta['order_payment']['shipping_method']) && !empty($shipping_mode_option) && !empty($shipping_mode_option['modes']) && is_array($shipping_mode_option['modes']) && array_key_exists($order_meta['order_payment']['shipping_method'], $shipping_mode_option['modes'])) ? $shipping_mode_option['modes'][$order_meta['order_payment']['shipping_method']]['name'] : ((!empty($order_meta['order_payment']['shipping_method'])) ? $order_meta['order_payment']['shipping_method'] : '');
618 618
 
619
-				$payment_method_option = get_option( 'wps_payment_mode' );
620
-				$order_payment_method = ( !empty($payment_method_option) && !empty($payment_method_option['mode'])  && !empty($order_meta['order_payment']['customer_choice']['method'])  && !empty($payment_method_option['mode'][$order_meta['order_payment']['customer_choice']['method']])  ) ? $payment_method_option['mode'][$order_meta['order_payment']['customer_choice']['method']]['name'] : $order_meta['order_payment']['customer_choice']['method'];
619
+				$payment_method_option = get_option('wps_payment_mode');
620
+				$order_payment_method = (!empty($payment_method_option) && !empty($payment_method_option['mode']) && !empty($order_meta['order_payment']['customer_choice']['method']) && !empty($payment_method_option['mode'][$order_meta['order_payment']['customer_choice']['method']])) ? $payment_method_option['mode'][$order_meta['order_payment']['customer_choice']['method']]['name'] : $order_meta['order_payment']['customer_choice']['method'];
621 621
 
622
-				if ( !empty( $email_option ) && !empty( $email_option['send_confirmation_order_message'] ) && $payment_status == 'completed'
623
-						&& ( !isset( $params_array[ 'send_received_payment_email' ] ) || ( true == $params_array[ 'send_received_payment_email' ] ) ) ) {
624
-					$wps_message->wpshop_prepared_email($email, 'WPSHOP_ORDER_CONFIRMATION_MESSAGE', array('order_id' => $order_id,'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'customer_email' => $email, 'order_key' => ( ( !empty($order_meta['order_key']) ) ? $order_meta['order_key'] : ''),'order_date' => current_time('mysql', 0),  'order_payment_method' => $order_payment_method, 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '',  'order_shipping_method' => $shipping_method ) );
622
+				if (!empty($email_option) && !empty($email_option['send_confirmation_order_message']) && $payment_status == 'completed'
623
+						&& (!isset($params_array['send_received_payment_email']) || (true == $params_array['send_received_payment_email']))) {
624
+					$wps_message->wpshop_prepared_email($email, 'WPSHOP_ORDER_CONFIRMATION_MESSAGE', array('order_id' => $order_id, 'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'customer_email' => $email, 'order_key' => ((!empty($order_meta['order_key'])) ? $order_meta['order_key'] : ''), 'order_date' => current_time('mysql', 0), 'order_payment_method' => $order_payment_method, 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '', 'order_shipping_method' => $shipping_method));
625 625
 				}
626 626
 
627
-				if ( !isset( $params_array[ 'send_received_payment_email' ] ) || ( true == $params_array[ 'send_received_payment_email' ] ) ) {
628
-					$wps_message->wpshop_prepared_email( $email, 'WPSHOP_OTHERS_PAYMENT_CONFIRMATION_MESSAGE', array('order_key' => $order_meta['order_key'], 'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'order_date' => $order_meta['order_date'], 'order_shipping_method' => $shipping_method), array(), $invoice_attachment_file);
627
+				if (!isset($params_array['send_received_payment_email']) || (true == $params_array['send_received_payment_email'])) {
628
+					$wps_message->wpshop_prepared_email($email, 'WPSHOP_OTHERS_PAYMENT_CONFIRMATION_MESSAGE', array('order_key' => $order_meta['order_key'], 'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'order_date' => $order_meta['order_date'], 'order_shipping_method' => $shipping_method), array(), $invoice_attachment_file);
629 629
 				}
630 630
 			}
631 631
 			else {
@@ -634,13 +634,13 @@  discard block
 block discarded – undo
634 634
 
635 635
 			$order_meta['order_status'] = $payment_status;
636 636
 
637
-			update_post_meta( $order_id, '_wpshop_order_status', $payment_status);
638
-			if( $save_metadata ) {
639
-				update_post_meta( $order_id, '_order_postmeta', $order_meta);
637
+			update_post_meta($order_id, '_wpshop_order_status', $payment_status);
638
+			if ($save_metadata) {
639
+				update_post_meta($order_id, '_order_postmeta', $order_meta);
640 640
 			}
641 641
 		}
642
-		do_action( 'wps_after_check_order_payment_total_amount', $order_id );
643
-		if ( ! $save_metadata ) {
642
+		do_action('wps_after_check_order_payment_total_amount', $order_id);
643
+		if (!$save_metadata) {
644 644
 			return $order_meta;
645 645
 		}
646 646
 	}
@@ -653,11 +653,11 @@  discard block
 block discarded – undo
653 653
 	 * @param integer $order_id The order identifier we want to get the old transaction reference for
654 654
 	 * @return integer
655 655
 	 */
656
-	public static function get_payment_transaction_number_old_way($order_id){
656
+	public static function get_payment_transaction_number_old_way($order_id) {
657 657
 		$order_postmeta = get_post_meta($order_id, '_order_postmeta', true);
658 658
 		$transaction_indentifier = 0;
659
-		if(!empty($order_postmeta['payment_method'])){
660
-			switch($order_postmeta['payment_method']){
659
+		if (!empty($order_postmeta['payment_method'])) {
660
+			switch ($order_postmeta['payment_method']) {
661 661
 				case 'check':
662 662
 					$transaction_indentifier = get_post_meta($order_id, '_order_check_number', true);
663 663
 					break;
@@ -676,26 +676,26 @@  discard block
 block discarded – undo
676 676
 		return $transaction_indentifier;
677 677
 	}
678 678
 
679
-	public static function reverify_payment_invoice_ref( $order_id, $index_payment ) {
679
+	public static function reverify_payment_invoice_ref($order_id, $index_payment) {
680 680
 		$status = false;
681
-		$order_meta = get_post_meta( $order_id, '_order_postmeta', true );
682
-		if( !empty( $order_meta ) && !empty( $order_meta['order_payment'] ) && !empty( $order_meta['order_payment']['received'] ) && !empty( $order_meta['order_payment']['received'][$index_payment] ) && empty( $order_meta['order_payment']['received'][$index_payment]['invoice_ref'] ) ) {
681
+		$order_meta = get_post_meta($order_id, '_order_postmeta', true);
682
+		if (!empty($order_meta) && !empty($order_meta['order_payment']) && !empty($order_meta['order_payment']['received']) && !empty($order_meta['order_payment']['received'][$index_payment]) && empty($order_meta['order_payment']['received'][$index_payment]['invoice_ref'])) {
683 683
 			$order_invoice = $invoice_ref = false;
684 684
 
685
-			end( $order_meta['order_payment']['received'] );
686
-			$last_payment = key( $order_meta['order_payment']['received'] );
687
-			if( $last_payment == $index_payment ) {
685
+			end($order_meta['order_payment']['received']);
686
+			$last_payment = key($order_meta['order_payment']['received']);
687
+			if ($last_payment == $index_payment) {
688 688
 				$payments = 0;
689
-				foreach( $order_meta['order_payment']['received'] as $payment ) {
690
-					$payments += ( $payment['status'] == 'payment_received' ) ? $payment['received_amount'] : 0;
689
+				foreach ($order_meta['order_payment']['received'] as $payment) {
690
+					$payments += ($payment['status'] == 'payment_received') ? $payment['received_amount'] : 0;
691 691
 				}
692
-				if( $order_meta['order_grand_total'] <= $payments ) {
693
-					if( $order_meta['order_status'] == 'partially_paid' ) {
694
-						$order_status_meta = get_post_meta( $order_id, '_wpshop_order_status', true );
692
+				if ($order_meta['order_grand_total'] <= $payments) {
693
+					if ($order_meta['order_status'] == 'partially_paid') {
694
+						$order_status_meta = get_post_meta($order_id, '_wpshop_order_status', true);
695 695
 						$order_meta['order_status'] = 'completed';
696
-						$status = (bool)update_post_meta( $order_id, '_wpshop_order_status', 'completed' );
696
+						$status = (bool)update_post_meta($order_id, '_wpshop_order_status', 'completed');
697 697
 					}
698
-					if( !empty( $order_meta['order_invoice_ref'] ) ) {
698
+					if (!empty($order_meta['order_invoice_ref'])) {
699 699
 						$invoice_ref = $order_meta['order_invoice_ref'];
700 700
 						$status = true;
701 701
 					} else {
@@ -706,16 +706,16 @@  discard block
 block discarded – undo
706 706
 				$status = true;
707 707
 			}
708 708
 
709
-			if( $status ) {
710
-				if( empty( $invoice_ref ) ) {
711
-					$invoice_ref = wpshop_modules_billing::generate_invoice_number( $order_id );
712
-					if( $order_invoice ) {
709
+			if ($status) {
710
+				if (empty($invoice_ref)) {
711
+					$invoice_ref = wpshop_modules_billing::generate_invoice_number($order_id);
712
+					if ($order_invoice) {
713 713
 						$order_meta['order_invoice_ref'] = $invoice_ref;
714 714
 					}
715 715
 				}
716 716
 
717 717
 				$order_meta['order_payment']['received'][$index_payment]['invoice_ref'] = $invoice_ref;
718
-				$status = (bool)update_post_meta( $order_id, '_order_postmeta', $order_meta );
718
+				$status = (bool)update_post_meta($order_id, '_order_postmeta', $order_meta);
719 719
 			}
720 720
 		}
721 721
 		return $status;
Please login to merge, or discard this patch.
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 /*	Check if file is include. No direct access possible with file url	*/
4 6
 if ( !defined( 'WPSHOP_VERSION' ) ) {
@@ -40,9 +42,11 @@  discard block
 block discarded – undo
40 42
 
41 43
 	public static function construct_url_parameters($url, $param, $value) {
42 44
 		$interoguation_marker_pos = strpos($url, '?');
43
-		if($interoguation_marker_pos===false)
44
-			return $url.'?'.$param.'='.$value;
45
-		else return $url.'&'.$param.'='.$value;
45
+		if($interoguation_marker_pos===false) {
46
+					return $url.'?'.$param.'='.$value;
47
+		} else {
48
+			return $url.'&'.$param.'='.$value;
49
+		}
46 50
 	}
47 51
 
48 52
 	/**
@@ -167,8 +171,7 @@  discard block
 block discarded – undo
167 171
 					$tpl_component['CHECKOUT_PAYMENT_METHOD_IDENTIFIER'] = $payment_method_identifier;
168 172
 					if ( !empty($payment_mode['logo']) && (int)$payment_mode['logo'] != 0 ) {
169 173
 						$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = ( !empty($payment_method_def['payment_method_icon']) ) ? wp_get_attachment_image( $payment_method_def['payment_method_icon'], 'thumbnail', false, array('class' => 'wps_shipping_mode_logo') ) : '';
170
-					}
171
-					else {
174
+					} else {
172 175
 						$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = ( !empty($payment_method_def['payment_method_icon']) ) ? '<img src="' .$payment_method_def['payment_method_icon']. '" alt="" />' : '';
173 176
 					}
174 177
 					//$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = $payment_method_def['payment_method_icon'];
@@ -200,8 +203,7 @@  discard block
 block discarded – undo
200 203
 
201 204
 						if ( !empty($payment_config['logo']) && (int)$payment_config['logo'] != 0 ) {
202 205
 							$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = ( !empty($payment_config['logo']) ) ? wp_get_attachment_image( $payment_config['logo'], 'thumbnail', false ) : '';
203
-						}
204
-						else {
206
+						} else {
205 207
 							$tpl_component['CHECKOUT_PAYMENT_METHOD_ICON'] = ( !empty($payment_config['logo']) ) ? '<img src="' .$payment_config['logo']. '" alt="' .$payment_config['name']. '" />' : '';
206 208
 						}
207 209
 						$tpl_component['CHECKOUT_PAYMENT_METHOD_NAME'] = ( !empty($payment_config['name']) ) ? $payment_config['name'] : '';
@@ -599,8 +601,7 @@  discard block
 block discarded – undo
599 601
 					if( !empty($order_meta['order_payment']) && !empty($order_meta['order_payment']['shipping_method']) && $order_meta['order_payment']['shipping_method'] == 'default_shipping_mode_for_pos' ) {
600 602
 						$payment_status = 'pos';
601 603
 					}
602
-				}
603
-				else {
604
+				} else {
604 605
 					$payment_status = 'partially_paid';
605 606
 				}
606 607
 
@@ -627,8 +628,7 @@  discard block
 block discarded – undo
627 628
 				if ( !isset( $params_array[ 'send_received_payment_email' ] ) || ( true == $params_array[ 'send_received_payment_email' ] ) ) {
628 629
 					$wps_message->wpshop_prepared_email( $email, 'WPSHOP_OTHERS_PAYMENT_CONFIRMATION_MESSAGE', array('order_key' => $order_meta['order_key'], 'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'order_date' => $order_meta['order_date'], 'order_shipping_method' => $shipping_method), array(), $invoice_attachment_file);
629 630
 				}
630
-			}
631
-			else {
631
+			} else {
632 632
 				$payment_status = $bank_response;
633 633
 			}
634 634
 
Please login to merge, or discard this patch.
includes/librairies/payments/paypal.class.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -149,8 +149,8 @@
 block discarded – undo
149 149
 	}
150 150
 
151 151
 	/**
152
-	* Display the paypal form in order to redirect correctly to paypal
153
-	*/
152
+	 * Display the paypal form in order to redirect correctly to paypal
153
+	 */
154 154
 	public static function display_form($oid) {
155 155
 		global $wpdb;
156 156
 		$order = get_post_meta($oid, '_order_postmeta', true);
Please login to merge, or discard this patch.
Braces   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 /*	Check if file is include. No direct access possible with file url	*/
4 6
 if ( !defined( 'WPSHOP_VERSION' ) ) {
@@ -45,8 +47,7 @@  discard block
 block discarded – undo
45 47
 			if($paypalMode == 'sandbox') {
46 48
 				$fp = fsockopen ('ssl://sandbox.paypal.com', 443, $errno, $errstr, 30);
47 49
 				$host = "www.sandbox.paypal.com";
48
-			}
49
-			else {
50
+			} else {
50 51
 				$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
51 52
 				$host = "www.paypal.com";
52 53
 			}
@@ -84,8 +85,7 @@  discard block
 block discarded – undo
84 85
 
85 86
 			if (!$fp){
86 87
 				echo 'HTTP ERROR!';
87
-			}
88
-			else {
88
+			} else {
89 89
 				fputs ($fp, $header.$req);
90 90
 				while (!feof($fp)) {
91 91
 					$res = fgets ($fp, 1024);
@@ -113,13 +113,11 @@  discard block
 block discarded – undo
113 113
 								/*	Check if the paid amount is equal to the order amount	*/
114 114
 								if ( $amount_paid == $amount2pay ) {
115 115
 									$payment_status = 'completed';
116
-								}
117
-								else {
116
+								} else {
118 117
 									$payment_status = 'incorrect_amount';
119 118
 								}
120 119
 
121
-							}
122
-							else {
120
+							} else {
123 121
 								@mail($notify_email, 'VERIFIED DUPLICATED TRANSACTION', 'VERIFIED DUPLICATED TRANSACTION');
124 122
 								$payment_status = 'completed';
125 123
 							}
@@ -164,8 +162,11 @@  discard block
 block discarded – undo
164 162
 			if(!empty($paypalBusinessEmail)) {
165 163
 
166 164
 				$paypalMode = get_option('wpshop_paypalMode', null);
167
-				if($paypalMode == 'sandbox') $paypal = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
168
-				else $paypal = 'https://www.paypal.com/cgi-bin/webscr';
165
+				if($paypalMode == 'sandbox') {
166
+					$paypal = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
167
+				} else {
168
+					$paypal = 'https://www.paypal.com/cgi-bin/webscr';
169
+				}
169 170
 
170 171
 				$current_currency = get_option('wpshop_shop_default_currency');
171 172
 				$query = $wpdb->prepare('SELECT code_iso FROM ' .WPSHOP_DBT_ATTRIBUTE_UNIT. ' WHERE id =%d ', $current_currency );
@@ -202,8 +203,7 @@  discard block
 block discarded – undo
202 203
 									<input id="quantity_'.$i.'" name="quantity_'.$i.'" type="hidden" value="1" />
203 204
 									<input id="amount_'.$i.'" name="amount_'.$i.'" type="hidden" value="'.number_format($order['order_amount_to_pay_now'], 2, '.', '').'" />
204 205
 									';
205
-				}
206
-				else {
206
+				} else {
207 207
 
208 208
 					$output .=	'
209 209
 									<input id="item_number_'.$i.'" name="item_number_'.$i.'" type="hidden" value="' .$order['order_key']. '" />
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 /*	Check if file is include. No direct access possible with file url	*/
4
-if ( !defined( 'WPSHOP_VERSION' ) ) {
5
-	die( __('Access is not allowed by this way', 'wpshop') );
4
+if (!defined('WPSHOP_VERSION')) {
5
+	die(__('Access is not allowed by this way', 'wpshop'));
6 6
 }
7 7
 
8 8
 /**
@@ -18,38 +18,38 @@  discard block
 block discarded – undo
18 18
 class wpshop_paypal {
19 19
 
20 20
 	public function __construct() {
21
-		add_filter( 'wps_payment_mode_interface_paypal', array( &$this, 'display_admin_part') );
21
+		add_filter('wps_payment_mode_interface_paypal', array(&$this, 'display_admin_part'));
22 22
 
23 23
 		/** Check if SystemPay is registred in Payment Main Option **/
24
-		$payment_option = get_option( 'wps_payment_mode' );
25
-		if ( !empty($payment_option) && !empty($payment_option['mode']) && !array_key_exists('paypal', $payment_option['mode']) ) {
24
+		$payment_option = get_option('wps_payment_mode');
25
+		if (!empty($payment_option) && !empty($payment_option['mode']) && !array_key_exists('paypal', $payment_option['mode'])) {
26 26
 			$payment_option['mode']['paypal']['name'] = __('Paypal', 'wpshop');
27
-			$payment_option['mode']['paypal']['logo'] = WPSHOP_TEMPLATES_URL.'wpshop/medias/paypal.png';
27
+			$payment_option['mode']['paypal']['logo'] = WPSHOP_TEMPLATES_URL . 'wpshop/medias/paypal.png';
28 28
 			$payment_option['mode']['paypal']['description'] = __('<strong>Tips</strong> : If you have a Paypal account, by choosing this payment method, you will be redirected to the secure payment site Paypal to make your payment. Debit your PayPal account, immediate booking products.', 'wpshop');
29
-			update_option( 'wps_payment_mode', $payment_option );
29
+			update_option('wps_payment_mode', $payment_option);
30 30
 		}
31 31
 
32
-		$payment_listener = !empty( $_GET['paymentListener'] ) ? sanitize_text_field( $_GET['paymentListener'] ) : '';
32
+		$payment_listener = !empty($_GET['paymentListener']) ? sanitize_text_field($_GET['paymentListener']) : '';
33 33
 
34
-		if(!empty($payment_listener) && $payment_listener=='paypal') {
34
+		if (!empty($payment_listener) && $payment_listener == 'paypal') {
35 35
 			$payment_status = 'denied';
36 36
 			// read the post from PayPal system and add 'cmd'
37 37
 			$req = 'cmd=_notify-validate';
38 38
 			// @TODO : REQUEST
39
-			$post = !empty($_POST) ? (array) $_POST : array();
40
-			foreach ( $post as $key => $value) {
39
+			$post = !empty($_POST) ? (array)$_POST : array();
40
+			foreach ($post as $key => $value) {
41 41
 				$value = urlencode(stripslashes($value));
42 42
 				$req .= "&$key=$value";
43 43
 			}
44 44
 
45 45
 			// If testing on Sandbox use:
46 46
 			$paypalMode = get_option('wpshop_paypalMode', null);
47
-			if($paypalMode == 'sandbox') {
48
-				$fp = fsockopen ('ssl://sandbox.paypal.com', 443, $errno, $errstr, 30);
47
+			if ($paypalMode == 'sandbox') {
48
+				$fp = fsockopen('ssl://sandbox.paypal.com', 443, $errno, $errstr, 30);
49 49
 				$host = "www.sandbox.paypal.com";
50 50
 			}
51 51
 			else {
52
-				$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
52
+				$fp = fsockopen('ssl://www.paypal.com', 443, $errno, $errstr, 30);
53 53
 				$host = "www.paypal.com";
54 54
 			}
55 55
 
@@ -64,45 +64,45 @@  discard block
 block discarded – undo
64 64
 			$shipping = $_POST['mc_shipping']; // frais de livraison
65 65
 			$business = $_POST['business']; // compte pro
66 66
 			$order_id = (int)$_POST['invoice']; // num de facture
67
-			$receiver_email = sanitize_text_field( $_POST['receiver_email'] );
67
+			$receiver_email = sanitize_text_field($_POST['receiver_email']);
68 68
 			$amount_paid = $_POST['mc_gross']; // total (hors frais livraison)
69 69
 			$txn_id = $_POST['txn_id']; // num�ro de transaction
70 70
 			$payment_status = $_POST['payment_status']; // status du paiement
71 71
 			$payer_email = $_POST['payer_email']; // email du client
72
-			$txn_type = sanitize_text_field( $_POST['txn_type'] );
72
+			$txn_type = sanitize_text_field($_POST['txn_type']);
73 73
 
74 74
 			// @TODO : REQUEST
75
-			$post = !empty($_POST) ? (array) $_POST : array();
76
-			if ( !empty($post) ) {
77
-				foreach ( $post as $key => $value) {
78
-					if ( substr($key, 0, 9) == 'item_name' ) {
75
+			$post = !empty($_POST) ? (array)$_POST : array();
76
+			if (!empty($post)) {
77
+				foreach ($post as $key => $value) {
78
+					if (substr($key, 0, 9) == 'item_name') {
79 79
 						//$_POST[$key] = htmlentities($value);
80 80
 					}
81 81
 				}
82 82
 			}
83 83
 
84 84
 			/**	Save paypal return data automatically	*/
85
-			wpshop_payment::save_payment_return_data( $order_id );
85
+			wpshop_payment::save_payment_return_data($order_id);
86 86
 
87 87
 			$notify_email = get_option('wpshop_paypalEmail', null); // email address to which debug emails are sent to
88 88
 
89
-			if (!$fp){
89
+			if (!$fp) {
90 90
 				echo 'HTTP ERROR!';
91 91
 			}
92 92
 			else {
93
-				fputs ($fp, $header.$req);
93
+				fputs($fp, $header . $req);
94 94
 				while (!feof($fp)) {
95
-					$res = fgets ($fp, 1024);
96
-					if (strcmp ($res, "VERIFIED") == 0) {
95
+					$res = fgets($fp, 1024);
96
+					if (strcmp($res, "VERIFIED") == 0) {
97 97
 						$paypalBusinessEmail = get_option('wpshop_paypalEmail', null);
98 98
 
99 99
 						/**	Check if payment has been send to good paypal account	*/
100 100
 						if ($receiver_email == $paypalBusinessEmail) {
101 101
 							/**	Get the payment transaction identifier	*/
102
-							$paypal_txn_id = wpshop_payment::get_payment_transaction_number( $order_id,  wpshop_payment::get_order_waiting_payment_array_id( $order_id, 'paypal'));
102
+							$paypal_txn_id = wpshop_payment::get_payment_transaction_number($order_id, wpshop_payment::get_order_waiting_payment_array_id($order_id, 'paypal'));
103 103
 
104 104
 							/**	If no transaction reference has been saved for this order	*/
105
-							if ( empty($paypal_txn_id) ) {
105
+							if (empty($paypal_txn_id)) {
106 106
 								/**	Set the payment reference for the order	*/
107 107
 								wpshop_payment::set_payment_transaction_number($order_id, $txn_id);
108 108
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 								$amount_paid = number_format(floatval($amount_paid), 2, '.', '');
116 116
 
117 117
 								/*	Check if the paid amount is equal to the order amount	*/
118
-								if ( $amount_paid == $amount2pay ) {
118
+								if ($amount_paid == $amount2pay) {
119 119
 									$payment_status = 'completed';
120 120
 								}
121 121
 								else {
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 						}
131 131
 					}
132 132
 					// if the IPN POST was 'INVALID'...do this
133
-					elseif (strcmp ($res, "INVALID") == 0) {
133
+					elseif (strcmp($res, "INVALID") == 0) {
134 134
 						@mail($notify_email, "INVALID IPN", "$res\n $req");
135 135
 						$payment_status = 'payment_refused';
136 136
 					}
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 				fclose($fp);
139 139
 			}
140 140
 
141
-			$mc_gross = !empty( $_POST['mc_gross'] ) ? (float)$_POST['mc_gross'] : 0;
141
+			$mc_gross = !empty($_POST['mc_gross']) ? (float)$_POST['mc_gross'] : 0;
142 142
 
143 143
 			$params_array = array('method' => 'paypal',
144 144
 					'waited_amount' => number_format((float)$order['order_amount_to_pay_now'], 2, '.', ''),
145
-					'status' => ( ( number_format((float)$order['order_amount_to_pay_now'], 2, '.', '') == number_format($mc_gross, 2, '.', '') ) ? 'payment_received' : 'incorrect_amount' ),
145
+					'status' => ((number_format((float)$order['order_amount_to_pay_now'], 2, '.', '') == number_format($mc_gross, 2, '.', '')) ? 'payment_received' : 'incorrect_amount'),
146 146
 					'author' => $order['customer_id'],
147 147
 					'payment_reference' => $txn_id,
148 148
 					'date' => current_time('mysql', 0),
149
-					'received_amount' => number_format($mc_gross, 2, '.', '') );
149
+					'received_amount' => number_format($mc_gross, 2, '.', ''));
150 150
 			wpshop_payment::check_order_payment_total_amount($order_id, $params_array, $payment_status);
151 151
 
152 152
 		}
@@ -162,25 +162,25 @@  discard block
 block discarded – undo
162 162
 		$order = get_post_meta($oid, '_order_postmeta', true);
163 163
 
164 164
 		// If the order exist
165
-		if(!empty($order)) {
165
+		if (!empty($order)) {
166 166
 
167 167
 			$paypalBusinessEmail = get_option('wpshop_paypalEmail', null);
168 168
 
169 169
 			// Si l'email Paypal n'est pas vide
170
-			if(!empty($paypalBusinessEmail)) {
170
+			if (!empty($paypalBusinessEmail)) {
171 171
 
172 172
 				$paypalMode = get_option('wpshop_paypalMode', null);
173
-				if($paypalMode == 'sandbox') $paypal = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
173
+				if ($paypalMode == 'sandbox') $paypal = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
174 174
 				else $paypal = 'https://www.paypal.com/cgi-bin/webscr';
175 175
 
176 176
 				$current_currency = get_option('wpshop_shop_default_currency');
177
-				$query = $wpdb->prepare('SELECT code_iso FROM ' .WPSHOP_DBT_ATTRIBUTE_UNIT. ' WHERE id =%d ', $current_currency );
177
+				$query = $wpdb->prepare('SELECT code_iso FROM ' . WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id =%d ', $current_currency);
178 178
 				$currency = $wpdb->get_var($query);
179 179
 
180 180
 				$output  = '<script type="text/javascript">jQuery(document).ready(function(){ jQuery("#paypalForm").submit(); });</script>';
181 181
 				$output .= '<div class="paypalPaymentLoading"><span>' . __('Redirecting to paypal. Please wait', 'wpshop') . '</span></div>';
182 182
 				$output .= '
183
-						<form action="'.$paypal.'" id="paypalForm" method="post">
183
+						<form action="'.$paypal . '" id="paypalForm" method="post">
184 184
 						<input id="cmd" name="cmd" type="hidden" value="_cart" />
185 185
 						<input id="upload" name="upload" type="hidden" value="1" />
186 186
 						<input id="charset" name="charset" type="hidden" value="utf-8" />
@@ -188,41 +188,41 @@  discard block
 block discarded – undo
188 188
 						<input id="no_note" name="no_note" type="hidden" value="0" />
189 189
 						<input id="rm" name="rm" type="hidden" value="0" />
190 190
 
191
-						<input id="custom" name="custom" type="hidden" value="'.$order['customer_id'].'" />
192
-						<input id="invoice" name="invoice" type="hidden" value="'.$oid.'" /> <!-- Invoice number -->
193
-						<input id="business" name="business" type="hidden" value="'.$paypalBusinessEmail.'" /> <!-- Paypal business account -->
191
+						<input id="custom" name="custom" type="hidden" value="'.$order['customer_id'] . '" />
192
+						<input id="invoice" name="invoice" type="hidden" value="'.$oid . '" /> <!-- Invoice number -->
193
+						<input id="business" name="business" type="hidden" value="'.$paypalBusinessEmail . '" /> <!-- Paypal business account -->
194 194
 						<input id="cbt" name="cbt" type="hidden" value="' . __('Back to shop', 'wpshop') . '" />
195 195
 						<input id="lc" name="lc" type="hidden" value="FR" />
196
-						<input id="currency_code" name="currency_code" type="hidden" value="'.$currency.'" />
196
+						<input id="currency_code" name="currency_code" type="hidden" value="'.$currency . '" />
197 197
 
198
-						<input id="return" name="return" type="hidden" value="'.wpshop_payment::get_success_payment_url().'" />
199
-						<input id="cancel_return" name="cancel_return" type="hidden" value="'.wpshop_payment::get_cancel_payment_url().'" />
200
-						<input id="notify_url" name="notify_url" type="hidden" value="'.wpshop_payment::construct_url_parameters(trailingslashit(home_url()), 'paymentListener', 'paypal').'" />
198
+						<input id="return" name="return" type="hidden" value="'.wpshop_payment::get_success_payment_url() . '" />
199
+						<input id="cancel_return" name="cancel_return" type="hidden" value="'.wpshop_payment::get_cancel_payment_url() . '" />
200
+						<input id="notify_url" name="notify_url" type="hidden" value="'.wpshop_payment::construct_url_parameters(trailingslashit(home_url()), 'paymentListener', 'paypal') . '" />
201 201
 				';
202 202
 
203
-				$i=1;
204
-				if ( !empty( $order['order_partial_payment']) && !empty($order['order_partial_payment']['amount_of_partial_payment']) ) {
205
-					$output .=	'
206
-									<input id="item_number_'.$i.'" name="item_number_'.$i.'" type="hidden" value="' .$oid. '_partial_payment" />
207
-									<input id="item_name_'.$i.'" name="item_name_'.$i.'" type="hidden" value="'.__('Partial payment', 'wpshop').' (' .__('Order number', 'wpshop'). ' : ' .$order['order_key']. ')" />
208
-									<input id="quantity_'.$i.'" name="quantity_'.$i.'" type="hidden" value="1" />
209
-									<input id="amount_'.$i.'" name="amount_'.$i.'" type="hidden" value="'.number_format($order['order_amount_to_pay_now'], 2, '.', '').'" />
203
+				$i = 1;
204
+				if (!empty($order['order_partial_payment']) && !empty($order['order_partial_payment']['amount_of_partial_payment'])) {
205
+					$output .= '
206
+									<input id="item_number_'.$i . '" name="item_number_' . $i . '" type="hidden" value="' . $oid . '_partial_payment" />
207
+									<input id="item_name_'.$i . '" name="item_name_' . $i . '" type="hidden" value="' . __('Partial payment', 'wpshop') . ' (' . __('Order number', 'wpshop') . ' : ' . $order['order_key'] . ')" />
208
+									<input id="quantity_'.$i . '" name="quantity_' . $i . '" type="hidden" value="1" />
209
+									<input id="amount_'.$i . '" name="amount_' . $i . '" type="hidden" value="' . number_format($order['order_amount_to_pay_now'], 2, '.', '') . '" />
210 210
 									';
211 211
 				}
212 212
 				else {
213 213
 
214
-					$output .=	'
215
-									<input id="item_number_'.$i.'" name="item_number_'.$i.'" type="hidden" value="' .$order['order_key']. '" />
216
-									<input id="item_name_'.$i.'" name="item_name_'.$i.'" type="hidden" value="' .__('Current order', 'wpshop'). ' : ' .$order['order_key']. '" />
217
-									<input id="quantity_'.$i.'" name="quantity_'.$i.'" type="hidden" value="1" />
218
-									<input id="amount_'.$i.'" name="amount_'.$i.'" type="hidden" value="'.number_format($order['order_amount_to_pay_now'], 2, '.', '').'" />
214
+					$output .= '
215
+									<input id="item_number_'.$i . '" name="item_number_' . $i . '" type="hidden" value="' . $order['order_key'] . '" />
216
+									<input id="item_name_'.$i . '" name="item_name_' . $i . '" type="hidden" value="' . __('Current order', 'wpshop') . ' : ' . $order['order_key'] . '" />
217
+									<input id="quantity_'.$i . '" name="quantity_' . $i . '" type="hidden" value="1" />
218
+									<input id="amount_'.$i . '" name="amount_' . $i . '" type="hidden" value="' . number_format($order['order_amount_to_pay_now'], 2, '.', '') . '" />
219 219
 									';
220 220
 
221 221
 				}
222 222
 
223 223
 
224 224
 
225
-				$output .=	'<noscript><input type="submit" value="' . __('Checkout', 'wpshop') . '" /></noscript></form>';
225
+				$output .= '<noscript><input type="submit" value="' . __('Checkout', 'wpshop') . '" /></noscript></form>';
226 226
 			}
227 227
 		}
228 228
 
@@ -232,16 +232,16 @@  discard block
 block discarded – undo
232 232
 
233 233
 	function display_admin_part() {
234 234
 		$paypalEmail = get_option('wpshop_paypalEmail');
235
-		$paypalMode = get_option('wpshop_paypalMode',0);
235
+		$paypalMode = get_option('wpshop_paypalMode', 0);
236 236
 		$output  = '<div class="wps-boxed">';
237
-		$output .= '<div class="wps-form-group"><label>'.__('Business email','wpshop').'</label><div class="wps-form"><input name="wpshop_paypalEmail" type="text" value="'.$paypalEmail.'" /></div></div>';
238
-		$output .= '<label class="simple_right">'.__('Mode','wpshop').'</label>';
237
+		$output .= '<div class="wps-form-group"><label>' . __('Business email', 'wpshop') . '</label><div class="wps-form"><input name="wpshop_paypalEmail" type="text" value="' . $paypalEmail . '" /></div></div>';
238
+		$output .= '<label class="simple_right">' . __('Mode', 'wpshop') . '</label>';
239 239
 		$output .= '<div class="wps-form"><select name="wpshop_paypalMode">';
240
-		$output .= '<option value="normal"'.(($paypalMode=='sandbox') ? null : ' selected="selected"').'>'.__('Production mode','wpshop').'</option>';
241
-		$output .= '<option value="sandbox"'.(($paypalMode=='sandbox') ? ' selected="selected"' : null).'>'.__('Sandbox mode','wpshop').'</option>';
240
+		$output .= '<option value="normal"' . (($paypalMode == 'sandbox') ? null : ' selected="selected"') . '>' . __('Production mode', 'wpshop') . '</option>';
241
+		$output .= '<option value="sandbox"' . (($paypalMode == 'sandbox') ? ' selected="selected"' : null) . '>' . __('Sandbox mode', 'wpshop') . '</option>';
242 242
 		$output .= '</select>';
243 243
 		$output .= '</div>';
244
-		$output .= '<a href="#" title="'.__('This checkbox allow to use Paypal in Sandbox mode (test) or production mode (real money)','wpshop').'" class="wpshop_infobulle_marker">?</a>';
244
+		$output .= '<a href="#" title="' . __('This checkbox allow to use Paypal in Sandbox mode (test) or production mode (real money)', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
245 245
 		$output .= '</div>';
246 246
 		return $output;
247 247
 	}
Please login to merge, or discard this patch.
includes/librairies/db/db_data_definition.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 /*	Check if file is include. No direct access possible with file url	*/
4
-if ( !defined( 'WPSHOP_VERSION' ) ) {
5
-	die( __('Access is not allowed by this way', 'wpshop') );
4
+if (!defined('WPSHOP_VERSION')) {
5
+	die(__('Access is not allowed by this way', 'wpshop'));
6 6
 }
7 7
 
8 8
 /**
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $wpshop_db_content_update = array();
22 22
 $wpshop_db_options_add = array();
23 23
 $wpshop_db_options_update = array();
24
-$wpshop_db_delete= array();
24
+$wpshop_db_delete = array();
25 25
 $wpshop_db_version = 0;
26 26
 
27 27
 {/*	Version 0	*/
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 	$wpshop_eav_content[$wpshop_db_version]['attributes'][] = WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT;
77 77
 
78 78
 	/*	Default attribute group	*/
79
-	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT]['default'][] = array('code' => 'important_datas', 'name' => __('Product', 'wpshop'), 'details' => array( 'product_attribute_set_id', 'barcode', 'product_price', 'tx_tva', 'manage_stock', 'product_stock', 'product_weight'), 'backend_display_type' => 'movable-tab' );
79
+	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT]['default'][] = array('code' => 'important_datas', 'name' => __('Product', 'wpshop'), 'details' => array('product_attribute_set_id', 'barcode', 'product_price', 'tx_tva', 'manage_stock', 'product_stock', 'product_weight'), 'backend_display_type' => 'movable-tab');
80 80
 	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT]['default'][] = array('code' => 'general', 'name' => __('Main information', 'wpshop'), 'details' => array('product_reference', 'cost_of_postage',));
81 81
 	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT]['default'][] = array('code' => 'feature', 'name' => __('Feature', 'wpshop'), 'details' => array('product_height', 'product_width'));
82 82
 	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT]['default'][] = array('code' => 'additionnal_informations', 'name' => __('Additionnal informations', 'wpshop'), 'details' => array());
83 83
 
84
-	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT]['default'][] = array( 'name' => __('Prices', 'wpshop'), 'code' => 'prices', 'details' => array( 'price_ht', 'tva', ));
84
+	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT]['default'][] = array('name' => __('Prices', 'wpshop'), 'code' => 'prices', 'details' => array('price_ht', 'tva',));
85 85
 
86 86
 	/*	Update attribute with default unit	*/
87 87
 	$wpshop_db_content_update[$wpshop_db_version][WPSHOP_DBT_ATTRIBUTE][] = array('datas' => array('last_update_date' => current_time('mysql', 0), '_unit_group_id' => 1, '_default_unit' => 2), 'where' => array('code' => 'product_height'));
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
 	/*	Add shop type	*/
164 164
 	$current_db_version = get_option('wpshop_db_options', 0);
165
-	if(!empty($current_db_version) && $current_db_version['db_version'] >= $wpshop_db_version){
165
+	if (!empty($current_db_version) && $current_db_version['db_version'] >= $wpshop_db_version) {
166 166
 		$wpshop_db_options_add[$wpshop_db_version]['wpshop_shop_type'] = 'sale';
167 167
 		$wpshop_db_options_update[$wpshop_db_version]['wpshop_db_options']['installation_state'] = 'completed';
168 168
 	}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	$wpshop_db_content_update[$wpshop_db_version][WPSHOP_DBT_ATTRIBUTE_GROUP][] = array('datas' => array('last_update_date' => current_time('mysql', 0), 'used_in_shop_type' => 'sale'), 'where' => array('code' => 'shipping'));
183 183
 
184 184
 	/*	Delete useless option	*/
185
-	$wpshop_db_delete[$wpshop_db_version][] = $wpdb->prepare("DELETE FROM ".$wpdb->options." WHERE option_name=%s", 'wpshop_shop_currencies');
185
+	$wpshop_db_delete[$wpshop_db_version][] = $wpdb->prepare("DELETE FROM " . $wpdb->options . " WHERE option_name=%s", 'wpshop_shop_currencies');
186 186
 }
187 187
 
188 188
 {/*	Version 20 - Version 1.3.1.9	*/
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 
227 227
 	$wpshop_eav_content[$wpshop_db_version]['attributes'][] = WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS;
228 228
 
229
-	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS][__('Billing address', 'wpshop')][] = array('code' => 'billing_address', 'name' => __('Billing address', 'wpshop'), 'details' => array( 'address_title', 'civility', 'address_last_name', 'address_first_name', 'company', 'tva_intra', 'address_user_email', 'address', 'postcode', 'city', 'country', 'state', 'phone', 'longitude', 'latitude'));
229
+	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS][__('Billing address', 'wpshop')][] = array('code' => 'billing_address', 'name' => __('Billing address', 'wpshop'), 'details' => array('address_title', 'civility', 'address_last_name', 'address_first_name', 'company', 'tva_intra', 'address_user_email', 'address', 'postcode', 'city', 'country', 'state', 'phone', 'longitude', 'latitude'));
230 230
 	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS][__('Shipping address', 'wpshop')][] = array('code' => 'shipping_address', 'name' => __('Shipping address', 'wpshop'), 'details' => array('address_title', 'civility', 'address_last_name', 'address_first_name', 'company', 'address', 'postcode', 'city', 'country', 'state', 'longitude', 'latitude'));
231 231
 
232
-	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS][__('Account', 'wpshop')][] = array('code' => 'account', 'name' => __('Account', 'wpshop'), 'details' => array( 'user_login', 'user_pass', 'last_name', 'first_name', 'user_email' ));
232
+	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS][__('Account', 'wpshop')][] = array('code' => 'account', 'name' => __('Account', 'wpshop'), 'details' => array('user_login', 'user_pass', 'last_name', 'first_name', 'user_email'));
233 233
 }
234 234
 
235 235
 {/*	Version 40 - Version 1.3.5.4	*/
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 {/*	Version 60 - Version 1.3.9.8	*/
252 252
 	$wpshop_db_version = 60;
253 253
 
254
-	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT]['free_product'][] = array( 'name' => __('Prices', 'wpshop'), 'code' => 'prices', 'details' => array('price_ht', 'product_price', 'tx_tva', 'tva'));
254
+	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT]['free_product'][] = array('name' => __('Prices', 'wpshop'), 'code' => 'prices', 'details' => array('price_ht', 'product_price', 'tx_tva', 'tva'));
255 255
 	$wpshop_eav_content[$wpshop_db_version]['attribute_groups'][WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT]['free_product'][] = array('code' => 'general', 'name' => __('Main information', 'wpshop'), 'details' => array('product_reference', 'barcode'));
256 256
 }
257 257
 
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
 /*	Check if file is include. No direct access possible with file url	*/
4 6
 if ( !defined( 'WPSHOP_VERSION' ) ) {
Please login to merge, or discard this patch.
includes/librairies/init.class.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -301,8 +301,8 @@
 block discarded – undo
301 301
 	}
302 302
 
303 303
 	/**
304
-	*	Admin javascript "header script" part definition
305
-	*/
304
+	 *	Admin javascript "header script" part definition
305
+	 */
306 306
 	function admin_css_head() {
307 307
 		ob_start();
308 308
 		include(WPSHOP_CSS_DIR . 'pages/wpshop_product.css');
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 /*	Check if file is include. No direct access possible with file url	*/
4 6
 if ( !defined( 'WPSHOP_VERSION' ) ) {
@@ -519,7 +521,9 @@  discard block
 block discarded – undo
519 521
 		$to_exclude=unserialize(WPSHOP_INTERNAL_TYPES_TO_EXCLUDE);
520 522
 		if(!empty($to_exclude)):
521 523
 			foreach($to_exclude as $excluded_type):
522
-				if(isset($wp_types[$excluded_type]))unset($wp_types[$excluded_type]);
524
+				if(isset($wp_types[$excluded_type])) {
525
+					unset($wp_types[$excluded_type]);
526
+				}
523 527
 			endforeach;
524 528
 		endif;
525 529
 		DEFINE('WPSHOP_INTERNAL_TYPES', serialize(array_merge($wp_types, array('users' => __('Users', 'wpshop')))));
Please login to merge, or discard this patch.
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 /*	Check if file is include. No direct access possible with file url	*/
4
-if ( !defined( 'WPSHOP_VERSION' ) ) {
5
-	die( __('Access is not allowed by this way', 'wpshop') );
4
+if (!defined('WPSHOP_VERSION')) {
5
+	die(__('Access is not allowed by this way', 'wpshop'));
6 6
 }
7 7
 
8 8
 /**
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  * @package wpshop
23 23
  * @subpackage librairies
24 24
  */
25
-class wpshop_init{
25
+class wpshop_init {
26 26
 
27 27
 	/**
28 28
 	 *	This is the function loaded when wordpress load the different plugin
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 		/*	Include head js	*/
41 41
 		add_action('admin_print_scripts', array('wpshop_init', 'admin_print_js'));
42 42
 
43
-		$page = !empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
44
-		$post_type = !empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : '';
45
-		$action = !empty( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : '';
46
-		$post = !empty( $_GET['post'] ) ? (array) $_GET['post'] : '';
47
-		$taxonomy = !empty( $_GET['taxonomy'] ) ? sanitize_text_field( $_GET['taxonomy'] ) : '';
48
-		if((isset($page) && substr($page, 0, 7) == 'wpshop_') || (isset($page) && $page == 'wps-installer' ) || (isset($post_type) && substr($post_type, 0, 7) == 'wpshop_') || !empty($post) || (isset($page) && $page==WPSHOP_NEWTYPE_IDENTIFIER_GROUP) || (isset($taxonomy) && ($taxonomy == WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES))){
43
+		$page = !empty($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
44
+		$post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
45
+		$action = !empty($_GET['action']) ? sanitize_text_field($_GET['action']) : '';
46
+		$post = !empty($_GET['post']) ? (array)$_GET['post'] : '';
47
+		$taxonomy = !empty($_GET['taxonomy']) ? sanitize_text_field($_GET['taxonomy']) : '';
48
+		if ((isset($page) && substr($page, 0, 7) == 'wpshop_') || (isset($page) && $page == 'wps-installer') || (isset($post_type) && substr($post_type, 0, 7) == 'wpshop_') || !empty($post) || (isset($page) && $page == WPSHOP_NEWTYPE_IDENTIFIER_GROUP) || (isset($taxonomy) && ($taxonomy == WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES))) {
49 49
 			/*	Include the different javascript	*/
50 50
 // 			add_action('admin_init', array('wpshop_init', 'admin_js'));
51
-			add_action( 'admin_enqueue_scripts', array('wpshop_init', 'admin_js') );
51
+			add_action('admin_enqueue_scripts', array('wpshop_init', 'admin_js'));
52 52
 			add_action('admin_footer', array('wpshop_init', 'admin_js_footer'));
53 53
 
54 54
 			/*	Include the different css	*/
@@ -57,28 +57,28 @@  discard block
 block discarded – undo
57 57
 		add_action('admin_init', array('wpshop_init', 'admin_css'));
58 58
 
59 59
 		/*	Include the different css	*/
60
-		if ( !is_admin() ) {
60
+		if (!is_admin()) {
61 61
 			add_action('wp_print_styles', array('wpshop_init', 'frontend_css'));
62 62
 			add_action('wp_print_scripts', array('wpshop_init', 'frontend_js_instruction'));
63 63
 		}
64 64
 
65
-		if (isset($page,$action) && $page=='wpshop_doc' && $action=='edit') {
65
+		if (isset($page, $action) && $page == 'wpshop_doc' && $action == 'edit') {
66 66
 			add_action('admin_init', array('wpshop_doc', 'init_wysiwyg'));
67 67
 		}
68 68
 
69 69
 		// RICH TEXT EDIT INIT
70
-		add_action('init', array('wpshop_display','wpshop_rich_text_tags'), 9999);
71
-		add_action('init', array('wpshop_display','wps_hide_admin_bar_for_customers'), 9999 );
70
+		add_action('init', array('wpshop_display', 'wpshop_rich_text_tags'), 9999);
71
+		add_action('init', array('wpshop_display', 'wps_hide_admin_bar_for_customers'), 9999);
72 72
 
73 73
 		/**	Adda custom class to the admin body	*/
74
-		add_filter( 'admin_body_class', array( 'wpshop_init', 'admin_body_class' ) );
75
-		add_filter( 'site_transient_update_plugins', array( 'wpshop_init', 'site_transient_update_plugins' ) );
74
+		add_filter('admin_body_class', array('wpshop_init', 'admin_body_class'));
75
+		add_filter('site_transient_update_plugins', array('wpshop_init', 'site_transient_update_plugins'));
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 *	Admin menu creation
80 80
 	 */
81
-	public static function admin_menu(){
81
+	public static function admin_menu() {
82 82
 		global $menu;
83 83
 
84 84
 		/*	Get current plugin version	*/
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 
87 87
 		$wpshop_catalog_menu_order = 34;
88 88
 
89
-		$menu[ $wpshop_catalog_menu_order-1 ] = array( '', 'read', 'separator-wpshop_dashboard', '', 'wp-menu-separator wpshop_dashboard' );
89
+		$menu[$wpshop_catalog_menu_order - 1] = array('', 'read', 'separator-wpshop_dashboard', '', 'wp-menu-separator wpshop_dashboard');
90 90
 
91 91
 		/*	Main menu creation	*/
92 92
 		global $wps_dashboard_ctr;
93
-		add_menu_page(__( 'Dashboard', 'wpshop' ), __( 'Shop', 'wpshop' ), 'wpshop_view_dashboard', WPSHOP_URL_SLUG_DASHBOARD, array( $wps_dashboard_ctr, 'display_dashboard' ), 'dashicons-admin-home', $wpshop_catalog_menu_order);
94
-		add_submenu_page(WPSHOP_URL_SLUG_DASHBOARD, __('Dashboard', 'wpshop' ), __('Dashboard', 'wpshop'), 'wpshop_view_dashboard', WPSHOP_URL_SLUG_DASHBOARD, array( $wps_dashboard_ctr, 'display_dashboard' ));
93
+		add_menu_page(__('Dashboard', 'wpshop'), __('Shop', 'wpshop'), 'wpshop_view_dashboard', WPSHOP_URL_SLUG_DASHBOARD, array($wps_dashboard_ctr, 'display_dashboard'), 'dashicons-admin-home', $wpshop_catalog_menu_order);
94
+		add_submenu_page(WPSHOP_URL_SLUG_DASHBOARD, __('Dashboard', 'wpshop'), __('Dashboard', 'wpshop'), 'wpshop_view_dashboard', WPSHOP_URL_SLUG_DASHBOARD, array($wps_dashboard_ctr, 'display_dashboard'));
95 95
 
96 96
 		/*	Add eav model menus	*/
97
-		add_menu_page(__( 'Entities', 'wpshop' ), __( 'Entities', 'wpshop' ), 'wpshop_view_dashboard', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, array('wpshop_display', 'display_page'), 'dashicons-universal-access-alt', $wpshop_catalog_menu_order + 1);
98
-		add_submenu_page(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, __( 'Attributes', 'wpshop' ), __('Attributes', 'wpshop'), 'wpshop_view_attributes', WPSHOP_URL_SLUG_ATTRIBUTE_LISTING, array('wpshop_display','display_page'));
99
-		add_submenu_page(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, __( 'Attributes groups', 'wpshop' ), __('Attributes groups', 'wpshop'), 'wpshop_view_attribute_set', WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING, array('wpshop_display','display_page'));
97
+		add_menu_page(__('Entities', 'wpshop'), __('Entities', 'wpshop'), 'wpshop_view_dashboard', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, array('wpshop_display', 'display_page'), 'dashicons-universal-access-alt', $wpshop_catalog_menu_order + 1);
98
+		add_submenu_page(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, __('Attributes', 'wpshop'), __('Attributes', 'wpshop'), 'wpshop_view_attributes', WPSHOP_URL_SLUG_ATTRIBUTE_LISTING, array('wpshop_display', 'display_page'));
99
+		add_submenu_page(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, __('Attributes groups', 'wpshop'), __('Attributes groups', 'wpshop'), 'wpshop_view_attribute_set', WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING, array('wpshop_display', 'display_page'));
100 100
 
101 101
 		/*	Add messages menus	*/
102 102
 		//add_submenu_page(WPSHOP_URL_SLUG_DASHBOARD, __( 'Messages', 'wpshop' ), __( 'Messages', 'wpshop'), 'wpshop_view_messages', 'edit.php?post_type='.WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 		/*	Add a menu for plugin tools	*/
107 107
 // 		if (WPSHOP_DISPLAY_TOOLS_MENU) {
108
-			add_management_page( __('Wpshop - Tools', 'wpshop' ), __('Wpshop - Tools', 'wpshop' ), 'wpshop_view_tools_menu', WPSHOP_URL_SLUG_TOOLS , array('wpshop_tools', 'main_page'));
108
+			add_management_page(__('Wpshop - Tools', 'wpshop'), __('Wpshop - Tools', 'wpshop'), 'wpshop_view_tools_menu', WPSHOP_URL_SLUG_TOOLS, array('wpshop_tools', 'main_page'));
109 109
 // 		}
110 110
 
111 111
 		/*	Add the options menu	*/
@@ -119,29 +119,29 @@  discard block
 block discarded – undo
119 119
 		$wpshop_menu_order = array();
120 120
 
121 121
 		// Get the index of our custom separator
122
-		$separator = array_search( 'separator-wpshop_dashboard', $menu_order );
123
-		$product = array_search( 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, $menu_order );
124
-		$order = array_search( 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER, $menu_order );
125
-		$customers = array_search( 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, $menu_order );
122
+		$separator = array_search('separator-wpshop_dashboard', $menu_order);
123
+		$product = array_search('edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, $menu_order);
124
+		$order = array_search('edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER, $menu_order);
125
+		$customers = array_search('edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, $menu_order);
126 126
 		//$entities = array_search( 'admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, $menu_order );
127
-		$entities = array_search( WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, $menu_order );
127
+		$entities = array_search(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, $menu_order);
128 128
 
129
-		unset( $menu_order[$separator] );
130
-		unset( $menu_order[$product] );
131
-		unset( $menu_order[$order] );
132
-		unset( $menu_order[$customers] );
133
-		unset( $menu_order[$entities] );
129
+		unset($menu_order[$separator]);
130
+		unset($menu_order[$product]);
131
+		unset($menu_order[$order]);
132
+		unset($menu_order[$customers]);
133
+		unset($menu_order[$entities]);
134 134
 
135 135
 		// Loop through menu order and do some rearranging
136
-		foreach ( $menu_order as $index => $item ) :
137
-			if ( 'wpshop_dashboard' == $item ) :
136
+		foreach ($menu_order as $index => $item) :
137
+			if ('wpshop_dashboard' == $item) :
138 138
 				$wpshop_menu_order[] = 'separator-wpshop_dashboard';
139 139
 				$wpshop_menu_order[] = $item;
140 140
 				$wpshop_menu_order[] = 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT;
141 141
 				$wpshop_menu_order[] = 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER;
142 142
 				$wpshop_menu_order[] = 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS;
143 143
 				$wpshop_menu_order[] = WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES;
144
-			elseif ( !in_array( $item, array( 'separator-wpshop_dashboard' ) ) ) :
144
+			elseif (!in_array($item, array('separator-wpshop_dashboard'))) :
145 145
 				$wpshop_menu_order[] = $item;
146 146
 			endif;
147 147
 		endforeach;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	public static function admin_custom_menu_order() {
154
-		return current_user_can( 'manage_options' );
154
+		return current_user_can('manage_options');
155 155
 	}
156 156
 
157 157
 	/**
@@ -161,18 +161,18 @@  discard block
 block discarded – undo
161 161
 
162 162
 		/*	Désactivation de l'enregistrement automatique pour certains type de post	*/
163 163
 		global $post;
164
-		if ( $post && ( (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_ORDER) ||  (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE)
165
-				|| (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES) || (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_COUPON) ) ) {
164
+		if ($post && ((get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_ORDER) || (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE)
165
+				|| (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES) || (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_COUPON))) {
166 166
 			wp_dequeue_script('autosave');
167 167
 		}
168 168
 
169
-		$entity_to_search = !empty( $_GET['entity_to_search'] ) ? sanitize_text_field( $_GET['entity_to_search'] ) : '';
169
+		$entity_to_search = !empty($_GET['entity_to_search']) ? sanitize_text_field($_GET['entity_to_search']) : '';
170 170
 //	var WPSHOP_AJAX_FILE_URL = "'.WPSHOP_AJAX_FILE_URL.'";
171 171
 		echo '
172 172
 <script type="text/javascript">
173 173
 
174
-	var WPSHOP_MEDIAS_ICON_URL = "'.WPSHOP_MEDIAS_ICON_URL.'";
175
-	var WPSHOP_PRODUCT_PRICE_PILOT = "'.WPSHOP_PRODUCT_PRICE_PILOT.'";
174
+	var WPSHOP_MEDIAS_ICON_URL = "'.WPSHOP_MEDIAS_ICON_URL . '";
175
+	var WPSHOP_PRODUCT_PRICE_PILOT = "'.WPSHOP_PRODUCT_PRICE_PILOT . '";
176 176
 	var WPSHOP_PRODUCT_PRICE_HT = "' . WPSHOP_PRODUCT_PRICE_HT . '";
177 177
 	var WPSHOP_PRODUCT_PRICE_TAX = "' . WPSHOP_PRODUCT_PRICE_TAX . '";
178 178
 	var WPSHOP_PRODUCT_PRICE_TTC = "' . WPSHOP_PRODUCT_PRICE_TTC . '";
@@ -188,16 +188,16 @@  discard block
 block discarded – undo
188 188
 	var WPSHOP_JS_VAR_ADD_LOGO = "' . __('Upload your logo', 'wpshop') . '";
189 189
 	var WPSHOP_NEWOPTION_CREATION_NONCE = "' . wp_create_nonce("wpshop_new_option_for_attribute_creation") . '";
190 190
 
191
-	var WPSHOP_ADD_TEXT = "'.__('Add', 'wpshop').'";
192
-	var WPSHOP_CREATE_TEXT = "'.__('Create', 'wpshop').'";
193
-	var WPSHOP_SAVE_PRODUCT_OPTIONS_PARAMS = "'.__('Save parameters', 'wpshop').'";
191
+	var WPSHOP_ADD_TEXT = "'.__('Add', 'wpshop') . '";
192
+	var WPSHOP_CREATE_TEXT = "'.__('Create', 'wpshop') . '";
193
+	var WPSHOP_SAVE_PRODUCT_OPTIONS_PARAMS = "'.__('Save parameters', 'wpshop') . '";
194 194
 
195
-	var WPSHOP_NEW_OPTION_IN_LIST_EMPTY = "'.__('You don\'t specify all needed file', 'wpshop').'";
196
-	var WPSHOP_IS_NOT_ALLOWED_SHIPPING_COUNTRY = "'.__('Sorry ! You can\'t order on this shop, because we don\'t ship in your country.', 'wpshop').'";
197
-	var WPSHOP_CONFIRM_BEFORE_GENERATE_INVOICE = "'.__('If you generate the invoice, you will cannot modify this order later. Are you sure to do this action ?', 'wpshop').'";
198
-	var WPSHOP_NEW_OPTION_ALREADY_EXIST_IN_LIST = "'.__('The value you entered already exist in list', 'wpshop').'";
199
-	var WPSHOP_SURE_TO_DELETE_ATTR_OPTION_FROM_LIST = "'.__('Are you sure you want to delete this option from list?', 'wpshop').'";
200
-	var WPSHOP_DEFAULT_VALUE = "'.__('Set as default value', 'wpshop').'";
195
+	var WPSHOP_NEW_OPTION_IN_LIST_EMPTY = "'.__('You don\'t specify all needed file', 'wpshop') . '";
196
+	var WPSHOP_IS_NOT_ALLOWED_SHIPPING_COUNTRY = "'.__('Sorry ! You can\'t order on this shop, because we don\'t ship in your country.', 'wpshop') . '";
197
+	var WPSHOP_CONFIRM_BEFORE_GENERATE_INVOICE = "'.__('If you generate the invoice, you will cannot modify this order later. Are you sure to do this action ?', 'wpshop') . '";
198
+	var WPSHOP_NEW_OPTION_ALREADY_EXIST_IN_LIST = "'.__('The value you entered already exist in list', 'wpshop') . '";
199
+	var WPSHOP_SURE_TO_DELETE_ATTR_OPTION_FROM_LIST = "'.__('Are you sure you want to delete this option from list?', 'wpshop') . '";
200
+	var WPSHOP_DEFAULT_VALUE = "'.__('Set as default value', 'wpshop') . '";
201 201
 	var WPSHOP_MSG_INVOICE_QUOTATION = "' . __('Are you sure you want to charge this order? You\'ll be unable to modify the content after this operation', 'wpshop') . '";
202 202
 	var WPSHOP_MSG_IGNORE_CONFIGURATION = "' . __('If you continue without install the plugin. Your products won\'t be purchasable', 'wpshop') . '";
203 203
 	var WPSHOP_MSG_CONFIRM_THUMBNAIL_DELETION = "' . __('Are you sure you want to delete this thumbnail?', 'wpshop') . '";
@@ -206,55 +206,55 @@  discard block
 block discarded – undo
206 206
 	var WPSHOP_CHOSEN_SELECT_FROM_LIST = "' . __('Select an Option', 'wpshop') . '";
207 207
 	var WPSHOP_AJAX_CHOSEN_KEEP_TYPING = "' . __('Keep typing for search launching', 'wpshop') . '";
208 208
 	var WPSHOP_AJAX_CHOSEN_SEARCHING = "' . __('Searching in progress for', 'wpshop') . '";
209
-	var WPSHOP_MSG_CONFIRM_ADDON_DEACTIVATION = "'.__('Are you sure you want to deactivate this addon?', 'wpshop').'";
210
-	var WPS_DELETE_SHOP_LOGO_MSG = "'.__('Are you sure you want to delete this logo?', 'wpshop').'";
209
+	var WPSHOP_MSG_CONFIRM_ADDON_DEACTIVATION = "'.__('Are you sure you want to deactivate this addon?', 'wpshop') . '";
210
+	var WPS_DELETE_SHOP_LOGO_MSG = "'.__('Are you sure you want to delete this logo?', 'wpshop') . '";
211 211
 	var WPS_DEFAULT_LOGO = "'.WPSHOP_MEDIAS_IMAGES_URL . 'no_picture.png";
212 212
 
213
-	var WPSHOP_NO_ATTRIBUTES_SELECT_FOR_VARIATION = "'.__('You have to select at least one attribute for creating a new variation', 'wpshop').'";
213
+	var WPSHOP_NO_ATTRIBUTES_SELECT_FOR_VARIATION = "'.__('You have to select at least one attribute for creating a new variation', 'wpshop') . '";
214 214
 
215 215
 	var WPSHOP_CHOSEN_ATTRS = {search_contains: true, disable_search_threshold: 5, no_results_text: WPSHOP_CHOSEN_NO_RESULT, placeholder_text_single : WPSHOP_CHOSEN_SELECT_FROM_LIST, placeholder_text_multiple : WPSHOP_CHOSEN_SELECT_FROM_MULTI_LIST};
216 216
 
217
-	var WPSHOP_TEMPLATES_URL = "'.WPSHOP_TEMPLATES_URL.'";
218
-	var WPSHOP_BUTTON_DESCRIPTION = "'.__('Insert shortcode into page content', 'wpshop').'";
219
-	var WPSHOP_WYSIWYG_MENU_TITLE_PRODUCT_LISTING = "'.__('Product listing', 'wpshop').'";
220
-	var WPSHOP_WYSIWYG_PRODUCT_LISTING_BY_PID_TITLE = "'.__('By product ID', 'wpshop').'";
221
-	var WPSHOP_WYSIWYG_PRODUCT_LISTING_BY_ATTRIBUTE_TITLE = "'.__('By attribute value', 'wpshop').'";
222
-	var WPSHOP_WYSIWYG_MENU_TITLE_CATEGORIES = "'.__('WPShop categories', 'wpshop').'";
223
-	var WPSHOP_WYSIWYG_MENU_TITLE_ATTRIBUTE_VALUE = "'.__('Attribute value', 'wpshop').'";
224
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_TITLE = "'.__('Custom message content', 'wpshop').'";
225
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_FIRST_NAME = "'.__('Customer first name', 'wpshop').'";
226
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_LAST_NAME = "'.__('Customer last name', 'wpshop').'";
227
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_EMAIL = "'.__('Customer email', 'wpshop').'";
228
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_ID = "'.__('Order identifer', 'wpshop').'";
229
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_PAYPAL_TRANSACTION_ID = "'.__('Paypal transaction ID', 'wpshop').'";
230
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_CONTENT = "'.__('Order content', 'wpshop').'";
231
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_CUSTOMER_PERSONNAL_INFORMATIONS = "'.__('Customer personnal informations', 'wpshop').'";
232
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_ADDRESSES = "'.__('Order addresses', 'wpshop').'";
233
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_BILLING_ORDER_ADDRESS = "'.__('Billing order address', 'wpshop').'";
234
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_SHIPPING_ORDER_ADDRESS = "'.__('Shipping order address', 'wpshop').'";
235
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_SHIPPING_METHOD = "'.__('Shipping method', 'wpshop').'";
236
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_PAYMENT_METHOD = "'.__('order payment_method', 'wpshop').'";
237
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_COMMENT = "'.__('Order customer comment', 'wpshop').'";
238
-	var WPSHOP_CUSTOM_TAGS_TITLE = "'.__('Wpshop custom tags', 'wpshop').'";
239
-	var WPSHOP_CUSTOM_TAGS_CART = "'.__('Cart', 'wpshop').'";
240
-	var WPSHOP_CUSTOM_TAGS_CART_MINI = "'.__('Cart widget', 'wpshop').'";
241
-	var WPSHOP_CUSTOM_TAGS_CHECKOUT = "'.__('Checkout', 'wpshop').'";
242
-	var WPSHOP_CUSTOM_TAGS_ACCOUNT = "'.__('Customer account', 'wpshop').'";
243
-	var WPSHOP_CUSTOM_TAGS_SHOP = "'.__('Shop', 'wpshop').'";
244
-	var WPSHOP_CUSTOM_TAGS_ADVANCED_SEARCH = "'.__('Advanced search', 'wpshop').'";
245
-	var WPSHOP_CANCEL_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to cancel this order ?', 'wpshop').'";
246
-	var WPSHOP_REFUND_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to refund this order ?', 'wpshop').'";
247
-	var WPSHOP_RESEND_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to resend this order to customer ?', 'wpshop').'";
248
-	var WPSHOP_SEARCH_IN_ORDER_EXPLAIN_MESSAGE = "'.__('You want to search in orders', 'wpshop').'";
249
-	var WPSHOP_SEARCH_IN_ORDER_CHOICE_CUSTOMER = "'.__('a customer', 'wpshop').'";
250
-	var WPSHOP_SEARCH_IN_ORDER_CHOICE_PRODUCT = "'.__('a product', 'wpshop').'";
251
-	var WPSHOP_SEARCH_IN_ORDER_USER_CHOICE = "'.( (!empty($entity_to_search) ) ? $entity_to_search : 'customer' ).'";
252
-	var WPSHOP_DELETE_ADDRESS_CONFIRMATION = "'.__( 'Do you really want to delete this address', 'wpshop' ).'";
253
-
254
-	var wps_options_shipping_weight_for_custom_fees = "'.__( 'You must enter a weight', 'wpshop' ).'";
255
-	var wps_options_country_choose_for_custom_fees = "'.__( 'You must a country for custom fees saving', 'wpshop' ).'";
256
-	var wps_options_country_postcode_choose_for_custom_fees = "'.__( 'You must choose a country or write a postcode.', 'wpshop' ).'";
257
-	var wps_an_error_occured = "'.__( 'An error occured', 'wpshop' ).'";
217
+	var WPSHOP_TEMPLATES_URL = "'.WPSHOP_TEMPLATES_URL . '";
218
+	var WPSHOP_BUTTON_DESCRIPTION = "'.__('Insert shortcode into page content', 'wpshop') . '";
219
+	var WPSHOP_WYSIWYG_MENU_TITLE_PRODUCT_LISTING = "'.__('Product listing', 'wpshop') . '";
220
+	var WPSHOP_WYSIWYG_PRODUCT_LISTING_BY_PID_TITLE = "'.__('By product ID', 'wpshop') . '";
221
+	var WPSHOP_WYSIWYG_PRODUCT_LISTING_BY_ATTRIBUTE_TITLE = "'.__('By attribute value', 'wpshop') . '";
222
+	var WPSHOP_WYSIWYG_MENU_TITLE_CATEGORIES = "'.__('WPShop categories', 'wpshop') . '";
223
+	var WPSHOP_WYSIWYG_MENU_TITLE_ATTRIBUTE_VALUE = "'.__('Attribute value', 'wpshop') . '";
224
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_TITLE = "'.__('Custom message content', 'wpshop') . '";
225
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_FIRST_NAME = "'.__('Customer first name', 'wpshop') . '";
226
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_LAST_NAME = "'.__('Customer last name', 'wpshop') . '";
227
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_EMAIL = "'.__('Customer email', 'wpshop') . '";
228
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_ID = "'.__('Order identifer', 'wpshop') . '";
229
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_PAYPAL_TRANSACTION_ID = "'.__('Paypal transaction ID', 'wpshop') . '";
230
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_CONTENT = "'.__('Order content', 'wpshop') . '";
231
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_CUSTOMER_PERSONNAL_INFORMATIONS = "'.__('Customer personnal informations', 'wpshop') . '";
232
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_ADDRESSES = "'.__('Order addresses', 'wpshop') . '";
233
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_BILLING_ORDER_ADDRESS = "'.__('Billing order address', 'wpshop') . '";
234
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_SHIPPING_ORDER_ADDRESS = "'.__('Shipping order address', 'wpshop') . '";
235
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_SHIPPING_METHOD = "'.__('Shipping method', 'wpshop') . '";
236
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_PAYMENT_METHOD = "'.__('order payment_method', 'wpshop') . '";
237
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_COMMENT = "'.__('Order customer comment', 'wpshop') . '";
238
+	var WPSHOP_CUSTOM_TAGS_TITLE = "'.__('Wpshop custom tags', 'wpshop') . '";
239
+	var WPSHOP_CUSTOM_TAGS_CART = "'.__('Cart', 'wpshop') . '";
240
+	var WPSHOP_CUSTOM_TAGS_CART_MINI = "'.__('Cart widget', 'wpshop') . '";
241
+	var WPSHOP_CUSTOM_TAGS_CHECKOUT = "'.__('Checkout', 'wpshop') . '";
242
+	var WPSHOP_CUSTOM_TAGS_ACCOUNT = "'.__('Customer account', 'wpshop') . '";
243
+	var WPSHOP_CUSTOM_TAGS_SHOP = "'.__('Shop', 'wpshop') . '";
244
+	var WPSHOP_CUSTOM_TAGS_ADVANCED_SEARCH = "'.__('Advanced search', 'wpshop') . '";
245
+	var WPSHOP_CANCEL_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to cancel this order ?', 'wpshop') . '";
246
+	var WPSHOP_REFUND_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to refund this order ?', 'wpshop') . '";
247
+	var WPSHOP_RESEND_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to resend this order to customer ?', 'wpshop') . '";
248
+	var WPSHOP_SEARCH_IN_ORDER_EXPLAIN_MESSAGE = "'.__('You want to search in orders', 'wpshop') . '";
249
+	var WPSHOP_SEARCH_IN_ORDER_CHOICE_CUSTOMER = "'.__('a customer', 'wpshop') . '";
250
+	var WPSHOP_SEARCH_IN_ORDER_CHOICE_PRODUCT = "'.__('a product', 'wpshop') . '";
251
+	var WPSHOP_SEARCH_IN_ORDER_USER_CHOICE = "'.((!empty($entity_to_search)) ? $entity_to_search : 'customer') . '";
252
+	var WPSHOP_DELETE_ADDRESS_CONFIRMATION = "'.__('Do you really want to delete this address', 'wpshop') . '";
253
+
254
+	var wps_options_shipping_weight_for_custom_fees = "'.__('You must enter a weight', 'wpshop') . '";
255
+	var wps_options_country_choose_for_custom_fees = "'.__('You must a country for custom fees saving', 'wpshop') . '";
256
+	var wps_options_country_postcode_choose_for_custom_fees = "'.__('You must choose a country or write a postcode.', 'wpshop') . '";
257
+	var wps_an_error_occured = "'.__('An error occured', 'wpshop') . '";
258 258
 </script>';
259 259
 	}
260 260
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 		ob_end_clean();
270 270
 
271 271
 		echo '<script type="text/javascript">
272
-			var wp_version = "'.$wp_version.'";
273
-			'.$wpshop_product_js.'
272
+			var wp_version = "'.$wp_version . '";
273
+			'.$wpshop_product_js . '
274 274
 		</script>';
275 275
 	}
276 276
 
@@ -286,21 +286,21 @@  discard block
 block discarded – undo
286 286
 		wp_enqueue_script('jquery-ui-dialog');
287 287
 		wp_enqueue_script('jquery-form');
288 288
 		wp_enqueue_script('jquery-ui-slider');
289
-		wp_enqueue_script( 'jquery-ui-autocomplete' );
289
+		wp_enqueue_script('jquery-ui-autocomplete');
290 290
 		wp_enqueue_script('wpshop_main_function_js', WPSHOP_JS_URL . 'main_function.js', '', WPSHOP_VERSION);
291 291
 		wp_enqueue_script('wpshop_main_js', WPSHOP_JS_URL . 'main.js', '', WPSHOP_VERSION);
292 292
 		wp_enqueue_script('wpshop_jq_datatable', WPSHOP_JS_URL . 'jquery-libs/jquery.dataTables.min.js', '', WPSHOP_VERSION);
293
-		wp_enqueue_script('wpshop_jquery_chosen',  WPSHOP_JS_URL . 'jquery-libs/chosen.jquery.min.js', '', WPSHOP_VERSION);
293
+		wp_enqueue_script('wpshop_jquery_chosen', WPSHOP_JS_URL . 'jquery-libs/chosen.jquery.min.js', '', WPSHOP_VERSION);
294 294
 		wp_enqueue_script('jquery-effects-core');
295 295
 		wp_enqueue_script('jquery-effects-highlight');
296 296
 
297
-		$page = !empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
297
+		$page = !empty($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
298 298
 
299 299
 		/*	Include specific js file for the current page if existing	*/
300
-		if(isset($page) && is_file(WPSHOP_JS_DIR . 'pages/' . $page . '.js')){
300
+		if (isset($page) && is_file(WPSHOP_JS_DIR . 'pages/' . $page . '.js')) {
301 301
 			wp_enqueue_script($page . '_js', WPSHOP_JS_URL . 'pages/' . $page . '.js', '', WPSHOP_VERSION);
302 302
 		}
303
-		if((isset($page) && ($page == 'wpshop_dashboard'))) {
303
+		if ((isset($page) && ($page == 'wpshop_dashboard'))) {
304 304
 			wp_enqueue_script($page . '_js', WPSHOP_JS_URL . 'pages/' . WPSHOP_URL_SLUG_OPTION . '.js', '', WPSHOP_VERSION);
305 305
 			wp_register_style($page . '_css', WPSHOP_CSS_URL . 'pages/' . WPSHOP_URL_SLUG_OPTION . '.css', '', WPSHOP_VERSION);
306 306
 			wp_enqueue_style($page . '_css');
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
 	 * @param array $classes
328 328
 	 * @return string
329 329
 	 */
330
-	public static function admin_body_class( $classes ) {
330
+	public static function admin_body_class($classes) {
331 331
 		global $post;
332 332
 
333
-		if ( !empty($post->ID) ) {
334
-			$post_type = get_post_type( $post->ID );
335
-			if ( is_admin() && in_array( $post_type, array(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION, WPSHOP_NEWTYPE_IDENTIFIER_ORDER, WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE, WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, WPSHOP_NEWTYPE_IDENTIFIER_COUPON, WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS) ) ) {
333
+		if (!empty($post->ID)) {
334
+			$post_type = get_post_type($post->ID);
335
+			if (is_admin() && in_array($post_type, array(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION, WPSHOP_NEWTYPE_IDENTIFIER_ORDER, WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE, WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, WPSHOP_NEWTYPE_IDENTIFIER_COUPON, WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS))) {
336 336
 				$classes .= ' wpshop-admin-body wpshop-admin-post-type-' . $post_type;
337 337
 			}
338 338
 		}
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 		wp_enqueue_style('wpshop_chosen_css');
361 361
 
362 362
 		/*	Include specific css file for the current page if existing	*/
363
-		$page = !empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
364
-		if(isset($page) && is_file(WPSHOP_CSS_DIR . 'pages/' . $page . '.css')){
363
+		$page = !empty($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
364
+		if (isset($page) && is_file(WPSHOP_CSS_DIR . 'pages/' . $page . '.css')) {
365 365
 			wp_register_style($page . '_css', WPSHOP_CSS_URL . 'pages/' . $page . '.css', '', WPSHOP_VERSION);
366 366
 			wp_enqueue_style($page . '_css');
367 367
 		}
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
 		wp_register_style('wpshop_default_wps_style_css', WPSHOP_TEMPLATES_URL . 'wpshop/css/wps_style.css', '', WPSHOP_VERSION);
404 404
 		wp_enqueue_style('wpshop_default_wps_style_css');
405 405
 
406
-		if( file_exists( get_stylesheet_directory().'/wpshop/css/wps_style.css' ) ) {
407
-			wp_deregister_style( 'wpshop_default_wps_style_css' );
406
+		if (file_exists(get_stylesheet_directory() . '/wpshop/css/wps_style.css')) {
407
+			wp_deregister_style('wpshop_default_wps_style_css');
408 408
 			wp_register_style('wps_style_css', wpshop_display::get_template_file('wps_style.css', WPSHOP_TEMPLATES_URL, 'wpshop/css', 'output', true), '', WPSHOP_VERSION);
409 409
 			wp_enqueue_style('wps_style_css', 11);
410 410
 		}
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 		wp_register_style('wps_owl_caroussel_transitions', wpshop_display::get_template_file('owl.transitions.css', WPSHOP_TEMPLATES_URL, 'wpshop/css', 'output'), '', WPSHOP_VERSION);
417 417
 		wp_enqueue_style('wps_owl_caroussel_transitions');
418 418
 
419
-			wp_enqueue_style( 'dashicons' );
419
+			wp_enqueue_style('dashicons');
420 420
 	}
421 421
 
422 422
 	/**
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		wp_enqueue_script('jquery-ui-slider');
435 435
 		wp_enqueue_script('wpshop_frontend_main_js', wpshop_display::get_template_file('frontend_main.js', WPSHOP_TEMPLATES_URL, 'wpshop/js', 'output'), '', WPSHOP_VERSION, true);
436 436
 // 		wp_enqueue_script('wpshop_jquery_jqzoom_core_js', wpshop_display::get_template_file('jquery.jqzoom-core.js', WPSHOP_TEMPLATES_URL, 'wpshop/js', 'output'), '', WPSHOP_VERSION, true);
437
-		wp_enqueue_script('fancyboxmousewheel',WPSHOP_JS_URL . 'fancybox/jquery.mousewheel-3.0.4.pack.js', '', WPSHOP_VERSION, true);
437
+		wp_enqueue_script('fancyboxmousewheel', WPSHOP_JS_URL . 'fancybox/jquery.mousewheel-3.0.4.pack.js', '', WPSHOP_VERSION, true);
438 438
 		wp_enqueue_script('fancybox', WPSHOP_JS_URL . 'fancybox/jquery.fancybox-1.3.4.pack.js', '', WPSHOP_VERSION, true);
439 439
 		wp_enqueue_script('jquery_address', WPSHOP_JS_URL . 'jquery-libs/jquery.address-1.5.min.js', '', WPSHOP_VERSION);
440 440
 		wp_enqueue_script('wps_api', wpshop_display::get_template_file('wps-api.js', WPSHOP_TEMPLATES_URL, 'wpshop/js', 'output'), '', WPSHOP_VERSION, true);
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	var WPSHOP_MUST_CHOOSE_SHIPPING_MODE = "<?php _e('You must to choose a shipping mode', 'wpshop'); ?>";
458 458
 	var WPSHOP_NO_SHIPPING_MODE_AVAILABLE = "<?php _e('You can\'t order because no shipping mode is available.', 'wpshop'); ?>";
459 459
 	var WPSHOP_LOADER_ICON_JQUERY_ADDRESS = "<img src=\"<?php echo WPSHOP_LOADING_ICON; ?>\" alt=\"Loading...\" />";
460
-	var WPSHOP_CONFIRM_DELETE_ADDRESS = "<?php _e( 'Do you really want to delete this address ?', 'wpshop' ); ?>";
460
+	var WPSHOP_CONFIRM_DELETE_ADDRESS = "<?php _e('Do you really want to delete this address ?', 'wpshop'); ?>";
461 461
 	var wps_speed_slideUpDown = 200;
462 462
 	var MODAL_URL = '<?php echo WPSHOP_TEMPLATES_URL; ?>wpshop/modal.php';
463 463
 </script>
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 		$product_class = new wpshop_products();
496 496
 		add_action('save_post', array($product_class, 'save_product_custom_informations'));
497 497
 		/*	Modification des paramètres de variation quand ils ne sont pas configurés individuellement	*/
498
-		add_filter('pre_update_option_' . 'wpshop_catalog_product_option', array('wpshop_products', 'update_wpshop_catalog_product_option'), 10, 2 );
498
+		add_filter('pre_update_option_' . 'wpshop_catalog_product_option', array('wpshop_products', 'update_wpshop_catalog_product_option'), 10, 2);
499 499
 
500 500
 		/*	Add wpshop product category term	*/
501 501
 		wpshop_categories::create_product_categories();
@@ -503,14 +503,14 @@  discard block
 block discarded – undo
503 503
 		/*	Add wpshop message term	*/
504 504
 
505 505
 
506
-		if ( $wpshop_shop_type == 'sale' ) {
506
+		if ($wpshop_shop_type == 'sale') {
507 507
 			/*	Add wpshop orders term	*/
508 508
 			wpshop_orders::create_orders_type();
509 509
 			add_action('add_meta_boxes', array('wpshop_orders', 'add_meta_boxes'));
510
-			add_action('manage_'.WPSHOP_NEWTYPE_IDENTIFIER_ORDER.'_posts_custom_column',  array('wpshop_orders', 'orders_custom_columns'), 10, 2);
511
-			add_filter('manage_edit-'.WPSHOP_NEWTYPE_IDENTIFIER_ORDER.'_columns', array('wpshop_orders', 'orders_edit_columns'));
512
-			add_action('restrict_manage_posts', array('wpshop_orders', 'list_table_filters') );
513
-			add_filter('parse_query', array('wpshop_orders', 'list_table_filter_parse_query') );
510
+			add_action('manage_' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER . '_posts_custom_column', array('wpshop_orders', 'orders_custom_columns'), 10, 2);
511
+			add_filter('manage_edit-' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER . '_columns', array('wpshop_orders', 'orders_edit_columns'));
512
+			add_action('restrict_manage_posts', array('wpshop_orders', 'list_table_filters'));
513
+			add_filter('parse_query', array('wpshop_orders', 'list_table_filter_parse_query'));
514 514
 		}
515 515
 
516 516
 		$args = array(
@@ -520,14 +520,14 @@  discard block
 block discarded – undo
520 520
 		$output = 'objects'; // names or objects, note names is the default
521 521
 		$operator = 'or'; // 'and' or 'or'
522 522
 
523
-		$wp_types_original=get_post_types($args,$output,$operator);
523
+		$wp_types_original = get_post_types($args, $output, $operator);
524 524
 		foreach ($wp_types_original as $type => $type_definition):
525 525
 			$wp_types[$type] = $type_definition->labels->name;
526 526
 		endforeach;
527
-		$to_exclude=unserialize(WPSHOP_INTERNAL_TYPES_TO_EXCLUDE);
528
-		if(!empty($to_exclude)):
529
-			foreach($to_exclude as $excluded_type):
530
-				if(isset($wp_types[$excluded_type]))unset($wp_types[$excluded_type]);
527
+		$to_exclude = unserialize(WPSHOP_INTERNAL_TYPES_TO_EXCLUDE);
528
+		if (!empty($to_exclude)):
529
+			foreach ($to_exclude as $excluded_type):
530
+				if (isset($wp_types[$excluded_type]))unset($wp_types[$excluded_type]);
531 531
 			endforeach;
532 532
 		endif;
533 533
 		DEFINE('WPSHOP_INTERNAL_TYPES', serialize(array_merge($wp_types, array('users' => __('Users', 'wpshop')))));
@@ -536,29 +536,29 @@  discard block
 block discarded – undo
536 536
 	/**
537 537
 	 * Send mail when new version is available
538 538
 	 */
539
-	public static function site_transient_update_plugins( $option ) {
540
-		if ( isset( $option->response[ WPSHOP_PLUGIN_NAME ] ) ) {
539
+	public static function site_transient_update_plugins($option) {
540
+		if (isset($option->response[WPSHOP_PLUGIN_NAME])) {
541 541
 			global $wpdb;
542 542
 			$message_mdl = new wps_message_mdl();
543
-			$admin_new_version_message = get_option( 'WPSHOP_NEW_VERSION_ADMIN_MESSAGE', null );
544
-			$shop_admin_email_option = get_option( 'wpshop_emails' );
545
-			$shop_admin_id = $wpdb->get_var( $wpdb->prepare( 'SELECT ID FROM ' . $wpdb->users . ' WHERE user_email = %s', $shop_admin_email_option['contact_email'] ) );
546
-			if ( ! is_null( $shop_admin_id ) && ! is_null( $admin_new_version_message ) ) {
547
-				$messages_histo = $message_mdl->get_messages_histo( $admin_new_version_message, $shop_admin_id );
548
-				if ( ! empty( $messages_histo ) ) {
549
-					foreach ( $messages_histo as $messages_histo_group ) {
550
-						foreach ( $messages_histo_group as $messages_histo ) {
551
-							if ( strpos( $messages_histo['mess_title'], $option->response[ WPSHOP_PLUGIN_NAME ]->new_version ) !== false
552
-							|| strpos( $messages_histo['mess_message'], $option->response[ WPSHOP_PLUGIN_NAME ]->new_version ) !== false ) {
543
+			$admin_new_version_message = get_option('WPSHOP_NEW_VERSION_ADMIN_MESSAGE', null);
544
+			$shop_admin_email_option = get_option('wpshop_emails');
545
+			$shop_admin_id = $wpdb->get_var($wpdb->prepare('SELECT ID FROM ' . $wpdb->users . ' WHERE user_email = %s', $shop_admin_email_option['contact_email']));
546
+			if (!is_null($shop_admin_id) && !is_null($admin_new_version_message)) {
547
+				$messages_histo = $message_mdl->get_messages_histo($admin_new_version_message, $shop_admin_id);
548
+				if (!empty($messages_histo)) {
549
+					foreach ($messages_histo as $messages_histo_group) {
550
+						foreach ($messages_histo_group as $messages_histo) {
551
+							if (strpos($messages_histo['mess_title'], $option->response[WPSHOP_PLUGIN_NAME]->new_version) !== false
552
+							|| strpos($messages_histo['mess_message'], $option->response[WPSHOP_PLUGIN_NAME]->new_version) !== false) {
553 553
 								return $option;
554 554
 							}
555 555
 						}
556 556
 					}
557 557
 				}
558 558
 				$wps_message = new wps_message_ctr();
559
-				$wps_message->wpshop_prepared_email( $shop_admin_email_option['contact_email'], 'WPSHOP_NEW_VERSION_ADMIN_MESSAGE', array(
560
-					'wpshop_version' => $option->response[ WPSHOP_PLUGIN_NAME ]->new_version,
561
-				) );
559
+				$wps_message->wpshop_prepared_email($shop_admin_email_option['contact_email'], 'WPSHOP_NEW_VERSION_ADMIN_MESSAGE', array(
560
+					'wpshop_version' => $option->response[WPSHOP_PLUGIN_NAME]->new_version,
561
+				));
562 562
 			}
563 563
 		}
564 564
 		return $option;
Please login to merge, or discard this patch.
includes/librairies/HTML2PDF/_tcpdf_5.0.002/unicode_data.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 //============================================================+
3 3
 // File name   : unicode_data.php
4 4
 // Begin       : 2008-01-01
@@ -17855,7 +17855,7 @@  discard block
 block discarded – undo
17855 17855
  * at http://www.unicode.org/unicode/reports/tr9/
17856 17856
  */
17857 17857
 global $unicode_mirror;
17858
-$unicode_mirror = array (
17858
+$unicode_mirror = array(
17859 17859
 0x0028=>0x0029,
17860 17860
 0x0029=>0x0028,
17861 17861
 0x003C=>0x003E,
@@ -18298,7 +18298,7 @@  discard block
 block discarded – undo
18298 18298
  * char code=>isolated, final, initial, medial
18299 18299
  */
18300 18300
 global $laa_array;
18301
-$laa_array = array (
18301
+$laa_array = array(
18302 18302
 1570 =>array(65269, 65270, 65269, 65270),
18303 18303
 1571 =>array(65271, 65272, 65271, 65272),
18304 18304
 1573 =>array(65273, 65274, 65273, 65274),
@@ -18312,7 +18312,7 @@  discard block
 block discarded – undo
18312 18312
  * second NSM char code=>substitution char
18313 18313
  */
18314 18314
 global $diacritics;
18315
-$diacritics = array (
18315
+$diacritics = array(
18316 18316
 1612=>64606, # Shadda + Dammatan
18317 18317
 1613=>64607, # Shadda + Kasratan
18318 18318
 1614=>64608, # Shadda + Fatha
@@ -18324,23 +18324,23 @@  discard block
 block discarded – undo
18324 18324
  * Array of character substitutions from UTF-8 unicode to latin1
18325 18325
  */
18326 18326
 global $utf8tolatin;
18327
-$utf8tolatin = array (
18327
+$utf8tolatin = array(
18328 18328
 8364=>128, # Euro1
18329
-338=>140,  # OE
18330
-352=>138,  # Scaron
18331
-376=>159,  # Ydieresis
18332
-381=>142,  # Zcaron2
18329
+338=>140, # OE
18330
+352=>138, # Scaron
18331
+376=>159, # Ydieresis
18332
+381=>142, # Zcaron2
18333 18333
 8226=>149, # bullet3
18334
-710=>136,  # circumflex
18334
+710=>136, # circumflex
18335 18335
 8224=>134, # dagger
18336 18336
 8225=>135, # daggerdbl
18337 18337
 8230=>133, # ellipsis
18338 18338
 8212=>151, # emdash
18339 18339
 8211=>150, # endash
18340
-402=>131,  # florin
18340
+402=>131, # florin
18341 18341
 8249=>139, # guilsinglleft
18342 18342
 8250=>155, # guilsinglright
18343
-339=>156,  # oe
18343
+339=>156, # oe
18344 18344
 8240=>137, # perthousand
18345 18345
 8222=>132, # quotedblbase
18346 18346
 8220=>147, # quotedblleft
@@ -18348,8 +18348,8 @@  discard block
 block discarded – undo
18348 18348
 8216=>145, # quoteleft
18349 18349
 8217=>146, # quoteright
18350 18350
 8218=>130, # quotesinglbase
18351
-353=>154,  # scaron
18352
-732=>152,  # tilde
18351
+353=>154, # scaron
18352
+732=>152, # tilde
18353 18353
 8482=>153, # trademark
18354 18354
 382=>158   # zcaron2
18355 18355
 );
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
 // File name   : unicode_data.php
4 6
 // Begin       : 2008-01-01
Please login to merge, or discard this patch.
includes/librairies/HTML2PDF/_tcpdf_5.0.002/config/lang/ger.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 //============================================================+
3 3
 // File name   : eng.php
4 4
 // Begin       : 2004-03-03
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
 // File name   : eng.php
4 6
 // Begin       : 2004-03-03
Please login to merge, or discard this patch.