예제 #1
0
파일: Config.php 프로젝트: zonquan/cmlphp
 public static function init()
 {
     if (Request::isCli()) {
         self::$isLocal = 'cli';
         return true;
     }
     switch ($_SERVER['HTTP_HOST']) {
         case $_SERVER['SERVER_ADDR']:
             // no break
         // no break
         case '127.0.0.1':
             //no break
         //no break
         case 'localhost':
             self::$isLocal = 'development';
             return true;
     }
     if (isset($_SERVER['SERVER_NAME'])) {
         $host = $_SERVER['SERVER_NAME'];
     } else {
         $host = $_SERVER['HTTP_HOST'];
         if ($_SERVER['SERVER_PORT'] != 80) {
             $host = explode(':', $host);
             $host = $host[0];
         }
     }
     $domain = substr($host, strrpos($host, '.') + 1);
     if ($domain == 'dev' || $domain == 'loc') {
         self::$isLocal = 'development';
         return true;
     }
     if (substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], '.')) == '192') {
         self::$isLocal = 'development';
     }
     return true;
 }
예제 #2
0
 public static function init()
 {
     self::$isLocal = Cml::getContainer()->make('cml_environment')->getEnv();
 }