From 54d5d869ad2c525dd276f28a8409658a106d9e3f Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 4 Sep 2013 14:56:06 +0200 Subject: Generalize request_type() to static_storage() Signed-off-by: Florian Pritz --- application/helpers/filebin_helper.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'application/helpers') diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php index 9b124506f..7ba68b839 100644 --- a/application/helpers/filebin_helper.php +++ b/application/helpers/filebin_helper.php @@ -341,15 +341,19 @@ function send_json_reply($array, $status = "success") $CI->output->set_output(json_encode($reply)); } -function request_type($set_type = null) +function static_storage($key, $value = null) { - static $type = null; + static $storage = array(); - if ($set_type !== null) { - $type = $set_type; + if ($value !== null) { + $storage[$key] = $value; } - return $type; + if (!isset($storage[$key])) { + $storage[$key] = null; + } + + return $storage[$key]; } # vim: set noet: -- cgit v1.2.3-24-g4f1b