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
This commit is contained in:
Paul S. Owen 2002-12-03 13:46:33 +00:00
parent ef09c7e9c9
commit b369a1e43c

View file

@ -766,41 +766,46 @@ class Template {
function decompile(&$_str, $savefile = false) function decompile(&$_str, $savefile = false)
{ {
$match_tags = array( $match_tags = array(
"#(<\?php\nif \(.?this\->security\(\) \) \{\n)|(\n\}\n\?".">)#", '#<\?php\nif \(\$this\->security\(\)\) \{(.*)[ \n]*?\n\}\n\?>$#s',
"#echo '(.*?)';#s", '#echo \'(.*?)\';#s',
"#\/\/ (INCLUDEPHP .*?)\n.?this\->assign_from_include_php\('.*?'\);\n#s",
"#\/\/ (INCLUDE .*?)\n.?this\->assign_from_include\('.*?'\);\n#s", '#\/\/ (INCLUDEPHP .*?)\n.?this\->assign_from_include_php\(\'.*?\'\);\n#s',
"#\/\/ (IF .*?)\nif \(.*?\) \{[ ]?\n#", '#\/\/ (INCLUDE .*?)\n.?this\->assign_from_include\(\'.*?\'\);[\n]?#s',
"#\/\/ (ELSEIF .*?)\n\} elseif \(.*?\) \{[ ]?\n#",
"#\/\/ (ELSE)\n\} else \{\n#", '#\/\/ (IF .*?)\nif \(.*?\) \{[ ]?\n#',
"#\/\/ (ENDIF)\n}\n#", '#\/\/ (ELSEIF .*?)\n\} elseif \(.*?\) \{[ ]?\n#',
"#\/\/ (BEGIN .*?)\n.?_.*? = \(.*?\) : 0;\nif \(.*?\) \{\nfor \(.*?\)\n\{\n#", '#\/\/ (ELSE)\n\} else \{\n#',
"#\}\}?\n\/\/ (END .*?)\n#", '#[\n]?\/\/ (ENDIF)\n}#',
"#\/\/ (BEGINELSE)\n\}\} else \{\n#",
"#' \. \(\(isset\(.?this\->_tpldata\['\.'\]\[0\]\['([A-Z0-9_]+?)'\]\) \) \? .?this\->_tpldata\['\.'\]\[0\]\['([A-Z0-9_]+?)'\] : '' \) \. '#s", '#\/\/ (BEGIN .*?)\n.?_.*? = \(.*?\) : 0;\nif \(.*?\) \{\nfor \(.*?\)\n\{\n#',
"#' \. \(\(isset\(.?this\->_tpldata\['([a-z0-9_]+?\.)'\]\[.?_[a-z0-9_]+?\]\['([A-Z0-9_]+)'\]\) \) \? .?this\->_tpldata\['[a-z0-9_]+?\.'\]\[.?_[a-z0-9_]+?\]\['[A-Z0-9_]+'\] : '' \) \. '#s", '#\}\}?\n\/\/ (END .*?)\n#',
"#' \. \(\(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", '#\/\/ (BEGINELSE)[\n]+?\}\} else \{\n#',
"#' \. \(\(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"
'#\' \. \(\(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( $replace_tags = array(
'', '\1',
"\\1", '\1',
"\\1", '<!-- \1 -->',
"<!-- \\1 -->", '<!-- \1 -->',
"<!-- \\1 -->", '<!-- \1 -->',
"<!-- \\1 -->", '<!-- \1 -->',
"<!-- \\1 -->", '<!-- \1 -->',
"<!-- \\1 -->", '<!-- \1 -->',
"<!-- \\1 -->", '<!-- \1 -->',
"<!-- \\1 -->", '<!-- \1 -->',
"<!-- \\1 -->", '<!-- \1 -->',
"{\\1}", '{\1}',
"{\\1\\2}", '{\1}',
"{\\1\\2\\3}", '{\1\2\3}',
"{\\1\\2\\3\\4}"
); );
preg_match_all('#\/\/ PHP START\n(.*?)\n\/\/ PHP END\n#s', $_str, $matches); preg_match_all('#\/\/ PHP START\n(.*?)\n\/\/ PHP END\n#s', $_str, $matches);
@ -823,7 +828,7 @@ class Template {
fwrite($tmpfile, $_str); fwrite($tmpfile, $_str);
} }
return $tmpfile; return $_str;
} }
} }