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


PHP Smarty::muteExpectedErrors方法代码示例

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


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

示例1: 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

示例2: run

 public static function run($action)
 {
     ConfigurationChecks::loadChecks();
     ConfigurationChecks::performChecks();
     $smarty = new Smarty();
     $smarty->muteExpectedErrors();
     $smarty->setCacheDir(SYSTEM_ROOT . '/classes/smarty/cache/');
     $smarty->setCompileDir(SYSTEM_ROOT . '/classes/smarty/templates_c/');
     $smarty->setTemplateDir(SYSTEM_ROOT . '/install/view/');
     $smarty->caching = Smarty::CACHING_OFF;
     $smarty->force_compile = true;
     $smarty->assign('title', 'Installation');
     switch ($action) {
         case 'tables':
             self::insertTables($smarty);
             break;
         case 'user':
             self::createUser($smarty);
             break;
         case 'success':
             self::success($smarty);
             break;
         default:
             self::checkRequirements($smarty);
             break;
     }
 }
开发者ID:nicefirework,项目名称:sharecloud,代码行数:27,代码来源:index.php

示例3: _muteErrors

 protected function _muteErrors()
 {
     if ($this->nMuteErrorsCnt <= 0) {
         $this->oSmarty->muteExpectedErrors();
         $this->nMuteErrorsCnt++;
     }
 }
开发者ID:anp135,项目名称:altocms,代码行数:7,代码来源:Viewer.class.php

示例4: populateTimestamp

 /**
  * populate Source Object with timestamp and exists from Resource
  *
  * @param Smarty_Template_Source $source source object
  * @return void
  */
 public function populateTimestamp(Smarty_Template_Source $source)
 {
     Smarty::muteExpectedErrors();
     $source->timestamp = @filemtime($source->filepath);
     Smarty::unmuteExpectedErrors();
     $source->exists = !!$source->timestamp;
 }
开发者ID:harmofwk,项目名称:harmofwk,代码行数:13,代码来源:smarty_internal_resource_php.php

示例5: populateTimestamp

 /**
  * populate Cached Object with timestamp and exists from Resource
  *
  * @param Smarty_Template_Cached $cached cached object
  * @return void
  */
 public function populateTimestamp(Smarty_Template_Cached $cached)
 {
     Smarty::muteExpectedErrors();
     $cached->timestamp = @filemtime($cached->filepath);
     Smarty::unmuteExpectedErrors();
     $cached->exists = !!$cached->timestamp;
 }
开发者ID:harmofwk,项目名称:harmofwk,代码行数:13,代码来源:smarty_internal_cacheresource_file.php

示例6: render

 public function render(string $path, array $attributes) : string
 {
     $smarty = new \Smarty();
     $smarty->setCompileDir($this->tempPath . "/smarty/templates_c/")->setCacheDir($this->tempPath . "/smarty/cache/")->error_reporting = E_ALL & ~E_NOTICE;
     \Smarty::muteExpectedErrors();
     $smarty->assign($attributes);
     $result = $smarty->fetch($path);
     return $result;
 }
开发者ID:wispira,项目名称:framework,代码行数:9,代码来源:Smarty.php

示例7: __construct

 public function __construct()
 {
     ob_start();
     $logErrors = (new Config())->get('dev');
     if ($logErrors) {
         set_error_handler(function ($errNo, $errStr, $errFile, $errLine) {
             self::addError("{$errStr} occurred on {$errFile}:{$errLine}");
         });
         set_exception_handler(function ($exception) {
             self::addError($exception->__toString());
         });
         \Smarty::muteExpectedErrors();
     }
 }
开发者ID:ryanknu,项目名称:zule-framework,代码行数:14,代码来源:Suggester.php

示例8: testMutedCaching

 public function testMutedCaching()
 {
     $this->_errors = array();
     set_error_handler(array($this, 'error_handler'));
     Smarty::muteExpectedErrors();
     $this->smarty->caching = true;
     $this->smarty->clearCache('default.tpl');
     $this->smarty->clearCompiledTemplate('default.tpl');
     $this->smarty->fetch('default.tpl');
     $this->assertEquals($this->_errors, array());
     @filemtime('ckxladanwijicajscaslyxck');
     $error = array(__FILE__ . ' line ' . (__LINE__ - 1));
     $this->assertEquals($error, $this->_errors);
     Smarty::unmuteExpectedErrors();
     restore_error_handler();
 }
开发者ID:jjs180,项目名称:dance-america,代码行数:16,代码来源:MuteExpectedErrorsTests.php

