<?php global $id, $url, $parent; ?> <script type="text/javascript"> // <![CDATA[ <?php $pages = return_i18n_pages(); # tags $tags = array(); foreach ($pages as $page) { foreach (preg_split('/\\s*,\\s*/', trim(@$page['tags'])) as $t) { $tags[$t] = true; } } $tags = array_keys($tags); sort($tags); # structure $structure = return_i18n_page_structure(null, false, $url); $siblings = @$pages['' . $parent]['children']; if ($siblings) { $myindex = array_search($url, $siblings); } else { $myindex = false; } $after = $myindex !== false && $myindex > 0 ? $siblings[$myindex - 1] : ''; ?> var after = <?php echo json_encode($after); ?> ;
private static function getFancyLanguageUrl($slug, $parent, $lang = null, $type = 'full') { global $SITEURL, $PERMALINK, $PERMALINK_ORIG, $language; if (!isset($PERMALINK_ORIG)) { $PERMALINK_ORIG = $PERMALINK; } if ($type == 'full') { $full = $SITEURL; } else { $full = '/'; } if (!$lang) { $lang = @$_GET[I18N_LANGUAGE_PARAM] ? $_GET[I18N_LANGUAGE_PARAM] : $language; } $plink = $PERMALINK_ORIG; if ($lang && $lang != self::getDefaultLanguage()) { $plink = str_replace('%nondefaultlanguage%', $lang, $plink); } else { $plink = str_replace('%nondefaultlanguage%/', '', $plink); $plink = str_replace('%nondefaultlanguage%', '', $plink); } $plink = str_replace('%language%', $lang, $plink); $parent = (string) $parent; if ($parent && (string) $slug && $slug != 'index') { // no parent for index page $plink = str_replace('%parent%', $parent, $plink); if (strpos($plink, '%parents%') !== false) { $parents = $parent; if (function_exists('return_i18n_pages')) { $pages = return_i18n_pages(); while ($parent = @$pages[$parent]['parent']) { $parents = $parent . '/' . $parents; } } elseif (function_exists('getPageField')) { while ($parent = getPageField($parent, 'parent')) { $parents = $parent . '/' . $parents; } } $plink = str_replace('%parents%', $parents, $plink); } } else { $plink = str_replace('%parent%/', '', $plink); $plink = str_replace('%parent%', '', $plink); $plink = str_replace('%parents%/', '', $plink); $plink = str_replace('%parents%', '', $plink); } if ((string) $slug && $slug != 'index') { $plink = str_replace('%slug%', $slug, $plink); } else { $plink = preg_replace('/%slug%\\.[a-zA-Z]+/', '', $plink); // support for file extensions $plink = str_replace('%slug%/', '', $plink); $plink = str_replace('%slug%', '', $plink); } return (string) $full . $plink; }