Smarty_Internal_Template PHP Class Code Examples

This page contains top rated real world PHP examples of class Smarty_Internal_Template extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: block.book.php Project: ilivanoff/www
0
function smarty_block_book($params, $content, Smarty_Internal_Template &$smarty)
{
    SmartyBlockContext::getInstance()->registerBlock($content, __FUNCTION__);
    if ($content) {
        echo '<div class="book"><div class="content">' . trim($content) . '</div></div>';
    }
}
Example #2
Show file File: smarty_template_cached.php Project: dayday0769/smarty
0
 /**
  * Read cache content from handler
  *
  * @param Smarty_Internal_Template $_template template object
  *
  * @return string content
  */
 public function read(Smarty_Internal_Template $_template)
 {
     if (!$_template->source->handler->recompiled) {
         return $this->handler->readCachedContent($_template);
     }
     return false;
 }
Example #3
Show file File: prefilter.tplhook.php Project: bhoidhos/aceAdminPanel
0
function smarty_outputfilter_tplhook_mark($sSource, Smarty_Internal_Template $oTemplate)
{
    if ($nPos = stripos($sSource, '<!doctype html>')) {
        $sSource = substr($sSource, $nPos, 15) . substr($sSource, 0, $nPos) . substr($sSource, $nPos + 15);
    }
    return $sSource;
}
Example #4
Show file File: resource.extendsall.php Project: dayday0769/smarty
0
 /**
  * populate Source Object with meta data from Resource
  *
  * @param  Smarty_Template_Source   $source    source object
  * @param  Smarty_Internal_Template $_template template object
  *
  * @return void
  */
 public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
 {
     $uid = '';
     $sources = array();
     $exists = true;
     foreach ($source->smarty->getTemplateDir() as $key => $directory) {
         try {
             $s = Smarty_Template_Source::load(null, $source->smarty, 'file:[' . $key . ']' . $source->name);
             if (!$s->exists) {
                 continue;
             }
             $sources[$s->uid] = $s;
             $uid .= $s->filepath;
         } catch (SmartyException $e) {
         }
     }
     if (!$sources) {
         $source->exists = false;
         return;
     }
     $sources = array_reverse($sources, true);
     reset($sources);
     $s = current($sources);
     $source->components = $sources;
     $source->filepath = $s->filepath;
     $source->uid = sha1($uid);
     $source->exists = $exists;
     if ($_template && $_template->smarty->compile_check) {
         $source->timestamp = $s->getTimeStamp();
     }
 }
Example #5
Show file File: smarty_template_compiled.php Project: vgrish/smarty
0
 /**
  * Read compiled content from handler
  *
  * @param Smarty_Internal_Template $_template template object
  *
  * @return string content
  */
 public function read(Smarty_Internal_Template $_template)
 {
     if (!$_template->source->handler->recompiled) {
         return file_get_contents($this->filepath);
     }
     return isset($this->content) ? $this->content : false;
 }
Example #6
Show file File: smarty_internal_filter_handler.php Project: TedaLIEz/AUNET
0
 *
 * @package Smarty
 * @subpackage PluginsInternal
 * @author Uwe Tews
 */
/**
 * Class for filter processing
 *
 * @package Smarty
 * @subpackage PluginsInternal
 */
