szurubooru/src/Messenger.php

28 lines
559 B
PHP
Raw Normal View History

<?php
class Messenger
{
2014-05-16 21:38:33 +02:00
public static function success($message)
{
2014-05-16 21:38:33 +02:00
self::message($message, true);
}
public static function fail($message)
{
self::message($message, false);
}
2014-05-16 21:38:33 +02:00
private static function message($message, $success = true)
{
2014-05-15 10:32:53 +02:00
$context = Core::getContext();
2014-05-16 21:38:33 +02:00
$message = $message ?: 'Empty message';
if (!preg_match('/[.?!]$/', $message))
$message .= '.';
$context->transport->success = $success;
$context->transport->message = $message;
$context->transport->messageHtml = TextHelper::parseMarkdown($message, true);
}
}