Skip to content
Browse files

Added ability to remove session keys by regexp

  • Loading branch information...
1 parent 26ddc1f commit 5bbb34ad51215885f0671eda6bfeb8f59e091fe9 @Artazor Artazor committed Jun 5, 2012
Showing with 14 additions and 1 deletion.
  1. +14 −1 session/session.class.php
View
15 session/session.class.php
@@ -1,9 +1,22 @@
<?
- class Oxygen_Session extends Oxygen_Object
+ class Oxygen_Session extends Oxygen_Object
implements ArrayAccess
{
+ public function removeRegexp($pattern) {
+ $keys = array_keys($_SESSION);
+ $remove = array();
+ foreach($keys as $key) {
+ if(preg_match($pattern, $key)) {
+ $remove[] = $key;
+ }
+ }
+ foreach($remove as $key) {
+ unset($_SESSION[$key]);
+ }
+ }
+
public function put($offset,$value) {
$_SESSION[$offset] = serialize($value);
}

0 comments on commit 5bbb34a

Please sign in to comment.
Something went wrong with that request. Please try again.