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


PHP Loader::instance方法代码示例

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


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

示例1: self

 /**
  * Return the object Loader
  * @return Loader
  */
 static function get_instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:jffuchs,项目名称:rainframework,代码行数:11,代码来源:Loader.php

示例2:

 function __construct(Local &$local = null)
 {
     if ($local) {
         $this->_local = $local;
     }
     self::$instance = $this;
 }
开发者ID:Calit2-UCI,项目名称:IoT_Map,代码行数:7,代码来源:loader.php

示例3: getInstance

 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:ivankruglyak,项目名称:mindk-kruglyak,代码行数:7,代码来源:Loader.php

示例4: getLoader

 public static function getLoader()
 {
     if (empty(self::$instance)) {
         self::$instance = new Loader();
     }
     return self::$instance;
 }
开发者ID:Kuturu,项目名称:mindk,代码行数:7,代码来源:Loader.php

示例5: getInstance

 /**
  * Возвращает лоадер-синглтон
  * @return Loader экземпляр лоадера
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new Loader();
     }
     return self::$instance;
 }
开发者ID:Artiomtb,项目名称:MindKBlog,代码行数:11,代码来源:Loader.php

示例6: getInstance

 /**
  * Getting Instance
  * @return object
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:tkaratug,项目名称:titan-mvc,代码行数:11,代码来源:Loader.php

示例7: getInstance

 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
开发者ID:AnaClaudiaConde,项目名称:teste-lazyphp,代码行数:8,代码来源:locale.php

示例8: getInstance

 public static function getInstance()
 {
     /**
      * Статическая функция, которая возвращает экземпляр класса или создает новый при необходимости
      * @return Loader
      */
     // проверяем актуальность экземпляра
     if (empty(self::$instance)) {
         // создаем новый экземпляр
         self::$instance = new self();
     }
     // возвращаем созданный или существующий экземпляр
     return self::$instance;
 }
开发者ID:GrigoriyDenisenko,项目名称:mk,代码行数:14,代码来源:Loader.php

示例9: module

 public function module($moduleName)
 {
     $modulePath = Path::instance()->evaluate('lib.module');
     if (file_exists($modulePath . "/{$moduleName}") && is_dir($modulePath . "/{$moduleName}")) {
         if (file_exists($modulePath . "/{$moduleName}/{$moduleName}.xml")) {
             if (is_readable($modulePath . "/{$moduleName}/{$moduleName}.xml")) {
                 foreach (ModuleConf::instance()->dependencies() as $dep) {
                     Loader::instance()->module($dep);
                 }
                 foreach (ModuleConf::instance()->includes() as $inc) {
                     Loader::instance()->inc($modulePath . "/{$moduleName}/" . trim($inc, '/'));
                 }
             } else {
                 return -2;
             }
         } else {
             return -1;
         }
     }
     return 0;
 }
开发者ID:neel,项目名称:bong,代码行数:21,代码来源:loader.php

示例10: addModel

 /**
  * Adiciona ao sitemap as páginas que são geradas pelos models, como páginas
  * com os textos das notícias, etc
  *
  * @version
  *     0.1 19/05/2010
  *         Inicial
  *     0.2. 02/11/2010
  *         - Busca por um coluna "modified" no Model informado, depois por uma
  *         "created", se não encontrar nenhuma das duas, coloca a data atual
  *         - Modificado o padrão de passagem de variáveis para :var ao invés
  *         de {var}.
  *         - Eliminado o uso de extract(), e iniciado o uso de String::insert(),
  *         nativa do framework
  *         - Adicionado suporte ao encadeamento de métodos
  *         - Renomeado para addModel()
  *  
  * @param string $model Nome do model a ser procurado
  * @param array $params Parâmetros a serem repassados para o método all()
  *     do model
  * @param array $configs Configurações individuais para cada model, nesse
  *     formato:
  *     array(
  *       'loc' => '/noticia/:id/:slug}',
  *       'lastmod' => ':modified',
  *       'changefreq' => 'daily'
  *       'priority' => '1'
  *    )
  *    Os textos no padrão ":nome" são os nomes das colunas do model
  *    informado, e serão substituídos pelos seus valores individuais
  *    quando o texto for gerado
  * @return void
  */
 public function addModel($model, $params = array(), $configs = array())
 {
     $results = Loader::instance('Model', $model)->all($params);
     $this->results[$model] = $results;
     $this->fields[$model] = array_keys(reset($results));
     //se lastmod nao for informado, verificar se modified existe nos campos, e
     //se nem existir nem for informado, adicionar a data atual
     if (!isset($configs['lastmod'])) {
         if (in_array('modified', $this->fields[$model])) {
             $configs['lastmod'] = ':modified';
         } elseif (in_array('created', $this->fields[$model])) {
             $configs['lastmod'] = ':created';
         } else {
             $configs['lastmod'] = date('r');
         }
     }
     $configs = array_merge(array('changefreq' => 'daily', 'priority' => 0.5), $configs);
     //pr($this->fields);
     foreach ($results as $row => $result) {
         $output = array('loc' => Mapper::url(String::insert($configs['loc'], $result), true), 'lastmod' => date('c', strtotime(String::insert($configs['lastmod'], $result))), 'priority' => $configs['priority'], 'changefreq' => $configs['changefreq']);
         $this->output[] = array_merge($configs, $output);
     }
     return $this;
 }
