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


PHP Smarty::addPluginsDir方法代码示例

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


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

示例1: __construct

 /**
  * @param waSystem $system
  * @param array $options
  * @return waSmarty3View
  */
 public function __construct(waSystem $system, $options = array())
 {
     $this->smarty = new Smarty();
     parent::__construct($system, $options);
     if (isset($options['auto_literal'])) {
         $this->smarty->auto_literal = $options['auto_literal'];
     }
     if (isset($options['left_delimiter'])) {
         $this->smarty->left_delimiter = $options['left_delimiter'];
     }
     if (isset($options['right_delimiter'])) {
         $this->smarty->right_delimiter = $options['right_delimiter'];
     }
     $this->smarty->setTemplateDir(isset($options['template_dir']) ? $options['template_dir'] : $system->getAppPath());
     $this->smarty->setCompileDir(isset($options['compile_dir']) ? $options['compile_dir'] : $system->getAppCachePath('templates/compiled/'));
     $this->smarty->setCacheDir($system->getAppCachePath('templates/cache/'));
     if (ini_get('safe_mode')) {
         $this->smarty->use_sub_dirs = false;
     } else {
         $this->smarty->use_sub_dirs = true;
     }
     // not use
     //$this->smarty->setCompileCheck(wa()->getConfig()->isDebug()?true:false);
     $this->smarty->addPluginsDir($system->getConfig()->getPath('system') . '/vendors/smarty-plugins');
     $this->smarty->loadFilter('pre', 'translate');
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:31,代码来源:waSmarty3View.class.php

示例2: initializeView

 /**
  * Initialize the view
  * Require the class to have an instance of the provider
  *
  * @param string $templateFolder Optional template folder to use instead of the default /frontend/module/views/
  * @return Viewable
  */
 protected function initializeView($templateFolder = null)
 {
     if (!$this->view) {
         $this->view = new \Smarty();
         $configuration = $this->getConfiguration();
         $appFolder = $configuration->get('system.app.folder');
         if ($templateFolder === null) {
             $module = $this->getModuleFromNamespace();
             $templateFolder = $appFolder . '/frontend/' . $module . '/views/';
         }
         // setup the template folder
         $this->view->setTemplateDir($templateFolder);
         // setup the temporary folders
         $tempFolder = $configuration->get('system.temp.folder');
         $this->view->setCompileDir($this->checkWritable($tempFolder . '/smarty_compiled/'));
         $this->view->setCacheDir($this->checkWritable($tempFolder . '/smarty_cache/'));
         $this->view->setConfigDir($this->checkWritable($tempFolder . '/smarty_config/'));
         // add all the plugin folders to the view
         foreach ($configuration->get('view.plugin.folders', array()) as $pluginFolder) {
             $this->view->addPluginsDir($pluginFolder);
         }
         $this->view->addPluginsDir($appFolder . '/../vendor/mystlabs/mistyforms/src/MistyForms/smarty_plugins');
         $this->view->addPluginsDir($appFolder . '/../vendor/mystlabs/mistyapp/src/MistyApp/smarty_plugins');
         // if we are in development mode we want to regenerate the views at every render
         if ($configuration->get('system.development.mode', false)) {
             $this->view->compile_check = true;
             $this->view->force_compile = true;
         }
     }
     return $this;
 }
开发者ID:mystlabs,项目名称:mistyapp,代码行数:38,代码来源:Viewable.php

示例3: rx_set_smarty_paths

function rx_set_smarty_paths(Smarty $viewModel)
{
    $viewModel->setTemplateDir(app\service\Smarty::$VIEW_PATH);
    $viewModel->setConfigDir(CONFIG_PATH);
    $CACHE_PATH = BUILD_PATH . 'smarty_cache';
    if (!file_exists($CACHE_PATH)) {
        if (!mkdir($CACHE_PATH, 0777, true)) {
            die('Failed to create folders:' . $CACHE_PATH);
        }
    }
    $viewModel->setCacheDir($CACHE_PATH);
    $TEMP_PATH = BUILD_PATH . 'smarty_temp';
    if (!file_exists($TEMP_PATH)) {
        if (!mkdir($TEMP_PATH, 0777, true)) {
            die('Failed to create folders:' . $TEMP_PATH);
        }
    }
    $viewModel->setCompileDir($TEMP_PATH);
    $LOCAL_PLUGIN_PATH = APP_PATH . "SMARTY_PLUGINS";
    if (file_exists($LOCAL_PLUGIN_PATH)) {
        $viewModel->addPluginsDir($LOCAL_PLUGIN_PATH);
    }
    foreach (app\service\Smarty::$PLUGINS_DIR as $path) {
        $viewModel->addPluginsDir($path);
    }
}
开发者ID:rudraks,项目名称:boot,代码行数:26,代码来源:rx_set_smarty_paths.php

示例4: get

 /**
  * Get the evaluated contents of the view.
  *
  * @param  string $path
  * @param  array  $data
  *
  * @throws \Exception
  * @return string
  */
 public function get($path, array $data = array())
 {
     ob_start();
     try {
         $smarty = new \Smarty();
         $smarty->caching = $this->config->get('smarty-view::caching');
         $smarty->debugging = $this->config->get('smarty-view::debugging');
         $smarty->cache_lifetime = $this->config->get('smarty-view::cache_lifetime');
         $smarty->compile_check = $this->config->get('smarty-view::compile_check');
         $smarty->error_reporting = $this->config->get('smarty-view::error_reporting');
         if (\App::environment('local')) {
             $smarty->force_compile = true;
         }
         $smarty->setTemplateDir($this->config->get('smarty-view::template_dir'));
         $smarty->setCompileDir($this->config->get('smarty-view::compile_dir'));
         $smarty->setCacheDir($this->config->get('smarty-view::cache_dir'));
         $smarty->registerResource('view', new ViewResource());
         $smarty->addPluginsDir(__DIR__ . '/plugins');
         foreach ((array) $this->config->get('smarty-view::plugins_path', array()) as $pluginPath) {
             $smarty->addPluginsDir($pluginPath);
         }
         foreach ($data as $key => $value) {
             $smarty->assign($key, $value);
         }
         $smarty->display($path);
     } catch (\Exception $e) {
         ob_get_clean();
         throw $e;
     }
     return ltrim(ob_get_clean());
 }
开发者ID:vi-kon,项目名称:laravel-smarty-view,代码行数:40,代码来源:SmartyView.php

示例5: initTemplateEngine

 /**
  * Initialise Twig
  *
  * @return void
  */
 protected function initTemplateEngine()
 {
     $this->loader = new \Smarty();
     $this->loader->muteExpectedErrors();
     $this->loader->setTemplateDir($this->getTemplateDir());
     $this->loader->addPluginsDir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'SmartyPlugins');
     $this->initSmartyCache();
     Logger::debug("Smarty Cache: " . $this->loader->getCacheDir());
 }
