function cacheGet($key) { global $wp_version; if (version_compare($wp_version, '2.8', '>=')) { $trans_id = get_option('gad_trans_id'); if ($trans_id === false) { $trans_id = 0; } return get_transient('gad_cache_' . $trans_id . '_' . md5($key)); } else { $lh = SimpleFileCache::lock(); $filename = sys_get_temp_dir() . '/gad_cache_' . md5($key) . '.dat'; $result = ''; if ($f = @fopen($filename, "r")) { $data = fread($f, filesize($filename)); $result = unserialize($data); fclose($f); } SimpleFileCache::unlock($lh); return $result; } }