本文整理汇总了PHP中Director::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Director::getInstance方法的具体用法?PHP Director::getInstance怎么用?PHP Director::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Director
的用法示例。
在下文中一共展示了Director::getInstance方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* Reads project's and default .ini file, sets project handler's
* and initializes paths.
* @param location config file
*/
public function __construct($urlPrefix)
{
$this->director = Director::getInstance();
$this->log = Logger::getInstance();
$this->urlPrefix = $urlPrefix;
$this->objects = array();
}
示例2: __construct
/**
* Constructor
*
* retrieves instance of Director {@link $director}
* sets pager key and url {@link $pagerKey}, {@link $pagerUrl}
* initialize sqlParser {@link $sqlParser}
*/
protected function __construct()
{
$this->log = Logger::getInstance();
$this->director = Director::getInstance();
$this->pagerKey = 'page';
$this->pagerUrl = new Url(true);
$this->sqlParser = new SqlParser();
$this->orderStatement = array();
}
示例3: __construct
public function __construct()
{
$this->director = Director::getInstance();
if (!function_exists("xmlrpc_server_create")) {
require_once "xmlrpc/xmlrpc.inc";
require_once "xmlrpc/xmlrpcs.inc";
require_once "xmlrpc/xmlrpc_wrappers.inc";
require_once "xmlrpc/xmlrpc_extension_api.inc";
}
$this->server = xmlrpc_server_create();
$this->log = Logger::getInstance();
}
示例4: __construct
/**
* constructor
* @return void
*/
private function __construct()
{
//$this->log = LoggerManager::getLogger(get_class($this));
$director = Director::getInstance();
$this->logfile = $director->getConfig()->log_file;
foreach (split(',', $director->getConfig()->log_enable) as $item) {
switch (trim($item)) {
case 'info':
$this->enableList[] = self::INFO;
case 'warning':
$this->enableList[] = self::WARNING;
case 'error':
$this->enableList[] = self::ERROR;
}
}
$this->setMaxFileSize($director->getConfig()->log_size);
$this->messages = array();
}
示例5: handleDbError
public static function handleDbError($theme)
{
$director = Director::getInstance();
$template = $theme->getTemplate();
$template->setVariable('siteTitle', 'DIF', false);
$content = '<h1>Welcome to DIF, the Dynamic Information Framework!</h1>
<p>This screen shows that DIF is working but not configured yet.<br />
Please <a href="' . $director->getConfig()->admin_path . '">login</a> and proceed with the configuration.</p>';
$template->setVariable($theme->getConfig()->main_tag, $content, false);
}
示例6: fetchTheme
public function fetchTheme()
{
$this->handleInitFetchTheme();
$cache = Cache::getInstance();
$template = $this->getTemplate();
// handle tag preprocessing
foreach ($this->tagTemplate as $key => $value) {
$data = trim($template->getVariable($key));
if (!$data) {
continue;
}
$tagTemplate = new TemplateEngine($value['file']);
$tagTemplate->setVariable($value['tag'], $data);
$template->setVariable($key, $tagTemplate, true, true);
}
// create unique filename for javascript and css files
$request = Request::getInstance();
$director = Director::getInstance();
$siteGroup = $director->siteGroup;
//FIXME remove user specific javascript
$stylesheet = $this->getClassName() . "stylesheet.css";
$javascript = $this->getClassName() . "javascript.js";
// write content to file
if (!$cache->isCached($stylesheet)) {
}
if ($this->getConfig()->stylesheet) {
$this->addStylesheet($this->fetchFile($this->getStyleSheetFile()));
}
$stylesheetDestFile = $this->getCachePath(true) . $stylesheet;
if ($cache->isCacheEnabled()) {
$stylesheetCacheFile = $cache->save(join("\n", $this->cssFiles), $stylesheet);
copy($stylesheetCacheFile, $stylesheetDestFile);
chmod($stylesheetDestFile, 0644);
} else {
$this->writeToFile($this->cssFiles, $stylesheetDestFile);
}
$this->addHeader('<link href="' . $this->getCachePath() . $stylesheet . '" rel="stylesheet" type="text/css" media="screen" />');
if (!$cache->isCached($javascript)) {
$javascriptDestFile = $this->getCachePath(true) . $javascript;
if ($cache->isCacheEnabled()) {
$javascriptCacheFile = $cache->save(join("\n", $this->jsFiles), $javascript);
copy($javascriptCacheFile, $javascriptDestFile);
chmod($javascriptDestFile, 0644);
} else {
$this->writeToFile($this->cssFiles, $stylesheetDestFile);
}
}
$this->addHeader('<script type="text/javascript" src="' . $this->getCachePath() . $javascript . '"></script>');
// make sure no duplicate javascript files are included because functions are already defined than.
$headers = array_unique($this->headers);
$template->setVariable('htmlheaders', join("\n", $headers), false);
// process system messages
$template->setVariable('htmlheaders', join("\n", $headers), false);
return $template->fetch();
}
示例7: define
<?php
define('DIF_VIRTUAL_WEB_ROOT', "/htdocs/");
define('DIF_INDEX_ROOT', dirname(__FILE__) . "/");
define('DIF_WEB_ROOT', realpath(DIF_INDEX_ROOT) . DIF_VIRTUAL_WEB_ROOT);
define('DIF_ROOT', realpath(DIF_WEB_ROOT . "/../dif") . "/");
define('DIF_SYSTEM_ROOT', realpath(DIF_WEB_ROOT . "../data") . "/");
require_once DIF_ROOT . 'utils/Utils.php';
require_once DIF_ROOT . 'utils/Timer.php';
// include external tools
Utils::setIncludePath();
$timer = Timer::getInstance();
require_once DIF_ROOT . "/core/Director.php";
$director = Director::getInstance();
$director->main();
//echo ' Executed in '. $timer->getTime().' seconds';
//echo '<!-- Executed in '. $timer->getTime().' seconds -->';
/*
$cache = Cache::getInstance();
$request = Request::getInstance();
Utils::debug(sprintf("%s : Executed in %s seconds (%s)", $request->getPath(), $timer->getTime(), $cache->isCached() ? 'CACHED' : 'GENERATED'), 'timer.log');
*/
示例8: __construct
public function __construct()
{
$this->director = Director::getInstance();
$this->initialize();
}
示例9: getBackdoorName
private function getBackdoorName()
{
$director = Director::getInstance();
return $director->getConfig()->login_name;
}
示例10: getTree
/**
* retrieves the tree
*
* @param boolean clone true if tree has to be cloned
* @return DOMXpath tree
*/
public function getTree($clone = false, $type = Tree::TREE_DEFAULT)
{
/*
TODO dit is de werkwijze van een database tree
kijk of xml bestand bestaat en geef terug
haal tabel op en creer xml met dom
schrijf xml weg naar bestand
bij een wijziging, gooi het xml bestand weg
voer AdminTree xml functies uit (in standaard abstracte klasse..
tree is abstract en gebruikt xml functies, implementatie gebruikt eventueel een dbConnector object.
*/
if ($type == Tree::TREE_DEFAULT) {
if (isset($this->tree)) {
if (!$clone) {
return $this->tree;
}
$doc = clone $this->doc;
return new DOMXPath($doc);
}
} elseif ($type == Tree::TREE_ORIGINAL) {
if (isset($this->treeOriginal)) {
if (!$clone) {
return $this->treeOriginal;
}
$doc = clone $this->doc;
return new DOMXPath($doc);
}
}
$this->docOriginal = new DOMDocument('1.0', 'iso-8859-1');
$cache = Cache::getInstance();
if (!$cache->isCached(__CLASS__)) {
$node = $this->docOriginal->createElement($this->rootName);
$root = $this->docOriginal->appendChild($node);
$searchcriteria = array('sitegroup_id' => $this->sitegroupId);
// create a reference list with node id as key
$nodelist = array();
$list = $this->systemSite->getList($searchcriteria);
foreach ($list['data'] as $item) {
$nodelist[$item['id']] = $item;
}
// retrieve acl list
$auth = Authentication::getInstance();
$acl = new Acl();
$this->isAdmin = $auth->isRole(SystemUser::ROLE_ADMIN);
$this->aclList = $acl->getAclList($searchcriteria);
$this->userGroupList = $auth->getGroup();
$this->director = Director::getInstance();
foreach ($nodelist as $item) {
$this->createNode($this->docOriginal, $root, $nodelist, $item);
}
$cache->save($this->docOriginal->saveXML(), __CLASS__);
} else {
$this->docOriginal->loadXML($cache->getCache(__CLASS__));
}
$this->treeOriginal = new DOMXpath($this->docOriginal);
// filter tree
$this->doc = new DOMDocument('1.0', 'iso-8859-1');
if (!$cache->isCached(__CLASS__ . "filter")) {
$this->doc = clone $this->docOriginal;
$this->tree = new DOMXPath($this->doc);
$this->filterTree();
$cache->save($this->doc->saveXML(), __CLASS__ . "filter");
} else {
$this->doc->loadXML($cache->getCache(__CLASS__ . "filter"));
$this->tree = new DOMXPath($this->doc);
}
/*
// We don't want to bother with white spaces
$doc->preserveWhiteSpace = false;
$doc->Load($this->xmlfile);
*/
if ($type == Tree::TREE_ORIGINAL) {
return $this->treeOriginal;
} else {
return $this->tree;
}
}
示例11: __construct
/**
* Constructor
*
* Reads project's and default .ini file, sets project handler's
* and initializes paths.
* @param location config file
*/
private function __construct()
{
$this->view = array(self::OVERVIEW => 'overzicht', self::ADMIN_OVERVIEW => 'overzicht', self::ADMIN_NEW => 'nieuw', self::ADMIN_EDIT => 'bewerken', self::ADMIN_DELETE => 'verwijderen', self::TREE_OVERVIEW => 'overzicht', self::TREE_NEW => 'nieuw', self::TREE_EDIT => 'bewerken', self::TREE_DELETE => 'verwijderen', self::CONF_OVERVIEW => 'overzicht', self::CONF_NEW => 'nieuw', self::CONF_EDIT => 'bewerken', self::CONF_DELETE => 'verwijderen');
// use different url id so normal section and admin section does not interfere
$director = Director::getInstance();
$this->urlId = $director->isAdminSection() ? self::URL_KEY_ADMIN : self::URL_KEY_DEFAULT;
$request = Request::getInstance();
$value = '';
if ($request->exists($this->urlId)) {
$value = $request->getValue($this->urlId);
} elseif ($request->getValue('REQUEST_METHOD', Request::SERVER) == 'POST' && $request->exists($this->urlId, Request::SESSION)) {
$value = $request->getValue($this->urlId, Request::SESSION);
}
// if type is userdefined, then this cannot be done
//if(!array_key_exists($value, $this->view)) $value = self::OVERVIEW;
$this->setType($value);
}