开发者ID:chrisnoden,项目名称:synergy,代码行数:14,代码来源:SmartyTemplate.php

示例6: _initalizeSmarty

 protected function _initalizeSmarty()
 {
     $configKey = $this->_sConfigKey;
     $caching = $this->config[$configKey . 'caching'];
     $cache_lifetime = $this->config[$configKey . 'cache_lifetime'];
     $debugging = $this->config[$configKey . 'debugging'];
     $template_path = $this->config[$configKey . 'template_path'];
     $compile_path = $this->config[$configKey . 'compile_path'];
     $cache_path = $this->config[$configKey . 'cache_path'];
     // Get the plugins path from the configuration
     $plugins_paths = $this->config[$configKey . 'plugins_paths'];
     //$this->_oSmarty = new \Smarty();
     require_once dirname(__FILE__) . '/Smarty/libs/Smarty.class.php';
     $this->_oSmarty = new \Smarty();
     $this->_oSmarty->setTemplateDir($template_path);
     $this->_oSmarty->setCompileDir($compile_path);
     $this->_oSmarty->setCacheDir($cache_path);
     // Add the plugin folder from the config to the Smarty object.
     // Note that I am using addPluginsDir here rather than setPluginsDir
     // because I want to add a secondary folder, not replace the
     // existing folder.
     foreach ($plugins_paths as $path) {
         $this->_oSmarty->addPluginsDir($path);
     }
     $this->_oSmarty->debugging = $debugging;
     $this->_oSmarty->caching = $caching;
     $this->_oSmarty->cache_lifetime = $cache_lifetime;
     $this->_oSmarty->compile_check = true;
 }
