Beispiel #1
0
 /**
  * Deletes the flash entries that were not marked for keeping.
  *
  */
 function sweep()
 {
     global $sess, $flash;
     if (!$sess->is_registered('flash')) {
         $flash = new Flash();
         $sess->register('flash');
     }
     // actually sweep
     $keys = array_keys($flash->flash);
     foreach ($keys as $k) {
         if (!$flash->used[$k]) {
             $flash->_use($k);
         } else {
             unset($flash->flash[$k]);
             unset($flash->used[$k]);
         }
     }
     // cleanup if someone meddled with flash or used
     $fkeys = array_keys($flash->flash);
     $ukeys = array_keys($flash->used);
     foreach (array_diff($fkeys, $ukeys) as $k => $v) {
         unset($flash->used[$k]);
     }
     // serialize it
     $flash = base64_encode(serialize($flash));
 }