$value, 'expire' => time() + $expire); } static function get($name){ if(!isset(self::$data[self::$deviceID], self::$data[self::$deviceID][$name])) return null; $_value = self::$data[self::$deviceID][$name]; if(!is_array($_value) || count($_value) == 0) return null; extract($_value); if(isset($expire) && $expire < time()) { unset(self::$data[$name]); $value = null; } return $value; } static function clear($name = ''){ if($name == '') self::$data = array(); else { if(isset(self::$data[self::$deviceID], self::$data[self::$deviceID][$name])) unset(self::$data[self::$deviceID][$name]); } //file_put_contents(WPDM_CACHE_DIR . '/session.txt', ''); } static function show(){ echo "
".print_r(self::$data, 1).""; } static function saveSession() { if(is_array(self::$data)) { $data = Crypt::encrypt(self::$data); if(!file_exists(WPDM_CACHE_DIR)) { @mkdir(WPDM_CACHE_DIR, 0755); @chmod(WPDM_CACHE_DIR, 0755); } file_put_contents(WPDM_CACHE_DIR . 'session-'.self::$deviceID.'.txt', $data); } } } new Session();