| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |  * Smarty Internal Plugin Compile Section | 
					
						
							|  |  |  |  * Compiles the {section} {sectionelse} {/section} tags | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |  * @subpackage Compiler | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @author     Uwe Tews | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |  * Smarty Internal Plugin Compile Section Class | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage Compiler | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-07-31 01:03:29 +02:00
										 |  |  | class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_ForeachSection | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |     public $required_attributes = array('name', 'loop'); | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $shorttag_order = array('name', 'loop'); | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-20 21:45:21 +01:00
										 |  |  |     public $optional_attributes = array('start', 'step', 'max', 'show', 'properties'); | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * counter | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $counter = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-31 01:03:29 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Name of this tag | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $tagName = 'section'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Valid properties of $smarty.section.name.xxx variable | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |     public $nameProperties = array('first', 'last', 'index', 'iteration', 'show', 'total', 'rownum', 'index_prev', | 
					
						
							|  |  |  |                                    'index_next', 'loop'); | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-31 01:03:29 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * {section} tag has no item properties | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $itemProperties = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * {section} tag has always name attribute | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var bool | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $isNamed = true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |      * Compiles code for the {section} tag | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |      * @param  array                                 $args     array with attributes from parser | 
					
						
							|  |  |  |      * @param  \Smarty_Internal_TemplateCompilerBase $compiler compiler object | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |      * @return string compiled code | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  |      * @throws \SmartyCompilerException | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |     public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $compiler->loopNesting ++; | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         // check and get attributes
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $_attr = $this->getAttributes($compiler, $args); | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $attributes = array('name' => $compiler->getId($_attr[ 'name' ])); | 
					
						
							|  |  |  |         unset($_attr[ 'name' ]); | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         foreach ($attributes as $a => $v) { | 
					
						
							|  |  |  |             if ($v === false) { | 
					
						
							| 
									
										
										
										
											2015-08-06 01:19:11 +02:00
										 |  |  |                 $compiler->trigger_template_error("'{$a}' attribute/variable has illegal value", null, true); | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  |         $local = "\$__section_{$attributes['name']}_" . $this->counter ++ . '_'; | 
					
						
							|  |  |  |         $sectionVar = "\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']"; | 
					
						
							|  |  |  |         $this->openTag($compiler, 'section', array('section', $compiler->nocache, $local, $sectionVar)); | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |         // maybe nocache because of nocache variables
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $initLocal = | 
					
						
							|  |  |  |             array('saved' => "isset(\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']) ? \$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}'] : false",); | 
					
						
							| 
									
										
										
										
											2015-07-31 01:03:29 +02:00
										 |  |  |         $initNamedProperty = array(); | 
					
						
							|  |  |  |         $initFor = array(); | 
					
						
							|  |  |  |         $incFor = array(); | 
					
						
							|  |  |  |         $cmpFor = array(); | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $propValue = array('index' => "{$sectionVar}->value['index']", 'show' => 'true', 'step' => 1, | 
					
						
							| 
									
										
										
										
											2015-07-31 01:03:29 +02:00
										 |  |  |                            'iteration' => "{$local}iteration", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |         $propType = array('index' => 2, 'iteration' => 2, 'show' => 0, 'step' => 0,); | 
					
						
							|  |  |  |         // search for used tag attributes
 | 
					
						
							|  |  |  |         $this->scanForProperties($attributes, $compiler); | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (!empty($this->matchResults[ 'named' ])) { | 
					
						
							|  |  |  |             $namedAttr = $this->matchResults[ 'named' ]; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-20 21:45:21 +01:00
										 |  |  |         if (isset($_attr[ 'properties' ]) && preg_match_all("/['](.*?)[']/", $_attr[ 'properties' ], $match)) { | 
					
						
							|  |  |  |             foreach ($match[ 1 ] as $prop) { | 
					
						
							|  |  |  |                 if (in_array($prop, $this->nameProperties)) { | 
					
						
							|  |  |  |                     $namedAttr[ $prop ] = true; | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     $compiler->trigger_template_error("Invalid property '{$prop}'", null, true); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $namedAttr[ 'index' ] = true; | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |         $output = "<?php\n"; | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         foreach ($_attr as $attr_name => $attr_value) { | 
					
						
							|  |  |  |             switch ($attr_name) { | 
					
						
							|  |  |  |                 case 'loop': | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     if (is_numeric($attr_value)) { | 
					
						
							|  |  |  |                         $v = (int) $attr_value; | 
					
						
							|  |  |  |                         $t = 0; | 
					
						
							|  |  |  |                     } else { | 
					
						
							| 
									
										
										
										
											2015-07-29 23:30:52 +02:00
										 |  |  |                         $v = "(is_array(@\$_loop=$attr_value) ? count(\$_loop) : max(0, (int) \$_loop))"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                         $t = 1; | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     if (isset($namedAttr[ 'loop' ])) { | 
					
						
							|  |  |  |                         $initNamedProperty[ 'loop' ] = "'loop' => {$v}"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                         if ($t == 1) { | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  |                             $v = "{$sectionVar}->value['loop']"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                         } | 
					
						
							|  |  |  |                     } elseif ($t == 1) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                         $initLocal[ 'loop' ] = $v; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                         $v = "{$local}loop"; | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  |                 case 'show': | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |                     if (is_bool($attr_value)) { | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                         $v = $attr_value ? 'true' : 'false'; | 
					
						
							|  |  |  |                         $t = 0; | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |                     } else { | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                         $v = "(bool) $attr_value"; | 
					
						
							|  |  |  |                         $t = 3; | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |                     break; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                 case 'step': | 
					
						
							|  |  |  |                     if (is_numeric($attr_value)) { | 
					
						
							|  |  |  |                         $v = (int) $attr_value; | 
					
						
							|  |  |  |                         $v = ($v == 0) ? 1 : $v; | 
					
						
							|  |  |  |                         $t = 0; | 
					
						
							|  |  |  |                         break; | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     $initLocal[ 'step' ] = "((int)@$attr_value) == 0 ? 1 : (int)@$attr_value"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     $v = "{$local}step"; | 
					
						
							|  |  |  |                     $t = 2; | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |                     break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 case 'max': | 
					
						
							|  |  |  |                 case 'start': | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     if (is_numeric($attr_value)) { | 
					
						
							|  |  |  |                         $v = (int) $attr_value; | 
					
						
							|  |  |  |                         $t = 0; | 
					
						
							|  |  |  |                         break; | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2015-07-29 23:30:52 +02:00
										 |  |  |                     $v = "(int)@$attr_value"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     $t = 3; | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |                     break; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             if ($t == 3 && $compiler->getId($attr_value)) { | 
					
						
							|  |  |  |                 $t = 1; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $propValue[ $attr_name ] = $v; | 
					
						
							|  |  |  |             $propType[ $attr_name ] = $t; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($namedAttr[ 'step' ])) { | 
					
						
							|  |  |  |             $initNamedProperty[ 'step' ] = $propValue[ 'step' ]; | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($namedAttr[ 'iteration' ])) { | 
					
						
							|  |  |  |             $propValue[ 'iteration' ] = "{$sectionVar}->value['iteration']"; | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $incFor[ 'iteration' ] = "{$propValue['iteration']}++"; | 
					
						
							|  |  |  |         $initFor[ 'iteration' ] = "{$propValue['iteration']} = 1"; | 
					
						
							| 
									
										
										
										
											2015-07-31 01:03:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if ($propType[ 'step' ] == 0) { | 
					
						
							|  |  |  |             if ($propValue[ 'step' ] == 1) { | 
					
						
							|  |  |  |                 $incFor[ 'index' ] = "{$sectionVar}->value['index']++"; | 
					
						
							|  |  |  |             } elseif ($propValue[ 'step' ] > 1) { | 
					
						
							|  |  |  |                 $incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $incFor[ 'index' ] = "{$sectionVar}->value['index'] -= " . - $propValue[ 'step' ]; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}"; | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (!isset($propValue[ 'max' ])) { | 
					
						
							|  |  |  |             $propValue[ 'max' ] = $propValue[ 'loop' ]; | 
					
						
							|  |  |  |             $propType[ 'max' ] = $propType[ 'loop' ]; | 
					
						
							|  |  |  |         } elseif ($propType[ 'max' ] != 0) { | 
					
						
							|  |  |  |             $propValue[ 'max' ] = "{$propValue['max']} < 0 ? {$propValue['loop']} : {$propValue['max']}"; | 
					
						
							|  |  |  |             $propType[ 'max' ] = 1; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             if ($propValue[ 'max' ] < 0) { | 
					
						
							|  |  |  |                 $propValue[ 'max' ] = $propValue[ 'loop' ]; | 
					
						
							|  |  |  |                 $propType[ 'max' ] = $propType[ 'loop' ]; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (!isset($propValue[ 'start' ])) { | 
					
						
							|  |  |  |             $start_code = | 
					
						
							|  |  |  |                 array(1 => "{$propValue['step']} > 0 ? ", 2 => '0', 3 => ' : ', 4 => $propValue[ 'loop' ], 5 => ' - 1'); | 
					
						
							|  |  |  |             if ($propType[ 'loop' ] == 0) { | 
					
						
							|  |  |  |                 $start_code[ 5 ] = ''; | 
					
						
							|  |  |  |                 $start_code[ 4 ] = $propValue[ 'loop' ] - 1; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             if ($propType[ 'step' ] == 0) { | 
					
						
							|  |  |  |                 if ($propValue[ 'step' ] > 0) { | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     $start_code = array(1 => '0'); | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     $propType[ 'start' ] = 0; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                 } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     $start_code[ 1 ] = $start_code[ 2 ] = $start_code[ 3 ] = ''; | 
					
						
							|  |  |  |                     $propType[ 'start' ] = $propType[ 'loop' ]; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $propType[ 'start' ] = 1; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $propValue[ 'start' ] = join('', $start_code); | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $start_code = | 
					
						
							|  |  |  |                 array(1 => "{$propValue['start']} < 0 ? ", 2 => 'max(', 3 => "{$propValue['step']} > 0 ? ", 4 => '0', | 
					
						
							|  |  |  |                       5 => ' : ', 6 => '-1', 7 => ', ', 8 => "{$propValue['start']} + {$propValue['loop']}", 10 => ')', | 
					
						
							|  |  |  |                       11 => ' : ', 12 => 'min(', 13 => $propValue[ 'start' ], 14 => ', ', | 
					
						
							|  |  |  |                       15 => "{$propValue['step']} > 0 ? ", 16 => $propValue[ 'loop' ], 17 => ' : ', | 
					
						
							|  |  |  |                       18 => $propType[ 'loop' ] == 0 ? $propValue[ 'loop' ] - 1 : "{$propValue['loop']} - 1", | 
					
						
							|  |  |  |                       19 => ')'); | 
					
						
							|  |  |  |             if ($propType[ 'step' ] == 0) { | 
					
						
							|  |  |  |                 $start_code[ 3 ] = $start_code[ 5 ] = $start_code[ 15 ] = $start_code[ 17 ] = ''; | 
					
						
							|  |  |  |                 if ($propValue[ 'step' ] > 0) { | 
					
						
							|  |  |  |                     $start_code[ 6 ] = $start_code[ 18 ] = ''; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                 } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     $start_code[ 4 ] = $start_code[ 16 ] = ''; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             if ($propType[ 'start' ] == 0) { | 
					
						
							|  |  |  |                 if ($propType[ 'loop' ] == 0) { | 
					
						
							|  |  |  |                     $start_code[ 8 ] = $propValue[ 'start' ] + $propValue[ 'loop' ]; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $propType[ 'start' ] = $propType[ 'step' ] + $propType[ 'loop' ]; | 
					
						
							|  |  |  |                 $start_code[ 1 ] = ''; | 
					
						
							|  |  |  |                 if ($propValue[ 'start' ] < 0) { | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     for ($i = 11; $i <= 19; $i ++) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                         $start_code[ $i ] = ''; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     if ($propType[ 'start' ] == 0) { | 
					
						
							|  |  |  |                         $start_code = array(max($propValue[ 'step' ] > 0 ? 0 : - 1, | 
					
						
							|  |  |  |                                                 $propValue[ 'start' ] + $propValue[ 'loop' ])); | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     } | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     for ($i = 1; $i <= 11; $i ++) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                         $start_code[ $i ] = ''; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     if ($propType[ 'start' ] == 0) { | 
					
						
							|  |  |  |                         $start_code = | 
					
						
							|  |  |  |                             array(min($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1, | 
					
						
							|  |  |  |                                       $propValue[ 'start' ])); | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $propValue[ 'start' ] = join('', $start_code); | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if ($propType[ 'start' ] != 0) { | 
					
						
							|  |  |  |             $initLocal[ 'start' ] = $propValue[ 'start' ]; | 
					
						
							|  |  |  |             $propValue[ 'start' ] = "{$local}start"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $initFor[ 'index' ] = "{$sectionVar}->value['index'] = {$propValue['start']}"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (!isset($_attr[ 'start' ]) && !isset($_attr[ 'step' ]) && !isset($_attr[ 'max' ])) { | 
					
						
							|  |  |  |             $propValue[ 'total' ] = $propValue[ 'loop' ]; | 
					
						
							|  |  |  |             $propType[ 'total' ] = $propType[ 'loop' ]; | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $propType[ 'total' ] = | 
					
						
							|  |  |  |                 $propType[ 'start' ] + $propType[ 'loop' ] + $propType[ 'step' ] + $propType[ 'max' ]; | 
					
						
							|  |  |  |             if ($propType[ 'total' ] == 0) { | 
					
						
							|  |  |  |                 $propValue[ 'total' ] = | 
					
						
							|  |  |  |                     min(ceil(($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] : | 
					
						
							|  |  |  |                                  (int) $propValue[ 'start' ] + 1) / abs($propValue[ 'step' ])), $propValue[ 'max' ]); | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $total_code = array(1 => 'min(', 2 => 'ceil(', 3 => '(', 4 => "{$propValue['step']} > 0 ? ", | 
					
						
							|  |  |  |                                     5 => $propValue[ 'loop' ], 6 => ' - ', 7 => $propValue[ 'start' ], 8 => ' : ', | 
					
						
							|  |  |  |                                     9 => $propValue[ 'start' ], 10 => '+ 1', 11 => ')', 12 => '/ ', 13 => 'abs(', | 
					
						
							|  |  |  |                                     14 => $propValue[ 'step' ], 15 => ')', 16 => ')', 17 => ", {$propValue['max']})",); | 
					
						
							|  |  |  |                 if (!isset($propValue[ 'max' ])) { | 
					
						
							|  |  |  |                     $total_code[ 1 ] = $total_code[ 17 ] = ''; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 if ($propType[ 'loop' ] + $propType[ 'start' ] == 0) { | 
					
						
							|  |  |  |                     $total_code[ 5 ] = $propValue[ 'loop' ] - $propValue[ 'start' ]; | 
					
						
							|  |  |  |                     $total_code[ 6 ] = $total_code[ 7 ] = ''; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 if ($propType[ 'start' ] == 0) { | 
					
						
							|  |  |  |                     $total_code[ 9 ] = (int) $propValue[ 'start' ] + 1; | 
					
						
							|  |  |  |                     $total_code[ 10 ] = ''; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 if ($propType[ 'step' ] == 0) { | 
					
						
							|  |  |  |                     $total_code[ 13 ] = $total_code[ 15 ] = ''; | 
					
						
							|  |  |  |                     if ($propValue[ 'step' ] == 1 || $propValue[ 'step' ] == - 1) { | 
					
						
							|  |  |  |                         $total_code[ 2 ] = $total_code[ 12 ] = $total_code[ 14 ] = $total_code[ 16 ] = ''; | 
					
						
							|  |  |  |                     } elseif ($propValue[ 'step' ] < 0) { | 
					
						
							|  |  |  |                         $total_code[ 14 ] = - $propValue[ 'step' ]; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     $total_code[ 4 ] = ''; | 
					
						
							|  |  |  |                     if ($propValue[ 'step' ] > 0) { | 
					
						
							|  |  |  |                         $total_code[ 8 ] = $total_code[ 9 ] = $total_code[ 10 ] = ''; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                         $total_code[ 5 ] = $total_code[ 6 ] = $total_code[ 7 ] = $total_code[ 8 ] = ''; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $propValue[ 'total' ] = join('', $total_code); | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |         if (isset($namedAttr[ 'loop' ])) { | 
					
						
							| 
									
										
										
										
											2016-01-26 03:01:33 +01:00
										 |  |  |             $initNamedProperty[ 'loop' ] = "'loop' => {$propValue['total']}"; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($namedAttr[ 'total' ])) { | 
					
						
							|  |  |  |             $initNamedProperty[ 'total' ] = "'total' => {$propValue['total']}"; | 
					
						
							|  |  |  |             if ($propType[ 'total' ] > 0) { | 
					
						
							|  |  |  |                 $propValue[ 'total' ] = "{$sectionVar}->value['total']"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         } elseif ($propType[ 'total' ] > 0) { | 
					
						
							|  |  |  |             $initLocal[ 'total' ] = $propValue[ 'total' ]; | 
					
						
							|  |  |  |             $propValue[ 'total' ] = "{$local}total"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $cmpFor[ 'iteration' ] = "{$propValue['iteration']} <= {$propValue['total']}"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-31 01:03:29 +02:00
										 |  |  |         foreach ($initLocal as $key => $code) { | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             $output .= "{$local}{$key} = {$code};\n"; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-31 01:03:29 +02:00
										 |  |  |         $_vars = 'array(' . join(', ', $initNamedProperty) . ')'; | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  |         $output .= "{$sectionVar} = new Smarty_Variable({$_vars});\n"; | 
					
						
							| 
									
										
										
										
											2015-07-31 01:03:29 +02:00
										 |  |  |         $cond_code = "{$propValue['total']} != 0"; | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if ($propType[ 'total' ] == 0) { | 
					
						
							|  |  |  |             if ($propValue[ 'total' ] == 0) { | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |                 $cond_code = 'false'; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $cond_code = 'true'; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if ($propType[ 'show' ] > 0) { | 
					
						
							| 
									
										
										
										
											2015-07-31 01:03:29 +02:00
										 |  |  |             $output .= "{$local}show = {$propValue['show']} ? {$cond_code} : false;\n"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             $output .= "if ({$local}show) {\n"; | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         } elseif ($propValue[ 'show' ] == 'true') { | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             $output .= "if ({$cond_code}) {\n"; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $output .= "if (false) {\n"; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-07-31 01:03:29 +02:00
										 |  |  |         $jinit = join(', ', $initFor); | 
					
						
							|  |  |  |         $jcmp = join(', ', $cmpFor); | 
					
						
							|  |  |  |         $jinc = join(', ', $incFor); | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         $output .= "for ({$jinit}; {$jcmp}; {$jinc}){\n"; | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($namedAttr[ 'rownum' ])) { | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  |             $output .= "{$sectionVar}->value['rownum'] = {$propValue['iteration']};\n"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($namedAttr[ 'index_prev' ])) { | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  |             $output .= "{$sectionVar}->value['index_prev'] = {$propValue['index']} - {$propValue['step']};\n"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($namedAttr[ 'index_next' ])) { | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  |             $output .= "{$sectionVar}->value['index_next'] = {$propValue['index']} + {$propValue['step']};\n"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($namedAttr[ 'first' ])) { | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  |             $output .= "{$sectionVar}->value['first'] = ({$propValue['iteration']} == 1);\n"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($namedAttr[ 'last' ])) { | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  |             $output .= "{$sectionVar}->value['last'] = ({$propValue['iteration']} == {$propValue['total']});\n"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |         $output .= "?>"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         return $output; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * Smarty Internal Plugin Compile Sectionelse Class | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage Compiler | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |      * Compiles code for the {sectionelse} tag | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |      * @param  array                                $args     array with attributes from parser | 
					
						
							|  |  |  |      * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |      * @return string compiled code | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |     public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // check and get attributes
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $_attr = $this->getAttributes($compiler, $args); | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  |         list($openTag, $nocache, $local, $sectionVar) = $this->closeTag($compiler, array('section')); | 
					
						
							|  |  |  |         $this->openTag($compiler, 'sectionelse', array('sectionelse', $nocache, $local, $sectionVar)); | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |         return "<?php }} else {\n ?>"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |  * Smarty Internal Plugin Compile Sectionclose Class | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage Compiler | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |      * Compiles code for the {/section} tag | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |      * @param  array                                $args     array with attributes from parser | 
					
						
							|  |  |  |      * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |      * @return string compiled code | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |     public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $compiler->loopNesting --; | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  |         // must endblock be nocache?
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         if ($compiler->nocache) { | 
					
						
							|  |  |  |             $compiler->tag_nocache = true; | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         list($openTag, $compiler->nocache, $local, $sectionVar) = | 
					
						
							|  |  |  |             $this->closeTag($compiler, array('section', 'sectionelse')); | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |         $output = "<?php\n"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         if ($openTag == 'sectionelse') { | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             $output .= "}\n"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |             $output .= "}\n}\n"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-08-02 19:43:21 +02:00
										 |  |  |         $output .= "if ({$local}saved) {\n"; | 
					
						
							|  |  |  |         $output .= "{$sectionVar} = {$local}saved;\n"; | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         $output .= "}\n"; | 
					
						
							| 
									
										
										
										
											2016-01-26 21:25:29 +01:00
										 |  |  |         $output .= "?>"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-29 22:23:23 +02:00
										 |  |  |         return $output; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | } |