當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Factory::plugin方法代碼示例

本文整理匯總了PHP中Factory::plugin方法的典型用法代碼示例。如果您正苦於以下問題:PHP Factory::plugin方法的具體用法?PHP Factory::plugin怎麽用?PHP Factory::plugin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Factory的用法示例。


在下文中一共展示了Factory::plugin方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: foreach

 /**
  * Import a helper (aka "template plugin").
  * @param string $name Helper name
  *
  */
 function &import_helper($name)
 {
     foreach (func_get_args() as $name) {
         $class =& Factory::plugin($name, 'template');
         if ($class === false) {
             trigger_error("Helper {$name} does not exist");
             die;
         }
     }
     if ($class) {
         return $class;
     }
 }
開發者ID:jvinet,項目名稱:pronto,代碼行數:18,代碼來源:template.php

示例2: depend

 /**
  * Load another plugin as a dependency of this one.  Plugins can
  * only load dependencies of their own kind.  Templates plugins
  * load template plugins, page plugins load page plugins.
  *
  * @param string $plugin The name of the plugin to import.  Will be
  *                       saved as $this->depends->$plugin
  */
 function depend($plugin)
 {
     switch (substr(get_class($this), 0, 2)) {
         case 'tp':
             $type = 'template';
             break;
         case 'pp':
             $type = 'page';
             break;
     }
     foreach (func_get_args() as $arg) {
         $this->depends->{$arg} =& Factory::plugin($arg, $type);
     }
 }
開發者ID:jvinet,項目名稱:pronto,代碼行數:22,代碼來源:plugin.php

示例3: I18N

// TODO: this should be unset, left for back-compat for now...
//unset($db);
/************************************************************************
 * INTERNATIONALIZATION
 ************************************************************************/
$i18n = new I18N();
$i18n->autoset_language('en');
define('LANG', $i18n->get_language());
Registry::set('pronto:i18n', $i18n);
unset($i18n);
/************************************************************************
 * PRELOAD PLUGINS
 ************************************************************************/
foreach (explode(' ', PLUGINS) as $p) {
    if ($p) {
        Factory::plugin($p, 'page');
    }
}
unset($p);
// left in the symbol table for the cmdline script
$plugins =& Registry::get('pronto:plugins');
/************************************************************************
 * REMAINING UTILITY CLASSES
 ************************************************************************/
$p = new Validator();
Registry::set('pronto:validator', $p);
unset($p);
/************************************************************************
 * HANDLE ERRORS/DEBUGGING/PROFILING
 ************************************************************************/
error_reporting(E_ALL & ~E_NOTICE);
開發者ID:jvinet,項目名稱:pronto,代碼行數:31,代碼來源:cmdline.php

示例4: foreach

 /**
  * Import a plugin (aka "page plugin").
  * @param string $name Plugin name
  */
 function &import_plugin($name)
 {
     foreach (func_get_args() as $name) {
         $class =& Factory::plugin($name, 'page');
         if ($class === false) {
             trigger_error("Plugin {$name} does not exist");
             die;
         }
     }
     // reload $this->plugins
     $this->plugins =& Registry::get('pronto:plugins');
     if ($class) {
         return $class;
     }
 }
開發者ID:jvinet,項目名稱:pronto,代碼行數:19,代碼來源:model.php

示例5:

 /**
  * Return a new helper (aka "template plugin") object
  * If an existing helper object already exists, it will be used.
  *
  * @param string $name
  * @return object
  */
 function &helper($name)
 {
     return Factory::plugin($name, 'template');
 }
開發者ID:jvinet,項目名稱:pronto,代碼行數:11,代碼來源:factory.php


注:本文中的Factory::plugin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。