Exemplo n.º 1
0
 public function before()
 {
     $parentReturn = parent::before();
     \Fuel\Core\Lang::load("global");
     \Fuel\Core\Lang::load("share");
     $this->template->jsVars = new JsVars();
     $this->template->jsVars->addVar("wsUrl", rtrim(Router::get("ws_" . $this->lang), "/") . "/");
     $this->template->jsVars->addVar("baseUrl", \Fuel\Core\Uri::base(FALSE));
     $this->template->css = array("fonts.css", "normalize.css", "definitions.css", "template.css", "sprites/generic.css");
     $this->template->js = array("libs/jquery-2.1.3.min.js", "libs/jquery-ui.min.js", "libs/mustache.js", "template.js");
     $this->template->header = "front_header";
     $this->template->set_global(array("menu_selected" => ""));
     $this->template->footer = "front_footer";
     $this->template->footer_options = array();
     $fbShare = array("share" => FALSE, "siteName" => '', "title" => '', "description" => '', "image" => '');
     $this->template->fbShare = $fbShare;
     return $parentReturn;
 }
Exemplo n.º 2
0
 public static function switch_language($other_lang)
 {
     $url = \Fuel\Core\Router::get('home_en') . '/';
     $switch_page = '';
     $params = array();
     $current_lang = \Fuel\Core\Lang::get_lang();
     // Loop through routes
     foreach (\Fuel\Core\Router::$routes as $key => $route) {
         // If there's segments in route (weird, but that tells us that it's the current route...!)
         if (count($route->segments) > 0) {
             if (strpos($key, '_' . $current_lang, strlen($key) - strlen('_' . $current_lang)) !== false) {
                 $switch_page = str_replace('_' . $current_lang, '_' . $other_lang, $key);
                 $params = $route->method_params;
             }
             $url = rtrim(\Fuel\Core\Router::get($switch_page, $route->named_params), "/") . "/";
             foreach ($params as $param) {
                 if ($param != $current_lang && $param != $other_lang) {
                     $url .= $param . '/';
                 }
             }
         }
     }
     return $url;
 }