diff options
author | David M <davidmj@users.sourceforge.net> | 2006-08-19 04:42:13 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2006-08-19 04:42:13 +0000 |
commit | f39eeda2253b6c1ae815692a2ab359e75e4ed49a (patch) | |
tree | 1e286d2b8388bda602f91bed0475f805fe92b00c /phpBB | |
parent | 11dba17606b6722df06b71ffa31a14998f363dde (diff) | |
download | forums-f39eeda2253b6c1ae815692a2ab359e75e4ed49a.tar forums-f39eeda2253b6c1ae815692a2ab359e75e4ed49a.tar.gz forums-f39eeda2253b6c1ae815692a2ab359e75e4ed49a.tar.bz2 forums-f39eeda2253b6c1ae815692a2ab359e75e4ed49a.tar.xz forums-f39eeda2253b6c1ae815692a2ab359e75e4ed49a.zip |
The regex used here are more or less identical to those used internally by the PHP lexer (ok, ok, they are a *little* bit more optimized), we should not need to call the tokenizer at all now...
git-svn-id: file:///svn/phpbb/trunk@6302 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/functions_template.php | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 7f29c2a040..4fecd0737e 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -103,14 +103,15 @@ class template_compile if (!function_exists('token_get_all')) { + // This matches the information gathered from the internal PHP lexer $match = array( - '\\?php[\n\r\s\t]+', - '[\\?%]=', - '[\\?%][^\w]', - 'script[\n\r\s\t]+language[\n\r\s\t]*=[\n\r\s\t]*[\'"]php[\'"]' + '#<\?.*?\?>#s', + '#<[%?]=.*?\?>#s', + '#<script\s+language\s*=\s*(["\']?)php\1\s*>.*?</script\s*>#s', + '#<\?php(?:\r\n?|[ \n\t]).*?\?>#s' ); - $code = preg_replace('#<(' . implode('|', $match) . ')#is', '<$1', $code); + $code = preg_replace($match, '', $code); return; } } @@ -169,12 +170,6 @@ class template_compile // php is a no-no. There is a potential issue here in that non-php // content may be removed ... however designers should use entities // if they wish to display < and > -/* - $match_php_tags = array('#\<\?php.*?\?\>#is', '#<[^\w<]*(script)(((?:"[^"]*"|\'[^\']*\'|[^<>\'"])+)?(language[^<>\'"]+("[^"]*php[^"]*"|\'[^\']*php[^\']*\'))((?:"[^"]*"|\'[^\']*\'|[^<>\'"])+)?)?>.*?</script>#is', '#\<\?.*?\?\>#s', '#\<%.*?%\>#s'); - $code = preg_replace($match_php_tags, '', $code); -*/ - - // An alternative to the above would be calling this function which would be the ultimate solution but also has its drawbacks. $this->remove_php_tags($code); // Pull out all block/statement level elements and seperate plain text |