示例#1
0
 public function __construct(Route $model)
 {
     $this->model = $model;
     // get all the parameters from the page uri
     $uriGetParam = isset($_GET['uri']) ? "/" . $_GET['uri'] : '/';
     self::$currentRoute = $uriGetParam;
     foreach (Trans::getAllDomains() as $value) {
         if (strpos($uriGetParam, $value) !== false) {
             Trans::setDomain($value);
         }
         $uriGetParam = str_replace("/" . $value, "", $uriGetParam);
     }
     $uriView = explode("/", $uriGetParam);
     if (isset($uriView[1])) {
         $this->uriView = "/" . $uriView[1];
     } else {
         $this->uriView = "/" . $uriView[0];
     }
     $this->additionalParam = explode("/", $uriGetParam);
     setNewLangInCookie();
 }
示例#2
0
文件: cookies.php 项目: audef1/myShop
<?php

/**
 * Created by PhpStorm.
 * User: florianauderset
 * Date: 18.12.15
 * Time: 12:13
 */
if (!isset($_COOKIE['locale'])) {
    $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
    $lang = $lang . "_" . strtoupper($lang);
    Trans::setDomain($lang);
    setcookie("locale", $lang, time() + 60 * 60 * 24 * 360);
}
function setNewLangInCookie()
{
    $_COOKIE['locale'] = Trans::getDomain();
    //setcookie("locale",Trans::getDomain(),time()+(60*60*24*360));
}
示例#3
0
文件: i18n.php 项目: audef1/myShop
<?php

/**
 * Created by PhpStorm.
 * User: florianauderset
 * Date: 04.12.15
 * Time: 11:41
 */
//Internationalisation
if (isset($_COOKIE['locale'])) {
    $locale = $_COOKIE['locale'];
    Trans::setDomain($locale);
}