Completed
Push — master ( 260ddf...425d95 )
by
unknown
14:14
created
script/wp-emulator.script.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
 
159 159
 	function trailingslashit( $string )
160 160
 	{
161
-	    return untrailingslashit( $string ) . '/';
161
+		return untrailingslashit( $string ) . '/';
162 162
 	}
163 163
 
164 164
 	function untrailingslashit( $string )
165 165
 	{
166
-	        return rtrim( $string, '/\\' );
166
+			return rtrim( $string, '/\\' );
167 167
 	}
168 168
 
169 169
 	function site_url()
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		public $term_relationships = "term_relationship";
289 289
 		public $term_taxonomy = "term_taxonomy";
290 290
 
291
-    }
291
+	}
292 292
 
293 293
 	class WP_Widget
294 294
 	{
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	define('ABSPATH', dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DIRECTORY_SEPARATOR);
3
-	define('WP_PLUGIN_DIR', dirname(dirname(dirname(__FILE__))) );
3
+	define('WP_PLUGIN_DIR', dirname(dirname(dirname(__FILE__))));
4 4
 	define('WP_LANG_DIR', 'FR');
5 5
 	define('WP_CONTENT_DIR', 'wp-content');
6 6
 
7
-	function __( $str )
7
+	function __($str)
8 8
 	{
9 9
 		$translate = "Result Testing text";
10 10
 		echo "[+] Requesting __ -> " . $str . PHP_EOL;
11 11
 		return $translate;
12 12
 	}
13 13
 
14
-	function add_action( $init, $object )
14
+	function add_action($init, $object)
15 15
 	{
16 16
 		$length = 0;
17 17
 		$hooked = "";
18 18
 		$oType = gettype($object);
19
-		if($oType == "object" || $oType == "array")
19
+		if ($oType == "object" || $oType == "array")
20 20
 		{
21 21
 			$hooked = "[";
22
-			foreach($object as $hook)
22
+			foreach ($object as $hook)
23 23
 			{
24 24
 				$length++;
25 25
 				$type = gettype($hook);
26 26
 
27
-				switch($type)
27
+				switch ($type)
28 28
 				{
29 29
 					case "integer":
30 30
 					case "boolean":
@@ -37,27 +37,27 @@  discard block
 block discarded – undo
37 37
 						break;
38 38
 				}
39 39
 			}
40
-			if($length > 0) $hooked = rtrim($hooked, ",");
40
+			if ($length > 0) $hooked = rtrim($hooked, ",");
41 41
 			$hooked .= "]";
42 42
 		}
43 43
 		else $hooked .= $object;
44 44
 		echo "[+] Adding action -> " . $init . " in " . $hooked . PHP_EOL;
45 45
 	}
46 46
 
47
-	function register_activation_hook( $file , $object )
47
+	function register_activation_hook($file, $object)
48 48
 	{
49 49
 		$length = 0;
50 50
 		$hooked = "";
51 51
 		$oType = gettype($object);
52
-		if($oType == "object" || $oType == "array")
52
+		if ($oType == "object" || $oType == "array")
53 53
 		{
54 54
 			$hooked = "[";
55
-			foreach($object as $hook)
55
+			foreach ($object as $hook)
56 56
 			{
57 57
 				$length++;
58 58
 				$type = gettype($hook);
59 59
 
60
-				switch($type)
60
+				switch ($type)
61 61
 				{
62 62
 					case "integer":
63 63
 					case "boolean":
@@ -70,27 +70,27 @@  discard block
 block discarded – undo
70 70
 						break;
71 71
 				}
72 72
 			}
73
-			if($length > 0) $hooked = rtrim($hooked, ",");
73
+			if ($length > 0) $hooked = rtrim($hooked, ",");
74 74
 			$hooked .= "]";
75 75
 		}
76 76
 		else $hooked .= $object;
77 77
 		echo "[+] Registering actiovation hook -> " . $file . " in " . $hooked . PHP_EOL;
78 78
 	}
79 79
 
80
-	function register_deactivation_hook( $file , $object )
80
+	function register_deactivation_hook($file, $object)
81 81
 	{
82 82
 		$length = 0;
83 83
 		$hooked = "";
84 84
 		$oType = gettype($object);
85
-		if($oType == "object" || $oType == "array")
85
+		if ($oType == "object" || $oType == "array")
86 86
 		{
87 87
 			$hooked = "[";
88
-			foreach($object as $hook)
88
+			foreach ($object as $hook)
89 89
 			{
90 90
 				$length++;
91 91
 				$type = gettype($hook);
92 92
 
93
-				switch($type)
93
+				switch ($type)
94 94
 				{
95 95
 					case "integer":
96 96
 					case "boolean":
@@ -103,29 +103,29 @@  discard block
 block discarded – undo
103 103
 						break;
104 104
 				}
105 105
 			}
106
-			if($length > 0) $hooked = rtrim($hooked, ",");
106
+			if ($length > 0) $hooked = rtrim($hooked, ",");
107 107
 			$hooked .= "]";
108 108
 		}
109 109
 		else $hooked .= $object;
110 110
 		echo "[+] Registering actiovation hook -> " . $file . " in " . $hooked . PHP_EOL;
111 111
 	}
112 112
 
113
-	function add_filter( $name, $fn, $nbr = "")
113
+	function add_filter($name, $fn, $nbr = "")
114 114
 	{
115 115
 		echo "[+] Adding filter -> " . $name . " X" . $nbr . PHP_EOL;
116 116
 	}
117 117
 
118
-	function add_shortcode( $name )
118
+	function add_shortcode($name)
119 119
 	{
120 120
 		echo "[+] Adding shortcode -> " . $name . PHP_EOL;
121 121
 	}
122 122
 
123
-	function add_option( $name, $conf)
123
+	function add_option($name, $conf)
124 124
 	{
125 125
 		echo "[+] Adding option -> " . $name . " conf:" . $conf . PHP_EOL;
126 126
 	}
127 127
 
128
-	function update_option( $name, $conf)
128
+	function update_option($name, $conf)
129 129
 	{
130 130
 		echo "[+] Updating option -> " . $name . " conf:" . $conf . PHP_EOL;
131 131
 	}
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 	function plugin_dir_path($path)
154 154
 	{
155 155
 		echo "[+] Plugin path -> " . $path . PHP_EOL;
156
-		return trailingslashit( dirname( $path ) );
156
+		return trailingslashit(dirname($path));
157 157
 	}
158 158
 
159
-	function trailingslashit( $string )
159
+	function trailingslashit($string)
160 160
 	{
161
-	    return untrailingslashit( $string ) . '/';
161
+	    return untrailingslashit($string) . '/';
162 162
 	}
163 163
 
164
-	function untrailingslashit( $string )
164
+	function untrailingslashit($string)
165 165
 	{
166
-	        return rtrim( $string, '/\\' );
166
+	        return rtrim($string, '/\\');
167 167
 	}
168 168
 
169 169
 	function site_url()
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 		return $dir;
216 216
 	}
217 217
 
218
-	function add_theme_support( $theme )
218
+	function add_theme_support($theme)
219 219
 	{
220 220
 		echo "[+] Adding theme support -> " . $theme . PHP_EOL;
221 221
 	}
222 222
 
223
-	function add_image_size( $image, $x, $y, $bool )
223
+	function add_image_size($image, $x, $y, $bool)
224 224
 	{
225 225
 		echo "[+] Adding image size -> " . $image . " x:" . $x . " y:" . $y . " bool:" . $bool . PHP_EOL;
226 226
 	}
@@ -232,24 +232,24 @@  discard block
 block discarded – undo
232 232
 		return $lang;
233 233
 	}
234 234
 
235
-	function load_plugin_textdomain( $name, $bool, $dir)
235
+	function load_plugin_textdomain($name, $bool, $dir)
236 236
 	{
237 237
 		echo "[+] Loading plugin textdomain -> " . $name . " bool:" . $bool . " dir:" . $dir . PHP_EOL;
238 238
 	}
239 239
 
240
-	function get_option( $name, $int = 0 )
240
+	function get_option($name, $int = 0)
241 241
 	{
242 242
 		echo "[+] Getting option -> " . $name . " int:" . $int . PHP_EOL;
243 243
 		return "";
244 244
 	}
245 245
 
246
-	function get_site_option( $name, $int = 0 )
246
+	function get_site_option($name, $int = 0)
247 247
 	{
248 248
 		echo "[+] Getting site option -> " . $name . " int:" . $int . PHP_EOL;
249 249
 		return "";
250 250
 	}
251 251
 
252
-	function current_time( $str )
252
+	function current_time($str)
253 253
 	{
254 254
 		$time = " 2005-08-05 10:41:13";
255 255
 		echo "[+] Requesting current_time -> " . $str . PHP_EOL;
@@ -258,17 +258,17 @@  discard block
 block discarded – undo
258 258
 
259 259
 	class WPDB
260 260
 	{
261
-		function prepare( $request = "" )
261
+		function prepare($request = "")
262 262
 		{
263 263
 			echo "[+] Preparing -> " . $request . PHP_EOL;
264 264
 		}
265 265
 
266
-		public static function get_var( $request = "" )
266
+		public static function get_var($request = "")
267 267
 		{
268 268
 			echo "[+] Requesting get var -> " . $request . PHP_EOL;
269 269
 		}
270 270
 
271
-		public static function get_charset_collate( $request = "" )
271
+		public static function get_charset_collate($request = "")
272 272
 		{
273 273
 			echo "[+] Requesting get charset collate -> " . $request . PHP_EOL;
274 274
 		}
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,10 +37,13 @@  discard block
 block discarded – undo
37 37
 						break;
38 38
 				}
39 39
 			}
40
-			if($length > 0) $hooked = rtrim($hooked, ",");
40
+			if($length > 0) {
41
+				$hooked = rtrim($hooked, ",");
42
+			}
41 43
 			$hooked .= "]";
44
+		} else {
45
+			$hooked .= $object;
42 46
 		}
43
-		else $hooked .= $object;
44 47
 		echo "[+] Adding action -> " . $init . " in " . $hooked . PHP_EOL;
45 48
 	}
46 49
 
@@ -70,10 +73,13 @@  discard block
 block discarded – undo
70 73
 						break;
71 74
 				}
72 75
 			}
73
-			if($length > 0) $hooked = rtrim($hooked, ",");
76
+			if($length > 0) {
77
+				$hooked = rtrim($hooked, ",");
78
+			}
74 79
 			$hooked .= "]";
80
+		} else {
81
+			$hooked .= $object;
75 82
 		}
76
-		else $hooked .= $object;
77 83
 		echo "[+] Registering actiovation hook -> " . $file . " in " . $hooked . PHP_EOL;
78 84
 	}
79 85
 
@@ -103,10 +109,13 @@  discard block
 block discarded – undo
103 109
 						break;
104 110
 				}
105 111
 			}
106
-			if($length > 0) $hooked = rtrim($hooked, ",");
112
+			if($length > 0) {
113
+				$hooked = rtrim($hooked, ",");
114
+			}
107 115
 			$hooked .= "]";
116
+		} else {
117
+			$hooked .= $object;
108 118
 		}
109
-		else $hooked .= $object;
110 119
 		echo "[+] Registering actiovation hook -> " . $file . " in " . $hooked . PHP_EOL;
111 120
 	}
112 121
 
Please login to merge, or discard this patch.
script/unit.script.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 $unitList = searchFiles('.' . DIRECTORY_SEPARATOR, END_TEST);
11 11
 
12 12
 // Loop on unitList
13
-foreach($unitList as $test)
13
+foreach ($unitList as $test)
14 14
 {
15 15
 	echo "[+] Testing -> " . $test . PHP_EOL;
16 16
 	include($test);
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	$ite = new RecursiveIteratorIterator($dir);
29 29
 	$files = new RegexIterator($ite, $pattern, RegexIterator::GET_MATCH);
30 30
 	$fileList = array();
31
-	foreach($files as $file)
31
+	foreach ($files as $file)
32 32
 	{
33 33
 		$fileList[] = $file[0];
34 34
 	}
Please login to merge, or discard this patch.
includes/librairies/eav/wp_list_custom_attributes.class.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		 * to keep hidden, and a list of columns that are sortable. Each of these
315 315
 		 * can be defined in another method (as we've done here) before being
316 316
 		 * used to build the value for our _column_headers property.
317
-		*/
317
+		 */
318 318
 		$columns = $this->get_columns();
319 319
 		$hidden = array();
320 320
 		$sortable = $this->get_sortable_columns();
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
 		 * headers. The $this->_column_headers property takes an array which contains
325 325
 		 * 3 other arrays. One for all columns, one for hidden columns, and one
326 326
 		 * for sortable columns.
327
-		*/
327
+		 */
328 328
 		$this->_column_headers = array($columns, $hidden, $sortable);
329 329
 
330 330
 		/**
331 331
 		 * Optional. You can handle your bulk actions however you see fit. In this
332 332
 		 * case, we'll handle them within our package just to keep things clean.
333
-		*/
333
+		 */
334 334
 		$this->process_bulk_action();
335 335
 
336 336
 		/**
@@ -341,14 +341,14 @@  discard block
 block discarded – undo
341 341
 		 * our data. In a real-world implementation, you will probably want to
342 342
 		 * use sort and pagination data to build a custom query instead, as you'll
343 343
 		 * be able to use your precisely-queried data immediately.
344
-		*/
344
+		 */
345 345
 		$data = $this->datas;
346 346
 
347 347
 		/**
348 348
 		 * REQUIRED for pagination. Let's figure out what page the user is currently
349 349
 		 * looking at. We'll need this later, so you should always include it in
350 350
 		 * your own package classes.
351
-		*/
351
+		 */
352 352
 		$current_page = $this->get_pagenum();
353 353
 
354 354
 		/**
@@ -356,20 +356,20 @@  discard block
 block discarded – undo
356 356
 		 * In real-world use, this would be the total number of items in your database,
357 357
 		 * without filtering. We'll need this later, so you should always include it
358 358
 		 * in your own package classes.
359
-		*/
359
+		 */
360 360
 		$total_items = count($data);
361 361
 
362 362
 		/**
363 363
 		 * The WP_List_Table class does not handle pagination for us, so we need
364 364
 		 * to ensure that the data is trimmed to only the current page. We can use
365 365
 		 * array_slice() to
366
-		*/
366
+		 */
367 367
 		$data = array_slice($data,(($current_page-1)*$per_page),$per_page);
368 368
 
369 369
 		/**
370 370
 		 * REQUIRED. Now we can add our *sorted* data to the items property, where
371 371
 		 * it can be used by the rest of the class.
372
-		*/
372
+		 */
373 373
 		$this->items = $data;
374 374
 
375 375
 		/*	REQUIRED. We also have to register our pagination options & calculations.	*/
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.
Spacing   +49 added lines, -49 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
 
@@ -12,38 +12,38 @@  discard block
 block discarded – undo
12 12
  * @package wpshop
13 13
  * @subpackage librairies
14 14
  */
15
-class wpshop_attributes_custom_List_table extends WP_List_Table{
15
+class wpshop_attributes_custom_List_table extends WP_List_Table {
16 16
 	var $datas;
17 17
 
18 18
 	/** ************************************************************************
19 19
 	 * REQUIRED. Set up a constructor that references the parent constructor. We
20 20
 	 * use the parent reference to set some default configs.
21 21
 	 ***************************************************************************/
22
-	function __construct(){
22
+	function __construct() {
23 23
 		global $status, $page;
24 24
 
25 25
 		//Set parent defaults
26
-		parent::__construct( array(
27
-			'singular'  => __('attribute\'s', 'wpshop'),    //singular name of the listed records
28
-			'plural'    => __('attributes\'', 'wpshop'),    //plural name of the listed records
26
+		parent::__construct(array(
27
+			'singular'  => __('attribute\'s', 'wpshop'), //singular name of the listed records
28
+			'plural'    => __('attributes\'', 'wpshop'), //plural name of the listed records
29 29
 			'ajax'     => true       //does this table support ajax?
30
-		) );
30
+		));
31 31
 	}
32 32
 
33 33
 	/*	Allows to set different listings for attributes	*/
34
-	function get_views(){
34
+	function get_views() {
35 35
 		$wpshop_attribute_links = array();
36 36
 
37 37
 		$active_nb = wpshop_attributes::getElement('', "'valid'");
38 38
 		$unactive_nb = wpshop_attributes::getElement('', "'moderated', 'notused'");
39 39
 		$deleted_nb = wpshop_attributes::getElement('', "'deleted'");
40 40
 
41
-		$attribute_status = !empty( $_REQUEST['attribute_status'] ) ? sanitize_text_field( $_REQUEST['attribute_status'] ) : '';
41
+		$attribute_status = !empty($_REQUEST['attribute_status']) ? sanitize_text_field($_REQUEST['attribute_status']) : '';
42 42
 
43
-		$wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_valid'.(empty($attribute_status)?' current':'')] = '<a href="'.admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING).'" >'.__('Used attributes', 'wpshop').' ('.count($active_nb).')</a>';
44
-		$wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_moderated'.(!empty($attribute_status) && ($attribute_status=='unactive')?' current':'')] = '<a href="'.admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING.'&attribute_status=unactive').'" >'.__('Unactive attributes', 'wpshop').' ('.count($unactive_nb).')</a>';
45
-		$wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_deleted'.(!empty($attribute_status) && ($attribute_status=='deleted')?' current':'')] = '<a href="'.admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING.'&attribute_status=deleted').'" >'.__('Trashed attributes', 'wpshop').' ('.count($deleted_nb).')</a>';
46
-		$wpshop_attribute_links['unit_management_link'] = '<a href="#" id="wpshop_attribute_unit_manager_opener" data-nonce="' . wp_create_nonce( 'load_unit_interface' ) . '">'.__('Unit management', 'wpshop').'</a>';
43
+		$wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_valid' . (empty($attribute_status) ? ' current' : '')] = '<a href="' . admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING) . '" >' . __('Used attributes', 'wpshop') . ' (' . count($active_nb) . ')</a>';
44
+		$wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_moderated' . (!empty($attribute_status) && ($attribute_status == 'unactive') ? ' current' : '')] = '<a href="' . admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING . '&attribute_status=unactive') . '" >' . __('Unactive attributes', 'wpshop') . ' (' . count($unactive_nb) . ')</a>';
45
+		$wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_deleted' . (!empty($attribute_status) && ($attribute_status == 'deleted') ? ' current' : '')] = '<a href="' . admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING . '&attribute_status=deleted') . '" >' . __('Trashed attributes', 'wpshop') . ' (' . count($deleted_nb) . ')</a>';
46
+		$wpshop_attribute_links['unit_management_link'] = '<a href="#" id="wpshop_attribute_unit_manager_opener" data-nonce="' . wp_create_nonce('load_unit_interface') . '">' . __('Unit management', 'wpshop') . '</a>';
47 47
 		$wpshop_attribute_links['unit_management_dialog'] = '<div id="wpshop_attribute_unit_manager"title="' . __('Unit management', 'wpshop') . '" class="wpshopHide" ><div class="loading_picture_container" id="product_chooser_picture" ><img src="' . WPSHOP_LOADING_ICON . '" alt="loading..." /></div></div>';
48 48
 		return $wpshop_attribute_links;
49 49
 	}
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 * @see WP_List_Table::::single_row_columns()
62 62
 	 * @return array An associative array containing column information: 'slugs'=>'Visible Titles'
63 63
 	 **************************************************************************/
64
-	function get_columns(){
64
+	function get_columns() {
65 65
 		$columns = array(
66
-			'cb'       	=> '',//'<input type="checkbox" />', //Render a checkbox instead of text
66
+			'cb'       	=> '', //'<input type="checkbox" />', //Render a checkbox instead of text
67 67
 			'id'       	=> __('Id.', 'wpshop'),
68 68
 			'name'    	=> __('Name', 'wpshop'),
69 69
 			'status'    => __('Status', 'wpshop'),
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	 * @param array $column_name The name/slug of the column to be processed
95 95
 	 * @return string Text or HTML to be placed inside the column <td>
96 96
 	 **************************************************************************/
97
-	function column_default($item, $column_name){
98
-		switch($column_name){
97
+	function column_default($item, $column_name) {
98
+		switch ($column_name) {
99 99
 			default:
100
-				return print_r($item,true); //Show the whole array for troubleshooting purposes
100
+				return print_r($item, true); //Show the whole array for troubleshooting purposes
101 101
 		}
102 102
 	}
103 103
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @param array $item A singular item (one full row's worth of data)
118 118
 	 * @return string Text to be placed inside the column <td> (movie title only)
119 119
 	 **************************************************************************/
120
-	function column_id($item){
120
+	function column_id($item) {
121 121
 		return $item['id'];
122 122
 	}
123 123
 	/** ************************************************************************
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @param array $item A singular item (one full row's worth of data)
137 137
 	 * @return string Text to be placed inside the column <td> (movie title only)
138 138
 	 **************************************************************************/
139
-	function column_status($item){
139
+	function column_status($item) {
140 140
 		return __($item['status'], 'wpshop');
141 141
 	}
142 142
 	/** ************************************************************************
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @param array $item A singular item (one full row's worth of data)
156 156
 	 * @return string Text to be placed inside the column <td> (movie title only)
157 157
 	 **************************************************************************/
158
-	function column_code($item){
158
+	function column_code($item) {
159 159
 		return $item['code'];
160 160
 	}
161 161
 	/** ************************************************************************
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @param array $item A singular item (one full row's worth of data)
175 175
 	 * @return string Text to be placed inside the column <td> (movie title only)
176 176
 	 **************************************************************************/
177
-	function column_entity($item){
178
-		return __($item['entity'],'wpshop');
177
+	function column_entity($item) {
178
+		return __($item['entity'], 'wpshop');
179 179
 	}
180 180
 	/** ************************************************************************
181 181
 	 * Recommended. This is a custom column method and is responsible for what
@@ -193,28 +193,28 @@  discard block
 block discarded – undo
193 193
 	 * @param array $item A singular item (one full row's worth of data)
194 194
 	 * @return string Text to be placed inside the column <td> (movie title only)
195 195
 	 **************************************************************************/
196
-	function column_name($item){
196
+	function column_name($item) {
197 197
 		$attribute_undeletable = unserialize(WPSHOP_ATTRIBUTE_UNDELETABLE);
198 198
 
199
-		$link_format = admin_url('admin.php').'?page=%2$s&amp;action=%3$s&amp;id=%4$s';
200
-		$default_action='edit';
201
-		$default_action_text=__('Edit', 'wpshop');
202
-		$attribute_status = !empty( $_REQUEST['attribute_status'] ) ? sanitize_text_field( $_REQUEST['attribute_status'] ) : '';
203
-		if(!empty($attribute_status) && ($attribute_status=='deleted')){
204
-			$default_action='activate';
205
-			$default_action_text=__('Restore', 'wpshop');
199
+		$link_format = admin_url('admin.php') . '?page=%2$s&amp;action=%3$s&amp;id=%4$s';
200
+		$default_action = 'edit';
201
+		$default_action_text = __('Edit', 'wpshop');
202
+		$attribute_status = !empty($_REQUEST['attribute_status']) ? sanitize_text_field($_REQUEST['attribute_status']) : '';
203
+		if (!empty($attribute_status) && ($attribute_status == 'deleted')) {
204
+			$default_action = 'activate';
205
+			$default_action_text = __('Restore', 'wpshop');
206 206
 		}
207 207
 		//Build row actions
208 208
 		$actions = array(
209
-			'edit'     => sprintf('<a href="'.$link_format.'">'.$default_action_text.'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING,$default_action,$item['id'])
209
+			'edit'     => sprintf('<a href="' . $link_format . '">' . $default_action_text . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING, $default_action, $item['id'])
210 210
 		);
211
-		if(empty($attribute_status) && (!in_array($item['code'], $attribute_undeletable))){
212
-			$actions['delete'] = sprintf('<a href="'.$link_format.'">'.__('Delete', 'wpshop').'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING,'delete',$item['id']);
211
+		if (empty($attribute_status) && (!in_array($item['code'], $attribute_undeletable))) {
212
+			$actions['delete'] = sprintf('<a href="' . $link_format . '">' . __('Delete', 'wpshop') . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING, 'delete', $item['id']);
213 213
 		}
214 214
 
215 215
 		//Return the title contents
216 216
 		return sprintf('%1$s%2$s',
217
-			/*$1%s*/ sprintf('<a href="'.$link_format.'">'.__($item['name'], 'wpshop').'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING,$default_action,$item['id']),
217
+			/*$1%s*/ sprintf('<a href="' . $link_format . '">' . __($item['name'], 'wpshop') . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING, $default_action, $item['id']),
218 218
 			/*$3%s*/ $this->row_actions($actions)
219 219
 		);
220 220
 	}
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 	 * @param array $item A singular item (one full row's worth of data)
228 228
 	 * @return string Text to be placed inside the column <td> (movie title only)
229 229
 	 **************************************************************************/
230
-	function column_cb($item){
230
+	function column_cb($item) {
231 231
 		return '';
232 232
 		return sprintf(
233 233
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
234
-			/*$1%s*/ $this->_args['singular'],  //Let's simply repurpose the table's singular label ("movie")
234
+			/*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("movie")
235 235
 			/*$2%s*/ $item['id']             //The value of the checkbox should be the record's id
236 236
 		);
237 237
 	}
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
 	 **************************************************************************/
253 253
 	function get_sortable_columns() {
254 254
 		$sortable_columns = array(
255
-			'name'    => array('frontend_label',true),    //true means its already sorted
256
-			'status'  => array('status',true)
255
+			'name'    => array('frontend_label', true), //true means its already sorted
256
+			'status'  => array('status', true)
257 257
 		);
258 258
 		return $sortable_columns;
259 259
 	}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	 **************************************************************************/
289 289
 	function process_bulk_action() {
290 290
 		//Detect when a bulk action is being triggered...
291
-		if( 'delete'===$this->current_action() ) {
291
+		if ('delete' === $this->current_action()) {
292 292
 			wp_die('Items deleted (or they would be if we had items to delete)!');
293 293
 		}
294 294
 	}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 **************************************************************************/
310 310
 	function prepare_items() {
311 311
 		/*	First, lets decide how many records per page to show	*/
312
-		$per_page = 10;//$this->get_items_per_page('attributes_per_page', 10);
312
+		$per_page = 10; //$this->get_items_per_page('attributes_per_page', 10);
313 313
 
314 314
 		/**
315 315
 		 * REQUIRED. Now we need to define our column headers. This includes a complete
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 		 * to ensure that the data is trimmed to only the current page. We can use
368 368
 		 * array_slice() to
369 369
 		*/
370
-		$data = array_slice($data,(($current_page-1)*$per_page),$per_page);
370
+		$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
371 371
 
372 372
 		/**
373 373
 		 * REQUIRED. Now we can add our *sorted* data to the items property, where
@@ -376,10 +376,10 @@  discard block
 block discarded – undo
376 376
 		$this->items = $data;
377 377
 
378 378
 		/*	REQUIRED. We also have to register our pagination options & calculations.	*/
379
-		$this->set_pagination_args( array(
380
-			'total_items' => $total_items,               		//WE have to calculate the total number of items
381
-			'per_page'    => $per_page,                 		//WE have to determine how many items to show on a page
382
-			'total_pages' => ceil($total_items/$per_page)   //WE have to calculate the total number of pages
383
-		) );
379
+		$this->set_pagination_args(array(
380
+			'total_items' => $total_items, //WE have to calculate the total number of items
381
+			'per_page'    => $per_page, //WE have to determine how many items to show on a page
382
+			'total_pages' => ceil($total_items / $per_page)   //WE have to calculate the total number of pages
383
+		));
384 384
 	}
385 385
 }
Please login to merge, or discard this patch.
includes/librairies/eav/wp_list_custom_attributes_set.class.php 3 patches
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 	var $datas;
17 17
 
18 18
 	/** ************************************************************************
19
-	* REQUIRED. Set up a constructor that references the parent constructor. We
20
-	* use the parent reference to set some default configs.
21
-	***************************************************************************/
19
+	 * REQUIRED. Set up a constructor that references the parent constructor. We
20
+	 * use the parent reference to set some default configs.
21
+	 ***************************************************************************/
22 22
 	function __construct(){
23 23
 		global $status, $page;
24 24
 
@@ -44,18 +44,18 @@  discard block
 block discarded – undo
44 44
 	}
45 45
 
46 46
 	/** ************************************************************************
47
-	* REQUIRED! This method dictates the table's columns and titles. This should
48
-	* return an array where the key is the column slug (and class) and the value
49
-	* is the column's title text. If you need a checkbox for bulk actions, refer
50
-	* to the $columns array below.
51
-	*
52
-	* The 'cb' column is treated differently than the rest. If including a checkbox
53
-	* column in your table you must create a column_cb() method. If you don't need
54
-	* bulk actions or checkboxes, simply leave the 'cb' entry out of your array.
55
-	*
56
-	* @see WP_List_Table::::single_row_columns()
57
-	* @return array An associative array containing column information: 'slugs'=>'Visible Titles'
58
-	**************************************************************************/
47
+	 * REQUIRED! This method dictates the table's columns and titles. This should
48
+	 * return an array where the key is the column slug (and class) and the value
49
+	 * is the column's title text. If you need a checkbox for bulk actions, refer
50
+	 * to the $columns array below.
51
+	 *
52
+	 * The 'cb' column is treated differently than the rest. If including a checkbox
53
+	 * column in your table you must create a column_cb() method. If you don't need
54
+	 * bulk actions or checkboxes, simply leave the 'cb' entry out of your array.
55
+	 *
56
+	 * @see WP_List_Table::::single_row_columns()
57
+	 * @return array An associative array containing column information: 'slugs'=>'Visible Titles'
58
+	 **************************************************************************/
59 59
 	function get_columns(){
60 60
 		$columns = array(
61 61
 			'cb'       => '',//'<input type="checkbox" />', //Render a checkbox instead of text
@@ -69,26 +69,26 @@  discard block
 block discarded – undo
69 69
 	}
70 70
 
71 71
 	/** ************************************************************************
72
-	* Recommended. This method is called when the parent class can't find a method
73
-	* specifically build for a given column. Generally, it's recommended to include
74
-	* one method for each column you want to render, keeping your package class
75
-	* neat and organized. For example, if the class needs to process a column
76
-	* named 'title', it would first see if a method named $this->column_title()
77
-	* exists - if it does, that method will be used. If it doesn't, this one will
78
-	* be used. Generally, you should try to use custom column methods as much as
79
-	* possible.
80
-	*
81
-	* Since we have defined a column_title() method later on, this method doesn't
82
-	* need to concern itself with any column with a name of 'title'. Instead, it
83
-	* needs to handle everything else.
84
-	*
85
-	* For more detailed insight into how columns are handled, take a look at
86
-	* WP_List_Table::single_row_columns()
87
-	*
88
-	* @param array $item A singular item (one full row's worth of data)
89
-	* @param array $column_name The name/slug of the column to be processed
90
-	* @return string Text or HTML to be placed inside the column <td>
91
-	**************************************************************************/
72
+	 * Recommended. This method is called when the parent class can't find a method
73
+	 * specifically build for a given column. Generally, it's recommended to include
74
+	 * one method for each column you want to render, keeping your package class
75
+	 * neat and organized. For example, if the class needs to process a column
76
+	 * named 'title', it would first see if a method named $this->column_title()
77
+	 * exists - if it does, that method will be used. If it doesn't, this one will
78
+	 * be used. Generally, you should try to use custom column methods as much as
79
+	 * possible.
80
+	 *
81
+	 * Since we have defined a column_title() method later on, this method doesn't
82
+	 * need to concern itself with any column with a name of 'title'. Instead, it
83
+	 * needs to handle everything else.
84
+	 *
85
+	 * For more detailed insight into how columns are handled, take a look at
86
+	 * WP_List_Table::single_row_columns()
87
+	 *
88
+	 * @param array $item A singular item (one full row's worth of data)
89
+	 * @param array $column_name The name/slug of the column to be processed
90
+	 * @return string Text or HTML to be placed inside the column <td>
91
+	 **************************************************************************/
92 92
 	function column_default($item, $column_name){
93 93
 		switch($column_name){
94 94
 			default:
@@ -97,97 +97,97 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 
99 99
 	/** ************************************************************************
100
-	* Recommended. This is a custom column method and is responsible for what
101
-	* is rendered in any column with a name/slug of 'title'. Every time the class
102
-	* needs to render a column, it first looks for a method named
103
-	* column_{$column_title} - if it exists, that method is run. If it doesn't
104
-	* exist, column_default() is called instead.
105
-	*
106
-	* This example also illustrates how to implement rollover actions. Actions
107
-	* should be an associative array formatted as 'slug'=>'link html' - and you
108
-	* will need to generate the URLs yourself. You could even ensure the links
109
-	*
110
-	*
111
-	* @see WP_List_Table::::single_row_columns()
112
-	* @param array $item A singular item (one full row's worth of data)
113
-	* @return string Text to be placed inside the column <td> (movie title only)
114
-	**************************************************************************/
100
+	 * Recommended. This is a custom column method and is responsible for what
101
+	 * is rendered in any column with a name/slug of 'title'. Every time the class
102
+	 * needs to render a column, it first looks for a method named
103
+	 * column_{$column_title} - if it exists, that method is run. If it doesn't
104
+	 * exist, column_default() is called instead.
105
+	 *
106
+	 * This example also illustrates how to implement rollover actions. Actions
107
+	 * should be an associative array formatted as 'slug'=>'link html' - and you
108
+	 * will need to generate the URLs yourself. You could even ensure the links
109
+	 *
110
+	 *
111
+	 * @see WP_List_Table::::single_row_columns()
112
+	 * @param array $item A singular item (one full row's worth of data)
113
+	 * @return string Text to be placed inside the column <td> (movie title only)
114
+	 **************************************************************************/
115 115
 	function column_id($item){
116 116
 		return $item['id'];
117 117
 	}
118 118
 	/** ************************************************************************
119
-	* Recommended. This is a custom column method and is responsible for what
120
-	* is rendered in any column with a name/slug of 'title'. Every time the class
121
-	* needs to render a column, it first looks for a method named
122
-	* column_{$column_title} - if it exists, that method is run. If it doesn't
123
-	* exist, column_default() is called instead.
124
-	*
125
-	* This example also illustrates how to implement rollover actions. Actions
126
-	* should be an associative array formatted as 'slug'=>'link html' - and you
127
-	* will need to generate the URLs yourself. You could even ensure the links
128
-	*
129
-	*
130
-	* @see WP_List_Table::::single_row_columns()
131
-	* @param array $item A singular item (one full row's worth of data)
132
-	* @return string Text to be placed inside the column <td> (movie title only)
133
-	**************************************************************************/
119
+	 * Recommended. This is a custom column method and is responsible for what
120
+	 * is rendered in any column with a name/slug of 'title'. Every time the class
121
+	 * needs to render a column, it first looks for a method named
122
+	 * column_{$column_title} - if it exists, that method is run. If it doesn't
123
+	 * exist, column_default() is called instead.
124
+	 *
125
+	 * This example also illustrates how to implement rollover actions. Actions
126
+	 * should be an associative array formatted as 'slug'=>'link html' - and you
127
+	 * will need to generate the URLs yourself. You could even ensure the links
128
+	 *
129
+	 *
130
+	 * @see WP_List_Table::::single_row_columns()
131
+	 * @param array $item A singular item (one full row's worth of data)
132
+	 * @return string Text to be placed inside the column <td> (movie title only)
133
+	 **************************************************************************/
134 134
 	function column_status($item){
135 135
 		return __($item['status'], 'wpshop');
136 136
 	}
137 137
 	/** ************************************************************************
138
-	* Recommended. This is a custom column method and is responsible for what
139
-	* is rendered in any column with a name/slug of 'title'. Every time the class
140
-	* needs to render a column, it first looks for a method named
141
-	* column_{$column_title} - if it exists, that method is run. If it doesn't
142
-	* exist, column_default() is called instead.
143
-	*
144
-	* This example also illustrates how to implement rollover actions. Actions
145
-	* should be an associative array formatted as 'slug'=>'link html' - and you
146
-	* will need to generate the URLs yourself. You could even ensure the links
147
-	*
148
-	*
149
-	* @see WP_List_Table::::single_row_columns()
150
-	* @param array $item A singular item (one full row's worth of data)
151
-	* @return string Text to be placed inside the column <td> (movie title only)
152
-	**************************************************************************/
138
+	 * Recommended. This is a custom column method and is responsible for what
139
+	 * is rendered in any column with a name/slug of 'title'. Every time the class
140
+	 * needs to render a column, it first looks for a method named
141
+	 * column_{$column_title} - if it exists, that method is run. If it doesn't
142
+	 * exist, column_default() is called instead.
143
+	 *
144
+	 * This example also illustrates how to implement rollover actions. Actions
145
+	 * should be an associative array formatted as 'slug'=>'link html' - and you
146
+	 * will need to generate the URLs yourself. You could even ensure the links
147
+	 *
148
+	 *
149
+	 * @see WP_List_Table::::single_row_columns()
150
+	 * @param array $item A singular item (one full row's worth of data)
151
+	 * @return string Text to be placed inside the column <td> (movie title only)
152
+	 **************************************************************************/
153 153
 	function column_content($item){
154 154
 		return $item['content'];
155 155
 	}
156 156
 	/** ************************************************************************
157
-	* Recommended. This is a custom column method and is responsible for what
158
-	* is rendered in any column with a name/slug of 'title'. Every time the class
159
-	* needs to render a column, it first looks for a method named
160
-	* column_{$column_title} - if it exists, that method is run. If it doesn't
161
-	* exist, column_default() is called instead.
162
-	*
163
-	* This example also illustrates how to implement rollover actions. Actions
164
-	* should be an associative array formatted as 'slug'=>'link html' - and you
165
-	* will need to generate the URLs yourself. You could even ensure the links
166
-	*
167
-	*
168
-	* @see WP_List_Table::::single_row_columns()
169
-	* @param array $item A singular item (one full row's worth of data)
170
-	* @return string Text to be placed inside the column <td> (movie title only)
171
-	**************************************************************************/
157
+	 * Recommended. This is a custom column method and is responsible for what
158
+	 * is rendered in any column with a name/slug of 'title'. Every time the class
159
+	 * needs to render a column, it first looks for a method named
160
+	 * column_{$column_title} - if it exists, that method is run. If it doesn't
161
+	 * exist, column_default() is called instead.
162
+	 *
163
+	 * This example also illustrates how to implement rollover actions. Actions
164
+	 * should be an associative array formatted as 'slug'=>'link html' - and you
165
+	 * will need to generate the URLs yourself. You could even ensure the links
166
+	 *
167
+	 *
168
+	 * @see WP_List_Table::::single_row_columns()
169
+	 * @param array $item A singular item (one full row's worth of data)
170
+	 * @return string Text to be placed inside the column <td> (movie title only)
171
+	 **************************************************************************/
172 172
 	function column_entity($item){
173 173
 		return __($item['entity'],'wpshop');
174 174
 	}
175 175
 	/** ************************************************************************
176
-	* Recommended. This is a custom column method and is responsible for what
177
-	* is rendered in any column with a name/slug of 'title'. Every time the class
178
-	* needs to render a column, it first looks for a method named
179
-	* column_{$column_title} - if it exists, that method is run. If it doesn't
180
-	* exist, column_default() is called instead.
181
-	*
182
-	* This example also illustrates how to implement rollover actions. Actions
183
-	* should be an associative array formatted as 'slug'=>'link html' - and you
184
-	* will need to generate the URLs yourself. You could even ensure the links
185
-	*
186
-	*
187
-	* @see WP_List_Table::::single_row_columns()
188
-	* @param array $item A singular item (one full row's worth of data)
189
-	* @return string Text to be placed inside the column <td> (movie title only)
190
-	**************************************************************************/
176
+	 * Recommended. This is a custom column method and is responsible for what
177
+	 * is rendered in any column with a name/slug of 'title'. Every time the class
178
+	 * needs to render a column, it first looks for a method named
179
+	 * column_{$column_title} - if it exists, that method is run. If it doesn't
180
+	 * exist, column_default() is called instead.
181
+	 *
182
+	 * This example also illustrates how to implement rollover actions. Actions
183
+	 * should be an associative array formatted as 'slug'=>'link html' - and you
184
+	 * will need to generate the URLs yourself. You could even ensure the links
185
+	 *
186
+	 *
187
+	 * @see WP_List_Table::::single_row_columns()
188
+	 * @param array $item A singular item (one full row's worth of data)
189
+	 * @return string Text to be placed inside the column <td> (movie title only)
190
+	 **************************************************************************/
191 191
 	function column_name($item){
192 192
 		//Build row actions
193 193
 		$default_action='edit';
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
 		);
209 209
 	}
210 210
 	/** ************************************************************************
211
-	* REQUIRED if displaying checkboxes or using bulk actions! The 'cb' column
212
-	* is given special treatment when columns are processed. It ALWAYS needs to
213
-	* have it's own method.
214
-	*
215
-	* @see WP_List_Table::::single_row_columns()
216
-	* @param array $item A singular item (one full row's worth of data)
217
-	* @return string Text to be placed inside the column <td> (movie title only)
218
-	**************************************************************************/
211
+	 * REQUIRED if displaying checkboxes or using bulk actions! The 'cb' column
212
+	 * is given special treatment when columns are processed. It ALWAYS needs to
213
+	 * have it's own method.
214
+	 *
215
+	 * @see WP_List_Table::::single_row_columns()
216
+	 * @param array $item A singular item (one full row's worth of data)
217
+	 * @return string Text to be placed inside the column <td> (movie title only)
218
+	 **************************************************************************/
219 219
 	function column_cb($item){
220 220
 		return '';
221 221
 		return sprintf(
@@ -226,19 +226,19 @@  discard block
 block discarded – undo
226 226
 	}
227 227
 
228 228
 	/** ************************************************************************
229
-	* Optional. If you want one or more columns to be sortable (ASC/DESC toggle),
230
-	* you will need to register it here. This should return an array where the
231
-	* key is the column that needs to be sortable, and the value is db column to
232
-	* sort by. Often, the key and value will be the same, but this is not always
233
-	* the case (as the value is a column name from the database, not the list table).
234
-	*
235
-	* This method merely defines which columns should be sortable and makes them
236
-	* clickable - it does not handle the actual sorting. You still need to detect
237
-	* the ORDERBY and ORDER querystring variables within prepare_items() and sort
238
-	* your data accordingly (usually by modifying your query).
239
-	*
240
-	* @return array An associative array containing all the columns that should be sortable: 'slugs'=>array('data_values',bool)
241
-	**************************************************************************/
229
+	 * Optional. If you want one or more columns to be sortable (ASC/DESC toggle),
230
+	 * you will need to register it here. This should return an array where the
231
+	 * key is the column that needs to be sortable, and the value is db column to
232
+	 * sort by. Often, the key and value will be the same, but this is not always
233
+	 * the case (as the value is a column name from the database, not the list table).
234
+	 *
235
+	 * This method merely defines which columns should be sortable and makes them
236
+	 * clickable - it does not handle the actual sorting. You still need to detect
237
+	 * the ORDERBY and ORDER querystring variables within prepare_items() and sort
238
+	 * your data accordingly (usually by modifying your query).
239
+	 *
240
+	 * @return array An associative array containing all the columns that should be sortable: 'slugs'=>array('data_values',bool)
241
+	 **************************************************************************/
242 242
 	function get_sortable_columns() {
243 243
 		$sortable_columns = array(
244 244
 			//'name'    => array('name',true)    //true means its already sorted
@@ -247,19 +247,19 @@  discard block
 block discarded – undo
247 247
 	}
248 248
 
249 249
 	/** ************************************************************************
250
-	* Optional. If you need to include bulk actions in your list table, this is
251
-	* the place to define them. Bulk actions are an associative array in the format
252
-	* 'slug'=>'Visible Title'
253
-	*
254
-	* If this method returns an empty value, no bulk action will be rendered. If
255
-	* you specify any bulk actions, the bulk actions box will be rendered with
256
-	* the table automatically on display().
257
-	*
258
-	* Also note that list tables are not automatically wrapped in <form> elements,
259
-	* so you will need to create those manually in order for bulk actions to function.
260
-	*
261
-	* @return array An associative array containing all the bulk actions: 'slugs'=>'Visible Titles'
262
-	**************************************************************************/
250
+	 * Optional. If you need to include bulk actions in your list table, this is
251
+	 * the place to define them. Bulk actions are an associative array in the format
252
+	 * 'slug'=>'Visible Title'
253
+	 *
254
+	 * If this method returns an empty value, no bulk action will be rendered. If
255
+	 * you specify any bulk actions, the bulk actions box will be rendered with
256
+	 * the table automatically on display().
257
+	 *
258
+	 * Also note that list tables are not automatically wrapped in <form> elements,
259
+	 * so you will need to create those manually in order for bulk actions to function.
260
+	 *
261
+	 * @return array An associative array containing all the bulk actions: 'slugs'=>'Visible Titles'
262
+	 **************************************************************************/
263 263
 	function get_bulk_actions() {
264 264
 		$actions = array(
265 265
 			// 'delete'    => __('Delete','wpshop')
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	}
269 269
 
270 270
 	/** ************************************************************************
271
-	* Optional. You can handle your bulk actions anywhere or anyhow you prefer.
272
-	* For this example package, we will handle it in the class to keep things
273
-	* clean and organized.
274
-	*
275
-	* @see $this->prepare_items()
276
-	**************************************************************************/
271
+	 * Optional. You can handle your bulk actions anywhere or anyhow you prefer.
272
+	 * For this example package, we will handle it in the class to keep things
273
+	 * clean and organized.
274
+	 *
275
+	 * @see $this->prepare_items()
276
+	 **************************************************************************/
277 277
 	function process_bulk_action() {
278 278
 		//Detect when a bulk action is being triggered...
279 279
 		if( 'delete'===$this->current_action() ) {
@@ -282,90 +282,90 @@  discard block
 block discarded – undo
282 282
 	}
283 283
 
284 284
 	/** ************************************************************************
285
-	* REQUIRED! This is where you prepare your data for display. This method will
286
-	* usually be used to query the database, sort and filter the data, and generally
287
-	* get it ready to be displayed. At a minimum, we should set $this->items and
288
-	* $this->set_pagination_args(), although the following properties and methods
289
-	* are frequently interacted with here...
290
-	*
291
-	* @uses $this->_column_headers
292
-	* @uses $this->items
293
-	* @uses $this->get_columns()
294
-	* @uses $this->get_sortable_columns()
295
-	* @uses $this->get_pagenum()
296
-	* @uses $this->set_pagination_args()
297
-	**************************************************************************/
285
+	 * REQUIRED! This is where you prepare your data for display. This method will
286
+	 * usually be used to query the database, sort and filter the data, and generally
287
+	 * get it ready to be displayed. At a minimum, we should set $this->items and
288
+	 * $this->set_pagination_args(), although the following properties and methods
289
+	 * are frequently interacted with here...
290
+	 *
291
+	 * @uses $this->_column_headers
292
+	 * @uses $this->items
293
+	 * @uses $this->get_columns()
294
+	 * @uses $this->get_sortable_columns()
295
+	 * @uses $this->get_pagenum()
296
+	 * @uses $this->set_pagination_args()
297
+	 **************************************************************************/
298 298
 	function prepare_items() {
299 299
 		/*	First, lets decide how many records per page to show	*/
300 300
 		$per_page = 10;
301 301
 
302 302
 		/**
303
-		* REQUIRED. Now we need to define our column headers. This includes a complete
304
-		* array of columns to be displayed (slugs & titles), a list of columns
305
-		* to keep hidden, and a list of columns that are sortable. Each of these
306
-		* can be defined in another method (as we've done here) before being
307
-		* used to build the value for our _column_headers property.
308
-		*/
303
+		 * REQUIRED. Now we need to define our column headers. This includes a complete
304
+		 * array of columns to be displayed (slugs & titles), a list of columns
305
+		 * to keep hidden, and a list of columns that are sortable. Each of these
306
+		 * can be defined in another method (as we've done here) before being
307
+		 * used to build the value for our _column_headers property.
308
+		 */
309 309
 		$columns = $this->get_columns();
310 310
 		$hidden = array();
311 311
 		$sortable = $this->get_sortable_columns();
312 312
 
313 313
 		/**
314
-		* REQUIRED. Finally, we build an array to be used by the class for column
315
-		* headers. The $this->_column_headers property takes an array which contains
316
-		* 3 other arrays. One for all columns, one for hidden columns, and one
317
-		* for sortable columns.
318
-		*/
314
+		 * REQUIRED. Finally, we build an array to be used by the class for column
315
+		 * headers. The $this->_column_headers property takes an array which contains
316
+		 * 3 other arrays. One for all columns, one for hidden columns, and one
317
+		 * for sortable columns.
318
+		 */
319 319
 		$this->_column_headers = array($columns, $hidden, $sortable);
320 320
 
321 321
 		/**
322
-		* Optional. You can handle your bulk actions however you see fit. In this
323
-		* case, we'll handle them within our package just to keep things clean.
324
-		*/
322
+		 * Optional. You can handle your bulk actions however you see fit. In this
323
+		 * case, we'll handle them within our package just to keep things clean.
324
+		 */
325 325
 		$this->process_bulk_action();
326 326
 
327 327
 		/**
328
-		* Instead of querying a database, we're going to fetch the example data
329
-		* property we created for use in this plugin. This makes this example
330
-		* package slightly different than one you might build on your own. In
331
-		* this example, we'll be using array manipulation to sort and paginate
332
-		* our data. In a real-world implementation, you will probably want to
333
-		* use sort and pagination data to build a custom query instead, as you'll
334
-		* be able to use your precisely-queried data immediately.
335
-		*/
328
+		 * Instead of querying a database, we're going to fetch the example data
329
+		 * property we created for use in this plugin. This makes this example
330
+		 * package slightly different than one you might build on your own. In
331
+		 * this example, we'll be using array manipulation to sort and paginate
332
+		 * our data. In a real-world implementation, you will probably want to
333
+		 * use sort and pagination data to build a custom query instead, as you'll
334
+		 * be able to use your precisely-queried data immediately.
335
+		 */
336 336
 		$data = $this->datas;
337 337
 
338 338
 		/**
339
-		* REQUIRED for pagination. Let's figure out what page the user is currently
340
-		* looking at. We'll need this later, so you should always include it in
341
-		* your own package classes.
342
-		*/
339
+		 * REQUIRED for pagination. Let's figure out what page the user is currently
340
+		 * looking at. We'll need this later, so you should always include it in
341
+		 * your own package classes.
342
+		 */
343 343
 		$current_page = $this->get_pagenum();
344 344
 
345 345
 		/**
346
-		* REQUIRED for pagination. Let's check how many items are in our data array.
347
-		* In real-world use, this would be the total number of items in your database,
348
-		* without filtering. We'll need this later, so you should always include it
349
-		* in your own package classes.
350
-		*/
346
+		 * REQUIRED for pagination. Let's check how many items are in our data array.
347
+		 * In real-world use, this would be the total number of items in your database,
348
+		 * without filtering. We'll need this later, so you should always include it
349
+		 * in your own package classes.
350
+		 */
351 351
 		$total_items = count($data);
352 352
 
353 353
 		/**
354
-		* The WP_List_Table class does not handle pagination for us, so we need
355
-		* to ensure that the data is trimmed to only the current page. We can use
356
-		* array_slice() to
357
-		*/
354
+		 * The WP_List_Table class does not handle pagination for us, so we need
355
+		 * to ensure that the data is trimmed to only the current page. We can use
356
+		 * array_slice() to
357
+		 */
358 358
 		$data = array_slice($data,(($current_page-1)*$per_page),$per_page);
359 359
 
360 360
 		/**
361
-		* REQUIRED. Now we can add our *sorted* data to the items property, where
362
-		* it can be used by the rest of the class.
363
-		*/
361
+		 * REQUIRED. Now we can add our *sorted* data to the items property, where
362
+		 * it can be used by the rest of the class.
363
+		 */
364 364
 		$this->items = $data;
365 365
 
366 366
 		/**
367
-		* REQUIRED. We also have to register our pagination options & calculations.
368
-		*/
367
+		 * REQUIRED. We also have to register our pagination options & calculations.
368
+		 */
369 369
 		$this->set_pagination_args( array(
370 370
 			'total_items' => $total_items,               		//WE have to calculate the total number of items
371 371
 			'per_page'    => $per_page,                 		//WE have to determine how many items to show on a page
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 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
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 * @package wpshop
12 12
 * @subpackage librairies
13 13
 */
14
-class wpshop_attributes_set_custom_List_table extends WP_List_Table{
14
+class wpshop_attributes_set_custom_List_table extends WP_List_Table {
15 15
 
16 16
 	var $datas;
17 17
 
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
 	* REQUIRED. Set up a constructor that references the parent constructor. We
20 20
 	* use the parent reference to set some default configs.
21 21
 	***************************************************************************/
22
-	function __construct(){
22
+	function __construct() {
23 23
 		global $status, $page;
24 24
 
25 25
 		//Set parent defaults
26
-		parent::__construct( array(
27
-			'singular'  => __('attribute\'s set', 'wpshop'),    //singular name of the listed records
28
-			'plural'    => __('attributes\' set', 'wpshop'),    //plural name of the listed records
26
+		parent::__construct(array(
27
+			'singular'  => __('attribute\'s set', 'wpshop'), //singular name of the listed records
28
+			'plural'    => __('attributes\' set', 'wpshop'), //plural name of the listed records
29 29
 			'ajax'     => true       //does this table support ajax?
30
-		) );
30
+		));
31 31
 	}
32 32
 
33 33
 	/*	Allows to set different listings for attributes	*/
34
-	function get_views(){
34
+	function get_views() {
35 35
 		$wpshop_attribute_links = array();
36 36
 
37 37
 		$active_nb = wpshop_attributes_set::getElement('', "'moderated','valid'");
38 38
 		$deleted_nb = wpshop_attributes_set::getElement('', "'deleted'");
39 39
 
40
-		$attribute_group_status = !empty( $_REQUEST['attribute_groups_status'] ) ? sanitize_text_field( $_REQUEST['attribute_groups_status'] ) : '';
40
+		$attribute_group_status = !empty($_REQUEST['attribute_groups_status']) ? sanitize_text_field($_REQUEST['attribute_groups_status']) : '';
41 41
 
42
-		$wpshop_attribute_links['wpshop_attribute_groups_links wpshop_attribute_groups_links_valid'.(empty($attribute_group_status)?' current':'')] = '<a href="'.admin_url('admin.php?page='.wpshop_attributes_set::getEditionSlug()).'" >'.__('Attribute groups', 'wpshop').' ('.count($active_nb).')</a>';
43
-		$wpshop_attribute_links['wpshop_attribute_groups_links wpshop_attribute_groups_links_deleted'.(!empty($attribute_group_status) && ($attribute_group_status=='deleted')?' current':'')] = '<a href="'.admin_url('admin.php?page='.wpshop_attributes_set::getEditionSlug().'&attribute_groups_status=deleted').'" >'.__('Trashed attribute groups', 'wpshop').' ('.count($deleted_nb).')</a>';
42
+		$wpshop_attribute_links['wpshop_attribute_groups_links wpshop_attribute_groups_links_valid' . (empty($attribute_group_status) ? ' current' : '')] = '<a href="' . admin_url('admin.php?page=' . wpshop_attributes_set::getEditionSlug()) . '" >' . __('Attribute groups', 'wpshop') . ' (' . count($active_nb) . ')</a>';
43
+		$wpshop_attribute_links['wpshop_attribute_groups_links wpshop_attribute_groups_links_deleted' . (!empty($attribute_group_status) && ($attribute_group_status == 'deleted') ? ' current' : '')] = '<a href="' . admin_url('admin.php?page=' . wpshop_attributes_set::getEditionSlug() . '&attribute_groups_status=deleted') . '" >' . __('Trashed attribute groups', 'wpshop') . ' (' . count($deleted_nb) . ')</a>';
44 44
 
45 45
 		return $wpshop_attribute_links;
46 46
 	}
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 	* @see WP_List_Table::::single_row_columns()
59 59
 	* @return array An associative array containing column information: 'slugs'=>'Visible Titles'
60 60
 	**************************************************************************/
61
-	function get_columns(){
61
+	function get_columns() {
62 62
 		$columns = array(
63
-			'cb'       => '',//'<input type="checkbox" />', //Render a checkbox instead of text
63
+			'cb'       => '', //'<input type="checkbox" />', //Render a checkbox instead of text
64 64
 			'id'       => 'Id.',
65 65
 			'name'    => 'Nom',
66 66
 			'status'    => 'Statut',
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 	* @param array $column_name The name/slug of the column to be processed
92 92
 	* @return string Text or HTML to be placed inside the column <td>
93 93
 	**************************************************************************/
94
-	function column_default($item, $column_name){
95
-		switch($column_name){
94
+	function column_default($item, $column_name) {
95
+		switch ($column_name) {
96 96
 			default:
97
-				return print_r($item,true); //Show the whole array for troubleshooting purposes
97
+				return print_r($item, true); //Show the whole array for troubleshooting purposes
98 98
 		}
99 99
 	}
100 100
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	* @param array $item A singular item (one full row's worth of data)
115 115
 	* @return string Text to be placed inside the column <td> (movie title only)
116 116
 	**************************************************************************/
117
-	function column_id($item){
117
+	function column_id($item) {
118 118
 		return $item['id'];
119 119
 	}
120 120
 	/** ************************************************************************
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	* @param array $item A singular item (one full row's worth of data)
134 134
 	* @return string Text to be placed inside the column <td> (movie title only)
135 135
 	**************************************************************************/
136
-	function column_status($item){
136
+	function column_status($item) {
137 137
 		return __($item['status'], 'wpshop');
138 138
 	}
139 139
 	/** ************************************************************************
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	* @param array $item A singular item (one full row's worth of data)
153 153
 	* @return string Text to be placed inside the column <td> (movie title only)
154 154
 	**************************************************************************/
155
-	function column_content($item){
155
+	function column_content($item) {
156 156
 		return $item['content'];
157 157
 	}
158 158
 	/** ************************************************************************
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	* @param array $item A singular item (one full row's worth of data)
172 172
 	* @return string Text to be placed inside the column <td> (movie title only)
173 173
 	**************************************************************************/
174
-	function column_entity($item){
175
-		return __($item['entity'],'wpshop');
174
+	function column_entity($item) {
175
+		return __($item['entity'], 'wpshop');
176 176
 	}
177 177
 	/** ************************************************************************
178 178
 	* Recommended. This is a custom column method and is responsible for what
@@ -190,23 +190,23 @@  discard block
 block discarded – undo
190 190
 	* @param array $item A singular item (one full row's worth of data)
191 191
 	* @return string Text to be placed inside the column <td> (movie title only)
192 192
 	**************************************************************************/
193
-	function column_name($item){
193
+	function column_name($item) {
194 194
 		//Build row actions
195
-		$default_action='edit';
196
-		$default_action_text=__('Edit', 'wpshop');
197
-		$attribute_groups_status = !empty( $_REQUEST['attribute_groups_status'] ) ? sanitize_text_field( $_REQUEST['attribute_groups_status'] ) : '';
198
-		if( !empty( $attribute_groups_status ) && ( $attribute_groups_status=='deleted' ) ){
199
-			$default_action='activate';
200
-			$default_action_text=__('Restore', 'wpshop');
195
+		$default_action = 'edit';
196
+		$default_action_text = __('Edit', 'wpshop');
197
+		$attribute_groups_status = !empty($_REQUEST['attribute_groups_status']) ? sanitize_text_field($_REQUEST['attribute_groups_status']) : '';
198
+		if (!empty($attribute_groups_status) && ($attribute_groups_status == 'deleted')) {
199
+			$default_action = 'activate';
200
+			$default_action_text = __('Restore', 'wpshop');
201 201
 		}
202
-		$actions['edit']=sprintf('<a href="'.admin_url('admin.php').'?page=%2$s&amp;action=%3$s&amp;id=%4$s">'.$default_action_text.'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING,$default_action,$item['id']);
202
+		$actions['edit'] = sprintf('<a href="' . admin_url('admin.php') . '?page=%2$s&amp;action=%3$s&amp;id=%4$s">' . $default_action_text . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING, $default_action, $item['id']);
203 203
 
204 204
 		if (empty($attribute_groups_status))
205
-			$actions['delete']=sprintf('<a href="'.admin_url('admin.php').'?page=%2$s&amp;action=%3$s&amp;id=%4$s">'.__('Delete', 'wpshop').'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING,'delete',$item['id']);
205
+			$actions['delete'] = sprintf('<a href="' . admin_url('admin.php') . '?page=%2$s&amp;action=%3$s&amp;id=%4$s">' . __('Delete', 'wpshop') . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING, 'delete', $item['id']);
206 206
 
207 207
 		//Return the title contents
208 208
 		return sprintf('%1$s%2$s',
209
-			/*$1%s*/ sprintf('<a href="'.admin_url('admin.php').'?page=%2$s&amp;action=%3$s&amp;id=%4$s">'.__($item['name'], 'wpshop').'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING,'edit',$item['id']),
209
+			/*$1%s*/ sprintf('<a href="' . admin_url('admin.php') . '?page=%2$s&amp;action=%3$s&amp;id=%4$s">' . __($item['name'], 'wpshop') . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING, 'edit', $item['id']),
210 210
 			/*$3%s*/ $this->row_actions($actions)
211 211
 		);
212 212
 	}
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 	* @param array $item A singular item (one full row's worth of data)
220 220
 	* @return string Text to be placed inside the column <td> (movie title only)
221 221
 	**************************************************************************/
222
-	function column_cb($item){
222
+	function column_cb($item) {
223 223
 		return '';
224 224
 		return sprintf(
225 225
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
226
-			/*$1%s*/ $this->_args['singular'],  //Let's simply repurpose the table's singular label ("movie")
226
+			/*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("movie")
227 227
 			/*$2%s*/ $item['id']             //The value of the checkbox should be the record's id
228 228
 		);
229 229
 	}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	**************************************************************************/
280 280
 	function process_bulk_action() {
281 281
 		//Detect when a bulk action is being triggered...
282
-		if( 'delete'===$this->current_action() ) {
282
+		if ('delete' === $this->current_action()) {
283 283
 			wp_die('Items deleted (or they would be if we had items to delete)!');
284 284
 		}
285 285
 	}
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 		* to ensure that the data is trimmed to only the current page. We can use
359 359
 		* array_slice() to
360 360
 		*/
361
-		$data = array_slice($data,(($current_page-1)*$per_page),$per_page);
361
+		$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
362 362
 
363 363
 		/**
364 364
 		* REQUIRED. Now we can add our *sorted* data to the items property, where
@@ -369,11 +369,11 @@  discard block
 block discarded – undo
369 369
 		/**
370 370
 		* REQUIRED. We also have to register our pagination options & calculations.
371 371
 		*/
372
-		$this->set_pagination_args( array(
373
-			'total_items' => $total_items,               		//WE have to calculate the total number of items
374
-			'per_page'    => $per_page,                 		//WE have to determine how many items to show on a page
375
-			'total_pages' => ceil($total_items/$per_page)   //WE have to calculate the total number of pages
376
-		) );
372
+		$this->set_pagination_args(array(
373
+			'total_items' => $total_items, //WE have to calculate the total number of items
374
+			'per_page'    => $per_page, //WE have to determine how many items to show on a page
375
+			'total_pages' => ceil($total_items / $per_page)   //WE have to calculate the total number of pages
376
+		));
377 377
 	}
378 378
 
379 379
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 /*	Check if file is include. No direct access possible with file url	*/
4 6
 if ( !defined( 'WPSHOP_VERSION' ) ) {
@@ -201,8 +203,9 @@  discard block
 block discarded – undo
201 203
 		}
202 204
 		$actions['edit']=sprintf('<a href="'.admin_url('admin.php').'?page=%2$s&amp;action=%3$s&amp;id=%4$s">'.$default_action_text.'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING,$default_action,$item['id']);
203 205
 
204
-		if (empty($attribute_groups_status))
205
-			$actions['delete']=sprintf('<a href="'.admin_url('admin.php').'?page=%2$s&amp;action=%3$s&amp;id=%4$s">'.__('Delete', 'wpshop').'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING,'delete',$item['id']);
206
+		if (empty($attribute_groups_status)) {
207
+					$actions['delete']=sprintf('<a href="'.admin_url('admin.php').'?page=%2$s&amp;action=%3$s&amp;id=%4$s">'.__('Delete', 'wpshop').'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING,'delete',$item['id']);
208
+		}
206 209
 
207 210
 		//Return the title contents
208 211
 		return sprintf('%1$s%2$s',
Please login to merge, or discard this patch.
includes/librairies/eav/attributes.class.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1423,7 +1423,7 @@
 block discarded – undo
1423 1423
 	 *	@param string $attributeType The extension of the database table to get the attribute value in
1424 1424
 	 *	@param integer $attributeId The attribute identifier we want to get the value for
1425 1425
 	 *	@param integer $entityTypeId The entity type identifier we want to get the attribute value for (example: product = 1)
1426
-	 	*	@param integer $entityId The entity id we want the attribute value for
1426
+	 *	@param integer $entityId The entity id we want the attribute value for
1427 1427
 	 *
1428 1428
 	 *	@return object $attributeValue A wordpress database object containing the value of the attribute for the selected entity
1429 1429
 	 */
Please login to merge, or discard this patch.
Braces   +156 added lines, -171 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' ) ) {
@@ -90,12 +92,12 @@  discard block
 block discarded – undo
90 92
 			if(($action == 'edit') || ($action == 'delete')){
91 93
 				$editedItem = self::getElement($objectInEdition);
92 94
 				$title = sprintf(__(self::pageEditingTitle, 'wpshop'), str_replace("\\", "", $editedItem->frontend_label));
95
+			} elseif($action == 'add') {
96
+							$title = __(self::pageAddingTitle, 'wpshop');
93 97
 			}
94
-			elseif($action == 'add')
95
-				$title = __(self::pageAddingTitle, 'wpshop');
98
+		} elseif((self::getEditionSlug() != self::getListingSlug()) && ($page == self::getEditionSlug())) {
99
+					$title = __(self::pageAddingTitle, 'wpshop');
96 100
 		}
97
-		elseif((self::getEditionSlug() != self::getListingSlug()) && ($page == self::getEditionSlug()))
98
-			$title = __(self::pageAddingTitle, 'wpshop');
99 101
 
100 102
 		return $title;
101 103
 	}
@@ -126,14 +128,15 @@  discard block
 block discarded – undo
126 128
 		if(($action != '') && ($action == 'saveok') && ($saveditem > 0)){
127 129
 			$editedElement = self::getElement($saveditem);
128 130
 			$pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully saved', 'wpshop'), '<span class="bold" >' . $editedElement->code . '</span>');
129
-		}
130
-		elseif(($action != '') && ($action == 'deleteok') && ($saveditem > 0)){
131
+		} elseif(($action != '') && ($action == 'deleteok') && ($saveditem > 0)){
131 132
 			$editedElement = self::getElement($saveditem, "'deleted'");
132 133
 			$pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully deleted', 'wpshop'), '<span class="bold" >' . $editedElement->code . '</span>');
133 134
 		}
134 135
 
135 136
 		$attribute_parameter = !empty( $_REQUEST[self::getDbTable()] ) ? (array)$_REQUEST[self::getDbTable()] : array();
136
-		 if ( !empty($set_section) ) unset($attribute_parameter['set_section']);
137
+		 if ( !empty($set_section) ) {
138
+		 	unset($attribute_parameter['set_section']);
139
+		 }
137 140
 
138 141
 		$wpshop_attribute_combo_values_list_order_def = !empty($attribute_parameter['wpshop_attribute_combo_values_list_order_def']) ? $attribute_parameter['wpshop_attribute_combo_values_list_order_def'] : array();
139 142
 		// @TODO $_REQUEST
@@ -193,66 +196,82 @@  discard block
 block discarded – undo
193 196
 			switch ($attribute_parameter['frontend_input']) {
194 197
 				case 'short_text':
195 198
 						$attribute_parameter['frontend_input'] = 'text';
196
-						if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
199
+						if ( empty($attribute_parameter['backend_input']) ) {
200
+							$attribute_parameter['backend_input'] = 'text';
201
+						}
197 202
 						$attribute_parameter['data_type'] = 'varchar';
198 203
 					break;
199 204
 				case 'date_field':
200 205
 						$attribute_parameter['frontend_input'] = 'text';
201
-						if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
206
+						if ( empty($attribute_parameter['backend_input']) ) {
207
+							$attribute_parameter['backend_input'] = 'text';
208
+						}
202 209
 						$attribute_parameter['data_type'] = 'datetime';
203 210
 					break;
204 211
 				case 'float_field':
205 212
 						$attribute_parameter['frontend_input'] = 'text';
206
-						if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
213
+						if ( empty($attribute_parameter['backend_input']) ) {
214
+							$attribute_parameter['backend_input'] = 'text';
215
+						}
207 216
 						$attribute_parameter['data_type'] = 'decimal';
208 217
 					break;
209 218
 				case 'hidden_field':
210 219
 						$attribute_parameter['frontend_input'] = 'hidden';
211
-						if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
220
+						if ( empty($attribute_parameter['backend_input']) ) {
221
+							$attribute_parameter['backend_input'] = 'text';
222
+						}
212 223
 						$attribute_parameter['data_type'] = 'varchar';
213 224
 					break;
214 225
 				case 'pass_field':
215 226
 						$attribute_parameter['frontend_input'] = 'password';
216
-						if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
227
+						if ( empty($attribute_parameter['backend_input']) ) {
228
+							$attribute_parameter['backend_input'] = 'text';
229
+						}
217 230
 						$attribute_parameter['data_type'] = 'varchar';
218 231
 					break;
219 232
 
220 233
 				case 'select':
221 234
 						$attribute_parameter['frontend_input'] = 'select';
222
-						if ( empty($attribute_parameter['backend_input']) || empty($id) )
223
-							$attribute_parameter['backend_input'] = 'multiple-select';
235
+						if ( empty($attribute_parameter['backend_input']) || empty($id) ) {
236
+													$attribute_parameter['backend_input'] = 'multiple-select';
237
+						}
224 238
 						$attribute_parameter['data_type'] = 'integer';
225 239
 					break;
226 240
 				case 'multiple-select':
227 241
 						$attribute_parameter['frontend_input'] = 'multiple-select';
228
-						if ( empty($attribute_parameter['backend_input']) || empty($id) )
229
-							$attribute_parameter['backend_input'] = 'multiple-select';
242
+						if ( empty($attribute_parameter['backend_input']) || empty($id) ) {
243
+													$attribute_parameter['backend_input'] = 'multiple-select';
244
+						}
230 245
 						$attribute_parameter['data_type'] = 'integer';
231 246
 					break;
232 247
 				case 'radio':
233 248
 						$attribute_parameter['frontend_input'] = 'radio';
234
-						if ( empty($attribute_parameter['backend_input']) || empty($id) )
235
-							$attribute_parameter['backend_input'] = 'multiple-select';
249
+						if ( empty($attribute_parameter['backend_input']) || empty($id) ) {
250
+													$attribute_parameter['backend_input'] = 'multiple-select';
251
+						}
236 252
 						$attribute_parameter['data_type'] = 'integer';
237 253
 					break;
238 254
 				case 'checkbox':
239 255
 						$attribute_parameter['frontend_input'] = 'checkbox';
240
-						if ( empty($attribute_parameter['backend_input']) || empty($id) )
241
-							$attribute_parameter['backend_input'] = 'multiple-select';
256
+						if ( empty($attribute_parameter['backend_input']) || empty($id) ) {
257
+													$attribute_parameter['backend_input'] = 'multiple-select';
258
+						}
242 259
 						$attribute_parameter['data_type'] = 'integer';
243 260
 					break;
244 261
 
245 262
 				case 'textarea':
246 263
 						$attribute_parameter['frontend_input'] = 'textarea';
247
-						if ( empty($attribute_parameter['backend_input']) || empty($id) )
248
-							$attribute_parameter['backend_input'] = 'textarea';
264
+						if ( empty($attribute_parameter['backend_input']) || empty($id) ) {
265
+													$attribute_parameter['backend_input'] = 'textarea';
266
+						}
249 267
 						$attribute_parameter['data_type'] = 'text';
250 268
 					break;
251 269
 			}
252
-		}
253
-		else {
270
+		} else {
254 271
 			$attribute_parameter['frontend_input'] = 'text';
255
-			if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
272
+			if ( empty($attribute_parameter['backend_input']) ) {
273
+				$attribute_parameter['backend_input'] = 'text';
274
+			}
256 275
 			$attribute_parameter['data_type'] = 'varchar';
257 276
 		}
258 277
 
@@ -287,22 +306,18 @@  discard block
 block discarded – undo
287 306
 					if(!in_array($attribute_code, $attribute_undeletable)){
288 307
 						if(current_user_can('wpshop_delete_attributes')){
289 308
 							$attribute_parameter['status'] = 'deleted';
290
-						}
291
-						else{
309
+						} else{
292 310
 							$actionResult = 'userNotAllowedForActionDelete';
293 311
 						}
294
-					}
295
-					else{
312
+					} else{
296 313
 						$actionResult = 'unDeletableAtribute';
297 314
 					}
298 315
 				}
299 316
 				$actionResult = wpshop_database::update($attribute_parameter, $id, self::getDbTable());
300
-			}
301
-			else{
317
+			} else{
302 318
 				$actionResult = 'userNotAllowedForActionEdit';
303 319
 			}
304
-		}
305
-		elseif(($pageAction != '') && (($pageAction == 'delete'))){
320
+		} elseif(($pageAction != '') && (($pageAction == 'delete'))){
306 321
 			$attribute_code = '';
307 322
 			if (empty(	$attribute_parameter['code'])) {
308 323
 				$attribute = self::getElement($id, "'valid', 'moderated', 'notused', 'deleted'", 'id');
@@ -313,14 +328,13 @@  discard block
 block discarded – undo
313 328
 					$attribute_parameter['last_update_date'] = current_time('mysql', 0);
314 329
 					$attribute_parameter['status'] = 'deleted';
315 330
 					$actionResult = wpshop_database::update($attribute_parameter, $id, self::getDbTable());
331
+				} else {
332
+									$actionResult = 'userNotAllowedForActionDelete';
316 333
 				}
317
-				else
318
-					$actionResult = 'userNotAllowedForActionDelete';
334
+			} else {
335
+							$actionResult = 'unDeletableAtribute';
319 336
 			}
320
-			else
321
-				$actionResult = 'unDeletableAtribute';
322
-		}
323
-		elseif(($pageAction != '') && (($pageAction == 'save') || ($pageAction == 'saveandcontinue') || ($pageAction == 'add'))){
337
+		} elseif(($pageAction != '') && (($pageAction == 'save') || ($pageAction == 'saveandcontinue') || ($pageAction == 'add'))){
324 338
 			if(current_user_can('wpshop_add_attributes')){
325 339
 				$attribute_parameter['creation_date'] = current_time('mysql', 0);
326 340
 				if(trim($attribute_parameter['code']) == ''){
@@ -333,8 +347,7 @@  discard block
 block discarded – undo
333 347
 				}
334 348
 				$actionResult = wpshop_database::save($attribute_parameter, self::getDbTable());
335 349
 				$id = $wpdb->insert_id;
336
-			}
337
-			else{
350
+			} else{
338 351
 				$actionResult = 'userNotAllowedForActionAdd';
339 352
 			}
340 353
 		}
@@ -345,11 +358,12 @@  discard block
 block discarded – undo
345 358
 		/****************************************************************************/
346 359
 		if($actionResult != ''){
347 360
 			$elementIdentifierForMessage = __('the attribute', 'wpshop');
348
-			if(!empty($attribute_parameter['name']))$elementIdentifierForMessage = '<span class="bold" >' . $attribute_parameter['frontend_label'] . '</span>';
361
+			if(!empty($attribute_parameter['name'])) {
362
+				$elementIdentifierForMessage = '<span class="bold" >' . $attribute_parameter['frontend_label'] . '</span>';
363
+			}
349 364
 			if ($actionResult == 'error') {/*	CHANGE HERE FOR SPECIFIC CASE	*/
350 365
 				$pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . sprintf(__('An error occured while saving %s', 'wpshop'), $elementIdentifierForMessage, ' -> ' . $wpdb->last_error);
351
-			}
352
-			else if (($actionResult == 'done') || ($actionResult == 'nothingToUpdate')) {/*	CHANGE HERE FOR SPECIFIC CASE	*/
366
+			} else if (($actionResult == 'done') || ($actionResult == 'nothingToUpdate')) {/*	CHANGE HERE FOR SPECIFIC CASE	*/
353 367
 				/*****************************************************************************************************************/
354 368
 				/*************************			CHANGE FOR SPECIFIC ACTION FOR CURRENT ELEMENT				****************************/
355 369
 				/*****************************************************************************************************************/
@@ -368,8 +382,7 @@  discard block
 block discarded – undo
368 382
 					if (empty($attribute_parameter['code'])) {
369 383
 						$attribute = self::getElement($id, "'valid', 'moderated', 'notused'", 'id');
370 384
 						$attribute_code = $attribute->code;
371
-					}
372
-					else {
385
+					} else {
373 386
 						$attribute_code = $attribute_parameter['code'];
374 387
 					}
375 388
 					foreach ($optionsUpdate as $option_key => $option_label) {
@@ -460,8 +473,7 @@  discard block
 block discarded – undo
460 473
 						$choosen_set_section = explode('_', $set_section);
461 474
 						$set_id = $choosen_set_section[0];
462 475
 						$group_id = $choosen_set_section[1];
463
-					}
464
-					else{
476
+					} else{
465 477
 						$attribute_current_attribute_set = 0;
466 478
 						$query = $wpdb->prepare("
467 479
 								SELECT id
@@ -509,7 +521,9 @@  discard block
 block discarded – undo
509 521
 								$attribute_parameter['entity_id']
510 522
 						);
511 523
 						$wpshopAttributePosition = $wpdb->get_var($query);
512
-						if($wpshopAttributePosition == 0)$wpshopAttributePosition = 1;
524
+						if($wpshopAttributePosition == 0) {
525
+							$wpshopAttributePosition = 1;
526
+						}
513 527
 						$wpdb->insert(WPSHOP_DBT_ATTRIBUTE_DETAILS, array('status' => 'valid', 'creation_date' => current_time('mysql', 0), 'entity_type_id' => $attribute_parameter['entity_id'], 'attribute_set_id' => $set_id, 'attribute_group_id' => $group_id, 'attribute_id' => $id, 'position' => $wpshopAttributePosition));
514 528
 					}
515 529
 				}
@@ -530,15 +544,14 @@  discard block
 block discarded – undo
530 544
 					wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=saveok&saveditem=" . $id));
531 545
 				}
532 546
 				else */
533
-				if ( $pageAction == 'add' )
534
-					wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=edit&id=" . $id));
535
-				elseif ( $pageAction == 'delete' )
536
-					wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=deleteok&saveditem=" . $id));
537
-			}
538
-			elseif(($actionResult == 'userNotAllowedForActionEdit') || ($actionResult == 'userNotAllowedForActionAdd') || ($actionResult == 'userNotAllowedForActionDelete')){
547
+				if ( $pageAction == 'add' ) {
548
+									wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=edit&id=" . $id));
549
+				} elseif ( $pageAction == 'delete' ) {
550
+									wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=deleteok&saveditem=" . $id));
551
+				}
552
+			} elseif(($actionResult == 'userNotAllowedForActionEdit') || ($actionResult == 'userNotAllowedForActionAdd') || ($actionResult == 'userNotAllowedForActionDelete')){
539 553
 				$pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . __('You are not allowed to do this action', 'wpshop');
540
-			}
541
-			elseif(($actionResult == 'unDeletableAtribute')){
554
+			} elseif(($actionResult == 'unDeletableAtribute')){
542 555
 				$pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . __('This attribute could not be deleted due to configuration', 'wpshop');
543 556
 			}
544 557
 
@@ -583,8 +596,7 @@  discard block
 block discarded – undo
583 596
 		if ( !empty($s) ) {
584 597
 			$query = $wpdb->prepare("SELECT * FROM " . self::dbTable . ' WHERE frontend_label LIKE "%%%1$s%%" OR frontend_label LIKE "%%%2$s%%" AND backend_label LIKE "%%%1$s%%" OR backend_label LIKE "%%%2$s%%" AND code LIKE "%%%1$s%%" OR code LIKE "%%%2$s%%"', $s, __($s, 'wpshop') );
585 598
 			$attr_set_list = $wpdb->get_results( $query );
586
-		}
587
-		else {
599
+		} else {
588 600
 			$attr_set_list = self::getElement( '', $status );
589 601
 		}
590 602
 		$i=0;
@@ -638,8 +650,9 @@  discard block
 block discarded – undo
638 650
 		global $attribute_displayed_field, $attribute_options_group;
639 651
 		$dbFieldList = wpshop_database::fields_to_input(self::getDbTable());
640 652
 		$editedItem = '';
641
-		if($itemToEdit != '')
642
-			$editedItem = self::getElement($itemToEdit);
653
+		if($itemToEdit != '') {
654
+					$editedItem = self::getElement($itemToEdit);
655
+		}
643 656
 
644 657
 		$the_form_content_hidden = $the_form_general_content = '';
645 658
 		$the_form_option_content_list = array();
@@ -652,10 +665,11 @@  discard block
 block discarded – undo
652 665
 				$pageAction = isset($_REQUEST[self::getDbTable() . '_action']) ? sanitize_text_field($_REQUEST[self::getDbTable() . '_action']) : '';
653 666
 				$requestFormValue = isset($_REQUEST[self::currentPageCode][$input_def['label']]) ? sanitize_text_field($_REQUEST[self::currentPageCode][$input_def['label']]) : '';
654 667
 				$currentFieldValue = $input_def['value'];
655
-				if(is_object($editedItem))
656
-					$currentFieldValue = $editedItem->{$input_def['label']};
657
-				elseif(($pageAction != '') && ($requestFormValue != ''))
658
-					$currentFieldValue = $requestFormValue;
668
+				if(is_object($editedItem)) {
669
+									$currentFieldValue = $editedItem->{$input_def['label']};
670
+				} elseif(($pageAction != '') && ($requestFormValue != '')) {
671
+									$currentFieldValue = $requestFormValue;
672
+				}
659 673
 
660 674
 				if($input_def['label'] == 'status'){
661 675
 					if(in_array('notused', $input_def['possible_value'])){
@@ -727,9 +741,9 @@  discard block
 block discarded – undo
727 741
 				}
728 742
 
729 743
 				$input_def['value'] = $currentFieldValue;
730
-				if($input_def['label'] == 'code')
731
-					$input_def['type'] = 'hidden';
732
-				elseif($input_def['label'] == 'entity_id'){
744
+				if($input_def['label'] == 'code') {
745
+									$input_def['type'] = 'hidden';
746
+				} elseif($input_def['label'] == 'entity_id'){
733 747
 					$input_def['possible_value'] = wpshop_entities::get_entities_list();
734 748
 					$input_def['valueToPut'] = 'index';
735 749
 					$input_def['type'] = 'select';
@@ -741,21 +755,17 @@  discard block
 block discarded – undo
741 755
 						}
742 756
 						$i++;
743 757
 					}
744
-				}
745
-				elseif($input_def['label'] == '_unit_group_id'){
758
+				} elseif($input_def['label'] == '_unit_group_id'){
746 759
 					$input_def['possible_value'] = wpshop_attributes_unit::get_unit_group();
747 760
 					$input_def['type'] = 'select';
748
-				}
749
-				elseif($input_def['label'] == '_default_unit'){
761
+				} elseif($input_def['label'] == '_default_unit'){
750 762
 					$unit_group_list = wpshop_attributes_unit::get_unit_group();
751 763
 					$input_def['possible_value'] = wpshop_attributes_unit::get_unit_list_for_group(!empty($editedItem->_unit_group_id)?$editedItem->_unit_group_id:(!empty($unit_group_list)?$unit_group_list[0]->id:''));
752 764
 					$input_def['type'] = 'select';
753
-				}
754
-				elseif ($input_def['label'] == 'backend_input') {
765
+				} elseif ($input_def['label'] == 'backend_input') {
755 766
 					if ( !is_object($editedItem) ) {
756 767
 						$input_def['type'] = 'hidden';
757
-					}
758
-					else {
768
+					} else {
759 769
 						$new_possible_value = array();
760 770
 						switch ( $editedItem->data_type) {
761 771
 							case 'integer':
@@ -789,8 +799,7 @@  discard block
 block discarded – undo
789 799
 						}
790 800
 						$input_def['possible_value'] = $new_possible_value;
791 801
 					}
792
-				}
793
-				elseif ($input_def['label'] == 'frontend_input') {
802
+				} elseif ($input_def['label'] == 'frontend_input') {
794 803
 					$new_possible_value = array();
795 804
 
796 805
 					if ( is_object($editedItem) ) {
@@ -824,8 +833,7 @@  discard block
 block discarded – undo
824 833
 									$new_possible_value[__('Date field', 'wpshop')] = 'date_field';
825 834
 								break;
826 835
 						}
827
-					}
828
-					else {
836
+					} else {
829 837
 						$new_possible_value[__('Text field', 'wpshop')] = 'short_text';
830 838
 						$new_possible_value[__('Number field', 'wpshop')] = 'float_field';
831 839
 						$new_possible_value[__('Date field', 'wpshop')] = 'date_field';
@@ -917,8 +925,7 @@  discard block
 block discarded – undo
917 925
 								$the_input = wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE);
918 926
 							break;
919 927
 						}
920
-					}
921
-					else {
928
+					} else {
922 929
 						$input_def['type']='text';
923 930
 						$the_input = wpshop_form::check_input_type($input_def, self::getDbTable());
924 931
 					}
@@ -945,9 +952,9 @@  discard block
 block discarded – undo
945 952
 			<td class="wpshop_' . self::currentPageCode . '_edition_table_cell wpshop_' . self::currentPageCode . '_edition_table_field_label wpshop_' . self::currentPageCode . '_edition_table_field_label_'.$input_def['name'].'" ><label for="'.$input_def_id.'" >' . __($input_def['label'], 'wpshop') . '</label></td>
946 953
 			<td class="wpshop_' . self::currentPageCode . '_edition_table_cell wpshop_' . self::currentPageCode . '_edition_table_field_input wpshop_' . self::currentPageCode . '_edition_table_field_input_'.$input_def['name'].'" >' . $the_input . '</td>
947 954
 		</tr>';
948
-					if ( (substr($input_def['label'], 0, 3) == 'is_') || (substr($input_def['label'], 0, 1) == '_') || in_array($input_def['label'], unserialize( WPSHOP_ATTRIBUTE_DEF_COLUMN_INTO_OPTIONS )) )
949
-						$the_form_option_content_list[$input_def['label']] = $input;
950
-					else {
955
+					if ( (substr($input_def['label'], 0, 3) == 'is_') || (substr($input_def['label'], 0, 1) == '_') || in_array($input_def['label'], unserialize( WPSHOP_ATTRIBUTE_DEF_COLUMN_INTO_OPTIONS )) ) {
956
+											$the_form_option_content_list[$input_def['label']] = $input;
957
+					} else {
951 958
 						$the_form_general_content .= $input;
952 959
 						if ( ($input_def['label'] == 'frontend_input') && !is_object($editedItem) ) {
953 960
 
@@ -961,8 +968,7 @@  discard block
 block discarded – undo
961 968
 							$the_form_general_content .= $input;
962 969
 						}
963 970
 					}
964
-				}
965
-				else{
971
+				} else{
966 972
 					$the_form_content_hidden .= '
967 973
 				' . $the_input;
968 974
 				}
@@ -1247,17 +1253,18 @@  discard block
 block discarded – undo
1247 1253
 
1248 1254
 		 //$currentPageButton .= '<h2 class="cancelButton alignleft" ><a href="' . admin_url('edit.php?post_type='.WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES.'&amp;page=' . self::getListingSlug()) . '" class="button add-new-h2" >' . __('Back', 'wpshop') . '</a></h2>';
1249 1255
 
1250
-		if(($action == 'add') && (current_user_can('wpshop_add_attributes')))
1251
-			$currentPageButton .= '<input type="button" class="button-primary" id="add" name="add" value="' . __('Add', 'wpshop') . '" />';
1252
-
1253
-		elseif(current_user_can('wpshop_edit_attributes'))
1254
-		$currentPageButton .= '<input type="button" class="button-primary" id="save" name="save" value="' . __('Save', 'wpshop') . '" />';
1256
+		if(($action == 'add') && (current_user_can('wpshop_add_attributes'))) {
1257
+					$currentPageButton .= '<input type="button" class="button-primary" id="add" name="add" value="' . __('Add', 'wpshop') . '" />';
1258
+		} elseif(current_user_can('wpshop_edit_attributes')) {
1259
+				$currentPageButton .= '<input type="button" class="button-primary" id="save" name="save" value="' . __('Save', 'wpshop') . '" />';
1260
+		}
1255 1261
 
1256 1262
 		$attribute_undeletable = unserialize(WPSHOP_ATTRIBUTE_UNDELETABLE);
1257 1263
 		$attribute = self::getElement($element_id, "'valid', 'moderated', 'notused'", 'id');
1258 1264
 		$attribute_code = !empty($attribute->code)?$attribute->code:'';
1259
-		if(current_user_can('wpshop_delete_attributes') && ($action != 'add') && !in_array($attribute_code, $attribute_undeletable))
1260
-			$currentPageButton .= '<input type="button" class="button-secondary wpshop_delete_element_button wpshop_delete_element_button_'.self::currentPageCode.'" id="delete" name="delete" value="' . __('Delete', 'wpshop') . '" />';
1265
+		if(current_user_can('wpshop_delete_attributes') && ($action != 'add') && !in_array($attribute_code, $attribute_undeletable)) {
1266
+					$currentPageButton .= '<input type="button" class="button-secondary wpshop_delete_element_button wpshop_delete_element_button_'.self::currentPageCode.'" id="delete" name="delete" value="' . __('Delete', 'wpshop') . '" />';
1267
+		}
1261 1268
 
1262 1269
 		return $currentPageButton;
1263 1270
 	}
@@ -1302,8 +1309,7 @@  discard block
 block discarded – undo
1302 1309
 		/*	Get the query result regarding on the function parameters. If there must be only one result or a collection	*/
1303 1310
 		if(($element_id == '') || $list){
1304 1311
 			$element_list = $wpdb->get_results($query);
1305
-		}
1306
-		else{
1312
+		} else{
1307 1313
 			$element_list = $wpdb->get_row($query);
1308 1314
 		}
1309 1315
 
@@ -1397,8 +1403,7 @@  discard block
 block discarded – undo
1397 1403
 										foreach($attributeValue as $a){
1398 1404
 											$wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($query_params, array('value' => $a)));
1399 1405
 										}
1400
-									}
1401
-									else{
1406
+									} else{
1402 1407
 										$wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($query_params, array('value' => $attributeValue)));
1403 1408
 										wpeologs_ctr::log_datas_in_files( 'wpshop_attributes', array(
1404 1409
 											'object_id' 	=> $entityId,
@@ -1417,8 +1422,10 @@  discard block
 block discarded – undo
1417 1422
 										$value = self::get_attribute_type_select_option_info($attributeTypeDetails[$attribute_code], 'value');
1418 1423
 										if (strtolower($value) == 'yes') :
1419 1424
 											update_post_meta($entityId, 'attribute_option_'.$attribute_code, $attribute_option);
1420
-										else :
1425
+										else {
1426
+											:
1421 1427
 											delete_post_meta($entityId, 'attribute_option_'.$attribute_code);
1428
+										}
1422 1429
 										endif;
1423 1430
 									}
1424 1431
 								}
@@ -1478,8 +1485,7 @@  discard block
 block discarded – undo
1478 1485
 
1479 1486
 		if ( ( (count($attributeValue) <= 1 ) && !empty($attributeValue[0]) ) && ( empty($atribute_params['frontend_input']) || ($atribute_params['frontend_input'] != 'multiple-select') )) {
1480 1487
 			$attributeValue = $attributeValue[0];
1481
-		}
1482
-		else{
1488
+		} else{
1483 1489
 			$entity_meta = get_post_meta($entityId, WPSHOP_PRODUCT_ATTRIBUTE_META_KEY, true);
1484 1490
 			if ( !empty($entity_meta) ) {
1485 1491
 				$query = $wpdb->prepare("SELECT code FROM " . WPSHOP_DBT_ATTRIBUTE . " WHERE id = %d AND entity_id = %d ", $attributeId, $entityTypeId);
@@ -1545,12 +1551,10 @@  discard block
 block discarded – undo
1545 1551
 			if ( !empty($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value']) ) {
1546 1552
 				if (is_array($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'])) {
1547 1553
 					$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'][] = $elementDefinition->$attributeValueField;
1548
-				}
1549
-				else {
1554
+				} else {
1550 1555
 					$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'] = array($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'],$elementDefinition->$attributeValueField);
1551 1556
 				}
1552
-			}
1553
-			else {
1557
+			} else {
1554 1558
 				$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'] = $elementDefinition->$attributeValueField;
1555 1559
 			}
1556 1560
 
@@ -1631,17 +1635,14 @@  discard block
 block discarded – undo
1631 1635
 			if ( ( is_array($attribute_custom_config) && in_array($attribute_or_set, array('attribute', 'attribute_set_section', 'product_action_button')) && !empty($attribute_custom_config[$attribute_or_set]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) && $attribute_custom_config[$attribute_or_set][$attribute_code][$output_type] == 'yes' )
1632 1636
 				 || empty($attribute_custom_config) ) {
1633 1637
 				$attribute_output = true;
1634
-			}
1635
-			else if ( empty($attribute_custom_config[$attribute_or_set][$attribute_code]) || empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) || (!empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) && ( $attribute_custom_config[$attribute_or_set][$attribute_code][$output_type] == 'no')) )  {
1638
+			} else if ( empty($attribute_custom_config[$attribute_or_set][$attribute_code]) || empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) || (!empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) && ( $attribute_custom_config[$attribute_or_set][$attribute_code][$output_type] == 'no')) )  {
1636 1639
 				$attribute_output = false;
1637 1640
 			}
1638
-		}
1639
-		elseif ( $attribute_main_config === 'no' ) {
1641
+		} elseif ( $attribute_main_config === 'no' ) {
1640 1642
 			$attribute_output = false;
1641 1643
 			if ( empty($attribute_custom_config[$attribute_or_set]) || empty($attribute_custom_config[$attribute_or_set][$attribute_code]) ) {
1642 1644
 				$attribute_output = false;
1643
-			}
1644
-			else if ( !empty($attribute_custom_config) && !empty($attribute_custom_config[$attribute_or_set]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) && ( $attribute_custom_config[$attribute_or_set][$attribute_code][$output_type] == 'yes') )  {
1645
+			} else if ( !empty($attribute_custom_config) && !empty($attribute_custom_config[$attribute_or_set]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) && ( $attribute_custom_config[$attribute_or_set][$attribute_code][$output_type] == 'yes') )  {
1645 1646
 				$attribute_output = true;
1646 1647
 			}
1647 1648
 		}
@@ -1659,7 +1660,9 @@  discard block
 block discarded – undo
1659 1660
 		global $wp_query;
1660 1661
 
1661 1662
 		$attribute = self::getElement( $atts['attid'] );
1662
-		if(empty($atts['pid'])) $atts['pid'] = $wp_query->posts[0]->ID;
1663
+		if(empty($atts['pid'])) {
1664
+			$atts['pid'] = $wp_query->posts[0]->ID;
1665
+		}
1663 1666
 		$attribute_main_config = ( empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet') ) ? $attribute->is_visible_in_front : $attribute->is_visible_in_front_listing;
1664 1667
 		$output_type = ( empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet') ) ? 'complete_sheet' : 'mini_output';
1665 1668
 		$product_attribute_custom_config = get_post_meta($atts['pid'], WPSHOP_PRODUCT_FRONT_DISPLAY_CONF, true);
@@ -1678,13 +1681,11 @@  discard block
 block discarded – undo
1678 1681
 					}
1679 1682
 					$has_value = true;
1680 1683
 				}
1681
-			}
1682
-			else {
1684
+			} else {
1683 1685
 				$data = $wpdb->get_var($query);
1684 1686
 				if ( !empty($data) ) {
1685 1687
 					$has_value = true;
1686
-				}
1687
-				elseif( !empty($attribute->default_value) ) {
1688
+				} elseif( !empty($attribute->default_value) ) {
1688 1689
 					$has_value = true;
1689 1690
 					$data = $attribute->default_value;
1690 1691
 				}
@@ -1744,11 +1745,9 @@  discard block
 block discarded – undo
1744 1745
 
1745 1746
 		if ( !empty($attribute_value) && !is_object($attribute_value) ) {
1746 1747
 			$input_def['value'] = $attribute_value;
1747
-		}
1748
-		else if ( !empty($attribute_value->value) ) {
1748
+		} else if ( !empty($attribute_value->value) ) {
1749 1749
 			$input_def['value'] = stripslashes($attribute_value->value);
1750
-		}
1751
-		else if ( !empty($specific_argument['element_identifier']) && empty($attribute_value) && (get_post_status($specific_argument['element_identifier']) != 'auto-draft') ) {
1750
+		} else if ( !empty($specific_argument['element_identifier']) && empty($attribute_value) && (get_post_status($specific_argument['element_identifier']) != 'auto-draft') ) {
1752 1751
 			$input_def['value'] = '';
1753 1752
 		}
1754 1753
 
@@ -1758,8 +1757,7 @@  discard block
 block discarded – undo
1758 1757
 			$date_config = unserialize( $attribute->default_value );
1759 1758
 			if ((($date_config['default_value'] == '') || ($date_config['default_value'] == 'date_of_current_day')) && ($date_config['default_value'] == 'date_of_current_day')) {
1760 1759
 				$input_def['value'] = date('Y-m-d');
1761
-			}
1762
-			else {
1760
+			} else {
1763 1761
 				/**	Modification due to a message on eoxia forum: http://www.eoxia.com/forums/topic/bug-attribut-de-type-date-dans-fiche-produit-admin/	*/
1764 1762
 				$input_def['value'] = !empty($attribute_value->value) && is_string($attribute_value->value) ? str_replace( " 00:00:00", "", $attribute_value->value ) : ( !empty($attribute_value) && is_string($attribute_value) ? str_replace( " 00:00:00", "", $attribute_value ) : '' );
1765 1763
 			}
@@ -1864,8 +1862,7 @@  discard block
 block discarded – undo
1864 1862
 		if((WPSHOP_PRODUCT_PRICE_PILOT == 'HT') && ($attribute->code == WPSHOP_PRODUCT_PRICE_TTC) ){
1865 1863
 			$input_def['option'] .= ' readonly="readonly" ';
1866 1864
 			$input_more_class .= ' wpshop_prices_readonly';
1867
-		}
1868
-		elseif((WPSHOP_PRODUCT_PRICE_PILOT == 'TTC') && ($attribute->code == WPSHOP_PRODUCT_PRICE_HT) ){
1865
+		} elseif((WPSHOP_PRODUCT_PRICE_PILOT == 'TTC') && ($attribute->code == WPSHOP_PRODUCT_PRICE_HT) ){
1869 1866
 			$input_def['option'] .= ' readonly="readonly" ';
1870 1867
 			$input_more_class .= ' wpshop_prices_readonly';
1871 1868
 		}
@@ -1889,14 +1886,12 @@  discard block
 block discarded – undo
1889 1886
 		if ($attribute->is_requiring_unit == 'yes') {
1890 1887
 			if ( in_array($attribute->code, $wpshop_price_attributes) || ( WPSHOP_COST_OF_POSTAGE == $attribute->code) ) {
1891 1888
 				$input_def['options'] .= '&nbsp;<span class="attribute_currency" id="attribute_currency_' . $attribute->id . '" >' . wpshop_tools::wpshop_get_currency() . '</span>';
1892
-			}
1893
-			elseif ( in_array($attribute->code, $wpshop_weight_attributes) ) {
1889
+			} elseif ( in_array($attribute->code, $wpshop_weight_attributes) ) {
1894 1890
 				$weight_defaut_unity_option = get_option('wpshop_shop_default_weight_unity');
1895 1891
 				$query = $wpdb->prepare('SELECT name FROM '. WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id=%d', $weight_defaut_unity_option);
1896 1892
 				$unity = $wpdb->get_var( $query );
1897 1893
 				$input_def['options'] .= '&nbsp;<span class="attribute_weight" id="attribute_weight_' . $attribute->id . '" >' . __($unity, 'wpshop') . '</span>';
1898
-			}
1899
-			else {
1894
+			} else {
1900 1895
 				unset($unit_input_def);
1901 1896
 				$unit_input_def['possible_value'] = wpshop_attributes_unit::get_unit_list_for_group($attribute->_unit_group_id);
1902 1897
 				$unit_input_def['type'] = 'select';
@@ -1907,8 +1902,7 @@  discard block
 block discarded – undo
1907 1902
 				if($unit_input_def['value'] == ''){
1908 1903
 					if ( $attribute->_default_unit > 0 ) {
1909 1904
 						$unit_input_def['value'] = $attribute->_default_unit;
1910
-					}
1911
-					else {
1905
+					} else {
1912 1906
 						$unit_input_def['value'] = wpshop_attributes_unit::get_default_unit_for_group($attribute->_unit_group_id);
1913 1907
 					}
1914 1908
 				}
@@ -1932,8 +1926,7 @@  discard block
 block discarded – undo
1932 1926
 			$input_def['label_pointer'] = '';
1933 1927
 			$input_def['option'] = substr( $input_def['option'], 0 , -2 ) . ' wpshop_attributes_is_user_defined_admin_field "';
1934 1928
 			$input_def['field_container_class'] .= 'wpshop_attributes_is_user_defined_admin_container';
1935
-		}
1936
-		else {
1929
+		} else {
1937 1930
 			$input_def['output'] = wpshop_form::check_input_type($input_def, $attributeInputDomain);
1938 1931
 		}
1939 1932
 		return $input_def;
@@ -2030,8 +2023,7 @@  discard block
 block discarded – undo
2030 2023
 					/**	Check the value type to check if empty or not	*/
2031 2024
 					if ( $attributeDefinition['data_type'] == 'int' ) {
2032 2025
 						$attributeDefinition['value'] = (int)$attributeDefinition['value'];
2033
-					}
2034
-					else if ( $attributeDefinition['data_type'] == 'decimal' ) {
2026
+					} else if ( $attributeDefinition['data_type'] == 'decimal' ) {
2035 2027
 						$attributeDefinition['value'] = (float)$attributeDefinition['value'];
2036 2028
 					}
2037 2029
 
@@ -2093,8 +2085,7 @@  discard block
 block discarded – undo
2093 2085
 						require(wpshop_display::get_template_file($tpl_way_to_take[1]));
2094 2086
 						$tab_list .= ob_get_contents();
2095 2087
 						ob_end_clean();
2096
-					}
2097
-					else {
2088
+					} else {
2098 2089
 						$tab_list .= wpshop_display::display_template_element($template_part, $tpl_component);
2099 2090
 					}
2100 2091
 					unset($tpl_component);
@@ -2113,8 +2104,7 @@  discard block
 block discarded – undo
2113 2104
 						require(wpshop_display::get_template_file($tpl_way_to_take[1]));
2114 2105
 						$content_list .= ob_get_contents();
2115 2106
 						ob_end_clean();
2116
-					}
2117
-					else {
2107
+					} else {
2118 2108
 						$content_list .= wpshop_display::display_template_element($template_part, $tpl_component);
2119 2109
 					}
2120 2110
 					unset($tpl_component);
@@ -2136,8 +2126,7 @@  discard block
 block discarded – undo
2136 2126
 					require(wpshop_display::get_template_file($tpl_way_to_take[1]));
2137 2127
 					$attributeContentOutput = ob_get_contents();
2138 2128
 					ob_end_clean();
2139
-				}
2140
-				else {
2129
+				} else {
2141 2130
 					$attributeContentOutput = wpshop_display::display_template_element($template_part, $tpl_component);
2142 2131
 				}
2143 2132
 				unset($tpl_component);
@@ -2189,8 +2178,9 @@  discard block
 block discarded – undo
2189 2178
 				foreach ($attributeDefinition['value'] as $v) {
2190 2179
 					$attribute_value .= ' / '.wpshop_attributes::get_attribute_type_select_option_info($v, 'label', $attributeDefinition['data_type_to_use']);
2191 2180
 				}
2181
+			} else {
2182
+				$attribute_value = ' / '.wpshop_attributes::get_attribute_type_select_option_info($attributeDefinition['value'], 'label', $attributeDefinition['data_type_to_use']);
2192 2183
 			}
2193
-			else $attribute_value = ' / '.wpshop_attributes::get_attribute_type_select_option_info($attributeDefinition['value'], 'label', $attributeDefinition['data_type_to_use']);
2194 2184
 			$attribute_value = substr($attribute_value,3);
2195 2185
 		}
2196 2186
 
@@ -2272,8 +2262,7 @@  discard block
 block discarded – undo
2272 2262
 								wps_shortcodes_ctr::output_shortcode('attribute_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label'])), $shortcode_code_def, 'wpshop_product_shortcode_display wpshop_product_attribute_shortcode_display wpshop_product_attribute_shortcode_display_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label'])).' wpshop_cls');
2273 2263
 								$shortcodes .= '<li class="wpshop_cls" >'.sprintf(__('Insertion code for the attribute %s for this product', 'wpshop'), '<span>'.__($attribute_output_def['field_definition']['label'], 'wpshop').'</span>').ob_get_contents().'</li>';
2274 2264
 								ob_end_clean();
2275
-							}
2276
-							else {
2265
+							} else {
2277 2266
 								if ( $attribute->code == 'product_attribute_set_id' ) {
2278 2267
 									$attribute_output_def['field_definition']['type'] = 'hidden';
2279 2268
 								}
@@ -2293,10 +2282,11 @@  discard block
 block discarded – undo
2293 2282
 					$attribute_group_display = sprintf(__('Insertion code for attribute group %s for this product', 'wpshop'), '<span>'.$productAttributeSetDetail['name'].'</span>').ob_get_contents().'<ul class="" >'.$shortcodes.'</ul>';
2294 2283
 					ob_end_clean();
2295 2284
 
2296
-					if( WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE == 'each-box' )
2297
-						$currentTabContent .= '<div class="wpshop_cls" ><strong>'.__('Shortcodes','wpshop').'</strong> - <a href="#" class="show-hide-shortcodes">' . __('Display', 'wpshop') . '</a><div class="wpshop_product_shortcode_display wpshop_product_shortcode_display_container wpshopHide" >' . $attribute_group_display . '</div></div>';
2298
-					else
2299
-						$shortcodes_attr .= $attribute_group_display;
2285
+					if( WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE == 'each-box' ) {
2286
+											$currentTabContent .= '<div class="wpshop_cls" ><strong>'.__('Shortcodes','wpshop').'</strong> - <a href="#" class="show-hide-shortcodes">' . __('Display', 'wpshop') . '</a><div class="wpshop_product_shortcode_display wpshop_product_shortcode_display_container wpshopHide" >' . $attribute_group_display . '</div></div>';
2287
+					} else {
2288
+											$shortcodes_attr .= $attribute_group_display;
2289
+					}
2300 2290
 
2301 2291
 					if ( $output_nb <= 0 ) {
2302 2292
 						$currentTabContent = __('Nothing avaiblable here. You can go in attribute management interface in order to add content here.', 'wpshop');
@@ -2311,8 +2301,7 @@  discard block
 block discarded – undo
2311 2301
 						$box['boxContent'][$productAttributeSetDetail['code']] = '
2312 2302
 			<div id="wpshop_' . $currentPageCode . '_' . wpshop_tools::slugify($productAttributeSetDetail['code'], array('noAccent')) . '_form" >' . $currentTabContent . '
2313 2303
 							</div><div class="wpshop_cls" ></div>';
2314
-					}
2315
-					else if ( $outputType == 'column' ) {
2304
+					} else if ( $outputType == 'column' ) {
2316 2305
 						$currentTabContent = str_replace('wpshop_form_input_element', 'wpshop_form_input_column', $currentTabContent);
2317 2306
 						$currentTabContent = str_replace('wpshop_form_label', 'wpshop_form_label_column', $currentTabContent);
2318 2307
 
@@ -2350,8 +2339,7 @@  discard block
 block discarded – undo
2350 2339
 							$box['box']['shortcode'] = __('Product Shortcodes', 'wpshop');
2351 2340
 							$box['boxContent']['shortcode'] = $shortcodes_attr;
2352 2341
 							$box['box']['shortcode_backend_display_type'] = WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE;
2353
-						}
2354
-						else{
2342
+						} else{
2355 2343
 							$box['columnTitle']['shortcode'] = __('Product Shortcodes', 'wpshop');
2356 2344
 							$box['columnContent']['shortcode'] = $shortcodes_attr;
2357 2345
 						}
@@ -2391,8 +2379,7 @@  discard block
 block discarded – undo
2391 2379
 //					$ouput['more_input'] .= '<input type="hidden" value="' . (WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT ? str_replace("\\", "", $option->value) : str_replace("\\", "", $option->label)) . '" name="wpshop_product_attribute_' . $attribute->code . '_value_' . $option->id . '" id="wpshop_product_attribute_' . $attribute->code . '_value_' . $option->id . '" />';
2392 2380
 // 				}
2393 2381
 			endforeach;
2394
-		}
2395
-		elseif ( $attribute->data_type_to_use == 'internal')  {
2382
+		} elseif ( $attribute->data_type_to_use == 'internal')  {
2396 2383
 			switch ($attribute_default_value) {
2397 2384
 				case 'users':
2398 2385
 					$users = get_users('orderby=nicename');
@@ -2421,9 +2408,11 @@  discard block
 block discarded – undo
2421 2408
 		/*	There is no value existing for this value	*/
2422 2409
 		if (empty($attribute_select_options_list)) :
2423 2410
 			$ouput['more_input'].=__('Nothing found for this field', 'wpshop');
2424
-		else:
2411
+		else {
2412
+			:
2425 2413
 			/*	Add a default value to the combobox list	*/
2426 2414
 			$default_value_is_serial = false;
2415
+		}
2427 2416
 			$attribute_list_first_element = $attribute->default_value;
2428 2417
 			if ( !empty($attribute->default_value) && ($attribute->default_value == serialize(false) || wpshop_tools::is_serialized( $attribute->default_value ) ) ) {
2429 2418
 				$default_value_is_serial = true;
@@ -2439,8 +2428,7 @@  discard block
 block discarded – undo
2439 2428
 		/*	Add a extra element to create a new element into list	*/
2440 2429
 		if ( is_admin()  && ( empty($provenance['from']) || ($provenance['from'] != 'frontend')) ) {
2441 2430
 			/**	$ouput['more_input'] .= '<img src="'.WPSHOP_MEDIAS_ICON_URL.'add.png" id="new_value_pict_' . $attribute->code . '" alt="'.__('Add a new value for this attribute', 'wpshop').'" title="'.__('Add a new value for this attribute', 'wpshop').'" class="wpshop_icons wpshop_icons_add_new_value_to_option_list wpshop_icons_add_new_value_to_option_list_'.$attribute->code.'" />';	*/
2442
-		}
2443
-		else if ( 'yes' == $attribute->is_used_in_quick_add_form ) {
2431
+		} else if ( 'yes' == $attribute->is_used_in_quick_add_form ) {
2444 2432
 			$tpl_component = array();
2445 2433
 			$tpl_component['NEW_ELEMENT_CREATION_FIELD'] = 'attribute[new_value_creation][' . $attribute->code . ']';
2446 2434
 			$ouput['more_input'] .= wpshop_display::display_template_element('quick_entity_specific_field_new_element', $tpl_component);
@@ -2462,8 +2450,7 @@  discard block
 block discarded – undo
2462 2450
 WHERE ATT.code = %s
2463 2451
 	AND ATT_SELECT_OPTIONS_VALUE.status = 'valid'
2464 2452
 GROUP BY ATT.id, chosen_val", $element_id, $attribute_code);
2465
-		}
2466
-		else {
2453
+		} else {
2467 2454
 			$query = $wpdb->prepare("
2468 2455
 SELECT P.ID AS chosen_val, P.post_title
2469 2456
 FROM " . WPSHOP_DBT_ATTRIBUTE . " AS ATT
@@ -2638,14 +2625,17 @@  discard block
 block discarded – undo
2638 2625
 		$attribute_final = array();
2639 2626
 		$entity_type = get_post_type($entityId);
2640 2627
 		$data = self::get_attribute_list_for_item( wpshop_entities::get_entity_identifier_from_code($entity_type), $entityId, WPSHOP_CURRENT_LOCALE);
2641
-		foreach($data as $d) $attribute_available[$d->attribute_code] = array('attribute_id' => $d->attribute_id, 'data_type' => $d->data_type);
2628
+		foreach($data as $d) {
2629
+			$attribute_available[$d->attribute_code] = array('attribute_id' => $d->attribute_id, 'data_type' => $d->data_type);
2630
+		}
2642 2631
 
2643 2632
 		// Creation d'un array "propre" et valide pour la fonction self::saveAttributeForEntity
2644 2633
 		foreach ( $values as $key => $value ) {
2645 2634
 			if ( in_array( $key, array_keys( $attribute_available ) ) ) {
2646 2635
 				$attribute_final[$attribute_available[$key]['data_type']][$key] = $value;
2636
+			} else {
2637
+				$message .= sprintf(__('Impossible to set "%s" attribute', 'wpshop'), $key)."\n";
2647 2638
 			}
2648
-			else $message .= sprintf(__('Impossible to set "%s" attribute', 'wpshop'), $key)."\n";
2649 2639
 		}
2650 2640
 
2651 2641
 		// Pour les autres attributs non donné on leur affecte leur valeur par défaut
@@ -2715,8 +2705,7 @@  discard block
 block discarded – undo
2715 2705
 						/** Build template	*/
2716 2706
 						$info = wpshop_display::display_template_element($template_part, $tpl_component);
2717 2707
 						unset($tpl_component);
2718
-					}
2719
-					else {
2708
+					} else {
2720 2709
 						$info = $entity_infos->post_title;
2721 2710
 					}
2722 2711
 				}
@@ -2904,8 +2893,7 @@  discard block
 block discarded – undo
2904 2893
 
2905 2894
 		});
2906 2895
 	</script>';
2907
-			}
2908
-			elseif((($data_type == 'internal') && empty($attribute_select_options)) || (!empty($attribute_select_options) && !empty($attribute_select_options[0]->data_type_to_use) && ($attribute_select_options[0]->data_type_to_use == 'internal'))){
2896
+			} elseif((($data_type == 'internal') && empty($attribute_select_options)) || (!empty($attribute_select_options) && !empty($attribute_select_options[0]->data_type_to_use) && ($attribute_select_options[0]->data_type_to_use == 'internal'))){
2909 2897
 				$sub_output='';
2910 2898
 				$wp_types = unserialize(WPSHOP_INTERNAL_TYPES);
2911 2899
 				unset($input_def);$input_def=array();
@@ -3006,8 +2994,7 @@  discard block
 block discarded – undo
3006 2994
 									<option value="' . $value->value . '" >' . $value->label . '</option>';
3007 2995
 										}
3008 2996
 									}
3009
-								}
3010
-								else {
2997
+								} else {
3011 2998
 									foreach ($attribute_values as $attribute_value) {
3012 2999
 										if ( !empty($attribute_value->value) ) {
3013 3000
 											$attribute_possible_values .= '
@@ -3090,8 +3077,7 @@  discard block
 block discarded – undo
3090 3077
 					$final_list['unavailable'][$attribute->code]['label'] = $attribute->frontend_label;
3091 3078
 					$final_list['unavailable'][$attribute->code]['values'] = array();
3092 3079
 					$final_list['unavailable'][$attribute->code]['attribute_complete_def'] = $attribute;
3093
-				}
3094
-				else {
3080
+				} else {
3095 3081
 					$final_list['available'][$attribute->code]['label'] = $attribute->frontend_label;
3096 3082
 					$final_list['available'][$attribute->code]['values'] = $attribute_values_for_variations;
3097 3083
 					$final_list['available'][$attribute->code]['attribute_complete_def'] = $attribute;
@@ -3119,8 +3105,7 @@  discard block
 block discarded – undo
3119 3105
 						$tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_LABEL_STATE'] = '';
3120 3106
 						$tpl_component['ADMIN_VARIATIONS_DEF_LIST_ATTRIBUTE_CHECKBOX_STATE'] = '';
3121 3107
 						$tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_TO_USE_LABEL_EXPLAINATION'] = '';
3122
-					}
3123
-					else {
3108
+					} else {
3124 3109
 						$tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_LABEL_STATE'] = ' class="wpshop_unavailable_label_variation_definition" ';
3125 3110
 						$tpl_component['ADMIN_VARIATIONS_DEF_LIST_ATTRIBUTE_CHECKBOX_STATE'] = ' disabled="disabled"';
3126 3111
 						$tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_TO_USE_LABEL_EXPLAINATION'] = '';
Please login to merge, or discard this patch.
Spacing   +559 added lines, -559 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,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @package wpshop
21 21
  * @subpackage librairies
22 22
  */
23
-class wpshop_attributes{
23
+class wpshop_attributes {
24 24
 	/*	Define the database table used in the current class	*/
25 25
 	const dbTable = WPSHOP_DBT_ATTRIBUTE;
26 26
 	/*	Define the url listing slug used in the current class	*/
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 *	@return string The table of the class
52 52
 	 */
53
-	function setMessage($message){
53
+	function setMessage($message) {
54 54
 		$this->pageMessage = $message;
55 55
 	}
56 56
 	/**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 *	@return string The table of the class
60 60
 	 */
61
-	function getListingSlug(){
61
+	function getListingSlug() {
62 62
 		return self::urlSlugListing;
63 63
 	}
64 64
 	/**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 *	@return string The table of the class
68 68
 	 */
69
-	function getEditionSlug(){
69
+	function getEditionSlug() {
70 70
 		return self::urlSlugEdition;
71 71
 	}
72 72
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 *	@return string The table of the class
76 76
 	 */
77
-	public static function getDbTable(){
77
+	public static function getDbTable() {
78 78
 		return self::dbTable;
79 79
 	}
80 80
 	/**
@@ -82,21 +82,21 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 *	@return string $title The title of the page looking at the environnement
84 84
 	 */
85
-	function pageTitle(){
85
+	function pageTitle() {
86 86
 		$action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
87 87
 		$objectInEdition = isset($_REQUEST['id']) ? sanitize_key($_REQUEST['id']) : '';
88
-		$page = !empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
88
+		$page = !empty($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
89 89
 
90
-		$title = __(self::pageTitle, 'wpshop' );
91
-		if($action != ''){
92
-			if(($action == 'edit') || ($action == 'delete')){
90
+		$title = __(self::pageTitle, 'wpshop');
91
+		if ($action != '') {
92
+			if (($action == 'edit') || ($action == 'delete')) {
93 93
 				$editedItem = self::getElement($objectInEdition);
94 94
 				$title = sprintf(__(self::pageEditingTitle, 'wpshop'), str_replace("\\", "", $editedItem->frontend_label));
95 95
 			}
96
-			elseif($action == 'add')
96
+			elseif ($action == 'add')
97 97
 				$title = __(self::pageAddingTitle, 'wpshop');
98 98
 		}
99
-		elseif((self::getEditionSlug() != self::getListingSlug()) && ($page == self::getEditionSlug()))
99
+		elseif ((self::getEditionSlug() != self::getListingSlug()) && ($page == self::getEditionSlug()))
100 100
 			$title = __(self::pageAddingTitle, 'wpshop');
101 101
 
102 102
 		return $title;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 *	Define the different message and action after an action is send through the element interface
107 107
 	 */
108
-	function elementAction(){
108
+	function elementAction() {
109 109
 		global $wpdb, $initialEavData;
110 110
 
111 111
 		$pageMessage = $actionResult = '';
@@ -118,75 +118,75 @@  discard block
 block discarded – undo
118 118
 		$saveditem = isset($_REQUEST['saveditem']) ? sanitize_text_field($_REQUEST['saveditem']) : '';
119 119
 		$set_section = !empty($_REQUEST[self::getDbTable()]['set_section']) ? sanitize_text_field($_REQUEST[self::getDbTable()]['set_section']) : '';
120 120
 		//@TODO $_REQUEST
121
-		$id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : null;
122
-		if(!empty($action) && ($action=='activate') ){
123
-			if( isset($id) ) {
121
+		$id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : null;
122
+		if (!empty($action) && ($action == 'activate')) {
123
+			if (isset($id)) {
124 124
 				$query = $wpdb->update(self::getDbTable(), array('status'=>'moderated'), array('id'=>$id));
125 125
 				wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=edit&id=" . $id));
126 126
 			}
127 127
 		}
128
-		if(($action != '') && ($action == 'saveok') && ($saveditem > 0)){
128
+		if (($action != '') && ($action == 'saveok') && ($saveditem > 0)) {
129 129
 			$editedElement = self::getElement($saveditem);
130 130
 			$pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully saved', 'wpshop'), '<span class="bold" >' . $editedElement->code . '</span>');
131 131
 		}
132
-		elseif(($action != '') && ($action == 'deleteok') && ($saveditem > 0)){
132
+		elseif (($action != '') && ($action == 'deleteok') && ($saveditem > 0)) {
133 133
 			$editedElement = self::getElement($saveditem, "'deleted'");
134 134
 			$pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully deleted', 'wpshop'), '<span class="bold" >' . $editedElement->code . '</span>');
135 135
 		}
136 136
 
137
-		$attribute_parameter = !empty( $_REQUEST[self::getDbTable()] ) ? (array)$_REQUEST[self::getDbTable()] : array();
138
-		 if ( !empty($set_section) ) unset($attribute_parameter['set_section']);
137
+		$attribute_parameter = !empty($_REQUEST[self::getDbTable()]) ? (array)$_REQUEST[self::getDbTable()] : array();
138
+		 if (!empty($set_section)) unset($attribute_parameter['set_section']);
139 139
 
140 140
 		$wpshop_attribute_combo_values_list_order_def = !empty($attribute_parameter['wpshop_attribute_combo_values_list_order_def']) ? $attribute_parameter['wpshop_attribute_combo_values_list_order_def'] : array();
141 141
 		// @TODO $_REQUEST
142 142
 		// unset($_REQUEST[self::getDbTable()]['wpshop_attribute_combo_values_list_order_def']);
143 143
 
144
-		if(!isset($attribute_parameter['status'])){
144
+		if (!isset($attribute_parameter['status'])) {
145 145
 			$attribute_parameter['status'] = 'moderated';
146 146
 		}
147
-		if(!isset($attribute_parameter['is_historisable'])){
147
+		if (!isset($attribute_parameter['is_historisable'])) {
148 148
 			$attribute_parameter['is_historisable'] = 'no';
149 149
 		}
150
-		if(!isset($attribute_parameter['is_required'])){
150
+		if (!isset($attribute_parameter['is_required'])) {
151 151
 			$attribute_parameter['is_required'] = 'no';
152 152
 		}
153
-		if(!isset($attribute_parameter['is_used_in_admin_listing_column'])){
153
+		if (!isset($attribute_parameter['is_used_in_admin_listing_column'])) {
154 154
 			$attribute_parameter['is_used_in_admin_listing_column'] = 'no';
155 155
 		}
156
-		if(!isset($attribute_parameter['is_used_in_quick_add_form'])){
156
+		if (!isset($attribute_parameter['is_used_in_quick_add_form'])) {
157 157
 			$attribute_parameter['is_used_in_quick_add_form'] = 'no';
158 158
 		}
159
-		if(!isset($attribute_parameter['is_intrinsic'])){
159
+		if (!isset($attribute_parameter['is_intrinsic'])) {
160 160
 			$attribute_parameter['is_intrinsic'] = 'no';
161 161
 		}
162
-		if(!isset($attribute_parameter['is_requiring_unit'])){
162
+		if (!isset($attribute_parameter['is_requiring_unit'])) {
163 163
 			$attribute_parameter['is_requiring_unit'] = 'no';
164 164
 		}
165
-		if(!isset($attribute_parameter['is_visible_in_front'])){
165
+		if (!isset($attribute_parameter['is_visible_in_front'])) {
166 166
 			$attribute_parameter['is_visible_in_front'] = 'no';
167 167
 		}
168
-		if(!isset($attribute_parameter['is_visible_in_front_listing'])){
168
+		if (!isset($attribute_parameter['is_visible_in_front_listing'])) {
169 169
 			$attribute_parameter['is_visible_in_front_listing'] = 'no';
170 170
 		}
171
-		if(!isset($attribute_parameter['is_used_for_sort_by'])){
171
+		if (!isset($attribute_parameter['is_used_for_sort_by'])) {
172 172
 			$attribute_parameter['is_used_for_sort_by'] = 'no';
173 173
 		}
174
-		if(!isset($attribute_parameter['is_visible_in_advanced_search'])){
174
+		if (!isset($attribute_parameter['is_visible_in_advanced_search'])) {
175 175
 			$attribute_parameter['is_visible_in_advanced_search'] = 'no';
176 176
 		}
177
-		if(!isset($attribute_parameter['is_searchable'])){
177
+		if (!isset($attribute_parameter['is_searchable'])) {
178 178
 			$attribute_parameter['is_searchable'] = 'no';
179 179
 		}
180
-		if(!isset($attribute_parameter['is_used_for_variation'])){
180
+		if (!isset($attribute_parameter['is_used_for_variation'])) {
181 181
 			$attribute_parameter['is_used_for_variation'] = 'no';
182 182
 		}
183
-		if(!isset($attribute_parameter['is_used_in_variation'])){
183
+		if (!isset($attribute_parameter['is_used_in_variation'])) {
184 184
 			$attribute_parameter['is_used_in_variation'] = 'no';
185 185
 		}
186
-		if(!isset($attribute_parameter['is_user_defined'])){
186
+		if (!isset($attribute_parameter['is_user_defined'])) {
187 187
 			$attribute_parameter['is_user_defined'] = 'no';
188 188
 		}
189
-		if(!isset($attribute_parameter['_display_informations_about_value'])){
189
+		if (!isset($attribute_parameter['_display_informations_about_value'])) {
190 190
 			$attribute_parameter['_display_informations_about_value'] = 'no';
191 191
 		}
192 192
 
@@ -195,58 +195,58 @@  discard block
 block discarded – undo
195 195
 			switch ($attribute_parameter['frontend_input']) {
196 196
 				case 'short_text':
197 197
 						$attribute_parameter['frontend_input'] = 'text';
198
-						if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
198
+						if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text';
199 199
 						$attribute_parameter['data_type'] = 'varchar';
200 200
 					break;
201 201
 				case 'date_field':
202 202
 						$attribute_parameter['frontend_input'] = 'text';
203
-						if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
203
+						if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text';
204 204
 						$attribute_parameter['data_type'] = 'datetime';
205 205
 					break;
206 206
 				case 'float_field':
207 207
 						$attribute_parameter['frontend_input'] = 'text';
208
-						if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
208
+						if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text';
209 209
 						$attribute_parameter['data_type'] = 'decimal';
210 210
 					break;
211 211
 				case 'hidden_field':
212 212
 						$attribute_parameter['frontend_input'] = 'hidden';
213
-						if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
213
+						if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text';
214 214
 						$attribute_parameter['data_type'] = 'varchar';
215 215
 					break;
216 216
 				case 'pass_field':
217 217
 						$attribute_parameter['frontend_input'] = 'password';
218
-						if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
218
+						if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text';
219 219
 						$attribute_parameter['data_type'] = 'varchar';
220 220
 					break;
221 221
 
222 222
 				case 'select':
223 223
 						$attribute_parameter['frontend_input'] = 'select';
224
-						if ( empty($attribute_parameter['backend_input']) || empty($id) )
224
+						if (empty($attribute_parameter['backend_input']) || empty($id))
225 225
 							$attribute_parameter['backend_input'] = 'multiple-select';
226 226
 						$attribute_parameter['data_type'] = 'integer';
227 227
 					break;
228 228
 				case 'multiple-select':
229 229
 						$attribute_parameter['frontend_input'] = 'multiple-select';
230
-						if ( empty($attribute_parameter['backend_input']) || empty($id) )
230
+						if (empty($attribute_parameter['backend_input']) || empty($id))
231 231
 							$attribute_parameter['backend_input'] = 'multiple-select';
232 232
 						$attribute_parameter['data_type'] = 'integer';
233 233
 					break;
234 234
 				case 'radio':
235 235
 						$attribute_parameter['frontend_input'] = 'radio';
236
-						if ( empty($attribute_parameter['backend_input']) || empty($id) )
236
+						if (empty($attribute_parameter['backend_input']) || empty($id))
237 237
 							$attribute_parameter['backend_input'] = 'multiple-select';
238 238
 						$attribute_parameter['data_type'] = 'integer';
239 239
 					break;
240 240
 				case 'checkbox':
241 241
 						$attribute_parameter['frontend_input'] = 'checkbox';
242
-						if ( empty($attribute_parameter['backend_input']) || empty($id) )
242
+						if (empty($attribute_parameter['backend_input']) || empty($id))
243 243
 							$attribute_parameter['backend_input'] = 'multiple-select';
244 244
 						$attribute_parameter['data_type'] = 'integer';
245 245
 					break;
246 246
 
247 247
 				case 'textarea':
248 248
 						$attribute_parameter['frontend_input'] = 'textarea';
249
-						if ( empty($attribute_parameter['backend_input']) || empty($id) )
249
+						if (empty($attribute_parameter['backend_input']) || empty($id))
250 250
 							$attribute_parameter['backend_input'] = 'textarea';
251 251
 						$attribute_parameter['data_type'] = 'text';
252 252
 					break;
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 		}
255 255
 		else {
256 256
 			$attribute_parameter['frontend_input'] = 'text';
257
-			if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text';
257
+			if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text';
258 258
 			$attribute_parameter['data_type'] = 'varchar';
259 259
 		}
260 260
 
@@ -263,55 +263,55 @@  discard block
 block discarded – undo
263 263
 			// $attribute_parameter['use_ajax_for_filling_field']='no';
264 264
 		// }
265 265
 		$attribute_parameter['use_ajax_for_filling_field'] = 'yes';
266
-		if( $attribute_parameter['backend_input'] == 'multiple-select' ) {
266
+		if ($attribute_parameter['backend_input'] == 'multiple-select') {
267 267
 			$attribute_parameter['is_used_for_variation'] = 'yes';
268 268
 		}
269 269
 
270 270
 		/*	Define the database operation type from action launched by the user	 */
271 271
 		$attribute_parameter['default_value'] = (!empty($attribute_parameter['default_value']) && is_array($attribute_parameter['default_value'])) ? serialize($attribute_parameter['default_value']) : (isset($attribute_parameter['default_value']) ? str_replace('"', "'", $attribute_parameter['default_value']) : '');
272
-		if ( $attribute_parameter['data_type'] == 'datetime' ) {
272
+		if ($attribute_parameter['data_type'] == 'datetime') {
273 273
 			$date_default_value_trasform_into_config = array('default_value' => $attribute_parameter['default_value'], 'field_options' => (!empty($_POST[self::getDbTable() . '_options']) ? sanitize_text_field($_POST[self::getDbTable() . '_options']) : null));
274
-			$attribute_parameter['default_value'] = serialize( $date_default_value_trasform_into_config );
274
+			$attribute_parameter['default_value'] = serialize($date_default_value_trasform_into_config);
275 275
 		}
276 276
 		/*****************************		GENERIC				**************************/
277 277
 		/*************************************************************************/
278
-		$pageAction = (!empty($attribute_parameter['frontend_label']) && isset($_REQUEST[self::getDbTable() . '_action'])) ? sanitize_text_field($_REQUEST[self::getDbTable() . '_action']) : ((!empty($_GET['action']) && ($_GET['action']=='delete')) ? sanitize_text_field($_GET['action']) : '');
278
+		$pageAction = (!empty($attribute_parameter['frontend_label']) && isset($_REQUEST[self::getDbTable() . '_action'])) ? sanitize_text_field($_REQUEST[self::getDbTable() . '_action']) : ((!empty($_GET['action']) && ($_GET['action'] == 'delete')) ? sanitize_text_field($_GET['action']) : '');
279 279
 		$id = isset($attribute_parameter['id']) ? sanitize_key($attribute_parameter['id']) : ((!empty($_GET['id'])) ? $_GET['id'] : '');
280
-		if(($pageAction != '') && (($pageAction == 'edit') || ($pageAction == 'editandcontinue'))){
281
-			if(current_user_can('wpshop_edit_attributes')){
280
+		if (($pageAction != '') && (($pageAction == 'edit') || ($pageAction == 'editandcontinue'))) {
281
+			if (current_user_can('wpshop_edit_attributes')) {
282 282
 				$attribute_parameter['last_update_date'] = date('Y-m-d H:i:s');
283
-				if($pageAction == 'delete'){
283
+				if ($pageAction == 'delete') {
284 284
 					$attribute_code = $attribute_parameter['code'];
285
-					if(!isset($attribute_parameter['code']) || ($attribute_parameter['code'] == '')){
285
+					if (!isset($attribute_parameter['code']) || ($attribute_parameter['code'] == '')) {
286 286
 						$attribute = self::getElement($id, "'valid', 'moderated', 'notused'", 'id');
287 287
 						$attribute_code = $attribute->code;
288 288
 					}
289
-					if(!in_array($attribute_code, $attribute_undeletable)){
290
-						if(current_user_can('wpshop_delete_attributes')){
289
+					if (!in_array($attribute_code, $attribute_undeletable)) {
290
+						if (current_user_can('wpshop_delete_attributes')) {
291 291
 							$attribute_parameter['status'] = 'deleted';
292 292
 						}
293
-						else{
293
+						else {
294 294
 							$actionResult = 'userNotAllowedForActionDelete';
295 295
 						}
296 296
 					}
297
-					else{
297
+					else {
298 298
 						$actionResult = 'unDeletableAtribute';
299 299
 					}
300 300
 				}
301 301
 				$actionResult = wpshop_database::update($attribute_parameter, $id, self::getDbTable());
302 302
 			}
303
-			else{
303
+			else {
304 304
 				$actionResult = 'userNotAllowedForActionEdit';
305 305
 			}
306 306
 		}
307
-		elseif(($pageAction != '') && (($pageAction == 'delete'))){
307
+		elseif (($pageAction != '') && (($pageAction == 'delete'))) {
308 308
 			$attribute_code = '';
309
-			if (empty(	$attribute_parameter['code'])) {
309
+			if (empty($attribute_parameter['code'])) {
310 310
 				$attribute = self::getElement($id, "'valid', 'moderated', 'notused', 'deleted'", 'id');
311 311
 				$attribute_code = $attribute->code;
312 312
 			}
313 313
 			if (!in_array($attribute_code, $attribute_undeletable)) {
314
-				if(current_user_can('wpshop_delete_attributes')){
314
+				if (current_user_can('wpshop_delete_attributes')) {
315 315
 					$attribute_parameter['last_update_date'] = current_time('mysql', 0);
316 316
 					$attribute_parameter['status'] = 'deleted';
317 317
 					$actionResult = wpshop_database::update($attribute_parameter, $id, self::getDbTable());
@@ -322,21 +322,21 @@  discard block
 block discarded – undo
322 322
 			else
323 323
 				$actionResult = 'unDeletableAtribute';
324 324
 		}
325
-		elseif(($pageAction != '') && (($pageAction == 'save') || ($pageAction == 'saveandcontinue') || ($pageAction == 'add'))){
326
-			if(current_user_can('wpshop_add_attributes')){
325
+		elseif (($pageAction != '') && (($pageAction == 'save') || ($pageAction == 'saveandcontinue') || ($pageAction == 'add'))) {
326
+			if (current_user_can('wpshop_add_attributes')) {
327 327
 				$attribute_parameter['creation_date'] = current_time('mysql', 0);
328
-				if(trim($attribute_parameter['code']) == ''){
328
+				if (trim($attribute_parameter['code']) == '') {
329 329
 					$attribute_parameter['code'] = $attribute_parameter['frontend_label'];
330 330
 				}
331 331
 				$attribute_parameter['code'] = wpshop_tools::slugify(str_replace("\'", "_", str_replace('\"', "_", $attribute_parameter['code'])), array('noAccent', 'noSpaces', 'lowerCase', 'noPunctuation'));
332 332
 				$code_exists = self::getElement($attribute_parameter['code'], "'valid', 'moderated', 'deleted'", 'code');
333
-				if((is_object($code_exists) || is_array($code_exists)) && (count($code_exists) > 0)){
333
+				if ((is_object($code_exists) || is_array($code_exists)) && (count($code_exists) > 0)) {
334 334
 					$attribute_parameter['code'] = $attribute_parameter['code'] . '_' . (count($code_exists) + rand());
335 335
 				}
336 336
 				$actionResult = wpshop_database::save($attribute_parameter, self::getDbTable());
337 337
 				$id = $wpdb->insert_id;
338 338
 			}
339
-			else{
339
+			else {
340 340
 				$actionResult = 'userNotAllowedForActionAdd';
341 341
 			}
342 342
 		}
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
 		/************		CHANGE THE FIELD NAME TO TAKE TO DISPLAY				*************/
346 346
 		/************		CHANGE ERROR MESSAGE FOR SPECIFIC CASE					*************/
347 347
 		/****************************************************************************/
348
-		if($actionResult != ''){
348
+		if ($actionResult != '') {
349 349
 			$elementIdentifierForMessage = __('the attribute', 'wpshop');
350
-			if(!empty($attribute_parameter['name']))$elementIdentifierForMessage = '<span class="bold" >' . $attribute_parameter['frontend_label'] . '</span>';
350
+			if (!empty($attribute_parameter['name']))$elementIdentifierForMessage = '<span class="bold" >' . $attribute_parameter['frontend_label'] . '</span>';
351 351
 			if ($actionResult == 'error') {/*	CHANGE HERE FOR SPECIFIC CASE	*/
352 352
 				$pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . sprintf(__('An error occured while saving %s', 'wpshop'), $elementIdentifierForMessage, ' -> ' . $wpdb->last_error);
353 353
 			}
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
 				$done_options_value = array();
360 360
 				$default_value = $attribute_parameter['default_value'];
361 361
 				$i = 1;
362
-				$options = !empty($_REQUEST['options']) ? (array) $_REQUEST['options'] : array();
363
-				$optionsValue = !empty($_REQUEST['optionsValue']) ? (array) $_REQUEST['optionsValue'] : array();
364
-				$optionsUpdate = !empty($_REQUEST['optionsUpdate']) ? (array) $_REQUEST['optionsUpdate'] : array();
365
-				$optionsUpdateValue = !empty($_REQUEST['optionsUpdateValue']) ? (array) $_REQUEST['optionsUpdateValue'] : array();
366
-				if ( !empty($optionsUpdate) ) {
362
+				$options = !empty($_REQUEST['options']) ? (array)$_REQUEST['options'] : array();
363
+				$optionsValue = !empty($_REQUEST['optionsValue']) ? (array)$_REQUEST['optionsValue'] : array();
364
+				$optionsUpdate = !empty($_REQUEST['optionsUpdate']) ? (array)$_REQUEST['optionsUpdate'] : array();
365
+				$optionsUpdateValue = !empty($_REQUEST['optionsUpdateValue']) ? (array)$_REQUEST['optionsUpdateValue'] : array();
366
+				if (!empty($optionsUpdate)) {
367 367
 					/**
368 368
 					 *	Check if there is an attribute code into sended request or if we have to get the code from database (Bug fix)
369 369
 					 */
@@ -377,25 +377,25 @@  discard block
 block discarded – undo
377 377
 					foreach ($optionsUpdate as $option_key => $option_label) {
378 378
 						$option_value = !empty($optionsUpdateValue[$option_key]) ? str_replace(",", ".", $optionsUpdateValue[$option_key]) : '';
379 379
 
380
-						if ( empty($option_value) || !in_array($option_value, $done_options_value) ) {
380
+						if (empty($option_value) || !in_array($option_value, $done_options_value)) {
381 381
 							/*	Update an existing value only if the value does not exist into existing list	*/
382 382
 							$label = (($option_label != '') ? $option_label : str_replace(",", ".", $option_value));
383 383
 							$value = str_replace(",", ".", $option_value);
384
-							if( !WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT ) {
384
+							if (!WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT) {
385 385
 								$label = $option_label;
386
-								$value =  str_replace(",", ".", $label);
386
+								$value = str_replace(",", ".", $label);
387 387
 							}
388 388
 
389 389
 							$wpdb->update(WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS, array('last_update_date' => current_time('mysql', 0), 'position' => $i, 'label' => stripslashes($label), 'value' => stripslashes($value)), array('id' => $option_key));
390 390
 							$done_options_value[] = str_replace(",", ".", $option_value);
391 391
 
392 392
 							/*	Check if this value is used for price calculation and make update on the different product using this value	*/
393
-							if($attribute_code == WPSHOP_PRODUCT_PRICE_TAX){
393
+							if ($attribute_code == WPSHOP_PRODUCT_PRICE_TAX) {
394 394
 								$action = wpshop_prices::mass_update_prices();
395 395
 							}
396 396
 						}
397 397
 
398
-						if($default_value == $option_key) {
398
+						if ($default_value == $option_key) {
399 399
 							/*	Update an existing a only if the value does not exist into existing list	*/
400 400
 							$wpdb->update(WPSHOP_DBT_ATTRIBUTE, array('last_update_date' => current_time('mysql', 0), 'default_value' => $option_key), array('id' => $id));
401 401
 							$done_options_value[] = str_replace(",", ".", $option_value);
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
 						$i++;
404 404
 					}
405 405
 				}
406
-				if ( !empty($options) ) {
407
-					foreach ( $options as $option_key => $option_label ) {
406
+				if (!empty($options)) {
407
+					foreach ($options as $option_key => $option_label) {
408 408
 						$option_value = !empty($optionsValue[$option_key]) ? str_replace(",", ".", $optionsValue[$option_key]) : sanitize_title($option_label);
409 409
 
410 410
 						/*	Check what value to use for the new values	*/
411 411
 						$label = (!empty($option_label) ? $option_label : str_replace(",", ".", $option_value));
412
-						if( !WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT && empty($option_value) ) {
412
+						if (!WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT && empty($option_value)) {
413 413
 							$label = $option_label;
414 414
 							$option_value = sanitize_title($label);
415 415
 						}
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 						// If the optionsUpdateValue is empty, set it a empty array to avoid error calling the in_array() function
418 418
 						// $_REQUEST['optionsUpdateValue'] = !empty($_REQUEST['optionsUpdateValue']) ? $_REQUEST['optionsUpdateValue'] : array();
419 419
 
420
-						if (!in_array($option_value, $done_options_value) && !in_array($option_value, $optionsUpdateValue) ) {
420
+						if (!in_array($option_value, $done_options_value) && !in_array($option_value, $optionsUpdateValue)) {
421 421
 
422 422
 							$wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS, array('creation_date' => current_time('mysql', 0), 'status' => 'valid', 'attribute_id' => $id, 'position' => $i, 'label' => stripslashes($label), 'value' => stripslashes($option_value)));
423 423
 							$done_options_value[] = str_replace(",", ".", $option_value);
@@ -435,19 +435,19 @@  discard block
 block discarded – undo
435 435
 				}
436 436
 
437 437
 				// If the is_used_for_sort_by is mark as yes, we have to get out some attributes and save it separately
438
-				if( (!empty($attribute_parameter['is_used_for_sort_by']) && ($attribute_parameter['is_used_for_sort_by'] == 'yes')) || (!empty($attribute_parameter['is_filterable']) && ($attribute_parameter['is_filterable'] == 'yes')) || (!empty($attribute_parameter['is_searchable']) && ($attribute_parameter['is_searchable'] == 'yes')) ){
438
+				if ((!empty($attribute_parameter['is_used_for_sort_by']) && ($attribute_parameter['is_used_for_sort_by'] == 'yes')) || (!empty($attribute_parameter['is_filterable']) && ($attribute_parameter['is_filterable'] == 'yes')) || (!empty($attribute_parameter['is_searchable']) && ($attribute_parameter['is_searchable'] == 'yes'))) {
439 439
 					$attribute_code = $attribute_parameter['code'];
440
-					if(!isset($attribute_parameter['code']) || ($attribute_parameter['code'] == '')){
440
+					if (!isset($attribute_parameter['code']) || ($attribute_parameter['code'] == '')) {
441 441
 						$attribute = self::getElement($id, "'valid', 'moderated', 'notused'", 'id');
442 442
 						$attribute_code = $attribute->code;
443 443
 					}
444 444
 
445 445
 					$count_products = wp_count_posts(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT);
446
-					for( $i = 0; $i <= $count_products->publish; $i+= 20 ) {
447
-						$query = $wpdb->prepare( 'SELECT * FROM '. $wpdb->posts .' WHERE post_type = %s AND post_status = %s ORDER BY ID DESC LIMIT '.$i.', 20', WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'publish' );
448
-						$products = $wpdb->get_results( $query );
449
-						if ( !empty($products) ) {
450
-							foreach( $products as $product ) {
446
+					for ($i = 0; $i <= $count_products->publish; $i += 20) {
447
+						$query = $wpdb->prepare('SELECT * FROM ' . $wpdb->posts . ' WHERE post_type = %s AND post_status = %s ORDER BY ID DESC LIMIT ' . $i . ', 20', WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'publish');
448
+						$products = $wpdb->get_results($query);
449
+						if (!empty($products)) {
450
+							foreach ($products as $product) {
451 451
 								$query = $wpdb->prepare("SELECT value FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attribute_parameter['data_type'] . " WHERE attribute_id = %d AND entity_type_id = %d AND entity_id = %d AND value != '' ORDER BY creation_date_value DESC", $id, $attribute_parameter['entity_id'], $product->ID);
452 452
 								$value = $wpdb->get_var($query);
453 453
 								update_post_meta($product->ID, '_' . $attribute_code, $value);
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
 					wp_reset_query();
458 458
 				}
459 459
 
460
-				if ( $pageAction != 'delete' ) {/*	Add the new attribute in the additionnal informations attribute group	*/
461
-					if ( !empty($set_section) ) {
460
+				if ($pageAction != 'delete') {/*	Add the new attribute in the additionnal informations attribute group	*/
461
+					if (!empty($set_section)) {
462 462
 						$choosen_set_section = explode('_', $set_section);
463 463
 						$set_id = $choosen_set_section[0];
464 464
 						$group_id = $choosen_set_section[1];
465 465
 					}
466
-					else{
466
+					else {
467 467
 						$attribute_current_attribute_set = 0;
468 468
 						$query = $wpdb->prepare("
469 469
 								SELECT id
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 									AND ATTRIBUTE_SET_DETAILS.entity_type_id = %d", $id, $attribute_parameter['entity_id']);
474 474
 						$attribute_current_attribute_set = $wpdb->get_results($query);
475 475
 
476
-						if ( empty($attribute_current_attribute_set) ) {
476
+						if (empty($attribute_current_attribute_set)) {
477 477
 							$query = $wpdb->prepare("
478 478
 								SELECT
479 479
 									(
@@ -494,12 +494,12 @@  discard block
 block discarded – undo
494 494
 							$wpshop_default_group = $wpdb->get_row($query);
495 495
 
496 496
 							$set_id = $wpshop_default_group->attribute_set_id;
497
-							$default_group_id = ( !empty( $wpshop_default_group->default_attribute_group_id) ) ? $wpshop_default_group->default_attribute_group_id : '';
497
+							$default_group_id = (!empty($wpshop_default_group->default_attribute_group_id)) ? $wpshop_default_group->default_attribute_group_id : '';
498 498
 							$group_id = !empty($default_group_id) ? $default_group_id : $wpshop_default_group->attribute_group_id;
499 499
 						}
500 500
 					}
501 501
 
502
-					if ( !empty($set_id) && !empty($group_id) ) {
502
+					if (!empty($set_id) && !empty($group_id)) {
503 503
 						$query = $wpdb->prepare(
504 504
 								"SELECT (MAX(position) + 1) AS position
505 505
 								FROM " . WPSHOP_DBT_ATTRIBUTE_DETAILS . "
@@ -511,12 +511,12 @@  discard block
 block discarded – undo
511 511
 								$attribute_parameter['entity_id']
512 512
 						);
513 513
 						$wpshopAttributePosition = $wpdb->get_var($query);
514
-						if($wpshopAttributePosition == 0)$wpshopAttributePosition = 1;
514
+						if ($wpshopAttributePosition == 0)$wpshopAttributePosition = 1;
515 515
 						$wpdb->insert(WPSHOP_DBT_ATTRIBUTE_DETAILS, array('status' => 'valid', 'creation_date' => current_time('mysql', 0), 'entity_type_id' => $attribute_parameter['entity_id'], 'attribute_set_id' => $set_id, 'attribute_group_id' => $group_id, 'attribute_id' => $id, 'position' => $wpshopAttributePosition));
516 516
 					}
517 517
 				}
518 518
 
519
-				if ( !empty($wpshop_attribute_combo_values_list_order_def) ) {
519
+				if (!empty($wpshop_attribute_combo_values_list_order_def)) {
520 520
 					$post_order = explode(',', $wpshop_attribute_combo_values_list_order_def);
521 521
 					$position = 1;
522 522
 					foreach ($post_order as $post_id) {
@@ -532,19 +532,19 @@  discard block
 block discarded – undo
532 532
 					wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=saveok&saveditem=" . $id));
533 533
 				}
534 534
 				else */
535
-				if ( $pageAction == 'add' )
535
+				if ($pageAction == 'add')
536 536
 					wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=edit&id=" . $id));
537
-				elseif ( $pageAction == 'delete' )
537
+				elseif ($pageAction == 'delete')
538 538
 					wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=deleteok&saveditem=" . $id));
539 539
 			}
540
-			elseif(($actionResult == 'userNotAllowedForActionEdit') || ($actionResult == 'userNotAllowedForActionAdd') || ($actionResult == 'userNotAllowedForActionDelete')){
540
+			elseif (($actionResult == 'userNotAllowedForActionEdit') || ($actionResult == 'userNotAllowedForActionAdd') || ($actionResult == 'userNotAllowedForActionDelete')) {
541 541
 				$pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . __('You are not allowed to do this action', 'wpshop');
542 542
 			}
543
-			elseif(($actionResult == 'unDeletableAtribute')){
543
+			elseif (($actionResult == 'unDeletableAtribute')) {
544 544
 				$pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . __('This attribute could not be deleted due to configuration', 'wpshop');
545 545
 			}
546 546
 
547
-			if(empty($attribute_parameter['frontend_label']) && ($pageAction!='delete')){
547
+			if (empty($attribute_parameter['frontend_label']) && ($pageAction != 'delete')) {
548 548
 				$pageMessage .= __('Please enter an label for the attribut', 'wpshop');
549 549
 			}
550 550
 		}
@@ -562,37 +562,37 @@  discard block
 block discarded – undo
562 562
 		//Create an instance of our package class...
563 563
 		$wpshop_list_table = new wpshop_attributes_custom_List_table();
564 564
 		//Fetch, prepare, sort, and filter our data...
565
-		$status="'valid'";
566
-		$attribute_status = !empty($_REQUEST['attribute_status']) ? sanitize_text_field( $_REQUEST['attribute_status'] ) : null;
567
-		$s = !empty($_REQUEST['s']) ? sanitize_text_field( $_REQUEST['s'] ) : null;
565
+		$status = "'valid'";
566
+		$attribute_status = !empty($_REQUEST['attribute_status']) ? sanitize_text_field($_REQUEST['attribute_status']) : null;
567
+		$s = !empty($_REQUEST['s']) ? sanitize_text_field($_REQUEST['s']) : null;
568 568
 		$order = !empty($_REQUEST['order']) ? sanitize_text_field($_REQUEST['order']) : null;
569 569
 		$orderby = !empty($_REQUEST['orderby']) ? sanitize_text_field($_REQUEST['orderby']) : null;
570
-		if(!empty($attribute_status)){
571
-			switch($attribute_status){
570
+		if (!empty($attribute_status)) {
571
+			switch ($attribute_status) {
572 572
 				case 'unactive':
573
-					$status="'moderated', 'notused'";
574
-					if(empty($order_by) && empty($order)){
573
+					$status = "'moderated', 'notused'";
574
+					if (empty($order_by) && empty($order)) {
575 575
 						// @TODO : REQUEST
576 576
 						// $_REQUEST['orderby']='status';
577 577
 						// $_REQUEST['order']='asc';
578 578
 					}
579 579
 					break;
580 580
 				default:
581
-					$status="'".sanitize_text_field($_REQUEST['attribute_status'])."'";
581
+					$status = "'" . sanitize_text_field($_REQUEST['attribute_status']) . "'";
582 582
 					break;
583 583
 			}
584 584
 		}
585
-		if ( !empty($s) ) {
586
-			$query = $wpdb->prepare("SELECT * FROM " . self::dbTable . ' WHERE frontend_label LIKE "%%%1$s%%" OR frontend_label LIKE "%%%2$s%%" AND backend_label LIKE "%%%1$s%%" OR backend_label LIKE "%%%2$s%%" AND code LIKE "%%%1$s%%" OR code LIKE "%%%2$s%%"', $s, __($s, 'wpshop') );
587
-			$attr_set_list = $wpdb->get_results( $query );
585
+		if (!empty($s)) {
586
+			$query = $wpdb->prepare("SELECT * FROM " . self::dbTable . ' WHERE frontend_label LIKE "%%%1$s%%" OR frontend_label LIKE "%%%2$s%%" AND backend_label LIKE "%%%1$s%%" OR backend_label LIKE "%%%2$s%%" AND code LIKE "%%%1$s%%" OR code LIKE "%%%2$s%%"', $s, __($s, 'wpshop'));
587
+			$attr_set_list = $wpdb->get_results($query);
588 588
 		}
589 589
 		else {
590
-			$attr_set_list = self::getElement( '', $status );
590
+			$attr_set_list = self::getElement('', $status);
591 591
 		}
592
-		$i=0;
593
-		$attribute_set_list=array();
594
-		foreach($attr_set_list as $attr_set){
595
-			if(!empty($attr_set->id) && ($attr_set->code != 'product_attribute_set_id') ){
592
+		$i = 0;
593
+		$attribute_set_list = array();
594
+		foreach ($attr_set_list as $attr_set) {
595
+			if (!empty($attr_set->id) && ($attr_set->code != 'product_attribute_set_id')) {
596 596
 				$attribute_set_list[$i]['id'] = $attr_set->id;
597 597
 				$attribute_set_list[$i]['name'] = $attr_set->frontend_label;
598 598
 				$attribute_set_list[$i]['status'] = $attr_set->status;
@@ -640,31 +640,31 @@  discard block
 block discarded – undo
640 640
 		global $attribute_displayed_field, $attribute_options_group;
641 641
 		$dbFieldList = wpshop_database::fields_to_input(self::getDbTable());
642 642
 		$editedItem = '';
643
-		if($itemToEdit != '')
643
+		if ($itemToEdit != '')
644 644
 			$editedItem = self::getElement($itemToEdit);
645 645
 
646 646
 		$the_form_content_hidden = $the_form_general_content = '';
647 647
 		$the_form_option_content_list = array();
648
-		foreach($dbFieldList as $input_key => $input_def){
648
+		foreach ($dbFieldList as $input_key => $input_def) {
649 649
 
650
-			if(!isset($attribute_displayed_field) || !is_array($attribute_displayed_field) || in_array($input_def['name'], $attribute_displayed_field)){
650
+			if (!isset($attribute_displayed_field) || !is_array($attribute_displayed_field) || in_array($input_def['name'], $attribute_displayed_field)) {
651 651
 				$input_def['label'] = $input_def['name'];
652
-				$input_def_id=$input_def['id']='wpshop_' . self::currentPageCode . '_edition_table_field_id_'.$input_def['label'];
652
+				$input_def_id = $input_def['id'] = 'wpshop_' . self::currentPageCode . '_edition_table_field_id_' . $input_def['label'];
653 653
 
654 654
 				$pageAction = isset($_REQUEST[self::getDbTable() . '_action']) ? sanitize_text_field($_REQUEST[self::getDbTable() . '_action']) : '';
655 655
 				$requestFormValue = isset($_REQUEST[self::currentPageCode][$input_def['label']]) ? sanitize_text_field($_REQUEST[self::currentPageCode][$input_def['label']]) : '';
656 656
 				$currentFieldValue = $input_def['value'];
657
-				if(is_object($editedItem))
657
+				if (is_object($editedItem))
658 658
 					$currentFieldValue = $editedItem->{$input_def['label']};
659
-				elseif(($pageAction != '') && ($requestFormValue != ''))
659
+				elseif (($pageAction != '') && ($requestFormValue != ''))
660 660
 					$currentFieldValue = $requestFormValue;
661 661
 
662
-				if($input_def['label'] == 'status'){
663
-					if(in_array('notused', $input_def['possible_value'])){
662
+				if ($input_def['label'] == 'status') {
663
+					if (in_array('notused', $input_def['possible_value'])) {
664 664
 						$key = array_keys($input_def['possible_value'], 'notused');
665 665
 						unset($input_def['possible_value'][$key[0]]);
666 666
 					}
667
-					if(in_array('dbl', $input_def['possible_value'])){
667
+					if (in_array('dbl', $input_def['possible_value'])) {
668 668
 						$key = array_keys($input_def['possible_value'], 'dbl');
669 669
 						unset($input_def['possible_value'][$key[0]]);
670 670
 					}
@@ -672,94 +672,94 @@  discard block
 block discarded – undo
672 672
 					$input_def['type'] = 'checkbox';
673 673
 					$input_def['label'] = __('Use this attribute', 'wpshop');
674 674
 					$input_def['possible_value'] = array('valid');
675
-					$input_def_id.='_valid';
676
-					$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for using this attribute', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
675
+					$input_def_id .= '_valid';
676
+					$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for using this attribute', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
677 677
 				}
678 678
 
679
-				if ( (substr($input_def['label'], 0, 3) == 'is_') || ( $input_def['label'] == '_display_informations_about_value') ) {
679
+				if ((substr($input_def['label'], 0, 3) == 'is_') || ($input_def['label'] == '_display_informations_about_value')) {
680 680
 					$input_def['type'] = 'checkbox';
681 681
 					$input_def['possible_value'] = 'yes';
682 682
 				}
683
-				switch($input_def['label']){
683
+				switch ($input_def['label']) {
684 684
 					case 'is_requiring_unit':
685
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for using unit with this attribute', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
685
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for using unit with this attribute', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
686 686
 					break;
687 687
 					case 'is_visible_in_front':
688
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for displaying this attribute in shop', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
688
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for displaying this attribute in shop', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
689 689
 					break;
690 690
 					case 'is_visible_in_front_listing':
691
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for displaying this attribute in product listing in shop', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
691
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for displaying this attribute in product listing in shop', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
692 692
 					break;
693 693
 					case 'is_used_for_sort_by':
694
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for displaying this attribute into sortbar', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
694
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for displaying this attribute into sortbar', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
695 695
 					break;
696 696
 					case 'is_searchable':
697
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for including values of this attribute as search parameter', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
697
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for including values of this attribute as search parameter', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
698 698
 					break;
699 699
 					case 'is_visible_in_advanced_search':
700
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for using in advanced search form', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
700
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for using in advanced search form', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
701 701
 					break;
702 702
 					case 'frontend_css_class':
703
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Separate with a space each CSS Class', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
703
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Separate with a space each CSS Class', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
704 704
 					break;
705 705
 					case 'backend_css_class':
706
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Separate with a space each CSS Class', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
706
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Separate with a space each CSS Class', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
707 707
 					break;
708 708
 					case 'is_historisable':
709
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box if you want to save the different value this attribute, each time it is modified', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
709
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box if you want to save the different value this attribute, each time it is modified', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
710 710
 					break;
711 711
 					case 'is_filterable':
712
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box if you want to use this attribute in the filter search', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
712
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box if you want to use this attribute in the filter search', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
713 713
 					break;
714 714
 					case 'is_intrinsic':
715
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box if this attribute is intrinsic for a product', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
715
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box if this attribute is intrinsic for a product', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
716 716
 					break;
717 717
 					case 'is_used_for_variation':
718
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box if this attribute is used for variation. It means that the user would be able to choose a value in frontend', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
718
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box if this attribute is used for variation. It means that the user would be able to choose a value in frontend', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
719 719
 					break;
720 720
 					case 'is_used_in_variation':
721
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box if you want to use this attribute for variation definition', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
722
-						if ( !empty($editedItem) && ($editedItem->is_used_for_variation == 'yes') ) {
721
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box if you want to use this attribute for variation definition', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
722
+						if (!empty($editedItem) && ($editedItem->is_used_for_variation == 'yes')) {
723 723
 							$input_def['option'] = 'disabled="disabled"';
724 724
 						}
725 725
 					break;
726 726
 					case 'is_user_defined':
727
-						$input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box if you want your customer to choose a value for this attribute into frontend product', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
727
+						$input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box if you want your customer to choose a value for this attribute into frontend product', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
728 728
 					break;
729 729
 				}
730 730
 
731 731
 				$input_def['value'] = $currentFieldValue;
732
-				if($input_def['label'] == 'code')
732
+				if ($input_def['label'] == 'code')
733 733
 					$input_def['type'] = 'hidden';
734
-				elseif($input_def['label'] == 'entity_id'){
734
+				elseif ($input_def['label'] == 'entity_id') {
735 735
 					$input_def['possible_value'] = wpshop_entities::get_entities_list();
736 736
 					$input_def['valueToPut'] = 'index';
737 737
 					$input_def['type'] = 'select';
738 738
 
739
-					$i=0;
740
-					foreach($input_def['possible_value'] as $entity_id => $entity_name) {
741
-						if($i <= 0){
739
+					$i = 0;
740
+					foreach ($input_def['possible_value'] as $entity_id => $entity_name) {
741
+						if ($i <= 0) {
742 742
 							$current_entity_id = $entity_id;
743 743
 						}
744 744
 						$i++;
745 745
 					}
746 746
 				}
747
-				elseif($input_def['label'] == '_unit_group_id'){
747
+				elseif ($input_def['label'] == '_unit_group_id') {
748 748
 					$input_def['possible_value'] = wpshop_attributes_unit::get_unit_group();
749 749
 					$input_def['type'] = 'select';
750 750
 				}
751
-				elseif($input_def['label'] == '_default_unit'){
751
+				elseif ($input_def['label'] == '_default_unit') {
752 752
 					$unit_group_list = wpshop_attributes_unit::get_unit_group();
753
-					$input_def['possible_value'] = wpshop_attributes_unit::get_unit_list_for_group(!empty($editedItem->_unit_group_id)?$editedItem->_unit_group_id:(!empty($unit_group_list)?$unit_group_list[0]->id:''));
753
+					$input_def['possible_value'] = wpshop_attributes_unit::get_unit_list_for_group(!empty($editedItem->_unit_group_id) ? $editedItem->_unit_group_id : (!empty($unit_group_list) ? $unit_group_list[0]->id : ''));
754 754
 					$input_def['type'] = 'select';
755 755
 				}
756 756
 				elseif ($input_def['label'] == 'backend_input') {
757
-					if ( !is_object($editedItem) ) {
757
+					if (!is_object($editedItem)) {
758 758
 						$input_def['type'] = 'hidden';
759 759
 					}
760 760
 					else {
761 761
 						$new_possible_value = array();
762
-						switch ( $editedItem->data_type) {
762
+						switch ($editedItem->data_type) {
763 763
 							case 'integer':
764 764
 								$new_possible_value[__('Checkbox', 'wpshop')] = 'checkbox';
765 765
 								$new_possible_value[__('Radio button', 'wpshop')] = 'radio';
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 								$new_possible_value[__('multiple-select', 'wpshop')] = 'multiple-select';
768 768
 								break;
769 769
 							case 'varchar':
770
-								switch ( $input_def['value'] ) {
770
+								switch ($input_def['value']) {
771 771
 									case 'hidden':
772 772
 										$new_possible_value[__('Hidden field', 'wpshop')] = 'hidden_field';
773 773
 										break;
@@ -795,8 +795,8 @@  discard block
 block discarded – undo
795 795
 				elseif ($input_def['label'] == 'frontend_input') {
796 796
 					$new_possible_value = array();
797 797
 
798
-					if ( is_object($editedItem) ) {
799
-						switch ( $editedItem->data_type) {
798
+					if (is_object($editedItem)) {
799
+						switch ($editedItem->data_type) {
800 800
 							case 'integer':
801 801
 								$new_possible_value[__('Checkbox', 'wpshop')] = 'checkbox';
802 802
 								$new_possible_value[__('Radio button', 'wpshop')] = 'radio';
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 								$new_possible_value[__('multiple-select', 'wpshop')] = 'multiple-select';
805 805
 								break;
806 806
 							case 'varchar':
807
-									switch ( $input_def['value'] ) {
807
+									switch ($input_def['value']) {
808 808
 										case 'hidden':
809 809
 											$new_possible_value[__('Hidden field', 'wpshop')] = 'hidden_field';
810 810
 										break;
@@ -842,10 +842,10 @@  discard block
 block discarded – undo
842 842
 
843 843
 					$input_def['possible_value'] = $new_possible_value;
844 844
 
845
-					if ( !empty($editedItem->frontend_input) ) {
846
-						switch ( $editedItem->frontend_input ) {
845
+					if (!empty($editedItem->frontend_input)) {
846
+						switch ($editedItem->frontend_input) {
847 847
 							case 'text':
848
-								switch ( $editedItem->data_type ) {
848
+								switch ($editedItem->data_type) {
849 849
 									case 'varchar':
850 850
 										$input_def['value'] = 'short_text';
851 851
 									break;
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 					}
871 871
 				}
872 872
 
873
-				if(is_object($editedItem) && (($input_def['label'] == 'code') || ($input_def['label'] == 'data_type') || ($input_def['label'] == 'entity_id'))){
873
+				if (is_object($editedItem) && (($input_def['label'] == 'code') || ($input_def['label'] == 'data_type') || ($input_def['label'] == 'entity_id'))) {
874 874
 					// $input_def['type'] = 'hidden';
875 875
 					$input_def['option'] = ' disabled="disabled" ';
876 876
 					$the_form_content_hidden .= '<input type="hidden" name="' . self::getDbTable() . '[' . $input_def['name'] . ']" value="' . $input_def['value'] . '" />';
@@ -881,16 +881,16 @@  discard block
 block discarded – undo
881 881
 				$input_def['value'] = str_replace("\\", "", $input_def['value']);
882 882
 
883 883
 				$the_input = wpshop_form::check_input_type($input_def, self::getDbTable());
884
-				if ( $input_def['label'] == 'default_value' ) {
885
-					if ( !empty($editedItem->frontend_input) ) {
886
-						switch ( $editedItem->frontend_input ) {
884
+				if ($input_def['label'] == 'default_value') {
885
+					if (!empty($editedItem->frontend_input)) {
886
+						switch ($editedItem->frontend_input) {
887 887
 							case 'text':
888 888
 								$input_def['type'] = 'text';
889
-								switch ( $editedItem->data_type ) {
889
+								switch ($editedItem->data_type) {
890 890
 									case 'datetime':
891
-										$the_input = wpshop_attributes::attribute_type_date_config( unserialize($input_def['value']) );
891
+										$the_input = wpshop_attributes::attribute_type_date_config(unserialize($input_def['value']));
892 892
 
893
-										$input_def['label'] = __('Date field configuration','wpshop');
893
+										$input_def['label'] = __('Date field configuration', 'wpshop');
894 894
 									break;
895 895
 									default:
896 896
 										$the_input = wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE);
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 							case 'multiple-select':
908 908
 							case 'radio':
909 909
 							case 'checkbox':
910
-								$input_def['label'] = __('Options list for attribute','wpshop') . '
910
+								$input_def['label'] = __('Options list for attribute', 'wpshop') . '
911 911
 <div class="alignright wpshop_change_select_data_type" >
912 912
 	+' . __('Change data type for this attribute', 'wpshop') . '
913 913
 </div>';
@@ -921,50 +921,50 @@  discard block
 block discarded – undo
921 921
 						}
922 922
 					}
923 923
 					else {
924
-						$input_def['type']='text';
924
+						$input_def['type'] = 'text';
925 925
 						$the_input = wpshop_form::check_input_type($input_def, self::getDbTable());
926 926
 					}
927 927
 				}
928
-				if( $input_def['label'] == '_unit_group_id') {
928
+				if ($input_def['label'] == '_unit_group_id') {
929 929
 					$the_input .= '<div id="wpshop_loader_input_group_unit"></div>';
930
-					$the_input .= '<a class="button-primary" href="#wpshop_unit_group_list" id="wpshop_attribute_group_unit_manager_opener" data-nonce="' . wp_create_nonce( 'load_unit_interface' ) . '">'.__('Manage group unit', 'wpshop').'</a>';
930
+					$the_input .= '<a class="button-primary" href="#wpshop_unit_group_list" id="wpshop_attribute_group_unit_manager_opener" data-nonce="' . wp_create_nonce('load_unit_interface') . '">' . __('Manage group unit', 'wpshop') . '</a>';
931 931
 				}
932 932
 
933
-				if( $input_def['label'] == '_default_unit') {
933
+				if ($input_def['label'] == '_default_unit') {
934 934
 					$the_input .= '<div id="wpshop_loader_input_unit"></div>';
935
-					$the_input .= '<a class="button-primary" href="#wpshop_unit_list" id="wpshop_attribute_unit_manager_opener" data-nonce="' . wp_create_nonce( 'load_unit_interface' ) . '">'.__('Manage units', 'wpshop').'</a>';
935
+					$the_input .= '<a class="button-primary" href="#wpshop_unit_list" id="wpshop_attribute_unit_manager_opener" data-nonce="' . wp_create_nonce('load_unit_interface') . '">' . __('Manage units', 'wpshop') . '</a>';
936 936
 					$the_input .= '<input type="hidden" name="input_wpshop_load_attribute_unit_list" id="input_wpshop_load_attribute_unit_list" value="' . wp_create_nonce("wpshop_load_attribute_unit_list") . '" />';
937 937
 					$the_input .= '<div id="wpshop_attribute_unit_manager" title="' . __('Unit management', 'wpshop') . '" class="wpshopHide" ><div class="loading_picture_container" id="product_chooser_picture" ><img src="' . WPSHOP_LOADING_ICON . '" alt="loading..." /></div></div>';
938 938
 				}
939 939
 
940 940
 
941
-				if($input_def['type'] != 'hidden'){
942
-					if ( ($input_def['label'] == 'entity_id') && is_object($editedItem) ) {
941
+				if ($input_def['type'] != 'hidden') {
942
+					if (($input_def['label'] == 'entity_id') && is_object($editedItem)) {
943 943
 						$the_input .= '<br/><span class="wpshop_duplicate_attribute" >' . __('Duplicate this attribute to . another entity', 'wpshop') . '</span>';
944 944
 					}
945 945
 					$input = '
946
-		<tr class="wpshop_' . self::currentPageCode . '_edition_table_line wpshop_' . self::currentPageCode . '_edition_table_line_'.$input_def['name'].'" >
947
-			<td class="wpshop_' . self::currentPageCode . '_edition_table_cell wpshop_' . self::currentPageCode . '_edition_table_field_label wpshop_' . self::currentPageCode . '_edition_table_field_label_'.$input_def['name'].'" ><label for="'.$input_def_id.'" >' . __($input_def['label'], 'wpshop') . '</label></td>
948
-			<td class="wpshop_' . self::currentPageCode . '_edition_table_cell wpshop_' . self::currentPageCode . '_edition_table_field_input wpshop_' . self::currentPageCode . '_edition_table_field_input_'.$input_def['name'].'" >' . $the_input . '</td>
946
+		<tr class="wpshop_' . self::currentPageCode . '_edition_table_line wpshop_' . self::currentPageCode . '_edition_table_line_' . $input_def['name'] . '" >
947
+			<td class="wpshop_' . self::currentPageCode . '_edition_table_cell wpshop_' . self::currentPageCode . '_edition_table_field_label wpshop_' . self::currentPageCode . '_edition_table_field_label_' . $input_def['name'] . '" ><label for="' . $input_def_id . '" >' . __($input_def['label'], 'wpshop') . '</label></td>
948
+			<td class="wpshop_' . self::currentPageCode . '_edition_table_cell wpshop_' . self::currentPageCode . '_edition_table_field_input wpshop_' . self::currentPageCode . '_edition_table_field_input_' . $input_def['name'] . '" >' . $the_input . '</td>
949 949
 		</tr>';
950
-					if ( (substr($input_def['label'], 0, 3) == 'is_') || (substr($input_def['label'], 0, 1) == '_') || in_array($input_def['label'], unserialize( WPSHOP_ATTRIBUTE_DEF_COLUMN_INTO_OPTIONS )) )
950
+					if ((substr($input_def['label'], 0, 3) == 'is_') || (substr($input_def['label'], 0, 1) == '_') || in_array($input_def['label'], unserialize(WPSHOP_ATTRIBUTE_DEF_COLUMN_INTO_OPTIONS)))
951 951
 						$the_form_option_content_list[$input_def['label']] = $input;
952 952
 					else {
953 953
 						$the_form_general_content .= $input;
954
-						if ( ($input_def['label'] == 'frontend_input') && !is_object($editedItem) ) {
954
+						if (($input_def['label'] == 'frontend_input') && !is_object($editedItem)) {
955 955
 
956
-							$the_input = wpshop_attributes_set::get_attribute_set_complete_list($current_entity_id,  self::getDbTable(), self::currentPageCode);
956
+							$the_input = wpshop_attributes_set::get_attribute_set_complete_list($current_entity_id, self::getDbTable(), self::currentPageCode);
957 957
 
958 958
 							$input = '
959 959
 		<tr class="wpshop_' . self::currentPageCode . '_edition_table_line wpshop_' . self::currentPageCode . '_edition_table_line_set_section" >
960
-			<td class="wpshop_' . self::currentPageCode . '_edition_table_cell wpshop_' . self::currentPageCode . '_edition_table_field_label wpshop_' . self::currentPageCode . '_edition_table_field_label_set_section" ><label for="'.self::currentPageCode.'_set_section" >' . __('Affect this new attribute to the set section', 'wpshop') . '</label></td>
960
+			<td class="wpshop_' . self::currentPageCode . '_edition_table_cell wpshop_' . self::currentPageCode . '_edition_table_field_label wpshop_' . self::currentPageCode . '_edition_table_field_label_set_section" ><label for="' . self::currentPageCode . '_set_section" >' . __('Affect this new attribute to the set section', 'wpshop') . '</label></td>
961 961
 			<td class="wpshop_' . self::currentPageCode . '_edition_table_cell wpshop_' . self::currentPageCode . '_edition_table_field_input wpshop_' . self::currentPageCode . '_edition_table_field_input_set_section" >' . $the_input . '</td>
962 962
 		</tr>';
963 963
 							$the_form_general_content .= $input;
964 964
 						}
965 965
 					}
966 966
 				}
967
-				else{
967
+				else {
968 968
 					$the_form_content_hidden .= '
969 969
 				' . $the_input;
970 970
 				}
@@ -980,17 +980,17 @@  discard block
 block discarded – undo
980 980
 		$section_content = $the_form_general_content;
981 981
 
982 982
 		ob_start();
983
-		include(WPSHOP_TEMPLATES_DIR.'admin/admin_box_section.tpl.php');
983
+		include(WPSHOP_TEMPLATES_DIR . 'admin/admin_box_section.tpl.php');
984 984
 		$the_form_general_content = ob_get_contents();
985 985
 		ob_end_clean();
986 986
 
987 987
 		/** It is attribute TVA, add a button to calcilate price in mass **/
988
-		if ( !empty($editedItem) && !empty($editedItem->code) && $editedItem->code == 'tx_tva' ) {
989
-			$the_form_general_content .= '<input type="button" data-nonce="' . wp_create_nonce( 'wps_update_products_prices' ) . '" id="wps_update_price_infos" value="' .__('Update all products price', 'wpshop').'" /> <img src="' .WPSHOP_LOADING_ICON. '" alt="" id="update_products_loader" /> <br/>';
990
-			$the_form_general_content .= __('If you have updated your VAT rates, save it and update your products price after', 'wpshop' );
988
+		if (!empty($editedItem) && !empty($editedItem->code) && $editedItem->code == 'tx_tva') {
989
+			$the_form_general_content .= '<input type="button" data-nonce="' . wp_create_nonce('wps_update_products_prices') . '" id="wps_update_price_infos" value="' . __('Update all products price', 'wpshop') . '" /> <img src="' . WPSHOP_LOADING_ICON . '" alt="" id="update_products_loader" /> <br/>';
990
+			$the_form_general_content .= __('If you have updated your VAT rates, save it and update your products price after', 'wpshop');
991 991
 		}
992 992
 		if (!empty($the_form_option_content_list)) {
993
-			$the_form_option_content_section='';
993
+			$the_form_option_content_section = '';
994 994
 			foreach ($attribute_options_group as $group_name => $group_content) {
995 995
 				$section_content = '';
996 996
 				foreach ($group_content as $group_code) {
@@ -999,23 +999,23 @@  discard block
 block discarded – undo
999 999
 						unset($the_form_option_content_list[$group_code]);
1000 1000
 					}
1001 1001
 				}
1002
-				$section_legend = __($group_name,'wpshop');
1002
+				$section_legend = __($group_name, 'wpshop');
1003 1003
 				$section_page_code = self::currentPageCode;
1004 1004
 
1005 1005
 				ob_start();
1006
-				include(WPSHOP_TEMPLATES_DIR.'admin/admin_box_section.tpl.php');
1006
+				include(WPSHOP_TEMPLATES_DIR . 'admin/admin_box_section.tpl.php');
1007 1007
 				$the_form_option_content_section .= ob_get_contents();
1008 1008
 				ob_end_clean();
1009 1009
 			}
1010 1010
 
1011 1011
 			/*	Check there are other attributes to display not in defined group	*/
1012 1012
 			if (!empty($the_form_option_content_list)) {
1013
-				$section_legend = __('General options','wpshop');
1013
+				$section_legend = __('General options', 'wpshop');
1014 1014
 				$section_content = implode('', $the_form_option_content_list);
1015 1015
 				$section_page_code = self::currentPageCode;
1016 1016
 
1017 1017
 				ob_start();
1018
-				include(WPSHOP_TEMPLATES_DIR.'admin/admin_box_section.tpl.php');
1018
+				include(WPSHOP_TEMPLATES_DIR . 'admin/admin_box_section.tpl.php');
1019 1019
 				$the_form_option_content = ob_get_contents();
1020 1020
 				ob_end_clean();
1021 1021
 
@@ -1025,17 +1025,17 @@  discard block
 block discarded – undo
1025 1025
 		}
1026 1026
 
1027 1027
 		/*	Default content for the current page	*/
1028
-		$bloc_list[self::currentPageCode]['main_info']['title']=__('Main informations', 'wpshop');
1028
+		$bloc_list[self::currentPageCode]['main_info']['title'] = __('Main informations', 'wpshop');
1029 1029
 		$bloc_list[self::currentPageCode]['main_info']['content'] = $the_form_general_content;
1030 1030
 
1031
-		$bloc_list[self::currentPageCode]['options']['title']=__('Options', 'wpshop');
1032
-		$bloc_list[self::currentPageCode]['options']['content']=$the_form_option_content;
1031
+		$bloc_list[self::currentPageCode]['options']['title'] = __('Options', 'wpshop');
1032
+		$bloc_list[self::currentPageCode]['options']['content'] = $the_form_option_content;
1033 1033
 
1034
-		$action = !empty( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action' ] ) : '';
1034
+		$action = !empty($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
1035 1035
 		$the_form = '
1036 1036
 <form name="' . self::getDbTable() . '_form" id="' . self::getDbTable() . '_form" method="post" action="#" >
1037
-	' . wpshop_form::form_input(self::getDbTable() . '_action', self::getDbTable() . '_action', (isset($action) && ($action != '') ? sanitize_text_field($action) : 'save') , 'hidden') . '
1038
-	' . wpshop_form::form_input(self::currentPageCode . '_form_has_modification', self::currentPageCode . '_form_has_modification', 'no' , 'hidden') . $the_form_content_hidden . wpshop_display::custom_page_output_builder($bloc_list, WPSHOP_ATTRIBUTE_EDITION_PAGE_LAYOUT) . '
1037
+	' . wpshop_form::form_input(self::getDbTable() . '_action', self::getDbTable() . '_action', (isset($action) && ($action != '') ? sanitize_text_field($action) : 'save'), 'hidden') . '
1038
+	' . wpshop_form::form_input(self::currentPageCode . '_form_has_modification', self::currentPageCode . '_form_has_modification', 'no', 'hidden') . $the_form_content_hidden . wpshop_display::custom_page_output_builder($bloc_list, WPSHOP_ATTRIBUTE_EDITION_PAGE_LAYOUT) . '
1039 1039
 </form>
1040 1040
 <div title="' . __('Change data type for selected attribute', 'wpshop') . '" id="wpshop_dialog_change_select_data_type" ><div id="wpshop_dialog_change_select_data_type_container" ></div></div>';
1041 1041
 		$input_def['possible_value'] = wpshop_entities::get_entities_list();
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
 		$the_form .= '
1054 1054
 <script type="text/javascript" >
1055 1055
 	wpshop(document).ready(function(){
1056
-		wpshopMainInterface("'.self::getDbTable().'", "' . __('Are you sure you want to quit this page? You will loose all current modification', 'wpshop') . '", "' . __('Are you sure you want to delete this attributes group?', 'wpshop') . '");
1056
+		wpshopMainInterface("'.self::getDbTable() . '", "' . __('Are you sure you want to quit this page? You will loose all current modification', 'wpshop') . '", "' . __('Are you sure you want to delete this attributes group?', 'wpshop') . '");
1057 1057
 
1058 1058
 		jQuery("#wpshop_dialog_duplicate_attribute").dialog({
1059 1059
 			autoOpen: false,
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 			dialogClass: "wpshop_uidialog_box",
1064 1064
 			resizable: false,
1065 1065
 			buttons:{
1066
-				"'.__('Duplicate', 'wpshop').'": function(){
1066
+				"'.__('Duplicate', 'wpshop') . '": function(){
1067 1067
 					var data = {
1068 1068
 						action: "wpshop_duplicate_attribute",
1069 1069
 						wpshop_ajax_nonce: "' . wp_create_nonce("wpshop_duplicate_attribute") . '",
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 						}
1080 1080
 					}, "json");
1081 1081
 				},
1082
-				"'.__('Cancel', 'wpshop').'": function(){
1082
+				"'.__('Cancel', 'wpshop') . '": function(){
1083 1083
 					jQuery(this).dialog("close");
1084 1084
 					jQuery(".wpshop_duplicate_attribute_result").remove();
1085 1085
 				}
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 			dialogClass: "wpshop_uidialog_box",
1098 1098
 			resizable: false,
1099 1099
 			buttons:{
1100
-				"'.__('Change type', 'wpshop').'": function(){
1100
+				"'.__('Change type', 'wpshop') . '": function(){
1101 1101
 					var delete_entity = false;
1102 1102
 					if(jQuery("#delete_entity").is(":checked")){
1103 1103
 						var delete_entity = true;
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 						jQuery("#wpshop_dialog_change_select_data_type").dialog("close");
1121 1121
 					}, "json");
1122 1122
 				},
1123
-				"'.__('Cancel', 'wpshop').'": function(){
1123
+				"'.__('Cancel', 'wpshop') . '": function(){
1124 1124
 					jQuery(this).dialog("close");
1125 1125
 				}
1126 1126
 			}
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 			change_unit_list();
1161 1161
 		});';
1162 1162
 
1163
-		if ( !is_object($editedItem) )  {
1163
+		if (!is_object($editedItem)) {
1164 1164
 			$the_form .= '
1165 1165
 		jQuery("#wpshop_attributes_edition_table_field_id_frontend_input").change(function(){
1166 1166
 			jQuery(".wpshop_attributes_edition_table_field_input_default_value").html(jQuery("#wpshopLoadingPicture").html());
@@ -1243,23 +1243,23 @@  discard block
 block discarded – undo
1243 1243
 	 *
1244 1244
 	 *	@return string $currentPageButton The html output code with the different button to add to the interface
1245 1245
 	 */
1246
-	function getPageFormButton($element_id = 0){
1246
+	function getPageFormButton($element_id = 0) {
1247 1247
 		$action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : 'add';
1248 1248
 		$currentPageButton = '';
1249 1249
 
1250 1250
 		 //$currentPageButton .= '<h2 class="cancelButton alignleft" ><a href="' . admin_url('edit.php?post_type='.WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES.'&amp;page=' . self::getListingSlug()) . '" class="button add-new-h2" >' . __('Back', 'wpshop') . '</a></h2>';
1251 1251
 
1252
-		if(($action == 'add') && (current_user_can('wpshop_add_attributes')))
1252
+		if (($action == 'add') && (current_user_can('wpshop_add_attributes')))
1253 1253
 			$currentPageButton .= '<input type="button" class="button-primary" id="add" name="add" value="' . __('Add', 'wpshop') . '" />';
1254 1254
 
1255
-		elseif(current_user_can('wpshop_edit_attributes'))
1255
+		elseif (current_user_can('wpshop_edit_attributes'))
1256 1256
 		$currentPageButton .= '<input type="button" class="button-primary" id="save" name="save" value="' . __('Save', 'wpshop') . '" />';
1257 1257
 
1258 1258
 		$attribute_undeletable = unserialize(WPSHOP_ATTRIBUTE_UNDELETABLE);
1259 1259
 		$attribute = self::getElement($element_id, "'valid', 'moderated', 'notused'", 'id');
1260
-		$attribute_code = !empty($attribute->code)?$attribute->code:'';
1261
-		if(current_user_can('wpshop_delete_attributes') && ($action != 'add') && !in_array($attribute_code, $attribute_undeletable))
1262
-			$currentPageButton .= '<input type="button" class="button-secondary wpshop_delete_element_button wpshop_delete_element_button_'.self::currentPageCode.'" id="delete" name="delete" value="' . __('Delete', 'wpshop') . '" />';
1260
+		$attribute_code = !empty($attribute->code) ? $attribute->code : '';
1261
+		if (current_user_can('wpshop_delete_attributes') && ($action != 'add') && !in_array($attribute_code, $attribute_undeletable))
1262
+			$currentPageButton .= '<input type="button" class="button-secondary wpshop_delete_element_button wpshop_delete_element_button_' . self::currentPageCode . '" id="delete" name="delete" value="' . __('Delete', 'wpshop') . '" />';
1263 1263
 
1264 1264
 		return $currentPageButton;
1265 1265
 	}
@@ -1273,22 +1273,22 @@  discard block
 block discarded – undo
1273 1273
 	 *
1274 1274
 	 *	@return object $element_list A wordpress database object containing the attribute list
1275 1275
 	 */
1276
-	public static function getElement($element_id = '', $element_status = "'valid', 'moderated', 'notused'", $field_to_search = 'id', $list = false){
1276
+	public static function getElement($element_id = '', $element_status = "'valid', 'moderated', 'notused'", $field_to_search = 'id', $list = false) {
1277 1277
 
1278 1278
 		global $wpdb;
1279 1279
 		$element_list = array();
1280 1280
 		$moreQuery = "";
1281
-		$moreArgs = array( 1, );
1281
+		$moreArgs = array(1,);
1282 1282
 
1283
-		$orderby = !empty( $_REQUEST['orderby'] ) ? sanitize_text_field( $_REQUEST['orderby'] ) : '';
1284
-		$order = !empty( $_REQUEST['order'] ) ? sanitize_text_field( $_REQUEST['order'] ) : '';
1283
+		$orderby = !empty($_REQUEST['orderby']) ? sanitize_text_field($_REQUEST['orderby']) : '';
1284
+		$order = !empty($_REQUEST['order']) ? sanitize_text_field($_REQUEST['order']) : '';
1285 1285
 
1286
-		if($element_id != ''){
1286
+		if ($element_id != '') {
1287 1287
 			$moreQuery .= "
1288 1288
 					AND CURRENT_ELEMENT." . $field_to_search . " = %s ";
1289 1289
 			$moreArgs[] = $element_id;
1290 1290
 		}
1291
-		if(!empty($orderby) && !empty($order)){
1291
+		if (!empty($orderby) && !empty($order)) {
1292 1292
 			$moreQuery .= "
1293 1293
 					ORDER BY " . $orderby . "  " . $order;
1294 1294
 		}
@@ -1297,15 +1297,15 @@  discard block
 block discarded – undo
1297 1297
 			"SELECT CURRENT_ELEMENT.*, ENTITIES.post_name as entity
1298 1298
 			FROM " . self::getDbTable() . " AS CURRENT_ELEMENT
1299 1299
 			INNER JOIN {$wpdb->posts} AS ENTITIES ON (ENTITIES.ID = CURRENT_ELEMENT.entity_id)
1300
-			WHERE %d AND CURRENT_ELEMENT.status IN (".$element_status.") " . $moreQuery,
1300
+			WHERE %d AND CURRENT_ELEMENT.status IN (" . $element_status . ") " . $moreQuery,
1301 1301
 			$moreArgs
1302 1302
 		);
1303 1303
 
1304 1304
 		/*	Get the query result regarding on the function parameters. If there must be only one result or a collection	*/
1305
-		if(($element_id == '') || $list){
1305
+		if (($element_id == '') || $list) {
1306 1306
 			$element_list = $wpdb->get_results($query);
1307 1307
 		}
1308
-		else{
1308
+		else {
1309 1309
 			$element_list = $wpdb->get_row($query);
1310 1310
 		}
1311 1311
 
@@ -1327,8 +1327,8 @@  discard block
 block discarded – undo
1327 1327
 		$user_id = function_exists('is_user_logged_in') && is_user_logged_in() ? get_current_user_id() : '0';
1328 1328
 		$sent_attribute_list = array();
1329 1329
 
1330
-		if ( !empty($attributeToSet) ) {
1331
-			$attributeToSet = apply_filters( 'save_attribute_for_entity', $attributeToSet, $entityTypeId, $entityId );
1330
+		if (!empty($attributeToSet)) {
1331
+			$attributeToSet = apply_filters('save_attribute_for_entity', $attributeToSet, $entityTypeId, $entityId);
1332 1332
 			$old_attribute_to_set = $attributeToSet;
1333 1333
 			$attribute_setted = array();
1334 1334
 			foreach ($attributeToSet as $attributeType => $attributeTypeDetails) {
@@ -1337,39 +1337,39 @@  discard block
 block discarded – undo
1337 1337
 					'entity_id' => $entityId,
1338 1338
 					'entity_type_id' => $entityTypeId
1339 1339
 				);
1340
-				if ( WPSHOP_ATTRIBUTE_VALUE_PER_USER ) {
1340
+				if (WPSHOP_ATTRIBUTE_VALUE_PER_USER) {
1341 1341
 					$delete_current_attribute_values_params['user_id'] = $user_id;
1342 1342
 				}
1343 1343
 
1344
-				if(!empty($attributeTypeDetails) && is_array($attributeTypeDetails)) {
1345
-					$attributeTypeDetails = apply_filters( "save_attribute_for_entity_{$attributeType}", $attributeTypeDetails, $entityTypeId, $entityId );
1346
-					foreach($attributeTypeDetails as $attribute_code => $attributeValue) {
1347
-						$attributeValue = apply_filters( "save_attribute_for_entity_{$attributeType}_{$attribute_code}", apply_filters( "save_attribute_for_entity__{$attribute_code}", $attributeValue, $entityTypeId, $entityId ), $entityTypeId, $entityId );
1344
+				if (!empty($attributeTypeDetails) && is_array($attributeTypeDetails)) {
1345
+					$attributeTypeDetails = apply_filters("save_attribute_for_entity_{$attributeType}", $attributeTypeDetails, $entityTypeId, $entityId);
1346
+					foreach ($attributeTypeDetails as $attribute_code => $attributeValue) {
1347
+						$attributeValue = apply_filters("save_attribute_for_entity_{$attributeType}_{$attribute_code}", apply_filters("save_attribute_for_entity__{$attribute_code}", $attributeValue, $entityTypeId, $entityId), $entityTypeId, $entityId);
1348 1348
 						$old_attribute_value = $attributeValue;
1349 1349
 
1350
-						if ( $attributeType == 'decimal' ) {
1350
+						if ($attributeType == 'decimal') {
1351 1351
 							$attributeValue = str_replace(',', '.', $attributeValue);
1352 1352
 						}
1353
-						if ( ($attributeType == 'integer') && !is_array($attributeValue) ) {
1353
+						if (($attributeType == 'integer') && !is_array($attributeValue)) {
1354 1354
 							$attributeValue = (int)$attributeValue;
1355 1355
 						}
1356 1356
 						$more_query_params_values = array();
1357
-						if($attribute_code != 'unit') {
1357
+						if ($attribute_code != 'unit') {
1358 1358
 
1359 1359
 							$unit_id = 0;
1360
-							if(isset($attributeTypeDetails['unit'][$attribute_code])){
1360
+							if (isset($attributeTypeDetails['unit'][$attribute_code])) {
1361 1361
 								$unit_id = $attributeTypeDetails['unit'][$attribute_code];
1362 1362
 							}
1363 1363
 
1364 1364
 							$currentAttribute = self::getElement($attribute_code, "'valid'", 'code');
1365
-							if( !empty($currentAttribute) ){
1365
+							if (!empty($currentAttribute)) {
1366 1366
 								$sent_attribute_list[] = $currentAttribute->id;
1367 1367
 
1368 1368
 								/*	Enregistrement de la valeur actuelle de l'attribut dans la table d'historique si l'option historique est activee sur l'attribut courant	*/
1369
-								if (  $currentAttribute->is_historisable == 'yes') {
1369
+								if ($currentAttribute->is_historisable == 'yes') {
1370 1370
 									$query = $wpdb->prepare("SELECT * FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attributeType . " WHERE entity_type_id = %d AND attribute_id = %d AND entity_id = %d", $entityTypeId, $currentAttribute->id, $entityId);
1371 1371
 									$attribute_histo = $wpdb->get_results($query);
1372
-									if(!empty($attribute_histo)){
1372
+									if (!empty($attribute_histo)) {
1373 1373
 										$attribute_histo_content['status'] = 'valid';
1374 1374
 										$attribute_histo_content['creation_date'] = current_time('mysql', 0);
1375 1375
 										$attribute_histo_content['creation_date_value'] = $attribute_histo[0]->creation_date_value;
@@ -1387,8 +1387,8 @@  discard block
 block discarded – undo
1387 1387
 								}
1388 1388
 								$attributeValue = str_replace("\\", "", $attributeValue);
1389 1389
 
1390
-								if ( empty($from) || (!empty($attributeValue)) ) {
1391
-									$wpdb->delete(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($delete_current_attribute_values_params, array('attribute_id' => $currentAttribute->id)));
1390
+								if (empty($from) || (!empty($attributeValue))) {
1391
+									$wpdb->delete(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attributeType, array_merge($delete_current_attribute_values_params, array('attribute_id' => $currentAttribute->id)));
1392 1392
 
1393 1393
 									/**	Insertion de la nouvelle valeur de l'attribut dans la base	*/
1394 1394
 									$query_params = array(
@@ -1402,66 +1402,66 @@  discard block
 block discarded – undo
1402 1402
 										'creation_date_value' => current_time('mysql', 0)
1403 1403
 									);
1404 1404
 									/**	Si l'attribut courant est contenu dans un tableau (exemple: select multiple) on lit tout le tableau et on enregistre chaque valeur separement	*/
1405
-									if(is_array($attributeValue)){
1406
-										foreach($attributeValue as $a){
1407
-											$wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($query_params, array('value' => $a)));
1405
+									if (is_array($attributeValue)) {
1406
+										foreach ($attributeValue as $a) {
1407
+											$wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attributeType, array_merge($query_params, array('value' => $a)));
1408 1408
 										}
1409 1409
 									}
1410
-									else{
1411
-										$wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($query_params, array('value' => $attributeValue)));
1412
-										wpeologs_ctr::log_datas_in_files( 'wpshop_attributes', array(
1410
+									else {
1411
+										$wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attributeType, array_merge($query_params, array('value' => $attributeValue)));
1412
+										wpeologs_ctr::log_datas_in_files('wpshop_attributes', array(
1413 1413
 											'object_id' 	=> $entityId,
1414
-											'message' 		=> __( 'Add the attribute : ' . $currentAttribute->code . ' with value : ' . $attributeValue , 'wpshop' ) ), 0
1414
+											'message' 		=> __('Add the attribute : ' . $currentAttribute->code . ' with value : ' . $attributeValue, 'wpshop') ), 0
1415 1415
 										);
1416 1416
 									}
1417 1417
 
1418 1418
 									/**	Dans le cas ou l'attribut courant est utilise dans l'interface permettant de trier les produits (option de l'attribut) on defini une meta specifique	*/
1419
-									if ( ( ($currentAttribute->is_used_for_sort_by == 'yes') || ($currentAttribute->is_searchable == 'yes'))  || ( $currentAttribute->is_filterable == 'yes') && !empty($attributeValue) ) :
1420
-										update_post_meta($entityId, '_'.$attribute_code, $attributeValue);
1419
+									if ((($currentAttribute->is_used_for_sort_by == 'yes') || ($currentAttribute->is_searchable == 'yes')) || ($currentAttribute->is_filterable == 'yes') && !empty($attributeValue)) :
1420
+										update_post_meta($entityId, '_' . $attribute_code, $attributeValue);
1421 1421
 									endif;
1422 1422
 
1423 1423
 									/**	Enregistrement de toutes les valeurs des attributs dans une meta du produit	*/
1424
-									$attribute_option = (!empty($_POST['attribute_option'][$attribute_code])) ? (array) $_POST['attribute_option'][$attribute_code] : null;
1424
+									$attribute_option = (!empty($_POST['attribute_option'][$attribute_code])) ? (array)$_POST['attribute_option'][$attribute_code] : null;
1425 1425
 									if (isset($attribute_option)) {
1426 1426
 										$value = self::get_attribute_type_select_option_info($attributeTypeDetails[$attribute_code], 'value');
1427 1427
 										if (strtolower($value) == 'yes') :
1428
-											update_post_meta($entityId, 'attribute_option_'.$attribute_code, $attribute_option);
1428
+											update_post_meta($entityId, 'attribute_option_' . $attribute_code, $attribute_option);
1429 1429
 										else :
1430
-											delete_post_meta($entityId, 'attribute_option_'.$attribute_code);
1430
+											delete_post_meta($entityId, 'attribute_option_' . $attribute_code);
1431 1431
 										endif;
1432 1432
 									}
1433 1433
 								}
1434 1434
 							}
1435 1435
 						}
1436
-						do_action( "saved_attribute_for_entity_{$attributeType}_{$attribute_code}", $attributeValue, $old_attribute_value, $entityTypeId, $entityId );
1437
-						do_action( "saved_attribute_for_entity__{$attribute_code}", $attributeValue, $old_attribute_value, $entityTypeId, $entityId );
1438
-						if ( isset( $attribute_setted[$attributeType][$attribute_code] ) ) {
1439
-							if( is_array( $attribute_setted[$attributeType][$attribute_code] )) {
1436
+						do_action("saved_attribute_for_entity_{$attributeType}_{$attribute_code}", $attributeValue, $old_attribute_value, $entityTypeId, $entityId);
1437
+						do_action("saved_attribute_for_entity__{$attribute_code}", $attributeValue, $old_attribute_value, $entityTypeId, $entityId);
1438
+						if (isset($attribute_setted[$attributeType][$attribute_code])) {
1439
+							if (is_array($attribute_setted[$attributeType][$attribute_code])) {
1440 1440
 								$attribute_setted[$attributeType][$attribute_code][] = $attributeValue;
1441 1441
 							} else {
1442
-								$attribute_setted[$attributeType][$attribute_code] = array( $attribute_setted[$attributeType][$attribute_code], $attributeValue );
1442
+								$attribute_setted[$attributeType][$attribute_code] = array($attribute_setted[$attributeType][$attribute_code], $attributeValue);
1443 1443
 							}
1444 1444
 						} else {
1445 1445
 							$attribute_setted[$attributeType][$attribute_code] = $attributeValue;
1446 1446
 						}
1447 1447
 					}
1448 1448
 
1449
-					if ( empty($from) ) {
1450
-						$query = $wpdb->prepare("SELECT value_id FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType . " WHERE attribute_id NOT IN ('" . implode("', '", $sent_attribute_list) . "') AND entity_id = %d AND entity_type_id = %d", $entityId, $entityTypeId);
1449
+					if (empty($from)) {
1450
+						$query = $wpdb->prepare("SELECT value_id FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attributeType . " WHERE attribute_id NOT IN ('" . implode("', '", $sent_attribute_list) . "') AND entity_id = %d AND entity_type_id = %d", $entityId, $entityTypeId);
1451 1451
 						$attr_to_delete = $wpdb->get_results($query);
1452
-						if(!empty($attr_to_delete)){
1452
+						if (!empty($attr_to_delete)) {
1453 1453
 							foreach ($attr_to_delete as $value) {
1454
-								$wpdb->delete(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($delete_current_attribute_values_params, array('value_id' => $value->value_id)));
1455
-								wpeologs_ctr::log_datas_in_files( 'wpshop_attributes', array(
1454
+								$wpdb->delete(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attributeType, array_merge($delete_current_attribute_values_params, array('value_id' => $value->value_id)));
1455
+								wpeologs_ctr::log_datas_in_files('wpshop_attributes', array(
1456 1456
 									'object_id' 	=> $entityId,
1457
-									'message' 		=> __( 'Remove the attribute : ' . $value->value_id, 'wpshop' ) ), 0
1457
+									'message' 		=> __('Remove the attribute : ' . $value->value_id, 'wpshop') ), 0
1458 1458
 								);
1459 1459
 							}
1460 1460
 						}
1461 1461
 					}
1462 1462
 				}
1463 1463
 			}
1464
-			do_action( "saved_attribute_for_entity", $attribute_setted, $old_attribute_to_set, $entityTypeId, $entityId );
1464
+			do_action("saved_attribute_for_entity", $attribute_setted, $old_attribute_to_set, $entityTypeId, $entityId);
1465 1465
 		}
1466 1466
 	}
1467 1467
 
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
 
1482 1482
 		$query_params = "";
1483 1483
 		$query_params_values = array($attributeId, $entityTypeId, $entityId);
1484
-		if(WPSHOP_ATTRIBUTE_VALUE_PER_USER && (isset($atribute_params['intrinsic']) && ($atribute_params['intrinsic'] != 'yes'))){
1484
+		if (WPSHOP_ATTRIBUTE_VALUE_PER_USER && (isset($atribute_params['intrinsic']) && ($atribute_params['intrinsic'] != 'yes'))) {
1485 1485
 			$query_params = "
1486 1486
 				AND ATTR_VAL.user_id = %d";
1487 1487
 			$query_params_values[] = get_current_user_id();
@@ -1497,20 +1497,20 @@  discard block
 block discarded – undo
1497 1497
 		);
1498 1498
 		$attributeValue = $wpdb->get_results($query);
1499 1499
 
1500
-		if ( ( (count($attributeValue) <= 1 ) && !empty($attributeValue[0]) ) && ( empty($atribute_params['frontend_input']) || ($atribute_params['frontend_input'] != 'multiple-select') )) {
1500
+		if (((count($attributeValue) <= 1) && !empty($attributeValue[0])) && (empty($atribute_params['frontend_input']) || ($atribute_params['frontend_input'] != 'multiple-select'))) {
1501 1501
 			$attributeValue = $attributeValue[0];
1502 1502
 		}
1503
-		else{
1503
+		else {
1504 1504
 			$entity_meta = get_post_meta($entityId, WPSHOP_PRODUCT_ATTRIBUTE_META_KEY, true);
1505
-			if ( !empty($entity_meta) ) {
1505
+			if (!empty($entity_meta)) {
1506 1506
 				$query = $wpdb->prepare("SELECT code FROM " . WPSHOP_DBT_ATTRIBUTE . " WHERE id = %d AND entity_id = %d ", $attributeId, $entityTypeId);
1507 1507
 				$attribute_code = $wpdb->get_var($query);
1508 1508
 				$attributeValue = !empty($entity_meta[$attribute_code]) ? $entity_meta[$attribute_code] : null;
1509 1509
 			}
1510
-			if ( is_array($attributeValue) ) {
1510
+			if (is_array($attributeValue)) {
1511 1511
 				$tmp_array = array();
1512
-				if ( !empty($attributeValue) ) {
1513
-					foreach ( $attributeValue as $att ) {
1512
+				if (!empty($attributeValue)) {
1513
+					foreach ($attributeValue as $att) {
1514 1514
 						$obj = new stdClass();
1515 1515
 						$obj->value = $att;
1516 1516
 						$obj->unit_id = 0;
@@ -1541,9 +1541,9 @@  discard block
 block discarded – undo
1541 1541
 		$elements = array();
1542 1542
 		$elementsWithAttributeAndValues = self::get_attribute_list_for_item($entityId, $elementId, $language);
1543 1543
 
1544
-		foreach ( $elementsWithAttributeAndValues as $elementDefinition ) {
1544
+		foreach ($elementsWithAttributeAndValues as $elementDefinition) {
1545 1545
 			$arrayKey = $elementDefinition->attribute_id;
1546
-			if ( $keyForArray == 'code' ) {
1546
+			if ($keyForArray == 'code') {
1547 1547
 				$arrayKey = $elementDefinition->attribute_code;
1548 1548
 			}
1549 1549
 			$elements[$elementId][$elementDefinition->attribute_set_section_name]['code'] = $elementDefinition->attribute_set_section_code;
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
 			$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['backend_table'] = $elementDefinition->backend_table;
1554 1554
 			$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['backend_input'] = $elementDefinition->backend_input;
1555 1555
 			$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['frontend_input'] = $elementDefinition->frontend_input;
1556
-			$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['frontend_label'] = __( $elementDefinition->frontend_label, 'wpshop' );
1556
+			$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['frontend_label'] = __($elementDefinition->frontend_label, 'wpshop');
1557 1557
 			$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['attribute_code'] = $elementDefinition->attribute_code;
1558 1558
 			$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['data_type_to_use'] = $elementDefinition->data_type_to_use;
1559 1559
 			$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['is_visible_in_front'] = $elementDefinition->is_visible_in_front;
@@ -1563,29 +1563,29 @@  discard block
 block discarded – undo
1563 1563
 			$attributeValueField = 'attribute_value_' . $elementDefinition->data_type;
1564 1564
 
1565 1565
 			// Manage the value differently if it is an array or not
1566
-			if ( !empty($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value']) ) {
1566
+			if (!empty($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'])) {
1567 1567
 				if (is_array($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'])) {
1568 1568
 					$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'][] = $elementDefinition->$attributeValueField;
1569 1569
 				}
1570 1570
 				else {
1571
-					$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'] = array($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'],$elementDefinition->$attributeValueField);
1571
+					$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'] = array($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'], $elementDefinition->$attributeValueField);
1572 1572
 				}
1573 1573
 			}
1574 1574
 			else {
1575 1575
 				$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'] = $elementDefinition->$attributeValueField;
1576 1576
 			}
1577 1577
 
1578
-			if ( $elementDefinition->backend_input == 'multiple-select' ) {
1578
+			if ($elementDefinition->backend_input == 'multiple-select') {
1579 1579
 				$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['select_value'] = self::get_attribute_type_select_option_info($attributeValueField, 'value');
1580 1580
 			}
1581 1581
 
1582 1582
 			$attributeUnitField = 'attribute_unit_' . $elementDefinition->data_type;
1583
-			$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'] = __( $elementDefinition->$attributeUnitField, 'wpshop' );
1584
-			if( !empty($elementDefinition->is_requiring_unit ) && ( $elementDefinition->is_requiring_unit == 'yes' ) && empty( $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'] ) ) {
1583
+			$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'] = __($elementDefinition->$attributeUnitField, 'wpshop');
1584
+			if (!empty($elementDefinition->is_requiring_unit) && ($elementDefinition->is_requiring_unit == 'yes') && empty($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'])) {
1585 1585
 				$unit = '';
1586
-				$query = $wpdb->prepare( 'SELECT unit FROM '. WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id = %d AND status = %s', $elementDefinition->_default_unit, 'valid');
1587
-				$unit = $wpdb->get_var( $query );
1588
-				$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'] = __( $unit, 'wpshop' );
1586
+				$query = $wpdb->prepare('SELECT unit FROM ' . WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id = %d AND status = %s', $elementDefinition->_default_unit, 'valid');
1587
+				$unit = $wpdb->get_var($query);
1588
+				$elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'] = __($unit, 'wpshop');
1589 1589
 			}
1590 1590
 
1591 1591
 		}
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
 		$elementsWithAttributeAndValues = array();
1598 1598
 		$moreQuery = "";
1599 1599
 
1600
-		$entity_type = empty($defined_entity_type) ? get_post_type( $elementId ) : $defined_entity_type;
1600
+		$entity_type = empty($defined_entity_type) ? get_post_type($elementId) : $defined_entity_type;
1601 1601
 
1602 1602
 		$query = $wpdb->prepare(
1603 1603
 				"SELECT POST_META.*,
@@ -1646,23 +1646,23 @@  discard block
 block discarded – undo
1646 1646
 	 *
1647 1647
 	 * @return boolean The result to know if the element has to be displayed on frontend
1648 1648
 	 */
1649
-	public static function check_attribute_display( $attribute_main_config, $attribute_custom_config, $attribute_or_set, $attribute_code, $output_type) {
1650
-		if ( $attribute_main_config === 'yes' ) {
1649
+	public static function check_attribute_display($attribute_main_config, $attribute_custom_config, $attribute_or_set, $attribute_code, $output_type) {
1650
+		if ($attribute_main_config === 'yes') {
1651 1651
 			$attribute_output = true;
1652
-			if ( ( is_array($attribute_custom_config) && in_array($attribute_or_set, array('attribute', 'attribute_set_section', 'product_action_button')) && !empty($attribute_custom_config[$attribute_or_set]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) && $attribute_custom_config[$attribute_or_set][$attribute_code][$output_type] == 'yes' )
1653
-				 || empty($attribute_custom_config) ) {
1652
+			if ((is_array($attribute_custom_config) && in_array($attribute_or_set, array('attribute', 'attribute_set_section', 'product_action_button')) && !empty($attribute_custom_config[$attribute_or_set]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) && $attribute_custom_config[$attribute_or_set][$attribute_code][$output_type] == 'yes')
1653
+				 || empty($attribute_custom_config)) {
1654 1654
 				$attribute_output = true;
1655 1655
 			}
1656
-			else if ( empty($attribute_custom_config[$attribute_or_set][$attribute_code]) || empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) || (!empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) && ( $attribute_custom_config[$attribute_or_set][$attribute_code][$output_type] == 'no')) )  {
1656
+			else if (empty($attribute_custom_config[$attribute_or_set][$attribute_code]) || empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) || (!empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) && ($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type] == 'no'))) {
1657 1657
 				$attribute_output = false;
1658 1658
 			}
1659 1659
 		}
1660
-		elseif ( $attribute_main_config === 'no' ) {
1660
+		elseif ($attribute_main_config === 'no') {
1661 1661
 			$attribute_output = false;
1662
-			if ( empty($attribute_custom_config[$attribute_or_set]) || empty($attribute_custom_config[$attribute_or_set][$attribute_code]) ) {
1662
+			if (empty($attribute_custom_config[$attribute_or_set]) || empty($attribute_custom_config[$attribute_or_set][$attribute_code])) {
1663 1663
 				$attribute_output = false;
1664 1664
 			}
1665
-			else if ( !empty($attribute_custom_config) && !empty($attribute_custom_config[$attribute_or_set]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) && ( $attribute_custom_config[$attribute_or_set][$attribute_code][$output_type] == 'yes') )  {
1665
+			else if (!empty($attribute_custom_config) && !empty($attribute_custom_config[$attribute_or_set]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code]) && !empty($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type]) && ($attribute_custom_config[$attribute_or_set][$attribute_code][$output_type] == 'yes')) {
1666 1666
 				$attribute_output = true;
1667 1667
 			}
1668 1668
 		}
@@ -1679,22 +1679,22 @@  discard block
 block discarded – undo
1679 1679
 		global $wpdb;
1680 1680
 		global $wp_query;
1681 1681
 
1682
-		$attribute = self::getElement( $atts['attid'] );
1683
-		if(empty($atts['pid'])) $atts['pid'] = $wp_query->posts[0]->ID;
1684
-		$attribute_main_config = ( empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet') ) ? $attribute->is_visible_in_front : $attribute->is_visible_in_front_listing;
1685
-		$output_type = ( empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet') ) ? 'complete_sheet' : 'mini_output';
1682
+		$attribute = self::getElement($atts['attid']);
1683
+		if (empty($atts['pid'])) $atts['pid'] = $wp_query->posts[0]->ID;
1684
+		$attribute_main_config = (empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet')) ? $attribute->is_visible_in_front : $attribute->is_visible_in_front_listing;
1685
+		$output_type = (empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet')) ? 'complete_sheet' : 'mini_output';
1686 1686
 		$product_attribute_custom_config = get_post_meta($atts['pid'], WPSHOP_PRODUCT_FRONT_DISPLAY_CONF, true);
1687
-		$display_attribute_value = wpshop_attributes::check_attribute_display( $attribute_main_config, $product_attribute_custom_config, 'attribute', $attribute->code, $output_type);
1687
+		$display_attribute_value = wpshop_attributes::check_attribute_display($attribute_main_config, $product_attribute_custom_config, 'attribute', $attribute->code, $output_type);
1688 1688
 
1689
-		if ( !empty( $attribute->data_type ) ) {
1689
+		if (!empty($attribute->data_type)) {
1690 1690
 			$attributeDefinition['unit'] = '';
1691 1691
 
1692 1692
 			$has_value = false;
1693
-			$query = $wpdb->prepare("SELECT value FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attribute->data_type . " WHERE entity_id=%s AND attribute_id=%d", $atts['pid'], $atts['attid'] );
1694
-			if ( in_array($attribute->backend_input, array('multiple-select', 'checkbox')) ) {
1693
+			$query = $wpdb->prepare("SELECT value FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attribute->data_type . " WHERE entity_id=%s AND attribute_id=%d", $atts['pid'], $atts['attid']);
1694
+			if (in_array($attribute->backend_input, array('multiple-select', 'checkbox'))) {
1695 1695
 				$list_of_value = $wpdb->get_results($query);
1696
-				if ( !empty($list_of_value) ) {
1697
-					foreach ( $list_of_value as $value ) {
1696
+				if (!empty($list_of_value)) {
1697
+					foreach ($list_of_value as $value) {
1698 1698
 						$data[] = $value->value;
1699 1699
 					}
1700 1700
 					$has_value = true;
@@ -1702,10 +1702,10 @@  discard block
 block discarded – undo
1702 1702
 			}
1703 1703
 			else {
1704 1704
 				$data = $wpdb->get_var($query);
1705
-				if ( !empty($data) ) {
1705
+				if (!empty($data)) {
1706 1706
 					$has_value = true;
1707 1707
 				}
1708
-				elseif( !empty($attribute->default_value) ) {
1708
+				elseif (!empty($attribute->default_value)) {
1709 1709
 					$has_value = true;
1710 1710
 					$data = $attribute->default_value;
1711 1711
 				}
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 			$attributeDefinition['is_requiring_unit'] = $attribute->is_requiring_unit;
1718 1718
 			$attributeDefinition['backend_input'] = $attribute->backend_input;
1719 1719
 			$attributeDefinition['data_type_to_use'] = $attribute->data_type_to_use;
1720
-			$attribute_display = wpshop_attributes::wps_attribute_values_display( $attributeDefinition );
1720
+			$attribute_display = wpshop_attributes::wps_attribute_values_display($attributeDefinition);
1721 1721
 			$attribute_value = $attribute_display[0];
1722 1722
 			$attributeDefinition['value'] = $attribute_display[1];
1723 1723
 			$attribute_unit_list = $attribute_display[2];
@@ -1737,13 +1737,13 @@  discard block
 block discarded – undo
1737 1737
 	 * @param array $specific_argument Optionnal The different parameters used for filter output
1738 1738
 	 * @return array The definition for the field used to display an attribute
1739 1739
 	 */
1740
-	public static function get_attribute_field_definition( $attribute, $attribute_value = '', $specific_argument = array() ) {
1740
+	public static function get_attribute_field_definition($attribute, $attribute_value = '', $specific_argument = array()) {
1741 1741
 		global $wpdb;
1742 1742
 		$wpshop_price_attributes = unserialize(WPSHOP_ATTRIBUTE_PRICES);
1743 1743
 		$wpshop_weight_attributes = unserialize(WPSHOP_ATTRIBUTE_WEIGHT);
1744 1744
 		$input_def = array();
1745 1745
 		$input_def['option'] = $input_def['field_container_class'] = '';
1746
-		$attributeInputDomain = (!empty($specific_argument['field_custom_name_prefix']) || (!empty($specific_argument['field_custom_name_prefix']) && ($specific_argument['field_custom_name_prefix'] == 'empty')) ) ? $specific_argument['field_custom_name_prefix'] : ((!empty($specific_argument['page_code']) ? $specific_argument['page_code'] . '_' : '' ) . 'attribute[' . $attribute->data_type . ']');
1746
+		$attributeInputDomain = (!empty($specific_argument['field_custom_name_prefix']) || (!empty($specific_argument['field_custom_name_prefix']) && ($specific_argument['field_custom_name_prefix'] == 'empty'))) ? $specific_argument['field_custom_name_prefix'] : ((!empty($specific_argument['page_code']) ? $specific_argument['page_code'] . '_' : '') . 'attribute[' . $attribute->data_type . ']');
1747 1747
 		$input_def['input_domain'] = $attributeInputDomain;
1748 1748
 		$input_def['id'] = (!empty($specific_argument) && !empty($specific_argument['field_id']) ? $specific_argument['field_id'] . '_' : '') . 'attribute_' . $attribute->id;
1749 1749
 		$input_def['intrinsec'] = $attribute->is_intrinsic;
@@ -1763,26 +1763,26 @@  discard block
 block discarded – undo
1763 1763
 		$input_def['frontend_type'] = $attribute->frontend_input;
1764 1764
 		$input_def['is_used_in_quick_add_form'] = $attribute->is_used_in_quick_add_form;
1765 1765
 
1766
-		if ( !empty($attribute_value) && !is_object($attribute_value) ) {
1766
+		if (!empty($attribute_value) && !is_object($attribute_value)) {
1767 1767
 			$input_def['value'] = $attribute_value;
1768 1768
 		}
1769
-		else if ( !empty($attribute_value->value) ) {
1769
+		else if (!empty($attribute_value->value)) {
1770 1770
 			$input_def['value'] = stripslashes($attribute_value->value);
1771 1771
 		}
1772
-		else if ( !empty($specific_argument['element_identifier']) && empty($attribute_value) && (get_post_status($specific_argument['element_identifier']) != 'auto-draft') ) {
1772
+		else if (!empty($specific_argument['element_identifier']) && empty($attribute_value) && (get_post_status($specific_argument['element_identifier']) != 'auto-draft')) {
1773 1773
 			$input_def['value'] = '';
1774 1774
 		}
1775 1775
 
1776 1776
 		$input_def['options'] = '';
1777 1777
 		$input_more_class = !empty($specific_argument['input_class']) ? $specific_argument['input_class'] : '';
1778 1778
 		if ($attribute->data_type == 'datetime') {
1779
-			$date_config = unserialize( $attribute->default_value );
1779
+			$date_config = unserialize($attribute->default_value);
1780 1780
 			if ((($date_config['default_value'] == '') || ($date_config['default_value'] == 'date_of_current_day')) && ($date_config['default_value'] == 'date_of_current_day')) {
1781 1781
 				$input_def['value'] = date('Y-m-d');
1782 1782
 			}
1783 1783
 			else {
1784 1784
 				/**	Modification due to a message on eoxia forum: http://www.eoxia.com/forums/topic/bug-attribut-de-type-date-dans-fiche-produit-admin/	*/
1785
-				$input_def['value'] = !empty($attribute_value->value) && is_string($attribute_value->value) ? str_replace( " 00:00:00", "", $attribute_value->value ) : ( !empty($attribute_value) && is_string($attribute_value) ? str_replace( " 00:00:00", "", $attribute_value ) : '' );
1785
+				$input_def['value'] = !empty($attribute_value->value) && is_string($attribute_value->value) ? str_replace(" 00:00:00", "", $attribute_value->value) : (!empty($attribute_value) && is_string($attribute_value) ? str_replace(" 00:00:00", "", $attribute_value) : '');
1786 1786
 			}
1787 1787
 			$input_more_class .= ' wpshop_input_datetime ';
1788 1788
 			$field_script = '<script type="text/javascript" >
@@ -1795,31 +1795,31 @@  discard block
 block discarded – undo
1795 1795
 		wpshop("#' . $input_def['id'] . '").datepicker("option", "navigationAsDateFormat", true);
1796 1796
 		wpshop("#' . $input_def['id'] . '").val("' . str_replace(" 00:00:00", "", $input_def['value']) . '");';
1797 1797
 
1798
-			if ( !empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur']) ) {
1799
-				if ( !empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur']['minDate'][0]) ) {
1798
+			if (!empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur'])) {
1799
+				if (!empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur']['minDate'][0])) {
1800 1800
 					$field_script .= '
1801 1801
 		wpshop("#' . $input_def['id'] . '").datepicker("option", "minDate", "' . $date_config['field_options']['attribute_type_date_options_available_date_past_futur']['minDate'][0] . '");';
1802 1802
 				}
1803
-				if ( !empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur']['maxDate'][0]) ) {
1803
+				if (!empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur']['maxDate'][0])) {
1804 1804
 					$field_script .= '
1805 1805
 		wpshop("#' . $input_def['id'] . '").datepicker("option", "maxDate", "' . $date_config['field_options']['attribute_type_date_options_available_date_past_futur']['maxDate'][0] . '");';
1806 1806
 				}
1807 1807
 			}
1808 1808
 
1809 1809
 			$script_options = $script_options_params = array();
1810
-			if ( !empty($date_config['field_options']['attribute_type_date_options_day_to_show']) ) {
1810
+			if (!empty($date_config['field_options']['attribute_type_date_options_day_to_show'])) {
1811 1811
 				$day_to_show_list = '    ';
1812
-				foreach ( $date_config['field_options']['attribute_type_date_options_day_to_show'] as $day_to_show ) {
1812
+				foreach ($date_config['field_options']['attribute_type_date_options_day_to_show'] as $day_to_show) {
1813 1813
 					$day_to_show_list .= '(date.getDay() == ' . $day_to_show . ') || ';
1814 1814
 				}
1815 1815
 				$script_options[] = '( ' . substr($day_to_show_list, 0, -4) . ' )';
1816 1816
 			}
1817 1817
 
1818
-			if ( !empty($date_config['field_options']['attribute_type_date_options_available_date_type'][0]) ) {
1819
-				if ( !empty($date_config['field_options']['attribute_type_date_options_available_date']) ) {
1818
+			if (!empty($date_config['field_options']['attribute_type_date_options_available_date_type'][0])) {
1819
+				if (!empty($date_config['field_options']['attribute_type_date_options_available_date'])) {
1820 1820
 					$available_date = ' ';
1821
-					foreach ( $date_config['field_options']['attribute_type_date_options_available_date'] as $avalaible_date_list ) {
1822
-						if ( !empty($avalaible_date_list) ) {
1821
+					foreach ($date_config['field_options']['attribute_type_date_options_available_date'] as $avalaible_date_list) {
1822
+						if (!empty($avalaible_date_list)) {
1823 1823
 							$available_date .= '"' . $avalaible_date_list . '",';
1824 1824
 						}
1825 1825
 					}
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
 				}
1829 1829
 			}
1830 1830
 
1831
-			if ( !empty( $script_options ) ) {
1831
+			if (!empty($script_options)) {
1832 1832
 				$field_script .= '
1833 1833
 		wpshop("#' . $input_def['id'] . '").datepicker("option", "beforeShowDay", function(date){
1834 1834
 			' . implode(' ', $script_options_params) . ';
@@ -1856,37 +1856,37 @@  discard block
 block discarded – undo
1856 1856
 </script>';
1857 1857
 			$input_def['options'] .= $field_script;
1858 1858
 		}
1859
-		if ( in_array($attribute->backend_input, array('multiple-select', 'select', 'radio', 'checkbox'))) {
1860
-			$input_more_class .= (!empty($specific_argument['no_chosen']) ? '' : ' chosen_select ' );
1859
+		if (in_array($attribute->backend_input, array('multiple-select', 'select', 'radio', 'checkbox'))) {
1860
+			$input_more_class .= (!empty($specific_argument['no_chosen']) ? '' : ' chosen_select ');
1861 1861
 			$input_def['type'] = ((!empty($specific_argument['from']) && ($specific_argument['from'] == 'frontend')) || (!is_admin() && empty($specific_argument['from'])) ? $attribute->frontend_input : $attribute->backend_input);
1862 1862
 			$input_def['valueToPut'] = 'index';
1863 1863
 
1864 1864
 			$select_display = self::get_select_output($attribute, $specific_argument);
1865
-			if ( empty( $input_def[ 'options_label' ] ) && !empty( $specific_argument ) && (!empty($specific_argument['from']) && ($specific_argument['from'] == 'frontend') ) ) {
1866
-				$input_def[ 'options_label' ][ 'original' ] = true;
1865
+			if (empty($input_def['options_label']) && !empty($specific_argument) && (!empty($specific_argument['from']) && ($specific_argument['from'] == 'frontend'))) {
1866
+				$input_def['options_label']['original'] = true;
1867 1867
 			}
1868 1868
 			$input_def['options'] .= $select_display['more_input'];
1869 1869
 			$input_def['possible_value'] = (!empty($select_display) && !empty($select_display['possible_value'])) ? $select_display['possible_value'] : '';
1870
-			if ( !is_admin() ) {
1870
+			if (!is_admin()) {
1871 1871
 				$input_def['options'] .= '<input type="hidden" value="' . str_replace("\\", "", $input_def['value']) . '" name="wpshop_product_attribute_' . $attribute->code . '_current_value" id="wpshop_product_attribute_' . $attribute->code . '_current_value" />';
1872 1872
 			}
1873
-			if ( in_array($attribute->backend_input, array('multiple-select', 'checkbox')) && is_admin() && (empty($specific_argument['from']) || ($specific_argument['from'] != 'frontend')) ) {
1874
-				$input_def['options'] .= wpshop_display::display_template_element('select_list_multiple_bulk_action', array( 'CURRENT_ATTRIBUTE_ID' => $input_def['id'], 'CURRENT_ATTRIBUTE_CODE' => $attribute->code), array(), 'admin');
1873
+			if (in_array($attribute->backend_input, array('multiple-select', 'checkbox')) && is_admin() && (empty($specific_argument['from']) || ($specific_argument['from'] != 'frontend'))) {
1874
+				$input_def['options'] .= wpshop_display::display_template_element('select_list_multiple_bulk_action', array('CURRENT_ATTRIBUTE_ID' => $input_def['id'], 'CURRENT_ATTRIBUTE_CODE' => $attribute->code), array(), 'admin');
1875 1875
 			}
1876 1876
 		}
1877 1877
 		$input_def['label_pointer'] = 'for="' . $input_def['id'] . '"';
1878
-		if(($input_def['type'] == 'radio') || ($input_def['type'] == 'checkbox')){
1878
+		if (($input_def['type'] == 'radio') || ($input_def['type'] == 'checkbox')) {
1879 1879
 			$input_def['label_pointer'] = '';
1880 1880
 		}
1881 1881
 
1882 1882
 		/*
1883 1883
 		 * Specifc treatment for price attributes
1884 1884
 		 */
1885
-		if((WPSHOP_PRODUCT_PRICE_PILOT == 'HT') && ($attribute->code == WPSHOP_PRODUCT_PRICE_TTC) ){
1885
+		if ((WPSHOP_PRODUCT_PRICE_PILOT == 'HT') && ($attribute->code == WPSHOP_PRODUCT_PRICE_TTC)) {
1886 1886
 			$input_def['option'] .= ' readonly="readonly" ';
1887 1887
 			$input_more_class .= ' wpshop_prices_readonly';
1888 1888
 		}
1889
-		elseif((WPSHOP_PRODUCT_PRICE_PILOT == 'TTC') && ($attribute->code == WPSHOP_PRODUCT_PRICE_HT) ){
1889
+		elseif ((WPSHOP_PRODUCT_PRICE_PILOT == 'TTC') && ($attribute->code == WPSHOP_PRODUCT_PRICE_HT)) {
1890 1890
 			$input_def['option'] .= ' readonly="readonly" ';
1891 1891
 			$input_more_class .= ' wpshop_prices_readonly';
1892 1892
 		}
@@ -1897,7 +1897,7 @@  discard block
 block discarded – undo
1897 1897
 
1898 1898
 		$input_def['label'] = str_replace("\\", "", $input_def['label']);
1899 1899
 // 		$input_def['value'] = str_replace("\\", "", $input_def['value']);
1900
-		$input_def['option'] .= ' class="wpshop_product_attribute_' . $attribute->code . $input_more_class . ' ' . (( is_admin() ) ? $attribute->backend_css_class : $attribute->frontend_css_class) . ( !empty($attribute->frontend_verification) ? ' wps_attr_verification_' . $attribute->frontend_verification : '' ) . '" ';
1900
+		$input_def['option'] .= ' class="wpshop_product_attribute_' . $attribute->code . $input_more_class . ' ' . ((is_admin()) ? $attribute->backend_css_class : $attribute->frontend_css_class) . (!empty($attribute->frontend_verification) ? ' wps_attr_verification_' . $attribute->frontend_verification : '') . '" ';
1901 1901
 		$input_def['title'] = !empty($attribute->frontend_help_message) ? ' title="' . $attribute->frontend_help_message . '" ' : '';
1902 1902
 
1903 1903
 		if (($attribute->is_intrinsic == 'yes') && ((!empty($input_def['value'])) || ($input_def['value'] > 0))) {
@@ -1908,13 +1908,13 @@  discard block
 block discarded – undo
1908 1908
 		 * Add the unit to the attribute if attribute configuration is set to yes
1909 1909
 		 */
1910 1910
 		if ($attribute->is_requiring_unit == 'yes') {
1911
-			if ( in_array($attribute->code, $wpshop_price_attributes) || ( WPSHOP_COST_OF_POSTAGE == $attribute->code) ) {
1911
+			if (in_array($attribute->code, $wpshop_price_attributes) || (WPSHOP_COST_OF_POSTAGE == $attribute->code)) {
1912 1912
 				$input_def['options'] .= '&nbsp;<span class="attribute_currency" id="attribute_currency_' . $attribute->id . '" >' . wpshop_tools::wpshop_get_currency() . '</span>';
1913 1913
 			}
1914
-			elseif ( in_array($attribute->code, $wpshop_weight_attributes) ) {
1914
+			elseif (in_array($attribute->code, $wpshop_weight_attributes)) {
1915 1915
 				$weight_defaut_unity_option = get_option('wpshop_shop_default_weight_unity');
1916
-				$query = $wpdb->prepare('SELECT name FROM '. WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id=%d', $weight_defaut_unity_option);
1917
-				$unity = $wpdb->get_var( $query );
1916
+				$query = $wpdb->prepare('SELECT name FROM ' . WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id=%d', $weight_defaut_unity_option);
1917
+				$unity = $wpdb->get_var($query);
1918 1918
 				$input_def['options'] .= '&nbsp;<span class="attribute_weight" id="attribute_weight_' . $attribute->id . '" >' . __($unity, 'wpshop') . '</span>';
1919 1919
 			}
1920 1920
 			else {
@@ -1922,11 +1922,11 @@  discard block
 block discarded – undo
1922 1922
 				$unit_input_def['possible_value'] = wpshop_attributes_unit::get_unit_list_for_group($attribute->_unit_group_id);
1923 1923
 				$unit_input_def['type'] = 'select';
1924 1924
 				$unit_input_def['option'] = ' class="wpshop_attribute_unit_input chosen_select" ';
1925
-				$unit_input_def['id'] = ( !empty($specific_argument['page_code']) ? $specific_argument['page_code'] : null ) . '_' . ( !empty($specific_argument['element_identifier']) ? $specific_argument['element_identifier'] : null ) . '_unit_attribute_' . $attribute->id;
1925
+				$unit_input_def['id'] = (!empty($specific_argument['page_code']) ? $specific_argument['page_code'] : null) . '_' . (!empty($specific_argument['element_identifier']) ? $specific_argument['element_identifier'] : null) . '_unit_attribute_' . $attribute->id;
1926 1926
 				$unit_input_def['name'] = $attribute->code;
1927 1927
 				$unit_input_def['value'] = (!empty($attribute_value->unit_id) ? $attribute_value->unit_id : '');
1928
-				if($unit_input_def['value'] == ''){
1929
-					if ( $attribute->_default_unit > 0 ) {
1928
+				if ($unit_input_def['value'] == '') {
1929
+					if ($attribute->_default_unit > 0) {
1930 1930
 						$unit_input_def['value'] = $attribute->_default_unit;
1931 1931
 					}
1932 1932
 					else {
@@ -1940,18 +1940,18 @@  discard block
 block discarded – undo
1940 1940
 		/*
1941 1941
 		 * Add indication on postage cost tax
1942 1942
 		 */
1943
-		if ( $attribute->code == WPSHOP_COST_OF_POSTAGE ) {
1943
+		if ($attribute->code == WPSHOP_COST_OF_POSTAGE) {
1944 1944
 			$input_def['options'] .= ' <span class="attribute_currency" >' . __('ATI', 'wpshop') . '</span>';
1945 1945
 		}
1946 1946
 
1947 1947
 		/*
1948 1948
 		 * Create the field output
1949 1949
 		 */
1950
-		if ( is_admin() && ($attribute->data_type == 'datetime') && ($attribute->is_user_defined == 'yes') && (empty($specific_argument['from']) || ($specific_argument['from'] != 'frontend')) ) {
1951
-			$input_def['output'] = sprintf(__('You select this field to be defined by final customer into frontend part. To change this behaviour you have to change attribute option "%s"', 'wpshop'),__('is_user_defined', 'wpshop'));
1950
+		if (is_admin() && ($attribute->data_type == 'datetime') && ($attribute->is_user_defined == 'yes') && (empty($specific_argument['from']) || ($specific_argument['from'] != 'frontend'))) {
1951
+			$input_def['output'] = sprintf(__('You select this field to be defined by final customer into frontend part. To change this behaviour you have to change attribute option "%s"', 'wpshop'), __('is_user_defined', 'wpshop'));
1952 1952
 			$input_def['options'] = '';
1953 1953
 			$input_def['label_pointer'] = '';
1954
-			$input_def['option'] = substr( $input_def['option'], 0 , -2 ) . ' wpshop_attributes_is_user_defined_admin_field "';
1954
+			$input_def['option'] = substr($input_def['option'], 0, -2) . ' wpshop_attributes_is_user_defined_admin_field "';
1955 1955
 			$input_def['field_container_class'] .= 'wpshop_attributes_is_user_defined_admin_container';
1956 1956
 		}
1957 1957
 		else {
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
 	 * @param string $output_from
1967 1967
 	 * @return string The output for
1968 1968
 	 */
1969
-	public static function display_attribute( $attribute_code, $output_from = 'admin', $output_specs = array() ) {
1969
+	public static function display_attribute($attribute_code, $output_from = 'admin', $output_specs = array()) {
1970 1970
 		$output = '';
1971 1971
 		/*	Get the page code	*/
1972 1972
 		$currentPageCode = !empty($output_specs['page_code']) ? $output_specs['page_code'] : '';
@@ -1977,17 +1977,17 @@  discard block
 block discarded – undo
1977 1977
 
1978 1978
 		/*	Get attribute input definition	*/
1979 1979
 		$current_value = (!empty($output_specs['current_value']) ? $output_specs['current_value'] : '');
1980
-		$input = wpshop_attributes::get_attribute_field_definition( $attribute_def, $current_value, array_merge($output_specs, array('input_class' => ' wpshop_attributes_display', 'from' => $output_from)) );
1980
+		$input = wpshop_attributes::get_attribute_field_definition($attribute_def, $current_value, array_merge($output_specs, array('input_class' => ' wpshop_attributes_display', 'from' => $output_from)));
1981 1981
 
1982 1982
 		/*	Create default output	*/
1983 1983
 		$input_to_display = $input['output'] . $input['options'];
1984 1984
 
1985 1985
 		/*	Check if current field is linked to an addon, and if the addon is activated	*/
1986 1986
 		$addons_list = unserialize(WPSHOP_ADDONS_LIST);
1987
-		foreach ( $addons_list as $addon_code => $addon_def ) {
1988
-			if ( in_array($attribute_code, $addon_def) ) {
1989
-				if ( constant($addon_code) === false ) {
1990
-					$input_to_display = '<a href="' . admin_url('options-general.php?page=wpshop_option#wpshop_addons_option') . '" >' . __("This addon isn't activated, click to activate",'wpshop') . '</a>';
1987
+		foreach ($addons_list as $addon_code => $addon_def) {
1988
+			if (in_array($attribute_code, $addon_def)) {
1989
+				if (constant($addon_code) === false) {
1990
+					$input_to_display = '<a href="' . admin_url('options-general.php?page=wpshop_option#wpshop_addons_option') . '" >' . __("This addon isn't activated, click to activate", 'wpshop') . '</a>';
1991 1991
 				}
1992 1992
 			}
1993 1993
 		}
@@ -2012,11 +2012,11 @@  discard block
 block discarded – undo
2012 2012
 		/*
2013 2013
 		 * Display attribute option if applicable
2014 2014
 		 */
2015
-		if ( $output_from == 'admin') {
2016
-			$attribute_option_display = $attribute_def->backend_input=='select' && (strtolower( __(self::get_attribute_type_select_option_info($input['value'], 'value'), 'wpshop') ) == strtolower(__('yes', 'wpshop'))) ? '' : ' wpshopHide';
2015
+		if ($output_from == 'admin') {
2016
+			$attribute_option_display = $attribute_def->backend_input == 'select' && (strtolower(__(self::get_attribute_type_select_option_info($input['value'], 'value'), 'wpshop')) == strtolower(__('yes', 'wpshop'))) ? '' : ' wpshopHide';
2017 2017
 
2018 2018
 			$output['field'] .= '
2019
-	<div class="attribute_option_'.$attribute_def->code.''.$attribute_option_display.'">'.self::get_attribute_option_fields($element_identifier, $attribute_def->code).'</div>';
2019
+	<div class="attribute_option_'.$attribute_def->code . '' . $attribute_option_display . '">' . self::get_attribute_option_fields($element_identifier, $attribute_def->code) . '</div>';
2020 2020
 		}
2021 2021
 
2022 2022
 		$output['field'] .= '</div>';
@@ -2034,36 +2034,36 @@  discard block
 block discarded – undo
2034 2034
 	 *
2035 2035
 	 * @return string The html code to output directly tabs
2036 2036
 	 */
2037
-	public static function attribute_of_entity_to_tab( $element_code, $element_id, $element_definition ) {
2037
+	public static function attribute_of_entity_to_tab($element_code, $element_id, $element_definition) {
2038 2038
 		$attributeContentOutput = '';
2039 2039
 
2040 2040
 		/**	Get the different attribute affected to the entity	*/
2041 2041
 		$element_atribute_list = wpshop_attributes::getElementWithAttributeAndValue($element_code, $element_id, WPSHOP_CURRENT_LOCALE, '', 'frontend');
2042 2042
 
2043 2043
 
2044
-		if ( is_array($element_atribute_list) && (count($element_atribute_list) > 0) ) {
2045
-			foreach ( $element_atribute_list[$element_id] as $attributeSetSectionName => $attributeSetContent ) {
2044
+		if (is_array($element_atribute_list) && (count($element_atribute_list) > 0)) {
2045
+			foreach ($element_atribute_list[$element_id] as $attributeSetSectionName => $attributeSetContent) {
2046 2046
 				$attributeToShowNumber = 0;
2047 2047
 				$attributeOutput = '';
2048 2048
 
2049
-				foreach ( $attributeSetContent['attributes'] as $attributeId => $attributeDefinition ) {
2049
+				foreach ($attributeSetContent['attributes'] as $attributeId => $attributeDefinition) {
2050 2050
 
2051 2051
 					/**	Check the value type to check if empty or not	*/
2052
-					if ( $attributeDefinition['data_type'] == 'int' ) {
2052
+					if ($attributeDefinition['data_type'] == 'int') {
2053 2053
 						$attributeDefinition['value'] = (int)$attributeDefinition['value'];
2054 2054
 					}
2055
-					else if ( $attributeDefinition['data_type'] == 'decimal' ) {
2055
+					else if ($attributeDefinition['data_type'] == 'decimal') {
2056 2056
 						$attributeDefinition['value'] = (float)$attributeDefinition['value'];
2057 2057
 					}
2058 2058
 
2059 2059
 					/** Check if the attribute is set to be displayed in frontend	*/
2060
-					$attribute_display_state = wpshop_attributes::check_attribute_display( $attributeDefinition['is_visible_in_front'], $element_definition['custom_display'], 'attribute', $attributeDefinition['code'], 'complete_sheet');
2060
+					$attribute_display_state = wpshop_attributes::check_attribute_display($attributeDefinition['is_visible_in_front'], $element_definition['custom_display'], 'attribute', $attributeDefinition['code'], 'complete_sheet');
2061 2061
 
2062 2062
 					/**	Output the field if the value is not null	*/
2063 2063
 
2064
-					if ( (is_array($attributeDefinition['value']) || ( !empty($attributeDefinition['value']) ) ) && $attribute_display_state) {
2064
+					if ((is_array($attributeDefinition['value']) || (!empty($attributeDefinition['value']))) && $attribute_display_state) {
2065 2065
 
2066
-						$attribute_display = wpshop_attributes::wps_attribute_values_display( $attributeDefinition );
2066
+						$attribute_display = wpshop_attributes::wps_attribute_values_display($attributeDefinition);
2067 2067
 						$attribute_value = $attribute_display[0];
2068 2068
 						$attributeDefinition['value'] = $attribute_display[1];
2069 2069
 						$attribute_unit_list = $attribute_display[2];
@@ -2074,8 +2074,8 @@  discard block
 block discarded – undo
2074 2074
 						$tpl_component['PDT_ENTITY_CODE'] = self::currentPageCode;
2075 2075
 						$tpl_component['ATTRIBUTE_CODE'] = $attributeDefinition['attribute_code'];
2076 2076
 						$tpl_component['ATTRIBUTE_LABEL'] = __($attributeDefinition['frontend_label'], 'wpshop');
2077
-						$tpl_component['ATTRIBUTE_VALUE'] = (  !is_array($attribute_value) ) ? stripslashes($attribute_value) : $attribute_value;
2078
-						$tpl_component['ATTRIBUTE_VALUE_UNIT'] =  $attribute_unit_list;
2077
+						$tpl_component['ATTRIBUTE_VALUE'] = (!is_array($attribute_value)) ? stripslashes($attribute_value) : $attribute_value;
2078
+						$tpl_component['ATTRIBUTE_VALUE_UNIT'] = $attribute_unit_list;
2079 2079
 
2080 2080
 						/** Build template	*/
2081 2081
 						$attributeOutput .= wpshop_display::display_template_element($template_part, $tpl_component);
@@ -2086,9 +2086,9 @@  discard block
 block discarded – undo
2086 2086
 				}
2087 2087
 
2088 2088
 				/** Check if the attribute set section is set to be displayed in frontend	*/
2089
-				$attribute_set_display_state = wpshop_attributes::check_attribute_display( $attributeSetContent['display_on_frontend'], $element_definition['custom_display'], 'attribute_set_section', $attributeSetContent['code'], 'complete_sheet');
2089
+				$attribute_set_display_state = wpshop_attributes::check_attribute_display($attributeSetContent['display_on_frontend'], $element_definition['custom_display'], 'attribute_set_section', $attributeSetContent['code'], 'complete_sheet');
2090 2090
 
2091
-				if ( !$attribute_set_display_state ) {
2091
+				if (!$attribute_set_display_state) {
2092 2092
 					$attributeToShowNumber = 0;
2093 2093
 					$attributeOutput = '';
2094 2094
 				}
@@ -2098,8 +2098,8 @@  discard block
 block discarded – undo
2098 2098
 
2099 2099
 			/** Gestion de l'affichage	*/
2100 2100
 			$tab_list = $content_list = '';
2101
-			foreach ( $element_atribute_list[$element_id] as $attributeSetSectionName => $attributeSetContent ) {
2102
-				if ( !empty($attributeSetContent['count']) > 0 ) {
2101
+			foreach ($element_atribute_list[$element_id] as $attributeSetSectionName => $attributeSetContent) {
2102
+				if (!empty($attributeSetContent['count']) > 0) {
2103 2103
 					/** Template parameters	*/
2104 2104
 					$template_part = 'product_attribute_tabs';
2105 2105
 					$tpl_component = array();
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
 
2109 2109
 					/** Build template	*/
2110 2110
 					$tpl_way_to_take = wpshop_display::check_way_for_template($template_part);
2111
-					if ( $tpl_way_to_take[0] && !empty($tpl_way_to_take[1]) ) {
2111
+					if ($tpl_way_to_take[0] && !empty($tpl_way_to_take[1])) {
2112 2112
 						/*	Include the old way template part	*/
2113 2113
 						ob_start();
2114 2114
 						require(wpshop_display::get_template_file($tpl_way_to_take[1]));
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
 
2129 2129
 					/** Build template	*/
2130 2130
 					$tpl_way_to_take = wpshop_display::check_way_for_template($template_part);
2131
-					if ( $tpl_way_to_take[0] && !empty($tpl_way_to_take[1]) ) {
2131
+					if ($tpl_way_to_take[0] && !empty($tpl_way_to_take[1])) {
2132 2132
 						/*	Include the old way template part	*/
2133 2133
 						ob_start();
2134 2134
 						require(wpshop_display::get_template_file($tpl_way_to_take[1]));
@@ -2142,16 +2142,16 @@  discard block
 block discarded – undo
2142 2142
 				}
2143 2143
 			}
2144 2144
 
2145
-			if ( $tab_list != '' ) {
2145
+			if ($tab_list != '') {
2146 2146
 				/** Template parameters	*/
2147 2147
 				$template_part = 'product_attribute_container';
2148 2148
 				$tpl_component = array();
2149
-				$tpl_component['PDT_TABS'] = apply_filters( 'wpshop_extra_tabs_menu_before', '' ).$tab_list.apply_filters( 'wpshop_extra_tabs_menu_after', '' );
2150
-				$tpl_component['PDT_TAB_DETAIL'] = apply_filters( 'wpshop_extra_tabs_content_before', '' ).$content_list.apply_filters( 'wpshop_extra_tabs_content_after', '' );
2149
+				$tpl_component['PDT_TABS'] = apply_filters('wpshop_extra_tabs_menu_before', '') . $tab_list . apply_filters('wpshop_extra_tabs_menu_after', '');
2150
+				$tpl_component['PDT_TAB_DETAIL'] = apply_filters('wpshop_extra_tabs_content_before', '') . $content_list . apply_filters('wpshop_extra_tabs_content_after', '');
2151 2151
 
2152 2152
 				/** Build template	*/
2153 2153
 				$tpl_way_to_take = wpshop_display::check_way_for_template($template_part);
2154
-				if ( $tpl_way_to_take[0] && !empty($tpl_way_to_take[1]) ) {
2154
+				if ($tpl_way_to_take[0] && !empty($tpl_way_to_take[1])) {
2155 2155
 					/*	Include the old way template part	*/
2156 2156
 					ob_start();
2157 2157
 					require(wpshop_display::get_template_file($tpl_way_to_take[1]));
@@ -2174,9 +2174,9 @@  discard block
 block discarded – undo
2174 2174
 	 * @param unknown_type $attributeDefinition
2175 2175
 	 * @return multitype:Ambigous <unknown, string> Ambigous <string, string> Ambigous <>
2176 2176
 	 */
2177
-	public static function wps_attribute_values_display( $attributeDefinition ) {
2177
+	public static function wps_attribute_values_display($attributeDefinition) {
2178 2178
 		$attribute_unit_list = '';
2179
-		if ( !empty($attributeDefinition['unit']) ) {
2179
+		if (!empty($attributeDefinition['unit'])) {
2180 2180
 			/** Template parameters	*/
2181 2181
 			$template_part = 'product_attribute_unit';
2182 2182
 			$tpl_component = array();
@@ -2188,31 +2188,31 @@  discard block
 block discarded – undo
2188 2188
 		}
2189 2189
 
2190 2190
 		$attribute_value = $attributeDefinition['value'];
2191
-		if ( $attributeDefinition['data_type'] == 'decimal' ) {
2192
-			$attribute_value =(is_numeric($attribute_value) ) ? number_format($attribute_value, 2, ',', '') : $attribute_value;
2193
-			if ( in_array($attributeDefinition['code'], unserialize(WPSHOP_ATTRIBUTE_PRICES)) ) {
2194
-				if ( $attributeDefinition['is_requiring_unit'] == 'yes' ) {
2191
+		if ($attributeDefinition['data_type'] == 'decimal') {
2192
+			$attribute_value = (is_numeric($attribute_value)) ? number_format($attribute_value, 2, ',', '') : $attribute_value;
2193
+			if (in_array($attributeDefinition['code'], unserialize(WPSHOP_ATTRIBUTE_PRICES))) {
2194
+				if ($attributeDefinition['is_requiring_unit'] == 'yes') {
2195 2195
 					$attribute_unit_list = ' ' . wpshop_tools::wpshop_get_currency();
2196 2196
 				}
2197 2197
 				$attributeDefinition['value'] = wpshop_display::format_field_output('wpshop_product_price', $attributeDefinition['value']);
2198 2198
 			}
2199 2199
 		}
2200
-		if ( $attributeDefinition['data_type'] == 'datetime' ) {
2200
+		if ($attributeDefinition['data_type'] == 'datetime') {
2201 2201
 			$attribute_value = mysql2date('d/m/Y', $attributeDefinition['value'], true);
2202 2202
 		}
2203
-		if ( $attributeDefinition['backend_input'] == 'select' ) {
2203
+		if ($attributeDefinition['backend_input'] == 'select') {
2204 2204
 			$attribute_value = wpshop_attributes::get_attribute_type_select_option_info($attributeDefinition['value'], 'label', $attributeDefinition['data_type_to_use']);
2205 2205
 		}
2206 2206
 		/** Manage differently if its an array of values or not	*/
2207
-		if ( $attributeDefinition['backend_input'] == 'multiple-select') {
2207
+		if ($attributeDefinition['backend_input'] == 'multiple-select') {
2208 2208
 			$attribute_value = '';
2209
-			if ( is_array($attributeDefinition['value']) ) {
2209
+			if (is_array($attributeDefinition['value'])) {
2210 2210
 				foreach ($attributeDefinition['value'] as $v) {
2211
-					$attribute_value .= ' / '.wpshop_attributes::get_attribute_type_select_option_info($v, 'label', $attributeDefinition['data_type_to_use']);
2211
+					$attribute_value .= ' / ' . wpshop_attributes::get_attribute_type_select_option_info($v, 'label', $attributeDefinition['data_type_to_use']);
2212 2212
 				}
2213 2213
 			}
2214
-			else $attribute_value = ' / '.wpshop_attributes::get_attribute_type_select_option_info($attributeDefinition['value'], 'label', $attributeDefinition['data_type_to_use']);
2215
-			$attribute_value = substr($attribute_value,3);
2214
+			else $attribute_value = ' / ' . wpshop_attributes::get_attribute_type_select_option_info($attributeDefinition['value'], 'label', $attributeDefinition['data_type_to_use']);
2215
+			$attribute_value = substr($attribute_value, 3);
2216 2216
 		}
2217 2217
 
2218 2218
 		return array($attribute_value, $attributeDefinition['value'], $attribute_unit_list);
@@ -2222,13 +2222,13 @@  discard block
 block discarded – undo
2222 2222
 	 * Manage display for the output when user uses a shortcode for attributes display
2223 2223
 	 * @param array $shorcode_args The list of argument passed through the shortcode
2224 2224
 	 */
2225
-	function wpshop_attributes_shortcode( $shorcode_args ) {
2225
+	function wpshop_attributes_shortcode($shorcode_args) {
2226 2226
 		$output = '';
2227 2227
 		/*
2228 2228
 		 * Read the attribute list
2229 2229
 		*/
2230
-		foreach ( explode(', ', $shorcode_args['attributes']) as $attribute_code ) {
2231
-			$attribute_output_def = wpshop_attributes::display_attribute( $attribute_code, $shorcode_args['from'] );
2230
+		foreach (explode(', ', $shorcode_args['attributes']) as $attribute_code) {
2231
+			$attribute_output_def = wpshop_attributes::display_attribute($attribute_code, $shorcode_args['from']);
2232 2232
 			$output .= $attribute_output_def['field'];
2233 2233
 		}
2234 2234
 
@@ -2250,7 +2250,7 @@  discard block
 block discarded – undo
2250 2250
 		$productAttributeSetDetails = wpshop_attributes_set::getAttributeSetDetails($attributeSetId, "'valid','deleted'");
2251 2251
 		$attribute_specification = array('page_code' => $currentPageCode, 'element_identifier' => $itemToEdit, 'field_id' => $currentPageCode . '_' . $itemToEdit . '_');
2252 2252
 
2253
-		if ( count($productAttributeSetDetails) > 0 ) {
2253
+		if (count($productAttributeSetDetails) > 0) {
2254 2254
 			/*	Read the attribute list in order to output	*/
2255 2255
 			$shortcodes_attr = '';
2256 2256
 			$shortcodes_to_display = false;
@@ -2260,80 +2260,80 @@  discard block
 block discarded – undo
2260 2260
 
2261 2261
 				$shortcodes = $currentTabContent = '';
2262 2262
 				$output_nb = 0;
2263
-				if(count($productAttributeSetDetail['attribut']) >= 1){
2264
-					foreach($productAttributeSetDetail['attribut'] as $attribute){
2263
+				if (count($productAttributeSetDetail['attribut']) >= 1) {
2264
+					foreach ($productAttributeSetDetail['attribut'] as $attribute) {
2265 2265
 
2266
-						if ( !empty($attribute->id) ) {
2267
-							if ( $attribute->code == 'product_attribute_set_id' ) {
2266
+						if (!empty($attribute->id)) {
2267
+							if ($attribute->code == 'product_attribute_set_id') {
2268 2268
 								$attribute_set_id_is_present = true;
2269 2269
 							}
2270 2270
 
2271 2271
 							/** Generic part for attribute field output	*/
2272 2272
 							$value = wpshop_attributes::getAttributeValueForEntityInSet($attribute->data_type, $attribute->id, wpshop_entities::get_entity_identifier_from_code($currentPageCode), $itemToEdit, array('intrinsic' => $attribute->is_intrinsic, 'backend_input' => $attribute->backend_input));
2273
-							$product_meta = get_post_meta( $itemToEdit, '_wpshop_product_metadata', true);
2273
+							$product_meta = get_post_meta($itemToEdit, '_wpshop_product_metadata', true);
2274 2274
 
2275 2275
 							/**	Check if value is empty and get value in meta if not empty	*/
2276 2276
 							$value = (empty($value) && !empty($product_meta[$attribute->code])) ? $product_meta[$attribute->code] : (!empty($value) ? $value : null);
2277 2277
 
2278 2278
 							/*	Manage specific field as the attribute_set_id in product form	*/
2279
-							if ( $attribute->code == 'product_attribute_set_id' ) {
2279
+							if ($attribute->code == 'product_attribute_set_id') {
2280 2280
 
2281 2281
 								$value = empty($value) ? $attributeSetId : $value;
2282 2282
 							}
2283 2283
 							$attribute_specification['current_value'] = $value;
2284
-							$attribute_output_def = apply_filters( 'wpshop_attribute_output_def', wpshop_attributes::display_attribute( $attribute->code, 'admin', $attribute_specification), $itemToEdit );
2285
-							if ( ($attribute_output_def['field_definition']['type'] != 'hidden') && ($attribute->code != 'product_attribute_set_id') ) {
2284
+							$attribute_output_def = apply_filters('wpshop_attribute_output_def', wpshop_attributes::display_attribute($attribute->code, 'admin', $attribute_specification), $itemToEdit);
2285
+							if (($attribute_output_def['field_definition']['type'] != 'hidden') && ($attribute->code != 'product_attribute_set_id')) {
2286 2286
 								$currentTabContent .= $attribute_output_def['field'];
2287
-								$shortcode_code_def=array();
2288
-								$shortcode_code_def['attribute_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['main_code'] = 'wpshop_att_val';
2289
-								$shortcode_code_def['attribute_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['type'] = $attribute->data_type;
2290
-								$shortcode_code_def['attribute_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['attid'] = $attribute->id;
2291
-								$shortcode_code_def['attribute_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['pid'] = $itemToEdit;
2287
+								$shortcode_code_def = array();
2288
+								$shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['main_code'] = 'wpshop_att_val';
2289
+								$shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['type'] = $attribute->data_type;
2290
+								$shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['attid'] = $attribute->id;
2291
+								$shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['pid'] = $itemToEdit;
2292 2292
 								ob_start();
2293
-								wps_shortcodes_ctr::output_shortcode('attribute_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label'])), $shortcode_code_def, 'wpshop_product_shortcode_display wpshop_product_attribute_shortcode_display wpshop_product_attribute_shortcode_display_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label'])).' wpshop_cls');
2294
-								$shortcodes .= '<li class="wpshop_cls" >'.sprintf(__('Insertion code for the attribute %s for this product', 'wpshop'), '<span>'.__($attribute_output_def['field_definition']['label'], 'wpshop').'</span>').ob_get_contents().'</li>';
2293
+								wps_shortcodes_ctr::output_shortcode('attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label'])), $shortcode_code_def, 'wpshop_product_shortcode_display wpshop_product_attribute_shortcode_display wpshop_product_attribute_shortcode_display_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label'])) . ' wpshop_cls');
2294
+								$shortcodes .= '<li class="wpshop_cls" >' . sprintf(__('Insertion code for the attribute %s for this product', 'wpshop'), '<span>' . __($attribute_output_def['field_definition']['label'], 'wpshop') . '</span>') . ob_get_contents() . '</li>';
2295 2295
 								ob_end_clean();
2296 2296
 							}
2297 2297
 							else {
2298
-								if ( $attribute->code == 'product_attribute_set_id' ) {
2298
+								if ($attribute->code == 'product_attribute_set_id') {
2299 2299
 									$attribute_output_def['field_definition']['type'] = 'hidden';
2300 2300
 								}
2301
-								$currentTabContent .=  wpshop_form::check_input_type($attribute_output_def['field_definition'], $attribute_output_def['field_definition']['input_domain']);
2301
+								$currentTabContent .= wpshop_form::check_input_type($attribute_output_def['field_definition'], $attribute_output_def['field_definition']['input_domain']);
2302 2302
 							}
2303 2303
 							$output_nb++;
2304 2304
 						}
2305 2305
 					}
2306 2306
 
2307
-					$currentTabContent = apply_filters( 'wps_entity_attribute_edition', $currentTabContent, $itemToEdit, $productAttributeSetDetail );
2307
+					$currentTabContent = apply_filters('wps_entity_attribute_edition', $currentTabContent, $itemToEdit, $productAttributeSetDetail);
2308 2308
 
2309 2309
 					$shortcode_code['attributes_set']['main_code'] = 'wpshop_att_group';
2310 2310
 					$shortcode_code['attributes_set']['attrs_exemple']['pid'] = $itemToEdit;
2311 2311
 					$shortcode_code['attributes_set']['attrs_exemple']['sid'] = $productAttributeSetDetail['id'];
2312 2312
 					ob_start();
2313
-					wps_shortcodes_ctr::output_shortcode('attributes_set', $shortcode_code, 'wpshop_product_shortcode_display wpshop_product_attribute_group_shortcode_display wpshop_product_attribute_group_shortcode_display_'.str_replace('-', '_', sanitize_title($productAttributeSetDetail['name'])).' cls');
2314
-					$attribute_group_display = sprintf(__('Insertion code for attribute group %s for this product', 'wpshop'), '<span>'.$productAttributeSetDetail['name'].'</span>').ob_get_contents().'<ul class="" >'.$shortcodes.'</ul>';
2313
+					wps_shortcodes_ctr::output_shortcode('attributes_set', $shortcode_code, 'wpshop_product_shortcode_display wpshop_product_attribute_group_shortcode_display wpshop_product_attribute_group_shortcode_display_' . str_replace('-', '_', sanitize_title($productAttributeSetDetail['name'])) . ' cls');
2314
+					$attribute_group_display = sprintf(__('Insertion code for attribute group %s for this product', 'wpshop'), '<span>' . $productAttributeSetDetail['name'] . '</span>') . ob_get_contents() . '<ul class="" >' . $shortcodes . '</ul>';
2315 2315
 					ob_end_clean();
2316 2316
 
2317
-					if( WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE == 'each-box' )
2318
-						$currentTabContent .= '<div class="wpshop_cls" ><strong>'.__('Shortcodes','wpshop').'</strong> - <a href="#" class="show-hide-shortcodes">' . __('Display', 'wpshop') . '</a><div class="wpshop_product_shortcode_display wpshop_product_shortcode_display_container wpshopHide" >' . $attribute_group_display . '</div></div>';
2317
+					if (WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE == 'each-box')
2318
+						$currentTabContent .= '<div class="wpshop_cls" ><strong>' . __('Shortcodes', 'wpshop') . '</strong> - <a href="#" class="show-hide-shortcodes">' . __('Display', 'wpshop') . '</a><div class="wpshop_product_shortcode_display wpshop_product_shortcode_display_container wpshopHide" >' . $attribute_group_display . '</div></div>';
2319 2319
 					else
2320 2320
 						$shortcodes_attr .= $attribute_group_display;
2321 2321
 
2322
-					if ( $output_nb <= 0 ) {
2322
+					if ($output_nb <= 0) {
2323 2323
 						$currentTabContent = __('Nothing avaiblable here. You can go in attribute management interface in order to add content here.', 'wpshop');
2324 2324
 					}
2325 2325
 				}
2326 2326
 
2327 2327
 				if ($output_nb > 0) {
2328 2328
 					$shortcodes_to_display = true;
2329
-					if ( $outputType == 'box' ) {
2329
+					if ($outputType == 'box') {
2330 2330
 						$box['box'][$productAttributeSetDetail['code']] = $productAttributeSetDetail['name'];
2331
-						$box['box'][$productAttributeSetDetail['code'].'_backend_display_type'] = $productAttributeSetDetail['backend_display_type'];
2331
+						$box['box'][$productAttributeSetDetail['code'] . '_backend_display_type'] = $productAttributeSetDetail['backend_display_type'];
2332 2332
 						$box['boxContent'][$productAttributeSetDetail['code']] = '
2333 2333
 			<div id="wpshop_' . $currentPageCode . '_' . wpshop_tools::slugify($productAttributeSetDetail['code'], array('noAccent')) . '_form" >' . $currentTabContent . '
2334 2334
 							</div><div class="wpshop_cls" ></div>';
2335 2335
 					}
2336
-					else if ( $outputType == 'column' ) {
2336
+					else if ($outputType == 'column') {
2337 2337
 						$currentTabContent = str_replace('wpshop_form_input_element', 'wpshop_form_input_column', $currentTabContent);
2338 2338
 						$currentTabContent = str_replace('wpshop_form_label', 'wpshop_form_label_column', $currentTabContent);
2339 2339
 
@@ -2343,11 +2343,11 @@  discard block
 block discarded – undo
2343 2343
 				}
2344 2344
 			}
2345 2345
 
2346
-			if( !$attribute_set_id_is_present ) {
2346
+			if (!$attribute_set_id_is_present) {
2347 2347
 				/*	Get attribute definition	*/
2348 2348
 				$attribute_def = wpshop_attributes::getElement('product_attribute_set_id', "'valid'", 'code');
2349 2349
 				/*	Get attribute input definition	*/
2350
-				$input = wpshop_attributes::get_attribute_field_definition( $attribute_def, $attributeSetId, array_merge($attribute_specification, array('input_class' => ' wpshop_attributes_display', 'from' => 'admin')) );
2350
+				$input = wpshop_attributes::get_attribute_field_definition($attribute_def, $attributeSetId, array_merge($attribute_specification, array('input_class' => ' wpshop_attributes_display', 'from' => 'admin')));
2351 2351
 				$input['type'] = 'hidden';
2352 2352
 
2353 2353
 				$box['boxMore'] = wpshop_form::check_input_type($input, $input['input_domain']);
@@ -2358,13 +2358,13 @@  discard block
 block discarded – undo
2358 2358
 			$dialog_identifier = 'wpshop_new_attribute_option_value_add';
2359 2359
 			$dialog_input_identifier = 'wpshop_new_attribute_option_value';
2360 2360
 			ob_start();
2361
-			include(WPSHOP_TEMPLATES_DIR.'admin/add_new_element_dialog.tpl.php');
2361
+			include(WPSHOP_TEMPLATES_DIR . 'admin/add_new_element_dialog.tpl.php');
2362 2362
 			$box['boxMore'] .= ob_get_contents();
2363 2363
 			ob_end_clean();
2364 2364
 			$box['boxMore'] .= '<input type="hidden" name="wpshop_attribute_type_select_code" value="" id="wpshop_attribute_type_select_code" />';
2365 2365
 
2366
-			if ( $shortcodes_to_display ) {
2367
-				switch ( WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE ) {
2366
+			if ($shortcodes_to_display) {
2367
+				switch (WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE) {
2368 2368
 					case 'fixed-tab':
2369 2369
 					case 'movable-tab':
2370 2370
 						if ($outputType == 'box') {
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 							$box['boxContent']['shortcode'] = $shortcodes_attr;
2373 2373
 							$box['box']['shortcode_backend_display_type'] = WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE;
2374 2374
 						}
2375
-						else{
2375
+						else {
2376 2376
 							$box['columnTitle']['shortcode'] = __('Product Shortcodes', 'wpshop');
2377 2377
 							$box['columnContent']['shortcode'] = $shortcodes_attr;
2378 2378
 						}
@@ -2396,12 +2396,12 @@  discard block
 block discarded – undo
2396 2396
 		$ouput['more_input'] = '';
2397 2397
 
2398 2398
 		$attribute_default_value = $attribute->default_value;
2399
-		if ( !empty($attribute->default_value) && ($attribute->default_value == serialize(false) || wpshop_tools::is_serialized( $attribute->default_value ) ) ) {
2399
+		if (!empty($attribute->default_value) && ($attribute->default_value == serialize(false) || wpshop_tools::is_serialized($attribute->default_value))) {
2400 2400
 			$tmp_default_value = unserialize($attribute->default_value);
2401 2401
 			$attribute_default_value = !empty($tmp_default_value["default_value"]) ? $tmp_default_value["default_value"] : null;
2402 2402
 		}
2403 2403
 
2404
-		if ( $attribute->data_type_to_use == 'custom') {
2404
+		if ($attribute->data_type_to_use == 'custom') {
2405 2405
 			$query = $wpdb->prepare("SELECT id, label, value, '' as name FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . " WHERE attribute_id = %d AND status = 'valid' ORDER BY position", $attribute->id);
2406 2406
 			$attribute_select_options = $wpdb->get_results($query);
2407 2407
 
@@ -2413,11 +2413,11 @@  discard block
 block discarded – undo
2413 2413
 // 				}
2414 2414
 			endforeach;
2415 2415
 		}
2416
-		elseif ( $attribute->data_type_to_use == 'internal')  {
2416
+		elseif ($attribute->data_type_to_use == 'internal') {
2417 2417
 			switch ($attribute_default_value) {
2418 2418
 				case 'users':
2419 2419
 					$users = get_users('orderby=nicename');
2420
-					foreach($users as $user){
2420
+					foreach ($users as $user) {
2421 2421
 						$attribute_select_options_list[$user->ID] = $user->display_name;
2422 2422
 					}
2423 2423
 				break;
@@ -2426,11 +2426,11 @@  discard block
 block discarded – undo
2426 2426
 					$wpshop_attr_custom_post_query = new WP_Query(array(
2427 2427
 						'post_type' => $attribute_default_value,
2428 2428
 						'posts_per_page' => -1,
2429
-						'post_status' => array( 'publish', 'draft', 'future' ) ,
2429
+						'post_status' => array('publish', 'draft', 'future'),
2430 2430
 					));
2431 2431
 
2432
-					if($wpshop_attr_custom_post_query->have_posts()):
2433
-						foreach($wpshop_attr_custom_post_query->posts as $post){
2432
+					if ($wpshop_attr_custom_post_query->have_posts()):
2433
+						foreach ($wpshop_attr_custom_post_query->posts as $post) {
2434 2434
 							$attribute_select_options_list[$post->ID] = $post->post_title;
2435 2435
 						}
2436 2436
 					endif;
@@ -2441,27 +2441,27 @@  discard block
 block discarded – undo
2441 2441
 
2442 2442
 		/*	There is no value existing for this value	*/
2443 2443
 		if (empty($attribute_select_options_list)) :
2444
-			$ouput['more_input'].=__('Nothing found for this field', 'wpshop');
2444
+			$ouput['more_input'] .= __('Nothing found for this field', 'wpshop');
2445 2445
 		else:
2446 2446
 			/*	Add a default value to the combobox list	*/
2447 2447
 			$default_value_is_serial = false;
2448 2448
 			$attribute_list_first_element = $attribute->default_value;
2449
-			if ( !empty($attribute->default_value) && ($attribute->default_value == serialize(false) || wpshop_tools::is_serialized( $attribute->default_value ) ) ) {
2449
+			if (!empty($attribute->default_value) && ($attribute->default_value == serialize(false) || wpshop_tools::is_serialized($attribute->default_value))) {
2450 2450
 				$default_value_is_serial = true;
2451 2451
 				$tmp_default_value = unserialize($attribute->default_value);
2452 2452
 				$attribute_list_first_element = $tmp_default_value["field_options"]["label_for_first_item"];
2453 2453
 			}
2454 2454
 			//if ( !in_array($attribute->frontend_input, array('radio', 'checkbox')) || ($attribute_list_first_element != 'none') ) $ouput['possible_value'][] = ($default_value_is_serial && !empty($attribute_list_first_element)) ? $attribute_list_first_element : __('Choose a value', 'wpshop');
2455
-			foreach ( $attribute_select_options_list as $option_key => $option_value ) {
2455
+			foreach ($attribute_select_options_list as $option_key => $option_value) {
2456 2456
 				$ouput['possible_value'][$option_key] = stripslashes($option_value);
2457 2457
 			}
2458 2458
 		endif;
2459 2459
 
2460 2460
 		/*	Add a extra element to create a new element into list	*/
2461
-		if ( is_admin()  && ( empty($provenance['from']) || ($provenance['from'] != 'frontend')) ) {
2461
+		if (is_admin() && (empty($provenance['from']) || ($provenance['from'] != 'frontend'))) {
2462 2462
 			/**	$ouput['more_input'] .= '<img src="'.WPSHOP_MEDIAS_ICON_URL.'add.png" id="new_value_pict_' . $attribute->code . '" alt="'.__('Add a new value for this attribute', 'wpshop').'" title="'.__('Add a new value for this attribute', 'wpshop').'" class="wpshop_icons wpshop_icons_add_new_value_to_option_list wpshop_icons_add_new_value_to_option_list_'.$attribute->code.'" />';	*/
2463 2463
 		}
2464
-		else if ( 'yes' == $attribute->is_used_in_quick_add_form ) {
2464
+		else if ('yes' == $attribute->is_used_in_quick_add_form) {
2465 2465
 			$tpl_component = array();
2466 2466
 			$tpl_component['NEW_ELEMENT_CREATION_FIELD'] = 'attribute[new_value_creation][' . $attribute->code . ']';
2467 2467
 			$ouput['more_input'] .= wpshop_display::display_template_element('quick_entity_specific_field_new_element', $tpl_component);
@@ -2470,11 +2470,11 @@  discard block
 block discarded – undo
2470 2470
 		return $ouput;
2471 2471
 	}
2472 2472
 
2473
-	public static function get_affected_value_for_list( $attribute_code, $element_id, $attribute_data_type ) {
2473
+	public static function get_affected_value_for_list($attribute_code, $element_id, $attribute_data_type) {
2474 2474
 		global $wpdb;
2475 2475
 		$affected_value = array();
2476 2476
 
2477
-		if ( $attribute_data_type == 'custom' ) {
2477
+		if ($attribute_data_type == 'custom') {
2478 2478
 			$query = $wpdb->prepare("
2479 2479
 SELECT ATT_SELECT_OPTIONS_VALUE.id AS chosen_val, ATT_SELECT_OPTIONS_VALUE.value
2480 2480
 FROM " . WPSHOP_DBT_ATTRIBUTE . " AS ATT
@@ -2496,20 +2496,20 @@  discard block
 block discarded – undo
2496 2496
 		}
2497 2497
 
2498 2498
 		$attribute_values_for_variations = $wpdb->get_results($query);
2499
-		foreach ( $attribute_values_for_variations as $attribute_def ) {
2500
-			$affected_value[] = (int) $attribute_def->chosen_val;
2499
+		foreach ($attribute_values_for_variations as $attribute_def) {
2500
+			$affected_value[] = (int)$attribute_def->chosen_val;
2501 2501
 		}
2502 2502
 
2503 2503
 		return $affected_value;
2504 2504
 	}
2505 2505
 
2506 2506
 	public static function get_attribute_option_output($item, $attr_code, $attr_option, $additionnal_params = '') {
2507
-		switch($attr_code){
2507
+		switch ($attr_code) {
2508 2508
 			case 'is_downloadable_':
2509
-				$option = get_post_meta($item['item_id'], 'attribute_option_'.$attr_code, true);
2510
-				switch($attr_option){
2509
+				$option = get_post_meta($item['item_id'], 'attribute_option_' . $attr_code, true);
2510
+				switch ($attr_option) {
2511 2511
 					case 'file_url':
2512
-						if(in_array($additionnal_params['order_status'], array('completed', 'shipped')) && (!empty($item['item_'.$attr_code]) && (strtolower(__($item['item_'.$attr_code], 'wpshop')) == __('yes','wpshop'))) ){
2512
+						if (in_array($additionnal_params['order_status'], array('completed', 'shipped')) && (!empty($item['item_' . $attr_code]) && (strtolower(__($item['item_' . $attr_code], 'wpshop')) == __('yes', 'wpshop')))) {
2513 2513
 							$file_url = isset($option[$attr_option]) ? $option[$attr_option] : false;
2514 2514
 							return $file_url;
2515 2515
 						}
@@ -2522,17 +2522,17 @@  discard block
 block discarded – undo
2522 2522
 
2523 2523
 	public static function get_attribute_option_fields($postid, $code) {
2524 2524
 
2525
-		switch($code){
2525
+		switch ($code) {
2526 2526
 			case 'is_downloadable_':
2527
-				$data = get_post_meta($postid, 'attribute_option_'.$code, true);
2528
-				$data['file_url'] = !empty($data['file_url'])?$data['file_url']:__('No file selected', 'wpshop');
2529
-				$fields =  wp_nonce_field( 'ajax_wpshop_show_downloadable_interface_in_admin'.$postid, '_show_downloadable_interface_in_admin_wpnonce', true, false );
2527
+				$data = get_post_meta($postid, 'attribute_option_' . $code, true);
2528
+				$data['file_url'] = !empty($data['file_url']) ? $data['file_url'] : __('No file selected', 'wpshop');
2529
+				$fields = wp_nonce_field('ajax_wpshop_show_downloadable_interface_in_admin' . $postid, '_show_downloadable_interface_in_admin_wpnonce', true, false);
2530 2530
 				$fields .= '<div class="wpshop_form_label alignleft">&nbsp;</div>
2531 2531
 						<div class="wpshop_form_input_element alignleft">
2532
-						<div class="send_downloadable_file_dialog wpshop_add_box" data-post="'.$postid.'" title="' .__('Send the downloadable file', 'wpshop'). '"></div>
2533
-						<a data-nonce="' . wp_create_nonce( "ajax_wpshop_fill_the_downloadable_dialog".$postid ) . '"  class="send_downlodable_file wps-bton-first-mini-rounded">' .__('Send a file', 'wpshop').'</a>
2534
-						<input type="hidden" class="product_identifer_field" value="' .( !empty($postid) ? esc_attr( $postid ) : '') . '" /><br/><u>'.__('File url','wpshop').' :</u>
2535
-						<div class="is_downloadable_statut_'.$postid.'"><a href="' .$data['file_url']. '" target="_blank" download>'.basename($data['file_url']).'</a></div>
2532
+						<div class="send_downloadable_file_dialog wpshop_add_box" data-post="'.$postid . '" title="' . __('Send the downloadable file', 'wpshop') . '"></div>
2533
+						<a data-nonce="' . wp_create_nonce("ajax_wpshop_fill_the_downloadable_dialog" . $postid) . '"  class="send_downlodable_file wps-bton-first-mini-rounded">' . __('Send a file', 'wpshop') . '</a>
2534
+						<input type="hidden" class="product_identifer_field" value="' .(!empty($postid) ? esc_attr($postid) : '') . '" /><br/><u>' . __('File url', 'wpshop') . ' :</u>
2535
+						<div class="is_downloadable_statut_'.$postid . '"><a href="' . $data['file_url'] . '" target="_blank" download>' . basename($data['file_url']) . '</a></div>
2536 2536
 						</div>';
2537 2537
 				return $fields;
2538 2538
 				break;
@@ -2557,8 +2557,8 @@  discard block
 block discarded – undo
2557 2557
 		$attribute_value_content = '';
2558 2558
 
2559 2559
 		$atributes = self::getElement($attribute_code, "'valid'", 'code');
2560
-		if ( !empty($atributes) ) {
2561
-			$attribute_value_content = self::getAttributeValueForEntityInSet($atributes->data_type, $atributes->id,  wpshop_entities::get_entity_identifier_from_code($entity_type), $entity_id);
2560
+		if (!empty($atributes)) {
2561
+			$attribute_value_content = self::getAttributeValueForEntityInSet($atributes->data_type, $atributes->id, wpshop_entities::get_entity_identifier_from_code($entity_type), $entity_id);
2562 2562
 		}
2563 2563
 
2564 2564
 		return $attribute_value_content;
@@ -2570,14 +2570,14 @@  discard block
 block discarded – undo
2570 2570
 	 * @param mixed $value
2571 2571
 	 * @return string The complete interface allowing to manage datetime attribute field
2572 2572
 	 */
2573
-	function attribute_type_date_config( $value ) {
2573
+	function attribute_type_date_config($value) {
2574 2574
 		$date_config_output = '';
2575 2575
 
2576 2576
 		$input_def['name'] = 'default_value';
2577 2577
 		$input_def['type'] = 'checkbox';
2578 2578
 		$input_def['possible_value'] = 'date_of_current_day';
2579 2579
 		$input_def['value'] = !empty($value['default_value']) ? $value['default_value'] : '';
2580
-		$input_def['options_label']['custom'] = ' ' . __('Use the date of the day as default value', 'wpshop') . ' <a href="#" title="'.__('Check this box for using date of the day as value when editing a product', 'wpshop').'" class="wpshop_infobulle_marker">?</a>';
2580
+		$input_def['options_label']['custom'] = ' ' . __('Use the date of the day as default value', 'wpshop') . ' <a href="#" title="' . __('Check this box for using date of the day as value when editing a product', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>';
2581 2581
 		$date_config_output .= wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE);
2582 2582
 
2583 2583
 		$input_def = array();
@@ -2586,35 +2586,35 @@  discard block
 block discarded – undo
2586 2586
 		$input_def['type'] = 'checkbox';
2587 2587
 		$input_def['valueToPut'] = 'index';
2588 2588
 		$input_def['value'] = !empty($value['field_options']['attribute_type_date_options_day_to_show']) ? $value['field_options']['attribute_type_date_options_day_to_show'] : '';
2589
-		$input_def['possible_value'] = array('1' => ' ' . __('Monday', 'wpshop'), '2' => ' ' .__('Tuesday', 'wpshop'), '3' => ' ' .__('Wednesday', 'wpshop'), '4' => ' ' .__('Thursday', 'wpshop'), '5' => ' ' .__('Friday', 'wpshop'), '6' => ' ' .__('Saturday', 'wpshop'), '0' => ' ' .__('Sunday', 'wpshop'));
2589
+		$input_def['possible_value'] = array('1' => ' ' . __('Monday', 'wpshop'), '2' => ' ' . __('Tuesday', 'wpshop'), '3' => ' ' . __('Wednesday', 'wpshop'), '4' => ' ' . __('Thursday', 'wpshop'), '5' => ' ' . __('Friday', 'wpshop'), '6' => ' ' . __('Saturday', 'wpshop'), '0' => ' ' . __('Sunday', 'wpshop'));
2590 2590
 		$input_def['options_label']['original'] = true;
2591
-		$date_config_output .= '<div>' . __('Choose available days in date picker', 'wpshop') . '<a href="#" title="'.__('This option allows you to define the available day in final datepicker', 'wpshop').'" class="wpshop_infobulle_marker">?</a>' . '<br/>' . wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_day_to_show]') . '</div>';
2591
+		$date_config_output .= '<div>' . __('Choose available days in date picker', 'wpshop') . '<a href="#" title="' . __('This option allows you to define the available day in final datepicker', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>' . '<br/>' . wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_day_to_show]') . '</div>';
2592 2592
 
2593 2593
 		/**	Past and futur date restriction	*/
2594 2594
 		$input_def = array();
2595 2595
 		$input_def['name'] = '';
2596 2596
 		$input_def['type'] = 'text';
2597
-		$date_config_output .= '<div id="wpshop_avalaible_date_for_past_and_futur" >' . __('Calendar past and futur date available', 'wpshop') . '<a href="#" title="'.__('Define if the end user is allowed to choose past and/or futur date', 'wpshop').'" class="wpshop_infobulle_marker">?</a><br/>';
2597
+		$date_config_output .= '<div id="wpshop_avalaible_date_for_past_and_futur" >' . __('Calendar past and futur date available', 'wpshop') . '<a href="#" title="' . __('Define if the end user is allowed to choose past and/or futur date', 'wpshop') . '" class="wpshop_infobulle_marker">?</a><br/>';
2598 2598
 		$available_type_input_def = array();
2599 2599
 		$available_type_input_def['name'] = '';
2600 2600
 		$available_type_input_def['id'] = 'wpshop_attributes_edition_table_field_attribute_type_date_options_available_date_past_futur_minimum';
2601 2601
 		$available_type_input_def['type'] = 'text';
2602 2602
 		$available_type_input_def['value'] = !empty($value['field_options']['attribute_type_date_options_available_date_past_futur']['minDate'][0]) ? $value['field_options']['attribute_type_date_options_available_date_past_futur']['minDate'][0] : '';
2603
-		$date_config_output .= __('Minimum date to show', 'wpshop') . '<a href="#" title="'.__('If you want the calendar to start today put only 0, if you want to show anterior date, put the number of Day or Month or Year (ex: -1D)', 'wpshop').'" class="wpshop_infobulle_marker">?</a>' . wpshop_form::check_input_type($available_type_input_def, WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_available_date_past_futur][minDate]') . '<br/>';
2603
+		$date_config_output .= __('Minimum date to show', 'wpshop') . '<a href="#" title="' . __('If you want the calendar to start today put only 0, if you want to show anterior date, put the number of Day or Month or Year (ex: -1D)', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>' . wpshop_form::check_input_type($available_type_input_def, WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_available_date_past_futur][minDate]') . '<br/>';
2604 2604
 		$available_type_input_def = array();
2605 2605
 		$available_type_input_def['name'] = '';
2606 2606
 		$available_type_input_def['id'] = 'wpshop_attributes_edition_table_field_attribute_type_date_options_available_date_past_futur_maximum';
2607 2607
 		$available_type_input_def['type'] = 'text';
2608 2608
 		$available_type_input_def['value'] = !empty($value['field_options']['attribute_type_date_options_available_date_past_futur']['maxDate'][0]) ? $value['field_options']['attribute_type_date_options_available_date_past_futur']['maxDate'][0] : '';
2609
-		$date_config_output .= __('Maximum date to show', 'wpshop') . '<a href="#" title="'.__('If you want the calendar to end today put only 0, if you want to show date in futur, put the number of Day or Month or Year (ex: +1M)', 'wpshop').'" class="wpshop_infobulle_marker">?</a>' . wpshop_form::check_input_type($available_type_input_def, WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_available_date_past_futur][maxDate]') . '<br/>';
2609
+		$date_config_output .= __('Maximum date to show', 'wpshop') . '<a href="#" title="' . __('If you want the calendar to end today put only 0, if you want to show date in futur, put the number of Day or Month or Year (ex: +1M)', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>' . wpshop_form::check_input_type($available_type_input_def, WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_available_date_past_futur][maxDate]') . '<br/>';
2610 2610
 		$date_config_output .= '</div>';
2611 2611
 
2612 2612
 		$input_def = array();
2613 2613
 		$input_def['name'] = '';
2614 2614
 		$input_def['type'] = 'text';
2615 2615
 		$date_config_output .= '
2616
-<div id="wpshop_attribute_date_empy_field" class="wpshopHide" ><br/>' . wpshop_form::check_input_type(array_merge($input_def, array('value' => '', 'id' => 'wpshop_attributes_edition_table_field_attribute_type_date_options_available_date_new_input')), WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_available_date]') .'</div>
2617
-<div id="wpshop_avalaible_date_list_container" >' . __('Choose available date in date picker', 'wpshop') . '<a href="#" title="'.__('This option allows you to define the available date in final datepicker', 'wpshop').'" class="wpshop_infobulle_marker">?</a><br/>';
2616
+<div id="wpshop_attribute_date_empy_field" class="wpshopHide" ><br/>' . wpshop_form::check_input_type(array_merge($input_def, array('value' => '', 'id' => 'wpshop_attributes_edition_table_field_attribute_type_date_options_available_date_new_input')), WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_available_date]') . '</div>
2617
+<div id="wpshop_avalaible_date_list_container" >' . __('Choose available date in date picker', 'wpshop') . '<a href="#" title="' . __('This option allows you to define the available date in final datepicker', 'wpshop') . '" class="wpshop_infobulle_marker">?</a><br/>';
2618 2618
 
2619 2619
 		$available_type_input_def = array();
2620 2620
 		$available_type_input_def['name'] = '';
@@ -2627,9 +2627,9 @@  discard block
 block discarded – undo
2627 2627
 		$date_config_output .= wpshop_form::check_input_type($available_type_input_def, WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_available_date_type]') . '<br/>';
2628 2628
 
2629 2629
 		$existing = 0;
2630
-		if ( !empty($value['field_options']['attribute_type_date_options_available_date']) ) {
2631
-			foreach ( $value['field_options']['attribute_type_date_options_available_date'] as $index => $value ) {
2632
-				if ( !empty($value) ) {
2630
+		if (!empty($value['field_options']['attribute_type_date_options_available_date'])) {
2631
+			foreach ($value['field_options']['attribute_type_date_options_available_date'] as $index => $value) {
2632
+				if (!empty($value)) {
2633 2633
 					$input_def['value'] = $value;
2634 2634
 					$input_def['id'] = 'wpshop_attributes_edition_table_field_attribute_type_date_options_available_date_' . $index;
2635 2635
 					$date_config_output .= wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_available_date]') . '<br/>';
@@ -2653,20 +2653,20 @@  discard block
 block discarded – undo
2653 2653
 	 * @param array $values Valeurs d'attributs
2654 2654
 	 * @return array
2655 2655
 	 */
2656
-	public static function setAttributesValuesForItem($entityId, $values=array(), $defaultValueForOthers=false, $from = 'webservice') {
2657
-		$message='';
2656
+	public static function setAttributesValuesForItem($entityId, $values = array(), $defaultValueForOthers = false, $from = 'webservice') {
2657
+		$message = '';
2658 2658
 		$attribute_available = array();
2659 2659
 		$attribute_final = array();
2660 2660
 		$entity_type = get_post_type($entityId);
2661
-		$data = self::get_attribute_list_for_item( wpshop_entities::get_entity_identifier_from_code($entity_type), $entityId, WPSHOP_CURRENT_LOCALE);
2662
-		foreach($data as $d) $attribute_available[$d->attribute_code] = array('attribute_id' => $d->attribute_id, 'data_type' => $d->data_type);
2661
+		$data = self::get_attribute_list_for_item(wpshop_entities::get_entity_identifier_from_code($entity_type), $entityId, WPSHOP_CURRENT_LOCALE);
2662
+		foreach ($data as $d) $attribute_available[$d->attribute_code] = array('attribute_id' => $d->attribute_id, 'data_type' => $d->data_type);
2663 2663
 
2664 2664
 		// Creation d'un array "propre" et valide pour la fonction self::saveAttributeForEntity
2665
-		foreach ( $values as $key => $value ) {
2666
-			if ( in_array( $key, array_keys( $attribute_available ) ) ) {
2665
+		foreach ($values as $key => $value) {
2666
+			if (in_array($key, array_keys($attribute_available))) {
2667 2667
 				$attribute_final[$attribute_available[$key]['data_type']][$key] = $value;
2668 2668
 			}
2669
-			else $message .= sprintf(__('Impossible to set "%s" attribute', 'wpshop'), $key)."\n";
2669
+			else $message .= sprintf(__('Impossible to set "%s" attribute', 'wpshop'), $key) . "\n";
2670 2670
 		}
2671 2671
 
2672 2672
 		// Pour les autres attributs non donné on leur affecte leur valeur par défaut
@@ -2687,7 +2687,7 @@  discard block
 block discarded – undo
2687 2687
 			}
2688 2688
 		}
2689 2689
 
2690
-		switch ( $entity_type ) {
2690
+		switch ($entity_type) {
2691 2691
 			case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT:
2692 2692
 					$meta_key = WPSHOP_PRODUCT_ATTRIBUTE_META_KEY;
2693 2693
 				break;
@@ -2717,22 +2717,22 @@  discard block
 block discarded – undo
2717 2717
 	 */
2718 2718
 	public static function get_attribute_type_select_option_info($option_id, $field = 'label', $attribute_data_type = 'custom', $only_value = false) {
2719 2719
 		global $wpdb;
2720
-		if( ! is_numeric( $option_id ) ) {
2720
+		if (!is_numeric($option_id)) {
2721 2721
 			return '';
2722 2722
 		}
2723
-		$option_id = (int) $option_id;
2724
-		switch ( $attribute_data_type ) {
2723
+		$option_id = (int)$option_id;
2724
+		switch ($attribute_data_type) {
2725 2725
 			case 'internal':
2726 2726
 				$entity_infos = get_post($option_id);
2727
-				if ( !empty($entity_infos) ) {
2728
-					if ( !$only_value ) {
2727
+				if (!empty($entity_infos)) {
2728
+					if (!$only_value) {
2729 2729
 						/** Template parameters */
2730 2730
 						$template_part = 'product_attribute_value_internal';
2731 2731
 						$tpl_component = array();
2732 2732
 						$tpl_component['ATTRIBUTE_VALUE_POST_LINK'] = get_permalink($option_id);
2733 2733
 						$tpl_component['ATTRIBUTE_VALUE_POST_TITLE'] = $entity_infos->post_title;
2734 2734
 
2735
-						foreach ( $entity_infos as $post_definition_key => $post_definition_value ) {
2735
+						foreach ($entity_infos as $post_definition_key => $post_definition_value) {
2736 2736
 							$tpl_component['ATTRIBUTE_VALUE_' . strtoupper($post_definition_key)] = $entity_infos->$post_definition_key;
2737 2737
 						}
2738 2738
 
@@ -2747,8 +2747,8 @@  discard block
 block discarded – undo
2747 2747
 				break;
2748 2748
 
2749 2749
 			default:
2750
-				if ( ! array_key_exists( $option_id, self::$select_option_info_cache ) ) {
2751
-					$query = $wpdb->prepare("SELECT " . $field . " FROM ".WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS." WHERE id=%d LIMIT 1", $option_id);
2750
+				if (!array_key_exists($option_id, self::$select_option_info_cache)) {
2751
+					$query = $wpdb->prepare("SELECT " . $field . " FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . " WHERE id=%d LIMIT 1", $option_id);
2752 2752
 					self::$select_option_info_cache[$option_id] = $wpdb->get_var($query);
2753 2753
 				}
2754 2754
 				$info = self::$select_option_info_cache[$option_id];
@@ -2788,39 +2788,39 @@  discard block
 block discarded – undo
2788 2788
 	 * @param string $data_type optionnal Le type de donnees choisi pour cet attribut (custom | internal)
2789 2789
 	 * @return string Le resultat sous forme de code html pour la liste des options
2790 2790
 	 */
2791
-	function get_select_options_list($attribute_id, $data_type='custom') {
2791
+	function get_select_options_list($attribute_id, $data_type = 'custom') {
2792 2792
 		global $wpdb;
2793 2793
 		$output = '';
2794 2794
 
2795 2795
 		$attribute_select_options = self::get_select_option_list_($attribute_id);
2796 2796
 
2797 2797
 		/*	Add possibily to choose datat type to use with list	*/
2798
-		if(empty($attribute_id) || (!empty($attribute_select_options) && empty($attribute_select_options[0]->data_type_to_use))){
2799
-			unset($input_def);$input_def=array();
2798
+		if (empty($attribute_id) || (!empty($attribute_select_options) && empty($attribute_select_options[0]->data_type_to_use))) {
2799
+			unset($input_def); $input_def = array();
2800 2800
 			$input_def['label'] = __('Type of data for list', 'wpshop');
2801 2801
 			$input_def['type'] = 'radio';
2802 2802
 			$input_def['name'] = 'data_type_to_use';
2803 2803
 			$input_def['valueToPut'] = 'index';
2804 2804
 			$input_def['possible_value'] = unserialize(WPSHOP_ATTR_SELECT_TYPE);
2805 2805
 			$input_def['option'] = 'class="wpshop_cls wpshop_attr_combo_data_type"';
2806
-			$input_def['value'] = $data_type.'_data';
2806
+			$input_def['value'] = $data_type . '_data';
2807 2807
 			$input_def['options_label']['original'] = true;
2808 2808
 			$output = wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE);
2809 2809
 		}
2810 2810
 
2811
-		if(!empty($attribute_id) || !empty($data_type)){
2812
-			$defaut_value = ( !empty($attribute_select_options[0]) && !empty($attribute_select_options[0]->default_value) ) ? $attribute_select_options[0]->default_value : null;
2811
+		if (!empty($attribute_id) || !empty($data_type)) {
2812
+			$defaut_value = (!empty($attribute_select_options[0]) && !empty($attribute_select_options[0]->default_value)) ? $attribute_select_options[0]->default_value : null;
2813 2813
 			$default_is_serial = false;
2814
-			if ( !empty($attribute_select_options[0]->default_value) && ($attribute_select_options[0]->default_value == serialize(false) || wpshop_tools::is_serialized( $attribute_select_options[0]->default_value ) ) ) {
2814
+			if (!empty($attribute_select_options[0]->default_value) && ($attribute_select_options[0]->default_value == serialize(false) || wpshop_tools::is_serialized($attribute_select_options[0]->default_value))) {
2815 2815
 				$defaut_value = unserialize($attribute_select_options[0]->default_value);
2816 2816
 				$default_is_serial = true;
2817 2817
 			}
2818 2818
 			/**	Add a custom text first item of list	*/
2819
-			$output .= '<div class="wpshop_cls" ><label for="text_for_empty_value" >' . __('Text displayed when no value selected', 'wpshop') . '</label> <input type="text" name="' . WPSHOP_DBT_ATTRIBUTE . '[default_value][field_options][label_for_first_item]" value="' . (($default_is_serial && is_array($defaut_value) && !empty($defaut_value["field_options"]["label_for_first_item"])) ? stripslashes( $defaut_value["field_options"]["label_for_first_item"] ) : __('Choose a value', 'wpshop')) . '" id="text_for_empty_value" /></div>';
2819
+			$output .= '<div class="wpshop_cls" ><label for="text_for_empty_value" >' . __('Text displayed when no value selected', 'wpshop') . '</label> <input type="text" name="' . WPSHOP_DBT_ATTRIBUTE . '[default_value][field_options][label_for_first_item]" value="' . (($default_is_serial && is_array($defaut_value) && !empty($defaut_value["field_options"]["label_for_first_item"])) ? stripslashes($defaut_value["field_options"]["label_for_first_item"]) : __('Choose a value', 'wpshop')) . '" id="text_for_empty_value" /></div>';
2820 2820
 
2821
-			if((($data_type == 'custom') && empty($attribute_select_options)) || (!empty($attribute_select_options) && !empty($attribute_select_options[0]->data_type_to_use) && ($attribute_select_options[0]->data_type_to_use == 'custom'))){
2821
+			if ((($data_type == 'custom') && empty($attribute_select_options)) || (!empty($attribute_select_options) && !empty($attribute_select_options[0]->data_type_to_use) && ($attribute_select_options[0]->data_type_to_use == 'custom'))) {
2822 2822
 				$sub_output = '';
2823
-				if ( !empty($attribute_select_options) && !empty($attribute_select_options[0]) && !empty($attribute_select_options[0]->id) ) {
2823
+				if (!empty($attribute_select_options) && !empty($attribute_select_options[0]) && !empty($attribute_select_options[0]->id)) {
2824 2824
 					$sub_output .= '
2825 2825
 					<li class="wpshop_attribute_combo_options_container ui-state-disabled" >
2826 2826
 						<input type="radio" name="' . WPSHOP_DBT_ATTRIBUTE . '[default_value][default_value]" value="" id="default_value_empty" ' . (($default_is_serial && is_array($defaut_value) && empty($defaut_value["default_value"])) || empty($defaut_value) ? 'checked ' : '') . '/> <label for="default_value_empty">' . __('No default value', 'wpshop') . '</label>
@@ -2833,7 +2833,7 @@  discard block
 block discarded – undo
2833 2833
 						$tpl_component['ADMIN_ATTRIBUTE_VALUES_OPTION_VALUE'] = str_replace(".", ",", $options->value);
2834 2834
 						$tpl_component['ADMIN_ATTRIBUTE_VALUES_OPTION_STATE'] = (!empty($options->id) && (($default_is_serial && is_array($defaut_value) && !empty($defaut_value["default_value"]) && ($defaut_value["default_value"] == $options->id))) ? ' checked="checked"' : '');
2835 2835
 						$tpl_component['ADMIN_ATTRIBUTE_VALUE_OPTIN_ACTIONS'] = '';
2836
-						if( current_user_can('wpshop_delete_attributes_select_values') && ($options->value_id >= 0) ):
2836
+						if (current_user_can('wpshop_delete_attributes_select_values') && ($options->value_id >= 0)):
2837 2837
 							$tpl_component['ADMIN_ATTRIBUTE_VALUE_OPTIN_ACTIONS'] .= wpshop_display::display_template_element('wpshop_admin_attr_option_value_item_deletion', $tpl_component, array('type' => WPSHOP_DBT_ATTRIBUTE, 'id' => $attribute_id), 'admin');
2838 2838
 						endif;
2839 2839
 						$sub_output .= wpshop_display::display_template_element('wpshop_admin_attr_option_value_item', $tpl_component, array('type' => WPSHOP_DBT_ATTRIBUTE, 'id' => $attribute_id), 'admin');
@@ -2841,13 +2841,13 @@  discard block
 block discarded – undo
2841 2841
 					}
2842 2842
 				}
2843 2843
 				$add_button = $add_dialog_box = $user_more_script = '';
2844
-				if( current_user_can('wpshop_add_attributes_select_values') ) {
2844
+				if (current_user_can('wpshop_add_attributes_select_values')) {
2845 2845
 
2846 2846
 					$dialog_title = __('New value for attribute', 'wpshop');
2847 2847
 					$dialog_identifier = 'wpshop_new_attribute_option_value_add';
2848 2848
 					$dialog_input_identifier = 'wpshop_new_attribute_option_value';
2849 2849
 					ob_start();
2850
-					include(WPSHOP_TEMPLATES_DIR.'admin/add_new_element_dialog.tpl.php');
2850
+					include(WPSHOP_TEMPLATES_DIR . 'admin/add_new_element_dialog.tpl.php');
2851 2851
 					$add_dialog_box = ob_get_contents();
2852 2852
 					ob_end_clean();
2853 2853
 
@@ -2855,23 +2855,23 @@  discard block
 block discarded – undo
2855 2855
 					$add_button_parent_class = 'wpshop_attribute_option_value_add';
2856 2856
 					$add_button_name = 'wpshop_add_option_to_select';
2857 2857
 					ob_start();
2858
-					include(WPSHOP_TEMPLATES_DIR.'admin/add_new_element_with_dialog.tpl.php');
2858
+					include(WPSHOP_TEMPLATES_DIR . 'admin/add_new_element_with_dialog.tpl.php');
2859 2859
 					$add_button = ob_get_contents();
2860 2860
 					ob_end_clean();
2861 2861
 
2862 2862
 					$user_more_script = '
2863
-			jQuery("#'.$dialog_identifier.'").dialog({
2863
+			jQuery("#'.$dialog_identifier . '").dialog({
2864 2864
 				modal: true,
2865 2865
 				dialogClass: "wpshop_uidialog_box",
2866 2866
 				autoOpen:false,
2867 2867
 				show: "blind",
2868 2868
 				resizable: false,
2869 2869
 				buttons:{
2870
-					"'.__('Add', 'wpshop').'": function(){
2870
+					"'.__('Add', 'wpshop') . '": function(){
2871 2871
 						var data = {
2872 2872
 							action: "new_option_for_select",
2873 2873
 							wpshop_ajax_nonce: "' . wp_create_nonce("wpshop_new_option_for_attribute_creation") . '",
2874
-							attribute_new_label: jQuery("#'.$dialog_input_identifier.'").val(),
2874
+							attribute_new_label: jQuery("#'.$dialog_input_identifier . '").val(),
2875 2875
 							attribute_identifier: "' . $attribute_id . '"
2876 2876
 						};
2877 2877
 						jQuery.post(ajaxurl, data, function(response) {
@@ -2887,21 +2887,21 @@  discard block
 block discarded – undo
2887 2887
 
2888 2888
 						jQuery(this).children("img").show();
2889 2889
 					},
2890
-					"'.__('Cancel', 'wpshop').'": function(){
2890
+					"'.__('Cancel', 'wpshop') . '": function(){
2891 2891
 						jQuery(this).dialog("close");
2892 2892
 					}
2893 2893
 				},
2894 2894
 				close:function(){
2895
-					jQuery("#'.$dialog_input_identifier.'").val("");
2895
+					jQuery("#'.$dialog_input_identifier . '").val("");
2896 2896
 				}
2897 2897
 			});
2898
-			jQuery(".'.$add_button_parent_class.' input").click(function(){
2899
-				jQuery("#'.$dialog_identifier.'").dialog("open");
2898
+			jQuery(".'.$add_button_parent_class . ' input").click(function(){
2899
+				jQuery("#'.$dialog_identifier . '").dialog("open");
2900 2900
 			});';
2901 2901
 
2902 2902
 				}
2903 2903
 				$output .= $add_dialog_box . '
2904
-	<ul id="sortable_attribute" class="wpshop_cls" >'.(count($attribute_select_options)>5 ? $add_button : '').$sub_output.$add_button.'
2904
+	<ul id="sortable_attribute" class="wpshop_cls" >'.(count($attribute_select_options) > 5 ? $add_button : '') . $sub_output . $add_button . '
2905 2905
 	</ul>
2906 2906
 	<input type="hidden" value="' . wp_create_nonce("wpshop_new_option_for_attribute_deletion") . '" name="wpshop_new_option_for_attribute_deletion_nonce" id="wpshop_new_option_for_attribute_deletion_nonce" />
2907 2907
 	<script type="text/javascript" >
@@ -2917,7 +2917,7 @@  discard block
 block discarded – undo
2917 2917
 					var data = {
2918 2918
 						action: "attribute_output_type",
2919 2919
 						current_type: jQuery("#wpshop_attributes_edition_table_field_id_frontend_input").val(),
2920
-						elementIdentifier: "'.$attribute_id.'",
2920
+						elementIdentifier: "'.$attribute_id . '",
2921 2921
 						data_type_to_use: jQuery(this).val(),
2922 2922
 						wpshop_ajax_nonce: "' . wp_create_nonce("wpshop_attribute_output_type_selection") . '"
2923 2923
 					};
@@ -2932,10 +2932,10 @@  discard block
 block discarded – undo
2932 2932
 		});
2933 2933
 	</script>';
2934 2934
 			}
2935
-			elseif((($data_type == 'internal') && empty($attribute_select_options)) || (!empty($attribute_select_options) && !empty($attribute_select_options[0]->data_type_to_use) && ($attribute_select_options[0]->data_type_to_use == 'internal'))){
2936
-				$sub_output='';
2935
+			elseif ((($data_type == 'internal') && empty($attribute_select_options)) || (!empty($attribute_select_options) && !empty($attribute_select_options[0]->data_type_to_use) && ($attribute_select_options[0]->data_type_to_use == 'internal'))) {
2936
+				$sub_output = '';
2937 2937
 				$wp_types = unserialize(WPSHOP_INTERNAL_TYPES);
2938
-				unset($input_def);$input_def=array();
2938
+				unset($input_def); $input_def = array();
2939 2939
 				$input_def['label'] = __('Type of data for list', 'wpshop');
2940 2940
 				$input_def['type'] = 'select';
2941 2941
 				$input_def['name'] = 'default_value][default_value';
@@ -2944,20 +2944,20 @@  discard block
 block discarded – undo
2944 2944
 				$input_def['possible_value'] = $wp_types;
2945 2945
 				$input_def['value'] = (($default_is_serial && is_array($defaut_value) && !empty($defaut_value["default_value"])) ? $defaut_value["default_value"] : (!empty($defaut_value) ? $defaut_value : null));
2946 2946
 				$combo_wp_type = wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE);
2947
-				$output .= '<div class="wpshop_cls">'.$combo_wp_type.'</div>';
2948
-				if ( !empty($attribute_id) ) {
2947
+				$output .= '<div class="wpshop_cls">' . $combo_wp_type . '</div>';
2948
+				if (!empty($attribute_id)) {
2949 2949
 					$option_list = '<div>' . __('You can reorder element for display them in the order you want into frontend part', 'wpshop') . '</div>';
2950
-					$options_for_current_attribute = query_posts( array('post_type' => $input_def['value'], 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC' ) );
2951
-					if ( !empty($options_for_current_attribute) ) {
2950
+					$options_for_current_attribute = query_posts(array('post_type' => $input_def['value'], 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC'));
2951
+					if (!empty($options_for_current_attribute)) {
2952 2952
 						$option_list .= '<ul class="wpshop_attribute_combo_values_list_container" >';
2953 2953
 						$current_order = ' ';
2954
-						foreach ( $options_for_current_attribute as $options_def ) {
2954
+						foreach ($options_for_current_attribute as $options_def) {
2955 2955
 							$current_order .= 'post_' . $options_def->ID . ',';
2956 2956
 							$option_list .= '<li id="post_' . $options_def->ID . '" class="wpshop_attribute_combo_values_list_item wpshop_attribute_combo_values_list_item_' . $options_def->ID . '" ><span class="wpshop_internal_value_for_option_list_identifier" >#' . $options_def->ID . '</span> ' . $options_def->post_title . '</li>';
2957 2957
 						}
2958 2958
 						$option_list .= '</ul><input type="hidden" value="' . substr($current_order, 0, -1) . '" name="' . WPSHOP_DBT_ATTRIBUTE . '[wpshop_attribute_combo_values_list_order_def]" id="wpshop_attribute_combo_values_list_order_def" />';
2959 2959
 					}
2960
-					$output .= '<div class="wpshop_cls">'.$option_list.'</div>';
2960
+					$output .= '<div class="wpshop_cls">' . $option_list . '</div>';
2961 2961
 				}
2962 2962
 			}
2963 2963
 		}
@@ -2985,8 +2985,8 @@  discard block
 block discarded – undo
2985 2985
 		$attribute_list_for_entity = self::getElement($entity_id, "'valid'", 'entity_id', true);
2986 2986
 
2987 2987
 		/*	Read the list	*/
2988
-		if ( !empty ($attribute_list_for_entity ) ) {
2989
-			foreach ( $attribute_list_for_entity as $attribute) {
2988
+		if (!empty ($attribute_list_for_entity)) {
2989
+			foreach ($attribute_list_for_entity as $attribute) {
2990 2990
 				switch ($list_for) {
2991 2991
 					case 'attribute_value':
2992 2992
 							$checkbox_state = ' ';
@@ -2995,8 +2995,8 @@  discard block
 block discarded – undo
2995 2995
 								<select id="wpshop_shortcode_element_attribute_value_product_list_' . $attribute->id . '" class="wpshop_shortcode_element_attribute_value_product_list" >';
2996 2996
 
2997 2997
 							global $post;
2998
-							$posts = get_posts( array('post_type' => WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'numberposts' => -1) );
2999
-							foreach( $posts as $post ) :
2998
+							$posts = get_posts(array('post_type' => WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'numberposts' => -1));
2999
+							foreach ($posts as $post) :
3000 3000
 								setup_postdata($post);
3001 3001
 								$attribute_possible_values .= '<option value="' . get_the_ID() . '" >' . get_the_ID() . ' - ' . get_the_title() . '</option>';
3002 3002
 							endforeach;
@@ -3012,23 +3012,23 @@  discard block
 block discarded – undo
3012 3012
 
3013 3013
 						$checkbox_state = 'disabled ';
3014 3014
 						$attribute_possible_values = '';
3015
-						if ( !empty($attribute_values) ) {
3015
+						if (!empty($attribute_values)) {
3016 3016
 							$checkbox_state = '';
3017 3017
 							$attribute_possible_values = '
3018 3018
 							<div class="wpshop_shortcode_element_product_listing_per_attribute_value wpshop_shortcode_element_prodcut_listing_per_attribute_value_' . $attribute->code . '_container" >
3019 3019
 								<select id="wpshop_attribute_value_for_shortcode_generation_' . $attribute->id . '" class="wpshop_shortcode_element_prodcut_listing_per_attribute_value hidden" >';
3020 3020
 
3021
-								if ( ($attribute->data_type == 'integer') && ( ($attribute->backend_input == 'select') || ($attribute->backend_input == 'multiple-select') ) ) {
3021
+								if (($attribute->data_type == 'integer') && (($attribute->backend_input == 'select') || ($attribute->backend_input == 'multiple-select'))) {
3022 3022
 									$query = $wpdb->prepare("SELECT * FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . " WHERE attribute_id=%d ORDER BY position", $attribute->id);
3023 3023
 									$possible_values = $wpdb->get_results($query);
3024 3024
 									$already_selected_values = array();
3025 3025
 									foreach ($attribute_values as $attribute_value) {
3026
-										if ( !empty($attribute_value->value) ) {
3026
+										if (!empty($attribute_value->value)) {
3027 3027
 											$already_selected_values[] = $attribute_value->value;
3028 3028
 										}
3029 3029
 									}
3030 3030
 									foreach ($possible_values as $value) {
3031
-										if ( in_array( $value->id, $already_selected_values ) ) {
3031
+										if (in_array($value->id, $already_selected_values)) {
3032 3032
 											$attribute_possible_values .= '
3033 3033
 									<option value="' . $value->value . '" >' . $value->label . '</option>';
3034 3034
 										}
@@ -3036,7 +3036,7 @@  discard block
 block discarded – undo
3036 3036
 								}
3037 3037
 								else {
3038 3038
 									foreach ($attribute_values as $attribute_value) {
3039
-										if ( !empty($attribute_value->value) ) {
3039
+										if (!empty($attribute_value->value)) {
3040 3040
 											$attribute_possible_values .= '
3041 3041
 									<option value="' . $attribute_value->value . '" >' . $attribute_value->value . '</option>';
3042 3042
 										}
@@ -3065,23 +3065,23 @@  discard block
 block discarded – undo
3065 3065
 	 *
3066 3066
 	 * @return object The attribute list as a wordpress database object
3067 3067
 	 */
3068
-	function get_attribute_list_in_same_set_section( $attribute_code ) {
3068
+	function get_attribute_list_in_same_set_section($attribute_code) {
3069 3069
 		global $wpdb;
3070 3070
 
3071 3071
 		$attribute_def = wpshop_attributes::getElement($attribute_code, "'valid'", 'code');
3072 3072
 
3073 3073
 		/** Get the entire list of attribute in price set section for display	*/
3074
-		$query = $wpdb->prepare( "SELECT entity_type_id, attribute_set_id, attribute_group_id FROM " . WPSHOP_DBT_ATTRIBUTE_DETAILS . " WHERE attribute_id = %d AND status = 'valid'", $attribute_def->id);
3074
+		$query = $wpdb->prepare("SELECT entity_type_id, attribute_set_id, attribute_group_id FROM " . WPSHOP_DBT_ATTRIBUTE_DETAILS . " WHERE attribute_id = %d AND status = 'valid'", $attribute_def->id);
3075 3075
 		$attribute_attribution_def = $wpdb->get_row($query);
3076 3076
 
3077
-		$query = $wpdb->prepare( "
3077
+		$query = $wpdb->prepare("
3078 3078
 							SELECT ATTR.code, is_visible_in_front_listing, is_visible_in_front
3079 3079
 							FROM " . WPSHOP_DBT_ATTRIBUTE_DETAILS . " AS SET_SECTION_DETAIL
3080 3080
 								INNER JOIN " . WPSHOP_DBT_ATTRIBUTE . " AS ATTR ON (ATTR.id = SET_SECTION_DETAIL.attribute_id)
3081 3081
 							WHERE entity_type_id = %d
3082 3082
 								AND attribute_set_id = %d
3083 3083
 								AND attribute_group_id = %d",
3084
-				$attribute_attribution_def->entity_type_id, $attribute_attribution_def->attribute_set_id, $attribute_attribution_def->attribute_group_id );
3084
+				$attribute_attribution_def->entity_type_id, $attribute_attribution_def->attribute_set_id, $attribute_attribution_def->attribute_group_id);
3085 3085
 		$atribute_list = $wpdb->get_results($query);
3086 3086
 
3087 3087
 		return $atribute_list;
@@ -3092,7 +3092,7 @@  discard block
 block discarded – undo
3092 3092
 	 * @param unknown_type $current_entity_id
3093 3093
 	 * @return Ambigous <multitype:, multitype:NULL >
3094 3094
 	 */
3095
-	public static function get_variation_available_attribute( $current_entity_id ) {
3095
+	public static function get_variation_available_attribute($current_entity_id) {
3096 3096
 		global $wpdb;
3097 3097
 		$final_list = array();
3098 3098
 
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
 		$query = $wpdb->prepare(
3101 3101
 				"SELECT ATT.*, ENTITY_META.meta_value
3102 3102
 				FROM " . self::getDbTable() . " AS ATT
3103
-					INNER JOIN " . WPSHOP_DBT_ATTRIBUTE_DETAILS. " AS ATT_DETAILS ON ((ATT_DETAILS.attribute_id = ATT.id) AND (ATT_DETAILS.entity_type_id = %d) AND (ATT_DETAILS.status = 'valid'))
3103
+					INNER JOIN " . WPSHOP_DBT_ATTRIBUTE_DETAILS . " AS ATT_DETAILS ON ((ATT_DETAILS.attribute_id = ATT.id) AND (ATT_DETAILS.entity_type_id = %d) AND (ATT_DETAILS.status = 'valid'))
3104 3104
 					INNER JOIN " . $wpdb->postmeta . " AS ENTITY_META ON ((ENTITY_META.meta_key = %s) AND (ENTITY_META.meta_value = ATT_DETAILS.attribute_set_id))
3105 3105
 				WHERE ATT.status IN ('valid')
3106 3106
 					AND ATT.is_used_for_variation = %s
@@ -3110,10 +3110,10 @@  discard block
 block discarded – undo
3110 3110
 		);
3111 3111
 		$attribute_list = $wpdb->get_results($query);
3112 3112
 		foreach ($attribute_list as $attribute) {
3113
-			if ( !in_array($attribute->code, unserialize(WPSHOP_VARIATION_ATTRIBUTE_TO_HIDE)) && in_array($attribute->backend_input, array('select', 'multiple-select')) ) {
3114
-				$attribute_values_for_variations = wpshop_attributes::get_affected_value_for_list( $attribute->code, $current_entity_id, $attribute->data_type_to_use );
3113
+			if (!in_array($attribute->code, unserialize(WPSHOP_VARIATION_ATTRIBUTE_TO_HIDE)) && in_array($attribute->backend_input, array('select', 'multiple-select'))) {
3114
+				$attribute_values_for_variations = wpshop_attributes::get_affected_value_for_list($attribute->code, $current_entity_id, $attribute->data_type_to_use);
3115 3115
 
3116
-				if ( empty($attribute_values_for_variations) ) {
3116
+				if (empty($attribute_values_for_variations)) {
3117 3117
 					$final_list['unavailable'][$attribute->code]['label'] = $attribute->frontend_label;
3118 3118
 					$final_list['unavailable'][$attribute->code]['values'] = array();
3119 3119
 					$final_list['unavailable'][$attribute->code]['attribute_complete_def'] = $attribute;
@@ -3133,16 +3133,16 @@  discard block
 block discarded – undo
3133 3133
 	 * @param integer $current_entity_id The current element edited
3134 3134
 	 * @return Ambigous <string, string, mixed>
3135 3135
 	 */
3136
-	public static function get_variation_available_attribute_display( $current_entity_id, $variation_type = 'multiple' ) {
3136
+	public static function get_variation_available_attribute_display($current_entity_id, $variation_type = 'multiple') {
3137 3137
 		$attribute_list = wpshop_attributes::get_variation_available_attribute($current_entity_id);
3138 3138
 
3139 3139
 		$attribute_defined_as_available_for_variation = '';
3140
-		if ( !empty($attribute_list) ) {
3140
+		if (!empty($attribute_list)) {
3141 3141
 			foreach ($attribute_list as $list_type => $attribute_list_by_type) {
3142 3142
 				$sub_attribute_list = '';
3143 3143
 				foreach ($attribute_list_by_type as $attribute_code => $attribute_def) {
3144 3144
 					$tpl_component = array();
3145
-					if ( $list_type == 'available' ) {
3145
+					if ($list_type == 'available') {
3146 3146
 						$tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_LABEL_STATE'] = '';
3147 3147
 						$tpl_component['ADMIN_VARIATIONS_DEF_LIST_ATTRIBUTE_CHECKBOX_STATE'] = '';
3148 3148
 						$tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_TO_USE_LABEL_EXPLAINATION'] = '';
@@ -3156,13 +3156,13 @@  discard block
 block discarded – undo
3156 3156
 					$tpl_component['ADMIN_ATTRIBUTE_CODE_FOR_VARIATION'] = $attribute_code;
3157 3157
 					$tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_TO_USE_NAME'] = $attribute_code;
3158 3158
 					$tpl_component['ADMIN_VARIATION_ATTRIBUTE_CONTAINER_CLASS'] = ' wpshop_attribute_for_variation_' . $attribute_code;
3159
-					$tpl_component['ADMIN_VARIATION_NEW_SINGLE_LABEL'] = __( $attribute_def['label'], 'wpshop' );
3159
+					$tpl_component['ADMIN_VARIATION_NEW_SINGLE_LABEL'] = __($attribute_def['label'], 'wpshop');
3160 3160
 					$tpl_component['ADMIN_VARIATION_NEW_SINGLE_INPUT'] = '';
3161
-					if ( $variation_type == 'single' ) {
3162
-						$attribute_output_def = wpshop_attributes::get_attribute_field_definition( $attribute_def['attribute_complete_def'], $attribute_def['values'], array('from' => 'frontend', 'field_custom_name_prefix' => 'variation_attr', 'input_class' => ' variation_attribute_usable_input') );
3163
-						if ( !empty($attribute_output_def['possible_value']) ) {
3164
-							foreach( $attribute_output_def['possible_value'] as $value_id => $value ){
3165
-								if ( !in_array($value_id, $attribute_def['values']) ) {
3161
+					if ($variation_type == 'single') {
3162
+						$attribute_output_def = wpshop_attributes::get_attribute_field_definition($attribute_def['attribute_complete_def'], $attribute_def['values'], array('from' => 'frontend', 'field_custom_name_prefix' => 'variation_attr', 'input_class' => ' variation_attribute_usable_input'));
3163
+						if (!empty($attribute_output_def['possible_value'])) {
3164
+							foreach ($attribute_output_def['possible_value'] as $value_id => $value) {
3165
+								if (!in_array($value_id, $attribute_def['values'])) {
3166 3166
 									unset($attribute_output_def['possible_value'][$value_id]);
3167 3167
 								}
3168 3168
 							}
@@ -3177,7 +3177,7 @@  discard block
 block discarded – undo
3177 3177
 			}
3178 3178
 		}
3179 3179
 
3180
-		return array($attribute_defined_as_available_for_variation, ( (!empty($attribute_list['available']) ) ? $attribute_list['available'] : ''), ( ( !empty($attribute_list['unavailable']) ) ? $attribute_list['unavailable'] : ''));
3180
+		return array($attribute_defined_as_available_for_variation, ((!empty($attribute_list['available'])) ? $attribute_list['available'] : ''), ((!empty($attribute_list['unavailable'])) ? $attribute_list['unavailable'] : ''));
3181 3181
 	}
3182 3182
 
3183 3183
 	/**
@@ -3186,18 +3186,18 @@  discard block
 block discarded – undo
3186 3186
 	 * @param array $variations_attribute_parameters Allows to give some parameters for customize list
3187 3187
 	 * @return string The output for all specific attribute in each product with option
3188 3188
 	 */
3189
-	public static function get_variation_attribute( $variations_attribute_parameters ) {
3189
+	public static function get_variation_attribute($variations_attribute_parameters) {
3190 3190
 		$output = '';
3191 3191
 
3192 3192
 		$attribute_list = wpshop_attributes::getElement('yes', "'valid'", "is_used_in_variation", true);
3193
-		if ( !empty( $attribute_list ) ) {
3193
+		if (!empty($attribute_list)) {
3194 3194
 			$tpl_component = array();
3195 3195
 			$tpl_component['ADMIN_VARIATION_DETAIL'] = '';
3196 3196
 			$price_piloting_option = get_option('wpshop_shop_price_piloting');
3197
-			foreach ( $attribute_list as $attribute_def ) {
3197
+			foreach ($attribute_list as $attribute_def) {
3198 3198
 
3199 3199
 				$variations_attribute_parameters['field_custom_name_prefix'] = $variations_attribute_parameters['field_name'] . '[attribute][' . $attribute_def->data_type . ']';
3200
-				$attribute_output_def = wpshop_attributes::get_attribute_field_definition( $attribute_def, (!empty($variations_attribute_parameters['variation_dif_values'][$attribute_def->code]) ? $variations_attribute_parameters['variation_dif_values'][$attribute_def->code] : ''), $variations_attribute_parameters );
3200
+				$attribute_output_def = wpshop_attributes::get_attribute_field_definition($attribute_def, (!empty($variations_attribute_parameters['variation_dif_values'][$attribute_def->code]) ? $variations_attribute_parameters['variation_dif_values'][$attribute_def->code] : ''), $variations_attribute_parameters);
3201 3201
 
3202 3202
 				$field_output = $attribute_output_def['output'];
3203 3203
 
@@ -3209,9 +3209,9 @@  discard block
 block discarded – undo
3209 3209
 				$sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_ID'] = $attribute_output_def['id'];
3210 3210
 				$sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_LABEL'] = $attribute_output_def['label'];
3211 3211
 				$sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_INPUT'] = $field_output;
3212
-				if( isset( $variations_attribute_parameters['post_id'] ) ) {
3213
-					$attribute_option_display = $attribute_def->backend_input=='select' && (strtolower( __(self::get_attribute_type_select_option_info($attribute_output_def['value'], 'value'), 'wpshop') ) == strtolower( __('yes', 'wpshop') )) ? '' : ' wpshopHide';
3214
-					$sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_INPUT'] .= '<div class="attribute_option_'.$attribute_def->code.''.$attribute_option_display.'">'.self::get_attribute_option_fields($variations_attribute_parameters['post_id'], $attribute_def->code).'</div>';
3212
+				if (isset($variations_attribute_parameters['post_id'])) {
3213
+					$attribute_option_display = $attribute_def->backend_input == 'select' && (strtolower(__(self::get_attribute_type_select_option_info($attribute_output_def['value'], 'value'), 'wpshop')) == strtolower(__('yes', 'wpshop'))) ? '' : ' wpshopHide';
3214
+					$sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_INPUT'] .= '<div class="attribute_option_' . $attribute_def->code . '' . $attribute_option_display . '">' . self::get_attribute_option_fields($variations_attribute_parameters['post_id'], $attribute_def->code) . '</div>';
3215 3215
 				}
3216 3216
 				$tpl_component['ADMIN_VARIATION_DETAIL'] .= wpshop_display::display_template_element('wpshop_admin_variation_item_details_line', $sub_tpl_component, array(), 'admin');
3217 3217
 				unset($sub_tpl_component);
@@ -3222,7 +3222,7 @@  discard block
 block discarded – undo
3222 3222
 		return $output;
3223 3223
 	}
3224 3224
 
3225
-	public static function get_attribute_user_defined( $use_defined_parameters, $status = "'publish'" ) {
3225
+	public static function get_attribute_user_defined($use_defined_parameters, $status = "'publish'") {
3226 3226
 		global $wpdb;
3227 3227
 		$attribute_user_defined_list = array();
3228 3228
 
@@ -3249,12 +3249,12 @@  discard block
 block discarded – undo
3249 3249
 	 * @param string $post_type The current
3250 3250
 	 *
3251 3251
 	 */
3252
-	function quick_edit( $column_name, $entity ) {
3253
-		switch ( $entity ) {
3252
+	function quick_edit($column_name, $entity) {
3253
+		switch ($entity) {
3254 3254
 			case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT:
3255 3255
 				$attribute_def = wpshop_attributes::getElement($column_name, "'valid'", 'code');
3256
-				if ( !empty($attribute_def) ) {
3257
-					$input_def = self::get_attribute_field_definition( $attribute_def, '', array('input_class' => ' wpshop_bulk_and_quick_edit_input') );
3256
+				if (!empty($attribute_def)) {
3257
+					$input_def = self::get_attribute_field_definition($attribute_def, '', array('input_class' => ' wpshop_bulk_and_quick_edit_input'));
3258 3258
 					$input = wpshop_form::check_input_type($input_def, $input_def['input_domain']);
3259 3259
 ?>
3260 3260
 	<div class="wpshop_bulk_and_quick_edit_column_container wpshop_bulk_and_quick_edit_column_<?php echo $column_name; ?>_container">
@@ -3274,12 +3274,12 @@  discard block
 block discarded – undo
3274 3274
 	 * @param string $post_type The current
3275 3275
 	 *
3276 3276
 	 */
3277
-	public static function bulk_edit( $column_name, $entity ) {
3278
-		switch ( $entity ) {
3277
+	public static function bulk_edit($column_name, $entity) {
3278
+		switch ($entity) {
3279 3279
 			case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT:
3280 3280
 				$attribute_def = wpshop_attributes::getElement($column_name, "'valid'", 'code');
3281
-				if ( !empty($attribute_def) ) {
3282
-					$input_def = self::get_attribute_field_definition( $attribute_def, '', array('input_class' => ' wpshop_bulk_and_quick_edit_input') );
3281
+				if (!empty($attribute_def)) {
3282
+					$input_def = self::get_attribute_field_definition($attribute_def, '', array('input_class' => ' wpshop_bulk_and_quick_edit_input'));
3283 3283
 					$input = wpshop_form::check_input_type($input_def, $input_def['input_domain']);
3284 3284
 ?>
3285 3285
 	<div class="wpshop_bulk_and_quick_edit_column_container wpshop_bulk_and_quick_edit_column_<?php echo $column_name; ?>_container">
Please login to merge, or discard this patch.
includes/librairies/purchase/orders.class.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
 	/** Generate the billing reference regarding the order $order_id
245 245
 	 * @return void
246
-	*/
246
+	 */
247 247
 	function order_generate_billing_number($order_id, $force_invoicing = false){
248 248
 		global $wpdb, $wpshop_modules_billing;
249 249
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 
265 265
 
266 266
 	/** Renvoi une nouvelle r�f�rence unique pour une commande
267
-	* @return int
268
-	*/
267
+	 * @return int
268
+	 */
269 269
 	public static function get_new_order_reference(){
270 270
 		$number_figures = get_option('wpshop_order_number_figures', false);
271 271
 		/* If the number doesn't exist, we create a default one */
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 	}
286 286
 
287 287
 	/** Renvoi une nouvelle r�f�rence unique pour un devis
288
-	* @return int
289
-	*/
288
+	 * @return int
289
+	 */
290 290
 	public static function get_new_pre_order_reference($save = true){
291 291
 		$number_figures = get_option('wpshop_order_number_figures', false);
292 292
 		/* If the number doesn't exist, we create a default one */
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
 	/** Set the custom colums
350 350
 	 * @return array
351
-	*/
351
+	 */
352 352
 	static function orders_edit_columns($columns){
353 353
 	  $columns = array(
354 354
 		'cb' => '<input type="checkbox" />',
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 
368 368
 	/** Give the content by column
369 369
 	 * @return array
370
-	*/
370
+	 */
371 371
 	public static function orders_custom_columns($column, $post_id) {
372 372
 		if ( get_post_type( $post_id ) == WPSHOP_NEWTYPE_IDENTIFIER_ORDER ) {
373 373
 			global $civility, $order_status;
Please login to merge, or discard this patch.
Spacing   +138 added lines, -138 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
  * Products management method file
4 4
  *
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 /*	Check if file is include. No direct access possible with file url	*/
13
-if ( !defined( 'WPSHOP_VERSION' ) ) {
14
-	die( __('Access is not allowed by this way', 'wpshop') );
13
+if (!defined('WPSHOP_VERSION')) {
14
+	die(__('Access is not allowed by this way', 'wpshop'));
15 15
 }
16 16
 
17 17
 /**
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 		/**	Add action button	*/
71 71
 		add_meta_box(
72 72
 			'wpshop_order_actions',
73
-			'<span class="dashicons dashicons-info"></span> '.__('Actions on order', 'wpshop'),
73
+			'<span class="dashicons dashicons-info"></span> ' . __('Actions on order', 'wpshop'),
74 74
 			array('wpshop_orders', 'order_actions'),
75 75
 				WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'high'
76 76
 		);
77 77
 
78
-		if ( !in_array( $post->post_status, array( 'auto-draft' ) ) ) {
78
+		if (!in_array($post->post_status, array('auto-draft'))) {
79 79
 			add_meta_box('wpshop_credit_actions', __('Credit on order', 'wpshop'), array('wps_credit', 'wps_credit_meta_box'), WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'low');
80 80
 		}
81 81
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @param object $order The current order being edited
102 102
 	 */
103
-	public static function order_actions( $order ) {
103
+	public static function order_actions($order) {
104 104
 		$output = '';
105 105
 
106 106
 		$order_status = unserialize(WPSHOP_ORDER_STATUS);
@@ -108,34 +108,34 @@  discard block
 block discarded – undo
108 108
 
109 109
 		$tpl_component = array();
110 110
 
111
-		$delete_button = wpshop_display::display_template_element('wpshop_admin_order_action_del_button', array('ADMIN_ORDER_DELETE_LINK' => esc_url( get_delete_post_link($order->ID) ) , 'ADMIN_ORDER_DELETE_TEXT' => (!EMPTY_TRASH_DAYS ? __('Delete Permanently', 'wpshop') :  __('Move to Trash', 'wpshop'))), array(), 'admin');
112
-		$tpl_component['ADMIN_ORDER_DELETE_ORDER'] = current_user_can( "delete_post", $order->ID ) ? $delete_button : '';
111
+		$delete_button = wpshop_display::display_template_element('wpshop_admin_order_action_del_button', array('ADMIN_ORDER_DELETE_LINK' => esc_url(get_delete_post_link($order->ID)), 'ADMIN_ORDER_DELETE_TEXT' => (!EMPTY_TRASH_DAYS ? __('Delete Permanently', 'wpshop') : __('Move to Trash', 'wpshop'))), array(), 'admin');
112
+		$tpl_component['ADMIN_ORDER_DELETE_ORDER'] = current_user_can("delete_post", $order->ID) ? $delete_button : '';
113 113
 
114 114
 		/**	Add an action list	*/
115 115
 		$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] = '';
116 116
 
117 117
 		/**	Display main information about the order	*/
118 118
 		$order_main_info = '';
119
-		if(!empty($order_postmeta['order_date'])){
120
-			$order_main_info .=  '<div class="wps-product-section"><span class="dashicons dashicons-calendar-alt"></span> <strong>'.__('Order date','wpshop').' : </strong><br/>'.mysql2date('d F Y H:i:s', $order_postmeta['order_date'], true).'</div>';
119
+		if (!empty($order_postmeta['order_date'])) {
120
+			$order_main_info .= '<div class="wps-product-section"><span class="dashicons dashicons-calendar-alt"></span> <strong>' . __('Order date', 'wpshop') . ' : </strong><br/>' . mysql2date('d F Y H:i:s', $order_postmeta['order_date'], true) . '</div>';
121 121
 		}
122 122
 		$order_main_info .= '<div class="wps-product-section">';
123
-		if(empty($order_postmeta['order_date']) || (empty($order_postmeta['order_key']) && empty($order_postmeta['order_temporary_key']) && empty($order_postmeta['order_invoice_ref']))){
124
-			$order_main_info .=  '<span class="dashicons dashicons-arrow-right"></span> <strong>'.__('Temporary quotation reference','wpshop').': </strong>'.self::get_new_pre_order_reference(false).'<br/>';
123
+		if (empty($order_postmeta['order_date']) || (empty($order_postmeta['order_key']) && empty($order_postmeta['order_temporary_key']) && empty($order_postmeta['order_invoice_ref']))) {
124
+			$order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Temporary quotation reference', 'wpshop') . ': </strong>' . self::get_new_pre_order_reference(false) . '<br/>';
125 125
 		}
126
-		else{
127
-			if(!empty($order_postmeta['order_key'])){
128
-				$order_main_info .=  '<span class="dashicons dashicons-arrow-right"></span> <strong>'.__('Order reference','wpshop').' : </strong>'.$order_postmeta['order_key'].'<br/>';
126
+		else {
127
+			if (!empty($order_postmeta['order_key'])) {
128
+				$order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Order reference', 'wpshop') . ' : </strong>' . $order_postmeta['order_key'] . '<br/>';
129 129
 			}
130
-			if(!empty($order_postmeta['order_temporary_key'])){
131
-				$order_main_info .=  '<span class="dashicons dashicons-arrow-right"></span> <strong>'.__('Pre-order reference','wpshop').': </strong>'.$order_postmeta['order_temporary_key'].'<br/>';
132
-				$post_ID = !empty( $_GET['post'] ) ? (int) $_GET['post'] : 0;
133
-				$order_main_info .= '<a href="' .admin_url( 'admin-post.php?action=wps_invoice&order_id=' . $post_ID . '&mode=pdf' ) . '">' .__('Download the quotation', 'wpshop'). '</a><br />';
130
+			if (!empty($order_postmeta['order_temporary_key'])) {
131
+				$order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Pre-order reference', 'wpshop') . ': </strong>' . $order_postmeta['order_temporary_key'] . '<br/>';
132
+				$post_ID = !empty($_GET['post']) ? (int)$_GET['post'] : 0;
133
+				$order_main_info .= '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $post_ID . '&mode=pdf') . '">' . __('Download the quotation', 'wpshop') . '</a><br />';
134 134
 			}
135
-			if(!empty($order_postmeta['order_invoice_ref'])){
135
+			if (!empty($order_postmeta['order_invoice_ref'])) {
136 136
 				$sub_tpl_component = array();
137
-				$order_invoice_download = '<a href="' . admin_url( 'admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $order_postmeta['order_invoice_ref'] . '&mode=pdf' ) . '">' . __('Download invoice', 'wpshop') . '</a><br />';
138
-				$order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>'. __('Invoice number','wpshop').': </strong>'.$order_postmeta['order_invoice_ref'].'<br/>' . $order_invoice_download . '';
137
+				$order_invoice_download = '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $order_postmeta['order_invoice_ref'] . '&mode=pdf') . '">' . __('Download invoice', 'wpshop') . '</a><br />';
138
+				$order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Invoice number', 'wpshop') . ': </strong>' . $order_postmeta['order_invoice_ref'] . '<br/>' . $order_invoice_download . '';
139 139
 			}
140 140
 			else {
141 141
 				$order_main_info .= wpshop_display::display_template_element('wpshop_admin_order_generate_invoice_button', array(), array(), 'admin');
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 
147 147
 		/*Add the current order status in display**/
148
-			$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= ( !empty($order_postmeta['order_status']) ) ? (sprintf('<span class="order_status_' . $order->ID . ' wpshop_order_status_container wpshop_order_status_%1$s ">%2$s</span>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop')) ) : '';
148
+			$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= (!empty($order_postmeta['order_status'])) ? (sprintf('<span class="order_status_' . $order->ID . ' wpshop_order_status_container wpshop_order_status_%1$s ">%2$s</span>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop'))) : '';
149 149
 
150 150
 			$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= $order_main_info;
151 151
 
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 			</div>';
164 164
 		}*/
165 165
 
166
-		if( ( ( !empty($order_postmeta['cart_type']) && $order_postmeta['cart_type'] == 'quotation' ) || !empty( $order_postmeta['order_temporary_key'] ) ) && in_array( $order_postmeta['order_status'], array( 'awaiting_payment', 'partially_paid' ) ) && (float) $order_postmeta['order_amount_to_pay_now'] != (float) 0 ) {
167
-			$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section">' . self::display_customer_pay_quotation( isset( $order_postmeta['pay_quotation'] ), $order->ID ) . '</div>';
166
+		if (((!empty($order_postmeta['cart_type']) && $order_postmeta['cart_type'] == 'quotation') || !empty($order_postmeta['order_temporary_key'])) && in_array($order_postmeta['order_status'], array('awaiting_payment', 'partially_paid')) && (float)$order_postmeta['order_amount_to_pay_now'] != (float)0) {
167
+			$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section">' . self::display_customer_pay_quotation(isset($order_postmeta['pay_quotation']), $order->ID) . '</div>';
168 168
 		}
169 169
 
170 170
 		/**
@@ -175,30 +175,30 @@  discard block
 block discarded – undo
175 175
 		}*/
176 176
 
177 177
 		/*Add the button regarding the order status**/
178
-		if ( !empty($order_postmeta['order_status']) ) {
179
-			if( $order_postmeta['order_status'] == 'awaiting_payment' ) {
180
-				$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section"><button class="wps-bton-second-mini-rounded markAsCanceled order_'.$order->ID.'" >'.__('Cancel this order', 'wpshop').'</button><input type="hidden" id="markascanceled_order_hidden_indicator" name="markascanceled_order_hidden_indicator" /></div>';
178
+		if (!empty($order_postmeta['order_status'])) {
179
+			if ($order_postmeta['order_status'] == 'awaiting_payment') {
180
+				$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section"><button class="wps-bton-second-mini-rounded markAsCanceled order_' . $order->ID . '" >' . __('Cancel this order', 'wpshop') . '</button><input type="hidden" id="markascanceled_order_hidden_indicator" name="markascanceled_order_hidden_indicator" /></div>';
181 181
 			}
182
-			$credit_meta = get_post_meta( $order->ID, '_wps_order_credit', true );
182
+			$credit_meta = get_post_meta($order->ID, '_wps_order_credit', true);
183 183
 
184
-			$total_received = (float) 0;
185
-			if ( ! empty( $order_postmeta['order_payment'] ) && ! empty( $order_postmeta['order_payment']['received'] ) ) {
186
-				foreach( $order_postmeta['order_payment']['received'] as $received ) {
187
-					$total_received += (float) isset( $received['received_amount'] ) ? $received['received_amount'] : 0;
184
+			$total_received = (float)0;
185
+			if (!empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['received'])) {
186
+				foreach ($order_postmeta['order_payment']['received'] as $received) {
187
+					$total_received += (float)isset($received['received_amount']) ? $received['received_amount'] : 0;
188 188
 				}
189 189
 			}
190 190
 
191
-			if ( empty($credit_meta) && (float) 0 !== $total_received ) {
192
-				if( $order_postmeta['order_status'] == 'refunded') {
193
-					$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container">' .__('Credit Slip number', 'wpshop'). ' : <strong>'. ( (!empty($order_postmeta) && !empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['refunded_action']) && !empty($order_postmeta['order_payment']['refunded_action']['credit_slip_ref']) ) ? '<a href="' .admin_url( 'admin-post.php?action=wps_invoice&order_id=' .$order->ID. '&amp;invoice_ref=' .$order_postmeta['order_payment']['refunded_action']['credit_slip_ref'].'&credit_slip=ok' ). '" target="_blank">'.$order_postmeta['order_payment']['refunded_action']['credit_slip_ref'].'</a>' : '') .'</strong></div>';
191
+			if (empty($credit_meta) && (float)0 !== $total_received) {
192
+				if ($order_postmeta['order_status'] == 'refunded') {
193
+					$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container">' . __('Credit Slip number', 'wpshop') . ' : <strong>' . ((!empty($order_postmeta) && !empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['refunded_action']) && !empty($order_postmeta['order_payment']['refunded_action']['credit_slip_ref'])) ? '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&amp;invoice_ref=' . $order_postmeta['order_payment']['refunded_action']['credit_slip_ref'] . '&credit_slip=ok') . '" target="_blank">' . $order_postmeta['order_payment']['refunded_action']['credit_slip_ref'] . '</a>' : '') . '</strong></div>';
194 194
 				}
195 195
 				else {
196
-					$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container" ><button class="wps-bton-second-mini-rounded markAsRefunded order_' .$order->ID. '">' .__('Refund this order', 'wpshop'). '</button><input type="hidden" id="markasrefunded_order_hidden_indicator" name="markasrefunded_order_hidden_indicator" /></div>';
196
+					$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container" ><button class="wps-bton-second-mini-rounded markAsRefunded order_' . $order->ID . '">' . __('Refund this order', 'wpshop') . '</button><input type="hidden" id="markasrefunded_order_hidden_indicator" name="markasrefunded_order_hidden_indicator" /></div>';
197 197
 				}
198 198
 			}
199 199
 		}
200
-		$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] = strrev( preg_replace( strrev( '/wps-product-section/' ), '', strrev( $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] ), 1 ) );
201
-		echo wpshop_display::display_template_element( 'wpshop_admin_order_action_box', $tpl_component, array( 'type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'id' => $order->ID ), 'admin' );
200
+		$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] = strrev(preg_replace(strrev('/wps-product-section/'), '', strrev($tpl_component['ADMIN_ORDER_ACTIONS_LIST']), 1));
201
+		echo wpshop_display::display_template_element('wpshop_admin_order_action_box', $tpl_component, array('type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'id' => $order->ID), 'admin');
202 202
 	}
203 203
 
204 204
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	function order_container_in_admin() {
207 207
 		global $post;
208 208
 		$output  = '<div id="wps_order_content_container">';
209
-		$output .= self::order_content( $post );
209
+		$output .= self::order_content($post);
210 210
 		$output .= '</div>';
211 211
 		echo $output;
212 212
 	}
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
 	 *
218 218
 	 * @param order $post The complete order content
219 219
 	 */
220
-	function order_content( $post ) {
220
+	function order_content($post) {
221 221
 		$order_content = '';
222 222
 
223 223
 		$order = get_post_meta($post->ID, '_order_postmeta', true);
224 224
 
225 225
 		$order_content .= '<div id="order_product_container" class="order_product_container wpshop_cls" >';
226
-		if($order){/*	Read the order content if the order has product	*/
226
+		if ($order) {/*	Read the order content if the order has product	*/
227 227
 			$order_content .= '<input type="hidden" value="" name="order_products_to_delete" id="order_products_to_delete" />' . wpshop_cart::display_cart(true, $order, 'admin');
228 228
 			if (empty($order['order_invoice_ref'])) {
229 229
 				$order_content .= '<div id="order_refresh_button_container" class="wpshop_clear_block" ><input type="button" class="button-primary alignright wpshopHide" id="wpshop_admin_order_recalculate" value="' . __('Refresh order informations', 'wpshop') . '" /></div>';
@@ -241,18 +241,18 @@  discard block
 block discarded – undo
241 241
 	/** Generate the billing reference regarding the order $order_id
242 242
 	 * @return void
243 243
 	*/
244
-	function order_generate_billing_number($order_id, $force_invoicing = false){
244
+	function order_generate_billing_number($order_id, $force_invoicing = false) {
245 245
 		global $wpdb, $wpshop_modules_billing;
246 246
 
247 247
 		// Get the order from the db
248 248
 		$order = get_post_meta($order_id, '_order_postmeta', true);
249 249
 
250 250
 		// If the payment is completed
251
-		if(($order['order_status']=='completed') || $force_invoicing) {
251
+		if (($order['order_status'] == 'completed') || $force_invoicing) {
252 252
 
253 253
 			// If the reference hasn't been generated yet
254
-			if(empty($order['order_invoice_ref'])) {
255
-				$order['order_invoice_ref'] = $wpshop_modules_billing->generate_invoice_number( $order_id );
254
+			if (empty($order['order_invoice_ref'])) {
255
+				$order['order_invoice_ref'] = $wpshop_modules_billing->generate_invoice_number($order_id);
256 256
 
257 257
 				update_post_meta($order_id, '_order_postmeta', $order);
258 258
 			}
@@ -263,45 +263,45 @@  discard block
 block discarded – undo
263 263
 	/** Renvoi une nouvelle r�f�rence unique pour une commande
264 264
 	* @return int
265 265
 	*/
266
-	public static function get_new_order_reference(){
266
+	public static function get_new_order_reference() {
267 267
 		$number_figures = get_option('wpshop_order_number_figures', false);
268 268
 		/* If the number doesn't exist, we create a default one */
269
-		if(!$number_figures){
269
+		if (!$number_figures) {
270 270
 			$number_figures = 5;
271 271
 			update_option('wpshop_order_number_figures', $number_figures);
272 272
 		}
273 273
 
274 274
 		$order_current_number = get_option('wpshop_order_current_number', false);
275 275
 		/* If the counter doesn't exist, we initiate it */
276
-		if(!$order_current_number) { $order_current_number = 1; }
276
+		if (!$order_current_number) { $order_current_number = 1; }
277 277
 		else { $order_current_number++; }
278 278
 		update_option('wpshop_order_current_number', $order_current_number);
279 279
 
280
-		$order_ref = (string)sprintf('%0'.$number_figures.'d', $order_current_number);
281
-		return WPSHOP_ORDER_REFERENCE_PREFIX.$order_ref;
280
+		$order_ref = (string)sprintf('%0' . $number_figures . 'd', $order_current_number);
281
+		return WPSHOP_ORDER_REFERENCE_PREFIX . $order_ref;
282 282
 	}
283 283
 
284 284
 	/** Renvoi une nouvelle r�f�rence unique pour un devis
285 285
 	* @return int
286 286
 	*/
287
-	public static function get_new_pre_order_reference($save = true){
287
+	public static function get_new_pre_order_reference($save = true) {
288 288
 		$number_figures = get_option('wpshop_order_number_figures', false);
289 289
 		/* If the number doesn't exist, we create a default one */
290
-		if(!$number_figures){
290
+		if (!$number_figures) {
291 291
 			$number_figures = 5;
292 292
 			update_option('wpshop_order_number_figures', $number_figures);
293 293
 		}
294 294
 
295 295
 		$order_current_number = get_option('wpshop_preorder_current_number', false);
296 296
 		/* If the counter doesn't exist, we initiate it */
297
-		if(!$order_current_number) { $order_current_number = 1; }
297
+		if (!$order_current_number) { $order_current_number = 1; }
298 298
 		else { $order_current_number++; }
299
-		if($save){
299
+		if ($save) {
300 300
 			update_option('wpshop_preorder_current_number', $order_current_number);
301 301
 		}
302 302
 
303
-		$order_ref = (string)sprintf('%0'.$number_figures.'d', $order_current_number);
304
-		return WPSHOP_PREORDER_REFERENCE_PREFIX.$order_ref;
303
+		$order_ref = (string)sprintf('%0' . $number_figures . 'd', $order_current_number);
304
+		return WPSHOP_PREORDER_REFERENCE_PREFIX . $order_ref;
305 305
 	}
306 306
 
307 307
 
@@ -316,24 +316,24 @@  discard block
 block discarded – undo
316 316
 	 *
317 317
 	 *	@return void
318 318
 	 */
319
-	public static function set_order_customer_addresses($user_id, $order_id, $shipping_address_id='', $billing_address_id=''){
319
+	public static function set_order_customer_addresses($user_id, $order_id, $shipping_address_id = '', $billing_address_id = '') {
320 320
 		/**	Get order informations	*/
321 321
 		$billing_info['id'] = get_post_meta($billing_address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true);
322
-		$billing_info['address'] = get_post_meta($billing_address_id, '_'.WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS.'_metadata', true);
323
-		$billing_info['address_id'] = ( !empty($_SESSION['billing_address']) ) ? intval( $_SESSION['billing_address'] ) : '';
324
-		if ( !empty($_SESSION['shipping_partner_id']) ) {
325
-			$partner_address_id = get_post_meta( $_SESSION['shipping_partner_id'], '_wpshop_attached_address', true);
322
+		$billing_info['address'] = get_post_meta($billing_address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true);
323
+		$billing_info['address_id'] = (!empty($_SESSION['billing_address'])) ? intval($_SESSION['billing_address']) : '';
324
+		if (!empty($_SESSION['shipping_partner_id'])) {
325
+			$partner_address_id = get_post_meta($_SESSION['shipping_partner_id'], '_wpshop_attached_address', true);
326 326
 			if (!empty($partner_address_id)) {
327
-				foreach( $partner_address_id as $address_id ) {
327
+				foreach ($partner_address_id as $address_id) {
328 328
 					$shipping_info['id'] = get_post_meta($address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true);
329
-					$shipping_info['address'] = get_post_meta( $address_id, '_'.WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS.'_metadata', true);
329
+					$shipping_info['address'] = get_post_meta($address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true);
330 330
 				}
331 331
 			}
332 332
 		}
333 333
 		else {
334 334
 			$shipping_info['id'] = get_post_meta($shipping_address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true);
335
-			$shipping_info['address'] = get_post_meta($shipping_address_id, '_'.WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS.'_metadata', true);
336
-			$shipping_info['address_id'] = ( !empty($_SESSION['shipping_address']) ) ? intval( $_SESSION['shipping_address'] ) : '';
335
+			$shipping_info['address'] = get_post_meta($shipping_address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true);
336
+			$shipping_info['address_id'] = (!empty($_SESSION['shipping_address'])) ? intval($_SESSION['shipping_address']) : '';
337 337
 		}
338 338
 
339 339
 		$order_info = array('billing' => $billing_info, 'shipping' => $shipping_info);
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	/** Set the custom colums
347 347
 	 * @return array
348 348
 	*/
349
-	static function orders_edit_columns($columns){
349
+	static function orders_edit_columns($columns) {
350 350
 	  $columns = array(
351 351
 		'cb' => '<input type="checkbox" />',
352 352
 		'order_identifier' => __('Identifiers', 'wpshop'),
@@ -366,40 +366,40 @@  discard block
 block discarded – undo
366 366
 	 * @return array
367 367
 	*/
368 368
 	public static function orders_custom_columns($column, $post_id) {
369
-		if ( get_post_type( $post_id ) == WPSHOP_NEWTYPE_IDENTIFIER_ORDER ) {
369
+		if (get_post_type($post_id) == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) {
370 370
 			global $civility, $order_status;
371 371
 
372 372
 			$metadata = get_post_custom();
373 373
 
374
-			$order_postmeta = isset($metadata['_order_postmeta'][0])?unserialize($metadata['_order_postmeta'][0]):'';
375
-			$addresses = get_post_meta($post_id,'_order_info', true);
374
+			$order_postmeta = isset($metadata['_order_postmeta'][0]) ? unserialize($metadata['_order_postmeta'][0]) : '';
375
+			$addresses = get_post_meta($post_id, '_order_info', true);
376 376
 
377
-			switch($column){
377
+			switch ($column) {
378 378
 				case "order_identifier":
379
-					if( !empty( $order_postmeta['order_key'] ) ) {
379
+					if (!empty($order_postmeta['order_key'])) {
380 380
 						echo '<b>' . $order_postmeta['order_key'] . '</b><br>';
381 381
 					}
382
-					if( !empty( $order_postmeta['order_invoice_ref'] ) ) {
382
+					if (!empty($order_postmeta['order_invoice_ref'])) {
383 383
 						echo '<i>' . $order_postmeta['order_invoice_ref'] . '</i>';
384
-					} elseif( !empty($order_postmeta['order_temporary_key'] ) ) {
384
+					} elseif (!empty($order_postmeta['order_temporary_key'])) {
385 385
 						echo '<b>' . $order_postmeta['order_temporary_key'] . '</b>';
386 386
 					}
387 387
 				break;
388 388
 
389 389
 				case "order_status":
390
-					echo !empty($order_postmeta['order_status']) ? sprintf('<mark class="%s" id="order_status_'.$post_id.'">%s</mark>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop')) : __('Unknown Status', 'wpshop');
390
+					echo !empty($order_postmeta['order_status']) ? sprintf('<mark class="%s" id="order_status_' . $post_id . '">%s</mark>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop')) : __('Unknown Status', 'wpshop');
391 391
 				break;
392 392
 
393 393
 				case "order_billing":
394
-					if ( !empty($addresses['billing']) && !empty($addresses['billing']['address']) && is_array($addresses['billing']['address']) ) {
394
+					if (!empty($addresses['billing']) && !empty($addresses['billing']['address']) && is_array($addresses['billing']['address'])) {
395 395
 						$billing = $addresses['billing']['address'];
396 396
 					}
397
-					else if ( !empty($addresses['billing']) ) {
397
+					else if (!empty($addresses['billing'])) {
398 398
 						$billing = $addresses['billing'];
399 399
 					}
400
-					if ( !empty($billing) ) {
401
-						echo (!empty($billing['civility']) ? __(wpshop_attributes::get_attribute_type_select_option_info($billing['civility'], 'label', 'custom'), 'wpshop') : null).' <strong>'.(!empty($billing['address_first_name']) ? $billing['address_first_name'] : null).' '.(!empty($billing['address_last_name']) ? $billing['address_last_name'] : null).'</strong>';
402
-						echo empty($billing['company']) ?'<br />' : ', <i>'.$billing['company'].'</i><br />';
400
+					if (!empty($billing)) {
401
+						echo (!empty($billing['civility']) ? __(wpshop_attributes::get_attribute_type_select_option_info($billing['civility'], 'label', 'custom'), 'wpshop') : null) . ' <strong>' . (!empty($billing['address_first_name']) ? $billing['address_first_name'] : null) . ' ' . (!empty($billing['address_last_name']) ? $billing['address_last_name'] : null) . '</strong>';
402
+						echo empty($billing['company']) ? '<br />' : ', <i>' . $billing['company'] . '</i><br />';
403 403
 						echo !empty($billing['address']) ? $billing['address'] : null;
404 404
 						echo !empty($billing['postcode']) ? '<br />' . $billing['postcode'] . ' ' : null;
405 405
 						echo !empty($billing['city']) ? $billing['city'] . ', ' : null;
@@ -412,35 +412,35 @@  discard block
 block discarded – undo
412 412
 				break;
413 413
 
414 414
 				case "order_shipping":
415
-					if ( !empty($addresses['shipping']) && !empty($addresses['shipping']['address']) && is_array($addresses['shipping']['address']) ) {
415
+					if (!empty($addresses['shipping']) && !empty($addresses['shipping']['address']) && is_array($addresses['shipping']['address'])) {
416 416
 						$shipping = $addresses['shipping']['address'];
417 417
 					}
418
-					else if ( !empty($addresses['shipping']) ) {
418
+					else if (!empty($addresses['shipping'])) {
419 419
 						$shipping = $addresses['shipping'];
420 420
 					}
421
-					if ( !empty($shipping) ) {
422
-						echo '<strong>'.(!empty($shipping['address_first_name']) ? $shipping['address_first_name'] : null).' '.(!empty($shipping['address_last_name']) ? $shipping['address_last_name'] : null).'</strong>';
423
-						echo empty($shipping['company'])?'<br />':', <i>'.$shipping['company'].'</i><br />';
421
+					if (!empty($shipping)) {
422
+						echo '<strong>' . (!empty($shipping['address_first_name']) ? $shipping['address_first_name'] : null) . ' ' . (!empty($shipping['address_last_name']) ? $shipping['address_last_name'] : null) . '</strong>';
423
+						echo empty($shipping['company']) ? '<br />' : ', <i>' . $shipping['company'] . '</i><br />';
424 424
 						echo (!empty($shipping['address']) ? $shipping['address'] : null);
425 425
 						echo !empty($billing['postcode']) ? '<br />' . $billing['postcode'] . ' ' : null;
426 426
 						echo !empty($billing['city']) ? $billing['city'] . ', ' : null;
427 427
 						echo !empty($billing['country']) ? $billing['country'] : null;
428 428
 					}
429
-					else{
429
+					else {
430 430
 						echo __('No information available for user shipping', 'wpshop');
431 431
 					}
432 432
 				break;
433 433
 
434 434
 				case "order_type":
435
-						echo '<a href="'.admin_url('post.php?post='.$post_id.'&action=edit').'">'.(!empty($order_postmeta['order_temporary_key']) ? __('Quotation','wpshop') :  __('Basic order','wpshop')).'</a>';
435
+						echo '<a href="' . admin_url('post.php?post=' . $post_id . '&action=edit') . '">' . (!empty($order_postmeta['order_temporary_key']) ? __('Quotation', 'wpshop') : __('Basic order', 'wpshop')) . '</a>';
436 436
 						$buttons = '<p class="row-actions">';
437 437
 						// Voir la commande
438
-						$buttons .= '<a class="button button-small" href="'.admin_url('post.php?post='.$post_id.'&action=edit').'">'.__('View', 'wpshop').'</a>';
438
+						$buttons .= '<a class="button button-small" href="' . admin_url('post.php?post=' . $post_id . '&action=edit') . '">' . __('View', 'wpshop') . '</a>';
439 439
 						// Marquer comme envoy�
440 440
 						if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'completed')) {
441
-							$buttons .= '<a data-id="' . $post_id . '" class="wps-bton-second-mini-rounded markAsShipped order_'.$post_id.' wps-bton-loader" data-nonce="' . wp_create_nonce("wpshop_dialog_inform_shipping_number") . '">'.__('Mark as shipped', 'wpshop').'</a> ';
441
+							$buttons .= '<a data-id="' . $post_id . '" class="wps-bton-second-mini-rounded markAsShipped order_' . $post_id . ' wps-bton-loader" data-nonce="' . wp_create_nonce("wpshop_dialog_inform_shipping_number") . '">' . __('Mark as shipped', 'wpshop') . '</a> ';
442 442
 						}
443
-						else if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'awaiting_payment' )) {
443
+						else if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'awaiting_payment')) {
444 444
 							//		$buttons .= '<a class="button markAsCompleted order_'.$post_id.' alignleft" >'.__('Payment received', 'wpshop').'</a>' . wpshop_payment::display_payment_receiver_interface($post_id) . ' ';
445 445
 						}
446 446
 						$buttons .= '</p>';
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 
454 454
 				case "order_total":
455 455
 					$currency = !empty($order_postmeta['order_currency']) ? $order_postmeta['order_currency'] : get_option('wpshop_shop_default_currency');
456
-					echo isset( $order_postmeta['order_grand_total'] ) ? number_format( $order_postmeta['order_grand_total'], 2, '.', '' ).' '.  wpshop_tools::wpshop_get_sigle($currency) : 'NaN';
456
+					echo isset($order_postmeta['order_grand_total']) ? number_format($order_postmeta['order_grand_total'], 2, '.', '') . ' ' . wpshop_tools::wpshop_get_sigle($currency) : 'NaN';
457 457
 				break;
458 458
 
459 459
 				/*case "order_actions":
@@ -481,10 +481,10 @@  discard block
 block discarded – undo
481 481
 	}
482 482
 
483 483
 	public static function list_table_filters() {
484
-		$post_type = !empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : '';
485
-		$entity_filter = !empty( $_GET['entity_filter'] ) ? sanitize_text_field( $_GET['entity_filter'] ) : '';
486
-		$entity_filter_btpf = !empty( $_GET['entity_filter_btpf'] ) ? sanitize_text_field( $_GET['entity_filter_btpf'] ) : '';
487
-		$entity_filter_btps = !empty( $_GET['entity_filter_btps'] ) ? sanitize_text_field( $_GET['entity_filter_btps'] ) : '';
484
+		$post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
485
+		$entity_filter = !empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : '';
486
+		$entity_filter_btpf = !empty($_GET['entity_filter_btpf']) ? sanitize_text_field($_GET['entity_filter_btpf']) : '';
487
+		$entity_filter_btps = !empty($_GET['entity_filter_btps']) ? sanitize_text_field($_GET['entity_filter_btps']) : '';
488 488
 
489 489
 		if (isset($post_type)) {
490 490
 			if (post_type_exists($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER)) {
@@ -496,23 +496,23 @@  discard block
 block discarded – undo
496 496
 				echo wpshop_form::form_input_select('entity_filter', 'entity_filter', $filter_possibilities, $entity_filter, '', 'index');
497 497
 				$min = $entity_filter_btpf;
498 498
 				$max = $entity_filter_btps;
499
-				echo ' <label for="entity_filter_btpf">'.__('Between two prices', 'wpshop').'</label> ';
500
-				echo wpshop_form::form_input('entity_filter_btpf', 'entity_filter_btpf', $min, 'text', 'placeholder="'.__('Minimum price', 'wpshop').'"', null);
501
-				echo wpshop_form::form_input('entity_filter_btps', 'entity_filter_btps', $max, 'text', 'placeholder="'.__('Maximum price', 'wpshop').'"', null);
499
+				echo ' <label for="entity_filter_btpf">' . __('Between two prices', 'wpshop') . '</label> ';
500
+				echo wpshop_form::form_input('entity_filter_btpf', 'entity_filter_btpf', $min, 'text', 'placeholder="' . __('Minimum price', 'wpshop') . '"', null);
501
+				echo wpshop_form::form_input('entity_filter_btps', 'entity_filter_btps', $max, 'text', 'placeholder="' . __('Maximum price', 'wpshop') . '"', null);
502 502
 			}
503 503
 		}
504 504
 	}
505 505
 
506 506
 	public static function list_table_filter_parse_query($query) {
507 507
 		global $pagenow, $wpdb;
508
-		$post_type = !empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : '';
509
-		$entity_filter = !empty( $_GET['entity_filter'] ) ? sanitize_text_field( $_GET['entity_filter'] ) : '';
510
-		$entity_filter_btpf = !empty( $_GET['entity_filter_btpf'] ) ? sanitize_text_field( $_GET['entity_filter_btpf'] ) : '';
511
-		$entity_filter_btps = !empty( $_GET['entity_filter_btps'] ) ? sanitize_text_field( $_GET['entity_filter_btps'] ) : '';
508
+		$post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
509
+		$entity_filter = !empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : '';
510
+		$entity_filter_btpf = !empty($_GET['entity_filter_btpf']) ? sanitize_text_field($_GET['entity_filter_btpf']) : '';
511
+		$entity_filter_btps = !empty($_GET['entity_filter_btps']) ? sanitize_text_field($_GET['entity_filter_btps']) : '';
512 512
 
513
-		if ( is_admin() && ($pagenow == 'edit.php') && !empty( $post_type ) && ( $post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER ) && !empty( $entity_filter ) ) {
513
+		if (is_admin() && ($pagenow == 'edit.php') && !empty($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) && !empty($entity_filter)) {
514 514
 			$check = null;
515
-			switch ( $entity_filter ) {
515
+			switch ($entity_filter) {
516 516
 				case 'all':
517 517
 					$sql_query = $wpdb->prepare(
518 518
 						"SELECT ID
@@ -576,27 +576,27 @@  discard block
 block discarded – undo
576 576
 						break;
577 577
 			}
578 578
 
579
-			if ( !empty( $check ) ) {
580
-				if( !empty($no_btp) && $no_btp == 'yes' ) {
579
+			if (!empty($check)) {
580
+				if (!empty($no_btp) && $no_btp == 'yes') {
581 581
 					$min = 'minimum';
582 582
 					$max = 'maximum';
583 583
 				} else {
584
-					$min = ( !empty($_GET['entity_filter_btpf']) && is_numeric($_GET['entity_filter_btpf']) ) ? sanitize_text_field( $_GET['entity_filter_btpf'] ) : 'minimum';
585
-					$max = ( !empty($_GET['entity_filter_btps']) && is_numeric($_GET['entity_filter_btps']) ) ? sanitize_text_field( $_GET['entity_filter_btps'] ) : 'maximum';
584
+					$min = (!empty($_GET['entity_filter_btpf']) && is_numeric($_GET['entity_filter_btpf'])) ? sanitize_text_field($_GET['entity_filter_btpf']) : 'minimum';
585
+					$max = (!empty($_GET['entity_filter_btps']) && is_numeric($_GET['entity_filter_btps'])) ? sanitize_text_field($_GET['entity_filter_btps']) : 'maximum';
586 586
 				}
587 587
 				$results = $wpdb->get_results($sql_query);
588 588
 				$post_id_list = array();
589 589
 				$i = 0;
590
-				foreach($results as $item){
590
+				foreach ($results as $item) {
591 591
 					$meta_value = get_post_meta($item->ID, '_order_postmeta');
592
-					$price = ( !empty( $meta_value[0]['order_grand_total'] ) ) ? $meta_value[0]['order_grand_total'] : '';
593
-					if( $price >= $min || $min == 'minimum' ) {
594
-						if( $price <= $max || $max == 'maximum' ) {
592
+					$price = (!empty($meta_value[0]['order_grand_total'])) ? $meta_value[0]['order_grand_total'] : '';
593
+					if ($price >= $min || $min == 'minimum') {
594
+						if ($price <= $max || $max == 'maximum') {
595 595
 							$post_id_list[] = $item->ID;
596 596
 						}
597 597
 					}
598 598
 				}
599
-				if( empty($post_id_list) ) {
599
+				if (empty($post_id_list)) {
600 600
 					$post_id_list[] = 'no_result';
601 601
 				}
602 602
 				$query->query_vars[$check] = $post_id_list;
@@ -607,67 +607,67 @@  discard block
 block discarded – undo
607 607
 
608 608
 
609 609
 
610
-	function latest_products_ordered ( $orders ) {
610
+	function latest_products_ordered($orders) {
611 611
 		global $wpdb;
612 612
 		$product_id = $output = '';
613 613
 		$products = array();
614 614
 		$display_option = get_option('wpshop_display_option');
615
-		if ( !empty($orders) && !empty($display_option) && !empty($display_option['latest_products_ordered']) ) {
616
-			foreach( $orders as $order ) {
617
-				$order_content = get_post_meta( $order->ID, '_order_postmeta', true );
618
-				if ( !empty($order_content) && !empty( $order_content['order_items']) ) {
615
+		if (!empty($orders) && !empty($display_option) && !empty($display_option['latest_products_ordered'])) {
616
+			foreach ($orders as $order) {
617
+				$order_content = get_post_meta($order->ID, '_order_postmeta', true);
618
+				if (!empty($order_content) && !empty($order_content['order_items'])) {
619 619
 
620
-					foreach( $order_content['order_items'] as $item ) {
621
-						if ( count( $products) >= $display_option['latest_products_ordered'] ) {
620
+					foreach ($order_content['order_items'] as $item) {
621
+						if (count($products) >= $display_option['latest_products_ordered']) {
622 622
 							continue;
623 623
 						}
624 624
 						$product_id = $item['item_id'];
625
-						if ( !empty( $item) && !empty($item['item_meta']) && !empty($item['item_meta']['variation_definition']) ) {
626
-							$parent_def = wpshop_products::get_parent_variation( $item['item_id'] );
627
-							if ( !empty( $parent_def ) ) {
625
+						if (!empty($item) && !empty($item['item_meta']) && !empty($item['item_meta']['variation_definition'])) {
626
+							$parent_def = wpshop_products::get_parent_variation($item['item_id']);
627
+							if (!empty($parent_def)) {
628 628
 								$parent_post = $parent_def['parent_post'];
629 629
 								$product_id = $parent_post->ID;
630 630
 							}
631 631
 						}
632 632
 
633
-						if ( !in_array($product_id, $products) ) {
633
+						if (!in_array($product_id, $products)) {
634 634
 							$products[] = $product_id;
635 635
 						}
636 636
 					}
637 637
 				}
638 638
 			}
639
-			if ( !empty($products) ) {
639
+			if (!empty($products)) {
640 640
 				$products_id = implode(",", $products);
641
-				$output = wpshop_display::display_template_element('latest_products_ordered', array('LATEST_PRODUCTS_ORDERED' => do_shortcode('[wpshop_products pid="' .$products_id. '"]')) );
641
+				$output = wpshop_display::display_template_element('latest_products_ordered', array('LATEST_PRODUCTS_ORDERED' => do_shortcode('[wpshop_products pid="' . $products_id . '"]')));
642 642
 			}
643 643
 		}
644 644
 		return $output;
645 645
 	}
646 646
 
647
-	function get_order_list_for_customer( $customer_id ) {
647
+	function get_order_list_for_customer($customer_id) {
648 648
 		global $wpdb;
649 649
 		$output = '';
650 650
 
651
-		if( !empty($customer_id) ) {
652
-			 $query = $wpdb->prepare( 'SELECT *
653
-							 		   FROM ' .$wpdb->posts. '
651
+		if (!empty($customer_id)) {
652
+			 $query = $wpdb->prepare('SELECT *
653
+							 		   FROM ' .$wpdb->posts . '
654 654
 							 		   WHERE post_author = %d
655
-							 		   AND post_type = %s', $customer_id, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS );
656
-			 $orders = $wpdb->get_results( $query );
655
+							 		   AND post_type = %s', $customer_id, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS);
656
+			 $orders = $wpdb->get_results($query);
657 657
 
658
-			 foreach( $orders as $order ) {
658
+			 foreach ($orders as $order) {
659 659
 
660 660
 			 }
661 661
 		}
662 662
 
663 663
 		return $output;
664 664
 	}
665
-	static function display_customer_pay_quotation( $state, $oid ) {
666
-		$label = ( ( $state ) ? __('Invalid quotation', 'wpshop') : __('Valid quotation', 'wpshop') );
667
-		$btn = '<p><a role="button" data-nonce="' . wp_create_nonce( 'wps_quotation_is_payable_by_customer' ) . '" class="wps-bton-' . ( ( $state ) ? 'third' : 'second' ) . '-mini-rounded quotation_is_payable_by_customer" href="#" >'.$label.'</a></p>';
668
-		if( $state ) {
665
+	static function display_customer_pay_quotation($state, $oid) {
666
+		$label = (($state) ? __('Invalid quotation', 'wpshop') : __('Valid quotation', 'wpshop'));
667
+		$btn = '<p><a role="button" data-nonce="' . wp_create_nonce('wps_quotation_is_payable_by_customer') . '" class="wps-bton-' . (($state) ? 'third' : 'second') . '-mini-rounded quotation_is_payable_by_customer" href="#" >' . $label . '</a></p>';
668
+		if ($state) {
669 669
 			//$btn .= '<a target="_blank" href="' . admin_url( 'admin-ajax.php?action=wps_checkout_quotation&order_id=' . $oid . '&is_link=link' ) . '">' . __( 'Pay link', 'wpshop' ) . '</a>';
670
-			$btn .= '<span><input id="wps_direct_link_url" type="text" value="' . wpshop_checkout::wps_direct_payment_link_url( $oid ) . '"/><a class="button" data-copy-target="#wps_direct_link_url" title="' . __( 'Copy', 'wpshop' ) . '"><span class="dashicons dashicons-clipboard"></span></a><a data-nonce="' . wp_create_nonce( 'wps_send_direct_payment_link' ) . '" role="button" class="button" href="#" title="' . __( 'Send by mail', 'wpshop' ) . '"><span class="dashicons dashicons-email"></span></a></span><span>' . sprintf( __( 'Link is valid until %s', 'wpshop' ), mysql2date( get_option( 'date_format' ), date_format( date_create( date('Y-m') . ' + 2month - 1day' ), 'Y-m-d H:i:s' ), true ) ) . '</span>';
670
+			$btn .= '<span><input id="wps_direct_link_url" type="text" value="' . wpshop_checkout::wps_direct_payment_link_url($oid) . '"/><a class="button" data-copy-target="#wps_direct_link_url" title="' . __('Copy', 'wpshop') . '"><span class="dashicons dashicons-clipboard"></span></a><a data-nonce="' . wp_create_nonce('wps_send_direct_payment_link') . '" role="button" class="button" href="#" title="' . __('Send by mail', 'wpshop') . '"><span class="dashicons dashicons-email"></span></a></span><span>' . sprintf(__('Link is valid until %s', 'wpshop'), mysql2date(get_option('date_format'), date_format(date_create(date('Y-m') . ' + 2month - 1day'), 'Y-m-d H:i:s'), true)) . '</span>';
671 671
 		}
672 672
 		return $btn;
673 673
 	}
Please login to merge, or discard this patch.
Braces   +14 added lines, -23 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
  * Products management method file
4 6
  *
@@ -122,8 +124,7 @@  discard block
 block discarded – undo
122 124
 		$order_main_info .= '<div class="wps-product-section">';
123 125
 		if(empty($order_postmeta['order_date']) || (empty($order_postmeta['order_key']) && empty($order_postmeta['order_temporary_key']) && empty($order_postmeta['order_invoice_ref']))){
124 126
 			$order_main_info .=  '<span class="dashicons dashicons-arrow-right"></span> <strong>'.__('Temporary quotation reference','wpshop').': </strong>'.self::get_new_pre_order_reference(false).'<br/>';
125
-		}
126
-		else{
127
+		} else{
127 128
 			if(!empty($order_postmeta['order_key'])){
128 129
 				$order_main_info .=  '<span class="dashicons dashicons-arrow-right"></span> <strong>'.__('Order reference','wpshop').' : </strong>'.$order_postmeta['order_key'].'<br/>';
129 130
 			}
@@ -136,8 +137,7 @@  discard block
 block discarded – undo
136 137
 				$sub_tpl_component = array();
137 138
 				$order_invoice_download = '<a href="' . admin_url( 'admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $order_postmeta['order_invoice_ref'] . '&mode=pdf' ) . '">' . __('Download invoice', 'wpshop') . '</a><br />';
138 139
 				$order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>'. __('Invoice number','wpshop').': </strong>'.$order_postmeta['order_invoice_ref'].'<br/>' . $order_invoice_download . '';
139
-			}
140
-			else {
140
+			} else {
141 141
 				$order_main_info .= wpshop_display::display_template_element('wpshop_admin_order_generate_invoice_button', array(), array(), 'admin');
142 142
 			}
143 143
 		}
@@ -191,8 +191,7 @@  discard block
 block discarded – undo
191 191
 			if ( empty($credit_meta) && (float) 0 !== $total_received ) {
192 192
 				if( $order_postmeta['order_status'] == 'refunded') {
193 193
 					$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container">' .__('Credit Slip number', 'wpshop'). ' : <strong>'. ( (!empty($order_postmeta) && !empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['refunded_action']) && !empty($order_postmeta['order_payment']['refunded_action']['credit_slip_ref']) ) ? '<a href="' .admin_url( 'admin-post.php?action=wps_invoice&order_id=' .$order->ID. '&amp;invoice_ref=' .$order_postmeta['order_payment']['refunded_action']['credit_slip_ref'].'&credit_slip=ok' ). '" target="_blank">'.$order_postmeta['order_payment']['refunded_action']['credit_slip_ref'].'</a>' : '') .'</strong></div>';
194
-				}
195
-				else {
194
+				} else {
196 195
 					$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container" ><button class="wps-bton-second-mini-rounded markAsRefunded order_' .$order->ID. '">' .__('Refund this order', 'wpshop'). '</button><input type="hidden" id="markasrefunded_order_hidden_indicator" name="markasrefunded_order_hidden_indicator" /></div>';
197 196
 				}
198 197
 			}
@@ -273,8 +272,7 @@  discard block
 block discarded – undo
273 272
 
274 273
 		$order_current_number = get_option('wpshop_order_current_number', false);
275 274
 		/* If the counter doesn't exist, we initiate it */
276
-		if(!$order_current_number) { $order_current_number = 1; }
277
-		else { $order_current_number++; }
275
+		if(!$order_current_number) { $order_current_number = 1; } else { $order_current_number++; }
278 276
 		update_option('wpshop_order_current_number', $order_current_number);
279 277
 
280 278
 		$order_ref = (string)sprintf('%0'.$number_figures.'d', $order_current_number);
@@ -294,8 +292,7 @@  discard block
 block discarded – undo
294 292
 
295 293
 		$order_current_number = get_option('wpshop_preorder_current_number', false);
296 294
 		/* If the counter doesn't exist, we initiate it */
297
-		if(!$order_current_number) { $order_current_number = 1; }
298
-		else { $order_current_number++; }
295
+		if(!$order_current_number) { $order_current_number = 1; } else { $order_current_number++; }
299 296
 		if($save){
300 297
 			update_option('wpshop_preorder_current_number', $order_current_number);
301 298
 		}
@@ -329,8 +326,7 @@  discard block
 block discarded – undo
329 326
 					$shipping_info['address'] = get_post_meta( $address_id, '_'.WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS.'_metadata', true);
330 327
 				}
331 328
 			}
332
-		}
333
-		else {
329
+		} else {
334 330
 			$shipping_info['id'] = get_post_meta($shipping_address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true);
335 331
 			$shipping_info['address'] = get_post_meta($shipping_address_id, '_'.WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS.'_metadata', true);
336 332
 			$shipping_info['address_id'] = ( !empty($_SESSION['shipping_address']) ) ? intval( $_SESSION['shipping_address'] ) : '';
@@ -393,8 +389,7 @@  discard block
 block discarded – undo
393 389
 				case "order_billing":
394 390
 					if ( !empty($addresses['billing']) && !empty($addresses['billing']['address']) && is_array($addresses['billing']['address']) ) {
395 391
 						$billing = $addresses['billing']['address'];
396
-					}
397
-					else if ( !empty($addresses['billing']) ) {
392
+					} else if ( !empty($addresses['billing']) ) {
398 393
 						$billing = $addresses['billing'];
399 394
 					}
400 395
 					if ( !empty($billing) ) {
@@ -405,8 +400,7 @@  discard block
 block discarded – undo
405 400
 						echo !empty($billing['city']) ? $billing['city'] . ', ' : null;
406 401
 						echo !empty($billing['country']) ? $billing['country'] : null;
407 402
 						echo (!empty($billing['phone']) ? '<br /><b>' . $billing['phone'] . '</b>' : '');
408
-					}
409
-					else {
403
+					} else {
410 404
 						echo __('No information available for user billing', 'wpshop');
411 405
 					}
412 406
 				break;
@@ -414,8 +408,7 @@  discard block
 block discarded – undo
414 408
 				case "order_shipping":
415 409
 					if ( !empty($addresses['shipping']) && !empty($addresses['shipping']['address']) && is_array($addresses['shipping']['address']) ) {
416 410
 						$shipping = $addresses['shipping']['address'];
417
-					}
418
-					else if ( !empty($addresses['shipping']) ) {
411
+					} else if ( !empty($addresses['shipping']) ) {
419 412
 						$shipping = $addresses['shipping'];
420 413
 					}
421 414
 					if ( !empty($shipping) ) {
@@ -425,8 +418,7 @@  discard block
 block discarded – undo
425 418
 						echo !empty($billing['postcode']) ? '<br />' . $billing['postcode'] . ' ' : null;
426 419
 						echo !empty($billing['city']) ? $billing['city'] . ', ' : null;
427 420
 						echo !empty($billing['country']) ? $billing['country'] : null;
428
-					}
429
-					else{
421
+					} else{
430 422
 						echo __('No information available for user shipping', 'wpshop');
431 423
 					}
432 424
 				break;
@@ -439,8 +431,7 @@  discard block
 block discarded – undo
439 431
 						// Marquer comme envoy�
440 432
 						if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'completed')) {
441 433
 							$buttons .= '<a data-id="' . $post_id . '" class="wps-bton-second-mini-rounded markAsShipped order_'.$post_id.' wps-bton-loader" data-nonce="' . wp_create_nonce("wpshop_dialog_inform_shipping_number") . '">'.__('Mark as shipped', 'wpshop').'</a> ';
442
-						}
443
-						else if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'awaiting_payment' )) {
434
+						} else if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'awaiting_payment' )) {
444 435
 							//		$buttons .= '<a class="button markAsCompleted order_'.$post_id.' alignleft" >'.__('Payment received', 'wpshop').'</a>' . wpshop_payment::display_payment_receiver_interface($post_id) . ' ';
445 436
 						}
446 437
 						$buttons .= '</p>';
Please login to merge, or discard this patch.
includes/librairies/purchase/checkout.class.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@
 block discarded – undo
23 23
 	var $creating_account = true;
24 24
 
25 25
 	/** Constructor of the class
26
-	* @return void
27
-	*/
26
+	 * @return void
27
+	 */
28 28
 	function __construct () {
29 29
 	}
30 30
 
Please login to merge, or discard this patch.
Braces   +14 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' ) ) {
@@ -58,12 +60,13 @@  discard block
 block discarded – undo
58 60
 						// On enregistre la commande
59 61
 						update_post_meta($order_id, '_order_postmeta', $order);
60 62
 						update_post_meta($order_id, '_wpshop_order_customer_id', $user_id);
63
+					} else {
64
+						$wpshop->add_error(__('You don\'t own the order', 'wpshop'));
61 65
 					}
62
-					else $wpshop->add_error(__('You don\'t own the order', 'wpshop'));
66
+				} else {
67
+					$wpshop->add_error(__('The order doesn\'t exist.', 'wpshop'));
63 68
 				}
64
-				else $wpshop->add_error(__('The order doesn\'t exist.', 'wpshop'));
65
-			}
66
-			else{
69
+			} else{
67 70
 				$order_data = array(
68 71
 					'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
69 72
 					'post_title' => sprintf(__('Order - %s','wpshop'), mysql2date('d M Y\, H:i:s', current_time('mysql', 0), true)),
@@ -118,7 +121,9 @@  discard block
 block discarded – undo
118 121
 						}
119 122
 					}
120 123
 				}
121
-				if(!empty($download_codes)) update_user_meta($user_id, '_order_download_codes_'.$order_id, $download_codes);
124
+				if(!empty($download_codes)) {
125
+					update_user_meta($user_id, '_order_download_codes_'.$order_id, $download_codes);
126
+				}
122 127
 
123 128
 				// Informations de commande � stocker
124 129
 				$currency = wpshop_tools::wpshop_get_currency(true);
@@ -140,8 +145,7 @@  discard block
 block discarded – undo
140 145
 				// Si c'est un devis
141 146
 				if ( $paymentMethod == 'quotation' ) {
142 147
 					$order['order_temporary_key'] = wpshop_orders::get_new_pre_order_reference();
143
-				}
144
-				else {
148
+				} else {
145 149
 					$order['order_key'] = wpshop_orders::get_new_order_reference();
146 150
 				}
147 151
 
@@ -202,8 +206,7 @@  discard block
 block discarded – undo
202 206
 
203 207
 				if ( !empty($order_meta) && !empty($order_meta['cart_type']) && $order_meta['cart_type'] == 'quotation' && empty($order_meta['order_key']) ) {
204 208
 					$wps_message->wpshop_prepared_email($email, 'WPSHOP_QUOTATION_CONFIRMATION_MESSAGE', array('order_id' => $order_id,'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'customer_email' => $email, 'order_date' => current_time('mysql', 0), 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '', 'order_shipping_method' => $shipping_method, 'order_personnal_informations' => '') );
205
-				}
206
-				else {
209
+				} else {
207 210
 					$email_option = get_option( 'wpshop_emails' );
208 211
 					if ( empty($email_option['send_confirmation_order_message']) ) {
209 212
 						$payment_method_option = get_option( 'wps_payment_mode' );
@@ -257,8 +260,7 @@  discard block
 block discarded – undo
257 260
 
258 261
 			if( !empty( $order_infos ) && !empty($order_infos['cart_type']) && $order_infos['cart_type'] == 'normal' && !empty($order_infos['order_key']) ){
259 262
 				$message_type = 'WPSHOP_NEW_ORDER_ADMIN_MESSAGE';
260
-			}
261
-			else {
263
+			} else {
262 264
 				$message_type = 'WPSHOP_NEW_QUOTATION_ADMIN_MESSAGE';
263 265
 				$order_tmp_key = $order_infos['order_temporary_key'];
264 266
 			}
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 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
 /**
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 	/** Constructor of the class
26 26
 	* @return void
27 27
 	*/
28
-	function __construct () {
28
+	function __construct() {
29 29
 	}
30 30
 
31 31
 
32
-	public static function process_checkout($paymentMethod='paypal', $order_id = 0, $customer_id = 0, $customer_billing_address_id = 0, $customer_shipping_address_id = 0) {
32
+	public static function process_checkout($paymentMethod = 'paypal', $order_id = 0, $customer_id = 0, $customer_billing_address_id = 0, $customer_shipping_address_id = 0) {
33 33
 
34 34
 		global $wpdb, $wpshop, $wpshop_cart;
35 35
 		$wps_message = new wps_message_ctr();
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 		if (is_user_logged_in()) :
39 39
 			$user_id = get_current_user_id();
40 40
 
41
-		if ( $customer_id != 0 ) {
41
+		if ($customer_id != 0) {
42 42
 			$user_id = $customer_id;
43 43
 		}
44 44
 
45 45
 			// If the order is already created in the db
46
-			if(!empty($order_id) && is_numeric($order_id)) {
46
+			if (!empty($order_id) && is_numeric($order_id)) {
47 47
 				$order = get_post_meta($order_id, '_order_postmeta', true);
48 48
 
49
-				if(!empty($order)) {
50
-					if($order['customer_id'] == $user_id) {
49
+				if (!empty($order)) {
50
+					if ($order['customer_id'] == $user_id) {
51 51
 						$order['payment_method'] = $paymentMethod;
52
-						$_SESSION['order_id'] = (int) $order_id;
52
+						$_SESSION['order_id'] = (int)$order_id;
53 53
 						// Store cart in session
54 54
 						//wpshop_cart::store_cart_in_session($order);
55 55
 						// Add a payment
56
-						$order['order_payment']['received'][] = array( 'method' => $paymentMethod, 'waited_amount' => $order['order_amount_to_pay_now'], 'status' => 'waiting_payment', 'author' => get_current_user_id() );
56
+						$order['order_payment']['received'][] = array('method' => $paymentMethod, 'waited_amount' => $order['order_amount_to_pay_now'], 'status' => 'waiting_payment', 'author' => get_current_user_id());
57 57
 
58 58
 						// On enregistre la commande
59 59
 						update_post_meta($order_id, '_order_postmeta', $order);
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
 				}
64 64
 				else $wpshop->add_error(__('The order doesn\'t exist.', 'wpshop'));
65 65
 			}
66
-			else{
66
+			else {
67 67
 				$order_data = array(
68 68
 					'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
69
-					'post_title' => sprintf(__('Order - %s','wpshop'), mysql2date('d M Y\, H:i:s', current_time('mysql', 0), true)),
69
+					'post_title' => sprintf(__('Order - %s', 'wpshop'), mysql2date('d M Y\, H:i:s', current_time('mysql', 0), true)),
70 70
 					'post_status' => 'publish',
71
-					'post_excerpt' => !empty($_POST['wps-customer-comment']) ? sanitize_text_field( $_POST['wps-customer-comment'] ) : '',
71
+					'post_excerpt' => !empty($_POST['wps-customer-comment']) ? sanitize_text_field($_POST['wps-customer-comment']) : '',
72 72
 					'post_author' => $user_id,
73 73
 					'comment_status' => 'closed'
74 74
 				);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 				$order_tva = array();
79 79
 
80 80
 				//$cart = (array)$wpshop_cart->cart;
81
-				if ( !empty($_SESSION['cart']) && !empty( $_SESSION['cart']['shipping_method']) ) {
81
+				if (!empty($_SESSION['cart']) && !empty($_SESSION['cart']['shipping_method'])) {
82 82
 					$_SESSION['cart']['shipping_method'] = __('Standard shipping method', 'wpshop');
83 83
 				}
84 84
 				$cart = (array)$_SESSION['cart'];
@@ -90,35 +90,35 @@  discard block
 block discarded – undo
90 90
 				$_SESSION['order_id'] = $order_id;
91 91
 
92 92
 				// Cr�ation des codes de t�l�chargement si il y a des produits t�l�chargeable dans le panier
93
-				if ( !empty( $cart['order_items'] ) ) {
94
-					foreach($cart['order_items'] as $c) {
93
+				if (!empty($cart['order_items'])) {
94
+					foreach ($cart['order_items'] as $c) {
95 95
 						$product_id = $c['item_id'];
96 96
 						$product = null;
97
-						if( isset( $c['item_meta']['variations'] ) ) {
98
-							foreach ( $c['item_meta']['variations'] as $variation_id => $variation ) {
99
-								if( isset( $variation['item_meta']['is_downloadable_'] ) ) {
97
+						if (isset($c['item_meta']['variations'])) {
98
+							foreach ($c['item_meta']['variations'] as $variation_id => $variation) {
99
+								if (isset($variation['item_meta']['is_downloadable_'])) {
100 100
 									$product_id = $c['item_id'] . '__' . $variation_id;
101
-									$product = wpshop_products::get_product_data( $product_id );
101
+									$product = wpshop_products::get_product_data($product_id);
102 102
 								}
103 103
 							}
104 104
 						}
105
-						if( !isset( $product ) ) {
106
-							$product = wpshop_products::get_product_data( $c['item_id'] );
105
+						if (!isset($product)) {
106
+							$product = wpshop_products::get_product_data($c['item_id']);
107 107
 							$product_id = $c['item_id'];
108 108
 							/** Check if it's a variation and check the parent product **/
109
-							if ( get_post_type( $c['item_id'] ) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION ) {
110
-								$parent_def = wpshop_products::get_parent_variation( $c['item_id'] );
111
-								if ( !empty($parent_def) && !empty($parent_def['parent_post_meta']) && !empty($parent_def['parent_post_meta']['is_downloadable_']) ) {
109
+							if (get_post_type($c['item_id']) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
110
+								$parent_def = wpshop_products::get_parent_variation($c['item_id']);
111
+								if (!empty($parent_def) && !empty($parent_def['parent_post_meta']) && !empty($parent_def['parent_post_meta']['is_downloadable_'])) {
112 112
 									$product['is_downloadable_'] = $parent_def['parent_post_meta']['is_downloadable_'];
113 113
 								}
114 114
 							}
115 115
 						}
116
-						if(!empty($product['is_downloadable_'])) {
116
+						if (!empty($product['is_downloadable_'])) {
117 117
 							$download_codes[$product_id] = array('item_id' => $product_id, 'download_code' => uniqid('', true));
118 118
 						}
119 119
 					}
120 120
 				}
121
-				if(!empty($download_codes)) update_user_meta($user_id, '_order_download_codes_'.$order_id, $download_codes);
121
+				if (!empty($download_codes)) update_user_meta($user_id, '_order_download_codes_' . $order_id, $download_codes);
122 122
 
123 123
 				// Informations de commande � stocker
124 124
 				$currency = wpshop_tools::wpshop_get_currency(true);
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
 					'order_payment' 		=> array(
134 134
 					'customer_choice' 		=> array('method' => $paymentMethod),
135 135
 					'received'				=> array('0' => array('method' => $paymentMethod, 'waited_amount' => $cart['order_amount_to_pay_now'], 'status' =>  'waiting_payment', 'author' => $user_id)),
136
-					'shipping_method'       => ( ( !empty( $_SESSION['shipping_method']) ) ? wpshop_tools::varSanitizer( $_SESSION['shipping_method']) : __('Standard shipping method', 'wpshop') )
136
+					'shipping_method'       => ((!empty($_SESSION['shipping_method'])) ? wpshop_tools::varSanitizer($_SESSION['shipping_method']) : __('Standard shipping method', 'wpshop'))
137 137
 					),
138 138
 				), $cart);
139 139
 
140 140
 				// Si c'est un devis
141
-				if ( $paymentMethod == 'quotation' ) {
141
+				if ($paymentMethod == 'quotation') {
142 142
 					$order['order_temporary_key'] = wpshop_orders::get_new_pre_order_reference();
143 143
 				}
144 144
 				else {
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 				}
147 147
 
148 148
 				//Round final amount
149
-				$order['order_grand_total'] = number_format( round($order['order_grand_total'], 2), 2, '.', '');
150
-				$order['order_total_ttc'] = number_format( round($order['order_total_ttc'], 2), 2, '.', '');
151
-				$order['order_amount_to_pay_now'] = number_format( round($order['order_amount_to_pay_now'], 2), 2, '.', '');
149
+				$order['order_grand_total'] = number_format(round($order['order_grand_total'], 2), 2, '.', '');
150
+				$order['order_total_ttc'] = number_format(round($order['order_total_ttc'], 2), 2, '.', '');
151
+				$order['order_amount_to_pay_now'] = number_format(round($order['order_amount_to_pay_now'], 2), 2, '.', '');
152 152
 
153 153
 				/** On enregistre la commande	*/
154 154
 				update_post_meta($order_id, '_order_postmeta', $order);
@@ -157,75 +157,75 @@  discard block
 block discarded – undo
157 157
 				update_post_meta($order_id, '_wpshop_order_status', $order['order_status']);
158 158
 
159 159
 
160
-				do_action( 'wps_order_extra_save', $order_id );
160
+				do_action('wps_order_extra_save', $order_id);
161 161
 
162 162
 				//Add an action to extra actions on order save
163 163
 				// @TODO : REQUEST
164
-				$args = array( 'order_id' => $order_id, 'posted_data' => $_REQUEST );
165
-				wpshop_tools::create_custom_hook( 'wps_order_extra_save_action', $args );
164
+				$args = array('order_id' => $order_id, 'posted_data' => $_REQUEST);
165
+				wpshop_tools::create_custom_hook('wps_order_extra_save_action', $args);
166 166
 
167 167
 				/**	Set custmer information for the order	*/
168
-				$shipping_address =  ( !empty($shipping_address_option) && !empty($shipping_address_option['activate']) ) ? ( ( !empty($_SESSION['shipping_address']) ) ? wpshop_tools::varSanitizer($_SESSION['shipping_address']) : $customer_shipping_address_id ) : '';
169
-				$billing_address =  ( !empty($_SESSION['billing_address']) ) ? wpshop_tools::varSanitizer($_SESSION['billing_address']) : $customer_billing_address_id;
168
+				$shipping_address = (!empty($shipping_address_option) && !empty($shipping_address_option['activate'])) ? ((!empty($_SESSION['shipping_address'])) ? wpshop_tools::varSanitizer($_SESSION['shipping_address']) : $customer_shipping_address_id) : '';
169
+				$billing_address = (!empty($_SESSION['billing_address'])) ? wpshop_tools::varSanitizer($_SESSION['billing_address']) : $customer_billing_address_id;
170 170
 
171 171
 
172
-				if ( !empty( $billing_address) ) {
172
+				if (!empty($billing_address)) {
173 173
 					wpshop_orders::set_order_customer_addresses($user_id, $order_id, $shipping_address, $billing_address);
174 174
 				}
175 175
 
176
-				if ( !empty($_SESSION['shipping_address_to_save']) ) {
176
+				if (!empty($_SESSION['shipping_address_to_save'])) {
177 177
 					$order_infos_postmeta = get_post_meta($order_id, '_order_info', true);
178 178
 					$order_infos_postmeta['shipping']['address'] = $_SESSION['shipping_address_to_save'];
179 179
 					$order_infos_postmeta['shipping']['address_id'] = '';
180 180
 					update_post_meta($order_id, '_order_info', $order_infos_postmeta);
181
-					unset( $_SESSION['shipping_address_to_save'] );
181
+					unset($_SESSION['shipping_address_to_save']);
182 182
 				}
183 183
 
184 184
 
185 185
 				/** Save Coupon use **/
186
-				if ( !empty($_SESSION['cart']['coupon_id']) ) {
186
+				if (!empty($_SESSION['cart']['coupon_id'])) {
187 187
 					$wps_coupon_mdl = new wps_coupon_model();
188
-					$wps_coupon_mdl->save_coupon_use( $_SESSION['cart']['coupon_id'] );
188
+					$wps_coupon_mdl->save_coupon_use($_SESSION['cart']['coupon_id']);
189 189
 				}
190 190
 
191 191
 				/**	Notify the customer as the case	*/
192 192
 				$user_info = get_userdata($user_id);
193 193
 				$email = $user_info->user_email;
194
-				$first_name = $user_info->user_firstname ;
194
+				$first_name = $user_info->user_firstname;
195 195
 				$last_name = $user_info->user_lastname;
196 196
 
197 197
 				// Envoie du message de confirmation de commande au client
198
-				$order_meta = get_post_meta( $order_id, '_order_postmeta', true);
198
+				$order_meta = get_post_meta($order_id, '_order_postmeta', true);
199 199
 
200
-				$shipping_mode_option = get_option( 'wps_shipping_mode' );
201
-				$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'] : '' );
200
+				$shipping_mode_option = get_option('wps_shipping_mode');
201
+				$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'] : '');
202 202
 
203
-				if ( !empty($order_meta) && !empty($order_meta['cart_type']) && $order_meta['cart_type'] == 'quotation' && empty($order_meta['order_key']) ) {
204
-					$wps_message->wpshop_prepared_email($email, 'WPSHOP_QUOTATION_CONFIRMATION_MESSAGE', array('order_id' => $order_id,'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'customer_email' => $email, 'order_date' => current_time('mysql', 0), 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '', 'order_shipping_method' => $shipping_method, 'order_personnal_informations' => '') );
203
+				if (!empty($order_meta) && !empty($order_meta['cart_type']) && $order_meta['cart_type'] == 'quotation' && empty($order_meta['order_key'])) {
204
+					$wps_message->wpshop_prepared_email($email, 'WPSHOP_QUOTATION_CONFIRMATION_MESSAGE', array('order_id' => $order_id, 'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'customer_email' => $email, 'order_date' => current_time('mysql', 0), 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '', 'order_shipping_method' => $shipping_method, 'order_personnal_informations' => ''));
205 205
 				}
206 206
 				else {
207
-					$email_option = get_option( 'wpshop_emails' );
208
-					if ( empty($email_option['send_confirmation_order_message']) ) {
209
-						$payment_method_option = get_option( 'wps_payment_mode' );
210
-						$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'];
207
+					$email_option = get_option('wpshop_emails');
208
+					if (empty($email_option['send_confirmation_order_message'])) {
209
+						$payment_method_option = get_option('wps_payment_mode');
210
+						$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'];
211 211
 
212
-						$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, 'order_personnal_informations' => '' ) );
212
+						$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, 'order_personnal_informations' => ''));
213 213
 					}
214 214
 				}
215 215
 
216
-				if ( empty($_SESSION['wps-pos-addon']) ) {
216
+				if (empty($_SESSION['wps-pos-addon'])) {
217 217
 					$email_option = get_option('wpshop_emails');
218
-					if( empty($email_option) || ( !empty($email_option) && empty($email_option['send_confirmation_order_message']) ) ){
219
-						self::send_order_email_to_administrator( $order_id, $user_info );
218
+					if (empty($email_option) || (!empty($email_option) && empty($email_option['send_confirmation_order_message']))) {
219
+						self::send_order_email_to_administrator($order_id, $user_info);
220 220
 					}
221 221
 				}
222 222
 
223 223
 
224 224
 				/** IF Order amount is 0, Finish the Order **/
225
-				if ( $cart['order_amount_to_pay_now'] == 0 ) {
225
+				if ($cart['order_amount_to_pay_now'] == 0) {
226 226
 					$order_meta = get_post_meta($order_id, '_order_postmeta', true);
227 227
 					$payment_status = 'completed';
228
-					$params_array = array (
228
+					$params_array = array(
229 229
 						'method' =>'free',
230 230
 						'waited_amount' => $order_meta['order_amount_to_pay_now'],
231 231
 						'status' =>  'payment_received',
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
 					);
237 237
 					wpshop_payment::check_order_payment_total_amount($order_id, $params_array, $payment_status);
238 238
 				}
239
-				apply_filters( 'wpshop_finish_order_extra_actions', $order_id);
239
+				apply_filters('wpshop_finish_order_extra_actions', $order_id);
240 240
 			}
241 241
 		endif;
242 242
 		return $order_id;
243 243
 	}
244 244
 
245
-	public static function send_order_email_to_administrator ( $order_id, $customer_infos = ''  ) {
246
-		if ( !empty($order_id) ) {
245
+	public static function send_order_email_to_administrator($order_id, $customer_infos = '') {
246
+		if (!empty($order_id)) {
247 247
 			$wps_message = new wps_message_ctr();
248 248
 			$order_infos = get_post_meta($order_id, '_order_postmeta', true);
249 249
 			//Send email to administrator(s)
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
 			$shop_admin_email = $shop_admin_email_option['contact_email'];
252 252
 			$order_tmp_key = '';
253 253
 
254
-			$shipping_mode_option = get_option( 'wps_shipping_mode' );
255
-			$shipping_method = ( !empty($order_infos['order_payment']['shipping_method']) && !empty($shipping_mode_option) && !empty($shipping_mode_option['modes']) && is_array($shipping_mode_option['modes']) && array_key_exists($order_infos['order_payment']['shipping_method'], $shipping_mode_option['modes'])) ? $shipping_mode_option['modes'][$order_infos['order_payment']['shipping_method']]['name'] : ( (!empty($order_infos['order_payment']['shipping_method']) ) ? $order_infos['order_payment']['shipping_method'] : '' );
254
+			$shipping_mode_option = get_option('wps_shipping_mode');
255
+			$shipping_method = (!empty($order_infos['order_payment']['shipping_method']) && !empty($shipping_mode_option) && !empty($shipping_mode_option['modes']) && is_array($shipping_mode_option['modes']) && array_key_exists($order_infos['order_payment']['shipping_method'], $shipping_mode_option['modes'])) ? $shipping_mode_option['modes'][$order_infos['order_payment']['shipping_method']]['name'] : ((!empty($order_infos['order_payment']['shipping_method'])) ? $order_infos['order_payment']['shipping_method'] : '');
256 256
 
257 257
 
258
-			if( !empty( $order_infos ) && !empty($order_infos['cart_type']) && $order_infos['cart_type'] == 'normal' && !empty($order_infos['order_key']) ){
258
+			if (!empty($order_infos) && !empty($order_infos['cart_type']) && $order_infos['cart_type'] == 'normal' && !empty($order_infos['order_key'])) {
259 259
 				$message_type = 'WPSHOP_NEW_ORDER_ADMIN_MESSAGE';
260 260
 			}
261 261
 			else {
@@ -263,12 +263,12 @@  discard block
 block discarded – undo
263 263
 				$order_tmp_key = $order_infos['order_temporary_key'];
264 264
 			}
265 265
 
266
-			$payment_method_option = get_option( 'wps_payment_mode' );
267
-			$order_payment_method = ( !empty($payment_method_option) && !empty($payment_method_option['mode']) && !empty($order_infos['order_payment']['customer_choice']['method']) && !empty($payment_method_option['mode'][$order_infos['order_payment']['customer_choice']['method']])  ) ? $payment_method_option['mode'][$order_infos['order_payment']['customer_choice']['method']]['name'] : $order_infos['order_payment']['customer_choice']['method'];
266
+			$payment_method_option = get_option('wps_payment_mode');
267
+			$order_payment_method = (!empty($payment_method_option) && !empty($payment_method_option['mode']) && !empty($order_infos['order_payment']['customer_choice']['method']) && !empty($payment_method_option['mode'][$order_infos['order_payment']['customer_choice']['method']])) ? $payment_method_option['mode'][$order_infos['order_payment']['customer_choice']['method']]['name'] : $order_infos['order_payment']['customer_choice']['method'];
268 268
 
269
-			$data_to_send = array('order_id' => $order_id, 'order_key' => $order_infos['order_key'], 'customer_email' => ( !empty($customer_infos) && !empty($customer_infos->user_email) ) ? $customer_infos->user_email : '' , 'customer_last_name' => ( !empty($customer_infos) && !empty($customer_infos->user_lastname) ) ? $customer_infos->user_lastname : '', 'customer_first_name' => ( !empty($customer_infos) && !empty($customer_infos->user_firstname) ) ? $customer_infos->user_firstname : '', 'order_date' => $order_infos['order_date'], 'order_payment_method' => $order_payment_method, 'order_temporary_key' => $order_tmp_key, 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '','order_shipping_method' => $shipping_method, 'order_personnal_informations' => '' );
269
+			$data_to_send = array('order_id' => $order_id, 'order_key' => $order_infos['order_key'], 'customer_email' => (!empty($customer_infos) && !empty($customer_infos->user_email)) ? $customer_infos->user_email : '', 'customer_last_name' => (!empty($customer_infos) && !empty($customer_infos->user_lastname)) ? $customer_infos->user_lastname : '', 'customer_first_name' => (!empty($customer_infos) && !empty($customer_infos->user_firstname)) ? $customer_infos->user_firstname : '', 'order_date' => $order_infos['order_date'], 'order_payment_method' => $order_payment_method, 'order_temporary_key' => $order_tmp_key, 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '', 'order_shipping_method' => $shipping_method, 'order_personnal_informations' => '');
270 270
 
271
-			$wps_message->wpshop_prepared_email( $shop_admin_email, $message_type, $data_to_send, array('object_type' => 'order', 'object_id' => $order_id));
271
+			$wps_message->wpshop_prepared_email($shop_admin_email, $message_type, $data_to_send, array('object_type' => 'order', 'object_id' => $order_id));
272 272
 		}
273 273
 	}
274 274
 
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
 	 * @param mixed $data Array or false.
280 280
 	 * @return void
281 281
 	 */
282
-	public static function wps_direct_payment_link( $data = false ) {
283
-		$data = empty( $data ) ? self::wps_direct_payment_link_verify_token() : $data;
284
-		if ( (bool) $data ) {
285
-			wps_orders_ctr::pay_quotation( $data['oid'] );
286
-			wpshop_tools::wpshop_safe_redirect( get_permalink( wpshop_tools::get_page_id( get_option( 'wpshop_checkout_page_id' ) ) ) . '?order_step=5' );
282
+	public static function wps_direct_payment_link($data = false) {
283
+		$data = empty($data) ? self::wps_direct_payment_link_verify_token() : $data;
284
+		if ((bool)$data) {
285
+			wps_orders_ctr::pay_quotation($data['oid']);
286
+			wpshop_tools::wpshop_safe_redirect(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'))) . '?order_step=5');
287 287
 		} else {
288
-			wpshop_tools::wpshop_safe_redirect( get_permalink( wpshop_tools::get_page_id( get_option( 'wpshop_myaccount_page_id' ) ) ) );
288
+			wpshop_tools::wpshop_safe_redirect(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))));
289 289
 		}
290 290
 	}
291 291
 	/**
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
 	 * @param mixed $data Array or false.
296 296
 	 * @return void
297 297
 	 */
298
-	public static function wps_direct_payment_link_nopriv( $data = false ) {
299
-		$data = empty( $data ) ? self::wps_direct_payment_link_verify_token() : $data;
300
-		if ( (bool) $data ) {
301
-			wp_set_auth_cookie( $data['cid'], true, is_ssl() );
298
+	public static function wps_direct_payment_link_nopriv($data = false) {
299
+		$data = empty($data) ? self::wps_direct_payment_link_verify_token() : $data;
300
+		if ((bool)$data) {
301
+			wp_set_auth_cookie($data['cid'], true, is_ssl());
302 302
 		}
303
-		self::wps_direct_payment_link( $data );
303
+		self::wps_direct_payment_link($data);
304 304
 	}
305 305
 	/**
306 306
 	 * Verify token in request.
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
 	 * @return mixed Customer id or false.
310 310
 	 */
311 311
 	public static function wps_direct_payment_link_verify_token() {
312
-		$token = ! empty( $_GET['token'] ) ? sanitize_text_field( $_GET['token'] ) : '';
313
-		$order_id = ! empty( $_GET['order_id'] ) ? (int) $_GET['order_id'] : '';
314
-		$order_metadata = get_post_meta( $order_id, '_order_postmeta', true );
315
-		$customer_id = ! empty( $order_metadata['customer_id'] ) ? (int) $order_metadata['customer_id'] : false;
316
-		return ( (bool) $customer_id && wps_orders_ctr::wps_verify_token_order( $token, (int) $order_id ) ) ? array( 'oid' => $order_id, 'cid' => $customer_id ) : false;
312
+		$token = !empty($_GET['token']) ? sanitize_text_field($_GET['token']) : '';
313
+		$order_id = !empty($_GET['order_id']) ? (int)$_GET['order_id'] : '';
314
+		$order_metadata = get_post_meta($order_id, '_order_postmeta', true);
315
+		$customer_id = !empty($order_metadata['customer_id']) ? (int)$order_metadata['customer_id'] : false;
316
+		return ((bool)$customer_id && wps_orders_ctr::wps_verify_token_order($token, (int)$order_id)) ? array('oid' => $order_id, 'cid' => $customer_id) : false;
317 317
 	}
318 318
 	/**
319 319
 	 * Get URL for wps_direct_link.
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @param  int $order_id OrderID.
323 323
 	 * @return string Url or empty string.
324 324
 	 */
325
-	public static function wps_direct_payment_link_url( $order_id ) {
326
-		return ( (bool) ( $token = wps_orders_ctr::wps_token_order_customer( (int) $order_id ) ) ) ? admin_url( 'admin-post.php?action=wps_direct_payment_link&token=' . $token . '&amp;order_id=' . (int) $order_id ) : '';
325
+	public static function wps_direct_payment_link_url($order_id) {
326
+		return ((bool)($token = wps_orders_ctr::wps_token_order_customer((int)$order_id))) ? admin_url('admin-post.php?action=wps_direct_payment_link&token=' . $token . '&amp;order_id=' . (int)$order_id) : '';
327 327
 	}
328 328
 }
Please login to merge, or discard this patch.
includes/librairies/purchase/list_countries.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
 $wpshop_tab_countries = array(
3 3
 	'AF' => __('Afghanistan', 'wpshop'),
4 4
 	'AX' => __('&#197;land Islands', 'wpshop'),
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 $wpshop_tab_countries = array(
3 5
 	'AF' => __('Afghanistan', 'wpshop'),
4 6
 	'AX' => __('&#197;land Islands', 'wpshop'),
Please login to merge, or discard this patch.
includes/librairies/pdf/font/helveticabi.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['helveticaBI']=array(
3
-	chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
4
-	chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
5
-	','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
6
-	'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
7
-	'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
8
-	'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
9
-	chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
10
-	chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
11
-	chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
12
-	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
13
-	chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
14
-	chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
1
+<?php if (!defined('ABSPATH')) exit;
2
+$fpdf_charwidths['helveticaBI'] = array(
3
+	chr(0)=>278, chr(1)=>278, chr(2)=>278, chr(3)=>278, chr(4)=>278, chr(5)=>278, chr(6)=>278, chr(7)=>278, chr(8)=>278, chr(9)=>278, chr(10)=>278, chr(11)=>278, chr(12)=>278, chr(13)=>278, chr(14)=>278, chr(15)=>278, chr(16)=>278, chr(17)=>278, chr(18)=>278, chr(19)=>278, chr(20)=>278, chr(21)=>278,
4
+	chr(22)=>278, chr(23)=>278, chr(24)=>278, chr(25)=>278, chr(26)=>278, chr(27)=>278, chr(28)=>278, chr(29)=>278, chr(30)=>278, chr(31)=>278, ' '=>278, '!'=>333, '"'=>474, '#'=>556, '$'=>556, '%'=>889, '&'=>722, '\''=>238, '('=>333, ')'=>333, '*'=>389, '+'=>584,
5
+	','=>278, '-'=>333, '.'=>278, '/'=>278, '0'=>556, '1'=>556, '2'=>556, '3'=>556, '4'=>556, '5'=>556, '6'=>556, '7'=>556, '8'=>556, '9'=>556, ':'=>333, ';'=>333, '<'=>584, '='=>584, '>'=>584, '?'=>611, '@'=>975, 'A'=>722,
6
+	'B'=>722, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>722, 'I'=>278, 'J'=>556, 'K'=>722, 'L'=>611, 'M'=>833, 'N'=>722, 'O'=>778, 'P'=>667, 'Q'=>778, 'R'=>722, 'S'=>667, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>944,
7
+	'X'=>667, 'Y'=>667, 'Z'=>611, '['=>333, '\\'=>278, ']'=>333, '^'=>584, '_'=>556, '`'=>333, 'a'=>556, 'b'=>611, 'c'=>556, 'd'=>611, 'e'=>556, 'f'=>333, 'g'=>611, 'h'=>611, 'i'=>278, 'j'=>278, 'k'=>556, 'l'=>278, 'm'=>889,
8
+	'n'=>611, 'o'=>611, 'p'=>611, 'q'=>611, 'r'=>389, 's'=>556, 't'=>333, 'u'=>611, 'v'=>556, 'w'=>778, 'x'=>556, 'y'=>556, 'z'=>500, '{'=>389, '|'=>280, '}'=>389, '~'=>584, chr(127)=>350, chr(128)=>556, chr(129)=>350, chr(130)=>278, chr(131)=>556,
9
+	chr(132)=>500, chr(133)=>1000, chr(134)=>556, chr(135)=>556, chr(136)=>333, chr(137)=>1000, chr(138)=>667, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>278, chr(146)=>278, chr(147)=>500, chr(148)=>500, chr(149)=>350, chr(150)=>556, chr(151)=>1000, chr(152)=>333, chr(153)=>1000,
10
+	chr(154)=>556, chr(155)=>333, chr(156)=>944, chr(157)=>350, chr(158)=>500, chr(159)=>667, chr(160)=>278, chr(161)=>333, chr(162)=>556, chr(163)=>556, chr(164)=>556, chr(165)=>556, chr(166)=>280, chr(167)=>556, chr(168)=>333, chr(169)=>737, chr(170)=>370, chr(171)=>556, chr(172)=>584, chr(173)=>333, chr(174)=>737, chr(175)=>333,
11
+	chr(176)=>400, chr(177)=>584, chr(178)=>333, chr(179)=>333, chr(180)=>333, chr(181)=>611, chr(182)=>556, chr(183)=>278, chr(184)=>333, chr(185)=>333, chr(186)=>365, chr(187)=>556, chr(188)=>834, chr(189)=>834, chr(190)=>834, chr(191)=>611, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722,
12
+	chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>278, chr(205)=>278, chr(206)=>278, chr(207)=>278, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>584, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722,
13
+	chr(220)=>722, chr(221)=>667, chr(222)=>667, chr(223)=>611, chr(224)=>556, chr(225)=>556, chr(226)=>556, chr(227)=>556, chr(228)=>556, chr(229)=>556, chr(230)=>889, chr(231)=>556, chr(232)=>556, chr(233)=>556, chr(234)=>556, chr(235)=>556, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>611, chr(241)=>611,
14
+	chr(242)=>611, chr(243)=>611, chr(244)=>611, chr(245)=>611, chr(246)=>611, chr(247)=>584, chr(248)=>611, chr(249)=>611, chr(250)=>611, chr(251)=>611, chr(252)=>611, chr(253)=>556, chr(254)=>611, chr(255)=>556);
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['helveticaBI']=array(
3 5
 	chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
4 6
 	chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
Please login to merge, or discard this patch.