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


PHP PluginRegistry::initPlugin方法代码示例

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


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

示例1: _load

 /**
  * tries to include the requested plugin and returns the plugin class name, or false if plugin not found.
  * @param string $pluginName name of the plugin
  * @return string class name or false if not found
  */
 protected function _load($pluginName, $section)
 {
     $cleanName = FileUtils::sanitize($pluginName);
     $className = strtolower("Plugins_{$cleanName}_{$section}");
     if (M::resolve_class($className, 'plugins', function () use($cleanName) {
         PluginRegistry::initPlugin($cleanName);
     })) {
         return $className;
     }
 }
开发者ID:demental,项目名称:m,代码行数:15,代码来源:PluginRegistry.php

示例2: generate_migration

 public function generate_migration($name, $format = 'php', $pluginName = '')
 {
     if (!empty($pluginName)) {
         $basepath = PluginRegistry::initPlugin($pluginName);
     } else {
         $basepath = APP_ROOT;
     }
     $file = $basepath . 'db/migrations/' . date('YmdHi') . '_' . Strings::snake($name) . '.' . $format;
     $classname = Strings::camel($name);
     $source = file_get_contents(dirname(__FILE__) . '/generate/migration/' . $format . '.tpl');
     $source = str_replace('[MIGRATION_NAME]', $classname, $source);
     file_put_contents($file, $source);
     $this->line($file . ' created');
 }
开发者ID:demental,项目名称:m,代码行数:14,代码来源:generate.php

示例3: fetch

 public function fetch($tplfile)
 {
     if (!is_array($tplfile)) {
         $tplfile = array($tplfile);
     }
     $buffer = ob_get_contents();
     ob_clean();
     extract($this->_assignvars);
     $included = false;
     foreach ($tplfile as $file) {
         $pluginfile = explode(':', $file);
         if (count($pluginfile) == 2) {
             PluginRegistry::initPlugin($pluginfile[0]);
             $file = $pluginfile[1];
             $this->_config['tplfolders'] = array('M/plugins/' . $pluginfile[0] . '/templates/', APP_ROOT . 'app/plugins/' . $pluginfile[0] . '/templates/');
         }
         $this->_tplfile = $file;
         if ($tpl = $this->getTemplatePath()) {
             ob_start();
             $bf = trim($buffer);
             if (!empty($bf)) {
                 echo $this->comment('Start include ' . $file);
             }
             include $tpl;
             if (!empty($bf)) {
                 echo $this->comment('End include ' . $file);
             }
             $included = true;
             $ret = ob_get_contents();
             ob_clean();
             echo $buffer;
             foreach ($this->_postFilters as $filter) {
                 $filter->execute($ret);
             }
             return $ret;
             break;
         }
     }
     echo $buffer;
     ob_clean();
     throw new Exception('Fichier ' . print_r($tplfile, true) . ' introuvable dans dossier(s) ' . print_r($this->_config['tplfolders'], true));
 }
开发者ID:demental,项目名称:m,代码行数:42,代码来源:Mtpl.php

示例4: array

 /**
  *
  * description
  *
  * @param $modulename
  * @param $path
  * @param $params
  * @return unknown_type
  */
 public static function &factory($modulename, $path = null, $params = null)
 {
     if (empty($path)) {
         $path = array('modules');
     }
     if (!is_array($path)) {
         $path = array($path);
     }
     Log::info('Module::factory ' . $modulename);
     $plugmod = explode(':', $modulename);
     $moduleOpt = PEAR::getStaticProperty('Module', 'global');
     $optionsGroup = PEAR::getStaticProperty('Options', 'group');
     if ($plugmod[1]) {
         Log::info('Calling plugin module ' . $modulename);
         PluginRegistry::initPlugin($plugmod[0]);
         $path = array(APP_ROOT . 'app/plugins/' . $plugmod[0] . '/modules/', 'plugins/' . $plugmod[0] . '/modules/');
         $moduleOpt['template_dir'][] = 'plugins/' . $plugmod[0] . '/templates/';
         $moduleOpt['template_dir'][] = APP_ROOT . 'app/plugins/' . $plugmod[0] . '/templates/';
         $modulename = $plugmod[1];
         $className = $plugmod[0] . '_Module_' . $modulename;
     } else {
         $className = 'Module_' . $modulename;
     }
     $i = false;
     foreach ($path as $aPath) {
         if (@(include_once $aPath . '/' . $modulename . '.php')) {
             $i = true;
             break;
         }
     }
     if (!$i) {
         Log::info('Module::factory ' . $modulename . ' not found in path ' . implode(',', $path));
         throw new Error404Exception("No {$modulename} module in path " . implode(',', $path));
     }
     Log::info('Module::factory ' . $modulename . ' OK');
     $module = new $className($modulename);
     $module->_path = $path;
     Log::info('Generating options');
     $options = $module->generateOptions($moduleOpt, $optionsGroup);
     $module->setConfig($options);
     $module->setParams($params);
     $module->startView();
     Log::info('Module::factory ' . $className . ' configured');
     return $module;
 }
开发者ID:demental,项目名称:m,代码行数:54,代码来源:Module.php


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