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; }
public static function init() { self::$isLocal = Cml::getContainer()->make('cml_environment')->getEnv(); }