diff options
Diffstat (limited to 'include/functions.php')
-rw-r--r-- | include/functions.php | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/include/functions.php b/include/functions.php index 962ebb057..9a3ea4315 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2039,6 +2039,7 @@ $data['cdm_expanded'] = get_pref($link, 'CDM_EXPANDED'); $data['dep_ts'] = calculate_dep_timestamp(); + $data['reload_on_ts_change'] = !defined('_NO_RELOAD_ON_TS_CHANGE'); if (file_exists(LOCK_DIRECTORY . "/update_daemon.lock")) { @@ -2685,16 +2686,22 @@ } if ($entry->hasAttributes()) { - foreach (iterator_to_array($entry->attributes) as $attr) { + $attrs_to_remove = array(); + + foreach ($entry->attributes as $attr) { if (strpos($attr->nodeName, 'on') === 0) { - $entry->removeAttributeNode($attr); + array_push($attrs_to_remove, $attr); } if (in_array($attr->nodeName, $disallowed_attributes)) { - $entry->removeAttributeNode($attr); + array_push($attrs_to_remove, $attr); } } + + foreach ($attrs_to_remove as $attr) { + $entry->removeAttributeNode($attr); + } } } @@ -4084,4 +4091,42 @@ return $max_ts; } + function T_js_decl($s1, $s2) { + if ($s1 && $s2) { + $s1 = preg_replace("/\n/", "", $s1); + $s2 = preg_replace("/\n/", "", $s2); + + $s1 = preg_replace("/\"/", "\\\"", $s1); + $s2 = preg_replace("/\"/", "\\\"", $s2); + + return "T_messages[\"$s1\"] = \"$s2\";\n"; + } + } + + function init_js_translations() { + + print 'var T_messages = new Object(); + + function __(msg) { + if (T_messages[msg]) { + return T_messages[msg]; + } else { + return msg; + } + } + + function ngettext(msg1, msg2, n) { + return (parseInt(n) > 1) ? msg2 : msg1; + }'; + + $l10n = _get_reader(); + + for ($i = 0; $i < $l10n->total; $i++) { + $orig = $l10n->get_original_string($i); + $translation = __($orig); + + print T_js_decl($orig, $translation); + } + } + ?> |