示例9: getSmarty

 /**
  * @return \Smarty
  */
 public static function getSmarty()
 {
     if (!static::$smarty) {
         require_once DOCROOT . '../vendor/smarty/smarty/libs/Smarty.class.php';
         $smarty = new \Smarty();
         $smarty->template_dir = DOCROOT . '../app/views';
         $smarty->compile_dir = DOCROOT . '../templates_c';
         $smarty->error_reporting = E_ALL & ~E_NOTICE;
         $smarty->error_unassigned = false;
         //$smarty->force_compile = true;
         // Странно что это вообще понядобилось
         $smarty->muteExpectedErrors();
         $smarty->registerPlugin('modifier', 'e', 'htmlspecialchars');
         $smarty->assign(array('url' => DI::getDefault()->get('url')));
         static::$smarty = $smarty;
     }
     return static::$smarty;
 }
开发者ID:rj28,项目名称:test,代码行数:21,代码来源:EngineSmarty124.php

示例10: __construct

 public function __construct()
 {
     parent::__construct();
     // Store the Codeigniter super global instance... whatever
     $CI = get_instance();
     // Load the Smarty config file
     $CI->load->config('smarty');
     // Turn on/off debug
     $this->debugging = $CI->config->item('smarty.smarty_debug');
     // Set some pretty standard Smarty directories
     $this->setCompileDir($CI->config->item('smarty.compile_directory'));
     $this->setCacheDir($CI->config->item('smarty.cache_directory'));
     $this->setConfigDir($CI->config->item('smarty.config_directory'));
     // Default template extension
     $this->template_ext = $CI->config->item('smarty.template_ext');
     // How long to cache templates for
     $this->cache_lifetime = $CI->config->item('smarty.cache_lifetime');
     // Disable Smarty security policy
     $this->disableSecurity();
     // If caching is enabled, then disable force compile and enable cache
     if ($CI->config->item('smarty.cache_status') === TRUE) {
         $this->enable_caching();
     } else {
         $this->disable_caching();
     }
     // Set the error reporting level
     $this->error_reporting = $CI->config->item('smarty.template_error_reporting');
     // This will fix various issues like filemtime errors that some people experience
     // The cause of this is most likely setting the error_reporting value above
     // This is a static function in the main Smarty class
     Smarty::muteExpectedErrors();
     // Should let us access Codeigniter stuff in views
     // This means we can go for example {$this->session->userdata('item')}
     // just like we normally would in standard CI views
     $this->assign("this", $CI);
 }
开发者ID:kinhluan,项目名称:500CISAN,代码行数:36,代码来源:CI_Smarty.php

示例11: __construct

 function __construct($path)
 {
     $this->path = $path;
     Gongo_Locator::load($this->libraryPath, 'Smarty');
     Smarty::muteExpectedErrors();
 }
开发者ID:no22,项目名称:gongo,代码行数:6,代码来源:Smarty3.php

示例12: getCompiled

 /**
  * get a Compiled Object of this source
  *
  * @param Smarty_Internal_Template $_template template objet
  * @return Smarty_Template_Compiled compiled object
  */
 public function getCompiled(Smarty_Internal_Template $_template)
 {
     // check runtime cache
     $_cache_key_dir = join(DIRECTORY_SEPARATOR, $_template->smarty->getTemplateDir());
     $_cache_key = $_template->template_resource . '#' . $_template->compile_id;
     if (!isset(Smarty_Resource::$compileds[$_cache_key_dir])) {
         Smarty_Resource::$compileds[$_cache_key_dir] = array();
     }
     if (isset(Smarty_Resource::$compileds[$_cache_key_dir][$_cache_key])) {
         return Smarty_Resource::$compileds[$_cache_key_dir][$_cache_key];
     }
     $compiled = new Smarty_Template_Compiled($this);
     $this->handler->populateCompiledFilepath($compiled, $_template);
     Smarty::muteExpectedErrors();
     $compiled->timestamp = @filemtime($compiled->filepath);
     Smarty::unmuteExpectedErrors();
     $compiled->exists = !!$compiled->timestamp;
     // runtime cache
     Smarty_Resource::$compileds[$_cache_key_dir][$_cache_key] = $compiled;
     return $compiled;
 }
开发者ID:harmofwk,项目名称:harmofwk,代码行数:27,代码来源:smarty_resource.php