开发者ID:klawdyo,项目名称:spaghettiphp,代码行数:57,代码来源:SitemapHelper.php

示例11: startFromModel

 /**
  *	Inicia a configuração das colunas a partir de uma consulta a
  *	um model
  *	
  *	@param array $model O model em que será feita a busca
  *	@param array $conditions Os parâmetros de configuração para a
  *	    busca no model
  *	@return object
  */
 public function startFromModel($model, $params = array())
 {
     //Inicia os parâmetros da url
     $this->urlParams();
     //$model = ClassRegistry::load($model, 'Model'); //v 0.1
     $model = Loader::instance('Model', $model);
     //v 0.2
     $order = isset($this->urlParams['named']['order']) ? $this->urlParams['named']['order'] : $model->primaryKey;
     $order .= isset($this->urlParams['named']['by']) ? ' ' . $this->urlParams['named']['by'] : ' ASC';
     $model->order = $order;
     $this->start($model->all($params));
     return $this;
 }
开发者ID:klawdyo,项目名称:spaghetti-lib,代码行数:22,代码来源:XgridHelper.php

示例12: create

 /**
  * Cria o menu baseado no model
  *
  * @param string $model Nome do model
  * @param array $params Parâmetros para a busca no banco de dados
  * @param array $attrs Atributos para o menu gerado. Chaves permitidas:
  *         "class" define a class css do menu gerado
  *         "parentId" define a partir de qual parentId o menu será gerado
  * @return Menu formado
  */
 public function create($model, array $params = array(), array $attrs = array())
 {
     $this->modelObj = Loader::instance('Model', $model);
     if (!array_key_exists('parentId', $attrs)) {
         $parentId = 0;
     }
     $this->attrs = $attrs;
     return $this->generate($parentId, $params);
 }
开发者ID:klawdyo,项目名称:spaghettiphp,代码行数:19,代码来源:XmenuHelper.php

示例13: getInstance

 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         if (is_readable('vendor/autoload.php')) {
             self::$instance = (require 'vendor/autoload.php');
         } else {
             self::$instance = new Loader();
             $conf = json_decode(file_get_contents('composer.json'), true);
             $psr4 = $conf['autoload']['psr-4'];
             foreach ($psr4 as $key => &$value) {
                 self::$instance->setPsr4($key, $value);
             }
             self::$instance->register(true);
         }
     }
     return self::$instance;
 }
开发者ID:mirdware,项目名称:scoop,代码行数:17,代码来源:Loader.php

示例14: parse

 /**
  *	function parse()
  *	Gera um rss a partir de uma busca
  *	@version
  *	    0.1 03/06/2009  Método inicial
  *	    1.0 16/05/2010  Método refatorado completamente, renomeado, trocados
  *	        seus parâmetros, etc.
  *	
  *	@param $model O model a ser feita a busca
  *	@param $params Os parâmetros para a busca, será passado diretamente
  *	para o Model::all()
  */
 public function parse($model, $params = array())
 {
     //fazendo a busca
     $this->results = Loader::instance('Model', $model)->all($params);
     //pegando somente os campos
     $this->fields = !empty($this->results) ? array_keys(reset($this->results)) : array();
     //Limpando os campos "relations" que não existem em $this->allowedItems
     foreach ($this->config['relations'] as $key => $value) {
         if (!in_array($key, $this->allowedItems)) {
             unset($this->config['relations'][$key]);
         }
     }
     //Criando o cabeçalho
     $rss = new SimpleXmlElement('<?xml version="1.0" encoding="UTF-8" ?><rss xmlns:atom="http://www.w3.org/2005/Atom"></rss>');
     $rss->addAttribute('version', '2.0');
     $channel = $rss->addChild('channel');
     //verificando pelas tags permitidas, evitará a
     //inclusão de tags inválidas e poupará vários IFs.
     foreach ($this->allowedHeaders as $header) {
         if (!empty($this->config['headers'][$header])) {
             $channel->addChild($header, $this->format($this->config['headers'][$header], $header));
         }
     }
     //Procuro nos resultados
     foreach ($this->results as $row => $result) {
         $item = $channel->addChild("item");
         foreach ($this->config['relations'] as $key => $field) {
             $item->addChild($key, $this->format(String::insert($field, $result), $key));
             //                $item->addChild($key, $this->format($this->extract($field, $row), $key));
         }
     }
     return $rss->asXml();
 }
开发者ID:klawdyo,项目名称:spaghetti-lib,代码行数:45,代码来源:RssHelper.php

示例15: init

 /**
  * Inicia o helper a partir de um model
  *
  * @version 0.1 11/06/2011 Initial
  */
 public function init($modelName, $subMenuName)
 {
     #Resetando todas as configurações antes de inicar
     $this->reset();
     $this->modelObject = Loader::instance('Model', $modelName);
     $this->subMenuName = $subMenuName;
     return $this;
 }
开发者ID:klawdyo,项目名称:spaghettiphp,代码行数:13,代码来源:XnavHelper.php


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