public static function init() { try { if (!Schema::hasTable('sites')) { return static::setCurrent(new Site()); } } catch (\Exception $e) { return static::setCurrent(new Site()); } static::$baseUrl = $baseUrl = rtrim(config('app.url'), '/'); static::$domain = $domain = parse_url($baseUrl, PHP_URL_HOST); $basePath = parse_url($baseUrl, PHP_URL_PATH); static::$host = $host = parse_url(request()->root(), PHP_URL_HOST); if (false === strpos($host, $domain) && !request()) { throw new \Exception('Anda harus men-set konfigurasi domain ' . $domain); } $subdomain = $basePath ? null : rtrim(substr($host, 0, strlen($host) - strlen($domain)), '.'); if ($subdomain) { return static::initSubdomain($subdomain); } if ($site = static::getBySubfolder(new static())) { return static::setCurrent($site); } return static::setCurrent(new Site()); }
/** * @param string $domain 比如'bucket1'或是'bucket2.u' * @param null|string $bucketName bucket名,默认与$domain一致 */ public static function setDomain($domain, $bucketName = null) { static::$domain = $domain . '.qiniudn.com'; if (is_null($bucketName)) { $bucketName = $domain; } static::$bucketName = $bucketName; }
/** * 获取一级域名名称部分 * @access public * @author songdengtao <http://www.songdengtao.cn> * @return string */ public static function getDomain() { if (\Pandaphp::get('isCgi') && is_null(static::$domain)) { $domain = $_SERVER['HTTP_HOST']; $domain = strstr($domain, static::getDomainSuffix(), true); $domainArr = explode('.', $domain); $domain = array_pop($domainArr); static::$domain = $domain; } return static::$domain; }
protected static function write($level, $source, $message, $file, $line, $context) { // connect to redis server if (!isset(static::$socket)) { static::$socket = stream_socket_client(static::$server); if (static::$socket) { static::select(static::$db); static::$domain = array_key_exists('SERVER_NAME', $_SERVER) ? strtolower($_SERVER['SERVER_NAME']) : null; } } // make sure the socket was opened if (!static::$socket) { return false; } // generate the atomic log entry id # $id = static::incr(self::$channel . '.seq'); // construct the data record $record = json_encode(array('version' => static::VERSION, 'id' => $id, 'domain' => static::$domain, 'time' => time(), 'level' => $level, 'source' => $source, 'message' => $message, 'filename' => $file, 'line' => $line, 'context' => base64_encode(json_encode($context)))); static::publish(self::$channel, $record); return true; }
/** * Set Google apps domain * * @param string $domain Domain * * @return void */ public static function setDomain($domain) { static::$domain = $domain; }
/** * Set domain name * * @param string $url * * @return void */ public static function setDomain($url) { if (is_string($url)) { static::$domain = $url; } }
/** * Set the cookie key domain. * * @param string $domain Cookie key domain, or null for nothing. */ public static function setCookieDomain($domain) { static::$domain = $domain != null ? $domain : ''; }
/** * Default constructor * * @param BaseConverterInterface $baseConverter Converter * @param string $type OTP type * @param string $issuer Issuer * @param string $account Account * @param string $domain Domain * @param string $qrURL Base url for qr-code generator */ public function __construct(BaseConverterInterface $baseConverter, $type = OATH_TOTP, $issuer = '', $account = '', $domain = '', $qrURL = 'https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=') { static::$converter = $baseConverter; static::$type = $type; static::$issuer = $issuer; static::$account = $account; static::$domain = $domain; static::$qrURL = $qrURL; //static::$secret = static::$Secret(); }