当前位置: 首页>>代码示例>>PHP>>正文


PHP registry::getInstance方法代码示例

本文整理汇总了PHP中registry::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP registry::getInstance方法的具体用法?PHP registry::getInstance怎么用?PHP registry::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在registry的用法示例。


在下文中一共展示了registry::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     $registry = registry::getInstance();
     $path = empty($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == "/" ? $registry->config['default_controller'] : ltrim(strtolower($_SERVER['REQUEST_URI']), "/");
     if (strstr($path, "/")) {
         $arr = explode('/', $path);
         $page = $arr[0];
         $action = empty($arr[1]) ? 'index' : $arr[1];
     } else {
         $page = $path;
         $action = "index";
     }
     $file = 'application/controllers/controller.' . $page . '.php';
     if (file_exists($file)) {
         $class = strtolower($page);
         if (class_exists($class)) {
             $controller = new $class();
             if (!is_callable(array($controller, $action))) {
                 $this->handle404();
             } else {
                 $controller->{$action}();
             }
         } else {
             $this->handle404();
         }
     } else {
         $this->handle404();
     }
 }
开发者ID:Si2k63,项目名称:mvc_framework,代码行数:29,代码来源:router.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     $this->registry = registry::getInstance();
     $this->html = html::getInstance();
     $this->plugin = plugin::getInstance();
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:7,代码来源:appcontroller.php