class Smarty_Internal_Filter_Handler
{
    /**
     * Run filters over content
     *
     * The filters will be lazy loaded if required
     * class name format: Smarty_FilterType_FilterName
     * plugin filename format: filtertype.filtername.php
     * Smarty2 filter plugins could be used
     *
     * @param string                   $type     the type of filter ('pre','post','output') which shall run
     * @param string                   $content  the content which shall be processed by the filters
     * @param Smarty_Internal_Template $template template object
     * @return string the filtered content
     */
    public static function runFilter($type, $content, Smarty_Internal_Template $template)
    {
        $output = $content;
        // loop over autoload filters of specified type
        if (!empty($template->smarty->autoload_filters[$type])) {
            foreach ((array) $template->smarty->autoload_filters[$type] as $name) {
                $plugin_name = "Smarty_{$type}filter_{$name}";
                if ($template->smarty->loadPlugin($plugin_name)) {
                    if (function_exists($plugin_name)) {
Example #7
Show file File: cacheresource.apctest.php Project: mrsank/work_sample
0
 public function get(Smarty_Internal_Template $_template)
 {
     $this->contents = array();
     $this->timestamps = array();
     $t = $this->getContent($_template);
     return $t ? $t : null;
 }
Example #8
Show file File: block.strike.php Project: ilivanoff/www
0
function smarty_block_strike($params, $content, Smarty_Internal_Template &$smarty)
{
    if (isEmpty($content)) {
        return;
    }
    echo "<span class=\"strike\">{$content}</span>";
}
Example #9
Show file File: smarty_internal_debug.php Project: getcode2git/phpvulhunter
0
 /**
  * handle 'URL' debugging mode
  *
  * @param Smarty_Internal_Template $_template
  */
 public static function debugUrl(Smarty_Internal_Template $_template)
 {
     if (isset($_SERVER['QUERY_STRING'])) {
         $_query_string = $_SERVER['QUERY_STRING'];
     } else {
         $_query_string = '';
     }
     if (false !== strpos($_query_string, $_template->smarty->smarty_debug_id)) {
         if (false !== strpos($_query_string, $_template->smarty->smarty_debug_id . '=on')) {
             // enable debugging for this browser session
             setcookie('SMARTY_DEBUG', true);
             $_template->smarty->debugging = true;
         } elseif (false !== strpos($_query_string, $_template->smarty->smarty_debug_id . '=off')) {
             // disable debugging for this browser session
             setcookie('SMARTY_DEBUG', false);
             $_template->smarty->debugging = false;
         } else {
             // enable debugging for this page
             $_template->smarty->debugging = true;
         }
     } else {
         if (isset($_COOKIE['SMARTY_DEBUG'])) {
             $_template->smarty->debugging = true;
         }
     }
 }
Example #10
Show file File: block.u.php Project: ilivanoff/www
0
function smarty_block_u($params, $content, Smarty_Internal_Template &$smarty)
{
    if (!$content) {
        return;
    }
    echo "<span class=\"underline\">{$content}</span>";
}
Example #11
Show file File: smarty_internal_cacheresource_file.php Project: SBaof/fe
0
 /**
  * Read cached template from cache
  *
  * @param  Smarty_Internal_Template $_template template object
  *
  * @return string  content
  */
 public function readCachedContent(Smarty_Internal_Template $_template)
 {
     if (is_file($_template->cached->filepath)) {
         return file_get_contents($_template->cached->filepath);
     }
     return false;
 }
Example #12
Show file File: resource.extendsall.php Project: gelcaas/newpi
0
 /**
  * populate Source Object with meta data from Resource
  *
  * @param  Smarty_Template_Source   $source    source object
  * @param  Smarty_Internal_Template $_template template object
  *
  * @return void
  */
 public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
 {
     $uid = '';
     $sources = array();
     $exists = true;
     foreach ($_template->smarty->getTemplateDir() as $key => $directory) {
         try {
             $s = Smarty_Resource::source(null, $source->smarty, '[' . $key . ']' . $source->name);
             if (!$s->exists) {
                 continue;
             }
             $sources[$s->uid] = $s;
             $uid .= $s->filepath;
         } catch (SmartyException $e) {
         }
     }
     if (!$sources) {
         $source->exists = false;
         $source->template = $_template;
         return;
     }
     $sources = array_reverse($sources, true);
     reset($sources);
     $s = current($sources);
     $source->components = $sources;
     $source->filepath = $s->filepath;
     $source->uid = sha1($uid);
     $source->exists = $exists;
     if ($_template && $_template->smarty->compile_check) {
         $source->timestamp = $s->timestamp;
     }
     // need the template at getContent()
     $source->template = $_template;
 }
Example #13
Show file File: smarty_internal_filter_handler.php Project: huwenshu/dding
0
 /**
  * Run filters over content
  * The filters will be lazy loaded if required
  * class name format: Smarty_FilterType_FilterName
  * plugin filename format: filtertype.filtername.php
  * Smarty2 filter plugins could be used
  *
  * @param  string                   $type     the type of filter ('pre','post','output') which shall run
  * @param  string                   $content  the content which shall be processed by the filters
  * @param  Smarty_Internal_Template $template template object
  *
  * @throws SmartyException
  * @return string                   the filtered content
  */
 public static function runFilter($type, $content, Smarty_Internal_Template $template)
 {
     $output = $content;
     // loop over autoload filters of specified type
     if (!empty($template->smarty->autoload_filters[$type])) {
         foreach ((array) $template->smarty->autoload_filters[$type] as $name) {
             $plugin_name = "Smarty_{$type}filter_{$name}";
             if ($template->smarty->loadPlugin($plugin_name)) {
                 if (function_exists($plugin_name)) {
                     // use loaded Smarty2 style plugin
                     $output = $plugin_name($output, $template);
                 } elseif (class_exists($plugin_name, false)) {
                     // loaded class of filter plugin
                     $output = call_user_func(array($plugin_name, 'execute'), $output, $template);
                 }
             } else {
                 // nothing found, throw exception
                 throw new SmartyException("Unable to load filter {$plugin_name}");
             }
         }
     }
     // loop over registerd filters of specified type
     if (!empty($template->smarty->registered_filters[$type])) {
         foreach ($template->smarty->registered_filters[$type] as $key => $name) {
             if (is_array($template->smarty->registered_filters[$type][$key])) {
                 $output = call_user_func($template->smarty->registered_filters[$type][$key], $output, $template);
             } else {
                 $output = $template->smarty->registered_filters[$type][$key]($output, $template);
             }
         }
     }
     // return filtered output
     return $output;
 }
Example #14
Show file File: smarty_internal_resource_extends.php Project: RqHe/aunet1
0
* @subpackage TemplateResources
* @author Uwe Tews
* @author Rodney Rehm
*/
/**
* Smarty Internal Plugin Resource Extends
*
* Implements the file system as resource for Smarty which {extend}s a chain of template files templates
*
* @package Smarty
* @subpackage TemplateResources
*/
class Smarty_Internal_Resource_Extends extends Smarty_Resource
{
    /**
    * populate Source Object with meta data from Resource
    *
    * @param Smarty_Template_Source   $source    source object
    * @param Smarty_Internal_Template $_template template object
    */
    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
    {
        $uid = '';
        $sources = array();
        $components = explode('|', $source->name);
        $exists = true;
        foreach ($components as $component) {
            $s = Smarty_Resource::source(null, $source->smarty, $component);
Example #15
Show file File: smarty_internal_debug.php Project: ChrstnMgcn/revolution
0
 /**
  * Opens a window for the Smarty Debugging Consol and display the data
  */
 public static function display_debug($obj)
 {
     // prepare information of assigned variables
     $ptr = $obj;
     while (isset($ptr->parent)) {
         $ptr = $ptr->parent;
     }
     if ($obj instanceof Smarty) {
         $smarty = $obj;
     } else {
         $smarty = $obj->smarty;
     }
     $_assigned_vars = $ptr->tpl_vars;
     ksort($_assigned_vars);
     $_config_vars = $ptr->config_vars;
     ksort($_config_vars);
     $ldelim = $smarty->left_delimiter;
     $rdelim = $smarty->right_delimiter;
     $smarty->left_delimiter = '{';
     $smarty->right_delimiter = '}';
     $_template = new Smarty_Internal_Template($smarty->debug_tpl, $smarty);
     $_template->caching = false;
     $_template->force_compile = false;
     $_template->disableSecurity();
     $_template->cache_id = null;
     $_template->compile_id = null;
     $_template->assign('template_data', self::$template_data);
     $_template->assign('assigned_vars', $_assigned_vars);
     $_template->assign('config_vars', $_config_vars);
     $_template->assign('execution_time', microtime(true) - $smarty->start_time);
     echo $smarty->fetch($_template);
     $smarty->left_delimiter = $ldelim;
     $smarty->right_delimiter = $rdelim;
 }
Example #16
Show file File: smarty_internal_resource_extends.php Project: nstungxd/F2CA5
0
 /**
  * populate Source Object with meta data from Resource
  *
  * @param Smarty_Template_Source   $source    source object
  * @param Smarty_Internal_Template $_template template object
  *
  * @throws SmartyException
  */
 public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
 {
     $uid = sha1(getcwd());
     $sources = array();
     $components = explode('|', $source->name);
     $exists = true;
     foreach ($components as $component) {
         $s = Smarty_Resource::source(null, $source->smarty, $component);
         if ($s->type == 'php') {
             throw new SmartyException("Resource type {$s->type} cannot be used with the extends resource type");
         }
         $sources[$s->uid] = $s;
         $uid .= realpath($s->filepath);
         if ($_template && $_template->smarty->compile_check) {
             $exists = $exists && $s->exists;
         }
     }
     $source->components = $sources;
     $source->filepath = $s->filepath;
     $source->uid = sha1($uid);
     if ($_template && $_template->smarty->compile_check) {
         $source->timestamp = $s->timestamp;
         $source->exists = $exists;
     }
     // need the template at getContent()
     $source->template = $_template;
 }