36 $this->CONFIG = $CONFIG;
66 if ($SUBTYPE_CACHE === null) {
94 if ($SUBTYPE_CACHE === null) {
98 if (isset($SUBTYPE_CACHE[$subtype_id])) {
99 return $SUBTYPE_CACHE[$subtype_id]->subtype;
117 if ($SUBTYPE_CACHE === null) {
121 foreach ($SUBTYPE_CACHE as $obj) {
137 $results =
_elgg_services()->db->getData(
"SELECT * FROM {$this->CONFIG->dbprefix}entity_subtypes");
139 $SUBTYPE_CACHE = array();
140 foreach ($results as
$row) {
141 $SUBTYPE_CACHE[$row->id] =
$row;
163 if ($SUBTYPE_CACHE === null) {
193 if ($SUBTYPE_CACHE === null) {
197 if (isset($SUBTYPE_CACHE[$subtype_id])) {
198 return $SUBTYPE_CACHE[$subtype_id]->class;
235 $cache_obj = (object) array(
245 $id =
_elgg_services()->db->insertData(
"INSERT INTO {$this->CONFIG->dbprefix}entity_subtypes" 246 .
" (type, subtype, class) VALUES ('$type', '$subtype', '$class')");
249 $cache_obj->id =
$id;
250 $SUBTYPE_CACHE[
$id] = $cache_obj;
277 .
" WHERE type = '$type' AND subtype = '$subtype'");
281 $SUBTYPE_CACHE = null;
304 if ($SUBTYPE_CACHE === null) {
308 $unescaped_class =
$class;
315 SET type = '$type', subtype = '$subtype', class = '$class' 320 $SUBTYPE_CACHE[
$id]->class = $unescaped_class;
update($type, $subtype, $class= '')
Update a registered type, subtype, and class name.
_elgg_populate_subtype_cache()
Fetch all suptypes from DB to local cache.
_elgg_retrieve_cached_subtype($type, $subtype)
Retrieve subtype from the cache.
get_subtype_id($type, $subtype)
Return the id for a given subtype.
retrieveFromCache($type, $subtype)
Retrieve subtype from the cache.
populateCache()
Fetch all suptypes from DB to local cache.
if(isset($vars['id'])) $class
sanitise_string($string)
Wrapper function for alternate English spelling (.
elgg global
Pointer to the global context.
add($type, $subtype, $class="")
Register with a certain type and subtype to be loaded as a specific class.
getClassFromId($subtype_id)
Returns the class name for a subtype id.
getSubtype($subtype_id)
Gets the denormalized string for a given subtype ID.
getId($type, $subtype)
Return the id for a given subtype.
global $SUBTYPE_CACHE
Cache subtypes and related class names.
if(!$collection_name) $id
__construct()
Constructor.
getClass($type, $subtype)
Return the class name for a registered type and subtype.