示例3: __construct

 function __construct()
 {
     parent::__construct();
     $this->registry = registry::getInstance();
     $this->addAction('index_init', 'init');
     $this->addAction('index_load', 'addToolbar');
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:7,代码来源:debug.plugin.php

示例4: __construct

 /**
  * @author Damien Lasserre <dlasserre@talen.com>
  * @param $_config_file
  */
 public function __construct($_config_file)
 {
     /** @var string $log_path */
     $log_path = APPLICATION_PATH . '/tmp/application.log';
     if (file_exists($_config_file)) {
         /** @var array $_attributes */
         $_attributes = parse_ini_file($_config_file, true);
         /** @var definition\config[] $_config */
         $_config = new \stdClass();
         foreach ($_attributes as $_env => $_parameters) {
             if ($_env == APPLICATION_ENV) {
                 foreach ($_parameters as $_parameter => $value) {
                     /** @var definition\config _parameter */
                     $_config->{$_parameter} = new definition\config();
                     $_config->{$_parameter}->_setName($_parameter)->_setValue($value)->_activate();
                 }
             }
         }
         if (isset($_config->log_path) and $_config->log_path->isActivated()) {
             $log_path = $_config->log_path;
         }
         if (is_file($log_path)) {
             defined('APPLICATION_PATH_LOG') || define('APPLICATION_PATH_LOG', $log_path);
         }
         $this->_configuration = $_config;
         /** Set in registry */
         registry::getInstance()->add('config', $this);
     }
 }
开发者ID:dlasserre,项目名称:uranium,代码行数:33,代码来源:config.php

示例5: execute

 /**
  * executes all controllers and compile the final HTML Document.
  *
  * @return string finalHTML
  */
 public function execute()
 {
     if (HANDHELD) {
         header('Pragma: public');
         header("Expires: " . gmdate("Y-m-d\\TH:i:s\\Z", time() + 60 * 30));
         header('Cache-Control: no-store, must-revalidate, post-check=0, pre-check=0, no-transform, max-age=1800');
     }
     foreach ($this->mountPoints as $column => $controllers) {
         ${$column} = "";
         foreach ($controllers as $c) {
             ${$column} .= $c->execute();
         }
     }
     $pageTitle = $this->title;
     $pageDescription = $this->description;
     $bodyClass = $this->bodyClass;
     foreach (registry::getInstance() as $k => $v) {
         ${$k} = $v;
     }
     isset($contentType) ? http_response::content($contentType) : http_response::content(CONTENT_TYPE);
     ob_start();
     require $this->file;
     // output is gzipped and minified (NO; PROBLEMS WITH CODE BLOCKS!).
     // ob_postprocess(trim(preg_replace('/\s+/', ' ', ob_get_clean())));
     echo ob_get_clean();
 }
开发者ID:madr,项目名称:urban-octo-rotary-phone,代码行数:31,代码来源:page.php

示例6: __construct

 public function __construct($mountPoints = false)
 {
     $this->file = VIEW . '/layout.phtml';
     $reg =& registry::getInstance();
     $mountPoints = $mountPoints !== false ? $mountPoints : $reg['columns'];
     foreach ($mountPoints as $wrap) {
         $this->mountPoints[$wrap] = array();
     }
 }
开发者ID:madr,项目名称:urban-octo-rotary-phone,代码行数:9,代码来源:route.php

示例7: getModels

 static function getModels()
 {
     // registry preparation
     $registry = registry::getInstance();
     // validate input
     $modelId = http_request::getString('model');
     $entityId = http_request::getString('entityId');
     // get all models
     $registry['models'] = new model_dir(ROOT . '/model');
 }
开发者ID:madr,项目名称:urban-octo-rotary-phone,代码行数:10,代码来源:admin.php

示例8: __construct

 public function __construct()
 {
     $this->registry = registry::getInstance();
     $this->path = $this->registry["path"];
     $this->html = html::getInstance();
     $this->session = $this->registry["session"];
     $this->cookie = $this->registry["cookie"];
     $this->ajax = new ajax();
     $this->l10n = l10n::getInstance();
 }
开发者ID:ravenlp,项目名称:FlavorPHP,代码行数:10,代码来源:views.class.php

示例9: __construct

 function __construct()
 {
     parent::__construct();
     $this->registry = registry::getInstance();
     if (!defined('GESHI_VERSION')) {
         require_once Absolute_Path . "app/plugins/geshi/GeSHi.php";
     }
     $this->addAction('index_post_content', 'source_code_beautifier');
     $this->addAction('admin_comments_content', 'comment_source_code_beautifier');
     $this->addAction('index_comment_content', 'comment_source_code_beautifier');
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:11,代码来源:kodrs.plugin.php

示例10: open

 /**
  * @author Damien Lasserre <dlasserre@talend.com>
  * @param string $_path
  * @param null $_session_id
  * @return bool|void
  * @throws \Exception
  */
 public function open($_path, $_session_id = null)
 {
     /** @var array $_config */
     $_config = registry::getInstance()->get('config');
     if (extension_loaded('memcached')) {
         $memcached = new \Memcached();
         $memcached->addServer($_config['memcached_host'], $_config['memcached_port']);
         $this->_memcached = $memcached;
     } else {
         throw new \Exception('Memcached was not installed, please install');
     }
 }
开发者ID:dlasserre,项目名称:uranium,代码行数:19,代码来源:session.php

示例11: find

 public static function find($arr, $fields = null)
 {
     $class = get_called_class();
     $registry = registry::getInstance();
     $registry->db->select(is_array($fields) && count($fields) > 0 ? implode(",", $fields) : '*')->from($class)->where($arr);
     $rows = $registry->db->fetch();
     $count = count($rows);
     if ($count) {
         return $count == 1 ? $rows[0] : $rows;
     } else {
         return false;
     }
 }
开发者ID:Si2k63,项目名称:mvc_framework,代码行数:13,代码来源:model.php

示例12: __construct

 function __construct($alias, $values = NULL)
 {
     if ($alias) {
         $this->registry = registry::getInstance();
         $db = $this->registry->get('db');
         $rs = $db->query("SELECT * FROM `email_template` WHERE `alias`=" . $db->escape($alias)) or die(__METHOD__ . ': ' . $db->lastError);
         if ($sa = $db->fetch($rs)) {
             $this->loadDataFromArray($sa);
         }
         $this->attachments = EmailTemplateAttachment::getList($this->id);
         $this->embedded = EmailTemplateEmbedded::getList($this->id);
     }
 }
开发者ID:jne21,项目名称:hatatool,代码行数:13,代码来源:EmailTemplate.php

示例13: getInstance

 /**
  * @author Damien Lasserre <damien.lasserre@gmail.com>
  * @param null $_adapter
  * @return cache
  *
  * @description simple singleton
  */
 public static function getInstance($_adapter = null)
 {
     if (null === $_adapter) {
         /** @var array $_config */
         $_config = registry::getInstance()->get('config');
         /** @var string $_adapter */
         $_adapter = $_config['cache_adapter'];
     }
     if (!is_array(self::$_instance) or array_key_exists($_adapter, self::$_instance)) {
         self::$_instance[$_adapter] = new cache($_adapter);
     }
     /** Return */
     return self::$_instance[$_adapter];
 }
开发者ID:dlasserre,项目名称:uranium,代码行数:21,代码来源:cache.php

示例14: getList

 function getList($templateId)
 {
     $this->templateId = intval($templateId);
     $result = [];
     if ($this->templateId) {
         $this->registry = registry::getInstance();
         $db = $this->registry->get(static::DB);
         $rs = $db->query("SELECT * FROM `" . static::TABLE . "` WHERE `email_template_id`=" . $this->templateId) or die(__METHOD__ . ': ' . $db->lastError);
         while ($sa = $db->fetch($rs)) {
             $item = new static();
             $item->loadDataFromArray($sa);
         }
     }
     return $result;
 }
开发者ID:jne21,项目名称:hatatool,代码行数:15,代码来源:EmailTemplateAttachmentAbstract.php

示例15: __construct

 public function __construct()
 {
     parent::__construct();
     $R = registry::getInstance();
     $class = $R->router->getClass();
     if ($class["action"] != "login" && $class["action"] != "logout") {
         if ($this->session->check("logged") == false) {
             $this->redirect("admin/login/nosession/");
         }
     }
     $this->plugin->call('admin_init');
     $C = new configuration();
     $this->blogConfig = $C->getBlogConfiguration();
     $this->userConf = $C->getUserConfiguration(1);
     $this->view->blogConfig = $this->blogConfig;
     $this->view->userConf = $this->userConf;
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:17,代码来源:admin_controller.php


注:本文中的registry::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。