本文整理匯總了PHP中Core::getObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP Core::getObject方法的具體用法?PHP Core::getObject怎麽用?PHP Core::getObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Core
的用法示例。
在下文中一共展示了Core::getObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadFields
protected function loadFields()
{
if (!is_array($this->fields)) {
$cache = Core::getObject('Core.Cache.CacheServer')->load('fields');
$this->fields = $cache->getFields($this->getClassPath());
}
}
示例2: checkACL
public static function checkACL($gid, $right)
{
$cache = Core::getObject('Core.Cache.CacheServer');
$p = $cache->load('permissions');
$acl = $p->getPermissions($gid);
if (isset($acl[$right])) {
return $acl[$right] == 1;
} else {
Core::throwError('No permission with name "' . $right . '" found.', INTERNAL_NOTICE);
return false;
}
}
示例3: parse
public function parse()
{
$__debug = Core::getObject('Core.System.Debug');
$__debug->startClock($this->file);
extract($this->vars, EXTR_SKIP);
ob_start();
include $this->file;
$contents = ob_get_contents();
ob_end_clean();
$this->time = $__debug->stopClock($this->file);
return $contents;
}
示例4: __autoload
/**
* Loads the required classes automatically from ClassManager (only indexed classes).
*
* @param string Class Name
*/
function __autoload($className)
{
if ($className === 'parent') {
// Avoid calling parent when using callback function.
// See: http://www.php.net/manual/de/function.call-user-func.php#106391
return;
}
$classManager = Core::getObject('Core.System.ClassManager');
if (Config::get('core.debug')) {
Core::throwError("Autoloaded class with name '{$className}'", INTERNAL_DEBUG);
}
$file = $classManager->loadFile($className);
if ($file == null) {
Core::throwError('Class "{$className}" not found', INTERNAL_ERROR);
}
}
示例5: __construct
public function __construct($package = 'Cms')
{
parent::__construct($package);
$cache = Core::getObject('Core.Cache.CacheServer');
$cache->setSourceDir('Cms.Cache.Items');
// URL => content for media-attribute
$this->cssFiles = array(URI::build('client/styles/stylesheet.css') => 'all');
// URL => content for type-attribute
$cdn = Config::get('ui.jquery_cdn');
$this->scriptFiles = array(URI::build($cdn ? $cdn : 'client/scripts/jquery/jquery.js') => 'text/javascript', URI::build('client/scripts/jquery/jquery.plugins.js') => 'text/javascript');
// Html to be placed into the head tag of the page (at last)
$this->headHtml = array();
Session::getObject();
// Init session
$this->breadcrumb = new Breadcrumb();
$this->breadcrumb->add(Config::get('general.title'), URI::frontPage());
}
示例6: loadACL
protected function loadACL()
{
if ($this->acl === null) {
$cache = Core::getObject('Core.Cache.CacheServer');
$p = $cache->load('permissions');
$this->acl = $p->getPermissions($this->getGroupId());
}
}
示例7: checkPassword
/**
* Checks whether a password is strong (true) enough or not (false).
*
* @param string $pw Password
* @return boolean
*/
public static function checkPassword($pw)
{
$pwo = Core::getObject('Core.Security.Password');
$quality = $pwo->check($pw);
$min_quality = Config::get('security.pwcheck');
return $quality >= $min_quality;
}
示例8: Core
/**
* Short form for Core::getObject().
*
* During implementation we tried several short forms and decided to take the last one:
* <code>
* Core::_(DB)->query("SQL"); // This is ugly
* Core::DB()->query("SQL"); // Ok, but slow (see php manual)
* Core::DB('query', "SQL"); // Alternative for the above
* Core::$DB->query("SQL"); // Not possible in PHP 5.3 (__getStatic, __setStatic), maybe
* // introduced in PHP 6, then the best option!
* Core(DB)->query("SQL"); // Short, fast, but not really oop. Seems to be the best one...
* </code>
*
* @param string|int Stored name of object as string or constant (internally that's an int)
* @return Object Stored object of a class
* @see Core::getObject()
*/
function Core($objectConst) {
return Core::getObject($objectConst);
}
示例9: getPkName
public function getPkName()
{
if ($this->pk == null) {
list($table, ) = explode('.', $this->params['source']);
$cache = Core::getObject('Core.Cache.CacheServer')->load('field_pk');
$this->pk = $cache->getPk($table);
}
return $this->pk;
}
示例10: invalidateCache
protected function invalidateCache()
{
$server = Core::getObject('Core.Cache.CacheServer');
if ($server != null) {
$cache = $server->load('fields');
if ($cache != null) {
$cache->delete();
}
}
}
示例11: __destruct
/**
* Destructs the ModuleObject.
*/
public function __destruct()
{
Core::destruct();
$debug = Core::getObject('Core.System.Debug');
$debug->stopClock($this->module);
}
示例12: throwError
/**
* Triggers an error message.
*
* The constants INTERNAL_ERROR (8), INTERNAL_WARNING (4), INTERNAL_NOTICE (2) and INTERNAL_DEBUG (0) can be used for the second parameter.
* Default value for the second parameter is INTERNAL_WARNING (4).
* INTERNAL_DEBUG does not throw any message to the user, it only adds the message to the log file.
*
* @param string Error message
* @param int Error reporting level
**/
public static function throwError($error, $warning = INTERNAL_WARNING)
{
$line = __LINE__;
$file = __FILE__;
if (function_exists('debug_backtrace') == true) {
$backtraceInfo = debug_backtrace();
if (isset($backtraceInfo[0]) == true) {
$file = $backtraceInfo[0]["file"];
$line = $backtraceInfo[0]["line"];
}
}
if ($warning == INTERNAL_ERROR) {
$warning = E_USER_ERROR;
} elseif ($warning == INTERNAL_NOTICE) {
$warning = E_USER_NOTICE;
} elseif ($warning == INTERNAL_DEBUG) {
} else {
$warning = E_USER_WARNING;
}
if ($warning != INTERNAL_DEBUG) {
$errorHandler = Core::getObject('Core.System.ErrorHandling');
$errorHandler->errorHandler($warning, $error, $file, $line);
} else {
$debug = Core::getObject('Core.System.Debug');
$debug->add($error);
}
}
示例13: deleteIndex
/**
* Deletes the index cache.
*
* @access private
*/
private function deleteIndex()
{
$cache = Core::getObject('Core.Cache.CacheServer');
$classesCache = $cache->load('classes');
$classesCache->delete();
}
示例14: getGroupId
public function getGroupId()
{
$cache = Core::getObject('Core.Cache.CacheServer');
$p = $cache->load('permissions');
return $p->getGuestID();
}
示例15: overview
protected function overview()
{
foreach ($this->getPositions() as $p) {
$cache = Core::getObject('Core.Cache.CacheServer')->load('fields');
$tpl = Response::getObject()->appendTemplate("/Cms/admin/fields");
$tpl->assign("data", $cache->getFields($p), false);
$tpl->assign('baseUri', $this->getBaseURI());
$tpl->output();
}
}