示例13: _parse

 private function _parse($pid)
 {
     $tpl = new Template();
     $template = $tpl->getTemplateDefinitionByPageId($pid);
     if ((int) $template->templatetype != 1) {
         throw $this->throwException(7008);
     }
     $_SESSION['language'] = 'tpl';
     $page = new Page();
     $opage = $page->getPageById($pid, false, true);
     $tn = new OTreeNode();
     $tn->page = $opage;
     $tname = $template->itemtype;
     if (!file_exists(BASEPATH . '/bright/site/views/' . $tname . 'View.php')) {
         throw $this->throwException(7010, array($tname . 'View'));
     }
     //		include_once('views/' . $tname . 'View.php');
     $viewclass = $tname . 'View';
     $view = new $viewclass($tn);
     // Simplify page for parsing
     // @deprecated Should not be used anymore
     foreach ($opage->content as $cfield => $value) {
         $opage->{$cfield} = $value;
     }
     $deactivationlink = BASEURL . 'bright/';
     if (defined('USEACTIONDIR') && USEACTIONDIR) {
         $deactivationlink .= 'actions/';
     }
     $deactivationlink .= 'registration.php?action=deactivate&email={email}&code={code}';
     $view->deactivationlink = $deactivationlink;
     define('DEACTIVATIONLINK', $deactivationlink);
     if (method_exists($view, 'parseTemplate')) {
         // Bright parser
         $parsed = $view->parseTemplate($view, $template->itemtype);
     } else {
         // Smarty parser
         \Smarty::muteExpectedErrors();
         $parsed = $view->output();
         \Smarty::unmuteExpectedErrors();
     }
     $parsed = preg_replace_callback('/<img([^>]*)src="\\/([^"]*)"([^>]*)\\/>/ism', array($this, '_replaceImage'), $parsed);
     $result = new \stdClass();
     $result->page = $opage;
     $result->parsed = $parsed;
     return $result;
 }
开发者ID:rsids,项目名称:bright_api,代码行数:46,代码来源:Mailing.php

示例14: clearCache

 /**
  * Empty cache for a specific template
  *
  * @param string  $template_name template name
  * @param string  $cache_id      cache id
  * @param string  $compile_id    compile id
  * @param integer $exp_time      expiration time
  * @param string  $type          resource type
  * @return integer number of cache files deleted
  */
 public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
 {
     Smarty::muteExpectedErrors();
     // load cache resource and call clear
     $_cache_resource = Smarty_CacheResource::load($this, $type);
     Smarty_CacheResource::invalidLoadedCache($this);
     $t = $_cache_resource->clear($this, $template_name, $cache_id, $compile_id, $exp_time);
     Smarty::unmuteExpectedErrors();
     return $t;
 }
开发者ID:harmofwk,项目名称:harmofwk,代码行数:20,代码来源:Smarty.class.php

示例15: __construct

 /**
  * Constructor.
  *
  * @param \Smarty                     $smarty  A \Smarty instance
  * @param TemplateLocator             $locator A TemplateLocator instance
  * @param TemplateNameParserInterface $parser  A TemplateNameParserInterface instance
  * @param LoaderInterface             $loader  A LoaderInterface instance
  * @param array                       $options An array of \Smarty properties
  * @param GlobalVariables|null        $globals A GlobalVariables instance or null
  * @param LoggerInterface|null        $logger  A LoggerInterface instance or null
  */
 public function __construct(\Smarty $smarty, TemplateLocator $locator, TemplateNameParserInterface $parser, LoaderInterface $loader, array $options = array(), GlobalVariables $globals = null, LoggerInterface $logger = null)
 {
     $this->smarty = $smarty;
     $this->locator = $locator;
     $this->parser = $parser;
     $this->loader = $loader;
     $this->globals = array();
     $this->logger = null;
     // There are no default extensions.
     $this->extensions = array();
     /*
      * Register an handler for 'logical' filenames of the type:
      * <code>file:Application:index:index.html.smarty</code>
      */
     $this->smarty->default_template_handler_func = array($this, 'smartyDefaultTemplateHandler');
     /*
      * Define a set of template dirs to look for. This will allow the
      * usage of the following syntax:
      * <code>file:[Application]/index/index.html.tpl</code>
      *
      * See {@link http://www.smarty.net/docs/en/resources.tpl} for details
      */
     $this->smarty->setTemplateDir($this->locator->getAppPath());
     $this->smarty->addTemplateDir($this->locator->getModulesPath());
     foreach ($options as $property => $value) {
         $this->smarty->{$this->smartyPropertyToSetter($property)}($value);
     }
     if (null !== $globals) {
         $this->addGlobal('app', $globals);
     }
     /*
      * @note muteExpectedErrors() was activated to workaround the following issue:
      *
      * <code>Warning: filemtime(): stat failed for /path/to/smarty/cache/3ab50a623e65185c49bf17c63c90cc56070ea85c.one.tpl.php
      * in /path/to/smarty/libs/sysplugins/smarty_resource.php</code>
      *
      * This means that your application registered a custom error hander
      * (using set_error_handler()) which is not respecting the given $errno
      * as it should. If, for whatever reason, this is the desired behaviour
      * of your custom error handler, please call muteExpectedErrors() after
      * you've registered your custom error handler.
      *
      * muteExpectedErrors() registers a custom error handler using
      * set_error_handler(). The error handler merely inspects $errno and
      * $errfile to determine if the given error was produced deliberately
      * and must be ignored, or should be passed on to the next error handler.
      */
     $smarty->muteExpectedErrors();
 }
开发者ID:dragoonis,项目名称:framework,代码行数:60,代码来源:SmartyEngine.php


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