web/wp-content/plugins/exec-php/includes/cache.php
branchwordpress
changeset 123 561aa6d282f6
equal deleted inserted replaced
112:fb7cd02b9848 123:561aa6d282f6
       
     1 <?php
       
     2 
       
     3 require_once(dirname(__FILE__).'/option.php');
       
     4 require_once(dirname(__FILE__).'/usermeta.php');
       
     5 
       
     6 // -----------------------------------------------------------------------------
       
     7 // the ExecPhp_Cache serves as a cache for the option and usermeta
       
     8 // -----------------------------------------------------------------------------
       
     9 
       
    10 if (!class_exists('ExecPhp_Cache')) :
       
    11 class ExecPhp_Cache
       
    12 {
       
    13 	var $m_option = NULL;
       
    14 	var $m_usermetas = array();
       
    15 
       
    16 	// ---------------------------------------------------------------------------
       
    17 	// init
       
    18 	// ---------------------------------------------------------------------------
       
    19 
       
    20 	function ExecPhp_Cache()
       
    21 	{
       
    22 		$this->m_option =& new ExecPhp_Option();
       
    23 	}
       
    24 
       
    25 	// ---------------------------------------------------------------------------
       
    26 	// access
       
    27 	// ---------------------------------------------------------------------------
       
    28 
       
    29 	function &get_option()
       
    30 	{
       
    31 		return $this->m_option;
       
    32 	}
       
    33 
       
    34 	function &get_usermeta($user_id)
       
    35 	{
       
    36 		if (!isset($this->m_usermetas[$user_id]))
       
    37 			// this will generate warnings with error_reporting(E_STRICT) using PHP5
       
    38 			// see http://www.php.net/manual/en/language.references.whatdo.php
       
    39 			$this->m_usermetas[$user_id] =& new ExecPhp_UserMeta($user_id);
       
    40 		return $this->m_usermetas[$user_id];
       
    41 	}
       
    42 }
       
    43 endif;
       
    44 
       
    45 ?>