public function __construct() { $this->cur_lang = return_i18n_languages()[0]; if (!$this->checkPrerequisites()) { throw new \Exception(i18n_r('rates/MISSING_DIR')); } }
public function __construct() { $this->cur_lang = return_i18n_languages()[0]; if (!$this->checkPrerequisites()) { throw new \Exception(i18n_r('calendar/MISSING_DIR')); } $this->schedule = $this->loadSchedule(); }
public static function outputLink($gallery) { include_once GSPLUGINPATH . 'i18n_gallery/helper.php'; $url = @$gallery['url'] ? $gallery['url'] : 'index'; $parent = @$gallery['parent'] ? $gallery['parent'] : null; $tags = @$gallery['tags'] ? $gallery['tags'] : null; $thumb = i18n_gallery_thumb($gallery); $title = $gallery['title']; if (function_exists('return_i18n_languages')) { $languages = return_i18n_languages(); $deflang = return_i18n_default_language(); foreach ($languages as $language) { $fullkey = 'title' . ($language == $deflang ? '' : '_' . $language); if (isset($gallery[$fullkey])) { $title = $gallery[$fullkey]; break; } } } $link = function_exists('find_i18n_url') ? find_i18n_url($url, $parent) : find_url($url, $parent); if ($tags) { $link .= (strpos($link, '?') !== false ? '&' : '?') . 'imagetags=' . urlencode($tags); } if (isset($thumb)) { $item = @$gallery['items'][$thumb]; if (!$item) { $item = $gallery['items'][0]; } echo '<div class="gallery-link">'; echo '<a href="' . htmlspecialchars($link) . '" class="gallery-thumb-link">'; echo '<img src="'; i18n_gallery_thumb_link($gallery, $item); echo '" alt="' . htmlspecialchars($title) . '" title="' . htmlspecialchars($title) . '"/>'; echo '</a>'; echo '<span class="gallery-title">' . htmlspecialchars($title) . '</span>'; echo '</div>'; } else { echo '<a href="' . htmlspecialchars($link) . '" class="gallery-title-link">'; echo htmlspecialchars($title); echo '</a>'; } }
private function getProp($name) { $value = null; if ($this->deflang !== null) { $languages = return_i18n_languages(); foreach ($languages as $language) { if (!isset($this->data[$language])) { $this->data[$language] = @getXML(GSDATAPAGESPATH . $this->url . ($language == $this->deflang ? '' : '_' . $language) . '.xml'); } if (@$this->data[$language]->{$name}) { return $this->data[$language]->{$name}; } } return null; } else { if (!isset($this->data[''])) { $this->data[''] = @getXML(GSDATAPAGESPATH . $this->url . '.xml'); } return $this->data['']->{$name}; } }
private function &execute() { $results = array(); if (count($this->tags) <= 0 && count($this->words) <= 0) { return $results; } if (!file_exists(GSDATAOTHERPATH . I18N_WORD_INDEX)) { create_i18n_search_index(); } $isi18n = function_exists('i18n_init'); // use multibyte string functions? $ismb = function_exists('mb_ereg_replace'); if ($ismb) { mb_regex_encoding('UTF-8'); } // language? $defaultLanguage = function_exists('return_i18n_default_language') ? return_i18n_default_language() : ''; $languages = function_exists('return_i18n_languages') ? $this->language ? array($this->language) : return_i18n_languages() : array($defaultLanguage); // scores per id $idScores = null; $tagIds = array(); if ($this->tags && count($this->tags) > 0) { for ($i = 0; $i < count($this->tags); $i++) { if ($ismb) { $this->tags[$i] = mb_ereg_replace("[^\\w]", "_", mb_strtolower(trim($this->tags[$i]), 'UTF-8')); } else { $this->tags[$i] = preg_replace("/[^\\w]/", "_", strtolower(trim($this->tags[$i]))); } $tagIds[$this->tags[$i]] = array(); } $f = fopen(GSDATAOTHERPATH . I18N_TAG_INDEX, "r"); while (($line = fgets($f)) !== false) { foreach ($this->tags as $tag) { if (strncmp($line, $tag . ' ', strlen($tag) + 1) == 0) { $fullids = preg_split("/\\s+/", trim($line)); unset($fullids[0]); foreach ($fullids as $fullid) { $tagIds[$tag][$fullid] = 1; } } } } fclose($f); foreach ($this->tags as $tag) { if ($idScores === null) { $idScores = $tagIds[$tag]; } else { $idScores = array_intersect_key($idScores, $tagIds[$tag]); } } } if ($this->words && count($this->words) > 0) { $wordIds = array(); for ($i = 0; $i < count($this->words); $i++) { if ($ismb) { $this->words[$i] = mb_strtolower(trim($this->words[$i]), 'UTF-8'); } else { $this->words[$i] = strtolower(trim($this->words[$i])); } $wordIds[$this->words[$i]] = array(); } $f = fopen(GSDATAOTHERPATH . I18N_WORD_INDEX, "r"); while (($line = fgets($f)) !== false) { foreach ($this->words as $word) { if ($this->is_word($line, $word, $ismb)) { $fullidAndScores = preg_split("/\\s+/", trim($line)); unset($fullidAndScores[0]); foreach ($fullidAndScores as $fullidAndScore) { $pos = strrpos($fullidAndScore, ":"); $score = (int) substr($fullidAndScore, $pos + 1); $fullid = substr($fullidAndScore, 0, $pos); if (isset($wordIds[$word][$fullid])) { $wordIds[$word][$fullid] += $score; } else { if ($idScores == null || isset($idScores[$fullid])) { $wordIds[$word][$fullid] = $score; } } } } } } fclose($f); foreach ($this->words as $word) { if ($idScores === null) { $idScores = $wordIds[$word]; } else { $idScores = array_intersect_key($idScores, $wordIds[$word]); foreach ($idScores as $fullid => $score) { $idScores[$fullid] = $score * $wordIds[$word][$fullid]; } } } } $filteredresults = array(); if ($idScores && count($idScores) > 0) { $idPubDates = array(); $idCreDates = array(); $f = fopen(GSDATAOTHERPATH . I18N_DATE_INDEX, "r"); while (($line = fgets($f)) !== false) { $items = preg_split("/\\s+/", trim($line)); $fullid = $items[0]; if (count($items) >= 2 && isset($idScores[$fullid])) { $idPubDates[$fullid] = (int) $items[1]; $idCreDates[$fullid] = count($items) >= 3 ? (int) $items[2] : (int) $items[1]; } } fclose($f); foreach ($idScores as $fullid => $score) { if ($isi18n) { $pos = strrpos($fullid, "_"); $language = $pos !== false ? substr($fullid, $pos + 1) : $defaultLanguage; $id = $pos !== false ? substr($fullid, 0, $pos) : $fullid; } else { $language = ''; $id = $fullid; } if (in_array($language, $languages)) { // ignore language, if not default and not requested by user if (substr($id, 0, 1) == '#') { $ispage = false; $id = substr($id, 1); } else { $ispage = true; } if ($ispage) { $results[] = new I18nSearchResultPage($id, $language, $idCreDates[$fullid], $idPubDates[$fullid], $idScores[$fullid]); } else { global $filters; $item = null; foreach ($filters as $filter) { if ($filter['filter'] == I18N_FILTER_SEARCH_ITEM) { $item = call_user_func_array($filter['function'], array($id, $language, $idCreDates[$fullid], $idPubDates[$fullid], $idScores[$fullid])); if ($item) { break; } } } $results[] = $item ? $item : new I18nSearchResultItem($id, $language, $idCreDates[$fullid], $idPubDates[$fullid], $idScores[$fullid]); } } } foreach ($results as $item) { global $filters; $vetoed = false; foreach ($filters as $filter) { if ($filter['filter'] == I18N_FILTER_VETO_SEARCH_ITEM) { if (call_user_func_array($filter['function'], array($item))) { $vetoed = true; break; } } } if (!$vetoed) { $filteredresults[] = $item; } } switch ($this->sort_field) { case 'url': usort($filteredresults, array($this, 'compare_url')); break; case 'date': usort($filteredresults, array($this, 'compare_date')); break; case 'created': usort($filteredresults, array($this, 'compare_created')); break; case 'score': usort($filteredresults, array($this, 'compare_score')); break; default: usort($filteredresults, array($this, 'compare_field')); } if ($this->sort_order == '-') { $filteredresults = array_reverse($filteredresults); } } return $filteredresults; }
$minTagSizePercent = array_key_exists('minTagSize', $params) ? (int) $params['minTagSize'] : 100; $maxTagSizePercent = array_key_exists('maxTagSize', $params) ? (int) $params['maxTagSize'] : 250; $addTags = array_key_exists('addTags', $params) ? $params['addTags'] : ''; $goText = @$i18n['GO']; $is_ajax = !isset($params['ajax']) || $params['ajax']; $live = $is_ajax && isset($params['live']) && $params['live']; $url = function_exists('find_i18n_url') ? find_i18n_url($slug, null) : find_url($slug, null); $method = strpos($url, '?') !== false ? 'POST' : 'GET'; // with GET the parameters are not submitted! $language = isset($params['lang']) ? $params['lang'] : null; $placeholderText = @$params['PLACEHOLDER']; // languages $reqlangs = null; if (function_exists('return_i18n_languages')) { $deflang = return_i18n_default_language(); $languages = $language ? array($language) : return_i18n_languages(); foreach ($languages as $lang) { if ($lang == $deflang) { $lang = ''; } $reqlangs = $reqlangs === null ? $lang : $reqlangs . ',' . $lang; } } // mark $mark = false; if (file_exists(GSDATAOTHERPATH . I18N_SEARCH_SETTINGS_FILE)) { $data = getXML(GSDATAOTHERPATH . I18N_SEARCH_SETTINGS_FILE); $mark = true && $data->mark; } ?> <form action="<?php
<?php $page = isset($_GET["page"]) ? $_GET["page"] : ""; $setlang = isset($_GET["setlang"]); $result = array(); if ($page == "" || $page == "init" || $setlang) { if (!$setlang) { $page = "index"; } $result["langs"] = return_i18n_languages(); $result["tabs"] = return_i18n_menu_data(return_page_slug(), 0, 0, I18N_SHOW_MENU); //echo $other_lang; } $content = ""; $title = ""; $url = $page; if (isset($pagesArray[$page])) { $data_index = return_i18n_page_data($page); $content = strip_decode($data_index->content); $content = exec_filter('content', $content); $title = strip_decode($data_index->title); $url = strip_decode($data_index->url); } $page_content = array(); $children = return_i18n_menu_data($page, 1, 1, I18N_SHOW_MENU); if (!is_null($children)) { $page_content["children"] = $children; } $page_content["title"] = $title; $page_content["content"] = $content; $result["url"] = $url;
<?php $slug = @$params['slug']; $is_ajax = !isset($params['ajax']) || $params['ajax']; $addtags = isset($params['addTags']) ? preg_split('/\\s+/', trim($params['addTags'])) : null; $reqtags = trim(@$_REQUEST['tags']) ? preg_split('/\\s+/', trim($_REQUEST['tags'])) : null; $language = isset($params['lang']) ? $params['lang'] : null; // languages $isi18n = function_exists('return_i18n_languages'); $defaultLanguage = $isi18n ? return_i18n_default_language() : ''; $languages = $isi18n ? $language ? array($language) : return_i18n_languages() : null; // read tag file if (!file_exists(GSDATAOTHERPATH . I18N_WORD_INDEX)) { create_i18n_search_index(); } $alltags = array(); $f = fopen(GSDATAOTHERPATH . I18N_TAG_INDEX, "r"); while (($line = fgets($f)) !== false) { $items = preg_split("/\\s+/", trim($line)); $tag = array_shift($items); if ($languages) { // filter items $filteredItems = array(); foreach ($items as $item) { $pos = strrpos($item, '_'); $lang = $pos !== false ? substr($item, $pos + 1) : $defaultLanguage; if (in_array($lang, $languages)) { $filteredItems[] = $item; } } if (count($filteredItems) > 0) {
<div class="tools"> <div class="contact-band"> <span> <a href=""> <i class="fa fa-phone"></i>(450) 788-2680 </a> </span> <span> <a href="mailto:info@campinglequebecois.qc.ca"> <i class="fa fa-envelope"></i>info@campinglequebecois.qc.ca </a> </span> </div> <div class="lang"> <?php $languages = return_i18n_languages(); if (count($languages) > 1) { $other_lang = $languages[1]; } else { $other_lang = $languages[0]; } $txt = "English"; if ($other_lang != "en") { $txt = "Français"; } ?> <a href="<?php echo return_i18n_setlang_url($other_lang); ?> "><?php echo $txt;