开发者ID:srit83,项目名称:laravel-smarty,代码行数:29,代码来源:SmartyEngine.php

示例7: renderHTML

 /**
  * Render the template and return the HTML content
  *
  * @author salvipascual
  * @param Service $service, service to be rendered
  * @param Response $response, response object to render
  * @return String, template in HTML
  * @throw Exception
  */
 public function renderHTML($service, $response)
 {
     // get the path
     $di = \Phalcon\DI\FactoryDefault::getDefault();
     $wwwroot = $di->get('path')['root'];
     // select the right file to load
     if ($response->internal) {
         $userTemplateFile = "{$wwwroot}/app/templates/{$response->template}";
     } else {
         $userTemplateFile = "{$wwwroot}/services/{$service->serviceName}/templates/{$response->template}";
     }
     // creating and configuring a new Smarty object
     $smarty = new Smarty();
     $smarty->addPluginsDir("{$wwwroot}/app/plugins/");
     $smarty->setTemplateDir("{$wwwroot}/app/layouts/");
     $smarty->setCompileDir("{$wwwroot}/temp/templates_c/");
     $smarty->setCacheDir("{$wwwroot}/temp/cache/");
     // disabling cache and debugging
     $smarty->force_compile = true;
     $smarty->debugging = false;
     $smarty->caching = false;
     // list the system variables
     $systemVariables = array("APRETASTE_USER_TEMPLATE" => $userTemplateFile, "APRETASTE_SERVICE_NAME" => strtoupper($service->serviceName), "APRETASTE_SERVICE_RELATED" => $this->getServicesRelatedArray($service->serviceName), "APRETASTE_SERVICE_CREATOR" => $service->creatorEmail, "APRETASTE_TOP_AD" => "", "APRETASTE_BOTTOM_AD" => "");
     // merge all variable sets and assign them to Smarty
     $templateVariables = array_merge($systemVariables, $response->content);
     $smarty->assign($templateVariables);
     // renderig and removing tabs, double spaces and break lines
     $renderedTemplate = $smarty->fetch("email_default.tpl");
     return preg_replace('/\\s+/S', " ", $renderedTemplate);
 }
开发者ID:Apretaste,项目名称:Sandbox,代码行数:39,代码来源:Render.php

示例8: __invoke

 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $config = $container->get('Configuration');
     $config = $config['smarty'];
     /** @var $pathResolver \Zend\View\Resolver\TemplatePathStack */
     $pathResolver = clone $container->get('ViewTemplatePathStack');
     $pathResolver->setDefaultSuffix($config['suffix']);
     /** @var $resolver \Zend\View\Resolver\AggregateResolver */
     $resolver = $container->get('ViewResolver');
     $resolver->attach($pathResolver);
     $engine = new \Smarty();
     $engine->setCompileDir($config['compile_dir']);
     $engine->setEscapeHtml($config['escape_html']);
     $engine->setTemplateDir($pathResolver->getPaths()->toArray());
     $engine->setCaching($config['caching']);
     $engine->setCacheDir($config['cache_dir']);
     $engine->addPluginsDir($config['plugins_dir']);
     if (file_exists($config['config_file'])) {
         $engine->configLoad($config['config_file']);
     }
     $renderer = new Renderer();
     $renderer->setEngine($engine);
     $renderer->setSuffix($config['suffix']);
     $renderer->setResolver($resolver);
     return $renderer;
 }
