]> git.mxchange.org Git - friendica.git/blob - vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php
0ec1e8485ee126293a142b7d0f6841c3a6ad5f14
[friendica.git] / vendor / smarty / smarty / libs / sysplugins / smarty_internal_compile_block_parent.php
1 <?php
2 /*
3  * This file is part of Smarty.
4  *
5  * (c) 2015 Uwe Tews
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * Smarty Internal Plugin Compile Block Parent Class
13  *
14  * @author Uwe Tews <uwe.tews@googlemail.com>
15  */
16 class Smarty_Internal_Compile_Block_Parent extends Smarty_Internal_Compile_Shared_Inheritance
17 {
18
19     /**
20      * Attribute definition: Overwrites base class.
21      *
22      * @var array
23      * @see Smarty_Internal_CompileBase
24      */
25     public $optional_attributes = array('name');
26
27     /**
28      * Attribute definition: Overwrites base class.
29      *
30      * @var array
31      * @see Smarty_Internal_CompileBase
32      */
33     public $shorttag_order = array('name');
34
35     /**
36      * Attribute definition: Overwrites base class.
37      *
38      * @var array
39      * @see Smarty_Internal_CompileBase
40      */
41     public $option_flags = array();
42
43     /**
44      * Saved compiler object
45      *
46      * @var Smarty_Internal_TemplateCompilerBase
47      */
48     public $compiler = null;
49
50     /**
51      * Compiles code for the {block_parent} tag
52      *
53      * @param  array                                 $args      array with attributes from parser
54      * @param  \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
55      * @param  array                                 $parameter array with compilation parameter
56      *
57      * @return bool true
58      */
59     public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
60     {
61         // check and get attributes
62         $_attr = $this->getAttributes($compiler, $args);
63         if (!isset($compiler->_cache[ 'blockNesting' ])) {
64             $compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ',
65                                               $compiler->parser->lex->taglineno);
66         }
67         $compiler->suppressNocacheProcessing = true;
68         $compiler->has_code = true;
69         $output = "<?php \n\$_smarty_tpl->inheritance->callParent(\$_smarty_tpl, \$this" .
70                   (isset($_attr[ 'name' ]) ? ", {$_attr[ 'name' ]}" : '') . ");\n?>\n";
71         return $output;
72     }
73 }