url as $url_tag) {
$loc = (string)$url_tag->loc;
$lastmod = (string)$url_tag->lastmod;
$is_excluded = false;
foreach ($exclude as $word) {
if (strpos($loc, $word) !== false) { $is_excluded = true; break; }
}
if ($is_excluded) continue;
$date = new DateTime($lastmod);
$year = $date->format(‘Y’);
$month = $date->format(‘F’);
$title = basename($loc, «.html»);
$title = mb_convert_case(str_replace([‘-‘, ‘_’], ‘ ‘, $title), MB_CASE_TITLE, «UTF-8»);
$grouped[$year][$month][] = [‘loc’ => $loc, ‘title’ => $title ?: ‘Главная’];
}
}
krsort($grouped);
return $grouped;
}
$month_ru = [
‘January’ => ‘Январь’, ‘February’ => ‘Февраль’, ‘March’ => ‘Март’, ‘April’ => ‘Апрель’,
‘May’ => ‘Май’, ‘June’ => ‘Июнь’, ‘July’ => ‘Июль’, ‘August’ => ‘Август’,
‘September’ => ‘Сентябрь’, ‘October’ => ‘Октябрь’, ‘November’ => ‘Ноябрь’, ‘December’ => ‘Декабрь’
];
$post_groups = getKbpSitemapData(‘https://kbp.by’);
?>