开发者ID:skillfish,项目名称:zf3-smarty-module,代码行数:26,代码来源:RendererFactory.php

示例9: tpl_display

function tpl_display($view = '', $vars = array())
{
    $dir_sep = DIRECTORY_SEPARATOR;
    $dir_base = __DIR__ . $dir_sep;
    $dir_smarty = $dir_base . implode($dir_sep, array('..', 'smarty-3.1.16', 'libs', ''));
    $dir_tpls = $dir_base . 'tpls' . $dir_sep;
    $dir_tplc = $dir_base . 'tplc' . $dir_sep;
    $dir_plgs = $dir_base . 'plugins' . $dir_sep;
    require_once $dir_smarty . 'Smarty.class.php';
    $smarty = new Smarty();
    $smarty->left_delimiter = '<%';
    $smarty->right_delimiter = '%>';
    $smarty->setTemplateDir($dir_tpls);
    $smarty->setCompileDir($dir_tplc);
    $smarty->addPluginsDir($dir_plgs);
    $smarty->registerFilter('pre', 'tpl_pre_filter');
    if (isset($vars['debug'])) {
        $smarty->force_compile = true;
    }
    $smarty->assign($vars);
    $smarty->display($view . '.tpl');
    if (isset($vars['debug'])) {
        $smarty->clearCompiledTemplate();
    }
}
开发者ID:i6ma,项目名称:snp,代码行数:25,代码来源:viewer.php

示例10: __construct

 /**
  * Constructor of the class
  */
 public function __construct($tpl_name = null)
 {
     $smarty = new Smarty();
     // TODO: remove "APP_LOCAL_PATH" from the list in 2.4.1
     $smarty->setTemplateDir(array(APP_LOCAL_PATH . '/templates', APP_LOCAL_PATH, APP_TPL_PATH));
     $smarty->setCompileDir(APP_TPL_COMPILE_PATH);
     $smarty->addPluginsDir(array(APP_INC_PATH . '/smarty'));
     $smarty->registerPlugin('modifier', 'activateLinks', array('Link_Filter', 'activateLinks'));
     $smarty->registerPlugin('modifier', 'activateAttachmentLinks', array('Link_Filter', 'activateAttachmentLinks'));
     $smarty->registerPlugin('modifier', 'formatCustomValue', array('Custom_Field', 'formatValue'));
     $smarty->registerPlugin('modifier', 'bool', array('Misc', 'getBooleanDisplayValue'));
     $smarty->registerPlugin('modifier', 'format_date', array('Date_Helper', 'getFormattedDate'));
     // Fixes problem with CRM API and dynamic includes.
     // See https://code.google.com/p/smarty-php/source/browse/trunk/distribution/3.1.16_RELEASE_NOTES.txt?spec=svn4800&r=4800
     if (isset($smarty->inheritance_merge_compiled_includes)) {
         $smarty->inheritance_merge_compiled_includes = false;
     }
     // this avoids loading it twice when using composer
     if (function_exists('smarty_block_t')) {
         $smarty->registerPlugin('block', 't', 'smarty_block_t');
     }
     if ($tpl_name) {
         $this->setTemplate($tpl_name);
     }
     $this->smarty = $smarty;
 }
开发者ID:korusdipl,项目名称:eventum,代码行数:29,代码来源:class.template_helper.php

