Skip to content
Extraits de code Groupes Projets
Valider 43a85662 rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

refs #4256 disabling escaping is much better this way

parent 6abcb0db
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -108,22 +108,23 @@ class Notification
*/
public $priority;
/**
* Set to true in case you want the raw message output. Make sure to escape the text in this case by yourself.
* @var bool
*/
public $raw = false;
/**
* @param string $message The notification message.
* @param boolean $raw Set to true in case you want the raw message output. Make sure to escape the text in
* this case by yourself.
* @throws \Exception In case the message is empty.
*/
public function __construct($message, $raw = false)
public function __construct($message)
{
if (empty($message)) {
throw new \Exception('No notification message given');
}
$this->message = $message;
$this->raw = $raw;
}
public function hasNoClear()
......
......@@ -108,7 +108,8 @@ abstract class ControllerAdmin extends Controller
));
if (Piwik::isUserIsSuperUser()) {
$notification = new Notification($invalidPluginsWarning, true);
$notification = new Notification($invalidPluginsWarning);
$notification->raw = true;
$notification->context = Notification::CONTEXT_WARNING;
$notification->title = Piwik::translate('General_Warning') . ':';
Notification\Manager::notify('ControllerAdmin_InvalidPluginsWarning', $notification);
......
......@@ -352,7 +352,8 @@ class Controller extends Plugin\ControllerAdmin
$message .= ' ' . Piwik::translate('CorePluginsAdmin_ChangeSettingsPossible', array($target));
}
$notification = new Notification($message, true);
$notification = new Notification($message);
$notification->raw = true;
$notification->title = Piwik::translate('General_WellDone');
$notification->context = Notification::CONTEXT_SUCCESS;
Notification\Manager::notify('CorePluginsAdmin_PluginActivated', $notification);
......
......@@ -71,7 +71,8 @@ class Controller extends \Piwik\Plugin\Controller
$notification->type = Notification::TYPE_TOAST;
Notification\Manager::notify('ExampleUI_successToast', $notification);
$notification = new Notification('Phasellus tincidunt arcu at justo <a href="#">faucibus</a>, et lacinia est accumsan. ', true);
$notification = new Notification('Phasellus tincidunt arcu at justo <a href="#">faucibus</a>, et lacinia est accumsan. ');
$notification->raw = true;
$notification->context = Notification::CONTEXT_ERROR;
Notification\Manager::notify('ExampleUI_error', $notification);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter