diff --git a/GPL_LIB/Smarty/libs/Smarty_Compiler.class.php b/GPL_LIB/Smarty/libs/Smarty_Compiler.class.php index 394f5f52d6e801052663d0ee83da57b48695c1ae..4cd71453c675b76fbccfe9d72c0be45a7afabb1f 100644 --- a/GPL_LIB/Smarty/libs/Smarty_Compiler.class.php +++ b/GPL_LIB/Smarty/libs/Smarty_Compiler.class.php @@ -32,6 +32,7 @@ * Template compiling class * @package Smarty */ + class Smarty_Compiler extends Smarty { // internal vars @@ -289,7 +290,7 @@ class Smarty_Compiler extends Smarty { for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) { if ($this->php_handling == SMARTY_PHP_PASSTHRU) { /* echo php contents */ - $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '<?php echo \''.str_replace("'", "\'", $sp_match[1][$curr_sp]).'\'; ?>'."\n", $text_blocks[$curr_tb]); + $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '<?phpphp echo \''.str_replace("'", "\'", $sp_match[1][$curr_sp]).'\'; ?>'."\n", $text_blocks[$curr_tb]); } else if ($this->php_handling == SMARTY_PHP_QUOTE) { /* quote php tags */ $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', htmlspecialchars($sp_match[1][$curr_sp]), $text_blocks[$curr_tb]); @@ -298,7 +299,7 @@ class Smarty_Compiler extends Smarty { $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '', $text_blocks[$curr_tb]); } else { /* SMARTY_PHP_ALLOW, but echo non php starting tags */ - $sp_match[1][$curr_sp] = preg_replace('~(<\?(?!php|=|$))~i', '<?php echo \'\\1\'?>'."\n", $sp_match[1][$curr_sp]); + $sp_match[1][$curr_sp] = preg_replace('~(<\?(?!php|=|$))~i', '<?phpphp echo \'\\1\'?>'."\n", $sp_match[1][$curr_sp]); $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', $sp_match[1][$curr_sp], $text_blocks[$curr_tb]); } } @@ -337,7 +338,7 @@ class Smarty_Compiler extends Smarty { /* remove trailing whitespaces from the last text_block */ $text_blocks[$j] = rtrim($text_blocks[$j]); } - $text_blocks[$j] = "<?php echo '" . strtr($text_blocks[$j], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>"; + $text_blocks[$j] = "<?phpphp echo '" . strtr($text_blocks[$j], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>"; if ($compiled_tags[$j] == '{/strip}') { $compiled_tags[$j] = "\n"; /* slurped by php, but necessary if a newline is following the closing strip-tag */ @@ -366,7 +367,7 @@ class Smarty_Compiler extends Smarty { } if (!empty($this->_cache_serial)) { - $compiled_content = "<?php \$this->_cache_serials['".$this->_cache_include."'] = '".$this->_cache_serial."'; ?>" . $compiled_content; + $compiled_content = "<?phpphp \$this->_cache_serials['".$this->_cache_include."'] = '".$this->_cache_serial."'; ?>" . $compiled_content; } // remove unnecessary close/open tags @@ -387,7 +388,7 @@ class Smarty_Compiler extends Smarty { } // put header at the top of the compiled template - $template_header = "<?php /* Smarty version ".$this->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n"; + $template_header = "<?phpphp /* Smarty version ".$this->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n"; $template_header .= " compiled from ".strtr(urlencode($resource_name), array('%2F'=>'/', '%3A'=>':'))." */ ?>\n"; /* Emit code to load needed plugins. */ @@ -401,14 +402,14 @@ class Smarty_Compiler extends Smarty { } } $_plugins_params .= '))'; - $plugins_code = "<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');\nsmarty_core_load_plugins($_plugins_params, \$this); ?>\n"; + $plugins_code = "<?phpphp require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');\nsmarty_core_load_plugins($_plugins_params, \$this); ?>\n"; $template_header .= $plugins_code; $this->_plugin_info = array(); $this->_plugins_code = $plugins_code; } if ($this->_init_smarty_vars) { - $template_header .= "<?php require_once(SMARTY_CORE_DIR . 'core.assign_smarty_interface.php');\nsmarty_core_assign_smarty_interface(null, \$this); ?>\n"; + $template_header .= "<?phpphp require_once(SMARTY_CORE_DIR . 'core.assign_smarty_interface.php');\nsmarty_core_assign_smarty_interface(null, \$this); ?>\n"; $this->_init_smarty_vars = false; } @@ -443,7 +444,7 @@ class Smarty_Compiler extends Smarty { if (preg_match('~^' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '$~', $tag_command)) { /* tag name is a variable or object */ $_return = $this->_parse_var_props($tag_command . $tag_modifier); - return "<?php echo $_return; ?>" . $this->_additional_newline; + return "<?phpphp echo $_return; ?>" . $this->_additional_newline; } /* If the tag name is a registered object, we process it. */ @@ -468,7 +469,7 @@ class Smarty_Compiler extends Smarty { $this->_syntax_error('unexpected {else}', E_USER_ERROR, __FILE__, __LINE__); else $this->_push_tag('else'); - return '<?php else: ?>'; + return '<?phpphp else: ?>'; case 'elseif': list($_open_tag) = end($this->_tag_stack); @@ -480,7 +481,7 @@ class Smarty_Compiler extends Smarty { case '/if': $this->_pop_tag('if'); - return '<?php endif; ?>'; + return '<?phpphp endif; ?>'; case 'capture': return $this->_compile_capture_tag(true, $tag_args); @@ -500,15 +501,15 @@ class Smarty_Compiler extends Smarty { case 'sectionelse': $this->_push_tag('sectionelse'); - return "<?php endfor; else: ?>"; + return "<?phpphp endfor; else: ?>"; break; case '/section': $_open_tag = $this->_pop_tag('section'); if ($_open_tag == 'sectionelse') - return "<?php endif; ?>"; + return "<?phpphp endif; ?>"; else - return "<?php endfor; endif; ?>"; + return "<?phpphp endfor; endif; ?>"; case 'foreach': $this->_push_tag('foreach'); @@ -517,14 +518,14 @@ class Smarty_Compiler extends Smarty { case 'foreachelse': $this->_push_tag('foreachelse'); - return "<?php endforeach; else: ?>"; + return "<?phpphp endforeach; else: ?>"; case '/foreach': $_open_tag = $this->_pop_tag('foreach'); if ($_open_tag == 'foreachelse') - return "<?php endif; unset(\$_from); ?>"; + return "<?phpphp endif; unset(\$_from); ?>"; else - return "<?php endforeach; endif; unset(\$_from); ?>"; + return "<?phpphp endforeach; endif; unset(\$_from); ?>"; break; case 'strip': @@ -555,14 +556,14 @@ class Smarty_Compiler extends Smarty { return ''; case 3: /* literal */ - return "<?php echo '" . strtr($block[2], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>" . $this->_additional_newline; + return "<?phpphp echo '" . strtr($block[2], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>" . $this->_additional_newline; case 4: /* php */ if ($this->security && !$this->security_settings['PHP_TAGS']) { $this->_syntax_error("(secure mode) php tags not permitted", E_USER_WARNING, __FILE__, __LINE__); return; } - return '<?php ' . $block[3] .' ?>'; + return '<?phpphp ' . $block[3] .' ?>'; } break; @@ -638,7 +639,7 @@ class Smarty_Compiler extends Smarty { if ($have_function) { $output = call_user_func_array($plugin_func, array($tag_args, &$this)); if($output != '') { - $output = '<?php ' . $this->_push_cacheable_state('compiler', $tag_command) + $output = '<?phpphp ' . $this->_push_cacheable_state('compiler', $tag_command) . $output . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>'; } @@ -724,7 +725,7 @@ class Smarty_Compiler extends Smarty { $this->_pop_tag($tag_command); if ($start_tag) { - $output = '<?php ' . $this->_push_cacheable_state('block', $tag_command); + $output = '<?phpphp ' . $this->_push_cacheable_state('block', $tag_command); $attrs = $this->_parse_attrs($tag_args); $_cache_attrs=''; $arg_list = $this->_compile_arg_list('block', $tag_command, $attrs, $_cache_attrs); @@ -732,7 +733,7 @@ class Smarty_Compiler extends Smarty { $output .= '$_block_repeat=true;' . $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);'; $output .= 'while ($_block_repeat) { ob_start(); ?>'; } else { - $output = '<?php $_block_content = ob_get_contents(); ob_end_clean(); '; + $output = '<?phpphp $_block_content = ob_get_contents(); ob_end_clean(); '; $_out_tag_text = $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat)'; if ($tag_modifier != '') { $this->_parse_modifiers($_out_tag_text, $tag_modifier); @@ -811,7 +812,7 @@ class Smarty_Compiler extends Smarty { } if($output != '') { - $output = '<?php ' . $_cacheable_state . $_cache_attrs . 'echo ' . $output . ';' + $output = '<?phpphp ' . $_cacheable_state . $_cache_attrs . 'echo ' . $output . ';' . $this->_pop_cacheable_state('function', $tag_command) . "?>" . $this->_additional_newline; } @@ -909,7 +910,7 @@ class Smarty_Compiler extends Smarty { $output = ''; } - return '<?php ' . $prefix . $output . $postfix . "?>" . $newline; + return '<?phpphp ' . $prefix . $output . $postfix . "?>" . $newline; } /** @@ -943,7 +944,7 @@ class Smarty_Compiler extends Smarty { $_params = "array('args' => array(".implode(', ', (array)$arg_list)."))"; - return "<?php require_once(SMARTY_CORE_DIR . 'core.run_insert_handler.php');\necho smarty_core_run_insert_handler($_params, \$this); ?>" . $this->_additional_newline; + return "<?phpphp require_once(SMARTY_CORE_DIR . 'core.run_insert_handler.php');\necho smarty_core_run_insert_handler($_params, \$this); ?>" . $this->_additional_newline; } /** @@ -974,7 +975,7 @@ class Smarty_Compiler extends Smarty { $arg_list[] = "'$arg_name' => $arg_value"; } - $output = '<?php '; + $output = '<?phpphp '; if (isset($assign_var)) { $output .= "ob_start();\n"; @@ -1027,7 +1028,7 @@ class Smarty_Compiler extends Smarty { $_params = "array('smarty_file' => " . $attrs['file'] . ", 'smarty_assign' => '$assign_var', 'smarty_once' => $once_var, 'smarty_include_vars' => array(".implode(',', $arg_list)."))"; - return "<?php require_once(SMARTY_CORE_DIR . 'core.smarty_include_php.php');\nsmarty_core_smarty_include_php($_params, \$this); ?>" . $this->_additional_newline; + return "<?phpphp require_once(SMARTY_CORE_DIR . 'core.smarty_include_php.php');\nsmarty_core_smarty_include_php($_params, \$this); ?>" . $this->_additional_newline; } @@ -1042,7 +1043,7 @@ class Smarty_Compiler extends Smarty { $attrs = $this->_parse_attrs($tag_args); $arg_list = array(); - $output = '<?php '; + $output = '<?phpphp '; $section_name = $attrs['name']; if (empty($section_name)) { $this->_syntax_error("missing section name", E_USER_ERROR, __FILE__, __LINE__); @@ -1177,7 +1178,7 @@ class Smarty_Compiler extends Smarty { $name = null; } - $output = '<?php '; + $output = '<?phpphp '; $output .= "\$_from = $from; if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array'); }"; if (isset($name)) { $foreach_props = "\$this->_foreach[$name]"; @@ -1217,11 +1218,11 @@ class Smarty_Compiler extends Smarty { $assign = $attrs['assign']; else $assign = null; - $output = "<?php ob_start(); ?>"; + $output = "<?phpphp ob_start(); ?>"; $this->_capture_stack[] = array($buffer, $assign); } else { list($buffer, $assign) = array_pop($this->_capture_stack); - $output = "<?php \$this->_smarty_vars['capture'][$buffer] = ob_get_contents(); "; + $output = "<?phpphp \$this->_smarty_vars['capture'][$buffer] = ob_get_contents(); "; if (isset($assign)) { $output .= " \$this->assign($assign, ob_get_contents());"; } @@ -1397,9 +1398,9 @@ class Smarty_Compiler extends Smarty { } if ($elseif) - return '<?php elseif ('.implode(' ', $tokens).'): ?>'; + return '<?phpphp elseif ('.implode(' ', $tokens).'): ?>'; else - return '<?php if ('.implode(' ', $tokens).'): ?>'; + return '<?phpphp if ('.implode(' ', $tokens).'): ?>'; }