Ejemplo n.º 1
0
 public static function env($checkget = true)
 {
     if ($checkget && Req::hasget('environment')) {
         return Req::get('environment');
     }
     $serverName = $_SERVER['SERVER_NAME'];
     return isset(Config::$baseurl[$serverName]) ? Config::$baseurl[$serverName] : 'production';
 }
Ejemplo n.º 2
0
 public static function env()
 {
     if (Req::hasget('development')) {
         Lib::cookie()->set('development', Req::get('development'));
     }
     if (Lib::cookie()->get('development')) {
         return 'development';
     }
     return self::$env;
 }
Ejemplo n.º 3
0
 public static function url($key, $options = array(), $external = false)
 {
     $values = array();
     $link = $external ? Config::getHTMLBase() : '';
     if (Req::hasget('environment')) {
         $options['environment'] = Req::get('environment');
     }
     if (Config::$sef) {
         Lib::load('router');
         $segments = array();
         foreach (Router::getRouters() as $router) {
             if (is_string($router->allowedBuild) && $key !== $router->allowedBuild) {
                 continue;
             }
             if (is_array($router->allowedBuild) && !in_array($key, $router->allowedBuild)) {
                 continue;
             }
             $router->encode($key, $options, $segments);
         }
         if (!empty($segments)) {
             $link .= implode('/', $segments);
         }
     } else {
         $link .= 'index.php';
     }
     if (!empty($options)) {
         $values = array();
         foreach ($options as $k => $v) {
             $values[] = urlencode($k) . '=' . urlencode($v);
         }
         $queries = implode('&', $values);
         if (!empty($queries)) {
             $queries = '?' . $queries;
         }
         $link .= $queries;
     }
     return $link;
 }