本文整理汇总了PHP中AddressFormat::_setOriginalDisplayFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP AddressFormat::_setOriginalDisplayFormat方法的具体用法?PHP AddressFormat::_setOriginalDisplayFormat怎么用?PHP AddressFormat::_setOriginalDisplayFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AddressFormat
的用法示例。
在下文中一共展示了AddressFormat::_setOriginalDisplayFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFormattedAddressFieldsValues
public static function getFormattedAddressFieldsValues($address, $addressFormat, $id_lang = null)
{
if (!$id_lang) {
$id_lang = Context::getContext()->language->id;
}
$tab = array();
$temporyObject = array();
// Check if $address exist and it's an instanciate object of Address
if ($address && $address instanceof Address) {
foreach ($addressFormat as $line) {
if (($keyList = preg_split(self::_CLEANING_REGEX_, $line, -1, PREG_SPLIT_NO_EMPTY)) && is_array($keyList)) {
foreach ($keyList as $pattern) {
if ($associateName = explode(':', $pattern)) {
$totalName = count($associateName);
if ($totalName == 1 && isset($address->{$associateName[0]})) {
$tab[$associateName[0]] = $address->{$associateName[0]};
} else {
$tab[$pattern] = '';
// Check if the property exist in both classes
if ($totalName == 2 && class_exists($associateName[0]) && property_exists($associateName[0], $associateName[1]) && property_exists($address, 'id_' . strtolower($associateName[0]))) {
$idFieldName = 'id_' . strtolower($associateName[0]);
if (!isset($temporyObject[$associateName[0]])) {
$temporyObject[$associateName[0]] = new $associateName[0]($address->{$idFieldName});
}
if ($temporyObject[$associateName[0]]) {
$tab[$pattern] = is_array($temporyObject[$associateName[0]]->{$associateName[1]}) ? isset($temporyObject[$associateName[0]]->{$associateName[1]}[$id_lang]) ? $temporyObject[$associateName[0]]->{$associateName[1]}[$id_lang] : '' : $temporyObject[$associateName[0]]->{$associateName[1]};
}
}
}
}
}
AddressFormat::_setOriginalDisplayFormat($tab, $line, $keyList);
}
}
}
AddressFormat::cleanOrderedAddress($addressFormat);
// Free the instanciate objects
foreach ($temporyObject as &$object) {
unset($object);
}
return $tab;
}