本文整理匯總了PHP中SiteConfig::compile方法的典型用法代碼示例。如果您正苦於以下問題:PHP SiteConfig::compile方法的具體用法?PHP SiteConfig::compile怎麽用?PHP SiteConfig::compile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SiteConfig
的用法示例。
在下文中一共展示了SiteConfig::compile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Creates a new site:
* starts the timing clock (if enabled)
* creates the SiteLayout if not set
* sets up config
*/
private function __construct()
{
if (isset(self::$TheSite)) {
throw new RuntimeException('Site already set to ' . get_class(self::$TheSite));
}
self::$TheSite = $this;
set_error_handler(array($this, 'dispatchError'), E_ALL | E_RECOVERABLE_ERROR);
set_exception_handler(array($this, 'dispatchException'));
$start = array(microtime(true), 'start');
$this->timePoint('start');
if (!isset($this->url)) {
$this->url = dirname($_SERVER['PHP_SELF']);
if ($this->url == '/') {
$this->url = '';
}
}
$proto = 'http';
$port = '';
if (isset($_SERVER['SERVER_PORT'])) {
if ($_SERVER['SERVER_PORT'] == 443) {
$proto = 'https';
} elseif ($_SERVER['SERVER_PORT'] != 80) {
$port = ':' . $_SERVER['SERVER_PORT'];
}
}
$this->serverUrl = "{$proto}://" . $_SERVER['SERVER_NAME'] . $port;
try {
if (!isset($this->layout)) {
$this->layout = new SiteLayout($this);
}
// The log starts off in an unconfigured state where it accumulates
// messages until configuration is done and it's told what to do with
// them; however if something goes wrong early on, it dumps all logged
// messages
$this->log = new SiteLog($this);
$this->config = new SiteConfig($this);
$this->config->addFile(Loader::$FrameworkPath . '/config.ini');
new SiteModuleLoader($this);
$this->dispatchCallback('onConfig', $this);
$this->config->addFile(Loader::$LocalPath . '/config.ini');
$this->config->addFile(Loader::$Base . '/siteconfig.ini');
$this->config->compile();
$this->dispatchCallback('onPostConfig', $this);
} catch (SiteConfigParseException $ex) {
$this->printErrorPage('Error loading onfiguration', "<h1>Error loading configuration:</h1>\n" . "<pre>" . $ex->getMessage() . "</pre>\n");
exit(1);
}
$this->timing = $this->isDebugMode();
if ($this->timing) {
array_push($this->timePoints, $start);
}
}