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


PHP Dwoo::getLoader方法代码示例

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


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

示例1: init

 /**
  * Component initialization
  */
 function init()
 {
     Yii::import('application.vendors.*');
     // need this since Yii autoload handler raises an error if class is not found
     spl_autoload_unregister(array('YiiBase', 'autoload'));
     // registering Dwoo autoload handler
     require_once 'Dwoo/dwooAutoload.php';
     // adding back Yii autoload handler
     spl_autoload_register(array('YiiBase', 'autoload'));
     // compiled templates directory
     $compileDir = Yii::app()->getRuntimePath() . '/dwoo/compiled/';
     // create compiled directory if not exists
     if (!file_exists($compileDir)) {
         mkdir($compileDir, $this->filePermission, true);
     }
     // cached templates directory
     $cacheDir = Yii::app()->getRuntimePath() . '/dwoo/cache/';
     // create compiled directory if not exists
     if (!file_exists($cacheDir)) {
         mkdir($cacheDir, $this->filePermission, true);
     }
     $this->dwoo = new Dwoo($compileDir, $cacheDir);
     $loader = $this->dwoo->getLoader();
     // adding extension plugin directory
     $loader->addDirectory(Yii::getPathOfAlias('application.extensions.Dwoo.plugins'));
     // adding config plugin directory if specified
     if (!empty($this->pluginsDir)) {
         $loader->addDirectory(Yii::getPathOfAlias($this->pluginsDir));
     }
 }
开发者ID:sinelnikof,项目名称:yiiext,代码行数:33,代码来源:EDwooViewRenderer.php

示例2: testLoaderGetSet

 public function testLoaderGetSet()
 {
     $dwoo = new Dwoo(DWOO_COMPILE_DIR, DWOO_CACHE_DIR);
     $loader = new Dwoo_Loader(TEST_DIRECTORY . '/temp/cache');
     $dwoo->setLoader($loader);
     $this->assertEquals($loader, $dwoo->getLoader());
 }
开发者ID:apeschar,项目名称:php-fw,代码行数:7,代码来源:LoaderTests.php

示例3: render

 /**
  * {@inheritdoc}
  */
 public function render($viewName, Model $model, NotificationCenter $notificationCenter, $output = true)
 {
     Profile::start('Renderer', 'Generate HTML');
     $templateName = $viewName . '.' . static::$templateFileExtension;
     $dwoo = new Dwoo($this->compiledPath, $this->cachePath);
     $dwoo->getLoader()->addDirectory($this->functionsPath);
     Profile::start('Renderer', 'Create template file.');
     $template = new Dwoo_Template_File($templateName);
     $template->setIncludePath($this->getTemplatesPath());
     Profile::stop();
     Profile::start('Renderer', 'Render');
     $dwooData = new Dwoo_Data();
     $dwooData->setData($model->getData());
     $dwooData->assign('errorMessages', $notificationCenter->getErrors());
     $dwooData->assign('successMessages', $notificationCenter->getSuccesses());
     $this->setHeader('Content-type: text/html', $output);
     // I do never output directly from dwoo to have the possibility to show an error page if there was a render error.
     $result = $rendered = $dwoo->get($template, $dwooData, null, false);
     if ($output) {
         echo $result;
     }
     Profile::stop();
     Profile::stop();
     return $output ? null : $rendered;
 }
开发者ID:enyo,项目名称:rincewind,代码行数:28,代码来源:DwooRenderer.php

示例4: Dwoo_Plugin_format_text

function Dwoo_Plugin_format_text(Dwoo $dwoo, $text, $format = 'plain', $mode = 'format')
{
    switch ($format) {
        case 'html':
            if ($mode == 'strip') {
                return strip_tags($text);
            } else {
                return $text;
            }
        case 'micstext':
            // load plugin
            if (function_exists('Dwoo_Plugin_micstext') === false) {
                $dwoo->getLoader()->loadPlugin('micstext');
            }
            return Dwoo_Plugin_micstext($dwoo, $text, $mode);
        default:
        case 'plain':
            return nl2br(htmlspecialchars($text));
    }
}
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:20,代码来源:format_text.php

示例5: getPluginType

 /**
  * returns the plugin type of a plugin and adds it to the used plugins array if required
  *
  * @param string $name plugin name, as found in the template
  * @return int type as a multi bit flag composed of the Dwoo plugin types constants
  */
 protected function getPluginType($name)
 {
     $pluginType = -1;
     if ($this->securityPolicy === null && (function_exists($name) || strtolower($name) === 'isset' || strtolower($name) === 'empty') || $this->securityPolicy !== null && in_array(strtolower($name), $this->securityPolicy->getAllowedPhpFunctions()) !== false) {
         $phpFunc = true;
     }
     while ($pluginType <= 0) {
         if (isset($this->customPlugins[$name])) {
             $pluginType = $this->customPlugins[$name]['type'] | Dwoo::CUSTOM_PLUGIN;
         } elseif (class_exists('Dwoo_Plugin_' . $name, false) !== false) {
             if (is_subclass_of('Dwoo_Plugin_' . $name, 'Dwoo_Block_Plugin')) {
                 $pluginType = Dwoo::BLOCK_PLUGIN;
             } else {
                 $pluginType = Dwoo::CLASS_PLUGIN;
             }
             $interfaces = class_implements('Dwoo_Plugin_' . $name, false);
             if (in_array('Dwoo_ICompilable', $interfaces) !== false || in_array('Dwoo_ICompilable_Block', $interfaces) !== false) {
                 $pluginType |= Dwoo::COMPILABLE_PLUGIN;
             }
         } elseif (function_exists('Dwoo_Plugin_' . $name) !== false) {
             $pluginType = Dwoo::FUNC_PLUGIN;
         } elseif (function_exists('Dwoo_Plugin_' . $name . '_compile')) {
             $pluginType = Dwoo::FUNC_PLUGIN | Dwoo::COMPILABLE_PLUGIN;
         } elseif (function_exists('smarty_modifier_' . $name) !== false) {
             $pluginType = Dwoo::SMARTY_MODIFIER;
         } elseif (function_exists('smarty_function_' . $name) !== false) {
             $pluginType = Dwoo::SMARTY_FUNCTION;
         } elseif (function_exists('smarty_block_' . $name) !== false) {
             $pluginType = Dwoo::SMARTY_BLOCK;
         } else {
             if ($pluginType === -1) {
                 try {
                     $this->dwoo->getLoader()->loadPlugin($name, isset($phpFunc) === false);
                 } catch (Exception $e) {
                     if (isset($phpFunc)) {
                         $pluginType = Dwoo::NATIVE_PLUGIN;
                     } elseif (is_object($this->dwoo->getPluginProxy()) && $this->dwoo->getPluginProxy()->handles($name)) {
                         $pluginType = Dwoo::PROXY_PLUGIN;
                         break;
                     } else {
                         throw $e;
                     }
                 }
             } else {
                 throw new Dwoo_Exception('Plugin "' . $name . '" could not be found');
             }
             $pluginType++;
         }
     }
     if (($pluginType & Dwoo::COMPILABLE_PLUGIN) === 0 && ($pluginType & Dwoo::NATIVE_PLUGIN) === 0 && ($pluginType & Dwoo::PROXY_PLUGIN) === 0) {
         $this->usedPlugins[$name] = $pluginType;
     }
     return $pluginType;
 }
开发者ID:stormeus,项目名称:Kusaba-Z,代码行数:60,代码来源:Compiler.php


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