Another fix in week view for negative hours.
[timetracker.git] / WEB-INF / lib / smarty / sysplugins / smarty_internal_compile_private_print_expression.php
1 <?php
2 /**
3  * Smarty Internal Plugin Compile Print Expression
4  * 
5  * Compiles any tag which will output an expression or variable
6  * 
7  * @package Smarty
8  * @subpackage Compiler
9  * @author Uwe Tews 
10  */
11
12 /**
13  * Smarty Internal Plugin Compile Print Expression Class
14  */
15 class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase {
16         // attribute definitions
17     public $optional_attributes = array('assign'); 
18     public $option_flags = array('nocache', 'nofilter'); 
19
20     /**
21      * Compiles code for gererting output from any expression
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         $this->compiler = $compiler;
31         // check and get attributes
32         $_attr = $this->_get_attributes($args); 
33         // nocache option
34         if ($_attr['nocache'] === true) {
35             $this->compiler->tag_nocache = true;
36         } 
37         // filter handling
38         if ($_attr['nofilter'] === true) {
39             $_filter = 'false';
40         } else {
41             $_filter = 'true';
42         } 
43         // compiled output
44         // compiled output
45         if (isset($_attr['assign'])) {
46             // assign output to variable
47             $output = "<?php \$_smarty_tpl->assign({$_attr['assign']},{$parameter['value']});?>";
48         } else {
49             // display value
50             if (!$_attr['nofilter'] && isset($this->compiler->smarty->registered_filters['variable'])) {
51                 $output = "Smarty_Internal_Filter_Handler::runFilter('variable', {$parameter['value']}, \$_smarty_tpl, {$_filter})";
52             } else {
53                 $output = $parameter['value'];
54             } 
55             if (!$_attr['nofilter'] && !empty($this->compiler->smarty->default_modifiers)) {
56                 $modifierlist = array();
57                 foreach ($this->compiler->smarty->default_modifiers as $key => $single_default_modifier) {
58                     preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', $single_default_modifier, $mod_array);
59                     for ($i = 0, $count = count($mod_array[0]);$i < $count;$i++) {
60                         if ($mod_array[0][$i] != ':') {
61                             $modifierlist[$key][] = $mod_array[0][$i];
62                         } 
63                     } 
64                 } 
65                 $output = $this->compiler->compileTag('private_modifier', array(), array('modifierlist' => $modifierlist, 'value' => $output));
66             } 
67             if (!empty($parameter['modifierlist'])) {
68                 $output = $this->compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifierlist'], 'value' => $output));
69             } 
70             $this->compiler->has_output = true;
71             $output = "<?php echo {$output};?>";
72         } 
73         return $output;
74     } 
75
76
77 ?>