@@ -1423,7 +1423,7 @@ |
||
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 | */ |
@@ -46,6 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * Get the url listing slug of the current class |
48 | 48 | * |
49 | + * @param string $message |
|
49 | 50 | * @return string The table of the class |
50 | 51 | */ |
51 | 52 | function setMessage($message){ |
@@ -1244,7 +1245,7 @@ discard block |
||
1244 | 1245 | * |
1245 | 1246 | * @param integer $element_id optionnal The attribute identifier we want to get. If not specify the entire list will be returned |
1246 | 1247 | * @param string $element_status optionnal The status of element to get into database. Default is set to valid element |
1247 | - * @param mixed $field_to_search optionnal The field we want to check the row identifier into. Default is to set id |
|
1248 | + * @param string $field_to_search optionnal The field we want to check the row identifier into. Default is to set id |
|
1248 | 1249 | * |
1249 | 1250 | * @return object $element_list A wordpress database object containing the attribute list |
1250 | 1251 | */ |
@@ -1484,9 +1485,6 @@ discard block |
||
1484 | 1485 | * Get the existing element list into database |
1485 | 1486 | * |
1486 | 1487 | * @param integer $elementId optionnal The element identifier we want to get. If not specify the entire list will be returned |
1487 | - * @param string $elementStatus optionnal The status of element to get into database. Default is set to valid element |
|
1488 | - * |
|
1489 | - * @return object $elements A wordpress database object containing the element list |
|
1490 | 1488 | */ |
1491 | 1489 | public static function getElementWithAttributeAndValue($entityId, $elementId, $language, $keyForArray = '', $outputType = '') { |
1492 | 1490 | global $wpdb; |
@@ -1625,7 +1623,7 @@ discard block |
||
1625 | 1623 | /** |
1626 | 1624 | * Traduit le shortcode et affiche la valeur d'un attribut donn� |
1627 | 1625 | * @param array $atts : tableau de param�tre du shortcode |
1628 | - * @return mixed |
|
1626 | + * @return string|null |
|
1629 | 1627 | **/ |
1630 | 1628 | public static function wpshop_att_val_func($atts) { |
1631 | 1629 | global $wpdb; |
@@ -1914,7 +1912,7 @@ discard block |
||
1914 | 1912 | |
1915 | 1913 | /** |
1916 | 1914 | * |
1917 | - * @param array $attribute_list |
|
1915 | + * @param array $attribute_code |
|
1918 | 1916 | * @param string $output_from |
1919 | 1917 | * @return string The output for |
1920 | 1918 | */ |
@@ -2455,6 +2453,12 @@ discard block |
||
2455 | 2453 | return $affected_value; |
2456 | 2454 | } |
2457 | 2455 | |
2456 | + /** |
|
2457 | + * @param string $attr_code |
|
2458 | + * @param string $attr_option |
|
2459 | + * |
|
2460 | + * @return string |
|
2461 | + */ |
|
2458 | 2462 | public static function get_attribute_option_output($item, $attr_code, $attr_option, $additionnal_params = '') { |
2459 | 2463 | switch($attr_code){ |
2460 | 2464 | case 'is_downloadable_': |
@@ -3187,7 +3191,6 @@ discard block |
||
3187 | 3191 | * Define the different field available for bulk edition for entities. Attributes to display are defined by checking box in attribute option |
3188 | 3192 | * |
3189 | 3193 | * @param string $column_name The column name for output type definition |
3190 | - * @param string $post_type The current |
|
3191 | 3194 | * |
3192 | 3195 | */ |
3193 | 3196 | function quick_edit( $column_name, $entity ) { |
@@ -3212,7 +3215,6 @@ discard block |
||
3212 | 3215 | * Define the different field available for bulk edition for entities. Attributes to display are defined by checking box in attribute option |
3213 | 3216 | * |
3214 | 3217 | * @param string $column_name The column name for output type definition |
3215 | - * @param string $post_type The current |
|
3216 | 3218 | * |
3217 | 3219 | */ |
3218 | 3220 | public static function bulk_edit( $column_name, $entity ) { |
@@ -1,4 +1,6 @@ discard block |
||
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 |
||
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 | } |
@@ -115,7 +117,9 @@ discard block |
||
115 | 117 | $action = isset($_REQUEST['action']) ? wpshop_tools::varSanitizer($_REQUEST['action']) : 'add'; |
116 | 118 | $saveditem = isset($_REQUEST['saveditem']) ? wpshop_tools::varSanitizer($_REQUEST['saveditem']) : ''; |
117 | 119 | $set_section = !empty($_REQUEST[self::getDbTable()]['set_section']) ? wpshop_tools::varSanitizer($_REQUEST[self::getDbTable()]['set_section']) : ''; |
118 | - if ( !empty($_REQUEST[self::getDbTable()]['set_section']) ) unset($_REQUEST[self::getDbTable()]['set_section']); |
|
120 | + if ( !empty($_REQUEST[self::getDbTable()]['set_section']) ) { |
|
121 | + unset($_REQUEST[self::getDbTable()]['set_section']); |
|
122 | + } |
|
119 | 123 | $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : null; |
120 | 124 | if(!empty($action) && ($action=='activate') ){ |
121 | 125 | if( isset($id) ) { |
@@ -126,8 +130,7 @@ discard block |
||
126 | 130 | if(($action != '') && ($action == 'saveok') && ($saveditem > 0)){ |
127 | 131 | $editedElement = self::getElement($saveditem); |
128 | 132 | $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)){ |
|
133 | + } elseif(($action != '') && ($action == 'deleteok') && ($saveditem > 0)){ |
|
131 | 134 | $editedElement = self::getElement($saveditem, "'deleted'"); |
132 | 135 | $pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully deleted', 'wpshop'), '<span class="bold" >' . $editedElement->code . '</span>'); |
133 | 136 | } |
@@ -191,66 +194,82 @@ discard block |
||
191 | 194 | switch ($attribute_parameter['frontend_input']) { |
192 | 195 | case 'short_text': |
193 | 196 | $attribute_parameter['frontend_input'] = 'text'; |
194 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
197 | + if ( empty($attribute_parameter['backend_input']) ) { |
|
198 | + $attribute_parameter['backend_input'] = 'text'; |
|
199 | + } |
|
195 | 200 | $attribute_parameter['data_type'] = 'varchar'; |
196 | 201 | break; |
197 | 202 | case 'date_field': |
198 | 203 | $attribute_parameter['frontend_input'] = 'text'; |
199 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
204 | + if ( empty($attribute_parameter['backend_input']) ) { |
|
205 | + $attribute_parameter['backend_input'] = 'text'; |
|
206 | + } |
|
200 | 207 | $attribute_parameter['data_type'] = 'datetime'; |
201 | 208 | break; |
202 | 209 | case 'float_field': |
203 | 210 | $attribute_parameter['frontend_input'] = 'text'; |
204 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
211 | + if ( empty($attribute_parameter['backend_input']) ) { |
|
212 | + $attribute_parameter['backend_input'] = 'text'; |
|
213 | + } |
|
205 | 214 | $attribute_parameter['data_type'] = 'decimal'; |
206 | 215 | break; |
207 | 216 | case 'hidden_field': |
208 | 217 | $attribute_parameter['frontend_input'] = 'hidden'; |
209 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
218 | + if ( empty($attribute_parameter['backend_input']) ) { |
|
219 | + $attribute_parameter['backend_input'] = 'text'; |
|
220 | + } |
|
210 | 221 | $attribute_parameter['data_type'] = 'varchar'; |
211 | 222 | break; |
212 | 223 | case 'pass_field': |
213 | 224 | $attribute_parameter['frontend_input'] = 'password'; |
214 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
225 | + if ( empty($attribute_parameter['backend_input']) ) { |
|
226 | + $attribute_parameter['backend_input'] = 'text'; |
|
227 | + } |
|
215 | 228 | $attribute_parameter['data_type'] = 'varchar'; |
216 | 229 | break; |
217 | 230 | |
218 | 231 | case 'select': |
219 | 232 | $attribute_parameter['frontend_input'] = 'select'; |
220 | - if ( empty($attribute_parameter['backend_input']) || empty($id) ) |
|
221 | - $attribute_parameter['backend_input'] = 'multiple-select'; |
|
233 | + if ( empty($attribute_parameter['backend_input']) || empty($id) ) { |
|
234 | + $attribute_parameter['backend_input'] = 'multiple-select'; |
|
235 | + } |
|
222 | 236 | $attribute_parameter['data_type'] = 'integer'; |
223 | 237 | break; |
224 | 238 | case 'multiple-select': |
225 | 239 | $attribute_parameter['frontend_input'] = 'multiple-select'; |
226 | - if ( empty($attribute_parameter['backend_input']) || empty($id) ) |
|
227 | - $attribute_parameter['backend_input'] = 'multiple-select'; |
|
240 | + if ( empty($attribute_parameter['backend_input']) || empty($id) ) { |
|
241 | + $attribute_parameter['backend_input'] = 'multiple-select'; |
|
242 | + } |
|
228 | 243 | $attribute_parameter['data_type'] = 'integer'; |
229 | 244 | break; |
230 | 245 | case 'radio': |
231 | 246 | $attribute_parameter['frontend_input'] = 'radio'; |
232 | - if ( empty($attribute_parameter['backend_input']) || empty($id) ) |
|
233 | - $attribute_parameter['backend_input'] = 'multiple-select'; |
|
247 | + if ( empty($attribute_parameter['backend_input']) || empty($id) ) { |
|
248 | + $attribute_parameter['backend_input'] = 'multiple-select'; |
|
249 | + } |
|
234 | 250 | $attribute_parameter['data_type'] = 'integer'; |
235 | 251 | break; |
236 | 252 | case 'checkbox': |
237 | 253 | $attribute_parameter['frontend_input'] = 'checkbox'; |
238 | - if ( empty($attribute_parameter['backend_input']) || empty($id) ) |
|
239 | - $attribute_parameter['backend_input'] = 'multiple-select'; |
|
254 | + if ( empty($attribute_parameter['backend_input']) || empty($id) ) { |
|
255 | + $attribute_parameter['backend_input'] = 'multiple-select'; |
|
256 | + } |
|
240 | 257 | $attribute_parameter['data_type'] = 'integer'; |
241 | 258 | break; |
242 | 259 | |
243 | 260 | case 'textarea': |
244 | 261 | $attribute_parameter['frontend_input'] = 'textarea'; |
245 | - if ( empty($attribute_parameter['backend_input']) || empty($id) ) |
|
246 | - $attribute_parameter['backend_input'] = 'textarea'; |
|
262 | + if ( empty($attribute_parameter['backend_input']) || empty($id) ) { |
|
263 | + $attribute_parameter['backend_input'] = 'textarea'; |
|
264 | + } |
|
247 | 265 | $attribute_parameter['data_type'] = 'text'; |
248 | 266 | break; |
249 | 267 | } |
250 | - } |
|
251 | - else { |
|
268 | + } else { |
|
252 | 269 | $attribute_parameter['frontend_input'] = 'text'; |
253 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
270 | + if ( empty($attribute_parameter['backend_input']) ) { |
|
271 | + $attribute_parameter['backend_input'] = 'text'; |
|
272 | + } |
|
254 | 273 | $attribute_parameter['data_type'] = 'varchar'; |
255 | 274 | } |
256 | 275 | |
@@ -282,22 +301,18 @@ discard block |
||
282 | 301 | if(!in_array($attribute_code, $attribute_undeletable)){ |
283 | 302 | if(current_user_can('wpshop_delete_attributes')){ |
284 | 303 | $attribute_parameter['status'] = 'deleted'; |
285 | - } |
|
286 | - else{ |
|
304 | + } else{ |
|
287 | 305 | $actionResult = 'userNotAllowedForActionDelete'; |
288 | 306 | } |
289 | - } |
|
290 | - else{ |
|
307 | + } else{ |
|
291 | 308 | $actionResult = 'unDeletableAtribute'; |
292 | 309 | } |
293 | 310 | } |
294 | 311 | $actionResult = wpshop_database::update($attribute_parameter, $id, self::getDbTable()); |
295 | - } |
|
296 | - else{ |
|
312 | + } else{ |
|
297 | 313 | $actionResult = 'userNotAllowedForActionEdit'; |
298 | 314 | } |
299 | - } |
|
300 | - elseif(($pageAction != '') && (($pageAction == 'delete'))){ |
|
315 | + } elseif(($pageAction != '') && (($pageAction == 'delete'))){ |
|
301 | 316 | $attribute_code = ''; |
302 | 317 | if (empty( $attribute_parameter['code'])) { |
303 | 318 | $attribute = self::getElement($id, "'valid', 'moderated', 'notused', 'deleted'", 'id'); |
@@ -308,14 +323,13 @@ discard block |
||
308 | 323 | $attribute_parameter['last_update_date'] = current_time('mysql', 0); |
309 | 324 | $attribute_parameter['status'] = 'deleted'; |
310 | 325 | $actionResult = wpshop_database::update($attribute_parameter, $id, self::getDbTable()); |
326 | + } else { |
|
327 | + $actionResult = 'userNotAllowedForActionDelete'; |
|
311 | 328 | } |
312 | - else |
|
313 | - $actionResult = 'userNotAllowedForActionDelete'; |
|
329 | + } else { |
|
330 | + $actionResult = 'unDeletableAtribute'; |
|
314 | 331 | } |
315 | - else |
|
316 | - $actionResult = 'unDeletableAtribute'; |
|
317 | - } |
|
318 | - elseif(($pageAction != '') && (($pageAction == 'save') || ($pageAction == 'saveandcontinue') || ($pageAction == 'add'))){ |
|
332 | + } elseif(($pageAction != '') && (($pageAction == 'save') || ($pageAction == 'saveandcontinue') || ($pageAction == 'add'))){ |
|
319 | 333 | if(current_user_can('wpshop_add_attributes')){ |
320 | 334 | $attribute_parameter['creation_date'] = current_time('mysql', 0); |
321 | 335 | if(trim($attribute_parameter['code']) == ''){ |
@@ -328,8 +342,7 @@ discard block |
||
328 | 342 | } |
329 | 343 | $actionResult = wpshop_database::save($attribute_parameter, self::getDbTable()); |
330 | 344 | $id = $wpdb->insert_id; |
331 | - } |
|
332 | - else{ |
|
345 | + } else{ |
|
333 | 346 | $actionResult = 'userNotAllowedForActionAdd'; |
334 | 347 | } |
335 | 348 | } |
@@ -340,11 +353,12 @@ discard block |
||
340 | 353 | /****************************************************************************/ |
341 | 354 | if($actionResult != ''){ |
342 | 355 | $elementIdentifierForMessage = __('the attribute', 'wpshop'); |
343 | - if(!empty($attribute_parameter['name']))$elementIdentifierForMessage = '<span class="bold" >' . $attribute_parameter['frontend_label'] . '</span>'; |
|
356 | + if(!empty($attribute_parameter['name'])) { |
|
357 | + $elementIdentifierForMessage = '<span class="bold" >' . $attribute_parameter['frontend_label'] . '</span>'; |
|
358 | + } |
|
344 | 359 | if ($actionResult == 'error') {/* CHANGE HERE FOR SPECIFIC CASE */ |
345 | 360 | $pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . sprintf(__('An error occured while saving %s', 'wpshop'), $elementIdentifierForMessage, ' -> ' . $wpdb->last_error); |
346 | - } |
|
347 | - else if (($actionResult == 'done') || ($actionResult == 'nothingToUpdate')) {/* CHANGE HERE FOR SPECIFIC CASE */ |
|
361 | + } else if (($actionResult == 'done') || ($actionResult == 'nothingToUpdate')) {/* CHANGE HERE FOR SPECIFIC CASE */ |
|
348 | 362 | /*****************************************************************************************************************/ |
349 | 363 | /************************* CHANGE FOR SPECIFIC ACTION FOR CURRENT ELEMENT ****************************/ |
350 | 364 | /*****************************************************************************************************************/ |
@@ -363,8 +377,7 @@ discard block |
||
363 | 377 | if (empty($attribute_parameter['code'])) { |
364 | 378 | $attribute = self::getElement($id, "'valid', 'moderated', 'notused'", 'id'); |
365 | 379 | $attribute_code = $attribute->code; |
366 | - } |
|
367 | - else { |
|
380 | + } else { |
|
368 | 381 | $attribute_code = $attribute_parameter['code']; |
369 | 382 | } |
370 | 383 | foreach ($optionsUpdate as $option_key => $option_label) { |
@@ -455,8 +468,7 @@ discard block |
||
455 | 468 | $choosen_set_section = explode('_', $set_section); |
456 | 469 | $set_id = $choosen_set_section[0]; |
457 | 470 | $group_id = $choosen_set_section[1]; |
458 | - } |
|
459 | - else{ |
|
471 | + } else{ |
|
460 | 472 | $attribute_current_attribute_set = 0; |
461 | 473 | $query = $wpdb->prepare(" |
462 | 474 | SELECT id |
@@ -504,7 +516,9 @@ discard block |
||
504 | 516 | $attribute_parameter['entity_id'] |
505 | 517 | ); |
506 | 518 | $wpshopAttributePosition = $wpdb->get_var($query); |
507 | - if($wpshopAttributePosition == 0)$wpshopAttributePosition = 1; |
|
519 | + if($wpshopAttributePosition == 0) { |
|
520 | + $wpshopAttributePosition = 1; |
|
521 | + } |
|
508 | 522 | $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)); |
509 | 523 | } |
510 | 524 | } |
@@ -525,15 +539,14 @@ discard block |
||
525 | 539 | wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=saveok&saveditem=" . $id)); |
526 | 540 | } |
527 | 541 | else */ |
528 | - if ( $pageAction == 'add' ) |
|
529 | - wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=edit&id=" . $id)); |
|
530 | - elseif ( $pageAction == 'delete' ) |
|
531 | - wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=deleteok&saveditem=" . $id)); |
|
532 | - } |
|
533 | - elseif(($actionResult == 'userNotAllowedForActionEdit') || ($actionResult == 'userNotAllowedForActionAdd') || ($actionResult == 'userNotAllowedForActionDelete')){ |
|
542 | + if ( $pageAction == 'add' ) { |
|
543 | + wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=edit&id=" . $id)); |
|
544 | + } elseif ( $pageAction == 'delete' ) { |
|
545 | + wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=deleteok&saveditem=" . $id)); |
|
546 | + } |
|
547 | + } elseif(($actionResult == 'userNotAllowedForActionEdit') || ($actionResult == 'userNotAllowedForActionAdd') || ($actionResult == 'userNotAllowedForActionDelete')){ |
|
534 | 548 | $pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . __('You are not allowed to do this action', 'wpshop'); |
535 | - } |
|
536 | - elseif(($actionResult == 'unDeletableAtribute')){ |
|
549 | + } elseif(($actionResult == 'unDeletableAtribute')){ |
|
537 | 550 | $pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . __('This attribute could not be deleted due to configuration', 'wpshop'); |
538 | 551 | } |
539 | 552 | |
@@ -577,8 +590,7 @@ discard block |
||
577 | 590 | if ( !empty($s) ) { |
578 | 591 | $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') ); |
579 | 592 | $attr_set_list = $wpdb->get_results( $query ); |
580 | - } |
|
581 | - else { |
|
593 | + } else { |
|
582 | 594 | $attr_set_list = self::getElement( '', $status ); |
583 | 595 | } |
584 | 596 | $i=0; |
@@ -630,8 +642,9 @@ discard block |
||
630 | 642 | global $attribute_displayed_field, $attribute_options_group; |
631 | 643 | $dbFieldList = wpshop_database::fields_to_input(self::getDbTable()); |
632 | 644 | $editedItem = ''; |
633 | - if($itemToEdit != '') |
|
634 | - $editedItem = self::getElement($itemToEdit); |
|
645 | + if($itemToEdit != '') { |
|
646 | + $editedItem = self::getElement($itemToEdit); |
|
647 | + } |
|
635 | 648 | |
636 | 649 | $the_form_content_hidden = $the_form_general_content = ''; |
637 | 650 | $the_form_option_content_list = array(); |
@@ -644,10 +657,11 @@ discard block |
||
644 | 657 | $pageAction = isset($_REQUEST[self::getDbTable() . '_action']) ? sanitize_text_field($_REQUEST[self::getDbTable() . '_action']) : ''; |
645 | 658 | $requestFormValue = isset($_REQUEST[self::currentPageCode][$input_def['label']]) ? sanitize_text_field($_REQUEST[self::currentPageCode][$input_def['label']]) : ''; |
646 | 659 | $currentFieldValue = $input_def['value']; |
647 | - if(is_object($editedItem)) |
|
648 | - $currentFieldValue = $editedItem->{$input_def['label']}; |
|
649 | - elseif(($pageAction != '') && ($requestFormValue != '')) |
|
650 | - $currentFieldValue = $requestFormValue; |
|
660 | + if(is_object($editedItem)) { |
|
661 | + $currentFieldValue = $editedItem->{$input_def['label']}; |
|
662 | + } elseif(($pageAction != '') && ($requestFormValue != '')) { |
|
663 | + $currentFieldValue = $requestFormValue; |
|
664 | + } |
|
651 | 665 | |
652 | 666 | if($input_def['label'] == 'status'){ |
653 | 667 | if(in_array('notused', $input_def['possible_value'])){ |
@@ -719,9 +733,9 @@ discard block |
||
719 | 733 | } |
720 | 734 | |
721 | 735 | $input_def['value'] = $currentFieldValue; |
722 | - if($input_def['label'] == 'code') |
|
723 | - $input_def['type'] = 'hidden'; |
|
724 | - elseif($input_def['label'] == 'entity_id'){ |
|
736 | + if($input_def['label'] == 'code') { |
|
737 | + $input_def['type'] = 'hidden'; |
|
738 | + } elseif($input_def['label'] == 'entity_id'){ |
|
725 | 739 | $input_def['possible_value'] = wpshop_entities::get_entities_list(); |
726 | 740 | $input_def['valueToPut'] = 'index'; |
727 | 741 | $input_def['type'] = 'select'; |
@@ -733,21 +747,17 @@ discard block |
||
733 | 747 | } |
734 | 748 | $i++; |
735 | 749 | } |
736 | - } |
|
737 | - elseif($input_def['label'] == '_unit_group_id'){ |
|
750 | + } elseif($input_def['label'] == '_unit_group_id'){ |
|
738 | 751 | $input_def['possible_value'] = wpshop_attributes_unit::get_unit_group(); |
739 | 752 | $input_def['type'] = 'select'; |
740 | - } |
|
741 | - elseif($input_def['label'] == '_default_unit'){ |
|
753 | + } elseif($input_def['label'] == '_default_unit'){ |
|
742 | 754 | $unit_group_list = wpshop_attributes_unit::get_unit_group(); |
743 | 755 | $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:'')); |
744 | 756 | $input_def['type'] = 'select'; |
745 | - } |
|
746 | - elseif ($input_def['label'] == 'backend_input') { |
|
757 | + } elseif ($input_def['label'] == 'backend_input') { |
|
747 | 758 | if ( !is_object($editedItem) ) { |
748 | 759 | $input_def['type'] = 'hidden'; |
749 | - } |
|
750 | - else { |
|
760 | + } else { |
|
751 | 761 | $new_possible_value = array(); |
752 | 762 | switch ( $editedItem->data_type) { |
753 | 763 | case 'integer': |
@@ -781,8 +791,7 @@ discard block |
||
781 | 791 | } |
782 | 792 | $input_def['possible_value'] = $new_possible_value; |
783 | 793 | } |
784 | - } |
|
785 | - elseif ($input_def['label'] == 'frontend_input') { |
|
794 | + } elseif ($input_def['label'] == 'frontend_input') { |
|
786 | 795 | $new_possible_value = array(); |
787 | 796 | |
788 | 797 | if ( is_object($editedItem) ) { |
@@ -816,8 +825,7 @@ discard block |
||
816 | 825 | $new_possible_value[__('Date field', 'wpshop')] = 'date_field'; |
817 | 826 | break; |
818 | 827 | } |
819 | - } |
|
820 | - else { |
|
828 | + } else { |
|
821 | 829 | $new_possible_value[__('Text field', 'wpshop')] = 'short_text'; |
822 | 830 | $new_possible_value[__('Number field', 'wpshop')] = 'float_field'; |
823 | 831 | $new_possible_value[__('Date field', 'wpshop')] = 'date_field'; |
@@ -909,8 +917,7 @@ discard block |
||
909 | 917 | $the_input = wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE); |
910 | 918 | break; |
911 | 919 | } |
912 | - } |
|
913 | - else { |
|
920 | + } else { |
|
914 | 921 | $input_def['type']='text'; |
915 | 922 | $the_input = wpshop_form::check_input_type($input_def, self::getDbTable()); |
916 | 923 | } |
@@ -937,9 +944,9 @@ discard block |
||
937 | 944 | <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> |
938 | 945 | <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> |
939 | 946 | </tr>'; |
940 | - 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 )) ) |
|
941 | - $the_form_option_content_list[$input_def['label']] = $input; |
|
942 | - else { |
|
947 | + 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 )) ) { |
|
948 | + $the_form_option_content_list[$input_def['label']] = $input; |
|
949 | + } else { |
|
943 | 950 | $the_form_general_content .= $input; |
944 | 951 | if ( ($input_def['label'] == 'frontend_input') && !is_object($editedItem) ) { |
945 | 952 | |
@@ -953,8 +960,7 @@ discard block |
||
953 | 960 | $the_form_general_content .= $input; |
954 | 961 | } |
955 | 962 | } |
956 | - } |
|
957 | - else{ |
|
963 | + } else{ |
|
958 | 964 | $the_form_content_hidden .= ' |
959 | 965 | ' . $the_input; |
960 | 966 | } |
@@ -1238,17 +1244,18 @@ discard block |
||
1238 | 1244 | |
1239 | 1245 | //$currentPageButton .= '<h2 class="cancelButton alignleft" ><a href="' . admin_url('edit.php?post_type='.WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES.'&page=' . self::getListingSlug()) . '" class="button add-new-h2" >' . __('Back', 'wpshop') . '</a></h2>'; |
1240 | 1246 | |
1241 | - if(($action == 'add') && (current_user_can('wpshop_add_attributes'))) |
|
1242 | - $currentPageButton .= '<input type="button" class="button-primary" id="add" name="add" value="' . __('Add', 'wpshop') . '" />'; |
|
1243 | - |
|
1244 | - elseif(current_user_can('wpshop_edit_attributes')) |
|
1245 | - $currentPageButton .= '<input type="button" class="button-primary" id="save" name="save" value="' . __('Save', 'wpshop') . '" />'; |
|
1247 | + if(($action == 'add') && (current_user_can('wpshop_add_attributes'))) { |
|
1248 | + $currentPageButton .= '<input type="button" class="button-primary" id="add" name="add" value="' . __('Add', 'wpshop') . '" />'; |
|
1249 | + } elseif(current_user_can('wpshop_edit_attributes')) { |
|
1250 | + $currentPageButton .= '<input type="button" class="button-primary" id="save" name="save" value="' . __('Save', 'wpshop') . '" />'; |
|
1251 | + } |
|
1246 | 1252 | |
1247 | 1253 | $attribute_undeletable = unserialize(WPSHOP_ATTRIBUTE_UNDELETABLE); |
1248 | 1254 | $attribute = self::getElement($element_id, "'valid', 'moderated', 'notused'", 'id'); |
1249 | 1255 | $attribute_code = !empty($attribute->code)?$attribute->code:''; |
1250 | - if(current_user_can('wpshop_delete_attributes') && ($action != 'add') && !in_array($attribute_code, $attribute_undeletable)) |
|
1251 | - $currentPageButton .= '<input type="button" class="button-secondary wpshop_delete_element_button wpshop_delete_element_button_'.self::currentPageCode.'" id="delete" name="delete" value="' . __('Delete', 'wpshop') . '" />'; |
|
1256 | + if(current_user_can('wpshop_delete_attributes') && ($action != 'add') && !in_array($attribute_code, $attribute_undeletable)) { |
|
1257 | + $currentPageButton .= '<input type="button" class="button-secondary wpshop_delete_element_button wpshop_delete_element_button_'.self::currentPageCode.'" id="delete" name="delete" value="' . __('Delete', 'wpshop') . '" />'; |
|
1258 | + } |
|
1252 | 1259 | |
1253 | 1260 | return $currentPageButton; |
1254 | 1261 | } |
@@ -1290,8 +1297,7 @@ discard block |
||
1290 | 1297 | /* Get the query result regarding on the function parameters. If there must be only one result or a collection */ |
1291 | 1298 | if(($element_id == '') || $list){ |
1292 | 1299 | $element_list = $wpdb->get_results($query); |
1293 | - } |
|
1294 | - else{ |
|
1300 | + } else{ |
|
1295 | 1301 | $element_list = $wpdb->get_row($query); |
1296 | 1302 | } |
1297 | 1303 | |
@@ -1385,8 +1391,7 @@ discard block |
||
1385 | 1391 | foreach($attributeValue as $a){ |
1386 | 1392 | $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($query_params, array('value' => $a))); |
1387 | 1393 | } |
1388 | - } |
|
1389 | - else{ |
|
1394 | + } else{ |
|
1390 | 1395 | $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($query_params, array('value' => $attributeValue))); |
1391 | 1396 | wpeologs_ctr::log_datas_in_files( 'wpshop_attributes', array( |
1392 | 1397 | 'object_id' => $entityId, |
@@ -1404,8 +1409,10 @@ discard block |
||
1404 | 1409 | $value = self::get_attribute_type_select_option_info($attributeTypeDetails[$attribute_code], 'value'); |
1405 | 1410 | if (strtolower($value) == 'yes') : |
1406 | 1411 | update_post_meta($entityId, 'attribute_option_'.$attribute_code, $_POST['attribute_option'][$attribute_code]); |
1407 | - else : |
|
1412 | + else { |
|
1413 | + : |
|
1408 | 1414 | delete_post_meta($entityId, 'attribute_option_'.$attribute_code); |
1415 | + } |
|
1409 | 1416 | endif; |
1410 | 1417 | } |
1411 | 1418 | } |
@@ -1465,8 +1472,7 @@ discard block |
||
1465 | 1472 | |
1466 | 1473 | if ( ( (count($attributeValue) <= 1 ) && !empty($attributeValue[0]) ) && ( empty($atribute_params['frontend_input']) || ($atribute_params['frontend_input'] != 'multiple-select') )) { |
1467 | 1474 | $attributeValue = $attributeValue[0]; |
1468 | - } |
|
1469 | - else{ |
|
1475 | + } else{ |
|
1470 | 1476 | $entity_meta = get_post_meta($entityId, WPSHOP_PRODUCT_ATTRIBUTE_META_KEY, true); |
1471 | 1477 | if ( !empty($entity_meta) ) { |
1472 | 1478 | $query = $wpdb->prepare("SELECT code FROM " . WPSHOP_DBT_ATTRIBUTE . " WHERE id = %d AND entity_id = %d ", $attributeId, $entityTypeId); |
@@ -1532,12 +1538,10 @@ discard block |
||
1532 | 1538 | if ( !empty($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value']) ) { |
1533 | 1539 | if (is_array($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'])) { |
1534 | 1540 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'][] = $elementDefinition->$attributeValueField; |
1535 | - } |
|
1536 | - else { |
|
1541 | + } else { |
|
1537 | 1542 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'] = array($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'],$elementDefinition->$attributeValueField); |
1538 | 1543 | } |
1539 | - } |
|
1540 | - else { |
|
1544 | + } else { |
|
1541 | 1545 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'] = $elementDefinition->$attributeValueField; |
1542 | 1546 | } |
1543 | 1547 | |
@@ -1618,17 +1622,14 @@ discard block |
||
1618 | 1622 | 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' ) |
1619 | 1623 | || empty($attribute_custom_config) ) { |
1620 | 1624 | $attribute_output = true; |
1621 | - } |
|
1622 | - 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')) ) { |
|
1625 | + } 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')) ) { |
|
1623 | 1626 | $attribute_output = false; |
1624 | 1627 | } |
1625 | - } |
|
1626 | - elseif ( $attribute_main_config === 'no' ) { |
|
1628 | + } elseif ( $attribute_main_config === 'no' ) { |
|
1627 | 1629 | $attribute_output = false; |
1628 | 1630 | if ( empty($attribute_custom_config[$attribute_or_set]) || empty($attribute_custom_config[$attribute_or_set][$attribute_code]) ) { |
1629 | 1631 | $attribute_output = false; |
1630 | - } |
|
1631 | - 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') ) { |
|
1632 | + } 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') ) { |
|
1632 | 1633 | $attribute_output = true; |
1633 | 1634 | } |
1634 | 1635 | } |
@@ -1646,7 +1647,9 @@ discard block |
||
1646 | 1647 | global $wp_query; |
1647 | 1648 | |
1648 | 1649 | $attribute = self::getElement( $atts['attid'] ); |
1649 | - if(empty($atts['pid'])) $atts['pid'] = $wp_query->posts[0]->ID; |
|
1650 | + if(empty($atts['pid'])) { |
|
1651 | + $atts['pid'] = $wp_query->posts[0]->ID; |
|
1652 | + } |
|
1650 | 1653 | $attribute_main_config = ( empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet') ) ? $attribute->is_visible_in_front : $attribute->is_visible_in_front_listing; |
1651 | 1654 | $output_type = ( empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet') ) ? 'complete_sheet' : 'mini_output'; |
1652 | 1655 | $product_attribute_custom_config = get_post_meta($atts['pid'], WPSHOP_PRODUCT_FRONT_DISPLAY_CONF, true); |
@@ -1665,13 +1668,11 @@ discard block |
||
1665 | 1668 | } |
1666 | 1669 | $has_value = true; |
1667 | 1670 | } |
1668 | - } |
|
1669 | - else { |
|
1671 | + } else { |
|
1670 | 1672 | $data = $wpdb->get_var($query); |
1671 | 1673 | if ( !empty($data) ) { |
1672 | 1674 | $has_value = true; |
1673 | - } |
|
1674 | - elseif( !empty($attribute->default_value) ) { |
|
1675 | + } elseif( !empty($attribute->default_value) ) { |
|
1675 | 1676 | $has_value = true; |
1676 | 1677 | $data = $attribute->default_value; |
1677 | 1678 | } |
@@ -1731,11 +1732,9 @@ discard block |
||
1731 | 1732 | |
1732 | 1733 | if ( !empty($attribute_value) && !is_object($attribute_value) ) { |
1733 | 1734 | $input_def['value'] = $attribute_value; |
1734 | - } |
|
1735 | - else if ( !empty($attribute_value->value) ) { |
|
1735 | + } else if ( !empty($attribute_value->value) ) { |
|
1736 | 1736 | $input_def['value'] = stripslashes($attribute_value->value); |
1737 | - } |
|
1738 | - else if ( !empty($specific_argument['element_identifier']) && empty($attribute_value) && (get_post_status($specific_argument['element_identifier']) != 'auto-draft') ) { |
|
1737 | + } else if ( !empty($specific_argument['element_identifier']) && empty($attribute_value) && (get_post_status($specific_argument['element_identifier']) != 'auto-draft') ) { |
|
1739 | 1738 | $input_def['value'] = ''; |
1740 | 1739 | } |
1741 | 1740 | |
@@ -1745,8 +1744,7 @@ discard block |
||
1745 | 1744 | $date_config = unserialize( $attribute->default_value ); |
1746 | 1745 | if ((($date_config['default_value'] == '') || ($date_config['default_value'] == 'date_of_current_day')) && ($date_config['default_value'] == 'date_of_current_day')) { |
1747 | 1746 | $input_def['value'] = date('Y-m-d'); |
1748 | - } |
|
1749 | - else { |
|
1747 | + } else { |
|
1750 | 1748 | /** Modification due to a message on eoxia forum: http://www.eoxia.com/forums/topic/bug-attribut-de-type-date-dans-fiche-produit-admin/ */ |
1751 | 1749 | $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 ) : '' ); |
1752 | 1750 | } |
@@ -1851,8 +1849,7 @@ discard block |
||
1851 | 1849 | if((WPSHOP_PRODUCT_PRICE_PILOT == 'HT') && ($attribute->code == WPSHOP_PRODUCT_PRICE_TTC) ){ |
1852 | 1850 | $input_def['option'] .= ' readonly="readonly" '; |
1853 | 1851 | $input_more_class .= ' wpshop_prices_readonly'; |
1854 | - } |
|
1855 | - elseif((WPSHOP_PRODUCT_PRICE_PILOT == 'TTC') && ($attribute->code == WPSHOP_PRODUCT_PRICE_HT) ){ |
|
1852 | + } elseif((WPSHOP_PRODUCT_PRICE_PILOT == 'TTC') && ($attribute->code == WPSHOP_PRODUCT_PRICE_HT) ){ |
|
1856 | 1853 | $input_def['option'] .= ' readonly="readonly" '; |
1857 | 1854 | $input_more_class .= ' wpshop_prices_readonly'; |
1858 | 1855 | } |
@@ -1876,14 +1873,12 @@ discard block |
||
1876 | 1873 | if ($attribute->is_requiring_unit == 'yes') { |
1877 | 1874 | if ( in_array($attribute->code, $wpshop_price_attributes) || ( WPSHOP_COST_OF_POSTAGE == $attribute->code) ) { |
1878 | 1875 | $input_def['options'] .= ' <span class="attribute_currency" id="attribute_currency_' . $attribute->id . '" >' . wpshop_tools::wpshop_get_currency() . '</span>'; |
1879 | - } |
|
1880 | - elseif ( in_array($attribute->code, $wpshop_weight_attributes) ) { |
|
1876 | + } elseif ( in_array($attribute->code, $wpshop_weight_attributes) ) { |
|
1881 | 1877 | $weight_defaut_unity_option = get_option('wpshop_shop_default_weight_unity'); |
1882 | 1878 | $query = $wpdb->prepare('SELECT name FROM '. WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id=%d', $weight_defaut_unity_option); |
1883 | 1879 | $unity = $wpdb->get_var( $query ); |
1884 | 1880 | $input_def['options'] .= ' <span class="attribute_weight" id="attribute_weight_' . $attribute->id . '" >' . __($unity, 'wpshop') . '</span>'; |
1885 | - } |
|
1886 | - else { |
|
1881 | + } else { |
|
1887 | 1882 | unset($unit_input_def); |
1888 | 1883 | $unit_input_def['possible_value'] = wpshop_attributes_unit::get_unit_list_for_group($attribute->_unit_group_id); |
1889 | 1884 | $unit_input_def['type'] = 'select'; |
@@ -1894,8 +1889,7 @@ discard block |
||
1894 | 1889 | if($unit_input_def['value'] == ''){ |
1895 | 1890 | if ( $attribute->_default_unit > 0 ) { |
1896 | 1891 | $unit_input_def['value'] = $attribute->_default_unit; |
1897 | - } |
|
1898 | - else { |
|
1892 | + } else { |
|
1899 | 1893 | $unit_input_def['value'] = wpshop_attributes_unit::get_default_unit_for_group($attribute->_unit_group_id); |
1900 | 1894 | } |
1901 | 1895 | } |
@@ -1919,8 +1913,7 @@ discard block |
||
1919 | 1913 | $input_def['label_pointer'] = ''; |
1920 | 1914 | $input_def['option'] = substr( $input_def['option'], 0 , -2 ) . ' wpshop_attributes_is_user_defined_admin_field "'; |
1921 | 1915 | $input_def['field_container_class'] .= 'wpshop_attributes_is_user_defined_admin_container'; |
1922 | - } |
|
1923 | - else { |
|
1916 | + } else { |
|
1924 | 1917 | $input_def['output'] = wpshop_form::check_input_type($input_def, $attributeInputDomain); |
1925 | 1918 | } |
1926 | 1919 | return $input_def; |
@@ -2017,8 +2010,7 @@ discard block |
||
2017 | 2010 | /** Check the value type to check if empty or not */ |
2018 | 2011 | if ( $attributeDefinition['data_type'] == 'int' ) { |
2019 | 2012 | $attributeDefinition['value'] = (int)$attributeDefinition['value']; |
2020 | - } |
|
2021 | - else if ( $attributeDefinition['data_type'] == 'decimal' ) { |
|
2013 | + } else if ( $attributeDefinition['data_type'] == 'decimal' ) { |
|
2022 | 2014 | $attributeDefinition['value'] = (float)$attributeDefinition['value']; |
2023 | 2015 | } |
2024 | 2016 | |
@@ -2080,8 +2072,7 @@ discard block |
||
2080 | 2072 | require(wpshop_display::get_template_file($tpl_way_to_take[1])); |
2081 | 2073 | $tab_list .= ob_get_contents(); |
2082 | 2074 | ob_end_clean(); |
2083 | - } |
|
2084 | - else { |
|
2075 | + } else { |
|
2085 | 2076 | $tab_list .= wpshop_display::display_template_element($template_part, $tpl_component); |
2086 | 2077 | } |
2087 | 2078 | unset($tpl_component); |
@@ -2100,8 +2091,7 @@ discard block |
||
2100 | 2091 | require(wpshop_display::get_template_file($tpl_way_to_take[1])); |
2101 | 2092 | $content_list .= ob_get_contents(); |
2102 | 2093 | ob_end_clean(); |
2103 | - } |
|
2104 | - else { |
|
2094 | + } else { |
|
2105 | 2095 | $content_list .= wpshop_display::display_template_element($template_part, $tpl_component); |
2106 | 2096 | } |
2107 | 2097 | unset($tpl_component); |
@@ -2123,8 +2113,7 @@ discard block |
||
2123 | 2113 | require(wpshop_display::get_template_file($tpl_way_to_take[1])); |
2124 | 2114 | $attributeContentOutput = ob_get_contents(); |
2125 | 2115 | ob_end_clean(); |
2126 | - } |
|
2127 | - else { |
|
2116 | + } else { |
|
2128 | 2117 | $attributeContentOutput = wpshop_display::display_template_element($template_part, $tpl_component); |
2129 | 2118 | } |
2130 | 2119 | unset($tpl_component); |
@@ -2176,8 +2165,9 @@ discard block |
||
2176 | 2165 | foreach ($attributeDefinition['value'] as $v) { |
2177 | 2166 | $attribute_value .= ' / '.wpshop_attributes::get_attribute_type_select_option_info($v, 'label', $attributeDefinition['data_type_to_use']); |
2178 | 2167 | } |
2168 | + } else { |
|
2169 | + $attribute_value = ' / '.wpshop_attributes::get_attribute_type_select_option_info($attributeDefinition['value'], 'label', $attributeDefinition['data_type_to_use']); |
|
2179 | 2170 | } |
2180 | - else $attribute_value = ' / '.wpshop_attributes::get_attribute_type_select_option_info($attributeDefinition['value'], 'label', $attributeDefinition['data_type_to_use']); |
|
2181 | 2171 | $attribute_value = substr($attribute_value,3); |
2182 | 2172 | } |
2183 | 2173 | |
@@ -2259,8 +2249,7 @@ discard block |
||
2259 | 2249 | 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'); |
2260 | 2250 | $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>'; |
2261 | 2251 | ob_end_clean(); |
2262 | - } |
|
2263 | - else { |
|
2252 | + } else { |
|
2264 | 2253 | if ( $attribute->code == 'product_attribute_set_id' ) { |
2265 | 2254 | $attribute_output_def['field_definition']['type'] = 'hidden'; |
2266 | 2255 | } |
@@ -2280,10 +2269,11 @@ discard block |
||
2280 | 2269 | $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>'; |
2281 | 2270 | ob_end_clean(); |
2282 | 2271 | |
2283 | - if( WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE == 'each-box' ) |
|
2284 | - $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>'; |
|
2285 | - else |
|
2286 | - $shortcodes_attr .= $attribute_group_display; |
|
2272 | + if( WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE == 'each-box' ) { |
|
2273 | + $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>'; |
|
2274 | + } else { |
|
2275 | + $shortcodes_attr .= $attribute_group_display; |
|
2276 | + } |
|
2287 | 2277 | |
2288 | 2278 | if ( $output_nb <= 0 ) { |
2289 | 2279 | $currentTabContent = __('Nothing avaiblable here. You can go in attribute management interface in order to add content here.', 'wpshop'); |
@@ -2298,8 +2288,7 @@ discard block |
||
2298 | 2288 | $box['boxContent'][$productAttributeSetDetail['code']] = ' |
2299 | 2289 | <div id="wpshop_' . $currentPageCode . '_' . wpshop_tools::slugify($productAttributeSetDetail['code'], array('noAccent')) . '_form" >' . $currentTabContent . ' |
2300 | 2290 | </div><div class="wpshop_cls" ></div>'; |
2301 | - } |
|
2302 | - else if ( $outputType == 'column' ) { |
|
2291 | + } else if ( $outputType == 'column' ) { |
|
2303 | 2292 | $currentTabContent = str_replace('wpshop_form_input_element', 'wpshop_form_input_column', $currentTabContent); |
2304 | 2293 | $currentTabContent = str_replace('wpshop_form_label', 'wpshop_form_label_column', $currentTabContent); |
2305 | 2294 | |
@@ -2337,8 +2326,7 @@ discard block |
||
2337 | 2326 | $box['box']['shortcode'] = __('Product Shortcodes', 'wpshop'); |
2338 | 2327 | $box['boxContent']['shortcode'] = $shortcodes_attr; |
2339 | 2328 | $box['box']['shortcode_backend_display_type'] = WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE; |
2340 | - } |
|
2341 | - else{ |
|
2329 | + } else{ |
|
2342 | 2330 | $box['columnTitle']['shortcode'] = __('Product Shortcodes', 'wpshop'); |
2343 | 2331 | $box['columnContent']['shortcode'] = $shortcodes_attr; |
2344 | 2332 | } |
@@ -2378,8 +2366,7 @@ discard block |
||
2378 | 2366 | // $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 . '" />'; |
2379 | 2367 | // } |
2380 | 2368 | endforeach; |
2381 | - } |
|
2382 | - elseif ( $attribute->data_type_to_use == 'internal') { |
|
2369 | + } elseif ( $attribute->data_type_to_use == 'internal') { |
|
2383 | 2370 | switch ($attribute_default_value) { |
2384 | 2371 | case 'users': |
2385 | 2372 | $users = get_users('orderby=nicename'); |
@@ -2408,9 +2395,11 @@ discard block |
||
2408 | 2395 | /* There is no value existing for this value */ |
2409 | 2396 | if (empty($attribute_select_options_list)) : |
2410 | 2397 | $ouput['more_input'].=__('Nothing found for this field', 'wpshop'); |
2411 | - else: |
|
2398 | + else { |
|
2399 | + : |
|
2412 | 2400 | /* Add a default value to the combobox list */ |
2413 | 2401 | $default_value_is_serial = false; |
2402 | + } |
|
2414 | 2403 | $attribute_list_first_element = $attribute->default_value; |
2415 | 2404 | if ( !empty($attribute->default_value) && ($attribute->default_value == serialize(false) || @unserialize($attribute->default_value) !== false) ) { |
2416 | 2405 | $default_value_is_serial = true; |
@@ -2426,8 +2415,7 @@ discard block |
||
2426 | 2415 | /* Add a extra element to create a new element into list */ |
2427 | 2416 | if ( is_admin() && ( empty($provenance['from']) || ($provenance['from'] != 'frontend')) ) { |
2428 | 2417 | /** $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.'" />'; */ |
2429 | - } |
|
2430 | - else if ( 'yes' == $attribute->is_used_in_quick_add_form ) { |
|
2418 | + } else if ( 'yes' == $attribute->is_used_in_quick_add_form ) { |
|
2431 | 2419 | $tpl_component = array(); |
2432 | 2420 | $tpl_component['NEW_ELEMENT_CREATION_FIELD'] = 'attribute[new_value_creation][' . $attribute->code . ']'; |
2433 | 2421 | $ouput['more_input'] .= wpshop_display::display_template_element('quick_entity_specific_field_new_element', $tpl_component); |
@@ -2449,8 +2437,7 @@ discard block |
||
2449 | 2437 | WHERE ATT.code = %s |
2450 | 2438 | AND ATT_SELECT_OPTIONS_VALUE.status = 'valid' |
2451 | 2439 | GROUP BY ATT.id, chosen_val", $element_id, $attribute_code); |
2452 | - } |
|
2453 | - else { |
|
2440 | + } else { |
|
2454 | 2441 | $query = $wpdb->prepare(" |
2455 | 2442 | SELECT P.ID AS chosen_val, P.post_title |
2456 | 2443 | FROM " . WPSHOP_DBT_ATTRIBUTE . " AS ATT |
@@ -2624,14 +2611,17 @@ discard block |
||
2624 | 2611 | $attribute_final = array(); |
2625 | 2612 | $entity_type = get_post_type($entityId); |
2626 | 2613 | $data = self::get_attribute_list_for_item( wpshop_entities::get_entity_identifier_from_code($entity_type), $entityId, WPSHOP_CURRENT_LOCALE); |
2627 | - foreach($data as $d) $attribute_available[$d->attribute_code] = array('attribute_id' => $d->attribute_id, 'data_type' => $d->data_type); |
|
2614 | + foreach($data as $d) { |
|
2615 | + $attribute_available[$d->attribute_code] = array('attribute_id' => $d->attribute_id, 'data_type' => $d->data_type); |
|
2616 | + } |
|
2628 | 2617 | |
2629 | 2618 | // Creation d'un array "propre" et valide pour la fonction self::saveAttributeForEntity |
2630 | 2619 | foreach ( $values as $key => $value ) { |
2631 | 2620 | if ( in_array( $key, array_keys( $attribute_available ) ) ) { |
2632 | 2621 | $attribute_final[$attribute_available[$key]['data_type']][$key] = $value; |
2622 | + } else { |
|
2623 | + $message .= sprintf(__('Impossible to set "%s" attribute', 'wpshop'), $key)."\n"; |
|
2633 | 2624 | } |
2634 | - else $message .= sprintf(__('Impossible to set "%s" attribute', 'wpshop'), $key)."\n"; |
|
2635 | 2625 | } |
2636 | 2626 | |
2637 | 2627 | // Pour les autres attributs non donné on leur affecte leur valeur par défaut |
@@ -2701,8 +2691,7 @@ discard block |
||
2701 | 2691 | /** Build template */ |
2702 | 2692 | $info = wpshop_display::display_template_element($template_part, $tpl_component); |
2703 | 2693 | unset($tpl_component); |
2704 | - } |
|
2705 | - else { |
|
2694 | + } else { |
|
2706 | 2695 | $info = $entity_infos->post_title; |
2707 | 2696 | } |
2708 | 2697 | } |
@@ -2890,8 +2879,7 @@ discard block |
||
2890 | 2879 | |
2891 | 2880 | }); |
2892 | 2881 | </script>'; |
2893 | - } |
|
2894 | - 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'))){ |
|
2882 | + } 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'))){ |
|
2895 | 2883 | $sub_output=''; |
2896 | 2884 | $wp_types = unserialize(WPSHOP_INTERNAL_TYPES); |
2897 | 2885 | unset($input_def);$input_def=array(); |
@@ -2992,8 +2980,7 @@ discard block |
||
2992 | 2980 | <option value="' . $value->value . '" >' . $value->label . '</option>'; |
2993 | 2981 | } |
2994 | 2982 | } |
2995 | - } |
|
2996 | - else { |
|
2983 | + } else { |
|
2997 | 2984 | foreach ($attribute_values as $attribute_value) { |
2998 | 2985 | if ( !empty($attribute_value->value) ) { |
2999 | 2986 | $attribute_possible_values .= ' |
@@ -3076,8 +3063,7 @@ discard block |
||
3076 | 3063 | $final_list['unavailable'][$attribute->code]['label'] = $attribute->frontend_label; |
3077 | 3064 | $final_list['unavailable'][$attribute->code]['values'] = array(); |
3078 | 3065 | $final_list['unavailable'][$attribute->code]['attribute_complete_def'] = $attribute; |
3079 | - } |
|
3080 | - else { |
|
3066 | + } else { |
|
3081 | 3067 | $final_list['available'][$attribute->code]['label'] = $attribute->frontend_label; |
3082 | 3068 | $final_list['available'][$attribute->code]['values'] = $attribute_values_for_variations; |
3083 | 3069 | $final_list['available'][$attribute->code]['attribute_complete_def'] = $attribute; |
@@ -3105,8 +3091,7 @@ discard block |
||
3105 | 3091 | $tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_LABEL_STATE'] = ''; |
3106 | 3092 | $tpl_component['ADMIN_VARIATIONS_DEF_LIST_ATTRIBUTE_CHECKBOX_STATE'] = ''; |
3107 | 3093 | $tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_TO_USE_LABEL_EXPLAINATION'] = ''; |
3108 | - } |
|
3109 | - else { |
|
3094 | + } else { |
|
3110 | 3095 | $tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_LABEL_STATE'] = ' class="wpshop_unavailable_label_variation_definition" '; |
3111 | 3096 | $tpl_component['ADMIN_VARIATIONS_DEF_LIST_ATTRIBUTE_CHECKBOX_STATE'] = ' disabled="disabled"'; |
3112 | 3097 | $tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_TO_USE_LABEL_EXPLAINATION'] = ''; |
@@ -1,8 +1,8 @@ discard block |
||
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 |
||
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 */ |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return string The table of the class |
50 | 50 | */ |
51 | - function setMessage($message){ |
|
51 | + function setMessage($message) { |
|
52 | 52 | $this->pageMessage = $message; |
53 | 53 | } |
54 | 54 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return string The table of the class |
58 | 58 | */ |
59 | - function getListingSlug(){ |
|
59 | + function getListingSlug() { |
|
60 | 60 | return self::urlSlugListing; |
61 | 61 | } |
62 | 62 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string The table of the class |
66 | 66 | */ |
67 | - function getEditionSlug(){ |
|
67 | + function getEditionSlug() { |
|
68 | 68 | return self::urlSlugEdition; |
69 | 69 | } |
70 | 70 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return string The table of the class |
74 | 74 | */ |
75 | - public static function getDbTable(){ |
|
75 | + public static function getDbTable() { |
|
76 | 76 | return self::dbTable; |
77 | 77 | } |
78 | 78 | /** |
@@ -80,21 +80,21 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return string $title The title of the page looking at the environnement |
82 | 82 | */ |
83 | - function pageTitle(){ |
|
83 | + function pageTitle() { |
|
84 | 84 | $action = isset($_REQUEST['action']) ? wpshop_tools::varSanitizer($_REQUEST['action']) : ''; |
85 | 85 | $objectInEdition = isset($_REQUEST['id']) ? wpshop_tools::varSanitizer($_REQUEST['id']) : ''; |
86 | - $page = !empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : ''; |
|
86 | + $page = !empty($_GET['page']) ? sanitize_text_field($_GET['page']) : ''; |
|
87 | 87 | |
88 | - $title = __(self::pageTitle, 'wpshop' ); |
|
89 | - if($action != ''){ |
|
90 | - if(($action == 'edit') || ($action == 'delete')){ |
|
88 | + $title = __(self::pageTitle, 'wpshop'); |
|
89 | + if ($action != '') { |
|
90 | + if (($action == 'edit') || ($action == 'delete')) { |
|
91 | 91 | $editedItem = self::getElement($objectInEdition); |
92 | 92 | $title = sprintf(__(self::pageEditingTitle, 'wpshop'), str_replace("\\", "", $editedItem->frontend_label)); |
93 | 93 | } |
94 | - elseif($action == 'add') |
|
94 | + elseif ($action == 'add') |
|
95 | 95 | $title = __(self::pageAddingTitle, 'wpshop'); |
96 | 96 | } |
97 | - elseif((self::getEditionSlug() != self::getListingSlug()) && ($page == self::getEditionSlug())) |
|
97 | + elseif ((self::getEditionSlug() != self::getListingSlug()) && ($page == self::getEditionSlug())) |
|
98 | 98 | $title = __(self::pageAddingTitle, 'wpshop'); |
99 | 99 | |
100 | 100 | return $title; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | /** |
104 | 104 | * Define the different message and action after an action is send through the element interface |
105 | 105 | */ |
106 | - function elementAction(){ |
|
106 | + function elementAction() { |
|
107 | 107 | global $wpdb, $initialEavData; |
108 | 108 | |
109 | 109 | $pageMessage = $actionResult = ''; |
@@ -115,74 +115,74 @@ discard block |
||
115 | 115 | $action = isset($_REQUEST['action']) ? wpshop_tools::varSanitizer($_REQUEST['action']) : 'add'; |
116 | 116 | $saveditem = isset($_REQUEST['saveditem']) ? wpshop_tools::varSanitizer($_REQUEST['saveditem']) : ''; |
117 | 117 | $set_section = !empty($_REQUEST[self::getDbTable()]['set_section']) ? wpshop_tools::varSanitizer($_REQUEST[self::getDbTable()]['set_section']) : ''; |
118 | - if ( !empty($_REQUEST[self::getDbTable()]['set_section']) ) unset($_REQUEST[self::getDbTable()]['set_section']); |
|
119 | - $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : null; |
|
120 | - if(!empty($action) && ($action=='activate') ){ |
|
121 | - if( isset($id) ) { |
|
118 | + if (!empty($_REQUEST[self::getDbTable()]['set_section'])) unset($_REQUEST[self::getDbTable()]['set_section']); |
|
119 | + $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : null; |
|
120 | + if (!empty($action) && ($action == 'activate')) { |
|
121 | + if (isset($id)) { |
|
122 | 122 | $query = $wpdb->update(self::getDbTable(), array('status'=>'moderated'), array('id'=>$id)); |
123 | 123 | wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=edit&id=" . $id)); |
124 | 124 | } |
125 | 125 | } |
126 | - if(($action != '') && ($action == 'saveok') && ($saveditem > 0)){ |
|
126 | + if (($action != '') && ($action == 'saveok') && ($saveditem > 0)) { |
|
127 | 127 | $editedElement = self::getElement($saveditem); |
128 | 128 | $pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully saved', 'wpshop'), '<span class="bold" >' . $editedElement->code . '</span>'); |
129 | 129 | } |
130 | - elseif(($action != '') && ($action == 'deleteok') && ($saveditem > 0)){ |
|
130 | + elseif (($action != '') && ($action == 'deleteok') && ($saveditem > 0)) { |
|
131 | 131 | $editedElement = self::getElement($saveditem, "'deleted'"); |
132 | 132 | $pageMessage = '<img src="' . WPSHOP_SUCCES_ICON . '" alt="action success" class="wpshopPageMessage_Icon" />' . sprintf(__('%s succesfully deleted', 'wpshop'), '<span class="bold" >' . $editedElement->code . '</span>'); |
133 | 133 | } |
134 | 134 | |
135 | - $attribute_parameter = !empty( $_REQUEST[self::getDbTable()] ) ? (array)$_REQUEST[self::getDbTable()] : array(); |
|
135 | + $attribute_parameter = !empty($_REQUEST[self::getDbTable()]) ? (array)$_REQUEST[self::getDbTable()] : array(); |
|
136 | 136 | |
137 | 137 | $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(); |
138 | 138 | unset($_REQUEST[self::getDbTable()]['wpshop_attribute_combo_values_list_order_def']); |
139 | 139 | |
140 | - if(!isset($attribute_parameter['status'])){ |
|
140 | + if (!isset($attribute_parameter['status'])) { |
|
141 | 141 | $attribute_parameter['status'] = 'moderated'; |
142 | 142 | } |
143 | - if(!isset($attribute_parameter['is_historisable'])){ |
|
143 | + if (!isset($attribute_parameter['is_historisable'])) { |
|
144 | 144 | $attribute_parameter['is_historisable'] = 'no'; |
145 | 145 | } |
146 | - if(!isset($attribute_parameter['is_required'])){ |
|
146 | + if (!isset($attribute_parameter['is_required'])) { |
|
147 | 147 | $attribute_parameter['is_required'] = 'no'; |
148 | 148 | } |
149 | - if(!isset($attribute_parameter['is_used_in_admin_listing_column'])){ |
|
149 | + if (!isset($attribute_parameter['is_used_in_admin_listing_column'])) { |
|
150 | 150 | $attribute_parameter['is_used_in_admin_listing_column'] = 'no'; |
151 | 151 | } |
152 | - if(!isset($attribute_parameter['is_used_in_quick_add_form'])){ |
|
152 | + if (!isset($attribute_parameter['is_used_in_quick_add_form'])) { |
|
153 | 153 | $attribute_parameter['is_used_in_quick_add_form'] = 'no'; |
154 | 154 | } |
155 | - if(!isset($attribute_parameter['is_intrinsic'])){ |
|
155 | + if (!isset($attribute_parameter['is_intrinsic'])) { |
|
156 | 156 | $attribute_parameter['is_intrinsic'] = 'no'; |
157 | 157 | } |
158 | - if(!isset($attribute_parameter['is_requiring_unit'])){ |
|
158 | + if (!isset($attribute_parameter['is_requiring_unit'])) { |
|
159 | 159 | $attribute_parameter['is_requiring_unit'] = 'no'; |
160 | 160 | } |
161 | - if(!isset($attribute_parameter['is_visible_in_front'])){ |
|
161 | + if (!isset($attribute_parameter['is_visible_in_front'])) { |
|
162 | 162 | $attribute_parameter['is_visible_in_front'] = 'no'; |
163 | 163 | } |
164 | - if(!isset($attribute_parameter['is_visible_in_front_listing'])){ |
|
164 | + if (!isset($attribute_parameter['is_visible_in_front_listing'])) { |
|
165 | 165 | $attribute_parameter['is_visible_in_front_listing'] = 'no'; |
166 | 166 | } |
167 | - if(!isset($attribute_parameter['is_used_for_sort_by'])){ |
|
167 | + if (!isset($attribute_parameter['is_used_for_sort_by'])) { |
|
168 | 168 | $attribute_parameter['is_used_for_sort_by'] = 'no'; |
169 | 169 | } |
170 | - if(!isset($attribute_parameter['is_visible_in_advanced_search'])){ |
|
170 | + if (!isset($attribute_parameter['is_visible_in_advanced_search'])) { |
|
171 | 171 | $attribute_parameter['is_visible_in_advanced_search'] = 'no'; |
172 | 172 | } |
173 | - if(!isset($attribute_parameter['is_searchable'])){ |
|
173 | + if (!isset($attribute_parameter['is_searchable'])) { |
|
174 | 174 | $attribute_parameter['is_searchable'] = 'no'; |
175 | 175 | } |
176 | - if(!isset($attribute_parameter['is_used_for_variation'])){ |
|
176 | + if (!isset($attribute_parameter['is_used_for_variation'])) { |
|
177 | 177 | $attribute_parameter['is_used_for_variation'] = 'no'; |
178 | 178 | } |
179 | - if(!isset($attribute_parameter['is_used_in_variation'])){ |
|
179 | + if (!isset($attribute_parameter['is_used_in_variation'])) { |
|
180 | 180 | $attribute_parameter['is_used_in_variation'] = 'no'; |
181 | 181 | } |
182 | - if(!isset($attribute_parameter['is_user_defined'])){ |
|
182 | + if (!isset($attribute_parameter['is_user_defined'])) { |
|
183 | 183 | $attribute_parameter['is_user_defined'] = 'no'; |
184 | 184 | } |
185 | - if(!isset($attribute_parameter['_display_informations_about_value'])){ |
|
185 | + if (!isset($attribute_parameter['_display_informations_about_value'])) { |
|
186 | 186 | $attribute_parameter['_display_informations_about_value'] = 'no'; |
187 | 187 | } |
188 | 188 | |
@@ -191,58 +191,58 @@ discard block |
||
191 | 191 | switch ($attribute_parameter['frontend_input']) { |
192 | 192 | case 'short_text': |
193 | 193 | $attribute_parameter['frontend_input'] = 'text'; |
194 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
194 | + if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text'; |
|
195 | 195 | $attribute_parameter['data_type'] = 'varchar'; |
196 | 196 | break; |
197 | 197 | case 'date_field': |
198 | 198 | $attribute_parameter['frontend_input'] = 'text'; |
199 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
199 | + if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text'; |
|
200 | 200 | $attribute_parameter['data_type'] = 'datetime'; |
201 | 201 | break; |
202 | 202 | case 'float_field': |
203 | 203 | $attribute_parameter['frontend_input'] = 'text'; |
204 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
204 | + if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text'; |
|
205 | 205 | $attribute_parameter['data_type'] = 'decimal'; |
206 | 206 | break; |
207 | 207 | case 'hidden_field': |
208 | 208 | $attribute_parameter['frontend_input'] = 'hidden'; |
209 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
209 | + if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text'; |
|
210 | 210 | $attribute_parameter['data_type'] = 'varchar'; |
211 | 211 | break; |
212 | 212 | case 'pass_field': |
213 | 213 | $attribute_parameter['frontend_input'] = 'password'; |
214 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
214 | + if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text'; |
|
215 | 215 | $attribute_parameter['data_type'] = 'varchar'; |
216 | 216 | break; |
217 | 217 | |
218 | 218 | case 'select': |
219 | 219 | $attribute_parameter['frontend_input'] = 'select'; |
220 | - if ( empty($attribute_parameter['backend_input']) || empty($id) ) |
|
220 | + if (empty($attribute_parameter['backend_input']) || empty($id)) |
|
221 | 221 | $attribute_parameter['backend_input'] = 'multiple-select'; |
222 | 222 | $attribute_parameter['data_type'] = 'integer'; |
223 | 223 | break; |
224 | 224 | case 'multiple-select': |
225 | 225 | $attribute_parameter['frontend_input'] = 'multiple-select'; |
226 | - if ( empty($attribute_parameter['backend_input']) || empty($id) ) |
|
226 | + if (empty($attribute_parameter['backend_input']) || empty($id)) |
|
227 | 227 | $attribute_parameter['backend_input'] = 'multiple-select'; |
228 | 228 | $attribute_parameter['data_type'] = 'integer'; |
229 | 229 | break; |
230 | 230 | case 'radio': |
231 | 231 | $attribute_parameter['frontend_input'] = 'radio'; |
232 | - if ( empty($attribute_parameter['backend_input']) || empty($id) ) |
|
232 | + if (empty($attribute_parameter['backend_input']) || empty($id)) |
|
233 | 233 | $attribute_parameter['backend_input'] = 'multiple-select'; |
234 | 234 | $attribute_parameter['data_type'] = 'integer'; |
235 | 235 | break; |
236 | 236 | case 'checkbox': |
237 | 237 | $attribute_parameter['frontend_input'] = 'checkbox'; |
238 | - if ( empty($attribute_parameter['backend_input']) || empty($id) ) |
|
238 | + if (empty($attribute_parameter['backend_input']) || empty($id)) |
|
239 | 239 | $attribute_parameter['backend_input'] = 'multiple-select'; |
240 | 240 | $attribute_parameter['data_type'] = 'integer'; |
241 | 241 | break; |
242 | 242 | |
243 | 243 | case 'textarea': |
244 | 244 | $attribute_parameter['frontend_input'] = 'textarea'; |
245 | - if ( empty($attribute_parameter['backend_input']) || empty($id) ) |
|
245 | + if (empty($attribute_parameter['backend_input']) || empty($id)) |
|
246 | 246 | $attribute_parameter['backend_input'] = 'textarea'; |
247 | 247 | $attribute_parameter['data_type'] = 'text'; |
248 | 248 | break; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | } |
251 | 251 | else { |
252 | 252 | $attribute_parameter['frontend_input'] = 'text'; |
253 | - if ( empty($attribute_parameter['backend_input']) ) $attribute_parameter['backend_input'] = 'text'; |
|
253 | + if (empty($attribute_parameter['backend_input'])) $attribute_parameter['backend_input'] = 'text'; |
|
254 | 254 | $attribute_parameter['data_type'] = 'varchar'; |
255 | 255 | } |
256 | 256 | |
@@ -262,49 +262,49 @@ discard block |
||
262 | 262 | |
263 | 263 | /* Define the database operation type from action launched by the user */ |
264 | 264 | $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']) : ''); |
265 | - if ( $attribute_parameter['data_type'] == 'datetime' ) { |
|
265 | + if ($attribute_parameter['data_type'] == 'datetime') { |
|
266 | 266 | $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)); |
267 | - $attribute_parameter['default_value'] = serialize( $date_default_value_trasform_into_config ); |
|
267 | + $attribute_parameter['default_value'] = serialize($date_default_value_trasform_into_config); |
|
268 | 268 | } |
269 | 269 | /***************************** GENERIC **************************/ |
270 | 270 | /*************************************************************************/ |
271 | - $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']) : ''); |
|
271 | + $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']) : ''); |
|
272 | 272 | $id = isset($attribute_parameter['id']) ? wpshop_tools::varSanitizer($attribute_parameter['id']) : ((!empty($_GET['id'])) ? $_GET['id'] : ''); |
273 | - if(($pageAction != '') && (($pageAction == 'edit') || ($pageAction == 'editandcontinue'))){ |
|
274 | - if(current_user_can('wpshop_edit_attributes')){ |
|
273 | + if (($pageAction != '') && (($pageAction == 'edit') || ($pageAction == 'editandcontinue'))) { |
|
274 | + if (current_user_can('wpshop_edit_attributes')) { |
|
275 | 275 | $attribute_parameter['last_update_date'] = date('Y-m-d H:i:s'); |
276 | - if($pageAction == 'delete'){ |
|
276 | + if ($pageAction == 'delete') { |
|
277 | 277 | $attribute_code = $attribute_parameter['code']; |
278 | - if(!isset($attribute_parameter['code']) || ($attribute_parameter['code'] == '')){ |
|
278 | + if (!isset($attribute_parameter['code']) || ($attribute_parameter['code'] == '')) { |
|
279 | 279 | $attribute = self::getElement($id, "'valid', 'moderated', 'notused'", 'id'); |
280 | 280 | $attribute_code = $attribute->code; |
281 | 281 | } |
282 | - if(!in_array($attribute_code, $attribute_undeletable)){ |
|
283 | - if(current_user_can('wpshop_delete_attributes')){ |
|
282 | + if (!in_array($attribute_code, $attribute_undeletable)) { |
|
283 | + if (current_user_can('wpshop_delete_attributes')) { |
|
284 | 284 | $attribute_parameter['status'] = 'deleted'; |
285 | 285 | } |
286 | - else{ |
|
286 | + else { |
|
287 | 287 | $actionResult = 'userNotAllowedForActionDelete'; |
288 | 288 | } |
289 | 289 | } |
290 | - else{ |
|
290 | + else { |
|
291 | 291 | $actionResult = 'unDeletableAtribute'; |
292 | 292 | } |
293 | 293 | } |
294 | 294 | $actionResult = wpshop_database::update($attribute_parameter, $id, self::getDbTable()); |
295 | 295 | } |
296 | - else{ |
|
296 | + else { |
|
297 | 297 | $actionResult = 'userNotAllowedForActionEdit'; |
298 | 298 | } |
299 | 299 | } |
300 | - elseif(($pageAction != '') && (($pageAction == 'delete'))){ |
|
300 | + elseif (($pageAction != '') && (($pageAction == 'delete'))) { |
|
301 | 301 | $attribute_code = ''; |
302 | - if (empty( $attribute_parameter['code'])) { |
|
302 | + if (empty($attribute_parameter['code'])) { |
|
303 | 303 | $attribute = self::getElement($id, "'valid', 'moderated', 'notused', 'deleted'", 'id'); |
304 | 304 | $attribute_code = $attribute->code; |
305 | 305 | } |
306 | 306 | if (!in_array($attribute_code, $attribute_undeletable)) { |
307 | - if(current_user_can('wpshop_delete_attributes')){ |
|
307 | + if (current_user_can('wpshop_delete_attributes')) { |
|
308 | 308 | $attribute_parameter['last_update_date'] = current_time('mysql', 0); |
309 | 309 | $attribute_parameter['status'] = 'deleted'; |
310 | 310 | $actionResult = wpshop_database::update($attribute_parameter, $id, self::getDbTable()); |
@@ -315,21 +315,21 @@ discard block |
||
315 | 315 | else |
316 | 316 | $actionResult = 'unDeletableAtribute'; |
317 | 317 | } |
318 | - elseif(($pageAction != '') && (($pageAction == 'save') || ($pageAction == 'saveandcontinue') || ($pageAction == 'add'))){ |
|
319 | - if(current_user_can('wpshop_add_attributes')){ |
|
318 | + elseif (($pageAction != '') && (($pageAction == 'save') || ($pageAction == 'saveandcontinue') || ($pageAction == 'add'))) { |
|
319 | + if (current_user_can('wpshop_add_attributes')) { |
|
320 | 320 | $attribute_parameter['creation_date'] = current_time('mysql', 0); |
321 | - if(trim($attribute_parameter['code']) == ''){ |
|
321 | + if (trim($attribute_parameter['code']) == '') { |
|
322 | 322 | $attribute_parameter['code'] = $attribute_parameter['frontend_label']; |
323 | 323 | } |
324 | 324 | $attribute_parameter['code'] = wpshop_tools::slugify(str_replace("\'", "_", str_replace('\"', "_", $attribute_parameter['code'])), array('noAccent', 'noSpaces', 'lowerCase', 'noPunctuation')); |
325 | 325 | $code_exists = self::getElement($attribute_parameter['code'], "'valid', 'moderated', 'deleted'", 'code'); |
326 | - if((is_object($code_exists) || is_array($code_exists)) && (count($code_exists) > 0)){ |
|
326 | + if ((is_object($code_exists) || is_array($code_exists)) && (count($code_exists) > 0)) { |
|
327 | 327 | $attribute_parameter['code'] = $attribute_parameter['code'] . '_' . (count($code_exists) + rand()); |
328 | 328 | } |
329 | 329 | $actionResult = wpshop_database::save($attribute_parameter, self::getDbTable()); |
330 | 330 | $id = $wpdb->insert_id; |
331 | 331 | } |
332 | - else{ |
|
332 | + else { |
|
333 | 333 | $actionResult = 'userNotAllowedForActionAdd'; |
334 | 334 | } |
335 | 335 | } |
@@ -338,9 +338,9 @@ discard block |
||
338 | 338 | /************ CHANGE THE FIELD NAME TO TAKE TO DISPLAY *************/ |
339 | 339 | /************ CHANGE ERROR MESSAGE FOR SPECIFIC CASE *************/ |
340 | 340 | /****************************************************************************/ |
341 | - if($actionResult != ''){ |
|
341 | + if ($actionResult != '') { |
|
342 | 342 | $elementIdentifierForMessage = __('the attribute', 'wpshop'); |
343 | - if(!empty($attribute_parameter['name']))$elementIdentifierForMessage = '<span class="bold" >' . $attribute_parameter['frontend_label'] . '</span>'; |
|
343 | + if (!empty($attribute_parameter['name']))$elementIdentifierForMessage = '<span class="bold" >' . $attribute_parameter['frontend_label'] . '</span>'; |
|
344 | 344 | if ($actionResult == 'error') {/* CHANGE HERE FOR SPECIFIC CASE */ |
345 | 345 | $pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . sprintf(__('An error occured while saving %s', 'wpshop'), $elementIdentifierForMessage, ' -> ' . $wpdb->last_error); |
346 | 346 | } |
@@ -352,11 +352,11 @@ discard block |
||
352 | 352 | $done_options_value = array(); |
353 | 353 | $default_value = $attribute_parameter['default_value']; |
354 | 354 | $i = 1; |
355 | - $options = !empty($_REQUEST['options']) ? (array) $_REQUEST['options'] : array(); |
|
356 | - $optionsValue = !empty($_REQUEST['optionsValue']) ? (array) $_REQUEST['optionsValue'] : array(); |
|
357 | - $optionsUpdate = !empty($_REQUEST['optionsUpdate']) ? (array) $_REQUEST['optionsUpdate'] : array(); |
|
358 | - $optionsUpdateValue = !empty($_REQUEST['optionsUpdateValue']) ? (array) $_REQUEST['optionsUpdateValue'] : array(); |
|
359 | - if ( !empty($optionsUpdate) ) { |
|
355 | + $options = !empty($_REQUEST['options']) ? (array)$_REQUEST['options'] : array(); |
|
356 | + $optionsValue = !empty($_REQUEST['optionsValue']) ? (array)$_REQUEST['optionsValue'] : array(); |
|
357 | + $optionsUpdate = !empty($_REQUEST['optionsUpdate']) ? (array)$_REQUEST['optionsUpdate'] : array(); |
|
358 | + $optionsUpdateValue = !empty($_REQUEST['optionsUpdateValue']) ? (array)$_REQUEST['optionsUpdateValue'] : array(); |
|
359 | + if (!empty($optionsUpdate)) { |
|
360 | 360 | /** |
361 | 361 | * Check if there is an attribute code into sended request or if we have to get the code from database (Bug fix) |
362 | 362 | */ |
@@ -370,25 +370,25 @@ discard block |
||
370 | 370 | foreach ($optionsUpdate as $option_key => $option_label) { |
371 | 371 | $option_value = !empty($optionsUpdateValue[$option_key]) ? str_replace(",", ".", $optionsUpdateValue[$option_key]) : ''; |
372 | 372 | |
373 | - if ( empty($option_value) || !in_array($option_value, $done_options_value) ) { |
|
373 | + if (empty($option_value) || !in_array($option_value, $done_options_value)) { |
|
374 | 374 | /* Update an existing value only if the value does not exist into existing list */ |
375 | 375 | $label = (($option_label != '') ? $option_label : str_replace(",", ".", $option_value)); |
376 | 376 | $value = str_replace(",", ".", $option_value); |
377 | - if( !WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT ) { |
|
377 | + if (!WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT) { |
|
378 | 378 | $label = $option_label; |
379 | - $value = str_replace(",", ".", $label); |
|
379 | + $value = str_replace(",", ".", $label); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | $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)); |
383 | 383 | $done_options_value[] = str_replace(",", ".", $option_value); |
384 | 384 | |
385 | 385 | /* Check if this value is used for price calculation and make update on the different product using this value */ |
386 | - if($attribute_code == WPSHOP_PRODUCT_PRICE_TAX){ |
|
386 | + if ($attribute_code == WPSHOP_PRODUCT_PRICE_TAX) { |
|
387 | 387 | $action = wpshop_prices::mass_update_prices(); |
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | - if($default_value == $option_key) { |
|
391 | + if ($default_value == $option_key) { |
|
392 | 392 | /* Update an existing a only if the value does not exist into existing list */ |
393 | 393 | $wpdb->update(WPSHOP_DBT_ATTRIBUTE, array('last_update_date' => current_time('mysql', 0), 'default_value' => $option_key), array('id' => $id)); |
394 | 394 | $done_options_value[] = str_replace(",", ".", $option_value); |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | $i++; |
397 | 397 | } |
398 | 398 | } |
399 | - if ( !empty($options) ) { |
|
400 | - foreach ( $options as $option_key => $option_label ) { |
|
399 | + if (!empty($options)) { |
|
400 | + foreach ($options as $option_key => $option_label) { |
|
401 | 401 | $option_value = !empty($optionsValue[$option_key]) ? str_replace(",", ".", $optionsValue[$option_key]) : sanitize_title($option_label); |
402 | 402 | |
403 | 403 | /* Check what value to use for the new values */ |
404 | 404 | $label = (!empty($option_label) ? $option_label : str_replace(",", ".", $option_value)); |
405 | - if( !WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT && empty($option_value) ) { |
|
405 | + if (!WPSHOP_DISPLAY_VALUE_FOR_ATTRIBUTE_SELECT && empty($option_value)) { |
|
406 | 406 | $label = $option_label; |
407 | 407 | $option_value = sanitize_title($label); |
408 | 408 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | // If the optionsUpdateValue is empty, set it a empty array to avoid error calling the in_array() function |
411 | 411 | // $_REQUEST['optionsUpdateValue'] = !empty($_REQUEST['optionsUpdateValue']) ? $_REQUEST['optionsUpdateValue'] : array(); |
412 | 412 | |
413 | - if (!in_array($option_value, $done_options_value) && !in_array($option_value, $optionsUpdateValue) ) { |
|
413 | + if (!in_array($option_value, $done_options_value) && !in_array($option_value, $optionsUpdateValue)) { |
|
414 | 414 | |
415 | 415 | $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))); |
416 | 416 | $done_options_value[] = str_replace(",", ".", $option_value); |
@@ -428,19 +428,19 @@ discard block |
||
428 | 428 | } |
429 | 429 | |
430 | 430 | // If the is_used_for_sort_by is mark as yes, we have to get out some attributes and save it separately |
431 | - 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')) ){ |
|
431 | + 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'))) { |
|
432 | 432 | $attribute_code = $attribute_parameter['code']; |
433 | - if(!isset($attribute_parameter['code']) || ($attribute_parameter['code'] == '')){ |
|
433 | + if (!isset($attribute_parameter['code']) || ($attribute_parameter['code'] == '')) { |
|
434 | 434 | $attribute = self::getElement($id, "'valid', 'moderated', 'notused'", 'id'); |
435 | 435 | $attribute_code = $attribute->code; |
436 | 436 | } |
437 | 437 | |
438 | 438 | $count_products = wp_count_posts(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT); |
439 | - for( $i = 0; $i <= $count_products->publish; $i+= 20 ) { |
|
440 | - $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' ); |
|
441 | - $products = $wpdb->get_results( $query ); |
|
442 | - if ( !empty($products) ) { |
|
443 | - foreach( $products as $product ) { |
|
439 | + for ($i = 0; $i <= $count_products->publish; $i += 20) { |
|
440 | + $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'); |
|
441 | + $products = $wpdb->get_results($query); |
|
442 | + if (!empty($products)) { |
|
443 | + foreach ($products as $product) { |
|
444 | 444 | $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); |
445 | 445 | $value = $wpdb->get_var($query); |
446 | 446 | update_post_meta($product->ID, '_' . $attribute_code, $value); |
@@ -450,13 +450,13 @@ discard block |
||
450 | 450 | wp_reset_query(); |
451 | 451 | } |
452 | 452 | |
453 | - if ( $pageAction != 'delete' ) {/* Add the new attribute in the additionnal informations attribute group */ |
|
454 | - if ( !empty($set_section) ) { |
|
453 | + if ($pageAction != 'delete') {/* Add the new attribute in the additionnal informations attribute group */ |
|
454 | + if (!empty($set_section)) { |
|
455 | 455 | $choosen_set_section = explode('_', $set_section); |
456 | 456 | $set_id = $choosen_set_section[0]; |
457 | 457 | $group_id = $choosen_set_section[1]; |
458 | 458 | } |
459 | - else{ |
|
459 | + else { |
|
460 | 460 | $attribute_current_attribute_set = 0; |
461 | 461 | $query = $wpdb->prepare(" |
462 | 462 | SELECT id |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | AND ATTRIBUTE_SET_DETAILS.entity_type_id = %d", $id, $attribute_parameter['entity_id']); |
467 | 467 | $attribute_current_attribute_set = $wpdb->get_results($query); |
468 | 468 | |
469 | - if ( empty($attribute_current_attribute_set) ) { |
|
469 | + if (empty($attribute_current_attribute_set)) { |
|
470 | 470 | $query = $wpdb->prepare(" |
471 | 471 | SELECT |
472 | 472 | ( |
@@ -487,12 +487,12 @@ discard block |
||
487 | 487 | $wpshop_default_group = $wpdb->get_row($query); |
488 | 488 | |
489 | 489 | $set_id = $wpshop_default_group->attribute_set_id; |
490 | - $default_group_id = ( !empty( $wpshop_default_group->default_attribute_group_id) ) ? $wpshop_default_group->default_attribute_group_id : ''; |
|
490 | + $default_group_id = (!empty($wpshop_default_group->default_attribute_group_id)) ? $wpshop_default_group->default_attribute_group_id : ''; |
|
491 | 491 | $group_id = !empty($default_group_id) ? $default_group_id : $wpshop_default_group->attribute_group_id; |
492 | 492 | } |
493 | 493 | } |
494 | 494 | |
495 | - if ( !empty($set_id) && !empty($group_id) ) { |
|
495 | + if (!empty($set_id) && !empty($group_id)) { |
|
496 | 496 | $query = $wpdb->prepare( |
497 | 497 | "SELECT (MAX(position) + 1) AS position |
498 | 498 | FROM " . WPSHOP_DBT_ATTRIBUTE_DETAILS . " |
@@ -504,12 +504,12 @@ discard block |
||
504 | 504 | $attribute_parameter['entity_id'] |
505 | 505 | ); |
506 | 506 | $wpshopAttributePosition = $wpdb->get_var($query); |
507 | - if($wpshopAttributePosition == 0)$wpshopAttributePosition = 1; |
|
507 | + if ($wpshopAttributePosition == 0)$wpshopAttributePosition = 1; |
|
508 | 508 | $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)); |
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
512 | - if ( !empty($wpshop_attribute_combo_values_list_order_def) ) { |
|
512 | + if (!empty($wpshop_attribute_combo_values_list_order_def)) { |
|
513 | 513 | $post_order = explode(',', $wpshop_attribute_combo_values_list_order_def); |
514 | 514 | $position = 1; |
515 | 515 | foreach ($post_order as $post_id) { |
@@ -525,19 +525,19 @@ discard block |
||
525 | 525 | wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=saveok&saveditem=" . $id)); |
526 | 526 | } |
527 | 527 | else */ |
528 | - if ( $pageAction == 'add' ) |
|
528 | + if ($pageAction == 'add') |
|
529 | 529 | wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=edit&id=" . $id)); |
530 | - elseif ( $pageAction == 'delete' ) |
|
530 | + elseif ($pageAction == 'delete') |
|
531 | 531 | wpshop_tools::wpshop_safe_redirect(admin_url('admin.php?page=' . self::getListingSlug() . "&action=deleteok&saveditem=" . $id)); |
532 | 532 | } |
533 | - elseif(($actionResult == 'userNotAllowedForActionEdit') || ($actionResult == 'userNotAllowedForActionAdd') || ($actionResult == 'userNotAllowedForActionDelete')){ |
|
533 | + elseif (($actionResult == 'userNotAllowedForActionEdit') || ($actionResult == 'userNotAllowedForActionAdd') || ($actionResult == 'userNotAllowedForActionDelete')) { |
|
534 | 534 | $pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . __('You are not allowed to do this action', 'wpshop'); |
535 | 535 | } |
536 | - elseif(($actionResult == 'unDeletableAtribute')){ |
|
536 | + elseif (($actionResult == 'unDeletableAtribute')) { |
|
537 | 537 | $pageMessage .= '<img src="' . WPSHOP_ERROR_ICON . '" alt="action error" class="wpshopPageMessage_Icon" />' . __('This attribute could not be deleted due to configuration', 'wpshop'); |
538 | 538 | } |
539 | 539 | |
540 | - if(empty($attribute_parameter['frontend_label']) && ($pageAction!='delete')){ |
|
540 | + if (empty($attribute_parameter['frontend_label']) && ($pageAction != 'delete')) { |
|
541 | 541 | $pageMessage .= __('Please enter an label for the attribut', 'wpshop'); |
542 | 542 | } |
543 | 543 | } |
@@ -555,36 +555,36 @@ discard block |
||
555 | 555 | //Create an instance of our package class... |
556 | 556 | $wpshop_list_table = new wpshop_attributes_custom_List_table(); |
557 | 557 | //Fetch, prepare, sort, and filter our data... |
558 | - $status="'valid'"; |
|
559 | - $attribute_status = !empty($_REQUEST['attribute_status']) ? sanitize_text_field( $_REQUEST['attribute_status'] ) : null; |
|
560 | - $s = !empty($_REQUEST['s']) ? sanitize_text_field( $_REQUEST['attribute_status'] ) : null; |
|
558 | + $status = "'valid'"; |
|
559 | + $attribute_status = !empty($_REQUEST['attribute_status']) ? sanitize_text_field($_REQUEST['attribute_status']) : null; |
|
560 | + $s = !empty($_REQUEST['s']) ? sanitize_text_field($_REQUEST['attribute_status']) : null; |
|
561 | 561 | $order = !empty($_REQUEST['order']) ? sanitize_text_field($_REQUEST['order']) : null; |
562 | 562 | $orderby = !empty($_REQUEST['orderby']) ? sanitize_text_field($_REQUEST['orderby']) : null; |
563 | - if(!empty($attribute_status)){ |
|
564 | - switch($attribute_status){ |
|
563 | + if (!empty($attribute_status)) { |
|
564 | + switch ($attribute_status) { |
|
565 | 565 | case 'unactive': |
566 | - $status="'moderated', 'notused'"; |
|
567 | - if(empty($order_by) && empty($order)){ |
|
568 | - $_REQUEST['orderby']='status'; |
|
569 | - $_REQUEST['order']='asc'; |
|
566 | + $status = "'moderated', 'notused'"; |
|
567 | + if (empty($order_by) && empty($order)) { |
|
568 | + $_REQUEST['orderby'] = 'status'; |
|
569 | + $_REQUEST['order'] = 'asc'; |
|
570 | 570 | } |
571 | 571 | break; |
572 | 572 | default: |
573 | - $status="'".sanitize_text_field($_REQUEST['attribute_status'])."'"; |
|
573 | + $status = "'" . sanitize_text_field($_REQUEST['attribute_status']) . "'"; |
|
574 | 574 | break; |
575 | 575 | } |
576 | 576 | } |
577 | - if ( !empty($s) ) { |
|
578 | - $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') ); |
|
579 | - $attr_set_list = $wpdb->get_results( $query ); |
|
577 | + if (!empty($s)) { |
|
578 | + $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')); |
|
579 | + $attr_set_list = $wpdb->get_results($query); |
|
580 | 580 | } |
581 | 581 | else { |
582 | - $attr_set_list = self::getElement( '', $status ); |
|
582 | + $attr_set_list = self::getElement('', $status); |
|
583 | 583 | } |
584 | - $i=0; |
|
585 | - $attribute_set_list=array(); |
|
586 | - foreach($attr_set_list as $attr_set){ |
|
587 | - if(!empty($attr_set->id) && ($attr_set->code != 'product_attribute_set_id') ){ |
|
584 | + $i = 0; |
|
585 | + $attribute_set_list = array(); |
|
586 | + foreach ($attr_set_list as $attr_set) { |
|
587 | + if (!empty($attr_set->id) && ($attr_set->code != 'product_attribute_set_id')) { |
|
588 | 588 | $attribute_set_list[$i]['id'] = $attr_set->id; |
589 | 589 | $attribute_set_list[$i]['name'] = $attr_set->frontend_label; |
590 | 590 | $attribute_set_list[$i]['status'] = $attr_set->status; |
@@ -630,31 +630,31 @@ discard block |
||
630 | 630 | global $attribute_displayed_field, $attribute_options_group; |
631 | 631 | $dbFieldList = wpshop_database::fields_to_input(self::getDbTable()); |
632 | 632 | $editedItem = ''; |
633 | - if($itemToEdit != '') |
|
633 | + if ($itemToEdit != '') |
|
634 | 634 | $editedItem = self::getElement($itemToEdit); |
635 | 635 | |
636 | 636 | $the_form_content_hidden = $the_form_general_content = ''; |
637 | 637 | $the_form_option_content_list = array(); |
638 | - foreach($dbFieldList as $input_key => $input_def){ |
|
638 | + foreach ($dbFieldList as $input_key => $input_def) { |
|
639 | 639 | |
640 | - if(!isset($attribute_displayed_field) || !is_array($attribute_displayed_field) || in_array($input_def['name'], $attribute_displayed_field)){ |
|
640 | + if (!isset($attribute_displayed_field) || !is_array($attribute_displayed_field) || in_array($input_def['name'], $attribute_displayed_field)) { |
|
641 | 641 | $input_def['label'] = $input_def['name']; |
642 | - $input_def_id=$input_def['id']='wpshop_' . self::currentPageCode . '_edition_table_field_id_'.$input_def['label']; |
|
642 | + $input_def_id = $input_def['id'] = 'wpshop_' . self::currentPageCode . '_edition_table_field_id_' . $input_def['label']; |
|
643 | 643 | |
644 | 644 | $pageAction = isset($_REQUEST[self::getDbTable() . '_action']) ? sanitize_text_field($_REQUEST[self::getDbTable() . '_action']) : ''; |
645 | 645 | $requestFormValue = isset($_REQUEST[self::currentPageCode][$input_def['label']]) ? sanitize_text_field($_REQUEST[self::currentPageCode][$input_def['label']]) : ''; |
646 | 646 | $currentFieldValue = $input_def['value']; |
647 | - if(is_object($editedItem)) |
|
647 | + if (is_object($editedItem)) |
|
648 | 648 | $currentFieldValue = $editedItem->{$input_def['label']}; |
649 | - elseif(($pageAction != '') && ($requestFormValue != '')) |
|
649 | + elseif (($pageAction != '') && ($requestFormValue != '')) |
|
650 | 650 | $currentFieldValue = $requestFormValue; |
651 | 651 | |
652 | - if($input_def['label'] == 'status'){ |
|
653 | - if(in_array('notused', $input_def['possible_value'])){ |
|
652 | + if ($input_def['label'] == 'status') { |
|
653 | + if (in_array('notused', $input_def['possible_value'])) { |
|
654 | 654 | $key = array_keys($input_def['possible_value'], 'notused'); |
655 | 655 | unset($input_def['possible_value'][$key[0]]); |
656 | 656 | } |
657 | - if(in_array('dbl', $input_def['possible_value'])){ |
|
657 | + if (in_array('dbl', $input_def['possible_value'])) { |
|
658 | 658 | $key = array_keys($input_def['possible_value'], 'dbl'); |
659 | 659 | unset($input_def['possible_value'][$key[0]]); |
660 | 660 | } |
@@ -662,94 +662,94 @@ discard block |
||
662 | 662 | $input_def['type'] = 'checkbox'; |
663 | 663 | $input_def['label'] = __('Use this attribute', 'wpshop'); |
664 | 664 | $input_def['possible_value'] = array('valid'); |
665 | - $input_def_id.='_valid'; |
|
666 | - $input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for using this attribute', 'wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
665 | + $input_def_id .= '_valid'; |
|
666 | + $input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for using this attribute', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
667 | 667 | } |
668 | 668 | |
669 | - if ( (substr($input_def['label'], 0, 3) == 'is_') || ( $input_def['label'] == '_display_informations_about_value') ) { |
|
669 | + if ((substr($input_def['label'], 0, 3) == 'is_') || ($input_def['label'] == '_display_informations_about_value')) { |
|
670 | 670 | $input_def['type'] = 'checkbox'; |
671 | 671 | $input_def['possible_value'] = 'yes'; |
672 | 672 | } |
673 | - switch($input_def['label']){ |
|
673 | + switch ($input_def['label']) { |
|
674 | 674 | case 'is_requiring_unit': |
675 | - $input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for using unit with this attribute', 'wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
675 | + $input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for using unit with this attribute', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
676 | 676 | break; |
677 | 677 | case 'is_visible_in_front': |
678 | - $input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for displaying this attribute in shop', 'wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
678 | + $input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for displaying this attribute in shop', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
679 | 679 | break; |
680 | 680 | case 'is_visible_in_front_listing': |
681 | - $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>'; |
|
681 | + $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>'; |
|
682 | 682 | break; |
683 | 683 | case 'is_used_for_sort_by': |
684 | - $input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for displaying this attribute into sortbar', 'wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
684 | + $input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for displaying this attribute into sortbar', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
685 | 685 | break; |
686 | 686 | case 'is_searchable': |
687 | - $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>'; |
|
687 | + $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>'; |
|
688 | 688 | break; |
689 | 689 | case 'is_visible_in_advanced_search': |
690 | - $input_def['options_label']['custom'] = '<a href="#" title="'.__('Check this box for using in advanced search form', 'wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
690 | + $input_def['options_label']['custom'] = '<a href="#" title="' . __('Check this box for using in advanced search form', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
691 | 691 | break; |
692 | 692 | case 'frontend_css_class': |
693 | - $input_def['options_label']['custom'] = '<a href="#" title="'.__('Separate with a space each CSS Class', 'wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
693 | + $input_def['options_label']['custom'] = '<a href="#" title="' . __('Separate with a space each CSS Class', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
694 | 694 | break; |
695 | 695 | case 'backend_css_class': |
696 | - $input_def['options_label']['custom'] = '<a href="#" title="'.__('Separate with a space each CSS Class', 'wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
696 | + $input_def['options_label']['custom'] = '<a href="#" title="' . __('Separate with a space each CSS Class', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
697 | 697 | break; |
698 | 698 | case 'is_historisable': |
699 | - $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>'; |
|
699 | + $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>'; |
|
700 | 700 | break; |
701 | 701 | case 'is_filterable': |
702 | - $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>'; |
|
702 | + $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>'; |
|
703 | 703 | break; |
704 | 704 | case 'is_intrinsic': |
705 | - $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>'; |
|
705 | + $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>'; |
|
706 | 706 | break; |
707 | 707 | case 'is_used_for_variation': |
708 | - $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>'; |
|
708 | + $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>'; |
|
709 | 709 | break; |
710 | 710 | case 'is_used_in_variation': |
711 | - $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>'; |
|
712 | - if ( !empty($editedItem) && ($editedItem->is_used_for_variation == 'yes') ) { |
|
711 | + $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>'; |
|
712 | + if (!empty($editedItem) && ($editedItem->is_used_for_variation == 'yes')) { |
|
713 | 713 | $input_def['option'] = 'disabled="disabled"'; |
714 | 714 | } |
715 | 715 | break; |
716 | 716 | case 'is_user_defined': |
717 | - $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>'; |
|
717 | + $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>'; |
|
718 | 718 | break; |
719 | 719 | } |
720 | 720 | |
721 | 721 | $input_def['value'] = $currentFieldValue; |
722 | - if($input_def['label'] == 'code') |
|
722 | + if ($input_def['label'] == 'code') |
|
723 | 723 | $input_def['type'] = 'hidden'; |
724 | - elseif($input_def['label'] == 'entity_id'){ |
|
724 | + elseif ($input_def['label'] == 'entity_id') { |
|
725 | 725 | $input_def['possible_value'] = wpshop_entities::get_entities_list(); |
726 | 726 | $input_def['valueToPut'] = 'index'; |
727 | 727 | $input_def['type'] = 'select'; |
728 | 728 | |
729 | - $i=0; |
|
730 | - foreach($input_def['possible_value'] as $entity_id => $entity_name) { |
|
731 | - if($i <= 0){ |
|
729 | + $i = 0; |
|
730 | + foreach ($input_def['possible_value'] as $entity_id => $entity_name) { |
|
731 | + if ($i <= 0) { |
|
732 | 732 | $current_entity_id = $entity_id; |
733 | 733 | } |
734 | 734 | $i++; |
735 | 735 | } |
736 | 736 | } |
737 | - elseif($input_def['label'] == '_unit_group_id'){ |
|
737 | + elseif ($input_def['label'] == '_unit_group_id') { |
|
738 | 738 | $input_def['possible_value'] = wpshop_attributes_unit::get_unit_group(); |
739 | 739 | $input_def['type'] = 'select'; |
740 | 740 | } |
741 | - elseif($input_def['label'] == '_default_unit'){ |
|
741 | + elseif ($input_def['label'] == '_default_unit') { |
|
742 | 742 | $unit_group_list = wpshop_attributes_unit::get_unit_group(); |
743 | - $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:'')); |
|
743 | + $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 : '')); |
|
744 | 744 | $input_def['type'] = 'select'; |
745 | 745 | } |
746 | 746 | elseif ($input_def['label'] == 'backend_input') { |
747 | - if ( !is_object($editedItem) ) { |
|
747 | + if (!is_object($editedItem)) { |
|
748 | 748 | $input_def['type'] = 'hidden'; |
749 | 749 | } |
750 | 750 | else { |
751 | 751 | $new_possible_value = array(); |
752 | - switch ( $editedItem->data_type) { |
|
752 | + switch ($editedItem->data_type) { |
|
753 | 753 | case 'integer': |
754 | 754 | $new_possible_value[__('Checkbox', 'wpshop')] = 'checkbox'; |
755 | 755 | $new_possible_value[__('Radio button', 'wpshop')] = 'radio'; |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | $new_possible_value[__('multiple-select', 'wpshop')] = 'multiple-select'; |
758 | 758 | break; |
759 | 759 | case 'varchar': |
760 | - switch ( $input_def['value'] ) { |
|
760 | + switch ($input_def['value']) { |
|
761 | 761 | case 'hidden': |
762 | 762 | $new_possible_value[__('Hidden field', 'wpshop')] = 'hidden_field'; |
763 | 763 | break; |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | elseif ($input_def['label'] == 'frontend_input') { |
786 | 786 | $new_possible_value = array(); |
787 | 787 | |
788 | - if ( is_object($editedItem) ) { |
|
789 | - switch ( $editedItem->data_type) { |
|
788 | + if (is_object($editedItem)) { |
|
789 | + switch ($editedItem->data_type) { |
|
790 | 790 | case 'integer': |
791 | 791 | $new_possible_value[__('Checkbox', 'wpshop')] = 'checkbox'; |
792 | 792 | $new_possible_value[__('Radio button', 'wpshop')] = 'radio'; |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | $new_possible_value[__('multiple-select', 'wpshop')] = 'multiple-select'; |
795 | 795 | break; |
796 | 796 | case 'varchar': |
797 | - switch ( $input_def['value'] ) { |
|
797 | + switch ($input_def['value']) { |
|
798 | 798 | case 'hidden': |
799 | 799 | $new_possible_value[__('Hidden field', 'wpshop')] = 'hidden_field'; |
800 | 800 | break; |
@@ -832,10 +832,10 @@ discard block |
||
832 | 832 | |
833 | 833 | $input_def['possible_value'] = $new_possible_value; |
834 | 834 | |
835 | - if ( !empty($editedItem->frontend_input) ) { |
|
836 | - switch ( $editedItem->frontend_input ) { |
|
835 | + if (!empty($editedItem->frontend_input)) { |
|
836 | + switch ($editedItem->frontend_input) { |
|
837 | 837 | case 'text': |
838 | - switch ( $editedItem->data_type ) { |
|
838 | + switch ($editedItem->data_type) { |
|
839 | 839 | case 'varchar': |
840 | 840 | $input_def['value'] = 'short_text'; |
841 | 841 | break; |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | } |
861 | 861 | } |
862 | 862 | |
863 | - if(is_object($editedItem) && (($input_def['label'] == 'code') || ($input_def['label'] == 'data_type') || ($input_def['label'] == 'entity_id'))){ |
|
863 | + if (is_object($editedItem) && (($input_def['label'] == 'code') || ($input_def['label'] == 'data_type') || ($input_def['label'] == 'entity_id'))) { |
|
864 | 864 | // $input_def['type'] = 'hidden'; |
865 | 865 | $input_def['option'] = ' disabled="disabled" '; |
866 | 866 | $the_form_content_hidden .= '<input type="hidden" name="' . self::getDbTable() . '[' . $input_def['name'] . ']" value="' . $input_def['value'] . '" />'; |
@@ -871,16 +871,16 @@ discard block |
||
871 | 871 | $input_def['value'] = str_replace("\\", "", $input_def['value']); |
872 | 872 | |
873 | 873 | $the_input = wpshop_form::check_input_type($input_def, self::getDbTable()); |
874 | - if ( $input_def['label'] == 'default_value' ) { |
|
875 | - if ( !empty($editedItem->frontend_input) ) { |
|
876 | - switch ( $editedItem->frontend_input ) { |
|
874 | + if ($input_def['label'] == 'default_value') { |
|
875 | + if (!empty($editedItem->frontend_input)) { |
|
876 | + switch ($editedItem->frontend_input) { |
|
877 | 877 | case 'text': |
878 | 878 | $input_def['type'] = 'text'; |
879 | - switch ( $editedItem->data_type ) { |
|
879 | + switch ($editedItem->data_type) { |
|
880 | 880 | case 'datetime': |
881 | - $the_input = wpshop_attributes::attribute_type_date_config( unserialize($input_def['value']) ); |
|
881 | + $the_input = wpshop_attributes::attribute_type_date_config(unserialize($input_def['value'])); |
|
882 | 882 | |
883 | - $input_def['label'] = __('Date field configuration','wpshop'); |
|
883 | + $input_def['label'] = __('Date field configuration', 'wpshop'); |
|
884 | 884 | break; |
885 | 885 | default: |
886 | 886 | $the_input = wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE); |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | case 'multiple-select': |
898 | 898 | case 'radio': |
899 | 899 | case 'checkbox': |
900 | - $input_def['label'] = __('Options list for attribute','wpshop') . ' |
|
900 | + $input_def['label'] = __('Options list for attribute', 'wpshop') . ' |
|
901 | 901 | <div class="alignright wpshop_change_select_data_type" > |
902 | 902 | +' . __('Change data type for this attribute', 'wpshop') . ' |
903 | 903 | </div>'; |
@@ -911,50 +911,50 @@ discard block |
||
911 | 911 | } |
912 | 912 | } |
913 | 913 | else { |
914 | - $input_def['type']='text'; |
|
914 | + $input_def['type'] = 'text'; |
|
915 | 915 | $the_input = wpshop_form::check_input_type($input_def, self::getDbTable()); |
916 | 916 | } |
917 | 917 | } |
918 | - if( $input_def['label'] == '_unit_group_id') { |
|
918 | + if ($input_def['label'] == '_unit_group_id') { |
|
919 | 919 | $the_input .= '<div id="wpshop_loader_input_group_unit"></div>'; |
920 | - $the_input .= '<a class="button-primary" href="#wpshop_unit_group_list" id="wpshop_attribute_group_unit_manager_opener">'.__('Manage group unit', 'wpshop').'</a>'; |
|
920 | + $the_input .= '<a class="button-primary" href="#wpshop_unit_group_list" id="wpshop_attribute_group_unit_manager_opener">' . __('Manage group unit', 'wpshop') . '</a>'; |
|
921 | 921 | } |
922 | 922 | |
923 | - if( $input_def['label'] == '_default_unit') { |
|
923 | + if ($input_def['label'] == '_default_unit') { |
|
924 | 924 | $the_input .= '<div id="wpshop_loader_input_unit"></div>'; |
925 | - $the_input .= '<a class="button-primary" href="#wpshop_unit_list" id="wpshop_attribute_unit_manager_opener">'.__('Manage units', 'wpshop').'</a>'; |
|
925 | + $the_input .= '<a class="button-primary" href="#wpshop_unit_list" id="wpshop_attribute_unit_manager_opener">' . __('Manage units', 'wpshop') . '</a>'; |
|
926 | 926 | $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") . '" />'; |
927 | 927 | $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>'; |
928 | 928 | } |
929 | 929 | |
930 | 930 | |
931 | - if($input_def['type'] != 'hidden'){ |
|
932 | - if ( ($input_def['label'] == 'entity_id') && is_object($editedItem) ) { |
|
931 | + if ($input_def['type'] != 'hidden') { |
|
932 | + if (($input_def['label'] == 'entity_id') && is_object($editedItem)) { |
|
933 | 933 | $the_input .= '<br/><span class="wpshop_duplicate_attribute" >' . __('Duplicate this attribute to another entity', 'wpshop') . '</span>'; |
934 | 934 | } |
935 | 935 | $input = ' |
936 | - <tr class="wpshop_' . self::currentPageCode . '_edition_table_line wpshop_' . self::currentPageCode . '_edition_table_line_'.$input_def['name'].'" > |
|
937 | - <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> |
|
938 | - <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> |
|
936 | + <tr class="wpshop_' . self::currentPageCode . '_edition_table_line wpshop_' . self::currentPageCode . '_edition_table_line_' . $input_def['name'] . '" > |
|
937 | + <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> |
|
938 | + <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> |
|
939 | 939 | </tr>'; |
940 | - 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 )) ) |
|
940 | + 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))) |
|
941 | 941 | $the_form_option_content_list[$input_def['label']] = $input; |
942 | 942 | else { |
943 | 943 | $the_form_general_content .= $input; |
944 | - if ( ($input_def['label'] == 'frontend_input') && !is_object($editedItem) ) { |
|
944 | + if (($input_def['label'] == 'frontend_input') && !is_object($editedItem)) { |
|
945 | 945 | |
946 | - $the_input = wpshop_attributes_set::get_attribute_set_complete_list($current_entity_id, self::getDbTable(), self::currentPageCode); |
|
946 | + $the_input = wpshop_attributes_set::get_attribute_set_complete_list($current_entity_id, self::getDbTable(), self::currentPageCode); |
|
947 | 947 | |
948 | 948 | $input = ' |
949 | 949 | <tr class="wpshop_' . self::currentPageCode . '_edition_table_line wpshop_' . self::currentPageCode . '_edition_table_line_set_section" > |
950 | - <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> |
|
950 | + <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> |
|
951 | 951 | <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> |
952 | 952 | </tr>'; |
953 | 953 | $the_form_general_content .= $input; |
954 | 954 | } |
955 | 955 | } |
956 | 956 | } |
957 | - else{ |
|
957 | + else { |
|
958 | 958 | $the_form_content_hidden .= ' |
959 | 959 | ' . $the_input; |
960 | 960 | } |
@@ -970,17 +970,17 @@ discard block |
||
970 | 970 | $section_content = $the_form_general_content; |
971 | 971 | |
972 | 972 | ob_start(); |
973 | - include(WPSHOP_TEMPLATES_DIR.'admin/admin_box_section.tpl.php'); |
|
973 | + include(WPSHOP_TEMPLATES_DIR . 'admin/admin_box_section.tpl.php'); |
|
974 | 974 | $the_form_general_content = ob_get_contents(); |
975 | 975 | ob_end_clean(); |
976 | 976 | |
977 | 977 | /** It is attribute TVA, add a button to calcilate price in mass **/ |
978 | - if ( !empty($editedItem) && !empty($editedItem->code) && $editedItem->code == 'tx_tva' ) { |
|
979 | - $the_form_general_content .= '<input type="button" id="wps_update_price_infos" value="' .__('Update all products price', 'wpshop').'" /> <img src="' .WPSHOP_LOADING_ICON. '" alt="" id="update_products_loader" /> <br/>'; |
|
980 | - $the_form_general_content .= __('If you have updated your VAT rates, save it and update your products price after', 'wpshop' ); |
|
978 | + if (!empty($editedItem) && !empty($editedItem->code) && $editedItem->code == 'tx_tva') { |
|
979 | + $the_form_general_content .= '<input type="button" id="wps_update_price_infos" value="' . __('Update all products price', 'wpshop') . '" /> <img src="' . WPSHOP_LOADING_ICON . '" alt="" id="update_products_loader" /> <br/>'; |
|
980 | + $the_form_general_content .= __('If you have updated your VAT rates, save it and update your products price after', 'wpshop'); |
|
981 | 981 | } |
982 | 982 | if (!empty($the_form_option_content_list)) { |
983 | - $the_form_option_content_section=''; |
|
983 | + $the_form_option_content_section = ''; |
|
984 | 984 | foreach ($attribute_options_group as $group_name => $group_content) { |
985 | 985 | $section_content = ''; |
986 | 986 | foreach ($group_content as $group_code) { |
@@ -989,23 +989,23 @@ discard block |
||
989 | 989 | unset($the_form_option_content_list[$group_code]); |
990 | 990 | } |
991 | 991 | } |
992 | - $section_legend = __($group_name,'wpshop'); |
|
992 | + $section_legend = __($group_name, 'wpshop'); |
|
993 | 993 | $section_page_code = self::currentPageCode; |
994 | 994 | |
995 | 995 | ob_start(); |
996 | - include(WPSHOP_TEMPLATES_DIR.'admin/admin_box_section.tpl.php'); |
|
996 | + include(WPSHOP_TEMPLATES_DIR . 'admin/admin_box_section.tpl.php'); |
|
997 | 997 | $the_form_option_content_section .= ob_get_contents(); |
998 | 998 | ob_end_clean(); |
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | /* Check there are other attributes to display not in defined group */ |
1002 | 1002 | if (!empty($the_form_option_content_list)) { |
1003 | - $section_legend = __('General options','wpshop'); |
|
1003 | + $section_legend = __('General options', 'wpshop'); |
|
1004 | 1004 | $section_content = implode('', $the_form_option_content_list); |
1005 | 1005 | $section_page_code = self::currentPageCode; |
1006 | 1006 | |
1007 | 1007 | ob_start(); |
1008 | - include(WPSHOP_TEMPLATES_DIR.'admin/admin_box_section.tpl.php'); |
|
1008 | + include(WPSHOP_TEMPLATES_DIR . 'admin/admin_box_section.tpl.php'); |
|
1009 | 1009 | $the_form_option_content = ob_get_contents(); |
1010 | 1010 | ob_end_clean(); |
1011 | 1011 | |
@@ -1015,16 +1015,16 @@ discard block |
||
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | /* Default content for the current page */ |
1018 | - $bloc_list[self::currentPageCode]['main_info']['title']=__('Main informations', 'wpshop'); |
|
1018 | + $bloc_list[self::currentPageCode]['main_info']['title'] = __('Main informations', 'wpshop'); |
|
1019 | 1019 | $bloc_list[self::currentPageCode]['main_info']['content'] = $the_form_general_content; |
1020 | 1020 | |
1021 | - $bloc_list[self::currentPageCode]['options']['title']=__('Options', 'wpshop'); |
|
1022 | - $bloc_list[self::currentPageCode]['options']['content']=$the_form_option_content; |
|
1021 | + $bloc_list[self::currentPageCode]['options']['title'] = __('Options', 'wpshop'); |
|
1022 | + $bloc_list[self::currentPageCode]['options']['content'] = $the_form_option_content; |
|
1023 | 1023 | |
1024 | 1024 | $the_form = ' |
1025 | 1025 | <form name="' . se1lf::getDbTable() . '_form" id="' . self::getDbTable() . '_form" method="post" action="#" > |
1026 | - ' . wpshop_form::form_input(self::getDbTable() . '_action', self::getDbTable() . '_action', (isset($_REQUEST['action']) && ($_REQUEST['action'] != '') ? sanitize_text_field($_REQUEST['action']) : 'save') , 'hidden') . ' |
|
1027 | - ' . 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) . ' |
|
1026 | + ' . wpshop_form::form_input(self::getDbTable() . '_action', self::getDbTable() . '_action', (isset($_REQUEST['action']) && ($_REQUEST['action'] != '') ? sanitize_text_field($_REQUEST['action']) : 'save'), 'hidden') . ' |
|
1027 | + ' . 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) . ' |
|
1028 | 1028 | </form> |
1029 | 1029 | <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>'; |
1030 | 1030 | $input_def['possible_value'] = wpshop_entities::get_entities_list(); |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | $the_form .= ' |
1043 | 1043 | <script type="text/javascript" > |
1044 | 1044 | wpshop(document).ready(function(){ |
1045 | - 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') . '"); |
|
1045 | + 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') . '"); |
|
1046 | 1046 | |
1047 | 1047 | jQuery("#wpshop_dialog_duplicate_attribute").dialog({ |
1048 | 1048 | autoOpen: false, |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | dialogClass: "wpshop_uidialog_box", |
1053 | 1053 | resizable: false, |
1054 | 1054 | buttons:{ |
1055 | - "'.__('Duplicate', 'wpshop').'": function(){ |
|
1055 | + "'.__('Duplicate', 'wpshop') . '": function(){ |
|
1056 | 1056 | var data = { |
1057 | 1057 | action: "wpshop_duplicate_attribute", |
1058 | 1058 | wpshop_ajax_nonce: "' . wp_create_nonce("wpshop_duplicate_attribute") . '", |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | } |
1069 | 1069 | }, "json"); |
1070 | 1070 | }, |
1071 | - "'.__('Cancel', 'wpshop').'": function(){ |
|
1071 | + "'.__('Cancel', 'wpshop') . '": function(){ |
|
1072 | 1072 | jQuery(this).dialog("close"); |
1073 | 1073 | jQuery(".wpshop_duplicate_attribute_result").remove(); |
1074 | 1074 | } |
@@ -1086,7 +1086,7 @@ discard block |
||
1086 | 1086 | dialogClass: "wpshop_uidialog_box", |
1087 | 1087 | resizable: false, |
1088 | 1088 | buttons:{ |
1089 | - "'.__('Change type', 'wpshop').'": function(){ |
|
1089 | + "'.__('Change type', 'wpshop') . '": function(){ |
|
1090 | 1090 | var delete_entity = false; |
1091 | 1091 | if(jQuery("#delete_entity").is(":checked")){ |
1092 | 1092 | var delete_entity = true; |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | jQuery("#wpshop_dialog_change_select_data_type").dialog("close"); |
1110 | 1110 | }, "json"); |
1111 | 1111 | }, |
1112 | - "'.__('Cancel', 'wpshop').'": function(){ |
|
1112 | + "'.__('Cancel', 'wpshop') . '": function(){ |
|
1113 | 1113 | jQuery(this).dialog("close"); |
1114 | 1114 | } |
1115 | 1115 | } |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | change_unit_list(); |
1150 | 1150 | });'; |
1151 | 1151 | |
1152 | - if ( !is_object($editedItem) ) { |
|
1152 | + if (!is_object($editedItem)) { |
|
1153 | 1153 | $the_form .= ' |
1154 | 1154 | jQuery("#wpshop_attributes_edition_table_field_id_frontend_input").change(function(){ |
1155 | 1155 | jQuery(".wpshop_attributes_edition_table_field_input_default_value").html(jQuery("#wpshopLoadingPicture").html()); |
@@ -1232,23 +1232,23 @@ discard block |
||
1232 | 1232 | * |
1233 | 1233 | * @return string $currentPageButton The html output code with the different button to add to the interface |
1234 | 1234 | */ |
1235 | - function getPageFormButton($element_id = 0){ |
|
1235 | + function getPageFormButton($element_id = 0) { |
|
1236 | 1236 | $action = isset($_REQUEST['action']) ? wpshop_tools::varSanitizer($_REQUEST['action']) : 'add'; |
1237 | 1237 | $currentPageButton = ''; |
1238 | 1238 | |
1239 | 1239 | //$currentPageButton .= '<h2 class="cancelButton alignleft" ><a href="' . admin_url('edit.php?post_type='.WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES.'&page=' . self::getListingSlug()) . '" class="button add-new-h2" >' . __('Back', 'wpshop') . '</a></h2>'; |
1240 | 1240 | |
1241 | - if(($action == 'add') && (current_user_can('wpshop_add_attributes'))) |
|
1241 | + if (($action == 'add') && (current_user_can('wpshop_add_attributes'))) |
|
1242 | 1242 | $currentPageButton .= '<input type="button" class="button-primary" id="add" name="add" value="' . __('Add', 'wpshop') . '" />'; |
1243 | 1243 | |
1244 | - elseif(current_user_can('wpshop_edit_attributes')) |
|
1244 | + elseif (current_user_can('wpshop_edit_attributes')) |
|
1245 | 1245 | $currentPageButton .= '<input type="button" class="button-primary" id="save" name="save" value="' . __('Save', 'wpshop') . '" />'; |
1246 | 1246 | |
1247 | 1247 | $attribute_undeletable = unserialize(WPSHOP_ATTRIBUTE_UNDELETABLE); |
1248 | 1248 | $attribute = self::getElement($element_id, "'valid', 'moderated', 'notused'", 'id'); |
1249 | - $attribute_code = !empty($attribute->code)?$attribute->code:''; |
|
1250 | - if(current_user_can('wpshop_delete_attributes') && ($action != 'add') && !in_array($attribute_code, $attribute_undeletable)) |
|
1251 | - $currentPageButton .= '<input type="button" class="button-secondary wpshop_delete_element_button wpshop_delete_element_button_'.self::currentPageCode.'" id="delete" name="delete" value="' . __('Delete', 'wpshop') . '" />'; |
|
1249 | + $attribute_code = !empty($attribute->code) ? $attribute->code : ''; |
|
1250 | + if (current_user_can('wpshop_delete_attributes') && ($action != 'add') && !in_array($attribute_code, $attribute_undeletable)) |
|
1251 | + $currentPageButton .= '<input type="button" class="button-secondary wpshop_delete_element_button wpshop_delete_element_button_' . self::currentPageCode . '" id="delete" name="delete" value="' . __('Delete', 'wpshop') . '" />'; |
|
1252 | 1252 | |
1253 | 1253 | return $currentPageButton; |
1254 | 1254 | } |
@@ -1262,19 +1262,19 @@ discard block |
||
1262 | 1262 | * |
1263 | 1263 | * @return object $element_list A wordpress database object containing the attribute list |
1264 | 1264 | */ |
1265 | - public static function getElement($element_id = '', $element_status = "'valid', 'moderated', 'notused'", $field_to_search = 'id', $list = false){ |
|
1265 | + public static function getElement($element_id = '', $element_status = "'valid', 'moderated', 'notused'", $field_to_search = 'id', $list = false) { |
|
1266 | 1266 | |
1267 | 1267 | global $wpdb; |
1268 | 1268 | $element_list = array(); |
1269 | 1269 | $moreQuery = ""; |
1270 | - $moreArgs = array( 1, ); |
|
1270 | + $moreArgs = array(1,); |
|
1271 | 1271 | |
1272 | - if($element_id != ''){ |
|
1272 | + if ($element_id != '') { |
|
1273 | 1273 | $moreQuery .= " |
1274 | 1274 | AND CURRENT_ELEMENT." . $field_to_search . " = %s "; |
1275 | 1275 | $moreArgs[] = $element_id; |
1276 | 1276 | } |
1277 | - if(!empty($_REQUEST['orderby']) && !empty($_REQUEST['order'])){ |
|
1277 | + if (!empty($_REQUEST['orderby']) && !empty($_REQUEST['order'])) { |
|
1278 | 1278 | $moreQuery .= " |
1279 | 1279 | ORDER BY " . sanitize_text_field($_REQUEST['orderby']) . " " . sanitize_text_field($_REQUEST['order']); |
1280 | 1280 | } |
@@ -1283,15 +1283,15 @@ discard block |
||
1283 | 1283 | "SELECT CURRENT_ELEMENT.*, ENTITIES.post_name as entity |
1284 | 1284 | FROM " . self::getDbTable() . " AS CURRENT_ELEMENT |
1285 | 1285 | INNER JOIN {$wpdb->posts} AS ENTITIES ON (ENTITIES.ID = CURRENT_ELEMENT.entity_id) |
1286 | - WHERE %d AND CURRENT_ELEMENT.status IN (".$element_status.") " . $moreQuery, |
|
1286 | + WHERE %d AND CURRENT_ELEMENT.status IN (" . $element_status . ") " . $moreQuery, |
|
1287 | 1287 | $moreArgs |
1288 | 1288 | ); |
1289 | 1289 | |
1290 | 1290 | /* Get the query result regarding on the function parameters. If there must be only one result or a collection */ |
1291 | - if(($element_id == '') || $list){ |
|
1291 | + if (($element_id == '') || $list) { |
|
1292 | 1292 | $element_list = $wpdb->get_results($query); |
1293 | 1293 | } |
1294 | - else{ |
|
1294 | + else { |
|
1295 | 1295 | $element_list = $wpdb->get_row($query); |
1296 | 1296 | } |
1297 | 1297 | |
@@ -1313,43 +1313,43 @@ discard block |
||
1313 | 1313 | $user_id = function_exists('is_user_logged_in') && is_user_logged_in() ? get_current_user_id() : '0'; |
1314 | 1314 | $sent_attribute_list = array(); |
1315 | 1315 | |
1316 | - if ( !empty($attributeToSet) ) { |
|
1316 | + if (!empty($attributeToSet)) { |
|
1317 | 1317 | foreach ($attributeToSet as $attributeType => $attributeTypeDetails) { |
1318 | 1318 | /** Preparation des parametres permettant de supprimer les bonnes valeurs des attributs suivant la configuration de la boutique et de la methode de mise a jour */ |
1319 | 1319 | $delete_current_attribute_values_params = array( |
1320 | 1320 | 'entity_id' => $entityId, |
1321 | 1321 | 'entity_type_id' => $entityTypeId |
1322 | 1322 | ); |
1323 | - if ( WPSHOP_ATTRIBUTE_VALUE_PER_USER ) { |
|
1323 | + if (WPSHOP_ATTRIBUTE_VALUE_PER_USER) { |
|
1324 | 1324 | $delete_current_attribute_values_params['user_id'] = $user_id; |
1325 | 1325 | } |
1326 | 1326 | |
1327 | - if(!empty($attributeTypeDetails) && is_array($attributeTypeDetails)) { |
|
1328 | - foreach($attributeTypeDetails as $attribute_code => $attributeValue) { |
|
1327 | + if (!empty($attributeTypeDetails) && is_array($attributeTypeDetails)) { |
|
1328 | + foreach ($attributeTypeDetails as $attribute_code => $attributeValue) { |
|
1329 | 1329 | |
1330 | - if ( $attributeType == 'decimal' ) { |
|
1330 | + if ($attributeType == 'decimal') { |
|
1331 | 1331 | $attributeValue = str_replace(',', '.', $attributeValue); |
1332 | 1332 | } |
1333 | - if ( ($attributeType == 'integer') && !is_array($attributeValue) ) { |
|
1333 | + if (($attributeType == 'integer') && !is_array($attributeValue)) { |
|
1334 | 1334 | $attributeValue = (int)$attributeValue; |
1335 | 1335 | } |
1336 | 1336 | $more_query_params_values = array(); |
1337 | - if($attribute_code != 'unit') { |
|
1337 | + if ($attribute_code != 'unit') { |
|
1338 | 1338 | |
1339 | 1339 | $unit_id = 0; |
1340 | - if(isset($attributeTypeDetails['unit'][$attribute_code])){ |
|
1340 | + if (isset($attributeTypeDetails['unit'][$attribute_code])) { |
|
1341 | 1341 | $unit_id = $attributeTypeDetails['unit'][$attribute_code]; |
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | $currentAttribute = self::getElement($attribute_code, "'valid'", 'code'); |
1345 | - if( !empty($currentAttribute) ){ |
|
1345 | + if (!empty($currentAttribute)) { |
|
1346 | 1346 | $sent_attribute_list[] = $currentAttribute->id; |
1347 | 1347 | |
1348 | 1348 | /* Enregistrement de la valeur actuelle de l'attribut dans la table d'historique si l'option historique est activee sur l'attribut courant */ |
1349 | - if ( $currentAttribute->is_historisable == 'yes') { |
|
1349 | + if ($currentAttribute->is_historisable == 'yes') { |
|
1350 | 1350 | $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); |
1351 | 1351 | $attribute_histo = $wpdb->get_results($query); |
1352 | - if(!empty($attribute_histo)){ |
|
1352 | + if (!empty($attribute_histo)) { |
|
1353 | 1353 | $attribute_histo_content['status'] = 'valid'; |
1354 | 1354 | $attribute_histo_content['creation_date'] = current_time('mysql', 0); |
1355 | 1355 | $attribute_histo_content['creation_date_value'] = $attribute_histo[0]->creation_date_value; |
@@ -1366,8 +1366,8 @@ discard block |
||
1366 | 1366 | } |
1367 | 1367 | $attributeValue = str_replace("\\", "", $attributeValue); |
1368 | 1368 | |
1369 | - if ( empty($from) || (!empty($attributeValue)) ) { |
|
1370 | - $wpdb->delete(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($delete_current_attribute_values_params, array('attribute_id' => $currentAttribute->id))); |
|
1369 | + if (empty($from) || (!empty($attributeValue))) { |
|
1370 | + $wpdb->delete(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attributeType, array_merge($delete_current_attribute_values_params, array('attribute_id' => $currentAttribute->id))); |
|
1371 | 1371 | |
1372 | 1372 | /** Insertion de la nouvelle valeur de l'attribut dans la base */ |
1373 | 1373 | $query_params = array( |
@@ -1381,32 +1381,32 @@ discard block |
||
1381 | 1381 | 'creation_date_value' => current_time('mysql', 0) |
1382 | 1382 | ); |
1383 | 1383 | /** Si l'attribut courant est contenu dans un tableau (exemple: select multiple) on lit tout le tableau et on enregistre chaque valeur separement */ |
1384 | - if(is_array($attributeValue)){ |
|
1385 | - foreach($attributeValue as $a){ |
|
1386 | - $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($query_params, array('value' => $a))); |
|
1384 | + if (is_array($attributeValue)) { |
|
1385 | + foreach ($attributeValue as $a) { |
|
1386 | + $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attributeType, array_merge($query_params, array('value' => $a))); |
|
1387 | 1387 | } |
1388 | 1388 | } |
1389 | - else{ |
|
1390 | - $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($query_params, array('value' => $attributeValue))); |
|
1391 | - wpeologs_ctr::log_datas_in_files( 'wpshop_attributes', array( |
|
1389 | + else { |
|
1390 | + $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attributeType, array_merge($query_params, array('value' => $attributeValue))); |
|
1391 | + wpeologs_ctr::log_datas_in_files('wpshop_attributes', array( |
|
1392 | 1392 | 'object_id' => $entityId, |
1393 | - 'message' => __( 'Add the attribute : ' . $currentAttribute->code . ' with value : ' . $attributeValue , 'wpshop' ) ), 0 |
|
1393 | + 'message' => __('Add the attribute : ' . $currentAttribute->code . ' with value : ' . $attributeValue, 'wpshop') ), 0 |
|
1394 | 1394 | ); |
1395 | 1395 | } |
1396 | 1396 | |
1397 | 1397 | /** 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 */ |
1398 | - if ( ( ($currentAttribute->is_used_for_sort_by == 'yes') || ($currentAttribute->is_searchable == 'yes')) || ( $currentAttribute->is_filterable == 'yes') && !empty($attributeValue) ) : |
|
1399 | - update_post_meta($entityId, '_'.$attribute_code, $attributeValue); |
|
1398 | + if ((($currentAttribute->is_used_for_sort_by == 'yes') || ($currentAttribute->is_searchable == 'yes')) || ($currentAttribute->is_filterable == 'yes') && !empty($attributeValue)) : |
|
1399 | + update_post_meta($entityId, '_' . $attribute_code, $attributeValue); |
|
1400 | 1400 | endif; |
1401 | 1401 | |
1402 | 1402 | /** Enregistrement de toutes les valeurs des attributs dans une meta du produit */ |
1403 | - $attribute_option = (!empty($_POST['attribute_option'][$attribute_code])) ? (array) $_POST['attribute_option'][$attribute_code] : null; |
|
1403 | + $attribute_option = (!empty($_POST['attribute_option'][$attribute_code])) ? (array)$_POST['attribute_option'][$attribute_code] : null; |
|
1404 | 1404 | if (isset($attribute_option)) { |
1405 | 1405 | $value = self::get_attribute_type_select_option_info($attributeTypeDetails[$attribute_code], 'value'); |
1406 | 1406 | if (strtolower($value) == 'yes') : |
1407 | - update_post_meta($entityId, 'attribute_option_'.$attribute_code, $attribute_option); |
|
1407 | + update_post_meta($entityId, 'attribute_option_' . $attribute_code, $attribute_option); |
|
1408 | 1408 | else : |
1409 | - delete_post_meta($entityId, 'attribute_option_'.$attribute_code); |
|
1409 | + delete_post_meta($entityId, 'attribute_option_' . $attribute_code); |
|
1410 | 1410 | endif; |
1411 | 1411 | } |
1412 | 1412 | } |
@@ -1414,15 +1414,15 @@ discard block |
||
1414 | 1414 | } |
1415 | 1415 | } |
1416 | 1416 | |
1417 | - if ( empty($from) ) { |
|
1418 | - $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); |
|
1417 | + if (empty($from)) { |
|
1418 | + $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); |
|
1419 | 1419 | $attr_to_delete = $wpdb->get_results($query); |
1420 | - if(!empty($attr_to_delete)){ |
|
1420 | + if (!empty($attr_to_delete)) { |
|
1421 | 1421 | foreach ($attr_to_delete as $value) { |
1422 | - $wpdb->delete(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.$attributeType, array_merge($delete_current_attribute_values_params, array('value_id' => $value->value_id))); |
|
1423 | - wpeologs_ctr::log_datas_in_files( 'wpshop_attributes', array( |
|
1422 | + $wpdb->delete(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attributeType, array_merge($delete_current_attribute_values_params, array('value_id' => $value->value_id))); |
|
1423 | + wpeologs_ctr::log_datas_in_files('wpshop_attributes', array( |
|
1424 | 1424 | 'object_id' => $entityId, |
1425 | - 'message' => __( 'Remove the attribute : ' . $value->value_id, 'wpshop' ) ), 0 |
|
1425 | + 'message' => __('Remove the attribute : ' . $value->value_id, 'wpshop') ), 0 |
|
1426 | 1426 | ); |
1427 | 1427 | } |
1428 | 1428 | } |
@@ -1448,7 +1448,7 @@ discard block |
||
1448 | 1448 | |
1449 | 1449 | $query_params = ""; |
1450 | 1450 | $query_params_values = array($attributeId, $entityTypeId, $entityId); |
1451 | - if(WPSHOP_ATTRIBUTE_VALUE_PER_USER && (isset($atribute_params['intrinsic']) && ($atribute_params['intrinsic'] != 'yes'))){ |
|
1451 | + if (WPSHOP_ATTRIBUTE_VALUE_PER_USER && (isset($atribute_params['intrinsic']) && ($atribute_params['intrinsic'] != 'yes'))) { |
|
1452 | 1452 | $query_params = " |
1453 | 1453 | AND ATTR_VAL.user_id = %d"; |
1454 | 1454 | $query_params_values[] = get_current_user_id(); |
@@ -1464,20 +1464,20 @@ discard block |
||
1464 | 1464 | ); |
1465 | 1465 | $attributeValue = $wpdb->get_results($query); |
1466 | 1466 | |
1467 | - if ( ( (count($attributeValue) <= 1 ) && !empty($attributeValue[0]) ) && ( empty($atribute_params['frontend_input']) || ($atribute_params['frontend_input'] != 'multiple-select') )) { |
|
1467 | + if (((count($attributeValue) <= 1) && !empty($attributeValue[0])) && (empty($atribute_params['frontend_input']) || ($atribute_params['frontend_input'] != 'multiple-select'))) { |
|
1468 | 1468 | $attributeValue = $attributeValue[0]; |
1469 | 1469 | } |
1470 | - else{ |
|
1470 | + else { |
|
1471 | 1471 | $entity_meta = get_post_meta($entityId, WPSHOP_PRODUCT_ATTRIBUTE_META_KEY, true); |
1472 | - if ( !empty($entity_meta) ) { |
|
1472 | + if (!empty($entity_meta)) { |
|
1473 | 1473 | $query = $wpdb->prepare("SELECT code FROM " . WPSHOP_DBT_ATTRIBUTE . " WHERE id = %d AND entity_id = %d ", $attributeId, $entityTypeId); |
1474 | 1474 | $attribute_code = $wpdb->get_var($query); |
1475 | 1475 | $attributeValue = !empty($entity_meta[$attribute_code]) ? $entity_meta[$attribute_code] : null; |
1476 | 1476 | } |
1477 | - if ( is_array($attributeValue) ) { |
|
1477 | + if (is_array($attributeValue)) { |
|
1478 | 1478 | $tmp_array = array(); |
1479 | - if ( !empty($attributeValue) ) { |
|
1480 | - foreach ( $attributeValue as $att ) { |
|
1479 | + if (!empty($attributeValue)) { |
|
1480 | + foreach ($attributeValue as $att) { |
|
1481 | 1481 | $obj = new stdClass(); |
1482 | 1482 | $obj->value = $att; |
1483 | 1483 | $obj->unit_id = 0; |
@@ -1508,9 +1508,9 @@ discard block |
||
1508 | 1508 | $elements = array(); |
1509 | 1509 | $elementsWithAttributeAndValues = self::get_attribute_list_for_item($entityId, $elementId, $language); |
1510 | 1510 | |
1511 | - foreach ( $elementsWithAttributeAndValues as $elementDefinition ) { |
|
1511 | + foreach ($elementsWithAttributeAndValues as $elementDefinition) { |
|
1512 | 1512 | $arrayKey = $elementDefinition->attribute_id; |
1513 | - if ( $keyForArray == 'code' ) { |
|
1513 | + if ($keyForArray == 'code') { |
|
1514 | 1514 | $arrayKey = $elementDefinition->attribute_code; |
1515 | 1515 | } |
1516 | 1516 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['code'] = $elementDefinition->attribute_set_section_code; |
@@ -1520,7 +1520,7 @@ discard block |
||
1520 | 1520 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['backend_table'] = $elementDefinition->backend_table; |
1521 | 1521 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['backend_input'] = $elementDefinition->backend_input; |
1522 | 1522 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['frontend_input'] = $elementDefinition->frontend_input; |
1523 | - $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['frontend_label'] = __( $elementDefinition->frontend_label, 'wpshop' ); |
|
1523 | + $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['frontend_label'] = __($elementDefinition->frontend_label, 'wpshop'); |
|
1524 | 1524 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['attribute_code'] = $elementDefinition->attribute_code; |
1525 | 1525 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['data_type_to_use'] = $elementDefinition->data_type_to_use; |
1526 | 1526 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['is_visible_in_front'] = $elementDefinition->is_visible_in_front; |
@@ -1530,29 +1530,29 @@ discard block |
||
1530 | 1530 | $attributeValueField = 'attribute_value_' . $elementDefinition->data_type; |
1531 | 1531 | |
1532 | 1532 | // Manage the value differently if it is an array or not |
1533 | - if ( !empty($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value']) ) { |
|
1533 | + if (!empty($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'])) { |
|
1534 | 1534 | if (is_array($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'])) { |
1535 | 1535 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'][] = $elementDefinition->$attributeValueField; |
1536 | 1536 | } |
1537 | 1537 | else { |
1538 | - $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'] = array($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'],$elementDefinition->$attributeValueField); |
|
1538 | + $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'] = array($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'], $elementDefinition->$attributeValueField); |
|
1539 | 1539 | } |
1540 | 1540 | } |
1541 | 1541 | else { |
1542 | 1542 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['value'] = $elementDefinition->$attributeValueField; |
1543 | 1543 | } |
1544 | 1544 | |
1545 | - if ( $elementDefinition->backend_input == 'multiple-select' ) { |
|
1545 | + if ($elementDefinition->backend_input == 'multiple-select') { |
|
1546 | 1546 | $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['select_value'] = self::get_attribute_type_select_option_info($attributeValueField, 'value'); |
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | $attributeUnitField = 'attribute_unit_' . $elementDefinition->data_type; |
1550 | - $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'] = __( $elementDefinition->$attributeUnitField, 'wpshop' ); |
|
1551 | - if( !empty($elementDefinition->is_requiring_unit ) && ( $elementDefinition->is_requiring_unit == 'yes' ) && empty( $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'] ) ) { |
|
1550 | + $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'] = __($elementDefinition->$attributeUnitField, 'wpshop'); |
|
1551 | + if (!empty($elementDefinition->is_requiring_unit) && ($elementDefinition->is_requiring_unit == 'yes') && empty($elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'])) { |
|
1552 | 1552 | $unit = ''; |
1553 | - $query = $wpdb->prepare( 'SELECT unit FROM '. WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id = %d AND status = %s', $elementDefinition->_default_unit, 'valid'); |
|
1554 | - $unit = $wpdb->get_var( $query ); |
|
1555 | - $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'] = __( $unit, 'wpshop' ); |
|
1553 | + $query = $wpdb->prepare('SELECT unit FROM ' . WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id = %d AND status = %s', $elementDefinition->_default_unit, 'valid'); |
|
1554 | + $unit = $wpdb->get_var($query); |
|
1555 | + $elements[$elementId][$elementDefinition->attribute_set_section_name]['attributes'][$arrayKey]['unit'] = __($unit, 'wpshop'); |
|
1556 | 1556 | } |
1557 | 1557 | |
1558 | 1558 | } |
@@ -1564,7 +1564,7 @@ discard block |
||
1564 | 1564 | $elementsWithAttributeAndValues = array(); |
1565 | 1565 | $moreQuery = ""; |
1566 | 1566 | |
1567 | - $entity_type = empty($defined_entity_type) ? get_post_type( $elementId ) : $defined_entity_type; |
|
1567 | + $entity_type = empty($defined_entity_type) ? get_post_type($elementId) : $defined_entity_type; |
|
1568 | 1568 | |
1569 | 1569 | $query = $wpdb->prepare( |
1570 | 1570 | "SELECT POST_META.*, |
@@ -1613,23 +1613,23 @@ discard block |
||
1613 | 1613 | * |
1614 | 1614 | * @return boolean The result to know if the element has to be displayed on frontend |
1615 | 1615 | */ |
1616 | - public static function check_attribute_display( $attribute_main_config, $attribute_custom_config, $attribute_or_set, $attribute_code, $output_type) { |
|
1617 | - if ( $attribute_main_config === 'yes' ) { |
|
1616 | + public static function check_attribute_display($attribute_main_config, $attribute_custom_config, $attribute_or_set, $attribute_code, $output_type) { |
|
1617 | + if ($attribute_main_config === 'yes') { |
|
1618 | 1618 | $attribute_output = true; |
1619 | - 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' ) |
|
1620 | - || empty($attribute_custom_config) ) { |
|
1619 | + 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') |
|
1620 | + || empty($attribute_custom_config)) { |
|
1621 | 1621 | $attribute_output = true; |
1622 | 1622 | } |
1623 | - 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')) ) { |
|
1623 | + 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'))) { |
|
1624 | 1624 | $attribute_output = false; |
1625 | 1625 | } |
1626 | 1626 | } |
1627 | - elseif ( $attribute_main_config === 'no' ) { |
|
1627 | + elseif ($attribute_main_config === 'no') { |
|
1628 | 1628 | $attribute_output = false; |
1629 | - if ( empty($attribute_custom_config[$attribute_or_set]) || empty($attribute_custom_config[$attribute_or_set][$attribute_code]) ) { |
|
1629 | + if (empty($attribute_custom_config[$attribute_or_set]) || empty($attribute_custom_config[$attribute_or_set][$attribute_code])) { |
|
1630 | 1630 | $attribute_output = false; |
1631 | 1631 | } |
1632 | - 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') ) { |
|
1632 | + 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')) { |
|
1633 | 1633 | $attribute_output = true; |
1634 | 1634 | } |
1635 | 1635 | } |
@@ -1646,22 +1646,22 @@ discard block |
||
1646 | 1646 | global $wpdb; |
1647 | 1647 | global $wp_query; |
1648 | 1648 | |
1649 | - $attribute = self::getElement( $atts['attid'] ); |
|
1650 | - if(empty($atts['pid'])) $atts['pid'] = $wp_query->posts[0]->ID; |
|
1651 | - $attribute_main_config = ( empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet') ) ? $attribute->is_visible_in_front : $attribute->is_visible_in_front_listing; |
|
1652 | - $output_type = ( empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet') ) ? 'complete_sheet' : 'mini_output'; |
|
1649 | + $attribute = self::getElement($atts['attid']); |
|
1650 | + if (empty($atts['pid'])) $atts['pid'] = $wp_query->posts[0]->ID; |
|
1651 | + $attribute_main_config = (empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet')) ? $attribute->is_visible_in_front : $attribute->is_visible_in_front_listing; |
|
1652 | + $output_type = (empty($atts['output_type']) || ($atts['output_type'] == 'complete_sheet')) ? 'complete_sheet' : 'mini_output'; |
|
1653 | 1653 | $product_attribute_custom_config = get_post_meta($atts['pid'], WPSHOP_PRODUCT_FRONT_DISPLAY_CONF, true); |
1654 | - $display_attribute_value = wpshop_attributes::check_attribute_display( $attribute_main_config, $product_attribute_custom_config, 'attribute', $attribute->code, $output_type); |
|
1654 | + $display_attribute_value = wpshop_attributes::check_attribute_display($attribute_main_config, $product_attribute_custom_config, 'attribute', $attribute->code, $output_type); |
|
1655 | 1655 | |
1656 | - if ( !empty( $attribute->data_type ) ) { |
|
1656 | + if (!empty($attribute->data_type)) { |
|
1657 | 1657 | $attributeDefinition['unit'] = ''; |
1658 | 1658 | |
1659 | 1659 | $has_value = false; |
1660 | - $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'] ); |
|
1661 | - if ( in_array($attribute->backend_input, array('multiple-select', 'checkbox')) ) { |
|
1660 | + $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']); |
|
1661 | + if (in_array($attribute->backend_input, array('multiple-select', 'checkbox'))) { |
|
1662 | 1662 | $list_of_value = $wpdb->get_results($query); |
1663 | - if ( !empty($list_of_value) ) { |
|
1664 | - foreach ( $list_of_value as $value ) { |
|
1663 | + if (!empty($list_of_value)) { |
|
1664 | + foreach ($list_of_value as $value) { |
|
1665 | 1665 | $data[] = $value->value; |
1666 | 1666 | } |
1667 | 1667 | $has_value = true; |
@@ -1669,10 +1669,10 @@ discard block |
||
1669 | 1669 | } |
1670 | 1670 | else { |
1671 | 1671 | $data = $wpdb->get_var($query); |
1672 | - if ( !empty($data) ) { |
|
1672 | + if (!empty($data)) { |
|
1673 | 1673 | $has_value = true; |
1674 | 1674 | } |
1675 | - elseif( !empty($attribute->default_value) ) { |
|
1675 | + elseif (!empty($attribute->default_value)) { |
|
1676 | 1676 | $has_value = true; |
1677 | 1677 | $data = $attribute->default_value; |
1678 | 1678 | } |
@@ -1684,7 +1684,7 @@ discard block |
||
1684 | 1684 | $attributeDefinition['is_requiring_unit'] = $attribute->is_requiring_unit; |
1685 | 1685 | $attributeDefinition['backend_input'] = $attribute->backend_input; |
1686 | 1686 | $attributeDefinition['data_type_to_use'] = $attribute->data_type_to_use; |
1687 | - $attribute_display = wpshop_attributes::wps_attribute_values_display( $attributeDefinition ); |
|
1687 | + $attribute_display = wpshop_attributes::wps_attribute_values_display($attributeDefinition); |
|
1688 | 1688 | $attribute_value = $attribute_display[0]; |
1689 | 1689 | $attributeDefinition['value'] = $attribute_display[1]; |
1690 | 1690 | $attribute_unit_list = $attribute_display[2]; |
@@ -1704,13 +1704,13 @@ discard block |
||
1704 | 1704 | * @param array $specific_argument Optionnal The different parameters used for filter output |
1705 | 1705 | * @return array The definition for the field used to display an attribute |
1706 | 1706 | */ |
1707 | - public static function get_attribute_field_definition( $attribute, $attribute_value = '', $specific_argument = array() ) { |
|
1707 | + public static function get_attribute_field_definition($attribute, $attribute_value = '', $specific_argument = array()) { |
|
1708 | 1708 | global $wpdb; |
1709 | 1709 | $wpshop_price_attributes = unserialize(WPSHOP_ATTRIBUTE_PRICES); |
1710 | 1710 | $wpshop_weight_attributes = unserialize(WPSHOP_ATTRIBUTE_WEIGHT); |
1711 | 1711 | $input_def = array(); |
1712 | 1712 | $input_def['option'] = $input_def['field_container_class'] = ''; |
1713 | - $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 . ']'); |
|
1713 | + $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 . ']'); |
|
1714 | 1714 | $input_def['input_domain'] = $attributeInputDomain; |
1715 | 1715 | $input_def['id'] = (!empty($specific_argument) && !empty($specific_argument['field_id']) ? $specific_argument['field_id'] . '_' : '') . 'attribute_' . $attribute->id; |
1716 | 1716 | $input_def['intrinsec'] = $attribute->is_intrinsic; |
@@ -1730,26 +1730,26 @@ discard block |
||
1730 | 1730 | $input_def['frontend_type'] = $attribute->frontend_input; |
1731 | 1731 | $input_def['is_used_in_quick_add_form'] = $attribute->is_used_in_quick_add_form; |
1732 | 1732 | |
1733 | - if ( !empty($attribute_value) && !is_object($attribute_value) ) { |
|
1733 | + if (!empty($attribute_value) && !is_object($attribute_value)) { |
|
1734 | 1734 | $input_def['value'] = $attribute_value; |
1735 | 1735 | } |
1736 | - else if ( !empty($attribute_value->value) ) { |
|
1736 | + else if (!empty($attribute_value->value)) { |
|
1737 | 1737 | $input_def['value'] = stripslashes($attribute_value->value); |
1738 | 1738 | } |
1739 | - else if ( !empty($specific_argument['element_identifier']) && empty($attribute_value) && (get_post_status($specific_argument['element_identifier']) != 'auto-draft') ) { |
|
1739 | + else if (!empty($specific_argument['element_identifier']) && empty($attribute_value) && (get_post_status($specific_argument['element_identifier']) != 'auto-draft')) { |
|
1740 | 1740 | $input_def['value'] = ''; |
1741 | 1741 | } |
1742 | 1742 | |
1743 | 1743 | $input_def['options'] = ''; |
1744 | 1744 | $input_more_class = !empty($specific_argument['input_class']) ? $specific_argument['input_class'] : ''; |
1745 | 1745 | if ($attribute->data_type == 'datetime') { |
1746 | - $date_config = unserialize( $attribute->default_value ); |
|
1746 | + $date_config = unserialize($attribute->default_value); |
|
1747 | 1747 | if ((($date_config['default_value'] == '') || ($date_config['default_value'] == 'date_of_current_day')) && ($date_config['default_value'] == 'date_of_current_day')) { |
1748 | 1748 | $input_def['value'] = date('Y-m-d'); |
1749 | 1749 | } |
1750 | 1750 | else { |
1751 | 1751 | /** Modification due to a message on eoxia forum: http://www.eoxia.com/forums/topic/bug-attribut-de-type-date-dans-fiche-produit-admin/ */ |
1752 | - $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 ) : '' ); |
|
1752 | + $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) : ''); |
|
1753 | 1753 | } |
1754 | 1754 | $input_more_class .= ' wpshop_input_datetime '; |
1755 | 1755 | $field_script = '<script type="text/javascript" > |
@@ -1762,31 +1762,31 @@ discard block |
||
1762 | 1762 | wpshop("#' . $input_def['id'] . '").datepicker("option", "navigationAsDateFormat", true); |
1763 | 1763 | wpshop("#' . $input_def['id'] . '").val("' . str_replace(" 00:00:00", "", $input_def['value']) . '");'; |
1764 | 1764 | |
1765 | - if ( !empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur']) ) { |
|
1766 | - if ( !empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur']['minDate'][0]) ) { |
|
1765 | + if (!empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur'])) { |
|
1766 | + if (!empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur']['minDate'][0])) { |
|
1767 | 1767 | $field_script .= ' |
1768 | 1768 | wpshop("#' . $input_def['id'] . '").datepicker("option", "minDate", "' . $date_config['field_options']['attribute_type_date_options_available_date_past_futur']['minDate'][0] . '");'; |
1769 | 1769 | } |
1770 | - if ( !empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur']['maxDate'][0]) ) { |
|
1770 | + if (!empty($date_config['field_options']['attribute_type_date_options_available_date_past_futur']['maxDate'][0])) { |
|
1771 | 1771 | $field_script .= ' |
1772 | 1772 | wpshop("#' . $input_def['id'] . '").datepicker("option", "maxDate", "' . $date_config['field_options']['attribute_type_date_options_available_date_past_futur']['maxDate'][0] . '");'; |
1773 | 1773 | } |
1774 | 1774 | } |
1775 | 1775 | |
1776 | 1776 | $script_options = $script_options_params = array(); |
1777 | - if ( !empty($date_config['field_options']['attribute_type_date_options_day_to_show']) ) { |
|
1777 | + if (!empty($date_config['field_options']['attribute_type_date_options_day_to_show'])) { |
|
1778 | 1778 | $day_to_show_list = ' '; |
1779 | - foreach ( $date_config['field_options']['attribute_type_date_options_day_to_show'] as $day_to_show ) { |
|
1779 | + foreach ($date_config['field_options']['attribute_type_date_options_day_to_show'] as $day_to_show) { |
|
1780 | 1780 | $day_to_show_list .= '(date.getDay() == ' . $day_to_show . ') || '; |
1781 | 1781 | } |
1782 | 1782 | $script_options[] = '( ' . substr($day_to_show_list, 0, -4) . ' )'; |
1783 | 1783 | } |
1784 | 1784 | |
1785 | - if ( !empty($date_config['field_options']['attribute_type_date_options_available_date_type'][0]) ) { |
|
1786 | - if ( !empty($date_config['field_options']['attribute_type_date_options_available_date']) ) { |
|
1785 | + if (!empty($date_config['field_options']['attribute_type_date_options_available_date_type'][0])) { |
|
1786 | + if (!empty($date_config['field_options']['attribute_type_date_options_available_date'])) { |
|
1787 | 1787 | $available_date = ' '; |
1788 | - foreach ( $date_config['field_options']['attribute_type_date_options_available_date'] as $avalaible_date_list ) { |
|
1789 | - if ( !empty($avalaible_date_list) ) { |
|
1788 | + foreach ($date_config['field_options']['attribute_type_date_options_available_date'] as $avalaible_date_list) { |
|
1789 | + if (!empty($avalaible_date_list)) { |
|
1790 | 1790 | $available_date .= '"' . $avalaible_date_list . '",'; |
1791 | 1791 | } |
1792 | 1792 | } |
@@ -1795,7 +1795,7 @@ discard block |
||
1795 | 1795 | } |
1796 | 1796 | } |
1797 | 1797 | |
1798 | - if ( !empty( $script_options ) ) { |
|
1798 | + if (!empty($script_options)) { |
|
1799 | 1799 | $field_script .= ' |
1800 | 1800 | wpshop("#' . $input_def['id'] . '").datepicker("option", "beforeShowDay", function(date){ |
1801 | 1801 | ' . implode(' ', $script_options_params) . '; |
@@ -1823,37 +1823,37 @@ discard block |
||
1823 | 1823 | </script>'; |
1824 | 1824 | $input_def['options'] .= $field_script; |
1825 | 1825 | } |
1826 | - if ( in_array($attribute->backend_input, array('multiple-select', 'select', 'radio', 'checkbox'))) { |
|
1827 | - $input_more_class .= (!empty($specific_argument['no_chosen']) ? '' : ' chosen_select ' ); |
|
1826 | + if (in_array($attribute->backend_input, array('multiple-select', 'select', 'radio', 'checkbox'))) { |
|
1827 | + $input_more_class .= (!empty($specific_argument['no_chosen']) ? '' : ' chosen_select '); |
|
1828 | 1828 | $input_def['type'] = ((!empty($specific_argument['from']) && ($specific_argument['from'] == 'frontend')) || (!is_admin() && empty($specific_argument['from'])) ? $attribute->frontend_input : $attribute->backend_input); |
1829 | 1829 | $input_def['valueToPut'] = 'index'; |
1830 | 1830 | |
1831 | 1831 | $select_display = self::get_select_output($attribute, $specific_argument); |
1832 | - if ( empty( $input_def[ 'options_label' ] ) && !empty( $specific_argument ) && (!empty($specific_argument['from']) && ($specific_argument['from'] == 'frontend') ) ) { |
|
1833 | - $input_def[ 'options_label' ][ 'original' ] = true; |
|
1832 | + if (empty($input_def['options_label']) && !empty($specific_argument) && (!empty($specific_argument['from']) && ($specific_argument['from'] == 'frontend'))) { |
|
1833 | + $input_def['options_label']['original'] = true; |
|
1834 | 1834 | } |
1835 | 1835 | $input_def['options'] .= $select_display['more_input']; |
1836 | 1836 | $input_def['possible_value'] = (!empty($select_display) && !empty($select_display['possible_value'])) ? $select_display['possible_value'] : ''; |
1837 | - if ( !is_admin() ) { |
|
1837 | + if (!is_admin()) { |
|
1838 | 1838 | $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" />'; |
1839 | 1839 | } |
1840 | - if ( in_array($attribute->backend_input, array('multiple-select', 'checkbox')) && is_admin() && (empty($specific_argument['from']) || ($specific_argument['from'] != 'frontend')) ) { |
|
1841 | - $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'); |
|
1840 | + if (in_array($attribute->backend_input, array('multiple-select', 'checkbox')) && is_admin() && (empty($specific_argument['from']) || ($specific_argument['from'] != 'frontend'))) { |
|
1841 | + $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'); |
|
1842 | 1842 | } |
1843 | 1843 | } |
1844 | 1844 | $input_def['label_pointer'] = 'for="' . $input_def['id'] . '"'; |
1845 | - if(($input_def['type'] == 'radio') || ($input_def['type'] == 'checkbox')){ |
|
1845 | + if (($input_def['type'] == 'radio') || ($input_def['type'] == 'checkbox')) { |
|
1846 | 1846 | $input_def['label_pointer'] = ''; |
1847 | 1847 | } |
1848 | 1848 | |
1849 | 1849 | /* |
1850 | 1850 | * Specifc treatment for price attributes |
1851 | 1851 | */ |
1852 | - if((WPSHOP_PRODUCT_PRICE_PILOT == 'HT') && ($attribute->code == WPSHOP_PRODUCT_PRICE_TTC) ){ |
|
1852 | + if ((WPSHOP_PRODUCT_PRICE_PILOT == 'HT') && ($attribute->code == WPSHOP_PRODUCT_PRICE_TTC)) { |
|
1853 | 1853 | $input_def['option'] .= ' readonly="readonly" '; |
1854 | 1854 | $input_more_class .= ' wpshop_prices_readonly'; |
1855 | 1855 | } |
1856 | - elseif((WPSHOP_PRODUCT_PRICE_PILOT == 'TTC') && ($attribute->code == WPSHOP_PRODUCT_PRICE_HT) ){ |
|
1856 | + elseif ((WPSHOP_PRODUCT_PRICE_PILOT == 'TTC') && ($attribute->code == WPSHOP_PRODUCT_PRICE_HT)) { |
|
1857 | 1857 | $input_def['option'] .= ' readonly="readonly" '; |
1858 | 1858 | $input_more_class .= ' wpshop_prices_readonly'; |
1859 | 1859 | } |
@@ -1864,7 +1864,7 @@ discard block |
||
1864 | 1864 | |
1865 | 1865 | $input_def['label'] = str_replace("\\", "", $input_def['label']); |
1866 | 1866 | // $input_def['value'] = str_replace("\\", "", $input_def['value']); |
1867 | - $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 : '' ) . '" '; |
|
1867 | + $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 : '') . '" '; |
|
1868 | 1868 | $input_def['title'] = !empty($attribute->frontend_help_message) ? ' title="' . $attribute->frontend_help_message . '" ' : ''; |
1869 | 1869 | |
1870 | 1870 | if (($attribute->is_intrinsic == 'yes') && ((!empty($input_def['value'])) || ($input_def['value'] > 0))) { |
@@ -1875,13 +1875,13 @@ discard block |
||
1875 | 1875 | * Add the unit to the attribute if attribute configuration is set to yes |
1876 | 1876 | */ |
1877 | 1877 | if ($attribute->is_requiring_unit == 'yes') { |
1878 | - if ( in_array($attribute->code, $wpshop_price_attributes) || ( WPSHOP_COST_OF_POSTAGE == $attribute->code) ) { |
|
1878 | + if (in_array($attribute->code, $wpshop_price_attributes) || (WPSHOP_COST_OF_POSTAGE == $attribute->code)) { |
|
1879 | 1879 | $input_def['options'] .= ' <span class="attribute_currency" id="attribute_currency_' . $attribute->id . '" >' . wpshop_tools::wpshop_get_currency() . '</span>'; |
1880 | 1880 | } |
1881 | - elseif ( in_array($attribute->code, $wpshop_weight_attributes) ) { |
|
1881 | + elseif (in_array($attribute->code, $wpshop_weight_attributes)) { |
|
1882 | 1882 | $weight_defaut_unity_option = get_option('wpshop_shop_default_weight_unity'); |
1883 | - $query = $wpdb->prepare('SELECT name FROM '. WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id=%d', $weight_defaut_unity_option); |
|
1884 | - $unity = $wpdb->get_var( $query ); |
|
1883 | + $query = $wpdb->prepare('SELECT name FROM ' . WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id=%d', $weight_defaut_unity_option); |
|
1884 | + $unity = $wpdb->get_var($query); |
|
1885 | 1885 | $input_def['options'] .= ' <span class="attribute_weight" id="attribute_weight_' . $attribute->id . '" >' . __($unity, 'wpshop') . '</span>'; |
1886 | 1886 | } |
1887 | 1887 | else { |
@@ -1889,11 +1889,11 @@ discard block |
||
1889 | 1889 | $unit_input_def['possible_value'] = wpshop_attributes_unit::get_unit_list_for_group($attribute->_unit_group_id); |
1890 | 1890 | $unit_input_def['type'] = 'select'; |
1891 | 1891 | $unit_input_def['option'] = ' class="wpshop_attribute_unit_input chosen_select" '; |
1892 | - $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; |
|
1892 | + $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; |
|
1893 | 1893 | $unit_input_def['name'] = $attribute->code; |
1894 | 1894 | $unit_input_def['value'] = (!empty($attribute_value->unit_id) ? $attribute_value->unit_id : ''); |
1895 | - if($unit_input_def['value'] == ''){ |
|
1896 | - if ( $attribute->_default_unit > 0 ) { |
|
1895 | + if ($unit_input_def['value'] == '') { |
|
1896 | + if ($attribute->_default_unit > 0) { |
|
1897 | 1897 | $unit_input_def['value'] = $attribute->_default_unit; |
1898 | 1898 | } |
1899 | 1899 | else { |
@@ -1907,18 +1907,18 @@ discard block |
||
1907 | 1907 | /* |
1908 | 1908 | * Add indication on postage cost tax |
1909 | 1909 | */ |
1910 | - if ( $attribute->code == WPSHOP_COST_OF_POSTAGE ) { |
|
1910 | + if ($attribute->code == WPSHOP_COST_OF_POSTAGE) { |
|
1911 | 1911 | $input_def['options'] .= ' <span class="attribute_currency" >' . __('ATI', 'wpshop') . '</span>'; |
1912 | 1912 | } |
1913 | 1913 | |
1914 | 1914 | /* |
1915 | 1915 | * Create the field output |
1916 | 1916 | */ |
1917 | - if ( is_admin() && ($attribute->data_type == 'datetime') && ($attribute->is_user_defined == 'yes') && (empty($specific_argument['from']) || ($specific_argument['from'] != 'frontend')) ) { |
|
1918 | - $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')); |
|
1917 | + if (is_admin() && ($attribute->data_type == 'datetime') && ($attribute->is_user_defined == 'yes') && (empty($specific_argument['from']) || ($specific_argument['from'] != 'frontend'))) { |
|
1918 | + $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')); |
|
1919 | 1919 | $input_def['options'] = ''; |
1920 | 1920 | $input_def['label_pointer'] = ''; |
1921 | - $input_def['option'] = substr( $input_def['option'], 0 , -2 ) . ' wpshop_attributes_is_user_defined_admin_field "'; |
|
1921 | + $input_def['option'] = substr($input_def['option'], 0, -2) . ' wpshop_attributes_is_user_defined_admin_field "'; |
|
1922 | 1922 | $input_def['field_container_class'] .= 'wpshop_attributes_is_user_defined_admin_container'; |
1923 | 1923 | } |
1924 | 1924 | else { |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | * @param string $output_from |
1934 | 1934 | * @return string The output for |
1935 | 1935 | */ |
1936 | - public static function display_attribute( $attribute_code, $output_from = 'admin', $output_specs = array() ) { |
|
1936 | + public static function display_attribute($attribute_code, $output_from = 'admin', $output_specs = array()) { |
|
1937 | 1937 | $output = ''; |
1938 | 1938 | /* Get the page code */ |
1939 | 1939 | $currentPageCode = !empty($output_specs['page_code']) ? $output_specs['page_code'] : ''; |
@@ -1944,17 +1944,17 @@ discard block |
||
1944 | 1944 | |
1945 | 1945 | /* Get attribute input definition */ |
1946 | 1946 | $current_value = (!empty($output_specs['current_value']) ? $output_specs['current_value'] : ''); |
1947 | - $input = wpshop_attributes::get_attribute_field_definition( $attribute_def, $current_value, array_merge($output_specs, array('input_class' => ' wpshop_attributes_display', 'from' => $output_from)) ); |
|
1947 | + $input = wpshop_attributes::get_attribute_field_definition($attribute_def, $current_value, array_merge($output_specs, array('input_class' => ' wpshop_attributes_display', 'from' => $output_from))); |
|
1948 | 1948 | |
1949 | 1949 | /* Create default output */ |
1950 | 1950 | $input_to_display = $input['output'] . $input['options']; |
1951 | 1951 | |
1952 | 1952 | /* Check if current field is linked to an addon, and if the addon is activated */ |
1953 | 1953 | $addons_list = unserialize(WPSHOP_ADDONS_LIST); |
1954 | - foreach ( $addons_list as $addon_code => $addon_def ) { |
|
1955 | - if ( in_array($attribute_code, $addon_def) ) { |
|
1956 | - if ( constant($addon_code) === false ) { |
|
1957 | - $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>'; |
|
1954 | + foreach ($addons_list as $addon_code => $addon_def) { |
|
1955 | + if (in_array($attribute_code, $addon_def)) { |
|
1956 | + if (constant($addon_code) === false) { |
|
1957 | + $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>'; |
|
1958 | 1958 | } |
1959 | 1959 | } |
1960 | 1960 | } |
@@ -1979,11 +1979,11 @@ discard block |
||
1979 | 1979 | /* |
1980 | 1980 | * Display attribute option if applicable |
1981 | 1981 | */ |
1982 | - if ( $output_from == 'admin') { |
|
1983 | - $attribute_option_display = $attribute_def->backend_input=='select' && (strtolower( __(self::get_attribute_type_select_option_info($input['value'], 'value'), 'wpshop') ) == __('yes', 'wpshop')) ? '' : ' wpshopHide'; |
|
1982 | + if ($output_from == 'admin') { |
|
1983 | + $attribute_option_display = $attribute_def->backend_input == 'select' && (strtolower(__(self::get_attribute_type_select_option_info($input['value'], 'value'), 'wpshop')) == __('yes', 'wpshop')) ? '' : ' wpshopHide'; |
|
1984 | 1984 | |
1985 | 1985 | $output['field'] .= ' |
1986 | - <div class="attribute_option_'.$attribute_def->code.''.$attribute_option_display.'" >'.self::get_attribute_option_fields($element_identifier, $attribute_def->code).'</div>'; |
|
1986 | + <div class="attribute_option_'.$attribute_def->code . '' . $attribute_option_display . '" >' . self::get_attribute_option_fields($element_identifier, $attribute_def->code) . '</div>'; |
|
1987 | 1987 | } |
1988 | 1988 | |
1989 | 1989 | $output['field'] .= '</div>'; |
@@ -2001,36 +2001,36 @@ discard block |
||
2001 | 2001 | * |
2002 | 2002 | * @return string The html code to output directly tabs |
2003 | 2003 | */ |
2004 | - public static function attribute_of_entity_to_tab( $element_code, $element_id, $element_definition ) { |
|
2004 | + public static function attribute_of_entity_to_tab($element_code, $element_id, $element_definition) { |
|
2005 | 2005 | $attributeContentOutput = ''; |
2006 | 2006 | |
2007 | 2007 | /** Get the different attribute affected to the entity */ |
2008 | 2008 | $element_atribute_list = wpshop_attributes::getElementWithAttributeAndValue($element_code, $element_id, WPSHOP_CURRENT_LOCALE, '', 'frontend'); |
2009 | 2009 | |
2010 | 2010 | |
2011 | - if ( is_array($element_atribute_list) && (count($element_atribute_list) > 0) ) { |
|
2012 | - foreach ( $element_atribute_list[$element_id] as $attributeSetSectionName => $attributeSetContent ) { |
|
2011 | + if (is_array($element_atribute_list) && (count($element_atribute_list) > 0)) { |
|
2012 | + foreach ($element_atribute_list[$element_id] as $attributeSetSectionName => $attributeSetContent) { |
|
2013 | 2013 | $attributeToShowNumber = 0; |
2014 | 2014 | $attributeOutput = ''; |
2015 | 2015 | |
2016 | - foreach ( $attributeSetContent['attributes'] as $attributeId => $attributeDefinition ) { |
|
2016 | + foreach ($attributeSetContent['attributes'] as $attributeId => $attributeDefinition) { |
|
2017 | 2017 | |
2018 | 2018 | /** Check the value type to check if empty or not */ |
2019 | - if ( $attributeDefinition['data_type'] == 'int' ) { |
|
2019 | + if ($attributeDefinition['data_type'] == 'int') { |
|
2020 | 2020 | $attributeDefinition['value'] = (int)$attributeDefinition['value']; |
2021 | 2021 | } |
2022 | - else if ( $attributeDefinition['data_type'] == 'decimal' ) { |
|
2022 | + else if ($attributeDefinition['data_type'] == 'decimal') { |
|
2023 | 2023 | $attributeDefinition['value'] = (float)$attributeDefinition['value']; |
2024 | 2024 | } |
2025 | 2025 | |
2026 | 2026 | /** Check if the attribute is set to be displayed in frontend */ |
2027 | - $attribute_display_state = wpshop_attributes::check_attribute_display( $attributeDefinition['is_visible_in_front'], $element_definition['custom_display'], 'attribute', $attributeDefinition['code'], 'complete_sheet'); |
|
2027 | + $attribute_display_state = wpshop_attributes::check_attribute_display($attributeDefinition['is_visible_in_front'], $element_definition['custom_display'], 'attribute', $attributeDefinition['code'], 'complete_sheet'); |
|
2028 | 2028 | |
2029 | 2029 | /** Output the field if the value is not null */ |
2030 | 2030 | |
2031 | - if ( (is_array($attributeDefinition['value']) || ( !empty($attributeDefinition['value']) ) ) && $attribute_display_state) { |
|
2031 | + if ((is_array($attributeDefinition['value']) || (!empty($attributeDefinition['value']))) && $attribute_display_state) { |
|
2032 | 2032 | |
2033 | - $attribute_display = wpshop_attributes::wps_attribute_values_display( $attributeDefinition ); |
|
2033 | + $attribute_display = wpshop_attributes::wps_attribute_values_display($attributeDefinition); |
|
2034 | 2034 | $attribute_value = $attribute_display[0]; |
2035 | 2035 | $attributeDefinition['value'] = $attribute_display[1]; |
2036 | 2036 | $attribute_unit_list = $attribute_display[2]; |
@@ -2041,8 +2041,8 @@ discard block |
||
2041 | 2041 | $tpl_component['PDT_ENTITY_CODE'] = self::currentPageCode; |
2042 | 2042 | $tpl_component['ATTRIBUTE_CODE'] = $attributeDefinition['attribute_code']; |
2043 | 2043 | $tpl_component['ATTRIBUTE_LABEL'] = __($attributeDefinition['frontend_label'], 'wpshop'); |
2044 | - $tpl_component['ATTRIBUTE_VALUE'] = ( !is_array($attribute_value) ) ? stripslashes($attribute_value) : $attribute_value; |
|
2045 | - $tpl_component['ATTRIBUTE_VALUE_UNIT'] = $attribute_unit_list; |
|
2044 | + $tpl_component['ATTRIBUTE_VALUE'] = (!is_array($attribute_value)) ? stripslashes($attribute_value) : $attribute_value; |
|
2045 | + $tpl_component['ATTRIBUTE_VALUE_UNIT'] = $attribute_unit_list; |
|
2046 | 2046 | |
2047 | 2047 | /** Build template */ |
2048 | 2048 | $attributeOutput .= wpshop_display::display_template_element($template_part, $tpl_component); |
@@ -2053,9 +2053,9 @@ discard block |
||
2053 | 2053 | } |
2054 | 2054 | |
2055 | 2055 | /** Check if the attribute set section is set to be displayed in frontend */ |
2056 | - $attribute_set_display_state = wpshop_attributes::check_attribute_display( $attributeSetContent['display_on_frontend'], $element_definition['custom_display'], 'attribute_set_section', $attributeSetContent['code'], 'complete_sheet'); |
|
2056 | + $attribute_set_display_state = wpshop_attributes::check_attribute_display($attributeSetContent['display_on_frontend'], $element_definition['custom_display'], 'attribute_set_section', $attributeSetContent['code'], 'complete_sheet'); |
|
2057 | 2057 | |
2058 | - if ( !$attribute_set_display_state ) { |
|
2058 | + if (!$attribute_set_display_state) { |
|
2059 | 2059 | $attributeToShowNumber = 0; |
2060 | 2060 | $attributeOutput = ''; |
2061 | 2061 | } |
@@ -2065,8 +2065,8 @@ discard block |
||
2065 | 2065 | |
2066 | 2066 | /** Gestion de l'affichage */ |
2067 | 2067 | $tab_list = $content_list = ''; |
2068 | - foreach ( $element_atribute_list[$element_id] as $attributeSetSectionName => $attributeSetContent ) { |
|
2069 | - if ( !empty($attributeSetContent['count']) > 0 ) { |
|
2068 | + foreach ($element_atribute_list[$element_id] as $attributeSetSectionName => $attributeSetContent) { |
|
2069 | + if (!empty($attributeSetContent['count']) > 0) { |
|
2070 | 2070 | /** Template parameters */ |
2071 | 2071 | $template_part = 'product_attribute_tabs'; |
2072 | 2072 | $tpl_component = array(); |
@@ -2075,7 +2075,7 @@ discard block |
||
2075 | 2075 | |
2076 | 2076 | /** Build template */ |
2077 | 2077 | $tpl_way_to_take = wpshop_display::check_way_for_template($template_part); |
2078 | - if ( $tpl_way_to_take[0] && !empty($tpl_way_to_take[1]) ) { |
|
2078 | + if ($tpl_way_to_take[0] && !empty($tpl_way_to_take[1])) { |
|
2079 | 2079 | /* Include the old way template part */ |
2080 | 2080 | ob_start(); |
2081 | 2081 | require(wpshop_display::get_template_file($tpl_way_to_take[1])); |
@@ -2095,7 +2095,7 @@ discard block |
||
2095 | 2095 | |
2096 | 2096 | /** Build template */ |
2097 | 2097 | $tpl_way_to_take = wpshop_display::check_way_for_template($template_part); |
2098 | - if ( $tpl_way_to_take[0] && !empty($tpl_way_to_take[1]) ) { |
|
2098 | + if ($tpl_way_to_take[0] && !empty($tpl_way_to_take[1])) { |
|
2099 | 2099 | /* Include the old way template part */ |
2100 | 2100 | ob_start(); |
2101 | 2101 | require(wpshop_display::get_template_file($tpl_way_to_take[1])); |
@@ -2109,16 +2109,16 @@ discard block |
||
2109 | 2109 | } |
2110 | 2110 | } |
2111 | 2111 | |
2112 | - if ( $tab_list != '' ) { |
|
2112 | + if ($tab_list != '') { |
|
2113 | 2113 | /** Template parameters */ |
2114 | 2114 | $template_part = 'product_attribute_container'; |
2115 | 2115 | $tpl_component = array(); |
2116 | - $tpl_component['PDT_TABS'] = apply_filters( 'wpshop_extra_tabs_menu_before', '' ).$tab_list.apply_filters( 'wpshop_extra_tabs_menu_after', '' ); |
|
2117 | - $tpl_component['PDT_TAB_DETAIL'] = apply_filters( 'wpshop_extra_tabs_content_before', '' ).$content_list.apply_filters( 'wpshop_extra_tabs_content_after', '' ); |
|
2116 | + $tpl_component['PDT_TABS'] = apply_filters('wpshop_extra_tabs_menu_before', '') . $tab_list . apply_filters('wpshop_extra_tabs_menu_after', ''); |
|
2117 | + $tpl_component['PDT_TAB_DETAIL'] = apply_filters('wpshop_extra_tabs_content_before', '') . $content_list . apply_filters('wpshop_extra_tabs_content_after', ''); |
|
2118 | 2118 | |
2119 | 2119 | /** Build template */ |
2120 | 2120 | $tpl_way_to_take = wpshop_display::check_way_for_template($template_part); |
2121 | - if ( $tpl_way_to_take[0] && !empty($tpl_way_to_take[1]) ) { |
|
2121 | + if ($tpl_way_to_take[0] && !empty($tpl_way_to_take[1])) { |
|
2122 | 2122 | /* Include the old way template part */ |
2123 | 2123 | ob_start(); |
2124 | 2124 | require(wpshop_display::get_template_file($tpl_way_to_take[1])); |
@@ -2141,9 +2141,9 @@ discard block |
||
2141 | 2141 | * @param unknown_type $attributeDefinition |
2142 | 2142 | * @return multitype:Ambigous <unknown, string> Ambigous <string, string> Ambigous <> |
2143 | 2143 | */ |
2144 | - public static function wps_attribute_values_display( $attributeDefinition ) { |
|
2144 | + public static function wps_attribute_values_display($attributeDefinition) { |
|
2145 | 2145 | $attribute_unit_list = ''; |
2146 | - if ( !empty($attributeDefinition['unit']) ) { |
|
2146 | + if (!empty($attributeDefinition['unit'])) { |
|
2147 | 2147 | /** Template parameters */ |
2148 | 2148 | $template_part = 'product_attribute_unit'; |
2149 | 2149 | $tpl_component = array(); |
@@ -2155,31 +2155,31 @@ discard block |
||
2155 | 2155 | } |
2156 | 2156 | |
2157 | 2157 | $attribute_value = $attributeDefinition['value']; |
2158 | - if ( $attributeDefinition['data_type'] == 'decimal' ) { |
|
2159 | - $attribute_value =(is_numeric($attribute_value) ) ? number_format($attribute_value, 2, ',', '') : $attribute_value; |
|
2160 | - if ( in_array($attributeDefinition['code'], unserialize(WPSHOP_ATTRIBUTE_PRICES)) ) { |
|
2161 | - if ( $attributeDefinition['is_requiring_unit'] == 'yes' ) { |
|
2158 | + if ($attributeDefinition['data_type'] == 'decimal') { |
|
2159 | + $attribute_value = (is_numeric($attribute_value)) ? number_format($attribute_value, 2, ',', '') : $attribute_value; |
|
2160 | + if (in_array($attributeDefinition['code'], unserialize(WPSHOP_ATTRIBUTE_PRICES))) { |
|
2161 | + if ($attributeDefinition['is_requiring_unit'] == 'yes') { |
|
2162 | 2162 | $attribute_unit_list = ' ' . wpshop_tools::wpshop_get_currency(); |
2163 | 2163 | } |
2164 | 2164 | $attributeDefinition['value'] = wpshop_display::format_field_output('wpshop_product_price', $attributeDefinition['value']); |
2165 | 2165 | } |
2166 | 2166 | } |
2167 | - if ( $attributeDefinition['data_type'] == 'datetime' ) { |
|
2167 | + if ($attributeDefinition['data_type'] == 'datetime') { |
|
2168 | 2168 | $attribute_value = mysql2date('d/m/Y', $attributeDefinition['value'], true); |
2169 | 2169 | } |
2170 | - if ( $attributeDefinition['backend_input'] == 'select' ) { |
|
2170 | + if ($attributeDefinition['backend_input'] == 'select') { |
|
2171 | 2171 | $attribute_value = wpshop_attributes::get_attribute_type_select_option_info($attributeDefinition['value'], 'label', $attributeDefinition['data_type_to_use']); |
2172 | 2172 | } |
2173 | 2173 | /** Manage differently if its an array of values or not */ |
2174 | - if ( $attributeDefinition['backend_input'] == 'multiple-select') { |
|
2174 | + if ($attributeDefinition['backend_input'] == 'multiple-select') { |
|
2175 | 2175 | $attribute_value = ''; |
2176 | - if ( is_array($attributeDefinition['value']) ) { |
|
2176 | + if (is_array($attributeDefinition['value'])) { |
|
2177 | 2177 | foreach ($attributeDefinition['value'] as $v) { |
2178 | - $attribute_value .= ' / '.wpshop_attributes::get_attribute_type_select_option_info($v, 'label', $attributeDefinition['data_type_to_use']); |
|
2178 | + $attribute_value .= ' / ' . wpshop_attributes::get_attribute_type_select_option_info($v, 'label', $attributeDefinition['data_type_to_use']); |
|
2179 | 2179 | } |
2180 | 2180 | } |
2181 | - else $attribute_value = ' / '.wpshop_attributes::get_attribute_type_select_option_info($attributeDefinition['value'], 'label', $attributeDefinition['data_type_to_use']); |
|
2182 | - $attribute_value = substr($attribute_value,3); |
|
2181 | + else $attribute_value = ' / ' . wpshop_attributes::get_attribute_type_select_option_info($attributeDefinition['value'], 'label', $attributeDefinition['data_type_to_use']); |
|
2182 | + $attribute_value = substr($attribute_value, 3); |
|
2183 | 2183 | } |
2184 | 2184 | |
2185 | 2185 | return array($attribute_value, $attributeDefinition['value'], $attribute_unit_list); |
@@ -2189,13 +2189,13 @@ discard block |
||
2189 | 2189 | * Manage display for the output when user uses a shortcode for attributes display |
2190 | 2190 | * @param array $shorcode_args The list of argument passed through the shortcode |
2191 | 2191 | */ |
2192 | - function wpshop_attributes_shortcode( $shorcode_args ) { |
|
2192 | + function wpshop_attributes_shortcode($shorcode_args) { |
|
2193 | 2193 | $output = ''; |
2194 | 2194 | /* |
2195 | 2195 | * Read the attribute list |
2196 | 2196 | */ |
2197 | - foreach ( explode(', ', $shorcode_args['attributes']) as $attribute_code ) { |
|
2198 | - $attribute_output_def = wpshop_attributes::display_attribute( $attribute_code, $shorcode_args['from'] ); |
|
2197 | + foreach (explode(', ', $shorcode_args['attributes']) as $attribute_code) { |
|
2198 | + $attribute_output_def = wpshop_attributes::display_attribute($attribute_code, $shorcode_args['from']); |
|
2199 | 2199 | $output .= $attribute_output_def['field']; |
2200 | 2200 | } |
2201 | 2201 | |
@@ -2217,7 +2217,7 @@ discard block |
||
2217 | 2217 | $productAttributeSetDetails = wpshop_attributes_set::getAttributeSetDetails($attributeSetId, "'valid','deleted'"); |
2218 | 2218 | $attribute_specification = array('page_code' => $currentPageCode, 'element_identifier' => $itemToEdit, 'field_id' => $currentPageCode . '_' . $itemToEdit . '_'); |
2219 | 2219 | |
2220 | - if ( count($productAttributeSetDetails) > 0 ) { |
|
2220 | + if (count($productAttributeSetDetails) > 0) { |
|
2221 | 2221 | /* Read the attribute list in order to output */ |
2222 | 2222 | $shortcodes_attr = ''; |
2223 | 2223 | $shortcodes_to_display = false; |
@@ -2227,80 +2227,80 @@ discard block |
||
2227 | 2227 | |
2228 | 2228 | $shortcodes = $currentTabContent = ''; |
2229 | 2229 | $output_nb = 0; |
2230 | - if(count($productAttributeSetDetail['attribut']) >= 1){ |
|
2231 | - foreach($productAttributeSetDetail['attribut'] as $attribute){ |
|
2230 | + if (count($productAttributeSetDetail['attribut']) >= 1) { |
|
2231 | + foreach ($productAttributeSetDetail['attribut'] as $attribute) { |
|
2232 | 2232 | |
2233 | - if ( !empty($attribute->id) ) { |
|
2234 | - if ( $attribute->code == 'product_attribute_set_id' ) { |
|
2233 | + if (!empty($attribute->id)) { |
|
2234 | + if ($attribute->code == 'product_attribute_set_id') { |
|
2235 | 2235 | $attribute_set_id_is_present = true; |
2236 | 2236 | } |
2237 | 2237 | |
2238 | 2238 | /** Generic part for attribute field output */ |
2239 | 2239 | $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)); |
2240 | - $product_meta = get_post_meta( $itemToEdit, '_wpshop_product_metadata', true); |
|
2240 | + $product_meta = get_post_meta($itemToEdit, '_wpshop_product_metadata', true); |
|
2241 | 2241 | |
2242 | 2242 | /** Check if value is empty and get value in meta if not empty */ |
2243 | 2243 | $value = (empty($value) && !empty($product_meta[$attribute->code])) ? $product_meta[$attribute->code] : (!empty($value) ? $value : null); |
2244 | 2244 | |
2245 | 2245 | /* Manage specific field as the attribute_set_id in product form */ |
2246 | - if ( $attribute->code == 'product_attribute_set_id' ) { |
|
2246 | + if ($attribute->code == 'product_attribute_set_id') { |
|
2247 | 2247 | |
2248 | 2248 | $value = empty($value) ? $attributeSetId : $value; |
2249 | 2249 | } |
2250 | 2250 | $attribute_specification['current_value'] = $value; |
2251 | - $attribute_output_def = wpshop_attributes::display_attribute( $attribute->code, 'admin', $attribute_specification); |
|
2252 | - if ( ($attribute_output_def['field_definition']['type'] != 'hidden') && ($attribute->code != 'product_attribute_set_id') ) { |
|
2251 | + $attribute_output_def = wpshop_attributes::display_attribute($attribute->code, 'admin', $attribute_specification); |
|
2252 | + if (($attribute_output_def['field_definition']['type'] != 'hidden') && ($attribute->code != 'product_attribute_set_id')) { |
|
2253 | 2253 | $currentTabContent .= $attribute_output_def['field']; |
2254 | - $shortcode_code_def=array(); |
|
2255 | - $shortcode_code_def['attribute_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['main_code'] = 'wpshop_att_val'; |
|
2256 | - $shortcode_code_def['attribute_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['type'] = $attribute->data_type; |
|
2257 | - $shortcode_code_def['attribute_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['attid'] = $attribute->id; |
|
2258 | - $shortcode_code_def['attribute_'.str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['pid'] = $itemToEdit; |
|
2254 | + $shortcode_code_def = array(); |
|
2255 | + $shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['main_code'] = 'wpshop_att_val'; |
|
2256 | + $shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['type'] = $attribute->data_type; |
|
2257 | + $shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['attid'] = $attribute->id; |
|
2258 | + $shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['pid'] = $itemToEdit; |
|
2259 | 2259 | ob_start(); |
2260 | - 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'); |
|
2261 | - $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>'; |
|
2260 | + 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'); |
|
2261 | + $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>'; |
|
2262 | 2262 | ob_end_clean(); |
2263 | 2263 | } |
2264 | 2264 | else { |
2265 | - if ( $attribute->code == 'product_attribute_set_id' ) { |
|
2265 | + if ($attribute->code == 'product_attribute_set_id') { |
|
2266 | 2266 | $attribute_output_def['field_definition']['type'] = 'hidden'; |
2267 | 2267 | } |
2268 | - $currentTabContent .= wpshop_form::check_input_type($attribute_output_def['field_definition'], $attribute_output_def['field_definition']['input_domain']); |
|
2268 | + $currentTabContent .= wpshop_form::check_input_type($attribute_output_def['field_definition'], $attribute_output_def['field_definition']['input_domain']); |
|
2269 | 2269 | } |
2270 | 2270 | $output_nb++; |
2271 | 2271 | } |
2272 | 2272 | } |
2273 | 2273 | |
2274 | - $currentTabContent = apply_filters( 'wps_entity_attribute_edition', $currentTabContent, $itemToEdit, $productAttributeSetDetail ); |
|
2274 | + $currentTabContent = apply_filters('wps_entity_attribute_edition', $currentTabContent, $itemToEdit, $productAttributeSetDetail); |
|
2275 | 2275 | |
2276 | 2276 | $shortcode_code['attributes_set']['main_code'] = 'wpshop_att_group'; |
2277 | 2277 | $shortcode_code['attributes_set']['attrs_exemple']['pid'] = $itemToEdit; |
2278 | 2278 | $shortcode_code['attributes_set']['attrs_exemple']['sid'] = $productAttributeSetDetail['id']; |
2279 | 2279 | ob_start(); |
2280 | - 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'); |
|
2281 | - $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>'; |
|
2280 | + 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'); |
|
2281 | + $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>'; |
|
2282 | 2282 | ob_end_clean(); |
2283 | 2283 | |
2284 | - if( WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE == 'each-box' ) |
|
2285 | - $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>'; |
|
2284 | + if (WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE == 'each-box') |
|
2285 | + $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>'; |
|
2286 | 2286 | else |
2287 | 2287 | $shortcodes_attr .= $attribute_group_display; |
2288 | 2288 | |
2289 | - if ( $output_nb <= 0 ) { |
|
2289 | + if ($output_nb <= 0) { |
|
2290 | 2290 | $currentTabContent = __('Nothing avaiblable here. You can go in attribute management interface in order to add content here.', 'wpshop'); |
2291 | 2291 | } |
2292 | 2292 | } |
2293 | 2293 | |
2294 | 2294 | if ($output_nb > 0) { |
2295 | 2295 | $shortcodes_to_display = true; |
2296 | - if ( $outputType == 'box' ) { |
|
2296 | + if ($outputType == 'box') { |
|
2297 | 2297 | $box['box'][$productAttributeSetDetail['code']] = $productAttributeSetDetail['name']; |
2298 | - $box['box'][$productAttributeSetDetail['code'].'_backend_display_type'] = $productAttributeSetDetail['backend_display_type']; |
|
2298 | + $box['box'][$productAttributeSetDetail['code'] . '_backend_display_type'] = $productAttributeSetDetail['backend_display_type']; |
|
2299 | 2299 | $box['boxContent'][$productAttributeSetDetail['code']] = ' |
2300 | 2300 | <div id="wpshop_' . $currentPageCode . '_' . wpshop_tools::slugify($productAttributeSetDetail['code'], array('noAccent')) . '_form" >' . $currentTabContent . ' |
2301 | 2301 | </div><div class="wpshop_cls" ></div>'; |
2302 | 2302 | } |
2303 | - else if ( $outputType == 'column' ) { |
|
2303 | + else if ($outputType == 'column') { |
|
2304 | 2304 | $currentTabContent = str_replace('wpshop_form_input_element', 'wpshop_form_input_column', $currentTabContent); |
2305 | 2305 | $currentTabContent = str_replace('wpshop_form_label', 'wpshop_form_label_column', $currentTabContent); |
2306 | 2306 | |
@@ -2310,11 +2310,11 @@ discard block |
||
2310 | 2310 | } |
2311 | 2311 | } |
2312 | 2312 | |
2313 | - if( !$attribute_set_id_is_present ) { |
|
2313 | + if (!$attribute_set_id_is_present) { |
|
2314 | 2314 | /* Get attribute definition */ |
2315 | 2315 | $attribute_def = wpshop_attributes::getElement('product_attribute_set_id', "'valid'", 'code'); |
2316 | 2316 | /* Get attribute input definition */ |
2317 | - $input = wpshop_attributes::get_attribute_field_definition( $attribute_def, $attributeSetId, array_merge($attribute_specification, array('input_class' => ' wpshop_attributes_display', 'from' => 'admin')) ); |
|
2317 | + $input = wpshop_attributes::get_attribute_field_definition($attribute_def, $attributeSetId, array_merge($attribute_specification, array('input_class' => ' wpshop_attributes_display', 'from' => 'admin'))); |
|
2318 | 2318 | $input['type'] = 'hidden'; |
2319 | 2319 | |
2320 | 2320 | $box['boxMore'] = wpshop_form::check_input_type($input, $input['input_domain']); |
@@ -2325,13 +2325,13 @@ discard block |
||
2325 | 2325 | $dialog_identifier = 'wpshop_new_attribute_option_value_add'; |
2326 | 2326 | $dialog_input_identifier = 'wpshop_new_attribute_option_value'; |
2327 | 2327 | ob_start(); |
2328 | - include(WPSHOP_TEMPLATES_DIR.'admin/add_new_element_dialog.tpl.php'); |
|
2328 | + include(WPSHOP_TEMPLATES_DIR . 'admin/add_new_element_dialog.tpl.php'); |
|
2329 | 2329 | $box['boxMore'] .= ob_get_contents(); |
2330 | 2330 | ob_end_clean(); |
2331 | 2331 | $box['boxMore'] .= '<input type="hidden" name="wpshop_attribute_type_select_code" value="" id="wpshop_attribute_type_select_code" />'; |
2332 | 2332 | |
2333 | - if ( $shortcodes_to_display ) { |
|
2334 | - switch ( WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE ) { |
|
2333 | + if ($shortcodes_to_display) { |
|
2334 | + switch (WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE) { |
|
2335 | 2335 | case 'fixed-tab': |
2336 | 2336 | case 'movable-tab': |
2337 | 2337 | if ($outputType == 'box') { |
@@ -2339,7 +2339,7 @@ discard block |
||
2339 | 2339 | $box['boxContent']['shortcode'] = $shortcodes_attr; |
2340 | 2340 | $box['box']['shortcode_backend_display_type'] = WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE; |
2341 | 2341 | } |
2342 | - else{ |
|
2342 | + else { |
|
2343 | 2343 | $box['columnTitle']['shortcode'] = __('Product Shortcodes', 'wpshop'); |
2344 | 2344 | $box['columnContent']['shortcode'] = $shortcodes_attr; |
2345 | 2345 | } |
@@ -2363,12 +2363,12 @@ discard block |
||
2363 | 2363 | $ouput['more_input'] = ''; |
2364 | 2364 | |
2365 | 2365 | $attribute_default_value = $attribute->default_value; |
2366 | - if ( !empty($attribute->default_value) && ($attribute->default_value == serialize(false) || @unserialize($attribute->default_value) !== false) ) { |
|
2366 | + if (!empty($attribute->default_value) && ($attribute->default_value == serialize(false) || @unserialize($attribute->default_value) !== false)) { |
|
2367 | 2367 | $tmp_default_value = unserialize($attribute->default_value); |
2368 | 2368 | $attribute_default_value = !empty($tmp_default_value["default_value"]) ? $tmp_default_value["default_value"] : null; |
2369 | 2369 | } |
2370 | 2370 | |
2371 | - if ( $attribute->data_type_to_use == 'custom') { |
|
2371 | + if ($attribute->data_type_to_use == 'custom') { |
|
2372 | 2372 | $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); |
2373 | 2373 | $attribute_select_options = $wpdb->get_results($query); |
2374 | 2374 | |
@@ -2380,11 +2380,11 @@ discard block |
||
2380 | 2380 | // } |
2381 | 2381 | endforeach; |
2382 | 2382 | } |
2383 | - elseif ( $attribute->data_type_to_use == 'internal') { |
|
2383 | + elseif ($attribute->data_type_to_use == 'internal') { |
|
2384 | 2384 | switch ($attribute_default_value) { |
2385 | 2385 | case 'users': |
2386 | 2386 | $users = get_users('orderby=nicename'); |
2387 | - foreach($users as $user){ |
|
2387 | + foreach ($users as $user) { |
|
2388 | 2388 | $attribute_select_options_list[$user->ID] = $user->display_name; |
2389 | 2389 | } |
2390 | 2390 | break; |
@@ -2393,11 +2393,11 @@ discard block |
||
2393 | 2393 | $wpshop_attr_custom_post_query = new WP_Query(array( |
2394 | 2394 | 'post_type' => $attribute_default_value, |
2395 | 2395 | 'posts_per_page' => -1, |
2396 | - 'post_status' => array( 'publish', 'draft', 'future' ) , |
|
2396 | + 'post_status' => array('publish', 'draft', 'future'), |
|
2397 | 2397 | )); |
2398 | 2398 | |
2399 | - if($wpshop_attr_custom_post_query->have_posts()): |
|
2400 | - foreach($wpshop_attr_custom_post_query->posts as $post){ |
|
2399 | + if ($wpshop_attr_custom_post_query->have_posts()): |
|
2400 | + foreach ($wpshop_attr_custom_post_query->posts as $post) { |
|
2401 | 2401 | $attribute_select_options_list[$post->ID] = $post->post_title; |
2402 | 2402 | } |
2403 | 2403 | endif; |
@@ -2408,27 +2408,27 @@ discard block |
||
2408 | 2408 | |
2409 | 2409 | /* There is no value existing for this value */ |
2410 | 2410 | if (empty($attribute_select_options_list)) : |
2411 | - $ouput['more_input'].=__('Nothing found for this field', 'wpshop'); |
|
2411 | + $ouput['more_input'] .= __('Nothing found for this field', 'wpshop'); |
|
2412 | 2412 | else: |
2413 | 2413 | /* Add a default value to the combobox list */ |
2414 | 2414 | $default_value_is_serial = false; |
2415 | 2415 | $attribute_list_first_element = $attribute->default_value; |
2416 | - if ( !empty($attribute->default_value) && ($attribute->default_value == serialize(false) || @unserialize($attribute->default_value) !== false) ) { |
|
2416 | + if (!empty($attribute->default_value) && ($attribute->default_value == serialize(false) || @unserialize($attribute->default_value) !== false)) { |
|
2417 | 2417 | $default_value_is_serial = true; |
2418 | 2418 | $tmp_default_value = unserialize($attribute->default_value); |
2419 | 2419 | $attribute_list_first_element = $tmp_default_value["field_options"]["label_for_first_item"]; |
2420 | 2420 | } |
2421 | 2421 | //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'); |
2422 | - foreach ( $attribute_select_options_list as $option_key => $option_value ) { |
|
2422 | + foreach ($attribute_select_options_list as $option_key => $option_value) { |
|
2423 | 2423 | $ouput['possible_value'][$option_key] = stripslashes($option_value); |
2424 | 2424 | } |
2425 | 2425 | endif; |
2426 | 2426 | |
2427 | 2427 | /* Add a extra element to create a new element into list */ |
2428 | - if ( is_admin() && ( empty($provenance['from']) || ($provenance['from'] != 'frontend')) ) { |
|
2428 | + if (is_admin() && (empty($provenance['from']) || ($provenance['from'] != 'frontend'))) { |
|
2429 | 2429 | /** $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.'" />'; */ |
2430 | 2430 | } |
2431 | - else if ( 'yes' == $attribute->is_used_in_quick_add_form ) { |
|
2431 | + else if ('yes' == $attribute->is_used_in_quick_add_form) { |
|
2432 | 2432 | $tpl_component = array(); |
2433 | 2433 | $tpl_component['NEW_ELEMENT_CREATION_FIELD'] = 'attribute[new_value_creation][' . $attribute->code . ']'; |
2434 | 2434 | $ouput['more_input'] .= wpshop_display::display_template_element('quick_entity_specific_field_new_element', $tpl_component); |
@@ -2437,11 +2437,11 @@ discard block |
||
2437 | 2437 | return $ouput; |
2438 | 2438 | } |
2439 | 2439 | |
2440 | - public static function get_affected_value_for_list( $attribute_code, $element_id, $attribute_data_type ) { |
|
2440 | + public static function get_affected_value_for_list($attribute_code, $element_id, $attribute_data_type) { |
|
2441 | 2441 | global $wpdb; |
2442 | 2442 | $affected_value = array(); |
2443 | 2443 | |
2444 | - if ( $attribute_data_type == 'custom' ) { |
|
2444 | + if ($attribute_data_type == 'custom') { |
|
2445 | 2445 | $query = $wpdb->prepare(" |
2446 | 2446 | SELECT ATT_SELECT_OPTIONS_VALUE.id AS chosen_val, ATT_SELECT_OPTIONS_VALUE.value |
2447 | 2447 | FROM " . WPSHOP_DBT_ATTRIBUTE . " AS ATT |
@@ -2463,7 +2463,7 @@ discard block |
||
2463 | 2463 | } |
2464 | 2464 | |
2465 | 2465 | $attribute_values_for_variations = $wpdb->get_results($query); |
2466 | - foreach ( $attribute_values_for_variations as $attribute_def ) { |
|
2466 | + foreach ($attribute_values_for_variations as $attribute_def) { |
|
2467 | 2467 | $affected_value[] = $attribute_def->chosen_val; |
2468 | 2468 | } |
2469 | 2469 | |
@@ -2471,12 +2471,12 @@ discard block |
||
2471 | 2471 | } |
2472 | 2472 | |
2473 | 2473 | public static function get_attribute_option_output($item, $attr_code, $attr_option, $additionnal_params = '') { |
2474 | - switch($attr_code){ |
|
2474 | + switch ($attr_code) { |
|
2475 | 2475 | case 'is_downloadable_': |
2476 | - $option = get_post_meta($item['item_id'], 'attribute_option_'.$attr_code, true); |
|
2477 | - switch($attr_option){ |
|
2476 | + $option = get_post_meta($item['item_id'], 'attribute_option_' . $attr_code, true); |
|
2477 | + switch ($attr_option) { |
|
2478 | 2478 | case 'file_url': |
2479 | - if(in_array($additionnal_params['order_status'], array('completed', 'shipped')) && (!empty($item['item_'.$attr_code]) && (strtolower(__($item['item_'.$attr_code], 'wpshop')) == __('yes','wpshop'))) ){ |
|
2479 | + if (in_array($additionnal_params['order_status'], array('completed', 'shipped')) && (!empty($item['item_' . $attr_code]) && (strtolower(__($item['item_' . $attr_code], 'wpshop')) == __('yes', 'wpshop')))) { |
|
2480 | 2480 | $file_url = isset($option[$attr_option]) ? $option[$attr_option] : false; |
2481 | 2481 | return $file_url; |
2482 | 2482 | } |
@@ -2489,16 +2489,16 @@ discard block |
||
2489 | 2489 | |
2490 | 2490 | public static function get_attribute_option_fields($postid, $code) { |
2491 | 2491 | |
2492 | - switch($code){ |
|
2492 | + switch ($code) { |
|
2493 | 2493 | case 'is_downloadable_': |
2494 | - $data = get_post_meta($postid, 'attribute_option_'.$code, true); |
|
2495 | - $data['file_url'] = !empty($data['file_url'])?$data['file_url']:__('No file selected', 'wpshop'); |
|
2494 | + $data = get_post_meta($postid, 'attribute_option_' . $code, true); |
|
2495 | + $data['file_url'] = !empty($data['file_url']) ? $data['file_url'] : __('No file selected', 'wpshop'); |
|
2496 | 2496 | $fields = '<div class="wpshop_form_label alignleft"> </div> |
2497 | 2497 | <div class="wpshop_form_input_element alignleft"> |
2498 | - <div id="send_downloadable_file_dialog" class="wpshop_add_box" title="' .__('Send the downloadable file', 'wpshop'). '"></div> |
|
2499 | - <a id="send_downlodable_file" class="wps-bton-first-mini-rounded">' .__('Send a file', 'wpshop'). '</a> |
|
2500 | - <input type="hidden" id="product_identifer_field" value="' .( !empty($_GET['post']) ? esc_attr( $_GET['post'] ) : '') . '" /><br/><u>'.__('File url','wpshop').' :</u> |
|
2501 | - <div class="statut"><a href="' .$data['file_url']. '" target="_blank" download>'.basename($data['file_url']).'</a></div> |
|
2498 | + <div id="send_downloadable_file_dialog" class="wpshop_add_box" title="' .__('Send the downloadable file', 'wpshop') . '"></div> |
|
2499 | + <a id="send_downlodable_file" class="wps-bton-first-mini-rounded">' .__('Send a file', 'wpshop') . '</a> |
|
2500 | + <input type="hidden" id="product_identifer_field" value="' .(!empty($_GET['post']) ? esc_attr($_GET['post']) : '') . '" /><br/><u>' . __('File url', 'wpshop') . ' :</u> |
|
2501 | + <div class="statut"><a href="' .$data['file_url'] . '" target="_blank" download>' . basename($data['file_url']) . '</a></div> |
|
2502 | 2502 | </div>'; |
2503 | 2503 | return $fields; |
2504 | 2504 | break; |
@@ -2523,8 +2523,8 @@ discard block |
||
2523 | 2523 | $attribute_value_content = ''; |
2524 | 2524 | |
2525 | 2525 | $atributes = self::getElement($attribute_code, "'valid'", 'code'); |
2526 | - if ( !empty($atributes) ) { |
|
2527 | - $attribute_value_content = self::getAttributeValueForEntityInSet($atributes->data_type, $atributes->id, wpshop_entities::get_entity_identifier_from_code($entity_type), $entity_id); |
|
2526 | + if (!empty($atributes)) { |
|
2527 | + $attribute_value_content = self::getAttributeValueForEntityInSet($atributes->data_type, $atributes->id, wpshop_entities::get_entity_identifier_from_code($entity_type), $entity_id); |
|
2528 | 2528 | } |
2529 | 2529 | |
2530 | 2530 | return $attribute_value_content; |
@@ -2536,14 +2536,14 @@ discard block |
||
2536 | 2536 | * @param mixed $value |
2537 | 2537 | * @return string The complete interface allowing to manage datetime attribute field |
2538 | 2538 | */ |
2539 | - function attribute_type_date_config( $value ) { |
|
2539 | + function attribute_type_date_config($value) { |
|
2540 | 2540 | $date_config_output = ''; |
2541 | 2541 | |
2542 | 2542 | $input_def['name'] = 'default_value'; |
2543 | 2543 | $input_def['type'] = 'checkbox'; |
2544 | 2544 | $input_def['possible_value'] = 'date_of_current_day'; |
2545 | 2545 | $input_def['value'] = !empty($value['default_value']) ? $value['default_value'] : ''; |
2546 | - $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>'; |
|
2546 | + $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>'; |
|
2547 | 2547 | $date_config_output .= wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE); |
2548 | 2548 | |
2549 | 2549 | $input_def = array(); |
@@ -2552,35 +2552,35 @@ discard block |
||
2552 | 2552 | $input_def['type'] = 'checkbox'; |
2553 | 2553 | $input_def['valueToPut'] = 'index'; |
2554 | 2554 | $input_def['value'] = !empty($value['field_options']['attribute_type_date_options_day_to_show']) ? $value['field_options']['attribute_type_date_options_day_to_show'] : ''; |
2555 | - $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')); |
|
2555 | + $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')); |
|
2556 | 2556 | $input_def['options_label']['original'] = true; |
2557 | - $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>'; |
|
2557 | + $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>'; |
|
2558 | 2558 | |
2559 | 2559 | /** Past and futur date restriction */ |
2560 | 2560 | $input_def = array(); |
2561 | 2561 | $input_def['name'] = ''; |
2562 | 2562 | $input_def['type'] = 'text'; |
2563 | - $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/>'; |
|
2563 | + $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/>'; |
|
2564 | 2564 | $available_type_input_def = array(); |
2565 | 2565 | $available_type_input_def['name'] = ''; |
2566 | 2566 | $available_type_input_def['id'] = 'wpshop_attributes_edition_table_field_attribute_type_date_options_available_date_past_futur_minimum'; |
2567 | 2567 | $available_type_input_def['type'] = 'text'; |
2568 | 2568 | $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] : ''; |
2569 | - $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/>'; |
|
2569 | + $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/>'; |
|
2570 | 2570 | $available_type_input_def = array(); |
2571 | 2571 | $available_type_input_def['name'] = ''; |
2572 | 2572 | $available_type_input_def['id'] = 'wpshop_attributes_edition_table_field_attribute_type_date_options_available_date_past_futur_maximum'; |
2573 | 2573 | $available_type_input_def['type'] = 'text'; |
2574 | 2574 | $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] : ''; |
2575 | - $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/>'; |
|
2575 | + $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/>'; |
|
2576 | 2576 | $date_config_output .= '</div>'; |
2577 | 2577 | |
2578 | 2578 | $input_def = array(); |
2579 | 2579 | $input_def['name'] = ''; |
2580 | 2580 | $input_def['type'] = 'text'; |
2581 | 2581 | $date_config_output .= ' |
2582 | -<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> |
|
2583 | -<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/>'; |
|
2582 | +<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> |
|
2583 | +<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/>'; |
|
2584 | 2584 | |
2585 | 2585 | $available_type_input_def = array(); |
2586 | 2586 | $available_type_input_def['name'] = ''; |
@@ -2593,9 +2593,9 @@ discard block |
||
2593 | 2593 | $date_config_output .= wpshop_form::check_input_type($available_type_input_def, WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_available_date_type]') . '<br/>'; |
2594 | 2594 | |
2595 | 2595 | $existing = 0; |
2596 | - if ( !empty($value['field_options']['attribute_type_date_options_available_date']) ) { |
|
2597 | - foreach ( $value['field_options']['attribute_type_date_options_available_date'] as $index => $value ) { |
|
2598 | - if ( !empty($value) ) { |
|
2596 | + if (!empty($value['field_options']['attribute_type_date_options_available_date'])) { |
|
2597 | + foreach ($value['field_options']['attribute_type_date_options_available_date'] as $index => $value) { |
|
2598 | + if (!empty($value)) { |
|
2599 | 2599 | $input_def['value'] = $value; |
2600 | 2600 | $input_def['id'] = 'wpshop_attributes_edition_table_field_attribute_type_date_options_available_date_' . $index; |
2601 | 2601 | $date_config_output .= wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE . '_options[attribute_type_date_options_available_date]') . '<br/>'; |
@@ -2619,20 +2619,20 @@ discard block |
||
2619 | 2619 | * @param array $values Valeurs d'attributs |
2620 | 2620 | * @return array |
2621 | 2621 | */ |
2622 | - public static function setAttributesValuesForItem($entityId, $values=array(), $defaultValueForOthers=false, $from = 'webservice') { |
|
2623 | - $message=''; |
|
2622 | + public static function setAttributesValuesForItem($entityId, $values = array(), $defaultValueForOthers = false, $from = 'webservice') { |
|
2623 | + $message = ''; |
|
2624 | 2624 | $attribute_available = array(); |
2625 | 2625 | $attribute_final = array(); |
2626 | 2626 | $entity_type = get_post_type($entityId); |
2627 | - $data = self::get_attribute_list_for_item( wpshop_entities::get_entity_identifier_from_code($entity_type), $entityId, WPSHOP_CURRENT_LOCALE); |
|
2628 | - foreach($data as $d) $attribute_available[$d->attribute_code] = array('attribute_id' => $d->attribute_id, 'data_type' => $d->data_type); |
|
2627 | + $data = self::get_attribute_list_for_item(wpshop_entities::get_entity_identifier_from_code($entity_type), $entityId, WPSHOP_CURRENT_LOCALE); |
|
2628 | + foreach ($data as $d) $attribute_available[$d->attribute_code] = array('attribute_id' => $d->attribute_id, 'data_type' => $d->data_type); |
|
2629 | 2629 | |
2630 | 2630 | // Creation d'un array "propre" et valide pour la fonction self::saveAttributeForEntity |
2631 | - foreach ( $values as $key => $value ) { |
|
2632 | - if ( in_array( $key, array_keys( $attribute_available ) ) ) { |
|
2631 | + foreach ($values as $key => $value) { |
|
2632 | + if (in_array($key, array_keys($attribute_available))) { |
|
2633 | 2633 | $attribute_final[$attribute_available[$key]['data_type']][$key] = $value; |
2634 | 2634 | } |
2635 | - else $message .= sprintf(__('Impossible to set "%s" attribute', 'wpshop'), $key)."\n"; |
|
2635 | + else $message .= sprintf(__('Impossible to set "%s" attribute', 'wpshop'), $key) . "\n"; |
|
2636 | 2636 | } |
2637 | 2637 | |
2638 | 2638 | // Pour les autres attributs non donné on leur affecte leur valeur par défaut |
@@ -2653,7 +2653,7 @@ discard block |
||
2653 | 2653 | } |
2654 | 2654 | } |
2655 | 2655 | |
2656 | - switch ( $entity_type ) { |
|
2656 | + switch ($entity_type) { |
|
2657 | 2657 | case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT: |
2658 | 2658 | $meta_key = WPSHOP_PRODUCT_ATTRIBUTE_META_KEY; |
2659 | 2659 | break; |
@@ -2684,18 +2684,18 @@ discard block |
||
2684 | 2684 | public static function get_attribute_type_select_option_info($option_id, $field = 'label', $attribute_data_type = 'custom', $only_value = false) { |
2685 | 2685 | global $wpdb; |
2686 | 2686 | |
2687 | - switch ( $attribute_data_type ) { |
|
2687 | + switch ($attribute_data_type) { |
|
2688 | 2688 | case 'internal': |
2689 | 2689 | $entity_infos = get_post($option_id); |
2690 | - if ( !empty($entity_infos) ) { |
|
2691 | - if ( !$only_value ) { |
|
2690 | + if (!empty($entity_infos)) { |
|
2691 | + if (!$only_value) { |
|
2692 | 2692 | /** Template parameters */ |
2693 | 2693 | $template_part = 'product_attribute_value_internal'; |
2694 | 2694 | $tpl_component = array(); |
2695 | 2695 | $tpl_component['ATTRIBUTE_VALUE_POST_LINK'] = get_permalink($option_id); |
2696 | 2696 | $tpl_component['ATTRIBUTE_VALUE_POST_TITLE'] = $entity_infos->post_title; |
2697 | 2697 | |
2698 | - foreach ( $entity_infos as $post_definition_key => $post_definition_value ) { |
|
2698 | + foreach ($entity_infos as $post_definition_key => $post_definition_value) { |
|
2699 | 2699 | $tpl_component['ATTRIBUTE_VALUE_' . strtoupper($post_definition_key)] = $entity_infos->$post_definition_key; |
2700 | 2700 | } |
2701 | 2701 | |
@@ -2710,7 +2710,7 @@ discard block |
||
2710 | 2710 | break; |
2711 | 2711 | |
2712 | 2712 | default: |
2713 | - $query = $wpdb->prepare("SELECT " . $field . " FROM ".WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS." WHERE id=%d LIMIT 1", $option_id); |
|
2713 | + $query = $wpdb->prepare("SELECT " . $field . " FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . " WHERE id=%d LIMIT 1", $option_id); |
|
2714 | 2714 | $info = $wpdb->get_var($query); |
2715 | 2715 | break; |
2716 | 2716 | } |
@@ -2748,39 +2748,39 @@ discard block |
||
2748 | 2748 | * @param string $data_type optionnal Le type de donnees choisi pour cet attribut (custom | internal) |
2749 | 2749 | * @return string Le resultat sous forme de code html pour la liste des options |
2750 | 2750 | */ |
2751 | - function get_select_options_list($attribute_id, $data_type='custom') { |
|
2751 | + function get_select_options_list($attribute_id, $data_type = 'custom') { |
|
2752 | 2752 | global $wpdb; |
2753 | 2753 | $output = ''; |
2754 | 2754 | |
2755 | 2755 | $attribute_select_options = self::get_select_option_list_($attribute_id); |
2756 | 2756 | |
2757 | 2757 | /* Add possibily to choose datat type to use with list */ |
2758 | - if(empty($attribute_id) || (!empty($attribute_select_options) && empty($attribute_select_options[0]->data_type_to_use))){ |
|
2759 | - unset($input_def);$input_def=array(); |
|
2758 | + if (empty($attribute_id) || (!empty($attribute_select_options) && empty($attribute_select_options[0]->data_type_to_use))) { |
|
2759 | + unset($input_def); $input_def = array(); |
|
2760 | 2760 | $input_def['label'] = __('Type of data for list', 'wpshop'); |
2761 | 2761 | $input_def['type'] = 'radio'; |
2762 | 2762 | $input_def['name'] = 'data_type_to_use'; |
2763 | 2763 | $input_def['valueToPut'] = 'index'; |
2764 | 2764 | $input_def['possible_value'] = unserialize(WPSHOP_ATTR_SELECT_TYPE); |
2765 | 2765 | $input_def['option'] = 'class="wpshop_cls wpshop_attr_combo_data_type"'; |
2766 | - $input_def['value'] = $data_type.'_data'; |
|
2766 | + $input_def['value'] = $data_type . '_data'; |
|
2767 | 2767 | $input_def['options_label']['original'] = true; |
2768 | 2768 | $output = wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE); |
2769 | 2769 | } |
2770 | 2770 | |
2771 | - if(!empty($attribute_id) || !empty($data_type)){ |
|
2772 | - $defaut_value = ( !empty($attribute_select_options[0]) && !empty($attribute_select_options[0]->default_value) ) ? $attribute_select_options[0]->default_value : null; |
|
2771 | + if (!empty($attribute_id) || !empty($data_type)) { |
|
2772 | + $defaut_value = (!empty($attribute_select_options[0]) && !empty($attribute_select_options[0]->default_value)) ? $attribute_select_options[0]->default_value : null; |
|
2773 | 2773 | $default_is_serial = false; |
2774 | - if ( !empty($attribute_select_options[0]->default_value) && ($attribute_select_options[0]->default_value == serialize(false) || @unserialize($attribute_select_options[0]->default_value) !== false) ) { |
|
2774 | + if (!empty($attribute_select_options[0]->default_value) && ($attribute_select_options[0]->default_value == serialize(false) || @unserialize($attribute_select_options[0]->default_value) !== false)) { |
|
2775 | 2775 | $defaut_value = unserialize($attribute_select_options[0]->default_value); |
2776 | 2776 | $default_is_serial = true; |
2777 | 2777 | } |
2778 | 2778 | /** Add a custom text first item of list */ |
2779 | - $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>'; |
|
2779 | + $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>'; |
|
2780 | 2780 | |
2781 | - 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'))){ |
|
2781 | + 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'))) { |
|
2782 | 2782 | $sub_output = ''; |
2783 | - if ( !empty($attribute_select_options) && !empty($attribute_select_options[0]) && !empty($attribute_select_options[0]->id) ) { |
|
2783 | + if (!empty($attribute_select_options) && !empty($attribute_select_options[0]) && !empty($attribute_select_options[0]->id)) { |
|
2784 | 2784 | $sub_output .= ' |
2785 | 2785 | <li class="wpshop_attribute_combo_options_container ui-state-disabled" > |
2786 | 2786 | <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> |
@@ -2793,7 +2793,7 @@ discard block |
||
2793 | 2793 | $tpl_component['ADMIN_ATTRIBUTE_VALUES_OPTION_VALUE'] = str_replace(".", ",", $options->value); |
2794 | 2794 | $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"' : ''); |
2795 | 2795 | $tpl_component['ADMIN_ATTRIBUTE_VALUE_OPTIN_ACTIONS'] = ''; |
2796 | - if( current_user_can('wpshop_delete_attributes_select_values') && ($options->value_id >= 0) ): |
|
2796 | + if (current_user_can('wpshop_delete_attributes_select_values') && ($options->value_id >= 0)): |
|
2797 | 2797 | $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'); |
2798 | 2798 | endif; |
2799 | 2799 | $sub_output .= wpshop_display::display_template_element('wpshop_admin_attr_option_value_item', $tpl_component, array('type' => WPSHOP_DBT_ATTRIBUTE, 'id' => $attribute_id), 'admin'); |
@@ -2801,13 +2801,13 @@ discard block |
||
2801 | 2801 | } |
2802 | 2802 | } |
2803 | 2803 | $add_button = $add_dialog_box = $user_more_script = ''; |
2804 | - if( current_user_can('wpshop_add_attributes_select_values') ) { |
|
2804 | + if (current_user_can('wpshop_add_attributes_select_values')) { |
|
2805 | 2805 | |
2806 | 2806 | $dialog_title = __('New value for attribute', 'wpshop'); |
2807 | 2807 | $dialog_identifier = 'wpshop_new_attribute_option_value_add'; |
2808 | 2808 | $dialog_input_identifier = 'wpshop_new_attribute_option_value'; |
2809 | 2809 | ob_start(); |
2810 | - include(WPSHOP_TEMPLATES_DIR.'admin/add_new_element_dialog.tpl.php'); |
|
2810 | + include(WPSHOP_TEMPLATES_DIR . 'admin/add_new_element_dialog.tpl.php'); |
|
2811 | 2811 | $add_dialog_box = ob_get_contents(); |
2812 | 2812 | ob_end_clean(); |
2813 | 2813 | |
@@ -2815,23 +2815,23 @@ discard block |
||
2815 | 2815 | $add_button_parent_class = 'wpshop_attribute_option_value_add'; |
2816 | 2816 | $add_button_name = 'wpshop_add_option_to_select'; |
2817 | 2817 | ob_start(); |
2818 | - include(WPSHOP_TEMPLATES_DIR.'admin/add_new_element_with_dialog.tpl.php'); |
|
2818 | + include(WPSHOP_TEMPLATES_DIR . 'admin/add_new_element_with_dialog.tpl.php'); |
|
2819 | 2819 | $add_button = ob_get_contents(); |
2820 | 2820 | ob_end_clean(); |
2821 | 2821 | |
2822 | 2822 | $user_more_script = ' |
2823 | - jQuery("#'.$dialog_identifier.'").dialog({ |
|
2823 | + jQuery("#'.$dialog_identifier . '").dialog({ |
|
2824 | 2824 | modal: true, |
2825 | 2825 | dialogClass: "wpshop_uidialog_box", |
2826 | 2826 | autoOpen:false, |
2827 | 2827 | show: "blind", |
2828 | 2828 | resizable: false, |
2829 | 2829 | buttons:{ |
2830 | - "'.__('Add', 'wpshop').'": function(){ |
|
2830 | + "'.__('Add', 'wpshop') . '": function(){ |
|
2831 | 2831 | var data = { |
2832 | 2832 | action: "new_option_for_select", |
2833 | 2833 | wpshop_ajax_nonce: "' . wp_create_nonce("wpshop_new_option_for_attribute_creation") . '", |
2834 | - attribute_new_label: jQuery("#'.$dialog_input_identifier.'").val(), |
|
2834 | + attribute_new_label: jQuery("#'.$dialog_input_identifier . '").val(), |
|
2835 | 2835 | attribute_identifier: "' . $attribute_id . '" |
2836 | 2836 | }; |
2837 | 2837 | jQuery.post(ajaxurl, data, function(response) { |
@@ -2847,21 +2847,21 @@ discard block |
||
2847 | 2847 | |
2848 | 2848 | jQuery(this).children("img").show(); |
2849 | 2849 | }, |
2850 | - "'.__('Cancel', 'wpshop').'": function(){ |
|
2850 | + "'.__('Cancel', 'wpshop') . '": function(){ |
|
2851 | 2851 | jQuery(this).dialog("close"); |
2852 | 2852 | } |
2853 | 2853 | }, |
2854 | 2854 | close:function(){ |
2855 | - jQuery("#'.$dialog_input_identifier.'").val(""); |
|
2855 | + jQuery("#'.$dialog_input_identifier . '").val(""); |
|
2856 | 2856 | } |
2857 | 2857 | }); |
2858 | - jQuery(".'.$add_button_parent_class.' input").click(function(){ |
|
2859 | - jQuery("#'.$dialog_identifier.'").dialog("open"); |
|
2858 | + jQuery(".'.$add_button_parent_class . ' input").click(function(){ |
|
2859 | + jQuery("#'.$dialog_identifier . '").dialog("open"); |
|
2860 | 2860 | });'; |
2861 | 2861 | |
2862 | 2862 | } |
2863 | 2863 | $output .= $add_dialog_box . ' |
2864 | - <ul id="sortable_attribute" class="wpshop_cls" >'.(count($attribute_select_options)>5 ? $add_button : '').$sub_output.$add_button.' |
|
2864 | + <ul id="sortable_attribute" class="wpshop_cls" >'.(count($attribute_select_options) > 5 ? $add_button : '') . $sub_output . $add_button . ' |
|
2865 | 2865 | </ul> |
2866 | 2866 | <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" /> |
2867 | 2867 | <script type="text/javascript" > |
@@ -2877,7 +2877,7 @@ discard block |
||
2877 | 2877 | var data = { |
2878 | 2878 | action: "attribute_output_type", |
2879 | 2879 | current_type: jQuery("#wpshop_attributes_edition_table_field_id_frontend_input").val(), |
2880 | - elementIdentifier: "'.$attribute_id.'", |
|
2880 | + elementIdentifier: "'.$attribute_id . '", |
|
2881 | 2881 | data_type_to_use: jQuery(this).val(), |
2882 | 2882 | wpshop_ajax_nonce: "' . wp_create_nonce("wpshop_attribute_output_type_selection") . '" |
2883 | 2883 | }; |
@@ -2892,10 +2892,10 @@ discard block |
||
2892 | 2892 | }); |
2893 | 2893 | </script>'; |
2894 | 2894 | } |
2895 | - 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 | - $sub_output=''; |
|
2895 | + 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 | + $sub_output = ''; |
|
2897 | 2897 | $wp_types = unserialize(WPSHOP_INTERNAL_TYPES); |
2898 | - unset($input_def);$input_def=array(); |
|
2898 | + unset($input_def); $input_def = array(); |
|
2899 | 2899 | $input_def['label'] = __('Type of data for list', 'wpshop'); |
2900 | 2900 | $input_def['type'] = 'select'; |
2901 | 2901 | $input_def['name'] = 'default_value][default_value'; |
@@ -2904,20 +2904,20 @@ discard block |
||
2904 | 2904 | $input_def['possible_value'] = $wp_types; |
2905 | 2905 | $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)); |
2906 | 2906 | $combo_wp_type = wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE); |
2907 | - $output .= '<div class="wpshop_cls">'.$combo_wp_type.'</div>'; |
|
2908 | - if ( !empty($attribute_id) ) { |
|
2907 | + $output .= '<div class="wpshop_cls">' . $combo_wp_type . '</div>'; |
|
2908 | + if (!empty($attribute_id)) { |
|
2909 | 2909 | $option_list = '<div>' . __('You can reorder element for display them in the order you want into frontend part', 'wpshop') . '</div>'; |
2910 | - $options_for_current_attribute = query_posts( array('post_type' => $input_def['value'], 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC' ) ); |
|
2911 | - if ( !empty($options_for_current_attribute) ) { |
|
2910 | + $options_for_current_attribute = query_posts(array('post_type' => $input_def['value'], 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC')); |
|
2911 | + if (!empty($options_for_current_attribute)) { |
|
2912 | 2912 | $option_list .= '<ul class="wpshop_attribute_combo_values_list_container" >'; |
2913 | 2913 | $current_order = ' '; |
2914 | - foreach ( $options_for_current_attribute as $options_def ) { |
|
2914 | + foreach ($options_for_current_attribute as $options_def) { |
|
2915 | 2915 | $current_order .= 'post_' . $options_def->ID . ','; |
2916 | 2916 | $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>'; |
2917 | 2917 | } |
2918 | 2918 | $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" />'; |
2919 | 2919 | } |
2920 | - $output .= '<div class="wpshop_cls">'.$option_list.'</div>'; |
|
2920 | + $output .= '<div class="wpshop_cls">' . $option_list . '</div>'; |
|
2921 | 2921 | } |
2922 | 2922 | } |
2923 | 2923 | } |
@@ -2945,8 +2945,8 @@ discard block |
||
2945 | 2945 | $attribute_list_for_entity = self::getElement($entity_id, "'valid'", 'entity_id', true); |
2946 | 2946 | |
2947 | 2947 | /* Read the list */ |
2948 | - if ( !empty ($attribute_list_for_entity ) ) { |
|
2949 | - foreach ( $attribute_list_for_entity as $attribute) { |
|
2948 | + if (!empty ($attribute_list_for_entity)) { |
|
2949 | + foreach ($attribute_list_for_entity as $attribute) { |
|
2950 | 2950 | switch ($list_for) { |
2951 | 2951 | case 'attribute_value': |
2952 | 2952 | $checkbox_state = ' '; |
@@ -2955,8 +2955,8 @@ discard block |
||
2955 | 2955 | <select id="wpshop_shortcode_element_attribute_value_product_list_' . $attribute->id . '" class="wpshop_shortcode_element_attribute_value_product_list" >'; |
2956 | 2956 | |
2957 | 2957 | global $post; |
2958 | - $posts = get_posts( array('post_type' => WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'numberposts' => -1) ); |
|
2959 | - foreach( $posts as $post ) : |
|
2958 | + $posts = get_posts(array('post_type' => WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'numberposts' => -1)); |
|
2959 | + foreach ($posts as $post) : |
|
2960 | 2960 | setup_postdata($post); |
2961 | 2961 | $attribute_possible_values .= '<option value="' . get_the_ID() . '" >' . get_the_ID() . ' - ' . get_the_title() . '</option>'; |
2962 | 2962 | endforeach; |
@@ -2972,23 +2972,23 @@ discard block |
||
2972 | 2972 | |
2973 | 2973 | $checkbox_state = 'disabled '; |
2974 | 2974 | $attribute_possible_values = ''; |
2975 | - if ( !empty($attribute_values) ) { |
|
2975 | + if (!empty($attribute_values)) { |
|
2976 | 2976 | $checkbox_state = ''; |
2977 | 2977 | $attribute_possible_values = ' |
2978 | 2978 | <div class="wpshop_shortcode_element_product_listing_per_attribute_value wpshop_shortcode_element_prodcut_listing_per_attribute_value_' . $attribute->code . '_container" > |
2979 | 2979 | <select id="wpshop_attribute_value_for_shortcode_generation_' . $attribute->id . '" class="wpshop_shortcode_element_prodcut_listing_per_attribute_value hidden" >'; |
2980 | 2980 | |
2981 | - if ( ($attribute->data_type == 'integer') && ( ($attribute->backend_input == 'select') || ($attribute->backend_input == 'multiple-select') ) ) { |
|
2981 | + if (($attribute->data_type == 'integer') && (($attribute->backend_input == 'select') || ($attribute->backend_input == 'multiple-select'))) { |
|
2982 | 2982 | $query = $wpdb->prepare("SELECT * FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . " WHERE attribute_id=%d ORDER BY position", $attribute->id); |
2983 | 2983 | $possible_values = $wpdb->get_results($query); |
2984 | 2984 | $already_selected_values = array(); |
2985 | 2985 | foreach ($attribute_values as $attribute_value) { |
2986 | - if ( !empty($attribute_value->value) ) { |
|
2986 | + if (!empty($attribute_value->value)) { |
|
2987 | 2987 | $already_selected_values[] = $attribute_value->value; |
2988 | 2988 | } |
2989 | 2989 | } |
2990 | 2990 | foreach ($possible_values as $value) { |
2991 | - if ( in_array( $value->id, $already_selected_values ) ) { |
|
2991 | + if (in_array($value->id, $already_selected_values)) { |
|
2992 | 2992 | $attribute_possible_values .= ' |
2993 | 2993 | <option value="' . $value->value . '" >' . $value->label . '</option>'; |
2994 | 2994 | } |
@@ -2996,7 +2996,7 @@ discard block |
||
2996 | 2996 | } |
2997 | 2997 | else { |
2998 | 2998 | foreach ($attribute_values as $attribute_value) { |
2999 | - if ( !empty($attribute_value->value) ) { |
|
2999 | + if (!empty($attribute_value->value)) { |
|
3000 | 3000 | $attribute_possible_values .= ' |
3001 | 3001 | <option value="' . $attribute_value->value . '" >' . $attribute_value->value . '</option>'; |
3002 | 3002 | } |
@@ -3025,23 +3025,23 @@ discard block |
||
3025 | 3025 | * |
3026 | 3026 | * @return object The attribute list as a wordpress database object |
3027 | 3027 | */ |
3028 | - function get_attribute_list_in_same_set_section( $attribute_code ) { |
|
3028 | + function get_attribute_list_in_same_set_section($attribute_code) { |
|
3029 | 3029 | global $wpdb; |
3030 | 3030 | |
3031 | 3031 | $attribute_def = wpshop_attributes::getElement($attribute_code, "'valid'", 'code'); |
3032 | 3032 | |
3033 | 3033 | /** Get the entire list of attribute in price set section for display */ |
3034 | - $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); |
|
3034 | + $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); |
|
3035 | 3035 | $attribute_attribution_def = $wpdb->get_row($query); |
3036 | 3036 | |
3037 | - $query = $wpdb->prepare( " |
|
3037 | + $query = $wpdb->prepare(" |
|
3038 | 3038 | SELECT ATTR.code, is_visible_in_front_listing, is_visible_in_front |
3039 | 3039 | FROM " . WPSHOP_DBT_ATTRIBUTE_DETAILS . " AS SET_SECTION_DETAIL |
3040 | 3040 | INNER JOIN " . WPSHOP_DBT_ATTRIBUTE . " AS ATTR ON (ATTR.id = SET_SECTION_DETAIL.attribute_id) |
3041 | 3041 | WHERE entity_type_id = %d |
3042 | 3042 | AND attribute_set_id = %d |
3043 | 3043 | AND attribute_group_id = %d", |
3044 | - $attribute_attribution_def->entity_type_id, $attribute_attribution_def->attribute_set_id, $attribute_attribution_def->attribute_group_id ); |
|
3044 | + $attribute_attribution_def->entity_type_id, $attribute_attribution_def->attribute_set_id, $attribute_attribution_def->attribute_group_id); |
|
3045 | 3045 | $atribute_list = $wpdb->get_results($query); |
3046 | 3046 | |
3047 | 3047 | return $atribute_list; |
@@ -3052,7 +3052,7 @@ discard block |
||
3052 | 3052 | * @param unknown_type $current_entity_id |
3053 | 3053 | * @return Ambigous <multitype:, multitype:NULL > |
3054 | 3054 | */ |
3055 | - public static function get_variation_available_attribute( $current_entity_id ) { |
|
3055 | + public static function get_variation_available_attribute($current_entity_id) { |
|
3056 | 3056 | global $wpdb; |
3057 | 3057 | $final_list = array(); |
3058 | 3058 | |
@@ -3060,7 +3060,7 @@ discard block |
||
3060 | 3060 | $query = $wpdb->prepare( |
3061 | 3061 | "SELECT ATT.*, ENTITY_META.meta_value |
3062 | 3062 | FROM " . self::getDbTable() . " AS ATT |
3063 | - 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')) |
|
3063 | + 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')) |
|
3064 | 3064 | INNER JOIN " . $wpdb->postmeta . " AS ENTITY_META ON ((ENTITY_META.meta_key = %s) AND (ENTITY_META.meta_value = ATT_DETAILS.attribute_set_id)) |
3065 | 3065 | WHERE ATT.status IN ('valid') |
3066 | 3066 | AND ATT.is_used_for_variation = %s |
@@ -3070,10 +3070,10 @@ discard block |
||
3070 | 3070 | ); |
3071 | 3071 | $attribute_list = $wpdb->get_results($query); |
3072 | 3072 | foreach ($attribute_list as $attribute) { |
3073 | - if ( !in_array($attribute->code, unserialize(WPSHOP_VARIATION_ATTRIBUTE_TO_HIDE)) && in_array($attribute->backend_input, array('select', 'multiple-select')) ) { |
|
3074 | - $attribute_values_for_variations = wpshop_attributes::get_affected_value_for_list( $attribute->code, $current_entity_id, $attribute->data_type_to_use ); |
|
3073 | + if (!in_array($attribute->code, unserialize(WPSHOP_VARIATION_ATTRIBUTE_TO_HIDE)) && in_array($attribute->backend_input, array('select', 'multiple-select'))) { |
|
3074 | + $attribute_values_for_variations = wpshop_attributes::get_affected_value_for_list($attribute->code, $current_entity_id, $attribute->data_type_to_use); |
|
3075 | 3075 | |
3076 | - if ( empty($attribute_values_for_variations) ) { |
|
3076 | + if (empty($attribute_values_for_variations)) { |
|
3077 | 3077 | $final_list['unavailable'][$attribute->code]['label'] = $attribute->frontend_label; |
3078 | 3078 | $final_list['unavailable'][$attribute->code]['values'] = array(); |
3079 | 3079 | $final_list['unavailable'][$attribute->code]['attribute_complete_def'] = $attribute; |
@@ -3093,16 +3093,16 @@ discard block |
||
3093 | 3093 | * @param integer $current_entity_id The current element edited |
3094 | 3094 | * @return Ambigous <string, string, mixed> |
3095 | 3095 | */ |
3096 | - public static function get_variation_available_attribute_display( $current_entity_id, $variation_type = 'multiple' ) { |
|
3096 | + public static function get_variation_available_attribute_display($current_entity_id, $variation_type = 'multiple') { |
|
3097 | 3097 | $attribute_list = wpshop_attributes::get_variation_available_attribute($current_entity_id); |
3098 | 3098 | |
3099 | 3099 | $attribute_defined_as_available_for_variation = ''; |
3100 | - if ( !empty($attribute_list) ) { |
|
3100 | + if (!empty($attribute_list)) { |
|
3101 | 3101 | foreach ($attribute_list as $list_type => $attribute_list_by_type) { |
3102 | 3102 | $sub_attribute_list = ''; |
3103 | 3103 | foreach ($attribute_list_by_type as $attribute_code => $attribute_def) { |
3104 | 3104 | $tpl_component = array(); |
3105 | - if ( $list_type == 'available' ) { |
|
3105 | + if ($list_type == 'available') { |
|
3106 | 3106 | $tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_LABEL_STATE'] = ''; |
3107 | 3107 | $tpl_component['ADMIN_VARIATIONS_DEF_LIST_ATTRIBUTE_CHECKBOX_STATE'] = ''; |
3108 | 3108 | $tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_TO_USE_LABEL_EXPLAINATION'] = ''; |
@@ -3116,13 +3116,13 @@ discard block |
||
3116 | 3116 | $tpl_component['ADMIN_ATTRIBUTE_CODE_FOR_VARIATION'] = $attribute_code; |
3117 | 3117 | $tpl_component['ADMIN_VARIATIONS_DEF_ATTRIBUTE_TO_USE_NAME'] = $attribute_code; |
3118 | 3118 | $tpl_component['ADMIN_VARIATION_ATTRIBUTE_CONTAINER_CLASS'] = ' wpshop_attribute_for_variation_' . $attribute_code; |
3119 | - $tpl_component['ADMIN_VARIATION_NEW_SINGLE_LABEL'] = __( $attribute_def['label'], 'wpshop' ); |
|
3119 | + $tpl_component['ADMIN_VARIATION_NEW_SINGLE_LABEL'] = __($attribute_def['label'], 'wpshop'); |
|
3120 | 3120 | $tpl_component['ADMIN_VARIATION_NEW_SINGLE_INPUT'] = ''; |
3121 | - if ( $variation_type == 'single' ) { |
|
3122 | - $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') ); |
|
3123 | - if ( !empty($attribute_output_def['possible_value']) ) { |
|
3124 | - foreach( $attribute_output_def['possible_value'] as $value_id => $value ){ |
|
3125 | - if ( !in_array($value_id, $attribute_def['values']) ) { |
|
3121 | + if ($variation_type == 'single') { |
|
3122 | + $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')); |
|
3123 | + if (!empty($attribute_output_def['possible_value'])) { |
|
3124 | + foreach ($attribute_output_def['possible_value'] as $value_id => $value) { |
|
3125 | + if (!in_array($value_id, $attribute_def['values'])) { |
|
3126 | 3126 | unset($attribute_output_def['possible_value'][$value_id]); |
3127 | 3127 | } |
3128 | 3128 | } |
@@ -3137,7 +3137,7 @@ discard block |
||
3137 | 3137 | } |
3138 | 3138 | } |
3139 | 3139 | |
3140 | - return array($attribute_defined_as_available_for_variation, ( (!empty($attribute_list['available']) ) ? $attribute_list['available'] : ''), ( ( !empty($attribute_list['unavailable']) ) ? $attribute_list['unavailable'] : '')); |
|
3140 | + return array($attribute_defined_as_available_for_variation, ((!empty($attribute_list['available'])) ? $attribute_list['available'] : ''), ((!empty($attribute_list['unavailable'])) ? $attribute_list['unavailable'] : '')); |
|
3141 | 3141 | } |
3142 | 3142 | |
3143 | 3143 | /** |
@@ -3146,18 +3146,18 @@ discard block |
||
3146 | 3146 | * @param array $variations_attribute_parameters Allows to give some parameters for customize list |
3147 | 3147 | * @return string The output for all specific attribute in each product with option |
3148 | 3148 | */ |
3149 | - public static function get_variation_attribute( $variations_attribute_parameters ) { |
|
3149 | + public static function get_variation_attribute($variations_attribute_parameters) { |
|
3150 | 3150 | $output = ''; |
3151 | 3151 | |
3152 | 3152 | $attribute_list = wpshop_attributes::getElement('yes', "'valid'", "is_used_in_variation", true); |
3153 | - if ( !empty( $attribute_list ) ) { |
|
3153 | + if (!empty($attribute_list)) { |
|
3154 | 3154 | $tpl_component = array(); |
3155 | 3155 | $tpl_component['ADMIN_VARIATION_DETAIL'] = ''; |
3156 | 3156 | $price_piloting_option = get_option('wpshop_shop_price_piloting'); |
3157 | - foreach ( $attribute_list as $attribute_def ) { |
|
3157 | + foreach ($attribute_list as $attribute_def) { |
|
3158 | 3158 | |
3159 | 3159 | $variations_attribute_parameters['field_custom_name_prefix'] = $variations_attribute_parameters['field_name'] . '[attribute][' . $attribute_def->data_type . ']'; |
3160 | - $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 ); |
|
3160 | + $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); |
|
3161 | 3161 | |
3162 | 3162 | $field_output = $attribute_output_def['output']; |
3163 | 3163 | |
@@ -3169,7 +3169,7 @@ discard block |
||
3169 | 3169 | $sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_ID'] = $attribute_output_def['id']; |
3170 | 3170 | $sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_LABEL'] = $attribute_output_def['label']; |
3171 | 3171 | $sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_INPUT'] = $field_output; |
3172 | - $tpl_component['ADMIN_VARIATION_DETAIL'] .= wpshop_display::display_template_element('wpshop_admin_variation_item_details_line', $sub_tpl_component, array(), 'admin');; |
|
3172 | + $tpl_component['ADMIN_VARIATION_DETAIL'] .= wpshop_display::display_template_element('wpshop_admin_variation_item_details_line', $sub_tpl_component, array(), 'admin'); ; |
|
3173 | 3173 | unset($sub_tpl_component); |
3174 | 3174 | } |
3175 | 3175 | $output .= wpshop_display::display_template_element('wpshop_admin_variation_item_details', $tpl_component, array(), 'admin'); |
@@ -3178,7 +3178,7 @@ discard block |
||
3178 | 3178 | return $output; |
3179 | 3179 | } |
3180 | 3180 | |
3181 | - public static function get_attribute_user_defined( $use_defined_parameters ) { |
|
3181 | + public static function get_attribute_user_defined($use_defined_parameters) { |
|
3182 | 3182 | global $wpdb; |
3183 | 3183 | $attribute_user_defined_list = array(); |
3184 | 3184 | |
@@ -3205,12 +3205,12 @@ discard block |
||
3205 | 3205 | * @param string $post_type The current |
3206 | 3206 | * |
3207 | 3207 | */ |
3208 | - function quick_edit( $column_name, $entity ) { |
|
3209 | - switch ( $entity ) { |
|
3208 | + function quick_edit($column_name, $entity) { |
|
3209 | + switch ($entity) { |
|
3210 | 3210 | case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT: |
3211 | 3211 | $attribute_def = wpshop_attributes::getElement($column_name, "'valid'", 'code'); |
3212 | - if ( !empty($attribute_def) ) { |
|
3213 | - $input_def = self::get_attribute_field_definition( $attribute_def, '', array('input_class' => ' wpshop_bulk_and_quick_edit_input') ); |
|
3212 | + if (!empty($attribute_def)) { |
|
3213 | + $input_def = self::get_attribute_field_definition($attribute_def, '', array('input_class' => ' wpshop_bulk_and_quick_edit_input')); |
|
3214 | 3214 | $input = wpshop_form::check_input_type($input_def, $input_def['input_domain']); |
3215 | 3215 | ?> |
3216 | 3216 | <div class="wpshop_bulk_and_quick_edit_column_container wpshop_bulk_and_quick_edit_column_<?php echo $column_name; ?>_container"> |
@@ -3230,12 +3230,12 @@ discard block |
||
3230 | 3230 | * @param string $post_type The current |
3231 | 3231 | * |
3232 | 3232 | */ |
3233 | - public static function bulk_edit( $column_name, $entity ) { |
|
3234 | - switch ( $entity ) { |
|
3233 | + public static function bulk_edit($column_name, $entity) { |
|
3234 | + switch ($entity) { |
|
3235 | 3235 | case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT: |
3236 | 3236 | $attribute_def = wpshop_attributes::getElement($column_name, "'valid'", 'code'); |
3237 | - if ( !empty($attribute_def) ) { |
|
3238 | - $input_def = self::get_attribute_field_definition( $attribute_def, '', array('input_class' => ' wpshop_bulk_and_quick_edit_input') ); |
|
3237 | + if (!empty($attribute_def)) { |
|
3238 | + $input_def = self::get_attribute_field_definition($attribute_def, '', array('input_class' => ' wpshop_bulk_and_quick_edit_input')); |
|
3239 | 3239 | $input = wpshop_form::check_input_type($input_def, $input_def['input_domain']); |
3240 | 3240 | ?> |
3241 | 3241 | <div class="wpshop_bulk_and_quick_edit_column_container wpshop_bulk_and_quick_edit_column_<?php echo $column_name; ?>_container"> |
@@ -1,15 +1,15 @@ |
||
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 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['times']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, |
|
5 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, |
|
6 | - 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, |
|
7 | - 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, |
|
8 | - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, |
|
9 | - chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, |
|
10 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
12 | - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
14 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['times'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>408, '#'=>500, '$'=>500, '%'=>833, '&'=>778, '\''=>180, '('=>333, ')'=>333, '*'=>500, '+'=>564, |
|
5 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>278, ';'=>278, '<'=>564, '='=>564, '>'=>564, '?'=>444, '@'=>921, 'A'=>722, |
|
6 | + 'B'=>667, 'C'=>667, 'D'=>722, 'E'=>611, 'F'=>556, 'G'=>722, 'H'=>722, 'I'=>333, 'J'=>389, 'K'=>722, 'L'=>611, 'M'=>889, 'N'=>722, 'O'=>722, 'P'=>556, 'Q'=>722, 'R'=>667, 'S'=>556, 'T'=>611, 'U'=>722, 'V'=>722, 'W'=>944, |
|
7 | + 'X'=>722, 'Y'=>722, 'Z'=>611, '['=>333, '\\'=>278, ']'=>333, '^'=>469, '_'=>500, '`'=>333, 'a'=>444, 'b'=>500, 'c'=>444, 'd'=>500, 'e'=>444, 'f'=>333, 'g'=>500, 'h'=>500, 'i'=>278, 'j'=>278, 'k'=>500, 'l'=>278, 'm'=>778, |
|
8 | + 'n'=>500, 'o'=>500, 'p'=>500, 'q'=>500, 'r'=>333, 's'=>389, 't'=>278, 'u'=>500, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>444, '{'=>480, '|'=>200, '}'=>480, '~'=>541, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500, |
|
9 | + chr(132)=>444, chr(133)=>1000, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>556, chr(139)=>333, chr(140)=>889, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>444, chr(148)=>444, chr(149)=>350, chr(150)=>500, chr(151)=>1000, chr(152)=>333, chr(153)=>980, |
|
10 | + chr(154)=>389, chr(155)=>333, chr(156)=>722, chr(157)=>350, chr(158)=>444, chr(159)=>722, chr(160)=>250, chr(161)=>333, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>200, chr(167)=>500, chr(168)=>333, chr(169)=>760, chr(170)=>276, chr(171)=>500, chr(172)=>564, chr(173)=>333, chr(174)=>760, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>564, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>500, chr(182)=>453, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>310, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>444, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722, |
|
12 | + chr(198)=>889, chr(199)=>667, chr(200)=>611, chr(201)=>611, chr(202)=>611, chr(203)=>611, chr(204)=>333, chr(205)=>333, chr(206)=>333, chr(207)=>333, chr(208)=>722, chr(209)=>722, chr(210)=>722, chr(211)=>722, chr(212)=>722, chr(213)=>722, chr(214)=>722, chr(215)=>564, chr(216)=>722, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>722, chr(222)=>556, chr(223)=>500, chr(224)=>444, chr(225)=>444, chr(226)=>444, chr(227)=>444, chr(228)=>444, chr(229)=>444, chr(230)=>667, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>500, |
|
14 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>564, chr(248)=>500, chr(249)=>500, chr(250)=>500, chr(251)=>500, chr(252)=>500, chr(253)=>500, chr(254)=>500, chr(255)=>500); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['timesB']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, |
|
5 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, |
|
6 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, |
|
7 | - 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, |
|
8 | - 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, |
|
9 | - chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,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)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, |
|
14 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['timesB'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>555, '#'=>500, '$'=>500, '%'=>1000, '&'=>833, '\''=>278, '('=>333, ')'=>333, '*'=>500, '+'=>570, |
|
5 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>333, ';'=>333, '<'=>570, '='=>570, '>'=>570, '?'=>500, '@'=>930, 'A'=>722, |
|
6 | + 'B'=>667, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>778, 'I'=>389, 'J'=>500, 'K'=>778, 'L'=>667, 'M'=>944, 'N'=>722, 'O'=>778, 'P'=>611, 'Q'=>778, 'R'=>722, 'S'=>556, 'T'=>667, 'U'=>722, 'V'=>722, 'W'=>1000, |
|
7 | + 'X'=>722, 'Y'=>722, 'Z'=>667, '['=>333, '\\'=>278, ']'=>333, '^'=>581, '_'=>500, '`'=>333, 'a'=>500, 'b'=>556, 'c'=>444, 'd'=>556, 'e'=>444, 'f'=>333, 'g'=>500, 'h'=>556, 'i'=>278, 'j'=>333, 'k'=>556, 'l'=>278, 'm'=>833, |
|
8 | + 'n'=>556, 'o'=>500, 'p'=>556, 'q'=>556, 'r'=>444, 's'=>389, 't'=>333, 'u'=>556, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>444, '{'=>394, '|'=>220, '}'=>394, '~'=>520, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500, |
|
9 | + chr(132)=>500, chr(133)=>1000, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>556, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>667, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>500, chr(148)=>500, chr(149)=>350, chr(150)=>500, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>389, chr(155)=>333, chr(156)=>722, chr(157)=>350, chr(158)=>444, chr(159)=>722, chr(160)=>250, chr(161)=>333, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>220, chr(167)=>500, chr(168)=>333, chr(169)=>747, chr(170)=>300, chr(171)=>500, chr(172)=>570, chr(173)=>333, chr(174)=>747, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>570, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>556, chr(182)=>540, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>330, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>500, 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)=>389, chr(205)=>389, chr(206)=>389, chr(207)=>389, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>570, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>722, chr(222)=>611, chr(223)=>556, chr(224)=>500, chr(225)=>500, chr(226)=>500, chr(227)=>500, chr(228)=>500, chr(229)=>500, chr(230)=>722, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>556, |
|
14 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>570, chr(248)=>500, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>500, chr(254)=>556, chr(255)=>500); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['helvetica']=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,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>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,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, |
|
6 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'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,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, |
|
8 | - 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, |
|
9 | - chr(132)=>333,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)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>500,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)=>260,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)=>556,chr(182)=>537,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)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, |
|
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)=>500,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)=>556,chr(241)=>556, |
|
14 | - chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['helvetica'] = 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, '!'=>278, '"'=>355, '#'=>556, '$'=>556, '%'=>889, '&'=>667, '\''=>191, '('=>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, ':'=>278, ';'=>278, '<'=>584, '='=>584, '>'=>584, '?'=>556, '@'=>1015, 'A'=>667, |
|
6 | + 'B'=>667, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>722, 'I'=>278, 'J'=>500, 'K'=>667, 'L'=>556, '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, '['=>278, '\\'=>278, ']'=>278, '^'=>469, '_'=>556, '`'=>333, 'a'=>556, 'b'=>556, 'c'=>500, 'd'=>556, 'e'=>556, 'f'=>278, 'g'=>556, 'h'=>556, 'i'=>222, 'j'=>222, 'k'=>500, 'l'=>222, 'm'=>833, |
|
8 | + 'n'=>556, 'o'=>556, 'p'=>556, 'q'=>556, 'r'=>333, 's'=>500, 't'=>278, 'u'=>556, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>500, '{'=>334, '|'=>260, '}'=>334, '~'=>584, chr(127)=>350, chr(128)=>556, chr(129)=>350, chr(130)=>222, chr(131)=>556, |
|
9 | + chr(132)=>333, 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)=>222, chr(146)=>222, chr(147)=>333, chr(148)=>333, chr(149)=>350, chr(150)=>556, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>500, 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)=>260, 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)=>556, chr(182)=>537, 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)=>667, chr(193)=>667, chr(194)=>667, chr(195)=>667, chr(196)=>667, chr(197)=>667, |
|
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)=>500, 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)=>556, chr(241)=>556, |
|
14 | + chr(242)=>556, chr(243)=>556, chr(244)=>556, chr(245)=>556, chr(246)=>556, chr(247)=>584, chr(248)=>611, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>500, chr(254)=>556, chr(255)=>500); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['timesI']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, |
|
5 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, |
|
6 | - 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, |
|
7 | - 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, |
|
8 | - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, |
|
9 | - chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, |
|
10 | - chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, |
|
12 | - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
14 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['timesI'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>420, '#'=>500, '$'=>500, '%'=>833, '&'=>778, '\''=>214, '('=>333, ')'=>333, '*'=>500, '+'=>675, |
|
5 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>333, ';'=>333, '<'=>675, '='=>675, '>'=>675, '?'=>500, '@'=>920, 'A'=>611, |
|
6 | + 'B'=>611, 'C'=>667, 'D'=>722, 'E'=>611, 'F'=>611, 'G'=>722, 'H'=>722, 'I'=>333, 'J'=>444, 'K'=>667, 'L'=>556, 'M'=>833, 'N'=>667, 'O'=>722, 'P'=>611, 'Q'=>722, 'R'=>611, 'S'=>500, 'T'=>556, 'U'=>722, 'V'=>611, 'W'=>833, |
|
7 | + 'X'=>611, 'Y'=>556, 'Z'=>556, '['=>389, '\\'=>278, ']'=>389, '^'=>422, '_'=>500, '`'=>333, 'a'=>500, 'b'=>500, 'c'=>444, 'd'=>500, 'e'=>444, 'f'=>278, 'g'=>500, 'h'=>500, 'i'=>278, 'j'=>278, 'k'=>444, 'l'=>278, 'm'=>722, |
|
8 | + 'n'=>500, 'o'=>500, 'p'=>500, 'q'=>500, 'r'=>389, 's'=>389, 't'=>278, 'u'=>500, 'v'=>444, 'w'=>667, 'x'=>444, 'y'=>444, 'z'=>389, '{'=>400, '|'=>275, '}'=>400, '~'=>541, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500, |
|
9 | + chr(132)=>556, chr(133)=>889, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>500, chr(139)=>333, chr(140)=>944, chr(141)=>350, chr(142)=>556, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>556, chr(148)=>556, chr(149)=>350, chr(150)=>500, chr(151)=>889, chr(152)=>333, chr(153)=>980, |
|
10 | + chr(154)=>389, chr(155)=>333, chr(156)=>667, chr(157)=>350, chr(158)=>389, chr(159)=>556, chr(160)=>250, chr(161)=>389, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>275, chr(167)=>500, chr(168)=>333, chr(169)=>760, chr(170)=>276, chr(171)=>500, chr(172)=>675, chr(173)=>333, chr(174)=>760, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>675, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>500, chr(182)=>523, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>310, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>500, chr(192)=>611, chr(193)=>611, chr(194)=>611, chr(195)=>611, chr(196)=>611, chr(197)=>611, |
|
12 | + chr(198)=>889, chr(199)=>667, chr(200)=>611, chr(201)=>611, chr(202)=>611, chr(203)=>611, chr(204)=>333, chr(205)=>333, chr(206)=>333, chr(207)=>333, chr(208)=>722, chr(209)=>667, chr(210)=>722, chr(211)=>722, chr(212)=>722, chr(213)=>722, chr(214)=>722, chr(215)=>675, chr(216)=>722, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>556, chr(222)=>611, chr(223)=>500, chr(224)=>500, chr(225)=>500, chr(226)=>500, chr(227)=>500, chr(228)=>500, chr(229)=>500, chr(230)=>667, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>500, |
|
14 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>675, chr(248)=>500, chr(249)=>500, chr(250)=>500, chr(251)=>500, chr(252)=>500, chr(253)=>444, chr(254)=>500, chr(255)=>444); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,7 +1,7 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -for($i=0;$i<=255;$i++) |
|
3 | - $fpdf_charwidths['courier'][chr($i)]=600; |
|
4 | -$fpdf_charwidths['courierB']=$fpdf_charwidths['courier']; |
|
5 | -$fpdf_charwidths['courierI']=$fpdf_charwidths['courier']; |
|
6 | -$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier']; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +for ($i = 0; $i <= 255; $i++) |
|
3 | + $fpdf_charwidths['courier'][chr($i)] = 600; |
|
4 | +$fpdf_charwidths['courierB'] = $fpdf_charwidths['courier']; |
|
5 | +$fpdf_charwidths['courierI'] = $fpdf_charwidths['courier']; |
|
6 | +$fpdf_charwidths['courierBI'] = $fpdf_charwidths['courier']; |
|
7 | 7 | ?> |
@@ -1,6 +1,9 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -for($i=0;$i<=255;$i++) |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
4 | +for($i=0;$i<=255;$i++) { |
|
3 | 5 | $fpdf_charwidths['courier'][chr($i)]=600; |
6 | +} |
|
4 | 7 | $fpdf_charwidths['courierB']=$fpdf_charwidths['courier']; |
5 | 8 | $fpdf_charwidths['courierI']=$fpdf_charwidths['courier']; |
6 | 9 | $fpdf_charwidths['courierBI']=$fpdf_charwidths['courier']; |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['timesBI']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, |
|
5 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667, |
|
6 | - 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889, |
|
7 | - 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, |
|
8 | - 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, |
|
9 | - chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, |
|
12 | - chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, |
|
14 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['timesBI'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>389, '"'=>555, '#'=>500, '$'=>500, '%'=>833, '&'=>778, '\''=>278, '('=>333, ')'=>333, '*'=>500, '+'=>570, |
|
5 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>333, ';'=>333, '<'=>570, '='=>570, '>'=>570, '?'=>500, '@'=>832, 'A'=>667, |
|
6 | + 'B'=>667, 'C'=>667, 'D'=>722, 'E'=>667, 'F'=>667, 'G'=>722, 'H'=>778, 'I'=>389, 'J'=>500, 'K'=>667, 'L'=>611, 'M'=>889, 'N'=>722, 'O'=>722, 'P'=>611, 'Q'=>722, 'R'=>667, 'S'=>556, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>889, |
|
7 | + 'X'=>667, 'Y'=>611, 'Z'=>611, '['=>333, '\\'=>278, ']'=>333, '^'=>570, '_'=>500, '`'=>333, 'a'=>500, 'b'=>500, 'c'=>444, 'd'=>500, 'e'=>444, 'f'=>333, 'g'=>500, 'h'=>556, 'i'=>278, 'j'=>278, 'k'=>500, 'l'=>278, 'm'=>778, |
|
8 | + 'n'=>556, 'o'=>500, 'p'=>500, 'q'=>500, 'r'=>389, 's'=>389, 't'=>278, 'u'=>556, 'v'=>444, 'w'=>667, 'x'=>500, 'y'=>444, 'z'=>389, '{'=>348, '|'=>220, '}'=>348, '~'=>570, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500, |
|
9 | + chr(132)=>500, chr(133)=>1000, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>556, chr(139)=>333, chr(140)=>944, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>500, chr(148)=>500, chr(149)=>350, chr(150)=>500, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>389, chr(155)=>333, chr(156)=>722, chr(157)=>350, chr(158)=>389, chr(159)=>611, chr(160)=>250, chr(161)=>389, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>220, chr(167)=>500, chr(168)=>333, chr(169)=>747, chr(170)=>266, chr(171)=>500, chr(172)=>606, chr(173)=>333, chr(174)=>747, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>570, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>576, chr(182)=>500, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>300, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>500, chr(192)=>667, chr(193)=>667, chr(194)=>667, chr(195)=>667, chr(196)=>667, chr(197)=>667, |
|
12 | + chr(198)=>944, chr(199)=>667, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>389, chr(205)=>389, chr(206)=>389, chr(207)=>389, chr(208)=>722, chr(209)=>722, chr(210)=>722, chr(211)=>722, chr(212)=>722, chr(213)=>722, chr(214)=>722, chr(215)=>570, chr(216)=>722, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>611, chr(222)=>611, chr(223)=>500, chr(224)=>500, chr(225)=>500, chr(226)=>500, chr(227)=>500, chr(228)=>500, chr(229)=>500, chr(230)=>722, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>556, |
|
14 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>570, chr(248)=>500, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>444, chr(254)=>500, chr(255)=>444); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['symbol']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549, |
|
5 | - ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722, |
|
6 | - 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768, |
|
7 | - 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576, |
|
8 | - 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0, |
|
9 | - chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, |
|
10 | - chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603, |
|
11 | - chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768, |
|
12 | - chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042, |
|
13 | - chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329, |
|
14 | - chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['symbol'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>713, '#'=>500, '$'=>549, '%'=>833, '&'=>778, '\''=>439, '('=>333, ')'=>333, '*'=>500, '+'=>549, |
|
5 | + ','=>250, '-'=>549, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>278, ';'=>278, '<'=>549, '='=>549, '>'=>549, '?'=>444, '@'=>549, 'A'=>722, |
|
6 | + 'B'=>667, 'C'=>722, 'D'=>612, 'E'=>611, 'F'=>763, 'G'=>603, 'H'=>722, 'I'=>333, 'J'=>631, 'K'=>722, 'L'=>686, 'M'=>889, 'N'=>722, 'O'=>722, 'P'=>768, 'Q'=>741, 'R'=>556, 'S'=>592, 'T'=>611, 'U'=>690, 'V'=>439, 'W'=>768, |
|
7 | + 'X'=>645, 'Y'=>795, 'Z'=>611, '['=>333, '\\'=>863, ']'=>333, '^'=>658, '_'=>500, '`'=>500, 'a'=>631, 'b'=>549, 'c'=>549, 'd'=>494, 'e'=>439, 'f'=>521, 'g'=>411, 'h'=>603, 'i'=>329, 'j'=>603, 'k'=>549, 'l'=>549, 'm'=>576, |
|
8 | + 'n'=>521, 'o'=>549, 'p'=>549, 'q'=>521, 'r'=>549, 's'=>603, 't'=>439, 'u'=>576, 'v'=>713, 'w'=>686, 'x'=>493, 'y'=>686, 'z'=>494, '{'=>480, '|'=>200, '}'=>480, '~'=>549, chr(127)=>0, chr(128)=>0, chr(129)=>0, chr(130)=>0, chr(131)=>0, |
|
9 | + chr(132)=>0, chr(133)=>0, chr(134)=>0, chr(135)=>0, chr(136)=>0, chr(137)=>0, chr(138)=>0, chr(139)=>0, chr(140)=>0, chr(141)=>0, chr(142)=>0, chr(143)=>0, chr(144)=>0, chr(145)=>0, chr(146)=>0, chr(147)=>0, chr(148)=>0, chr(149)=>0, chr(150)=>0, chr(151)=>0, chr(152)=>0, chr(153)=>0, |
|
10 | + chr(154)=>0, chr(155)=>0, chr(156)=>0, chr(157)=>0, chr(158)=>0, chr(159)=>0, chr(160)=>750, chr(161)=>620, chr(162)=>247, chr(163)=>549, chr(164)=>167, chr(165)=>713, chr(166)=>500, chr(167)=>753, chr(168)=>753, chr(169)=>753, chr(170)=>753, chr(171)=>1042, chr(172)=>987, chr(173)=>603, chr(174)=>987, chr(175)=>603, |
|
11 | + chr(176)=>400, chr(177)=>549, chr(178)=>411, chr(179)=>549, chr(180)=>549, chr(181)=>713, chr(182)=>494, chr(183)=>460, chr(184)=>549, chr(185)=>549, chr(186)=>549, chr(187)=>549, chr(188)=>1000, chr(189)=>603, chr(190)=>1000, chr(191)=>658, chr(192)=>823, chr(193)=>686, chr(194)=>795, chr(195)=>987, chr(196)=>768, chr(197)=>768, |
|
12 | + chr(198)=>823, chr(199)=>768, chr(200)=>768, chr(201)=>713, chr(202)=>713, chr(203)=>713, chr(204)=>713, chr(205)=>713, chr(206)=>713, chr(207)=>713, chr(208)=>768, chr(209)=>713, chr(210)=>790, chr(211)=>790, chr(212)=>890, chr(213)=>823, chr(214)=>549, chr(215)=>250, chr(216)=>713, chr(217)=>603, chr(218)=>603, chr(219)=>1042, |
|
13 | + chr(220)=>987, chr(221)=>603, chr(222)=>987, chr(223)=>603, chr(224)=>494, chr(225)=>329, chr(226)=>790, chr(227)=>790, chr(228)=>786, chr(229)=>713, chr(230)=>384, chr(231)=>384, chr(232)=>384, chr(233)=>384, chr(234)=>384, chr(235)=>384, chr(236)=>494, chr(237)=>494, chr(238)=>494, chr(239)=>494, chr(240)=>0, chr(241)=>329, |
|
14 | + chr(242)=>274, chr(243)=>686, chr(244)=>686, chr(245)=>686, chr(246)=>384, chr(247)=>384, chr(248)=>384, chr(249)=>384, chr(250)=>384, chr(251)=>384, chr(252)=>494, chr(253)=>494, chr(254)=>494, chr(255)=>0); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |