Created
July 30, 2012 17:29
-
-
Save russ/3208554 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* A Flash model. | |
* @package hydra_flash | |
* @version 0.1 | |
*/ | |
session_start(); | |
class HydraFlash { | |
public static function __callStatic($method, $arguments) { | |
HydraFlash::message($method, $arguments[0]); | |
} | |
public static function message($type, $message) { | |
if (!isset($_SESSION["flash"][$type])) { | |
$_SESSION["flash"][$type] = array(); | |
} | |
$_SESSION["flash"][$type][] = $message; | |
} | |
public static function messages() { | |
$messages = $_SESSION["flash"]; | |
$_SESSION["flash"] = array(); | |
return $messages; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment