Skip to content

Instantly share code, notes, and snippets.

@russ
Created July 30, 2012 17:29
Show Gist options
  • Save russ/3208554 to your computer and use it in GitHub Desktop.
Save russ/3208554 to your computer and use it in GitHub Desktop.
<?
/**
* 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