diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2008-12-31 13:36:06 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-12-31 13:36:06 +0000 |
| commit | 1106aed2f6bc7a8976109b1fab6d0bd786070563 (patch) | |
| tree | 6280290d763cbc14487057d5416852ec03ddc5f5 /phpBB/includes/classes | |
| parent | 11e76473aaf0120a96edb4d3a96800603bffcc48 (diff) | |
| download | forums-1106aed2f6bc7a8976109b1fab6d0bd786070563.tar forums-1106aed2f6bc7a8976109b1fab6d0bd786070563.tar.gz forums-1106aed2f6bc7a8976109b1fab6d0bd786070563.tar.bz2 forums-1106aed2f6bc7a8976109b1fab6d0bd786070563.tar.xz forums-1106aed2f6bc7a8976109b1fab6d0bd786070563.zip | |
oi... index page looks good...
git-svn-id: file:///svn/phpbb/trunk@9246 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/classes')
| -rw-r--r-- | phpBB/includes/classes/template.php | 6 | ||||
| -rw-r--r-- | phpBB/includes/classes/template_compile.php | 41 |
2 files changed, 27 insertions, 20 deletions
diff --git a/phpBB/includes/classes/template.php b/phpBB/includes/classes/template.php index 167f33f3e8..f574f4d9fb 100644 --- a/phpBB/includes/classes/template.php +++ b/phpBB/includes/classes/template.php @@ -180,9 +180,6 @@ class phpbb_template $_rootref = &$this->_rootref; $_lang = &phpbb::$user->lang; - // These _are_ used the included files. - $_tpldata; $_rootref; $_lang; - if (($filename = $this->_tpl_load($handle)) !== false) { ($include_once) ? include_once($filename) : include($filename); @@ -497,9 +494,6 @@ class phpbb_template $_rootref = &$this->_rootref; $_lang = &phpbb::$user->lang; - // These _are_ used the included files. - $_tpldata; $_rootref; $_lang; - if ($filename) { include($filename); diff --git a/phpBB/includes/classes/template_compile.php b/phpBB/includes/classes/template_compile.php index b8fc662208..a5ead08b35 100644 --- a/phpBB/includes/classes/template_compile.php +++ b/phpBB/includes/classes/template_compile.php @@ -17,11 +17,10 @@ if (!defined('IN_PHPBB')) } /** - * The template filter that does the actual compilation - * @see template_compile - * @package phpBB3 - * - */ +* The template filter that does the actual compilation +* @see template_compile +* @package phpBB3 +*/ class phpbb_template_filter extends php_user_filter { /** @@ -184,25 +183,33 @@ class phpbb_template_filter extends php_user_filter $text_blocks = str_replace($var_val[0], $new, $text_blocks); } + // Handle special language tags L_ and LA_ + $this->compile_language_tags($text_blocks); + // This will handle the remaining root-level varrefs + $text_blocks = preg_replace('#\{([a-z0-9\-_]*)\}#is', "<?php echo (isset(\$_rootref['\\1'])) ? \$_rootref['\\1'] : ''; ?>", $text_blocks); + $text_blocks = preg_replace('#\{\$([a-z0-9\-_]*)\}#is', "<?php echo (isset(\$_tpldata['DEFINE']['.']['\\1'])) ? \$_tpldata['DEFINE']['.']['\\1'] : ''; ?>", $text_blocks); + + return $text_blocks; + } + + /** + * Handlse special language tags L_ and LA_ + */ + private function compile_language_tags(&$text_blocks) + { // transform vars prefixed by L_ into their language variable pendant if nothing is set within the tpldata array if (strpos($text_blocks, '{L_') !== false) { - $text_blocks = preg_replace('#\{L_([a-z0-9\-_]*)\}#is', "<?php echo ((isset(\$_rootref['L_\\1'])) ? \$_rootref['L_\\1'] : ((isset(\$_lang['\\1'])) ? \$_lang['\\1'] : '{ \\1 }')); ?>", $text_blocks); + $text_blocks = preg_replace('#\{L_([a-z0-9\-_]*)\}#is', "<?php echo (isset(\$_rootref['L_\\1'])) ? \$_rootref['L_\\1'] : (isset(\$_lang['\\1']) ? \$_lang['\\1'] : '{ \\1 }'); ?>", $text_blocks); } // Handle addslashed language variables prefixed with LA_ // If a template variable already exist, it will be used in favor of it... if (strpos($text_blocks, '{LA_') !== false) { - $text_blocks = preg_replace('#\{LA_([a-z0-9\-_]*)\}#is', "<?php echo ((isset(\$_rootref['LA_\\1'])) ? \$_rootref['LA_\\1'] : ((isset(\$_rootref['L_\\1'])) ? addslashes(\$_rootref['L_\\1']) : ((isset(\$_lang['\\1'])) ? addslashes(\$_lang['\\1']) : '{ \\1 }'))); ?>", $text_blocks); + $text_blocks = preg_replace('#\{LA_([a-z0-9\-_]*)\}#is', "<?php echo (isset(\$_rootref['LA_\\1'])) ? \$_rootref['LA_\\1'] : ((isset(\$_rootref['L_\\1'])) ? addslashes(\$_rootref['L_\\1']) : (isset(\$_lang['\\1']) ? addslashes(\$_lang['\\1']) : '{ \\1 }')); ?>", $text_blocks); } - - // Handle remaining varrefs - $text_blocks = preg_replace('#\{([a-z0-9\-_]*)\}#is', "<?php echo (isset(\$_rootref['\\1'])) ? \$_rootref['\\1'] : ''; ?>", $text_blocks); - $text_blocks = preg_replace('#\{\$([a-z0-9\-_]*)\}#is', "<?php echo (isset(\$_tpldata['DEFINE']['.']['\\1'])) ? \$_tpldata['DEFINE']['.']['\\1'] : ''; ?>", $text_blocks); - - return $text_blocks; } /** @@ -508,7 +515,13 @@ class phpbb_template_filter extends php_user_filter private function compile_tag_if($tag_args, $elseif) { $tokens = $this->compile_expression($tag_args); - return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $tokens) . ') { '); + + // @todo We suppress notices within IF statements until we find a way to correctly check them + $tpl = ($elseif) ? '} else if (@(' : 'if (@('; + $tpl .= implode(' ', $tokens); + $tpl .= ')) { '; + + return $tpl; } /** |
