web/wp-content/plugins/exec-php/includes/cache.php
branchwordpress
changeset 123 561aa6d282f6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/exec-php/includes/cache.php	Mon Feb 01 09:51:57 2010 +0000
@@ -0,0 +1,45 @@
+<?php
+
+require_once(dirname(__FILE__).'/option.php');
+require_once(dirname(__FILE__).'/usermeta.php');
+
+// -----------------------------------------------------------------------------
+// the ExecPhp_Cache serves as a cache for the option and usermeta
+// -----------------------------------------------------------------------------
+
+if (!class_exists('ExecPhp_Cache')) :
+class ExecPhp_Cache
+{
+	var $m_option = NULL;
+	var $m_usermetas = array();
+
+	// ---------------------------------------------------------------------------
+	// init
+	// ---------------------------------------------------------------------------
+
+	function ExecPhp_Cache()
+	{
+		$this->m_option =& new ExecPhp_Option();
+	}
+
+	// ---------------------------------------------------------------------------
+	// access
+	// ---------------------------------------------------------------------------
+
+	function &get_option()
+	{
+		return $this->m_option;
+	}
+
+	function &get_usermeta($user_id)
+	{
+		if (!isset($this->m_usermetas[$user_id]))
+			// this will generate warnings with error_reporting(E_STRICT) using PHP5
+			// see http://www.php.net/manual/en/language.references.whatdo.php
+			$this->m_usermetas[$user_id] =& new ExecPhp_UserMeta($user_id);
+		return $this->m_usermetas[$user_id];
+	}
+}
+endif;
+
+?>
\ No newline at end of file