Elgg  Version 1.10
river.php
Go to the documentation of this file.
1 <?php
37 function elgg_create_river_item(array $options = array()) {
38  $view = elgg_extract('view', $options);
39  // use default viewtype for when called from web services api
40  if (empty($view) || !(elgg_view_exists($view, 'default'))) {
41  return false;
42  }
43 
44  $action_type = elgg_extract('action_type', $options);
45  if (empty($action_type)) {
46  return false;
47  }
48 
49  $subject_guid = elgg_extract('subject_guid', $options, 0);
50  if (!($subject = get_entity($subject_guid))) {
51  return false;
52  }
53 
54  $object_guid = elgg_extract('object_guid', $options, 0);
55  if (!($object = get_entity($object_guid))) {
56  return false;
57  }
58 
59  $target_guid = elgg_extract('target_guid', $options, 0);
60  if ($target_guid) {
61  // target_guid is not a required parameter so check
62  // it only if it is included in the parameters
63  if (!($target = get_entity($target_guid))) {
64  return false;
65  }
66  }
67 
68  $access_id = elgg_extract('access_id', $options, $object->access_id);
69 
70  $posted = elgg_extract('posted', $options, time());
71 
72  $annotation_id = elgg_extract('annotation_id', $options, 0);
73  if ($annotation_id) {
74  if (!elgg_get_annotation_from_id($annotation_id)) {
75  return false;
76  }
77  }
78 
79  $values = array(
80  'type' => $object->getType(),
81  'subtype' => $object->getSubtype(),
82  'action_type' => $action_type,
83  'access_id' => $access_id,
84  'view' => $view,
85  'subject_guid' => $subject_guid,
86  'object_guid' => $object_guid,
87  'target_guid' => $target_guid,
88  'annotation_id' => $annotation_id,
89  'posted' => $posted,
90  );
91  $col_types = array(
92  'type' => 'string',
93  'subtype' => 'string',
94  'action_type' => 'string',
95  'access_id' => 'int',
96  'view' => 'string',
97  'subject_guid' => 'int',
98  'object_guid' => 'int',
99  'target_guid' => 'int',
100  'annotation_id' => 'int',
101  'posted' => 'int',
102  );
103 
104  // return false to stop insert
105  $values = elgg_trigger_plugin_hook('creating', 'river', null, $values);
106  if ($values == false) {
107  // inserting did not fail - it was just prevented
108  return true;
109  }
110 
111  $dbprefix = elgg_get_config('dbprefix');
112 
113  // escape values array and build INSERT assignments
114  $assignments = array();
115  foreach ($col_types as $name => $type) {
116  $values[$name] = ($type === 'int') ? (int)$values[$name] : sanitize_string($values[$name]);
117  $assignments[] = "$name = '{$values[$name]}'";
118  }
119 
120  $id = insert_data("INSERT INTO {$dbprefix}river SET " . implode(',', $assignments));
121 
122  // update the entities which had the action carried out on it
123  // @todo shouldn't this be done elsewhere? Like when an annotation is saved?
124  if ($id) {
125  update_entity_last_action($values['object_guid'], $values['posted']);
126 
127  $river_items = elgg_get_river(array('id' => $id));
128  if ($river_items) {
129  elgg_trigger_event('created', 'river', $river_items[0]);
130  }
131  return $id;
132  } else {
133  return false;
134  }
135 }
136 
162 function elgg_delete_river(array $options = array()) {
163  global $CONFIG;
164 
165  $defaults = array(
166  'ids' => ELGG_ENTITIES_ANY_VALUE,
167 
168  'subject_guids' => ELGG_ENTITIES_ANY_VALUE,
169  'object_guids' => ELGG_ENTITIES_ANY_VALUE,
170  'target_guids' => ELGG_ENTITIES_ANY_VALUE,
171  'annotation_ids' => ELGG_ENTITIES_ANY_VALUE,
172 
173  'views' => ELGG_ENTITIES_ANY_VALUE,
174  'action_types' => ELGG_ENTITIES_ANY_VALUE,
175 
176  'types' => ELGG_ENTITIES_ANY_VALUE,
177  'subtypes' => ELGG_ENTITIES_ANY_VALUE,
178  'type_subtype_pairs' => ELGG_ENTITIES_ANY_VALUE,
179 
180  'posted_time_lower' => ELGG_ENTITIES_ANY_VALUE,
181  'posted_time_upper' => ELGG_ENTITIES_ANY_VALUE,
182 
183  'wheres' => array(),
184  'joins' => array(),
185 
186  );
187 
188  $options = array_merge($defaults, $options);
189 
190  $singulars = array('id', 'subject_guid', 'object_guid', 'target_guid', 'annotation_id', 'action_type', 'view', 'type', 'subtype');
192 
193  $wheres = $options['wheres'];
194 
195  $wheres[] = _elgg_get_guid_based_where_sql('rv.id', $options['ids']);
196  $wheres[] = _elgg_get_guid_based_where_sql('rv.subject_guid', $options['subject_guids']);
197  $wheres[] = _elgg_get_guid_based_where_sql('rv.object_guid', $options['object_guids']);
198  $wheres[] = _elgg_get_guid_based_where_sql('rv.target_guid', $options['target_guids']);
199  $wheres[] = _elgg_get_guid_based_where_sql('rv.annotation_id', $options['annotation_ids']);
200  $wheres[] = _elgg_river_get_action_where_sql($options['action_types']);
201  $wheres[] = _elgg_river_get_view_where_sql($options['views']);
202  $wheres[] = _elgg_get_river_type_subtype_where_sql('rv', $options['types'],
203  $options['subtypes'], $options['type_subtype_pairs']);
204 
205  if ($options['posted_time_lower'] && is_int($options['posted_time_lower'])) {
206  $wheres[] = "rv.posted >= {$options['posted_time_lower']}";
207  }
208 
209  if ($options['posted_time_upper'] && is_int($options['posted_time_upper'])) {
210  $wheres[] = "rv.posted <= {$options['posted_time_upper']}";
211  }
212 
213  // see if any functions failed
214  // remove empty strings on successful functions
215  foreach ($wheres as $i => $where) {
216  if ($where === false) {
217  return false;
218  } elseif (empty($where)) {
219  unset($wheres[$i]);
220  }
221  }
222 
223  // remove identical where clauses
224  $wheres = array_unique($wheres);
225 
226  $query = "DELETE rv.* FROM {$CONFIG->dbprefix}river rv ";
227 
228  // remove identical join clauses
229  $joins = array_unique($options['joins']);
230 
231  // add joins
232  foreach ($joins as $j) {
233  $query .= " $j ";
234  }
235 
236  // add wheres
237  $query .= ' WHERE ';
238 
239  foreach ($wheres as $w) {
240  $query .= " $w AND ";
241  }
242  $query .= "1=1";
243 
244  return delete_data($query);
245 }
246 
286 function elgg_get_river(array $options = array()) {
287  global $CONFIG;
288 
289  $defaults = array(
290  'ids' => ELGG_ENTITIES_ANY_VALUE,
291 
292  'subject_guids' => ELGG_ENTITIES_ANY_VALUE,
293  'object_guids' => ELGG_ENTITIES_ANY_VALUE,
294  'target_guids' => ELGG_ENTITIES_ANY_VALUE,
295  'annotation_ids' => ELGG_ENTITIES_ANY_VALUE,
296  'action_types' => ELGG_ENTITIES_ANY_VALUE,
297 
298  'relationship' => null,
299  'relationship_guid' => null,
300  'inverse_relationship' => false,
301 
302  'types' => ELGG_ENTITIES_ANY_VALUE,
303  'subtypes' => ELGG_ENTITIES_ANY_VALUE,
304  'type_subtype_pairs' => ELGG_ENTITIES_ANY_VALUE,
305 
306  'posted_time_lower' => ELGG_ENTITIES_ANY_VALUE,
307  'posted_time_upper' => ELGG_ENTITIES_ANY_VALUE,
308 
309  'limit' => 20,
310  'offset' => 0,
311  'count' => false,
312  'distinct' => true,
313 
314  'order_by' => 'rv.posted desc',
315  'group_by' => ELGG_ENTITIES_ANY_VALUE,
316 
317  'wheres' => array(),
318  'joins' => array(),
319  );
320 
321  $options = array_merge($defaults, $options);
322 
323  $singulars = array('id', 'subject_guid', 'object_guid', 'target_guid', 'annotation_id', 'action_type', 'type', 'subtype');
325 
326  $wheres = $options['wheres'];
327 
328  $wheres[] = _elgg_get_guid_based_where_sql('rv.id', $options['ids']);
329  $wheres[] = _elgg_get_guid_based_where_sql('rv.subject_guid', $options['subject_guids']);
330  $wheres[] = _elgg_get_guid_based_where_sql('rv.object_guid', $options['object_guids']);
331  $wheres[] = _elgg_get_guid_based_where_sql('rv.target_guid', $options['target_guids']);
332  $wheres[] = _elgg_get_guid_based_where_sql('rv.annotation_id', $options['annotation_ids']);
333  $wheres[] = _elgg_river_get_action_where_sql($options['action_types']);
334  $wheres[] = _elgg_get_river_type_subtype_where_sql('rv', $options['types'],
335  $options['subtypes'], $options['type_subtype_pairs']);
336 
337  if ($options['posted_time_lower'] && is_int($options['posted_time_lower'])) {
338  $wheres[] = "rv.posted >= {$options['posted_time_lower']}";
339  }
340 
341  if ($options['posted_time_upper'] && is_int($options['posted_time_upper'])) {
342  $wheres[] = "rv.posted <= {$options['posted_time_upper']}";
343  }
344 
346  $wheres[] = "rv.enabled = 'yes'";
347  }
348 
349  $joins = $options['joins'];
350 
351  $dbprefix = elgg_get_config('dbprefix');
352  $joins[] = "JOIN {$dbprefix}entities oe ON rv.object_guid = oe.guid";
353  // LEFT JOIN is used because all river items do not necessarily have target
354  $joins[] = "LEFT JOIN {$dbprefix}entities te ON rv.target_guid = te.guid";
355 
356  if ($options['relationship_guid']) {
358  'rv.subject_guid',
359  $options['relationship'],
360  $options['relationship_guid'],
361  $options['inverse_relationship']);
362  if ($clauses) {
363  $wheres = array_merge($wheres, $clauses['wheres']);
364  $joins = array_merge($joins, $clauses['joins']);
365  }
366  }
367 
368  // see if any functions failed
369  // remove empty strings on successful functions
370  foreach ($wheres as $i => $where) {
371  if ($where === false) {
372  return false;
373  } elseif (empty($where)) {
374  unset($wheres[$i]);
375  }
376  }
377 
378  // remove identical where clauses
379  $wheres = array_unique($wheres);
380 
381  if (!$options['count']) {
382  $distinct = $options['distinct'] ? "DISTINCT" : "";
383 
384  $query = "SELECT $distinct rv.* FROM {$CONFIG->dbprefix}river rv ";
385  } else {
386  // note: when DISTINCT unneeded, it's slightly faster to compute COUNT(*) than IDs
387  $count_expr = $options['distinct'] ? "DISTINCT rv.id" : "*";
388 
389  $query = "SELECT COUNT($count_expr) as total FROM {$CONFIG->dbprefix}river rv ";
390  }
391 
392  // add joins
393  foreach ($joins as $j) {
394  $query .= " $j ";
395  }
396 
397  // add wheres
398  $query .= ' WHERE ';
399 
400  foreach ($wheres as $w) {
401  $query .= " $w AND ";
402  }
403 
404  // Make sure that user has access to all the entities referenced by each river item
405  $object_access_where = _elgg_get_access_where_sql(array('table_alias' => 'oe'));
406  $target_access_where = _elgg_get_access_where_sql(array('table_alias' => 'te'));
407 
408  // We use LEFT JOIN with entities table but the WHERE clauses are used
409  // regardless if a JOIN is successfully made. The "te.guid IS NULL" is
410  // needed because of this.
411  $query .= "$object_access_where AND ($target_access_where OR te.guid IS NULL) ";
412 
413  if (!$options['count']) {
414  $options['group_by'] = sanitise_string($options['group_by']);
415  if ($options['group_by']) {
416  $query .= " GROUP BY {$options['group_by']}";
417  }
418 
419  $options['order_by'] = sanitise_string($options['order_by']);
420  $query .= " ORDER BY {$options['order_by']}";
421 
422  if ($options['limit']) {
423  $limit = sanitise_int($options['limit']);
424  $offset = sanitise_int($options['offset'], false);
425  $query .= " LIMIT $offset, $limit";
426  }
427 
428  $river_items = get_data($query, '_elgg_row_to_elgg_river_item');
429  _elgg_prefetch_river_entities($river_items);
430 
431  return $river_items;
432  } else {
433  $total = get_data_row($query);
434  return (int)$total->total;
435  }
436 }
437 
444 function _elgg_prefetch_river_entities(array $river_items) {
445  // prefetch objects, subjects and targets
446  $guids = array();
447  foreach ($river_items as $item) {
448  if ($item->subject_guid && !_elgg_retrieve_cached_entity($item->subject_guid)) {
449  $guids[$item->subject_guid] = true;
450  }
451  if ($item->object_guid && !_elgg_retrieve_cached_entity($item->object_guid)) {
452  $guids[$item->object_guid] = true;
453  }
454  if ($item->target_guid && !_elgg_retrieve_cached_entity($item->target_guid)) {
455  $guids[$item->target_guid] = true;
456  }
457  }
458  if ($guids) {
459  // avoid creating oversized query
460  // @todo how to better handle this?
461  $guids = array_slice($guids, 0, 300, true);
462  // return value unneeded, just priming cache
463  elgg_get_entities(array(
464  'guids' => array_keys($guids),
465  'limit' => 0,
466  'distinct' => false,
467  ));
468  }
469 
470  // prefetch object containers
471  $guids = array();
472  foreach ($river_items as $item) {
473  $object = $item->getObjectEntity();
474  if ($object->container_guid && !_elgg_retrieve_cached_entity($object->container_guid)) {
475  $guids[$object->container_guid] = true;
476  }
477  }
478  if ($guids) {
479  $guids = array_slice($guids, 0, 300, true);
480  elgg_get_entities(array(
481  'guids' => array_keys($guids),
482  'limit' => 0,
483  'distinct' => false,
484  ));
485  }
486 }
487 
498 function elgg_list_river(array $options = array()) {
499  global $autofeed;
500  $autofeed = true;
501 
502  $defaults = array(
503  'offset' => (int) max(get_input('offset', 0), 0),
504  'limit' => (int) max(get_input('limit', max(20, elgg_get_config('default_limit'))), 0),
505  'pagination' => true,
506  'list_class' => 'elgg-list-river',
507  'no_results' => '',
508  );
509 
510  $options = array_merge($defaults, $options);
511 
512  if (!$options["limit"] && !$options["offset"]) {
513  // no need for pagination if listing is unlimited
514  $options["pagination"] = false;
515  }
516 
517  $options['count'] = true;
519 
520  if ($count > 0) {
521  $options['count'] = false;
523  } else {
524  $items = array();
525  }
526 
527  $options['count'] = $count;
528  $options['items'] = $items;
529 
530  return elgg_view('page/components/list', $options);
531 }
532 
543  if (!($row instanceof \stdClass)) {
544  return null;
545  }
546 
547  return new \ElggRiverItem($row);
548 }
549 
566  // short circuit if nothing is requested
567  if (!$types && !$subtypes && !$pairs) {
568  return '';
569  }
570 
571  $wheres = array();
572  $types_wheres = array();
573  $subtypes_wheres = array();
574 
575  // if no pairs, use types and subtypes
576  if (!is_array($pairs)) {
577  if ($types) {
578  if (!is_array($types)) {
579  $types = array($types);
580  }
581  foreach ($types as $type) {
582  $type = sanitise_string($type);
583  $types_wheres[] = "({$table}.type = '$type')";
584  }
585  }
586 
587  if ($subtypes) {
588  if (!is_array($subtypes)) {
589  $subtypes = array($subtypes);
590  }
591  foreach ($subtypes as $subtype) {
592  $subtype = sanitise_string($subtype);
593  $subtypes_wheres[] = "({$table}.subtype = '$subtype')";
594  }
595  }
596 
597  if (is_array($types_wheres) && count($types_wheres)) {
598  $types_wheres = array(implode(' OR ', $types_wheres));
599  }
600 
601  if (is_array($subtypes_wheres) && count($subtypes_wheres)) {
602  $subtypes_wheres = array('(' . implode(' OR ', $subtypes_wheres) . ')');
603  }
604 
605  $wheres = array(implode(' AND ', array_merge($types_wheres, $subtypes_wheres)));
606 
607  } else {
608  // using type/subtype pairs
609  foreach ($pairs as $paired_type => $paired_subtypes) {
610  $paired_type = sanitise_string($paired_type);
611  if (is_array($paired_subtypes)) {
612  $paired_subtypes = array_map('sanitise_string', $paired_subtypes);
613  $paired_subtype_str = implode("','", $paired_subtypes);
614  if ($paired_subtype_str) {
615  $wheres[] = "({$table}.type = '$paired_type'"
616  . " AND {$table}.subtype IN ('$paired_subtype_str'))";
617  }
618  } else {
619  $paired_subtype = sanitise_string($paired_subtypes);
620  $wheres[] = "({$table}.type = '$paired_type'"
621  . " AND {$table}.subtype = '$paired_subtype')";
622  }
623  }
624  }
625 
626  if (is_array($wheres) && count($wheres)) {
627  $where = implode(' OR ', $wheres);
628  return "($where)";
629  }
630 
631  return '';
632 }
633 
644  if (!$types) {
645  return '';
646  }
647 
648  if (!is_array($types)) {
649  $types = sanitise_string($types);
650  return "(rv.action_type = '$types')";
651  }
652 
653  // sanitize types array
654  $types_sanitized = array();
655  foreach ($types as $type) {
656  $types_sanitized[] = sanitise_string($type);
657  }
658 
659  $type_str = implode("','", $types_sanitized);
660  return "(rv.action_type IN ('$type_str'))";
661 }
662 
673  if (!$views) {
674  return '';
675  }
676 
677  if (!is_array($views)) {
678  $views = sanitise_string($views);
679  return "(rv.view = '$views')";
680  }
681 
682  // sanitize views array
683  $views_sanitized = array();
684  foreach ($views as $view) {
685  $views_sanitized[] = sanitise_string($view);
686  }
687 
688  $view_str = implode("','", $views_sanitized);
689  return "(rv.view IN ('$view_str'))";
690 }
691 
700 function update_river_access_by_object($object_guid, $access_id) {
701  // Sanitise
702  $object_guid = (int) $object_guid;
703  $access_id = (int) $access_id;
704 
705  // Load config
706  global $CONFIG;
707 
708  $query = "UPDATE {$CONFIG->dbprefix}river
709  SET access_id = {$access_id}
710  WHERE object_guid = {$object_guid}";
711  return update_data($query);
712 }
713 
721 function _elgg_river_page_handler($page) {
722  global $CONFIG;
723 
725 
726  // make a URL segment available in page handler script
727  $page_type = elgg_extract(0, $page, 'all');
728  $page_type = preg_replace('[\W]', '', $page_type);
729  if ($page_type == 'owner') {
730  elgg_gatekeeper();
731  $page_username = elgg_extract(1, $page, '');
732  if ($page_username == elgg_get_logged_in_user_entity()->username) {
733  $page_type = 'mine';
734  } else {
735  set_input('subject_username', $page_username);
736  }
737  }
738  set_input('page_type', $page_type);
739 
740  require_once("{$CONFIG->path}pages/river.php");
741  return true;
742 }
743 
748 function _elgg_river_test($hook, $type, $value) {
749  global $CONFIG;
750  $value[] = $CONFIG->path . 'engine/tests/ElggCoreRiverAPITest.php';
751  return $value;
752 }
753 
763 function _elgg_river_disable($event, $type, $entity) {
764 
765  if (!elgg_instanceof($entity)) {
766  return true;
767  }
768 
769  $dbprefix = elgg_get_config('dbprefix');
770  $query = <<<QUERY
771  UPDATE {$dbprefix}river AS rv
772  SET rv.enabled = 'no'
773  WHERE (rv.subject_guid = {$entity->guid} OR rv.object_guid = {$entity->guid} OR rv.target_guid = {$entity->guid});
774 QUERY;
775 
776  update_data($query);
777  return true;
778 }
779 
780 
790 function _elgg_river_enable($event, $type, $entity) {
791 
792  if (!elgg_instanceof($entity)) {
793  return true;
794  }
795 
796  $dbprefix = elgg_get_config('dbprefix');
797  $query = <<<QUERY
798  UPDATE {$dbprefix}river AS rv
799  LEFT JOIN {$dbprefix}entities AS se ON se.guid = rv.subject_guid
800  LEFT JOIN {$dbprefix}entities AS oe ON oe.guid = rv.object_guid
801  LEFT JOIN {$dbprefix}entities AS te ON te.guid = rv.target_guid
802  SET rv.enabled = 'yes'
803  WHERE (
804  (se.enabled = 'yes' OR se.guid IS NULL) AND
805  (oe.enabled = 'yes' OR oe.guid IS NULL) AND
806  (te.enabled = 'yes' OR te.guid IS NULL)
807  )
808  AND (se.guid = {$entity->guid} OR oe.guid = {$entity->guid} OR te.guid = {$entity->guid});
809 QUERY;
810 
811  update_data($query);
812  return true;
813 }
814 
819 function _elgg_river_init() {
820  elgg_register_page_handler('activity', '_elgg_river_page_handler');
821  $item = new \ElggMenuItem('activity', elgg_echo('activity'), 'activity');
823 
824  elgg_register_widget_type('river_widget', elgg_echo('river:widget:title'), elgg_echo('river:widget:description'));
825 
826  elgg_register_action('river/delete', '', 'admin');
827 
828  elgg_register_plugin_hook_handler('unit_test', 'system', '_elgg_river_test');
829 }
830 
831 elgg_register_event_handler('init', 'system', '_elgg_river_init');
832 elgg_register_event_handler('disable:after', 'all', '_elgg_river_disable');
833 elgg_register_event_handler('enable:after', 'all', '_elgg_river_enable');
elgg_list_river(array $options=array())
List river items.
Definition: river.php:498
_elgg_river_get_action_where_sql($types)
Get the where clause based on river action type strings.
Definition: river.php:643
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
$view
Definition: crop.php:68
$dbprefix
Definition: index.php:13
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
get_data_row($query, $callback="")
Retrieve a single row from the database.
Definition: database.php:66
$subject
Definition: exceptions.php:25
_elgg_river_init()
Initialize river library private.
Definition: river.php:819
$table
Definition: cron.php:28
$page_type
Definition: river.php:10
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:672
_elgg_retrieve_cached_entity($guid)
Retrieve a entity from the cache.
Definition: entities.php:125
$object
Definition: upgrade.php:12
_elgg_river_test($hook, $type, $value)
Register river unit tests private.
Definition: river.php:748
elgg_register_widget_type($handler, $name, $description, $context=array('all'), $multiple=false)
Register a widget type.
Definition: widgets.php:73
_elgg_get_guid_based_where_sql($column, $guids)
Returns SQL where clause for owner and containers.
Definition: entities.php:535
update_entity_last_action($guid, $posted=null)
Update the last_action column in the entities table for $guid.
Definition: entities.php:952
if(elgg_in_context('widget')) $offset
Definition: pagination.php:20
_elgg_prefetch_river_entities(array $river_items)
Prefetch entities that will be displayed in the river.
Definition: river.php:444
$value
Definition: longtext.php:29
elgg_view_exists($view, $viewtype= '', $recurse=true)
Returns whether the specified view exists.
Definition: views.php:318
set_input($variable, $value)
Sets an input value that may later be retrieved by get_input.
Definition: input.php:41
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1349
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Register a callback as a plugin hook handler.
Definition: elgglib.php:737
delete_data($query)
Remove a row from the database.
Definition: database.php:106
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:73
update_data($query)
Update a row in the database.
Definition: database.php:93
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
update_river_access_by_object($object_guid, $access_id)
Sets the access ID on river items for a particular object.
Definition: river.php:700
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:921
$limit
Definition: userpicker.php:33
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_get_annotation_from_id($id)
Get a specific annotation by its id.
Definition: annotations.php:36
if(!$limit=(int) elgg_extract('limit', $vars, elgg_get_config('default_limit'))) $count
Definition: pagination.php:26
elgg_create_river_item(array $options=array())
Adds an item to the river.
Definition: river.php:37
_elgg_row_to_elgg_river_item($row)
Convert a database row to a new .
Definition: river.php:542
$item
Definition: item.php:12
global $CONFIG
elgg menu river
Definition: navigation.php:487
sanitise_string($string)
Wrapper function for alternate English spelling (.
Definition: database.php:150
const ELGG_ENTITIES_ANY_VALUE
Definition: elgglib.php:2059
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
Definition: entities.php:490
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Trigger a Plugin Hook and run all handler callbacks registered to that hook:type. ...
Definition: elgglib.php:809
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 global
Pointer to the global context.
Definition: elgglib.js:12
elgg_register_menu_item($menu_name, $menu_item)
Register an item for an Elgg menu.
Definition: navigation.php:92
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
access_get_show_hidden_status()
Return current status of showing disabled entities.
Definition: access.php:170
$items
Definition: list.php:11
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
Register a callback as an Elgg event handler.
Definition: elgglib.php:553
_elgg_river_enable($event, $type, $entity)
Enable river entries that reference a re-enabled entity as subject/object/target. ...
Definition: river.php:790
$posted
Definition: comment.php:69
$guids
_elgg_river_disable($event, $type, $entity)
Disable river entries that reference a disabled entity as subject/object/target.
Definition: river.php:763
get_data($query, $callback="")
Retrieve rows from the database.
Definition: database.php:50
elgg_get_river(array $options=array())
Get river items.
Definition: river.php:286
$subtypes
elgg_delete_river(array $options=array())
Delete river items.
Definition: river.php:162
$row
sanitise_int($int, $signed=true)
Sanitizes an integer for database use.
Definition: database.php:173
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:32
elgg_register_action($action, $filename="", $access= 'logged_in')
Registers an action.
Definition: actions.php:85
$target
Definition: responses.php:19
_elgg_normalize_plural_options_array($options, $singulars)
Normalise the singular keys in an options array to plural keys.
Definition: elgglib.php:1479
$defaults
Definition: access.php:19
$entity
Definition: delete.php:10
_elgg_get_access_where_sql(array $options=array())
Returns the SQL where clause for enforcing read access to data.
Definition: access.php:214
_elgg_river_page_handler($page)
Page handler for activity.
Definition: river.php:721
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:604
$subtype
Definition: river.php:12
if(!$collection_name) $id
Definition: add.php:17
$options
Main activity stream list page.
Definition: river.php:6
$type
Definition: river.php:11
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:565
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:382