unmuteExpectedErrors() public static method

Disable error handler muting expected messages
public static unmuteExpectedErrors ( ) : void
return void
Example #1
0
 protected function _unmuteErrors()
 {
     if ($this->nMuteErrorsCnt > 0) {
         $this->oSmarty->unmuteExpectedErrors();
         $this->nMuteErrorsCnt--;
     }
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
 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();
 }
Example #5
0
 public function __construct()
 {
     if (!is_null(self::$smarty)) {
         return;
     }
     $smarty = new Smarty();
     $smarty->left_delimiter = C('LEFT_DELIMITER');
     $smarty->right_delimiter = C('RIGHT_DELIMITER');
     $smarty->template_dir = APP_TPL_PATH . '/' . CONTROLLER . '/';
     $smarty->compile_dir = APP_COMPILE_PATH;
     $smarty->cache_dir = APP_CACHE_PATH;
     $smarty->caching = C('CACHE_ON');
     $smarty->cache_lifetime = C("CACHE_TIME");
     $smarty->unmuteExpectedErrors();
     self::$smarty = $smarty;
 }
Example #6
0
 /**
  * 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;
 }
Example #7
0
 /**
  * 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;
 }
Example #8
0
 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;
 }