public static function meta_hreflang() { global $context; $meta_hreflang = array(); $context['hreflang'] = $meta_hreflang; $sisters = array(); //// detect other language for articles or sections if (strpos($context['current_item'], 'article') === FALSE && strpos($context['current_item'], 'section') === FALSE) { return $meta_hreflang; } // get the entity if ($anchor = Anchors::get($context['current_item'])) { // if anchor as a little name if ($nick = $anchor->get_nick_name()) { $class = $anchor->get_static_group_class(); $sisters = $class::list_for_name($nick, null, 'raw'); } } if (count($sisters)) { foreach ($sisters as $page) { if ($page['language'] && $page['language'] != 'none') { $url = http::add_url_param($class::get_permalink($page), "lang", $page['language']); $meta_hreflang[] = '<link rel="alternate" hreflang="' . $page['language'] . '" href="' . $url . '" />'; // memorize this for page::echo_local_switcher() $context['hreflang'][] = array('lang' => $page['language'], 'url' => $url, 'id' => $page['id']); } } } return $meta_hreflang; }
/** * jump to another web page * * This function never returns. * * @param string the target full web address */ public static function redirect($reference) { global $render_overlaid; // stay overlaid if it was asked if ($render_overlaid) { // stop redirect if param follow_up set to 'close' if (isset($_REQUEST['follow_up']) && $_REQUEST['follow_up'] === 'close') { exit('job done'); } // add overlaid param $reference = http::add_url_param($reference, "overlaid", "Y"); } // the actual redirection directive Safe::header('Location: ' . $reference); // a message for human beings if (!is_callable(array('i18n', 's'))) { exit; } exit(sprintf(i18n::s('Redirecting to %s'), '<a href="' . $reference . '">' . $reference . '</a>')); }