%PDF- %PDF-
Direktori : /var/www/cwg/wp-content/themes/cwg/wpallimport/ |
Current File : //var/www/cwg/wp-content/themes/cwg/wpallimport/function-editor.php |
<?php // if you see this file in the theme, this is not the file used by wp all import, just a backup // the true file is in uploads/wpallimport/functions.php and can be edited in the import edition page function format_indoor_outdoor($value) { switch ($value) { case '0': return 'indoor'; break; case '1': return 'outdoor'; break; default: return ''; break; } } function get_dimensions_data($value, $dimension) { $value = trim_excel_special_char($value); preg_match_all("/(?'Hcm'\d*[\.|,]*\d*)[\s|x]{0,3}(?'Lcm'\d+[\.|,]*\d*)[\s|x]{0,3}(?'Wcm'\d*[\.|,]*\d*)\s*?cm\s+(?'Hin'(?:\d*[\.|,]*\d*)|(?:(?:\d+\s)*(?:\d+\/?\d+)*))[\s|x]{0,3}(?'Lin'(?:\d*[\.|,]*\d*)|(?:(?:\d+\s)*(?:\d+\/?\d+)*))[\s|x]{0,3}(?'Win'(?:\d*[\.|,]?\d*)|(?:(?:\d+\s)*(?:\d+\/?\d+)*))\sin.*/mA", $value, $matches); if(isset($dimension) && array_key_exists($dimension, $matches) && count($matches[$dimension])) { return $matches[$dimension][0]; } return ""; } function get_height_cm($value) { return get_dimensions_data($value, "Hcm"); } function get_width_cm($value) { return get_dimensions_data($value, "Wcm"); } function get_length_cm($value) { return get_dimensions_data($value, "Lcm"); } function calculate_value_in_inches($result) { if(strpos($result, "/")) { $exploded = explode(" ", $result); switch(count($exploded)) { case 1: return (eval("return number_format(" . $exploded[0] . ", 2);")); case 2: return (eval("return number_format(" . intval($exploded[0]) . " + (" . $exploded[1] . "), 2);")); default: return ""; } } else { return $result; } } function get_height_in($value) { return calculate_value_in_inches(get_dimensions_data($value, "Hin")); } function get_width_in($value) { return calculate_value_in_inches(get_dimensions_data($value, "Win")); } function get_length_in($value) { return calculate_value_in_inches(get_dimensions_data($value, "Lin")); } function format_period($value) { switch ($value) { case 'Vintage Design': case 'Vintage Jewelry': return 'historical'; break; case 'Contemporary Design': case 'Contemporary Jewelry': return 'contemporary'; break; default: return ''; break; } } function format_is_b2b($value) { switch ($value) { case strlen($value) > 0: return 1; break; default: return 0; break; } } function trim_excel_special_char($value) { return str_replace('_x000D_', '', $value); } ?>