Exemplo n.º 1
0
 /**
  * fetch method
  * NOTE: Overwrites parent
  *
  * @param mixed $template
  * @param int $cache_id
  * @param mixed $parent
  * @param boolean $display
  * @param boolean $merge_tpl_vars
  * @param boolean $no_output_filter
  * @return mixed
  */
 public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
 {
     $name = $template;
     if (startswith($name, 'string:')) {
         $name = 'string:';
     }
     debug_buffer('', 'Fetch ' . $name . ' start');
     if (is_null($cache_id) || $cache_id === '') {
         $cache_id = $this->_global_cache_id;
     } else {
         if ($cache_id[0] == '|') {
             $cache_id = $this->_global_cache_id . $cache_id;
         }
     }
     // send an event before fetching...this allows us to change template stuff.
     if (cmsms()->is_frontend_request()) {
         $parms = array('template' => &$template, 'cache_id' => &$cache_id, 'compile_id' => &$compile_id, 'display' => &$display, 'no_output_filter' => &$no_output_filter);
         Events::SendEvent('Core', 'TemplatePreFetch', $parms);
     }
     $merge_tpl_vars = false;
     // hack
     $tmp = parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);
     debug_buffer('', 'Fetch ' . $name . ' end');
     return $tmp;
 }
Exemplo n.º 2
0
 /**
  * A overridden method from the Smarty class used to hook into the Smarty
  * engine. See the Smarty documentation for more information
  */
 function fetch($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
 {
     if (!is_null($compile_id)) {
         $cid = $this->cur_language . $compile_id;
     }
     return parent::fetch($template, $cache_id, $cid, $parent, $display, $merge_tpl_vars, $no_output_filter);
 }
Exemplo n.º 3
0
 function display_answers($sid)
 {
     $old_name = '';
     $x = 0;
     $sid = (int) $sid;
     $rs = $this->db->Execute("SELECT at.name, at.type, at.label, av.value, s.survey_text_mode\n                                  FROM {$this->CONF['db_tbl_prefix']}answer_types at\n                                  LEFT JOIN {$this->CONF['db_tbl_prefix']}answer_values av ON at.aid = av.aid,\n                                  {$this->CONF['db_tbl_prefix']}surveys s\n                                  WHERE s.sid = {$sid} AND s.sid = at.sid\n                                  ORDER BY name, av.avid ASC");
     if ($rs === FALSE) {
         die($this->db->ErrorMsg());
     }
     while ($r = $rs->FetchRow()) {
         if ($old_name != $r['name']) {
             if (!empty($old_name)) {
                 $x++;
             }
             $answers[$x]['name'] = $this->SfStr->getSafeString($r['name'], $r['survey_text_mode']);
             $answers[$x]['type'] = $r['type'];
             $answers[$x]['value'][] = $this->SfStr->getSafeString($r['value'], $r['survey_text_mode']);
             if (empty($r['label'])) {
                 $answers[$x]['label'] = ' ';
             } else {
                 $answers[$x]['label'] = $this->SfStr->getSafeString($r['label'], $r['survey_text_mode']);
             }
             $old_name = $r['name'];
         } else {
             $answers[$x]['value'][] = $this->SfStr->getSafeString($r['value'], $r['survey_text_mode']);
         }
     }
     $this->smarty->assign_by_ref("answers", $answers);
     $retval = $this->smarty->fetch($this->template . '/display_answers.tpl');
     return $retval;
 }
Exemplo n.º 4
0
 /**
  * fetch method
  * NOTE: Overwrites parent
  *
  * @param mixed $template
  * @param int $cache_id
  * @param mixed $parent
  * @param boolean $display
  * @param boolean $merge_tpl_vars
  * @param boolean $no_output_filter
  * @return mixed
  */
 public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
 {
     $name = $template;
     if (startswith($name, 'string:')) {
         $name = 'string:';
     }
     debug_buffer('', 'Fetch ' . $name . ' start');
     if (is_null($cache_id) || $cache_id === '') {
         $cache_id = $this->_global_cache_id;
     } else {
         if ($cache_id[0] == '|') {
             $cache_id = $this->_global_cache_id . $cache_id;
         }
     }
     $tmp = parent::fetch($template, $cache_id, $compile_id, $parent, $display, false, $no_output_filter);
     debug_buffer('', 'Fetch ' . $name . ' end');
     return $tmp;
 }
Exemplo n.º 5
0
 /**
  * @return string
  */
 public function render()
 {
     return $this->_instance->fetch($this->_filename . '.tpl');
 }
Exemplo n.º 6
0
 public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
 {
     global $gBitSystem;
     if (strpos($template, ':')) {
         list($resource, $location) = explode(':', $template);
         if ($resource == 'bitpackage') {
             list($package, $tpl) = explode('/', $location);
             // exclude temp, as it contains nexus menus
             if (!$gBitSystem->isPackageActive($package) && $package != 'temp') {
                 return '';
             }
         }
     }
     if (defined('TEMPLATE_DEBUG') && TEMPLATE_DEBUG == TRUE) {
         echo "\n<!-- - - - {$template} - - - -->\n";
     }
     return parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);
 }
Exemplo n.º 7
0
        return '[' . $content . ']';
    }
}
$smarty->registerPlugin('block', 'testRepeat', 'testRepeat');
function insert_testInsert($params, $smarty)
{
    $s = '';
    foreach ($params as $nm => $v) {
        $s .= "[{$nm}: {$v}] ";
    }
    $smarty->assign('insertResult', $s);
    return $s;
}
$smarty2 = new SmartyBC();
$smarty2->assign('testPath', $_SERVER['DOCUMENT_ROOT'] . '/test/templates');
$smarty->assign('includePHP', $smarty2->fetch('include_php.tpl'));
$smarty->assign('php', $smarty2->fetch('php.tpl'));
$smarty3 = new Smarty();
$smarty3->left_delimiter = '<!--{';
$smarty3->right_delimiter = '}-->';
$smarty3->auto_literal = false;
$smarty3->assign('foo', 'bar');
$smarty3->assign('a', array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'));
$smarty->assign('escapeParse', $smarty3->fetch('escape_parsing.tpl'));
function preFilterTest($tpl_source, Smarty_Internal_Template $template)
{
    return preg_replace("/<!--.*-->/U", 'changed in PRE filter', $tpl_source);
}
function preFilterTest2($tpl_source, Smarty_Internal_Template $template)
{
    return preg_replace("/changed/", '----------', $tpl_source);