mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
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:
parent
ef09c7e9c9
commit
b369a1e43c
1 changed files with 37 additions and 32 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue