From 2b7297a186ee86508a4784267d08ca19851d4254 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 13 Jul 2010 20:17:27 -0600 Subject: [PATCH] Remove horde/Core dependency in horde/Notification --- framework/Core/lib/Horde/Core/Notification/Status.php | 2 ++ .../Notification/lib/Horde/Notification/Event/Status.php | 11 +++++++++-- .../Notification/Class/Notification/Event/StatusTest.php | 5 +---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/framework/Core/lib/Horde/Core/Notification/Status.php b/framework/Core/lib/Horde/Core/Notification/Status.php index 4b5cd7352..2a8f3c9cc 100644 --- a/framework/Core/lib/Horde/Core/Notification/Status.php +++ b/framework/Core/lib/Horde/Core/Notification/Status.php @@ -29,6 +29,8 @@ class Horde_Core_Notification_Status extends Horde_Notification_Event_Status : (is_string($data) ? 'horde.message' : 'horde.error'); } + $this->charset = $GLOBALS['registry']->getCharset(); + parent::__construct($data, $type, $flags); } diff --git a/framework/Notification/lib/Horde/Notification/Event/Status.php b/framework/Notification/lib/Horde/Notification/Event/Status.php index fafee18d3..045e0494a 100644 --- a/framework/Notification/lib/Horde/Notification/Event/Status.php +++ b/framework/Notification/lib/Horde/Notification/Event/Status.php @@ -14,6 +14,13 @@ class Horde_Notification_Event_Status extends Horde_Notification_Event { /** + * Charset of the message. + * + * @var string + */ + public $charset = null; + + /** * String representation of this object. * * @return string String representation. @@ -22,8 +29,8 @@ class Horde_Notification_Event_Status extends Horde_Notification_Event { $text = $this->message; - if (!in_array('content.raw', $this->flags) && class_exists('Horde_Nls')) { - $text = htmlspecialchars($text, ENT_COMPAT, $GLOBALS['registry']->getCharset()); + if (!in_array('content.raw', $this->flags)) { + $text = htmlspecialchars($text, ENT_COMPAT, $charset); } return $text; diff --git a/framework/Notification/test/Horde/Notification/Class/Notification/Event/StatusTest.php b/framework/Notification/test/Horde/Notification/Class/Notification/Event/StatusTest.php index 6279d81b9..6963a5198 100644 --- a/framework/Notification/test/Horde/Notification/Class/Notification/Event/StatusTest.php +++ b/framework/Notification/test/Horde/Notification/Class/Notification/Event/StatusTest.php @@ -32,11 +32,8 @@ class Horde_Notification_Class_Notification_Event_StatusTest extends PHPUnit_Fra { public function testMethodTostringHasResultTheTextOfTheEvent() { - if (!class_exists('Horde_Nls')) { - $this->markTestSkipped('The Horde_Nls class is not available!'); - } - $GLOBALS['registry']->setCharset('ISO-8859-1'); $event = new Horde_Notification_Event_Status('test'); + $event->charset = 'ISO-8859-1'; $this->assertEquals('<b>test</b>', (string) $event); } -- 2.11.0