Elgg  Version 1.9
metadata.php
Go to the documentation of this file.
1 <?php
19  if (!($row instanceof stdClass)) {
20  return $row;
21  }
22 
23  return new ElggMetadata($row);
24 }
25 
37 }
38 
47  if (!$metadata) {
48  return false;
49  }
50  return $metadata->delete();
51 }
52 
69 function create_metadata($entity_guid, $name, $value, $value_type = '', $owner_guid = 0,
70  $access_id = ACCESS_PRIVATE, $allow_multiple = false) {
71 
73 
75  // name and value are encoded in add_metastring()
76  //$name = sanitise_string(trim($name));
77  //$value = sanitise_string(trim($value));
78  $value_type = detect_extender_valuetype($value, sanitise_string(trim($value_type)));
79  $time = time();
80  $owner_guid = (int)$owner_guid;
81  $allow_multiple = (boolean)$allow_multiple;
82 
83  if (!isset($value)) {
84  return false;
85  }
86 
87  if ($owner_guid == 0) {
89  }
90 
91  $access_id = (int)$access_id;
92 
93  $query = "SELECT * from {$CONFIG->dbprefix}metadata"
94  . " WHERE entity_guid = $entity_guid and name_id=" . elgg_get_metastring_id($name) . " limit 1";
95 
96  $existing = get_data_row($query);
97  if ($existing && !$allow_multiple) {
98  $id = (int)$existing->id;
99  $result = update_metadata($id, $name, $value, $value_type, $owner_guid, $access_id);
100 
101  if (!$result) {
102  return false;
103  }
104  } else {
105  // Support boolean types
106  if (is_bool($value)) {
107  $value = (int) $value;
108  }
109 
110  // Add the metastrings
111  $value_id = elgg_get_metastring_id($value);
112  if (!$value_id) {
113  return false;
114  }
115 
116  $name_id = elgg_get_metastring_id($name);
117  if (!$name_id) {
118  return false;
119  }
120 
121  // If ok then add it
122  $query = "INSERT into {$CONFIG->dbprefix}metadata"
123  . " (entity_guid, name_id, value_id, value_type, owner_guid, time_created, access_id)"
124  . " VALUES ($entity_guid, '$name_id','$value_id','$value_type', $owner_guid, $time, $access_id)";
125 
126  $id = insert_data($query);
127 
128  if ($id !== false) {
130  if (elgg_trigger_event('create', 'metadata', $obj)) {
131 
132  _elgg_get_metadata_cache()->save($entity_guid, $name, $value, $allow_multiple);
133 
134  return $id;
135  } else {
137  }
138  }
139  }
140 
141  return $id;
142 }
143 
156 function update_metadata($id, $name, $value, $value_type, $owner_guid, $access_id) {
157  global $CONFIG;
158 
159  $id = (int)$id;
160 
161  if (!$md = elgg_get_metadata_from_id($id)) {
162  return false;
163  }
164  if (!$md->canEdit()) {
165  return false;
166  }
167 
168  // If memcached then we invalidate the cache for this entry
169  static $metabyname_memcache;
170  if ((!$metabyname_memcache) && (is_memcache_available())) {
171  $metabyname_memcache = new ElggMemcache('metabyname_memcache');
172  }
173 
174  if ($metabyname_memcache) {
175  // @todo fix memcache (name_id is not a property of ElggMetadata)
176  $metabyname_memcache->delete("{$md->entity_guid}:{$md->name_id}");
177  }
178 
179  $value_type = detect_extender_valuetype($value, sanitise_string(trim($value_type)));
180 
181  $owner_guid = (int)$owner_guid;
182  if ($owner_guid == 0) {
184  }
185 
186  $access_id = (int)$access_id;
187 
188  // Support boolean types (as integers)
189  if (is_bool($value)) {
190  $value = (int) $value;
191  }
192 
193  $value_id = elgg_get_metastring_id($value);
194  if (!$value_id) {
195  return false;
196  }
197 
198  $name_id = elgg_get_metastring_id($name);
199  if (!$name_id) {
200  return false;
201  }
202 
203  // If ok then add it
204  $query = "UPDATE {$CONFIG->dbprefix}metadata"
205  . " set name_id='$name_id', value_id='$value_id', value_type='$value_type', access_id=$access_id,"
206  . " owner_guid=$owner_guid where id=$id";
207 
208  $result = update_data($query);
209  if ($result !== false) {
210 
211  _elgg_get_metadata_cache()->save($md->entity_guid, $name, $value);
212 
213  // @todo this event tells you the metadata has been updated, but does not
214  // let you do anything about it. What is needed is a plugin hook before
215  // the update that passes old and new values.
217  elgg_trigger_event('update', 'metadata', $obj);
218  }
219 
220  return $result;
221 }
222 
239 function create_metadata_from_array($entity_guid, array $name_and_values, $value_type, $owner_guid,
240 $access_id = ACCESS_PRIVATE, $allow_multiple = false) {
241 
242  foreach ($name_and_values as $k => $v) {
243  $result = create_metadata($entity_guid, $k, $v, $value_type, $owner_guid,
244  $access_id, $allow_multiple);
245  if (!$result) {
246  return false;
247  }
248  }
249  return true;
250 }
251 
282 function elgg_get_metadata(array $options = array()) {
283 
284  // @todo remove support for count shortcut - see #4393
285  // support shortcut of 'count' => true for 'metadata_calculation' => 'count'
286  if (isset($options['count']) && $options['count']) {
287  $options['metadata_calculation'] = 'count';
288  unset($options['count']);
289  }
290 
291  $options['metastring_type'] = 'metadata';
293 }
294 
307  if (!_elgg_is_valid_options_for_batch_operation($options, 'metadata')) {
308  return false;
309  }
310  $options['metastring_type'] = 'metadata';
311  $result = _elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback', false);
312 
313  // This moved last in case an object's constructor sets metadata. Currently the batch
314  // delete process has to create the entity to delete its metadata. See #5214
315  _elgg_get_metadata_cache()->invalidateByOptions('delete', $options);
316 
317  return $result;
318 }
319 
330  if (!_elgg_is_valid_options_for_batch_operation($options, 'metadata')) {
331  return false;
332  }
333 
334  _elgg_get_metadata_cache()->invalidateByOptions('disable', $options);
335 
336  // if we can see hidden (disabled) we need to use the offset
337  // otherwise we risk an infinite loop if there are more than 50
338  $inc_offset = access_get_show_hidden_status();
339 
340  $options['metastring_type'] = 'metadata';
341  return _elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback', $inc_offset);
342 }
343 
357  if (!$options || !is_array($options)) {
358  return false;
359  }
360 
361  _elgg_get_metadata_cache()->invalidateByOptions('enable', $options);
362 
363  $options['metastring_type'] = 'metadata';
364  return _elgg_batch_metastring_based_objects($options, 'elgg_batch_enable_callback');
365 }
366 
431 function elgg_get_entities_from_metadata(array $options = array()) {
432  $defaults = array(
433  'metadata_names' => ELGG_ENTITIES_ANY_VALUE,
434  'metadata_values' => ELGG_ENTITIES_ANY_VALUE,
435  'metadata_name_value_pairs' => ELGG_ENTITIES_ANY_VALUE,
436 
437  'metadata_name_value_pairs_operator' => 'AND',
438  'metadata_case_sensitive' => true,
439  'order_by_metadata' => array(),
440 
441  'metadata_owner_guids' => ELGG_ENTITIES_ANY_VALUE,
442  );
443 
444  $options = array_merge($defaults, $options);
445 
446  $singulars = array('metadata_name', 'metadata_value',
447  'metadata_name_value_pair', 'metadata_owner_guid');
448 
450 
452  return false;
453  }
454 
455  return elgg_get_entities($options);
456 }
457 
469  return elgg_list_entities($options, 'elgg_get_entities_from_metadata');
470 }
471 
495 function _elgg_get_entity_metadata_where_sql($e_table, $n_table, $names = null, $values = null,
496 $pairs = null, $pair_operator = 'AND', $case_sensitive = true, $order_by_metadata = null,
497 $owner_guids = null) {
498 
499  global $CONFIG;
500 
501  // short circuit if nothing requested
502  // 0 is a valid (if not ill-conceived) metadata name.
503  // 0 is also a valid metadata value for false, null, or 0
504  // 0 is also a valid(ish) owner_guid
505  if ((!$names && $names !== 0)
506  && (!$values && $values !== 0)
507  && (!$pairs && $pairs !== 0)
508  && (!$owner_guids && $owner_guids !== 0)
509  && !$order_by_metadata) {
510  return '';
511  }
512 
513  // join counter for incremental joins.
514  $i = 1;
515 
516  // binary forces byte-to-byte comparision of strings, making
517  // it case- and diacritical-mark- sensitive.
518  // only supported on values.
519  $binary = ($case_sensitive) ? ' BINARY ' : '';
520 
521  $access = _elgg_get_access_where_sql(array('table_alias' => 'n_table'));
522 
523  $return = array (
524  'joins' => array (),
525  'wheres' => array(),
526  'orders' => array()
527  );
528 
529  // will always want to join these tables if pulling metastrings.
530  $return['joins'][] = "JOIN {$CONFIG->dbprefix}{$n_table} n_table on
531  {$e_table}.guid = n_table.entity_guid";
532 
533  $wheres = array();
534 
535  // get names wheres and joins
536  $names_where = '';
537  if ($names !== null) {
538  if (!is_array($names)) {
539  $names = array($names);
540  }
541 
542  $sanitised_names = array();
543  foreach ($names as $name) {
544  // normalise to 0.
545  if (!$name) {
546  $name = '0';
547  }
548  $sanitised_names[] = '\'' . sanitise_string($name) . '\'';
549  }
550 
551  if ($names_str = implode(',', $sanitised_names)) {
552  $return['joins'][] = "JOIN {$CONFIG->dbprefix}metastrings msn on n_table.name_id = msn.id";
553  $names_where = "(msn.string IN ($names_str))";
554  }
555  }
556 
557  // get values wheres and joins
558  $values_where = '';
559  if ($values !== null) {
560  if (!is_array($values)) {
561  $values = array($values);
562  }
563 
564  $sanitised_values = array();
565  foreach ($values as $value) {
566  // normalize to 0
567  if (!$value) {
568  $value = 0;
569  }
570  $sanitised_values[] = '\'' . sanitise_string($value) . '\'';
571  }
572 
573  if ($values_str = implode(',', $sanitised_values)) {
574  $return['joins'][] = "JOIN {$CONFIG->dbprefix}metastrings msv on n_table.value_id = msv.id";
575  $values_where = "({$binary}msv.string IN ($values_str))";
576  }
577  }
578 
579  if ($names_where && $values_where) {
580  $wheres[] = "($names_where AND $values_where AND $access)";
581  } elseif ($names_where) {
582  $wheres[] = "($names_where AND $access)";
583  } elseif ($values_where) {
584  $wheres[] = "($values_where AND $access)";
585  }
586 
587  // add pairs
588  // pairs must be in arrays.
589  if (is_array($pairs)) {
590  // check if this is an array of pairs or just a single pair.
591  if (isset($pairs['name']) || isset($pairs['value'])) {
592  $pairs = array($pairs);
593  }
594 
595  $pair_wheres = array();
596 
597  // @todo when the pairs are > 3 should probably split the query up to
598  // denormalize the strings table.
599 
600  foreach ($pairs as $index => $pair) {
601  // @todo move this elsewhere?
602  // support shortcut 'n' => 'v' method.
603  if (!is_array($pair)) {
604  $pair = array(
605  'name' => $index,
606  'value' => $pair
607  );
608  }
609 
610  // must have at least a name and value
611  if (!isset($pair['name']) || !isset($pair['value'])) {
612  // @todo should probably return false.
613  continue;
614  }
615 
616  // case sensitivity can be specified per pair.
617  // default to higher level setting.
618  if (isset($pair['case_sensitive'])) {
619  $pair_binary = ($pair['case_sensitive']) ? ' BINARY ' : '';
620  } else {
621  $pair_binary = $binary;
622  }
623 
624  if (isset($pair['operand'])) {
625  $operand = sanitise_string($pair['operand']);
626  } else {
627  $operand = ' = ';
628  }
629 
630  // for comparing
631  $trimmed_operand = trim(strtolower($operand));
632 
633  $access = _elgg_get_access_where_sql(array('table_alias' => "n_table{$i}"));
634 
635  // certain operands can't work well with strings that can be interpreted as numbers
636  // for direct comparisons like IN, =, != we treat them as strings
637  // gt/lt comparisons need to stay unencapsulated because strings '5' > '15'
638  // see https://github.com/Elgg/Elgg/issues/7009
639  $num_safe_operands = array('>', '<', '>=', '<=');
640  $num_test_operand = trim(strtoupper($operand));
641 
642  if (is_numeric($pair['value']) && in_array($num_test_operand, $num_safe_operands)) {
643  $value = sanitize_string($pair['value']);
644  } else if (is_bool($pair['value'])) {
645  $value = (int) $pair['value'];
646  } else if (is_array($pair['value'])) {
647  $values_array = array();
648 
649  foreach ($pair['value'] as $pair_value) {
650  if (is_numeric($pair_value) && !in_array($num_test_operand, $num_safe_operands)) {
651  $values_array[] = sanitise_string($pair_value);
652  } else {
653  $values_array[] = "'" . sanitise_string($pair_value) . "'";
654  }
655  }
656 
657  if ($values_array) {
658  $value = '(' . implode(', ', $values_array) . ')';
659  }
660 
661  // @todo allow support for non IN operands with array of values.
662  // will have to do more silly joins.
663  $operand = 'IN';
664  } else if ($trimmed_operand == 'in') {
665  $value = "({$pair['value']})";
666  } else {
667  $value = "'" . sanitise_string($pair['value']) . "'";
668  }
669 
670  $name = sanitise_string($pair['name']);
671 
672  // @todo The multiple joins are only needed when the operator is AND
673  $return['joins'][] = "JOIN {$CONFIG->dbprefix}{$n_table} n_table{$i}
674  on {$e_table}.guid = n_table{$i}.entity_guid";
675  $return['joins'][] = "JOIN {$CONFIG->dbprefix}metastrings msn{$i}
676  on n_table{$i}.name_id = msn{$i}.id";
677  $return['joins'][] = "JOIN {$CONFIG->dbprefix}metastrings msv{$i}
678  on n_table{$i}.value_id = msv{$i}.id";
679 
680  $pair_wheres[] = "(msn{$i}.string = '$name' AND {$pair_binary}msv{$i}.string
681  $operand $value AND $access)";
682 
683  $i++;
684  }
685 
686  if ($where = implode(" $pair_operator ", $pair_wheres)) {
687  $wheres[] = "($where)";
688  }
689  }
690 
691  // add owner_guids
692  if ($owner_guids) {
693  if (is_array($owner_guids)) {
694  $sanitised = array_map('sanitise_int', $owner_guids);
695  $owner_str = implode(',', $sanitised);
696  } else {
697  $owner_str = sanitise_int($owner_guids);
698  }
699 
700  $wheres[] = "(n_table.owner_guid IN ($owner_str))";
701  }
702 
703  if ($where = implode(' AND ', $wheres)) {
704  $return['wheres'][] = "($where)";
705  }
706 
707  if (is_array($order_by_metadata)) {
708  if ((count($order_by_metadata) > 0) && !isset($order_by_metadata[0])) {
709  // singleton, so fix
710  $order_by_metadata = array($order_by_metadata);
711  }
712  foreach ($order_by_metadata as $order_by) {
713  if (is_array($order_by) && isset($order_by['name'])) {
714  $name = sanitise_string($order_by['name']);
715  if (isset($order_by['direction'])) {
716  $direction = sanitise_string($order_by['direction']);
717  } else {
718  $direction = 'ASC';
719  }
720  $return['joins'][] = "JOIN {$CONFIG->dbprefix}{$n_table} n_table{$i}
721  on {$e_table}.guid = n_table{$i}.entity_guid";
722  $return['joins'][] = "JOIN {$CONFIG->dbprefix}metastrings msn{$i}
723  on n_table{$i}.name_id = msn{$i}.id";
724  $return['joins'][] = "JOIN {$CONFIG->dbprefix}metastrings msv{$i}
725  on n_table{$i}.value_id = msv{$i}.id";
726 
727  $access = _elgg_get_access_where_sql(array('table_alias' => "n_table{$i}"));
728 
729  $return['wheres'][] = "(msn{$i}.string = '$name' AND $access)";
730  if (isset($order_by['as']) && $order_by['as'] == 'integer') {
731  $return['orders'][] = "CAST(msv{$i}.string AS SIGNED) $direction";
732  } else {
733  $return['orders'][] = "msv{$i}.string $direction";
734  }
735  $i++;
736  }
737  }
738  }
739 
740  return $return;
741 }
742 
751 function metadata_array_to_values($array) {
752  $valuearray = array();
753 
754  if (is_array($array)) {
755  foreach ($array as $element) {
756  $valuearray[] = $element->value;
757  }
758  }
759 
760  return $valuearray;
761 }
762 
773  $id = (int)$id;
774 
775  if ($extender = elgg_get_metadata_from_id($id)) {
776  return $extender->getURL();
777  }
778  return false;
779 }
780 
791  global $CONFIG;
792  if (!isset($CONFIG->independents)) {
793  $CONFIG->independents = array();
794  }
795  $CONFIG->independents[$type][$subtype] = true;
796 }
797 
808  global $CONFIG;
809  if (empty($CONFIG->independents)) {
810  return false;
811  }
812  if (!empty($CONFIG->independents[$type][$subtype])
813  || !empty($CONFIG->independents[$type]['*'])) {
814  return true;
815  }
816  return false;
817 }
818 
829 function metadata_update($event, $object_type, $object) {
830  if ($object instanceof ElggEntity) {
831  if (!is_metadata_independent($object->getType(), $object->getSubtype())) {
832  $db_prefix = elgg_get_config('dbprefix');
833  $access_id = (int) $object->access_id;
834  $guid = (int) $object->getGUID();
835  $query = "update {$db_prefix}metadata set access_id = {$access_id} where entity_guid = {$guid}";
836  update_data($query);
837  }
838  }
839  return true;
840 }
841 
850  global $CONFIG;
851  if (empty($CONFIG->local_metadata_cache)) {
852  $CONFIG->local_metadata_cache = new ElggVolatileMetadataCache();
853  }
854  return $CONFIG->local_metadata_cache;
855 }
856 
867  // remove as little as possible, optimizing for common cases
868  $cache = _elgg_get_metadata_cache();
869  if (empty($options['guid'])) {
870  // safest to clear everything unless we want to make this even more complex :(
871  $cache->flush();
872  } else {
873  if (empty($options['metadata_name'])) {
874  // safest to clear the whole entity
875  $cache->clear($options['guid']);
876  } else {
877  switch ($action) {
878  case 'delete':
879  $cache->markEmpty($options['guid'], $options['metadata_name']);
880  break;
881  default:
882  $cache->markUnknown($options['guid'], $options['metadata_name']);
883  }
884  }
885  }
886 }
887 
889 elgg_register_event_handler('update', 'all', 'metadata_update');
890 
903  global $CONFIG;
904  $value[] = $CONFIG->path . 'engine/tests/ElggCoreMetadataAPITest.php';
905  $value[] = $CONFIG->path . 'engine/tests/ElggCoreMetadataCacheTest.php';
906  return $value;
907 }
908 
909 elgg_register_plugin_hook_handler('unit_test', 'system', '_elgg_metadata_test');
elgg_delete_metadata_by_id($id)
Deletes metadata using its ID.
Definition: metadata.php:45
_elgg_entities_get_metastrings_options($type, $options)
Returns options to pass to elgg_get_entities() for metastrings operations.
update_metadata($id, $name, $value, $value_type, $owner_guid, $access_id)
Update a specific piece of metadata.
Definition: metadata.php:156
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
get_metadata_url($id)
Get the URL for this metadata.
Definition: metadata.php:772
_elgg_batch_metastring_based_objects(array $options, $callback, $inc_offset=true)
Runs metastrings-based objects found using $options through $callback.
elgg_get_entities_from_metadata(array $options=array())
ElggEntities interfaces.
Definition: metadata.php:431
elgg_disable_metadata(array $options)
Disables metadata based on $options.
Definition: metadata.php:329
elgg_get_metastring_id($string, $case_sensitive=true)
Gets the metastring identifier for a value.
Definition: metastrings.php:34
get_data_row($query, $callback="")
Retrieve a single row from the database.
Definition: database.php:66
_elgg_is_valid_options_for_batch_operation($options, $type)
Checks if there are some constraints on the options array for potentially dangerous operations...
Definition: elgglib.php:1877
if($guid==elgg_get_logged_in_user_guid()) $name
Definition: delete.php:21
register_metadata_as_independent($type, $subtype= '*')
Mark entities with a particular type and subtype as having access permissions that can be changed ind...
Definition: metadata.php:790
$object
Definition: upgrade.php:12
$metadata
Definition: entity.php:19
_elgg_get_metadata_cache()
Get the global metadata cache instance.
Definition: metadata.php:849
$value
Definition: longtext.php:29
$return
Definition: opendd.php:15
$guid
Removes an admin notice.
elgg_list_entities_from_metadata($options)
Returns a list of entities filtered by provided metadata.
Definition: metadata.php:468
row_to_elggmetadata($row)
Convert a database row to a new ElggMetadata.
Definition: metadata.php:18
elgg_get_metadata_from_id($id)
Get a specific metadata object by its id.
Definition: metadata.php:35
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Register a callback as a plugin hook handler.
Definition: elgglib.php:853
update_data($query)
Update a row in the database.
Definition: database.php:93
$action
sanitize_string($string)
Sanitize a string for database use.
Definition: database.php:140
insert_data($query)
Insert a row into the database.
Definition: database.php:80
$params
Definition: login.php:72
$entity_guid
Definition: save.php:9
detect_extender_valuetype($value, $value_type="")
Detect the value_type for a given value.
Definition: extender.php:21
$options
Definition: index.php:14
_elgg_get_entity_metadata_where_sql($e_table, $n_table, $names=null, $values=null, $pairs=null, $pair_operator= 'AND', $case_sensitive=true, $order_by_metadata=null, $owner_guids=null)
Returns metadata name and value SQL where for entities.
Definition: metadata.php:495
$owner_guid
metadata_array_to_values($array)
Takes a metadata array (which has all kinds of properties) and turns it into a simple array of string...
Definition: metadata.php:751
is_metadata_independent($type, $subtype)
Determines whether entities of a given type and subtype should not change their metadata in line with...
Definition: metadata.php:807
elgg_enable_metadata(array $options)
Enables metadata based on $options.
Definition: metadata.php:356
_elgg_get_metastring_based_object_from_id($id, $type)
Returns a singular metastring-based object by its ID.
global $CONFIG
create_metadata($entity_guid, $name, $value, $value_type= '', $owner_guid=0, $access_id=ACCESS_PRIVATE, $allow_multiple=false)
Create a new metadata object, or update an existing one.
Definition: metadata.php:69
sanitise_string($string)
Wrapper function for alternate English spelling (.
Definition: database.php:150
_elgg_get_metastring_based_objects($options)
Returns an array of either ElggAnnotation or ElggMetadata objects.
const ACCESS_PRIVATE
Definition: elgglib.php:2121
const ELGG_ENTITIES_ANY_VALUE
Definition: elgglib.php:2134
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
Definition: entities.php:777
elgg global
Pointer to the global context.
Definition: elgglib.js:12
$type
Definition: add.php:8
access_get_show_hidden_status()
Return current status of showing disabled entities.
Definition: access.php:299
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
Register a callback as an Elgg event handler.
Definition: elgglib.php:669
metadata_update($event, $object_type, $object)
When an entity is updated, resets the access ID on all of its child metadata.
Definition: metadata.php:829
elgg_list_entities(array $options=array(), $getter= 'elgg_get_entities', $viewer= 'elgg_view_entity_list')
Returns a string of rendered entities.
Definition: entities.php:1343
elgg_delete_metadata(array $options)
Deletes metadata based on $options.
Definition: metadata.php:306
elgg_get_metadata(array $options=array())
Returns metadata.
Definition: metadata.php:282
$row
sanitise_int($int, $signed=true)
Sanitizes an integer for database use.
Definition: database.php:173
create_metadata_from_array($entity_guid, array $name_and_values, $value_type, $owner_guid, $access_id=ACCESS_PRIVATE, $allow_multiple=false)
This function creates metadata from an associative array of "key => value" pairs. ...
Definition: metadata.php:239
is_memcache_available()
Return true if memcache is available and configured.
Definition: memcache.php:16
_elgg_metadata_test($hook, $type, $value, $params)
Metadata unit test.
Definition: metadata.php:902
_elgg_normalize_plural_options_array($options, $singulars)
Normalise the singular keys in an options array to plural keys.
Definition: elgglib.php:1594
$defaults
Definition: access.php:19
_elgg_get_access_where_sql(array $options=array())
Returns the SQL where clause for enforcing read access to data.
Definition: access.php:343
elgg_trigger_event($event, $object_type, $object=null)
Trigger an Elgg Event and attempt to run all handler callbacks registered to that event...
Definition: elgglib.php:720
$subtype
Definition: river.php:10
if(!$collection_name) $id
Definition: add.php:17
_elgg_invalidate_metadata_cache($action, array $options)
Invalidate the metadata cache based on options passed to various *_metadata functions.
Definition: metadata.php:866
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:42
if(!$num_display) $db_prefix
Definition: content.php:12
$access
Definition: save.php:15