num_section; break; case 'cms_editorial_parametres_perso': $index=$cms_object->num_type; break; case 'cms_editorial_publications_states': $index=0; break; case 'cms_logo': $index=$cms_object->type.'_'.$cms_object->id; break; default: $index=$cms_object->id; break; } return $index; } /** * @param object $cms_object an storable cms object * @return bool true if exists in the array, false otherwise */ public static function get_at_cms_cache($cms_object){ if(!isset(self::$cms_cache_arrayObject[get_class($cms_object)][self::get_index($cms_object)])) { self::$cms_cache_arrayObject[get_class($cms_object)][self::get_index($cms_object)] = null; } if(is_null(self::$cms_cache_arrayObject[get_class($cms_object)][self::get_index($cms_object)])){ return false; }else{ return self::$cms_cache_arrayObject[get_class($cms_object)][self::get_index($cms_object)]; } } /** * @param object $cms_object an storable cms object */ public static function set_at_cms_cache($cms_object){ self::$cms_cache_arrayObject[get_class($cms_object)][self::get_index($cms_object)]=$cms_object; } /* * Private contructor */ private function __construct() {} /* * Prevent cloning of instance */ private function __clone() { throw new Exception('Clone is not allowed !'); } /* * Set the instance to null */ private function __destruct() { self::$cms_cache_arrayObject=null; } public static function clean_cache(){ global $dbh; pmb_mysql_query("TRUNCATE TABLE cms_cache_cadres"); cms_build::$hash_cache_cadres = array(); } }