Elgg  Version 2.3
river.php
Go to the documentation of this file.
1 <?php
39 function elgg_create_river_item(array $options = array()) {
40  $view = elgg_extract('view', $options);
41  // use default viewtype for when called from web services api
42  if (empty($view) || !(elgg_view_exists($view, 'default'))) {
43  return false;
44  }
45 
46  $action_type = elgg_extract('action_type', $options);
47  if (empty($action_type)) {
48  return false;
49  }
50 
51  $subject_guid = elgg_extract('subject_guid', $options, 0);
52  if (!($subject = get_entity($subject_guid))) {
53  return false;
54  }
55 
56  $object_guid = elgg_extract('object_guid', $options, 0);
57  if (!($object = get_entity($object_guid))) {
58  return false;
59  }
60 
61  $target_guid = elgg_extract('target_guid', $options, 0);
62  if ($target_guid) {
63  // target_guid is not a required parameter so check
64  // it only if it is included in the parameters
65  if (!($target = get_entity($target_guid))) {
66  return false;
67  }
68  }
69 
70  $access_id = elgg_extract('access_id', $options, $object->access_id);
71 
72  $posted = elgg_extract('posted', $options, time());
73 
74  $annotation_id = elgg_extract('annotation_id', $options, 0);
75  if ($annotation_id) {
76  if (!elgg_get_annotation_from_id($annotation_id)) {
77  return false;
78  }
79  }
80 
81  $return_item = elgg_extract('return_item', $options, false);
82 
83  $values = array(
84  'type' => $object->getType(),
85  'subtype' => $object->getSubtype(),
86  'action_type' => $action_type,
87  'access_id' => $access_id,
88  'view' => $view,
89  'subject_guid' => $subject_guid,
90  'object_guid' => $object_guid,
91  'target_guid' => $target_guid,
92  'annotation_id' => $annotation_id,
93  'posted' => $posted,
94  );
95  $col_types = array(
96  'type' => 'string',
97  'subtype' => 'string',
98  'action_type' => 'string',
99  'access_id' => 'int',
100  'view' => 'string',
101  'subject_guid' => 'int',
102  'object_guid' => 'int',
103  'target_guid' => 'int',
104  'annotation_id' => 'int',
105  'posted' => 'int',
106  );
107 
108  // return false to stop insert
109  $values = elgg_trigger_plugin_hook('creating', 'river', null, $values);
110  if ($values == false) {
111  // inserting did not fail - it was just prevented
112  return true;
113  }
114 
115  $dbprefix = elgg_get_config('dbprefix');
116 
117  foreach ($values as $name => $value) {
118  $sql_columns[] = $name;
119  $sql_values[] = ":$name";
120  $query_params[":$name"] = ($col_types[$name] === 'int') ? (int)$value : $value;
121  }
122  $sql = "
123  INSERT INTO {$dbprefix}river (" . implode(',', $sql_columns) . ")
124  VALUES (" . implode(',', $sql_values) . ")
125  ";
126  $id = insert_data($sql, $query_params);
127  if (!$id) {
128  return false;
129  }
130 
131  // update the entities which had the action carried out on it
132  // @todo shouldn't this be done elsewhere? Like when an annotation is saved?
133  $object->updateLastAction($values['posted']);
134 
135  $ia = elgg_set_ignore_access(true);
136  $river_items = elgg_get_river(array('id' => $id));
138 
139  if (!$river_items) {
140  return false;
141  }
142 
143  elgg_trigger_event('created', 'river', $river_items[0]);
144 
145  return $return_item ? $river_items[0] : $id;
146 }
147 
197 function elgg_get_river(array $options = array()) {
198  global $CONFIG;
199 
200  $defaults = array(
201  'ids' => ELGG_ENTITIES_ANY_VALUE,
202 
203  'subject_guids' => ELGG_ENTITIES_ANY_VALUE,
204  'object_guids' => ELGG_ENTITIES_ANY_VALUE,
205  'target_guids' => ELGG_ENTITIES_ANY_VALUE,
206  'annotation_ids' => ELGG_ENTITIES_ANY_VALUE,
207  'action_types' => ELGG_ENTITIES_ANY_VALUE,
208 
209  'relationship' => null,
210  'relationship_guid' => null,
211  'inverse_relationship' => false,
212 
213  'types' => ELGG_ENTITIES_ANY_VALUE,
214  'subtypes' => ELGG_ENTITIES_ANY_VALUE,
215  'type_subtype_pairs' => ELGG_ENTITIES_ANY_VALUE,
216 
217  'posted_time_lower' => ELGG_ENTITIES_ANY_VALUE,
218  'posted_time_upper' => ELGG_ENTITIES_ANY_VALUE,
219 
220  'limit' => 20,
221  'offset' => 0,
222  'count' => false,
223  'distinct' => true,
224 
225  'batch' => false,
226  'batch_inc_offset' => true,
227  'batch_size' => 25,
228 
229  'order_by' => 'rv.posted desc',
230  'group_by' => ELGG_ENTITIES_ANY_VALUE,
231 
232  'wheres' => array(),
233  'joins' => array(),
234  );
235 
236  if (isset($options['view']) || isset($options['views'])) {
237  $msg = __FUNCTION__ . ' does not support the "views" option, though you may specify values for'
238  . ' the "rv.view" column using the "wheres" option.';
239  elgg_log($msg, 'WARNING');
240  }
241 
242  $options = array_merge($defaults, $options);
243 
244  if ($options['batch'] && !$options['count']) {
245  $batch_size = $options['batch_size'];
246  $batch_inc_offset = $options['batch_inc_offset'];
247 
248  // clean batch keys from $options.
249  unset($options['batch'], $options['batch_size'], $options['batch_inc_offset']);
250 
251  return new \ElggBatch('elgg_get_river', $options, null, $batch_size, $batch_inc_offset);
252  }
253 
254  $singulars = array('id', 'subject_guid', 'object_guid', 'target_guid', 'annotation_id', 'action_type', 'type', 'subtype');
256 
257  $wheres = $options['wheres'];
258 
259  $wheres[] = _elgg_get_guid_based_where_sql('rv.id', $options['ids']);
260  $wheres[] = _elgg_get_guid_based_where_sql('rv.subject_guid', $options['subject_guids']);
261  $wheres[] = _elgg_get_guid_based_where_sql('rv.object_guid', $options['object_guids']);
262  $wheres[] = _elgg_get_guid_based_where_sql('rv.target_guid', $options['target_guids']);
263  $wheres[] = _elgg_get_guid_based_where_sql('rv.annotation_id', $options['annotation_ids']);
264  $wheres[] = _elgg_river_get_action_where_sql($options['action_types']);
265  $wheres[] = _elgg_get_river_type_subtype_where_sql('rv', $options['types'],
266  $options['subtypes'], $options['type_subtype_pairs']);
267 
268  if ($options['posted_time_lower'] && is_int($options['posted_time_lower'])) {
269  $wheres[] = "rv.posted >= {$options['posted_time_lower']}";
270  }
271 
272  if ($options['posted_time_upper'] && is_int($options['posted_time_upper'])) {
273  $wheres[] = "rv.posted <= {$options['posted_time_upper']}";
274  }
275 
277  $wheres[] = "rv.enabled = 'yes'";
278  }
279 
280  $dbprefix = elgg_get_config('dbprefix');
281 
282  // joins
283  $joins = array();
284  $joins[] = "JOIN {$dbprefix}entities oe ON rv.object_guid = oe.guid";
285 
286  // LEFT JOIN is used because all river items do not necessarily have target
287  $joins[] = "LEFT JOIN {$dbprefix}entities te ON rv.target_guid = te.guid";
288 
289  if ($options['relationship_guid']) {
291  'rv.subject_guid',
292  $options['relationship'],
293  $options['relationship_guid'],
294  $options['inverse_relationship']);
295  if ($clauses) {
296  $wheres = array_merge($wheres, $clauses['wheres']);
297  $joins = array_merge($joins, $clauses['joins']);
298  }
299  }
300 
301  // add optional joins
302  $joins = array_merge($joins, $options['joins']);
303 
304  // see if any functions failed
305  // remove empty strings on successful functions
306  foreach ($wheres as $i => $where) {
307  if ($where === false) {
308  return false;
309  } elseif (empty($where)) {
310  unset($wheres[$i]);
311  }
312  }
313 
314  // remove identical where clauses
315  $wheres = array_unique($wheres);
316 
317  if (!$options['count']) {
318  $distinct = $options['distinct'] ? "DISTINCT" : "";
319 
320  $query = "SELECT $distinct rv.* FROM {$CONFIG->dbprefix}river rv ";
321  } else {
322  // note: when DISTINCT unneeded, it's slightly faster to compute COUNT(*) than IDs
323  $count_expr = $options['distinct'] ? "DISTINCT rv.id" : "*";
324 
325  $query = "SELECT COUNT($count_expr) as total FROM {$CONFIG->dbprefix}river rv ";
326  }
327 
328  // add joins
329  foreach ($joins as $j) {
330  $query .= " $j ";
331  }
332 
333  // add wheres
334  $query .= ' WHERE ';
335 
336  foreach ($wheres as $w) {
337  $query .= " $w AND ";
338  }
339 
340  // Make sure that user has access to all the entities referenced by each river item
341  $object_access_where = _elgg_get_access_where_sql(array('table_alias' => 'oe'));
342  $target_access_where = _elgg_get_access_where_sql(array('table_alias' => 'te'));
343 
344  // We use LEFT JOIN with entities table but the WHERE clauses are used
345  // regardless if a JOIN is successfully made. The "te.guid IS NULL" is
346  // needed because of this.
347  $query .= "$object_access_where AND ($target_access_where OR te.guid IS NULL) ";
348 
349  if (!$options['count']) {
350  $options['group_by'] = sanitise_string($options['group_by']);
351  if ($options['group_by']) {
352  $query .= " GROUP BY {$options['group_by']}";
353  }
354 
355  $options['order_by'] = sanitise_string($options['order_by']);
356  $query .= " ORDER BY {$options['order_by']}";
357 
358  if ($options['limit']) {
359  $limit = sanitise_int($options['limit']);
360  $offset = sanitise_int($options['offset'], false);
361  $query .= " LIMIT $offset, $limit";
362  }
363 
364  $river_items = get_data($query, '_elgg_row_to_elgg_river_item');
365  _elgg_prefetch_river_entities($river_items);
366 
367  return $river_items;
368  } else {
369  $total = get_data_row($query);
370  return (int)$total->total;
371  }
372 }
373 
380 function _elgg_prefetch_river_entities(array $river_items) {
381  // prefetch objects, subjects and targets
382  $guids = array();
383  foreach ($river_items as $item) {
384  if ($item->subject_guid && !_elgg_services()->entityCache->get($item->subject_guid)) {
385  $guids[$item->subject_guid] = true;
386  }
387  if ($item->object_guid && !_elgg_services()->entityCache->get($item->object_guid)) {
388  $guids[$item->object_guid] = true;
389  }
390  if ($item->target_guid && !_elgg_services()->entityCache->get($item->target_guid)) {
391  $guids[$item->target_guid] = true;
392  }
393  }
394  if ($guids) {
395  // The entity cache only holds 256. We don't want to bump out any plugins.
396  $guids = array_slice($guids, 0, 200, true);
397  // return value unneeded, just priming cache
398  elgg_get_entities(array(
399  'guids' => array_keys($guids),
400  'limit' => 0,
401  'distinct' => false,
402  ));
403  }
404 
405  // prefetch object containers, in case they were not in the targets
406  $guids = array();
407  foreach ($river_items as $item) {
408  $object = $item->getObjectEntity();
409  if ($object->container_guid && !_elgg_services()->entityCache->get($object->container_guid)) {
410  $guids[$object->container_guid] = true;
411  }
412  }
413  if ($guids) {
414  $guids = array_slice($guids, 0, 200, true);
415  elgg_get_entities(array(
416  'guids' => array_keys($guids),
417  'limit' => 0,
418  'distinct' => false,
419 
420  // Why specify? user containers are likely already loaded via the owners, and
421  // specifying groups allows ege() to auto-join the groups_entity table
422  'type' => 'group',
423  ));
424  }
425 
426  // Note: We've tried combining the above ege() calls into one (pulling containers at the same time).
427  // Although it seems like it would reduce queries, it added some. o_O
428 }
429 
441 function elgg_list_river(array $options = array()) {
443 
444  $defaults = array(
445  'offset' => (int) max(get_input('offset', 0), 0),
446  'limit' => (int) max(get_input('limit', max(20, elgg_get_config('default_limit'))), 0),
447  'pagination' => true,
448  'list_class' => 'elgg-list-river',
449  'no_results' => '',
450  );
451 
452  $options = array_merge($defaults, $options);
453 
454  if (!$options["limit"] && !$options["offset"]) {
455  // no need for pagination if listing is unlimited
456  $options["pagination"] = false;
457  }
458 
459  $options['count'] = false;
461  $options['count'] = is_array($items) ? count($items) : 0;
462 
463  if (!empty($items)) {
464  $count_needed = true;
465  if (!$options['pagination']) {
466  $count_needed = false;
467  } elseif (!$options['offset'] && !$options['limit']) {
468  $count_needed = false;
469  } elseif (($options['count'] < (int) $options['limit']) && !$options['offset']) {
470  $count_needed = false;
471  }
472 
473  if ($count_needed) {
474  $options['count'] = true;
475 
476  $options['count'] = (int) elgg_get_river($options);
477  }
478  }
479 
480  $options['items'] = $items;
481 
482  return elgg_view('page/components/list', $options);
483 }
484 
495  if (!($row instanceof \stdClass)) {
496  return null;
497  }
498 
499  return new \ElggRiverItem($row);
500 }
501 
518  // short circuit if nothing is requested
519  if (!$types && !$subtypes && !$pairs) {
520  return '';
521  }
522 
523  $wheres = array();
524  $types_wheres = array();
525  $subtypes_wheres = array();
526 
527  // if no pairs, use types and subtypes
528  if (!is_array($pairs)) {
529  if ($types) {
530  if (!is_array($types)) {
531  $types = array($types);
532  }
533  foreach ($types as $type) {
534  $type = sanitise_string($type);
535  $types_wheres[] = "({$table}.type = '$type')";
536  }
537  }
538 
539  if ($subtypes) {
540  if (!is_array($subtypes)) {
541  $subtypes = array($subtypes);
542  }
543  foreach ($subtypes as $subtype) {
544  $subtype = sanitise_string($subtype);
545  $subtypes_wheres[] = "({$table}.subtype = '$subtype')";
546  }
547  }
548 
549  if (is_array($types_wheres) && count($types_wheres)) {
550  $types_wheres = array(implode(' OR ', $types_wheres));
551  }
552 
553  if (is_array($subtypes_wheres) && count($subtypes_wheres)) {
554  $subtypes_wheres = array('(' . implode(' OR ', $subtypes_wheres) . ')');
555  }
556 
557  $wheres = array(implode(' AND ', array_merge($types_wheres, $subtypes_wheres)));
558 
559  } else {
560  // using type/subtype pairs
561  foreach ($pairs as $paired_type => $paired_subtypes) {
562  $paired_type = sanitise_string($paired_type);
563  if (is_array($paired_subtypes)) {
564  $paired_subtypes = array_map('sanitise_string', $paired_subtypes);
565  $paired_subtype_str = implode("','", $paired_subtypes);
566  if ($paired_subtype_str) {
567  $wheres[] = "({$table}.type = '$paired_type'"
568  . " AND {$table}.subtype IN ('$paired_subtype_str'))";
569  }
570  } else {
571  $paired_subtype = sanitise_string($paired_subtypes);
572  $wheres[] = "({$table}.type = '$paired_type'"
573  . " AND {$table}.subtype = '$paired_subtype')";
574  }
575  }
576  }
577 
578  if (is_array($wheres) && count($wheres)) {
579  $where = implode(' OR ', $wheres);
580  return "($where)";
581  }
582 
583  return '';
584 }
585 
596  if (!$types) {
597  return '';
598  }
599 
600  if (!is_array($types)) {
601  $types = sanitise_string($types);
602  return "(rv.action_type = '$types')";
603  }
604 
605  // sanitize types array
606  $types_sanitized = array();
607  foreach ($types as $type) {
608  $types_sanitized[] = sanitise_string($type);
609  }
610 
611  $type_str = implode("','", $types_sanitized);
612  return "(rv.action_type IN ('$type_str'))";
613 }
614 
625  if (!$views) {
626  return '';
627  }
628 
629  if (!is_array($views)) {
630  $views = sanitise_string($views);
631  return "(rv.view = '$views')";
632  }
633 
634  // sanitize views array
635  $views_sanitized = array();
636  foreach ($views as $view) {
637  $views_sanitized[] = sanitise_string($view);
638  }
639 
640  $view_str = implode("','", $views_sanitized);
641  return "(rv.view IN ('$view_str'))";
642 }
643 
652 function update_river_access_by_object($object_guid, $access_id) {
653 
654  $dbprefix = elgg_get_config('dbprefix');
655  $query = "
656  UPDATE {$dbprefix}river
657  SET access_id = :access_id
658  WHERE object_guid = :object_guid
659  ";
660 
661  $params = [
662  ':access_id' => (int) $access_id,
663  ':object_guid' => (int) $object_guid,
664  ];
665 
666  return update_data($query, $params);
667 }
668 
676 function _elgg_river_page_handler($segments) {
678 
679  // make a URL segment available in page handler script
680  $page_type = elgg_extract(0, $segments, 'all');
681  $page_type = preg_replace('[\W]', '', $page_type);
682 
683  if ($page_type == 'owner') {
684  elgg_gatekeeper();
685  $page_username = elgg_extract(1, $segments, '');
686  if ($page_username == elgg_get_logged_in_user_entity()->username) {
687  $page_type = 'mine';
688  } else {
689  $vars['subject_username'] = $page_username;
690  }
691  }
692 
693  $vars['page_type'] = $page_type;
694 
695  return elgg_ok_response(elgg_view_resource("river", $vars));
696 }
697 
702 function _elgg_river_test($hook, $type, $value) {
703  global $CONFIG;
704  $value[] = $CONFIG->path . 'engine/tests/ElggCoreRiverAPITest.php';
705  return $value;
706 }
707 
717 function _elgg_river_disable($event, $type, $entity) {
718 
719  if (!elgg_instanceof($entity)) {
720  return true;
721  }
722 
723  $dbprefix = elgg_get_config('dbprefix');
724  $query = <<<QUERY
725  UPDATE {$dbprefix}river AS rv
726  SET rv.enabled = 'no'
727  WHERE (rv.subject_guid = {$entity->guid} OR rv.object_guid = {$entity->guid} OR rv.target_guid = {$entity->guid});
728 QUERY;
729 
730  update_data($query);
731  return true;
732 }
733 
734 
744 function _elgg_river_enable($event, $type, $entity) {
745 
746  if (!elgg_instanceof($entity)) {
747  return true;
748  }
749 
750  $dbprefix = elgg_get_config('dbprefix');
751  $query = <<<QUERY
752  UPDATE {$dbprefix}river AS rv
753  LEFT JOIN {$dbprefix}entities AS se ON se.guid = rv.subject_guid
754  LEFT JOIN {$dbprefix}entities AS oe ON oe.guid = rv.object_guid
755  LEFT JOIN {$dbprefix}entities AS te ON te.guid = rv.target_guid
756  SET rv.enabled = 'yes'
757  WHERE (
758  (se.enabled = 'yes' OR se.guid IS NULL) AND
759  (oe.enabled = 'yes' OR oe.guid IS NULL) AND
760  (te.enabled = 'yes' OR te.guid IS NULL)
761  )
762  AND (se.guid = {$entity->guid} OR oe.guid = {$entity->guid} OR te.guid = {$entity->guid});
763 QUERY;
764 
765  update_data($query);
766  return true;
767 }
768 
773 function _elgg_river_init() {
774  elgg_register_page_handler('activity', '_elgg_river_page_handler');
775  $item = new \ElggMenuItem('activity', elgg_echo('activity'), 'activity');
777 
778  elgg_register_widget_type('river_widget', elgg_echo('river:widget:title'), elgg_echo('river:widget:description'));
779 
780  elgg_register_action('river/delete', '', 'admin');
781 
782  elgg_register_plugin_hook_handler('unit_test', 'system', '_elgg_river_test');
783 
784  // For BC, we want required AMD modules to be loaded even if plugins
785  // overwrite these views
786  elgg_extend_view('core/river/filter', 'core/river/filter_deps');
787  elgg_extend_view('forms/comment/save', 'forms/comment/save_deps');
788 
789 }
790 
791 return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
792  $events->registerHandler('init', 'system', '_elgg_river_init');
793  $events->registerHandler('disable:after', 'all', '_elgg_river_disable', 600);
794  $events->registerHandler('enable:after', 'all', '_elgg_river_enable', 600);
795 };
insert_data($query, array $params=[])
Insert a row into the database.
Definition: database.php:87
elgg_list_river(array $options=array())
List river items.
Definition: river.php:441
elgg_view_exists($view, $viewtype= '', $recurse=true)
Returns whether the specified view exists.
Definition: views.php:293
$object
These two snippets demonstrates triggering an event and how to register for that event.
Definition: trigger.php:7
_elgg_river_get_action_where_sql($types)
Get the where clause based on river action type strings.
Definition: river.php:595
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
$view
Definition: crop.php:34
$params
Definition: river.php:65
$subject
Definition: exceptions.php:25
_elgg_river_init()
Initialize river library private.
Definition: river.php:773
_elgg_river_page_handler($segments)
Page handler for activity.
Definition: river.php:676
$table
Definition: cron.php:34
if(!$items) $item
Definition: delete.php:17
if($guid==elgg_get_logged_in_user_guid()) $name
Definition: delete.php:21
_elgg_river_get_view_where_sql($views)
Get the where clause based on river view strings.
Definition: river.php:624
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_view_resource($name, array $vars=[])
Render a resource view.
Definition: views.php:510
$defaults
_elgg_river_test($hook, $type, $value)
Register river unit tests private.
Definition: river.php:702
_elgg_get_guid_based_where_sql($column, $guids)
Returns SQL where clause for owner and containers.
Definition: entities.php:341
_elgg_prefetch_river_entities(array $river_items)
Prefetch entities that will be displayed in the river.
Definition: river.php:380
$value
Definition: longtext.php:42
if(!$count) $offset
Definition: pagination.php:26
$items
Definition: delete.php:11
$subtype
Definition: river.php:12
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Definition: elgglib.php:740
if(empty($vars['value'])&&$vars['value']!==0 &&$vars['value']!== '0') $query_params
Elgg single tag output.
Definition: tag.php:16
$vars['entity']
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:72
update_river_access_by_object($object_guid, $access_id)
Sets the access ID on river items for a particular object.
Definition: river.php:652
$options
Main activity stream list page.
Definition: river.php:6
username
Definition: contents.php:36
elgg_gatekeeper()
Used at the top of a page to mark it as logged in users only.
Definition: pagehandler.php:58
elgg_instanceof($entity, $type=null, $subtype=null, $class=null)
Checks if $entity is an and optionally for type and subtype.
Definition: entities.php:736
$limit
Definition: userpicker.php:38
get_data_row($query, $callback=null, array $params=[])
Retrieve a single row from the database.
Definition: database.php:72
elgg_get_annotation_from_id($id)
Get a specific annotation by its id.
Definition: annotations.php:36
if(!($comment instanceof\ElggComment)||!$comment->canEdit()) $target
Definition: edit.php:17
elgg_create_river_item(array $options=array())
Adds an item to the river.
Definition: river.php:39
_elgg_row_to_elgg_river_item($row)
Convert a database row to a new .
Definition: river.php:494
update_data($query, array $params=[], $get_num_rows=false)
Update a row in the database.
Definition: database.php:102
elgg_set_ignore_access($ignore=true)
Set if Elgg&#39;s access system should be ignored.
Definition: access.php:43
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
global $CONFIG
sanitise_string($string)
Alias of sanitize_string.
Definition: database.php:166
$dbprefix
Definition: index.php:13
const ELGG_ENTITIES_ANY_VALUE
Definition: elgglib.php:2095
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
Definition: entities.php:326
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Definition: elgglib.php:826
elgg_register_page_handler($identifier, $function)
Registers a page handler for a particular identifier.
Definition: pagehandler.php:34
elgg_get_entity_relationship_where_sql($column, $relationship=null, $relationship_guid=null, $inverse_relationship=false)
Returns SQL appropriate for relationship joins and wheres.
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:336
elgg global
Pointer to the global context.
Definition: elgglib.js:12
get_data($query, $callback=null, array $params=[])
Retrieve rows from the database.
Definition: database.php:55
elgg_extend_view($view, $view_extension, $priority=501)
Extends a view with another view.
Definition: views.php:380
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
Definition: autoloader.php:17
access_get_show_hidden_status()
Return current status of showing disabled entities.
Definition: access.php:170
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1375
_elgg_river_enable($event, $type, $entity)
Enable river entries that reference a re-enabled entity as subject/object/target. ...
Definition: river.php:744
elgg_log($message, $level= 'NOTICE')
Display or log a message.
Definition: elgglib.php:1028
elgg_ok_response($content= '', $message= '', $forward_url=null, $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
$type
Definition: river.php:11
$posted
Definition: comment.php:83
$guids
_elgg_river_disable($event, $type, $entity)
Disable river entries that reference a disabled entity as subject/object/target.
Definition: river.php:717
elgg_get_river(array $options=array())
Get river items.
Definition: river.php:197
elgg subtext time
$subtypes
$entity
Definition: delete.php:7
$row
sanitise_int($int, $signed=true)
Alias of sanitize_int.
Definition: database.php:194
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:32
$page_type
Definition: river.php:10
elgg_register_action($action, $filename="", $access= 'logged_in')
Registers an action.
Definition: actions.php:96
_elgg_normalize_plural_options_array($options, $singulars)
Normalise the singular keys in an options array to plural keys.
Definition: elgglib.php:1528
_elgg_get_access_where_sql(array $options=array())
Returns the SQL where clause for enforcing read access to data.
Definition: access.php:214
elgg_trigger_event($event, $object_type, $object=null)
Definition: elgglib.php:614
if(!$collection_name) $id
Definition: add.php:17
elgg_register_widget_type($handler, $name=null, $description=null, $context=array('all'), $multiple=false)
Register a widget type.
Definition: widgets.php:74
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:42
_elgg_get_river_type_subtype_where_sql($table, $types, $subtypes, $pairs)
Returns SQL where clause for type and subtype on river table.
Definition: river.php:517
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:204
elgg_register_rss_link()
Include the RSS icon link and link element in the head.
Definition: views.php:1618