summaryrefslogtreecommitdiffstats
path: root/inc/message.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2014-08-15 13:10:56 +0200
committerSimon Rettberg2014-08-15 13:10:56 +0200
commitfe7412bdaf02e00699fd6654f74838c4cbe38bf9 (patch)
tree1975feb934a3d68abf2f243580cf1bd7d1c8f683 /inc/message.inc.php
parent[i18n] Sanity checks, introduced subdir for template language files (diff)
downloadslx-admin-fe7412bdaf02e00699fd6654f74838c4cbe38bf9.tar.gz
slx-admin-fe7412bdaf02e00699fd6654f74838c4cbe38bf9.tar.xz
slx-admin-fe7412bdaf02e00699fd6654f74838c4cbe38bf9.zip
Find messages and hardcoded-messages in php files, fix editing of messages
Diffstat (limited to 'inc/message.inc.php')
-rw-r--r--inc/message.inc.php14
1 files changed, 3 insertions, 11 deletions
diff --git a/inc/message.inc.php b/inc/message.inc.php
index 3fbff874..0e054846 100644
--- a/inc/message.inc.php
+++ b/inc/message.inc.php
@@ -1,9 +1,5 @@
<?php
-// TODO: Move to extra file
-global $error_text;
-$error_text = Dictionary::getMessages();
-
class Message
{
private static $list = array();
@@ -41,8 +37,6 @@ class Message
*/
private static function add($type, $id, $params)
{
- global $error_text;
- if (!isset($error_text[$id])) Util::traceError('Invalid message id: ' . $id);
self::$list[] = array(
'type' => $type,
'id' => $id,
@@ -58,11 +52,10 @@ class Message
*/
public static function renderList()
{
- global $error_text;
// Ajax
if (AJAX) {
foreach (self::$list as $item) {
- $message = $error_text[$item['id']];
+ $message = Dictionary::getMessage($item['id']);
foreach ($item['params'] as $index => $text) {
$message = str_replace('{{' . $index . '}}', '<b>' . htmlspecialchars($text) . '</b>', $message);
}
@@ -74,7 +67,7 @@ class Message
// Non-Ajax
if (!self::$flushed) Render::openTag('div', array('class' => 'container'));
foreach (self::$list as $item) {
- $message = $error_text[$item['id']];
+ $message = Dictionary::getMessage($item['id']);
foreach ($item['params'] as $index => $text) {
$message = str_replace('{{' . $index . '}}', '<b>' . htmlspecialchars($text) . '</b>', $message);
}
@@ -92,10 +85,9 @@ class Message
*/
public static function asString()
{
- global $error_text;
$return = '';
foreach (self::$list as $item) {
- $message = $error_text[$item['id']];
+ $message = Dictionary::getMessage($item['id']);
foreach ($item['params'] as $index => $text) {
$message = str_replace('{{' . $index . '}}', $text, $message);
}