aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2002-12-03 13:46:33 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2002-12-03 13:46:33 +0000
commitb369a1e43cdeb9edeee8b4c86fbc395c7bb5d202 (patch)
treed576a9622486fe2bac21e5bdd636d0879455ef24 /phpBB/includes/template.php
parentef09c7e9c94d823cf890e198ab6cc1297d935fbb (diff)
downloadforums-b369a1e43cdeb9edeee8b4c86fbc395c7bb5d202.tar
forums-b369a1e43cdeb9edeee8b4c86fbc395c7bb5d202.tar.gz
forums-b369a1e43cdeb9edeee8b4c86fbc395c7bb5d202.tar.bz2
forums-b369a1e43cdeb9edeee8b4c86fbc395c7bb5d202.tar.xz
forums-b369a1e43cdeb9edeee8b4c86fbc395c7bb5d202.zip
Start to (re-)fix generation of "plain text" templates from compiled source for template editing
git-svn-id: file:///svn/phpbb/trunk@3166 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/template.php')
-rw-r--r--phpBB/includes/template.php69
1 files changed, 37 insertions, 32 deletions
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index bd2b7b9dc6..53e559a1c6 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -766,41 +766,46 @@ class Template {
function decompile(&$_str, $savefile = false)
{
-
$match_tags = array(
- "#(<\?php\nif \(.?this\->security\(\) \) \{\n)|(\n\}\n\?".">)#",
- "#echo '(.*?)';#s",
- "#\/\/ (INCLUDEPHP .*?)\n.?this\->assign_from_include_php\('.*?'\);\n#s",
- "#\/\/ (INCLUDE .*?)\n.?this\->assign_from_include\('.*?'\);\n#s",
- "#\/\/ (IF .*?)\nif \(.*?\) \{[ ]?\n#",
- "#\/\/ (ELSEIF .*?)\n\} elseif \(.*?\) \{[ ]?\n#",
- "#\/\/ (ELSE)\n\} else \{\n#",
- "#\/\/ (ENDIF)\n}\n#",
- "#\/\/ (BEGIN .*?)\n.?_.*? = \(.*?\) : 0;\nif \(.*?\) \{\nfor \(.*?\)\n\{\n#",
- "#\}\}?\n\/\/ (END .*?)\n#",
- "#\/\/ (BEGINELSE)\n\}\} else \{\n#",
- "#' \. \(\(isset\(.?this\->_tpldata\['\.'\]\[0\]\['([A-Z0-9_]+?)'\]\) \) \? .?this\->_tpldata\['\.'\]\[0\]\['([A-Z0-9_]+?)'\] : '' \) \. '#s",
- "#' \. \(\(isset\(.?this\->_tpldata\['([a-z0-9_]+?\.)'\]\[.?_[a-z0-9_]+?\]\['([A-Z0-9_]+)'\]\) \) \? .?this\->_tpldata\['[a-z0-9_]+?\.'\]\[.?_[a-z0-9_]+?\]\['[A-Z0-9_]+'\] : '' \) \. '#s",
- "#' \. \(\(isset\(.?this\->_tpldata\['([a-z0-9_]+?\.)'\]\[.?_[a-z0-9_]+?\]\['([a-z0-9_]+?\.)'\]\[.?_[a-z0-9_]+?\]\['([A-Z0-9_]+)'\]\) \) \? .?this\->_tpldata\['[a-z0-9_]+?\.'\]\[.?_[a-z0-9_]+?\]\['[a-z0-9_]+?\.'\]\[.?_[a-z0-9_]+?\]\['[A-Z0-9_]+'\] : '' \) \. '#s",
- "#' \. \(\(isset\(.?this\->_tpldata\['([a-z0-9_]+?\.)'\]\[.?_[a-z0-9_]+?\]\['([a-z0-9_]+?\.)'\]\[.?_[a-z0-9_]+?\]\['([a-z0-9_]+?\.)'\]\[.?_[a-z0-9_]+?\]\['([A-Z0-9_]+)'\]\) \) \? .?this\->_tpldata\['[a-z0-9_]+?\.'\]\[.?_[a-z0-9_]+?\]\['[a-z0-9_]+?\.'\]\[.?_[a-z0-9_]+?\]\['[a-z0-9_]+?\.'\]\[.?_[a-z0-9_]+?\]\['[A-Z0-9_]+'\] : '' \) \. '#s"
+ '#<\?php\nif \(\$this\->security\(\)\) \{(.*)[ \n]*?\n\}\n\?>$#s',
+ '#echo \'(.*?)\';#s',
+
+ '#\/\/ (INCLUDEPHP .*?)\n.?this\->assign_from_include_php\(\'.*?\'\);\n#s',
+ '#\/\/ (INCLUDE .*?)\n.?this\->assign_from_include\(\'.*?\'\);[\n]?#s',
+
+ '#\/\/ (IF .*?)\nif \(.*?\) \{[ ]?\n#',
+ '#\/\/ (ELSEIF .*?)\n\} elseif \(.*?\) \{[ ]?\n#',
+ '#\/\/ (ELSE)\n\} else \{\n#',
+ '#[\n]?\/\/ (ENDIF)\n}#',
+
+ '#\/\/ (BEGIN .*?)\n.?_.*? = \(.*?\) : 0;\nif \(.*?\) \{\nfor \(.*?\)\n\{\n#',
+ '#\}\}?\n\/\/ (END .*?)\n#',
+ '#\/\/ (BEGINELSE)[\n]+?\}\} else \{\n#',
+
+ '#\' \. \(\(isset\(\$this\->_tpldata\[\'\.\'\]\[0\]\[\'(L_([A-Z0-9_])+?)\'\]\)\).*?\}\'\)\) \. \'#s',
+
+ '#\' \. \(\(isset\(\$this\->_tpldata\[\'\.\'\]\[0\]\[\'([A-Z0-9_]+?)\'\]\)\).*?\'\'\) \. \'#s',
+
+ '#\' \. \(\(isset\(\$this\->_tpldata\[\'([a-z0-9_\.]+?)\'\].*?[\'([a-z0-9_\.]+?)\'\].*?\[\'([A-Z0-9_]+?)\'\]\)\).*?\'\'\) \. \'#s',
);
+//' . ((isset($this->_tpldata['faq_block_link.'][$_faq_block_link_i]['faq_row_link.'][$_faq_row_link_i]['U_FAQ_LINK'])) ? $this->_tpldata['faq_block_link.'][$_faq_block_link_i]['faq_row_link.'][$_faq_row_link_i]['U_FAQ_LINK'] : '') . '
+
$replace_tags = array(
- '',
- "\\1",
- "\\1",
- "<!-- \\1 -->",
- "<!-- \\1 -->",
- "<!-- \\1 -->",
- "<!-- \\1 -->",
- "<!-- \\1 -->",
- "<!-- \\1 -->",
- "<!-- \\1 -->",
- "<!-- \\1 -->",
- "{\\1}",
- "{\\1\\2}",
- "{\\1\\2\\3}",
- "{\\1\\2\\3\\4}"
+ '\1',
+ '\1',
+ '<!-- \1 -->',
+ '<!-- \1 -->',
+ '<!-- \1 -->',
+ '<!-- \1 -->',
+ '<!-- \1 -->',
+ '<!-- \1 -->',
+ '<!-- \1 -->',
+ '<!-- \1 -->',
+ '<!-- \1 -->',
+ '{\1}',
+ '{\1}',
+ '{\1\2\3}',
);
preg_match_all('#\/\/ PHP START\n(.*?)\n\/\/ PHP END\n#s', $_str, $matches);
@@ -823,7 +828,7 @@ class Template {
fwrite($tmpfile, $_str);
}
- return $tmpfile;
+ return $_str;
}
}