1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-04 21:28:06 +02:00

[2.0.1] Start making more moves towards full error reporting. Revise message naming conventions. Fix variable assignment for error collecting. Revise Language interface to be as readable as possible (NOT compact). Add error reporting to DirectLex. Rewrite ErrorCollector.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1227 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2007-06-25 00:48:26 +00:00
parent 7b087c7bbe
commit 8ae2604440
9 changed files with 149 additions and 59 deletions

View File

@@ -71,17 +71,16 @@ class HTMLPurifier_Language
/**
* Formats a localised message with passed parameters
* @param $key string identifier of message
* @param $param Parameter to substitute in (arbitrary number)
* @param $args Parameters to substitute in
* @return string localised message
*/
function formatMessage($key) {
function formatMessage($key, $args = array()) {
if (!$this->_loaded) $this->load();
if (!isset($this->messages[$key])) return "[$key]";
$raw = $this->messages[$key];
$args = func_get_args();
$substitutions = array();
for ($i = 1; $i < count($args); $i++) {
$substitutions['$' . $i] = $args[$i];
foreach ($args as $i => $value) {
$substitutions['$' . $i] = $value;
}
return strtr($raw, $substitutions);
}