示例11: evaluatePath

 /**
  * Get the evaluated contents of the view at the given path.
  *
  * @param string $path
  * @param array $data
  * @return string
  */
 protected function evaluatePath($__path, $__data)
 {
     $caching = $this->config('caching');
     $cache_lifetime = $this->config('cache_lifetime');
     $debugging = $this->config('debugging');
     $template_path = $this->config('template_path');
     $compile_path = $this->config('compile_path');
     $cache_path = $this->config('cache_path');
     $plugins_paths = (array) $this->config('plugins_paths');
     $config_paths = (array) $this->config('config_paths');
     $escape_html = $this->config('escape_html', false);
     // Create smarty object.
     $smarty = new \Smarty();
     $smarty->setTemplateDir($template_path);
     $smarty->setCompileDir($compile_path);
     $smarty->setCacheDir($cache_path);
     foreach ($plugins_paths as $path) {
         $smarty->addPluginsDir($path);
     }
     foreach ($config_paths as $path) {
         $smarty->setConfigDir($path);
     }
     $smarty->debugging = $debugging;
     $smarty->caching = $caching;
     $smarty->cache_lifetime = $cache_lifetime;
     $smarty->compile_check = true;
     // set the escape_html flag from the configuration value
     //
     $smarty->escape_html = $escape_html;
     $smarty->error_reporting = E_ALL & ~E_NOTICE;
     foreach ($__data as $var => $val) {
         $smarty->assign($var, $val);
     }
     return $smarty->fetch($__path);
 }
开发者ID:guguanghai,项目名称:smarty,代码行数:42,代码来源:SmartyEngine.php

示例12: InitializeSmarty

 /**
  * Initialize smarty
  */
 protected function InitializeSmarty()
 {
     require_once GITPHP_SMARTYDIR . 'Smarty.class.php';
     $this->tpl = new Smarty();
     $this->tpl->error_reporting = E_ALL & ~E_NOTICE;
     $this->tpl->merge_compiled_includes = true;
     $this->tpl->addPluginsDir(GITPHP_INCLUDEDIR . 'smartyplugins');
     if ($this->config->GetValue('cache')) {
         $cacheDir = GITPHP_CACHEDIR . 'templates';
         if (file_exists($cacheDir)) {
             if (!is_dir($cacheDir)) {
                 throw new Exception($cacheDir . ' exists but is not a directory');
             } else {
                 if (!is_writable($cacheDir)) {
                     throw new Exception($cacheDir . ' is not writable');
                 }
             }
         } else {
             if (!mkdir($cacheDir, 0777)) {
                 throw new Exception($cacheDir . ' could not be created');
             }
             chmod($cacheDir, 0777);
         }
         $this->tpl->setCacheDir($cacheDir);
         $this->tpl->caching = Smarty::CACHING_LIFETIME_SAVED;
         if ($this->config->HasKey('cachelifetime')) {
             $this->tpl->cache_lifetime = $this->config->GetValue('cachelifetime');
         }
         $servers = $this->config->GetValue('memcache');
         if (isset($servers) && is_array($servers) && count($servers) > 0) {
             $this->tpl->registerCacheResource('memcache', new GitPHP_CacheResource_Memcache($servers));
             $this->tpl->caching_type = 'memcache';
         }
     }
 }
开发者ID:hmcclungiii,项目名称:gitphp,代码行数:38,代码来源:ControllerBase.class.php

