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:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user