PageRenderTime 46ms CodeModel.GetById 21ms app.highlight 19ms RepoModel.GetById 2ms app.codeStats 0ms

/#/vendor/smarty/sysplugins/smarty_internal_compile_setfilter.php

https://bitbucket.org/nemo_xiaolan/muyou
PHP | 72 lines | 24 code | 7 blank | 41 comment | 2 complexity | 7187949d5e69602674612566b801050e MD5 | raw file
 1<?php
 2/**
 3 * Smarty Internal Plugin Compile Setfilter
 4 *
 5 * Compiles code for setfilter tag
 6 *
 7 * @package Smarty
 8 * @subpackage Compiler
 9 * @author Uwe Tews
10 */
11
12/**
13 * Smarty Internal Plugin Compile Setfilter Class
14 *
15 * @package Smarty
16 * @subpackage Compiler
17 */
18class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase {
19
20    /**
21     * Compiles code for setfilter tag
22     *
23     * @param array  $args      array with attributes from parser
24     * @param object $compiler  compiler object
25     * @param array  $parameter array with compilation parameter
26     * @return string compiled code
27     */
28    public function compile($args, $compiler, $parameter)
29    {
30        $compiler->variable_filter_stack[] = $compiler->template->variable_filters;
31        $compiler->template->variable_filters = $parameter['modifier_list'];
32        // this tag does not return compiled code
33        $compiler->has_code = false;
34        return true;
35    }
36
37}
38
39/**
40 * Smarty Internal Plugin Compile Setfilterclose Class
41 *
42 * @package Smarty
43 * @subpackage Compiler
44 */
45class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase {
46
47    /**
48     * Compiles code for the {/setfilter} tag
49     *
50     * This tag does not generate compiled output. It resets variable filter.
51     *
52     * @param array  $args     array with attributes from parser
53     * @param object $compiler compiler object
54     * @return string compiled code
55     */
56    public function compile($args, $compiler)
57    {
58        $_attr = $this->getAttributes($compiler, $args);
59        // reset variable filter to previous state
60        if (count($compiler->variable_filter_stack)) {
61            $compiler->template->variable_filters = array_pop($compiler->variable_filter_stack);
62        } else {
63            $compiler->template->variable_filters = array();
64        }
65        // this tag does not return compiled code
66        $compiler->has_code = false;
67        return true;
68    }
69
70}
71
72?>