示例13: action_default

 public function action_default()
 {
     if (\count($this->arguments) < 2) {
         \Core::show_404();
     }
     $uri_arr = $this->arguments;
     $app = \array_shift($uri_arr) . DS . \array_shift($uri_arr);
     if (!$uri_arr) {
         $uri_arr = array('index');
     }
     # 检查是否已开启
     if (!is_file(\DIR_APPS . $app . \DS . '.installed')) {
         $this->show_error('指定的APP还没有安装,请先安装');
     }
     # 配置文件
     $config_file = \DIR_APPS . $app . \DS . 'config.ini';
     # 读取配置文件
     if (\is_file($config_file)) {
         $app_config = @\parse_ini_file($config_file, \INI_SCANNER_NORMAL, true);
         if (!$app_config) {
             $app_config = array();
         }
     }
     # 当前控制器
     $controller = \DIR_APPS . $app . \DS . '[admin]' . \DS . \implode(\DS, $uri_arr) . '.html';
     if (!\is_file($controller)) {
         $this->show_error('指定的APP控制器不存在');
     }
     # 载入APP类库
     $libraries = \Core::config('core.libraries.app');
     if ($libraries) {
         # 逆向排序
         \rsort($libraries);
         foreach ($libraries as $library_name) {
             if (!$library_name) {
                 continue;
             }
             \Core::import_library($library_name);
         }
     }
     # Smarty缓存目录
     $big_dir = \DIR_CACHE . 'apps' . \DS . $app . \DS . 'smarty' . \DS . 'admin' . \DS;
     $smarty = new \Smarty();
     # 设置缓存目录
     $smarty->setCacheDir($big_dir . 'cache' . \DS);
     # 设置模板编译目录
     $smarty->setCompileDir($big_dir . 'templates_c' . \DS);
     # 设置模板目录
     $smarty->setTemplateDir(\DIR_APPS . $app . \DS . '[admin]' . \DS . 'tpl' . \DS);
     foreach (\Core::$include_puth as $path) {
         if (\is_dir($path . 'smarty_plugins')) {
             # 增加Smarty插件目录
             $smarty->addPluginsDir($path . 'smarty_plugins');
         }
     }
     # 输出
     $smarty->display($controller);
 }
开发者ID:google2013,项目名称:myqee,代码行数:58,代码来源:apps.controller.php

示例14: __construct

 /**
  * Constructor
  *
  * @param string $tmplPath
  * @param array $extraParams
  * @return void
  */
 public function __construct($tmplPath = null, $extraParams = array())
 {
     $this->_smarty = new Smarty();
     $this->_config = Zend_Registry::get('config');
     $this->_router = Zend_Registry::get('router');
     $templates_dir = $this->_config->serviceDir . "core";
     $this->_smarty->addPluginsDir($templates_dir . '/modules/calendar/site/smarty');
     $this->setScriptPath($templates_dir);
     $this->_smarty->template_dir = $templates_dir;
     $this->_smarty->compile_dir = $this->_config->serviceDir . $this->_config->view->compile_dir;
     /*	 dostep do _router z poziomu szablonow	*/
     $this->_smarty->assign('router', $this->_router);
     $this->_smarty->assign('config', $this->_config);
     foreach ($extraParams as $key => $value) {
         $this->_smarty->{$key} = $value;
     }
     //$this->_smarty->registerPlugin("function","import_css", "import_css");
 }
开发者ID:adammajchrzak,项目名称:silesiamaps,代码行数:25,代码来源:View.php

示例15: setConfigure

 /**
  * smarty
  * @access private
  * @return void
  */
 private function setConfigure()
 {
     $this->smarty->left_delimiter = Config::get('smarty::left_delimiter');
     $this->smarty->right_delimiter = Config::get('smarty::right_delimiter');
     $this->smarty->setTemplateDir(Config::get('smarty::template_path'));
     $this->smarty->setCompileDir(Config::get('smarty::compile_path'));
     $this->smarty->setCacheDir(Config::get('smarty::cache_path'));
     //
     foreach (Config::get('smarty::plugins_paths') as $plugins) {
         $this->smarty->addPluginsDir($plugins);
     }
     $this->smarty->debugging = Config::get('smarty::debugging');
     $this->smarty->caching = Config::get('smarty::caching');
     $this->smarty->cache_lifetime = Config::get('smarty::cache_lifetime');
     $this->smarty->compile_check = Config::get('smarty::compile_check');
     $this->smarty->force_compile = true;
     $this->smarty->error_reporting = E_ALL & ~E_NOTICE;
 }
开发者ID:ytake,项目名称:laravel-smarty,代码行数:23,代码来源:SmartyManager.php


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