/**
  * {@inheritdoc}
  */
 public function render()
 {
     try {
         return parent::render();
     } catch (TemplateRenderingException $exception) {
         throw new FileTemplateRenderingException($this->file_identifier, $exception);
     } catch (LangNotFoundException $exception) {
         throw new FileTemplateRenderingException($this->file_identifier, $exception);
     }
 }
 /**
  * @desc Constructs a StringTemplate
  * @param string $content The content of the template (a string containing PHPBoost's template engine syntax).
  * @param bool $use_cache Controls if it has or not to use cache
  * @param bool $auto_load_vars Tells whether it has to load or not the most common variables.
  */
 public function __construct($content, $use_cache = self::USE_CACHE_IF_FASTER)
 {
     $data = new DefaultTemplateData();
     $data->auto_load_frequent_vars();
     $renderer = new DefaultTemplateRenderer();
     if ($this->has_to_cache($content, $use_cache)) {
         $loader = new CachedStringTemplateLoader($content);
     } else {
         $loader = new StringTemplateLoader($content);
     }
     parent::__construct($loader, $renderer, $data);
 }
Example #3
0
 public function __construct($config, $auth)
 {
     parent::__construct($config, $auth);
     $this->smarty = new Smarty();
     $this->smarty->template_dir = dirname(__FILE__) . "/smarty/templates/";
     $this->smarty->compile_dir = dirname(__FILE__) . "/smarty/templates_c/";
     $this->smarty->register_modifier("encodeMessageID", array($config, "encodeMessageID"));
     $this->smarty->register_modifier("calculateFileSize", array($this, "calculateFileSize"));
     $this->smarty->assign("ROOTBOARD", $this->parseBoard($config->getBoard()));
     $this->smarty->assign("VERSION", $config->getVersion());
     $this->smarty->assign("ISANONYMOUS", $this->getAuth()->isAnonymous());
     $this->smarty->assign("ADDRESS", $this->getAuth()->getAddress());
 }
 /**
  * @covers Xmf\Template\AbstractTemplate::fetch
  * @todo   Implement testFetch().
  */
 public function testFetch()
 {
     $ret = $this->object->fetch();
     $this->assertTrue(is_scalar($ret));
 }
Example #5
0
 /**
  * Passes the template name with appropriate prefix up to the template
  * constructor.
  *
  * @param  string  $t  The template to use.
  */
 public function __construct($t)
 {
     parent::__construct('content/' . $t);
 }
Example #6
0
 public function testSetDesignConfigWithValidInputParametersReturnsSuccess()
 {
     $config = array('area' => 'some_area', 'store' => 1);
     $this->_model->setDesignConfig($config);
     $this->assertEquals($config, $this->_model->getDesignConfig()->getData());
 }
 public function __construct($f3, $view)
 {
     parent::__construct($f3, $view);
 }
Example #8
0
 public function postProcess(&$WhoisParser)
 {
     $this->template->postProcess($WhoisParser);
 }
Example #9
0
 /**
  * Parses rawdata from whois server and call postProcess if exists afterwards
  * 
  * @throws NoTemplateException
  * @return void
  */
 private function parse()
 {
     $Config = $this->Config->getCurrent();
     $Template = AbstractTemplate::factory($Config['template']);
     // If Template is null then we do not have a template for that, but we
     // can still proceed to the end with just the rawdata
     if ($Template instanceof AbstractTemplate) {
         $this->parseTemplate($Template);
         // set rawdata to Result - this happens here because sometimes we
         // have to fix the rawdata as well in postProcess
         $this->Result->addItem('rawdata', explode("\n", $this->rawdata));
         // check availability upon type - IP addresses are always registered
         if (isset($Template->available) && $Template->available != '') {
             preg_match_all($Template->available, $this->rawdata, $matches);
             $this->Result->addItem('registered', empty($matches[0]));
         }
         // set registered to Result
         $this->Result->addItem('registered', isset($this->Result->registered) ? $this->Result->registered : false);
         if (!isset($this->Result->whoisserver)) {
             $this->Result->addItem('whoisserver', $Config['server']);
         }
         // start post processing
         $Template->postProcess($this);
         // set name to Result
         if (isset($this->Query->tld) && !isset($this->Query->fqdn)) {
             $this->Result->addItem('name', $this->Query->tld);
         } elseif (isset($this->Query->ip)) {
             $this->Result->addItem('name', $this->Query->ip);
         } elseif (isset($this->Query->asn)) {
             $this->Result->addItem('name', $this->Query->asn);
         } else {
             $this->Result->addItem('name', $this->Query->fqdn);
             $this->Result->addItem('idnName', $this->Query->idnFqdn);
         }
     } else {
         throw \WhoisParser\AbstractException::factory('NoTemplate', 'Template ' . $Config['template'] . ' could not be found.');
     }
 }