コード例 #1
0
ファイル: html.php プロジェクト: evacomaroski/dokuwiki
/**
 * Prints the global message array
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function html_msgarea()
{
    global $MSG, $MSG_shown;
    /** @var array $MSG */
    // store if the global $MSG has already been shown and thus HTML output has been started
    $MSG_shown = true;
    if (!isset($MSG)) {
        return;
    }
    $shown = array();
    foreach ($MSG as $msg) {
        $hash = md5($msg['msg']);
        if (isset($shown[$hash])) {
            continue;
        }
        // skip double messages
        if (info_msg_allowed($msg)) {
            print '<div class="' . $msg['lvl'] . '">';
            print $msg['msg'];
            print '</div>';
        }
        $shown[$hash] = 1;
    }
    unset($GLOBALS['MSG']);
}
コード例 #2
0
/**
 * Prints the global message array in Bootstrap style
 *
 * @author Andreas Gohr <*****@*****.**>
 * @author Giuseppe Di Terlizzi <*****@*****.**>
 */
function bootstrap3_html_msgarea()
{
    global $MSG, $MSG_shown;
    /** @var array $MSG */
    // store if the global $MSG has already been shown and thus HTML output has been started
    $MSG_shown = true;
    if (!isset($MSG)) {
        return;
    }
    $shown = array();
    foreach ($MSG as $msg) {
        $hash = md5($msg['msg']);
        if (isset($shown[$hash])) {
            continue;
        }
        // skip double messages
        if (info_msg_allowed($msg)) {
            switch ($msg['lvl']) {
                case 'info':
                    $level = 'info';
                    $icon = 'fa fa-fw fa-info-circle';
                    break;
                case 'error':
                    $level = 'danger';
                    $icon = 'fa fa-fw fa-times-circle';
                    break;
                case 'notify':
                    $level = 'warning';
                    $icon = 'fa fa-fw fa-warning';
                    break;
                case 'success':
                    $level = 'success';
                    $icon = 'fa fa-fw fa-check-circle';
                    break;
            }
            print '<div class="alert alert-' . $level . '">';
            print '<i class="' . $icon . '"></i> ';
            print $msg['msg'];
            print '</div>';
        }
        $shown[$hash] = 1;
    }
    unset($GLOBALS['MSG']);
}