| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  | * Smarty Internal Plugin Compile Print Expression | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * Compiles any tag which will output an expression or variable | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * @package Smarty | 
					
						
							|  |  |  | * @subpackage Compiler | 
					
						
							|  |  |  | * @author Uwe Tews  | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  | * Smarty Internal Plugin Compile Print Expression Class | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | class Smarty_Internal_Compile_Print_Expression extends Smarty_Internal_CompileBase { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |     * Compiles code for gererting output from any expression | 
					
						
							|  |  |  |     *  | 
					
						
							|  |  |  |     * @param array $args array with attributes from parser | 
					
						
							|  |  |  |     * @param object $compiler compiler object | 
					
						
							|  |  |  |     * @return string compiled code | 
					
						
							|  |  |  |     */ | 
					
						
							|  |  |  |     public function compile($args, $compiler) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-04-10 01:15:53 +00:00
										 |  |  |         $this->compiler = $compiler; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         $this->required_attributes = array('value'); | 
					
						
							| 
									
										
										
										
											2009-04-10 01:15:53 +00:00
										 |  |  |         $this->optional_attributes = array('assign', 'nocache', 'filter');  | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         // check and get attributes
 | 
					
						
							|  |  |  |         $_attr = $this->_get_attributes($args); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (isset($_attr['nocache'])) { | 
					
						
							|  |  |  |             if ($_attr['nocache'] == 'true') { | 
					
						
							|  |  |  |                 $this->compiler->_compiler_status->tag_nocache = true; | 
					
						
							|  |  |  |             }  | 
					
						
							|  |  |  |         }  | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-10 01:15:53 +00:00
										 |  |  |         if (!isset($_attr['filter'])) { | 
					
						
							|  |  |  |             $_attr['filter'] = 'null'; | 
					
						
							|  |  |  |         }  | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         if (isset($_attr['assign'])) { | 
					
						
							|  |  |  |             // assign output to variable
 | 
					
						
							|  |  |  |             $output = '<?php $_smarty_tpl->assign(' . $_attr['assign'] . ',' . $_attr['value'] . ');?>'; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             // display value
 | 
					
						
							|  |  |  |             $this->compiler->has_output = true; | 
					
						
							| 
									
										
										
										
											2009-04-10 01:15:53 +00:00
										 |  |  |             $output = '<?php echo $this->smarty->filter_handler->execute(\'variable\', ' . $_attr['value'] . ',' . $_attr['filter'] . ');?>'; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         }  | 
					
						
							|  |  |  |         return $output; | 
					
						
							|  |  |  |     }  | 
					
						
							|  |  |  | }  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ?>
 |