本文整理汇总了PHP中SiteConfig::addFile方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteConfig::addFile方法的具体用法?PHP SiteConfig::addFile怎么用?PHP SiteConfig::addFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteConfig
的用法示例。
在下文中一共展示了SiteConfig::addFile方法的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);
}
}