$APPLICATION->SetPageProperty('canonical', getSiteUrl() . $APPLICATION->GetCurPage(false));
function getSiteUrl() {
$protocol = $_SERVER['HTTPS'] != '' ? 'https://' : 'http://';
return $protocol . $_SERVER['SERVER_NAME'];
}
$repeater_value = (int)get_post_meta($post_id, 'repeater_field_name', true);
if ($repeater_value) {
for ($i=0; $i<$repeater_value;/*<-fixed*/ $i++) {
$meta_key = 'repeater_field_name_'.$i.'_sub_field_name';
$sub_field_value = get_post_meta($post_id, $meta_key, true);
}
}
$str = mb_convert_encoding($str, "UTF-8", "windows-1251");
$str = str_replace("&ndash", '-', $str);
// ОШибочки
libxml_use_internal_errors(true);
$xml = simplexml_load_string($str);
if (false === $xml) {
$errors = libxml_get_errors();
echo 'Errors are ' . var_export($errors, true);
throw new \Exception('invalid XML');
}