Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make FlashMessenger::clear() public.

  • Loading branch information...
commit cf8f3db72681a4ac0d976d3878ef614157211671 1 parent 59ff873
@dimkalinux dimkalinux authored
Showing with 7 additions and 26 deletions.
  1. +1 −1  include/essentials.php
  2. +6 −25 include/flash_messenger.php
View
2  include/essentials.php
@@ -96,8 +96,8 @@
require FORUM_CACHE_DIR.'cache_config.php';
}
-// Load the Flash messenger class
require FORUM_ROOT.'include/flash_messenger.php';
+$forum_flash = new FlashMessenger();
// If the request_uri is invalid try fix it
forum_fix_request_uri();
View
31 include/flash_messenger.php
@@ -10,15 +10,13 @@
class FlashMessenger
{
- const TEMPLATE_MSG_BLOCK = '%s';
- const TEMPLATE_MSG = '<span class="%s">%s</span>';
+ const TEMPLATE_MSG_BLOCK = '%s';
+ const TEMPLATE_MSG = '<span class="%s">%s</span>';
- //
- const MSG_TYPE_ERROR = 'message_error';
- const MSG_TYPE_WARNING = 'message_warning';
- const MSG_TYPE_INFO = 'message_info';
+ const MSG_TYPE_ERROR = 'message_error';
+ const MSG_TYPE_WARNING = 'message_warning';
+ const MSG_TYPE_INFO = 'message_info';
- //
private $message;
@@ -26,7 +24,6 @@ public function __construct()
{
global $forum_config;
- // Do not use with redirect
$disabled = isset($forum_config['o_redirect_delay']) && intval($forum_config['o_redirect_delay'], 10) > 0;
if (!$disabled)
@@ -37,29 +34,21 @@ public function __construct()
$this->message = $this->get_message();
}
-
- // Add error message
public function add_error($msg)
{
$this->add_message($msg, self::MSG_TYPE_ERROR);
}
-
- // Add warning message
public function add_warning($msg)
{
$this->add_message($msg, self::MSG_TYPE_WARNING);
}
-
- // Add info message
public function add_info($msg)
{
$this->add_message($msg, self::MSG_TYPE_INFO);
}
-
- //
public function show($just_return = false)
{
if (empty($this->message))
@@ -78,29 +67,24 @@ public function show($just_return = false)
$this->clear();
}
-
- //
- private function clear()
+ public function clear()
{
$this->message = NULL;
$this->save_message();
}
- //
private function add_message($message, $type)
{
$this->message = array($message, $type);
$this->save_message();
}
-
private function save_message()
{
$_SESSION['punbb_forum_flash'] = serialize($this->message);
}
-
private function get_message()
{
$message = NULL;
@@ -120,6 +104,3 @@ private function get_message()
return $message;
}
}
-
-// Create the flash messenger adapter object
-$forum_flash = new FlashMessenger();
Please sign in to comment.
Something went wrong with that request. Please try again.