Elgg  Version 1.9
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  $type = $object->getType();
80  $subtype = $object->getSubtype();
81 
83  $action_type = sanitise_string($action_type);
84  $subject_guid = sanitise_int($subject_guid);
85  $object_guid = sanitise_int($object_guid);
86  $target_guid = sanitise_int($target_guid);
87  $access_id = sanitise_int($access_id);
89  $annotation_id = sanitise_int($annotation_id);
90 
91  $values = array(
92  'type' => $type,
93  'subtype' => $subtype,
94  'action_type' => $action_type,
95  'access_id' => $access_id,
96  'view' => $view,
97  'subject_guid' => $subject_guid,
98  'object_guid' => $object_guid,
99  'target_guid' => $target_guid,
100  'annotation_id' => $annotation_id,
101  'posted' => $posted,
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  extract($values);
112 
113  $dbprefix = elgg_get_config('dbprefix');
114 
115  $id = insert_data("INSERT INTO {$dbprefix}river " .
116  " SET type = '$type', " .
117  " subtype = '$subtype', " .
118  " action_type = '$action_type', " .
119  " access_id = $access_id, " .
120  " view = '$view', " .
121  " subject_guid = $subject_guid, " .
122  " object_guid = $object_guid, " .
123  " target_guid = $target_guid, " .
124  " annotation_id = $annotation_id, " .
125  " posted = $posted, " .
126  " enabled = 'yes'");
127 
128  // update the entities which had the action carried out on it
129  // @todo shouldn't this be done elsewhere? Like when an annotation is saved?
130  if ($id) {
131  update_entity_last_action($object_guid, $posted);
132 
133  $river_items = elgg_get_river(array('id' => $id));
134  if ($river_items) {
135  elgg_trigger_event('created', 'river', $river_items[0]);
136  }
137  return $id;
138  } else {
139  return false;
140  }
141 }
142 
168 function elgg_delete_river(array $options = array()) {
169  global $CONFIG;
170 
171  $defaults = array(
172  'ids' => ELGG_ENTITIES_ANY_VALUE,
173 
174  'subject_guids' => ELGG_ENTITIES_ANY_VALUE,
175  'object_guids' => ELGG_ENTITIES_ANY_VALUE,
176  'target_guids' => ELGG_ENTITIES_ANY_VALUE,
177  'annotation_ids' => ELGG_ENTITIES_ANY_VALUE,
178 
179  'views' => ELGG_ENTITIES_ANY_VALUE,
180  'action_types' => ELGG_ENTITIES_ANY_VALUE,
181 
182  'types' => ELGG_ENTITIES_ANY_VALUE,
183  'subtypes' => ELGG_ENTITIES_ANY_VALUE,
184  'type_subtype_pairs' => ELGG_ENTITIES_ANY_VALUE,
185 
186  'posted_time_lower' => ELGG_ENTITIES_ANY_VALUE,
187  'posted_time_upper' => ELGG_ENTITIES_ANY_VALUE,
188 
189  'wheres' => array(),
190  'joins' => array(),
191 
192  );
193 
194  $options = array_merge($defaults, $options);
195 
196  $singulars = array('id', 'subject_guid', 'object_guid', 'target_guid', 'annotation_id', 'action_type', 'view', 'type', 'subtype');
198 
199  $wheres = $options['wheres'];
200 
201  $wheres[] = _elgg_get_guid_based_where_sql('rv.id', $options['ids']);
202  $wheres[] = _elgg_get_guid_based_where_sql('rv.subject_guid', $options['subject_guids']);
203  $wheres[] = _elgg_get_guid_based_where_sql('rv.object_guid', $options['object_guids']);
204  $wheres[] = _elgg_get_guid_based_where_sql('rv.target_guid', $options['target_guids']);
205  $wheres[] = _elgg_get_guid_based_where_sql('rv.annotation_id', $options['annotation_ids']);
206  $wheres[] = _elgg_river_get_action_where_sql($options['action_types']);
207  $wheres[] = _elgg_river_get_view_where_sql($options['views']);
208  $wheres[] = _elgg_get_river_type_subtype_where_sql('rv', $options['types'],
209  $options['subtypes'], $options['type_subtype_pairs']);
210 
211  if ($options['posted_time_lower'] && is_int($options['posted_time_lower'])) {
212  $wheres[] = "rv.posted >= {$options['posted_time_lower']}";
213  }
214 
215  if ($options['posted_time_upper'] && is_int($options['posted_time_upper'])) {
216  $wheres[] = "rv.posted <= {$options['posted_time_upper']}";
217  }
218 
219  // see if any functions failed
220  // remove empty strings on successful functions
221  foreach ($wheres as $i => $where) {
222  if ($where === false) {
223  return false;
224  } elseif (empty($where)) {
225  unset($wheres[$i]);
226  }
227  }
228 
229  // remove identical where clauses
230  $wheres = array_unique($wheres);
231 
232  $query = "DELETE rv.* FROM {$CONFIG->dbprefix}river rv ";
233 
234  // remove identical join clauses
235  $joins = array_unique($options['joins']);
236 
237  // add joins
238  foreach ($joins as $j) {
239  $query .= " $j ";
240  }
241 
242  // add wheres
243  $query .= ' WHERE ';
244 
245  foreach ($wheres as $w) {
246  $query .= " $w AND ";
247  }
248  $query .= "1=1";
249 
250  return delete_data($query);
251 }
252 
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 
313  'order_by' => 'rv.posted desc',
314  'group_by' => ELGG_ENTITIES_ANY_VALUE,
315 
316  'wheres' => array(),
317  'joins' => array(),
318  );
319 
320  $options = array_merge($defaults, $options);
321 
322  $singulars = array('id', 'subject_guid', 'object_guid', 'target_guid', 'annotation_id', 'action_type', 'type', 'subtype');
324 
325  $wheres = $options['wheres'];
326 
327  $wheres[] = _elgg_get_guid_based_where_sql('rv.id', $options['ids']);
328  $wheres[] = _elgg_get_guid_based_where_sql('rv.subject_guid', $options['subject_guids']);
329  $wheres[] = _elgg_get_guid_based_where_sql('rv.object_guid', $options['object_guids']);
330  $wheres[] = _elgg_get_guid_based_where_sql('rv.target_guid', $options['target_guids']);
331  $wheres[] = _elgg_get_guid_based_where_sql('rv.annotation_id', $options['annotation_ids']);
332  $wheres[] = _elgg_river_get_action_where_sql($options['action_types']);
333  $wheres[] = _elgg_get_river_type_subtype_where_sql('rv', $options['types'],
334  $options['subtypes'], $options['type_subtype_pairs']);
335 
336  if ($options['posted_time_lower'] && is_int($options['posted_time_lower'])) {
337  $wheres[] = "rv.posted >= {$options['posted_time_lower']}";
338  }
339 
340  if ($options['posted_time_upper'] && is_int($options['posted_time_upper'])) {
341  $wheres[] = "rv.posted <= {$options['posted_time_upper']}";
342  }
343 
345  $wheres[] = "rv.enabled = 'yes'";
346  }
347 
348  $joins = $options['joins'];
349 
350  $dbprefix = elgg_get_config('dbprefix');
351  $joins[] = "JOIN {$dbprefix}entities oe ON rv.object_guid = oe.guid";
352  // LEFT JOIN is used because all river items do not necessarily have target
353  $joins[] = "LEFT JOIN {$dbprefix}entities te ON rv.target_guid = te.guid";
354 
355  if ($options['relationship_guid']) {
357  'rv.subject_guid',
358  $options['relationship'],
359  $options['relationship_guid'],
360  $options['inverse_relationship']);
361  if ($clauses) {
362  $wheres = array_merge($wheres, $clauses['wheres']);
363  $joins = array_merge($joins, $clauses['joins']);
364  }
365  }
366 
367  // see if any functions failed
368  // remove empty strings on successful functions
369  foreach ($wheres as $i => $where) {
370  if ($where === false) {
371  return false;
372  } elseif (empty($where)) {
373  unset($wheres[$i]);
374  }
375  }
376 
377  // remove identical where clauses
378  $wheres = array_unique($wheres);
379 
380  if (!$options['count']) {
381  $query = "SELECT DISTINCT rv.* FROM {$CONFIG->dbprefix}river rv ";
382  } else {
383  $query = "SELECT COUNT(DISTINCT rv.id) AS total FROM {$CONFIG->dbprefix}river rv ";
384  }
385 
386  // add joins
387  foreach ($joins as $j) {
388  $query .= " $j ";
389  }
390 
391  // add wheres
392  $query .= ' WHERE ';
393 
394  foreach ($wheres as $w) {
395  $query .= " $w AND ";
396  }
397 
398  // Make sure that user has access to all the entities referenced by each river item
399  $object_access_where = _elgg_get_access_where_sql(array('table_alias' => 'oe'));
400  $target_access_where = _elgg_get_access_where_sql(array('table_alias' => 'te'));
401 
402  // We use LEFT JOIN with entities table but the WHERE clauses are used
403  // regardless if a JOIN is successfully made. The "te.guid IS NULL" is
404  // needed because of this.
405  $query .= "$object_access_where AND ($target_access_where OR te.guid IS NULL) ";
406 
407  if (!$options['count']) {
408  $options['group_by'] = sanitise_string($options['group_by']);
409  if ($options['group_by']) {
410  $query .= " GROUP BY {$options['group_by']}";
411  }
412 
413  $options['order_by'] = sanitise_string($options['order_by']);
414  $query .= " ORDER BY {$options['order_by']}";
415 
416  if ($options['limit']) {
417  $limit = sanitise_int($options['limit']);
418  $offset = sanitise_int($options['offset'], false);
419  $query .= " LIMIT $offset, $limit";
420  }
421 
422  $river_items = get_data($query, '_elgg_row_to_elgg_river_item');
423  _elgg_prefetch_river_entities($river_items);
424 
425  return $river_items;
426  } else {
427  $total = get_data_row($query);
428  return (int)$total->total;
429  }
430 }
431 
438 function _elgg_prefetch_river_entities(array $river_items) {
439  // prefetch objects, subjects and targets
440  $guids = array();
441  foreach ($river_items as $item) {
442  if ($item->subject_guid && !_elgg_retrieve_cached_entity($item->subject_guid)) {
443  $guids[$item->subject_guid] = true;
444  }
445  if ($item->object_guid && !_elgg_retrieve_cached_entity($item->object_guid)) {
446  $guids[$item->object_guid] = true;
447  }
448  if ($item->target_guid && !_elgg_retrieve_cached_entity($item->target_guid)) {
449  $guids[$item->target_guid] = true;
450  }
451  }
452  if ($guids) {
453  // avoid creating oversized query
454  // @todo how to better handle this?
455  $guids = array_slice($guids, 0, 300, true);
456  // return value unneeded, just priming cache
457  elgg_get_entities(array(
458  'guids' => array_keys($guids),
459  'limit' => 0,
460  ));
461  }
462 
463  // prefetch object containers
464  $guids = array();
465  foreach ($river_items as $item) {
466  $object = $item->getObjectEntity();
467  if ($object->container_guid && !_elgg_retrieve_cached_entity($object->container_guid)) {
468  $guids[$object->container_guid] = true;
469  }
470  }
471  if ($guids) {
472  $guids = array_slice($guids, 0, 300, true);
473  elgg_get_entities(array(
474  'guids' => array_keys($guids),
475  'limit' => 0,
476  ));
477  }
478 }
479 
490 function elgg_list_river(array $options = array()) {
491  global $autofeed;
492  $autofeed = true;
493 
494  $defaults = array(
495  'offset' => (int) max(get_input('offset', 0), 0),
496  'limit' => (int) max(get_input('limit', 20), 0),
497  'pagination' => true,
498  'list_class' => 'elgg-list-river',
499  'no_results' => '',
500  );
501 
502  $options = array_merge($defaults, $options);
503 
504  if (!$options["limit"] && !$options["offset"]) {
505  // no need for pagination if listing is unlimited
506  $options["pagination"] = false;
507  }
508 
509  $options['count'] = true;
511 
512  if ($count > 0) {
513  $options['count'] = false;
515  } else {
516  $items = array();
517  }
518 
519  $options['count'] = $count;
520  $options['items'] = $items;
521 
522  return elgg_view('page/components/list', $options);
523 }
524 
535  if (!($row instanceof stdClass)) {
536  return null;
537  }
538 
539  return new ElggRiverItem($row);
540 }
541 
558  // short circuit if nothing is requested
559  if (!$types && !$subtypes && !$pairs) {
560  return '';
561  }
562 
563  $wheres = array();
564  $types_wheres = array();
565  $subtypes_wheres = array();
566 
567  // if no pairs, use types and subtypes
568  if (!is_array($pairs)) {
569  if ($types) {
570  if (!is_array($types)) {
571  $types = array($types);
572  }
573  foreach ($types as $type) {
574  $type = sanitise_string($type);
575  $types_wheres[] = "({$table}.type = '$type')";
576  }
577  }
578 
579  if ($subtypes) {
580  if (!is_array($subtypes)) {
581  $subtypes = array($subtypes);
582  }
583  foreach ($subtypes as $subtype) {
584  $subtype = sanitise_string($subtype);
585  $subtypes_wheres[] = "({$table}.subtype = '$subtype')";
586  }
587  }
588 
589  if (is_array($types_wheres) && count($types_wheres)) {
590  $types_wheres = array(implode(' OR ', $types_wheres));
591  }
592 
593  if (is_array($subtypes_wheres) && count($subtypes_wheres)) {
594  $subtypes_wheres = array('(' . implode(' OR ', $subtypes_wheres) . ')');
595  }
596 
597  $wheres = array(implode(' AND ', array_merge($types_wheres, $subtypes_wheres)));
598 
599  } else {
600  // using type/subtype pairs
601  foreach ($pairs as $paired_type => $paired_subtypes) {
602  $paired_type = sanitise_string($paired_type);
603  if (is_array($paired_subtypes)) {
604  $paired_subtypes = array_map('sanitise_string', $paired_subtypes);
605  $paired_subtype_str = implode("','", $paired_subtypes);
606  if ($paired_subtype_str) {
607  $wheres[] = "({$table}.type = '$paired_type'"
608  . " AND {$table}.subtype IN ('$paired_subtype_str'))";
609  }
610  } else {
611  $paired_subtype = sanitise_string($paired_subtypes);
612  $wheres[] = "({$table}.type = '$paired_type'"
613  . " AND {$table}.subtype = '$paired_subtype')";
614  }
615  }
616  }
617 
618  if (is_array($wheres) && count($wheres)) {
619  $where = implode(' OR ', $wheres);
620  return "($where)";
621  }
622 
623  return '';
624 }
625 
636  if (!$types) {
637  return '';
638  }
639 
640  if (!is_array($types)) {
641  $types = sanitise_string($types);
642  return "(rv.action_type = '$types')";
643  }
644 
645  // sanitize types array
646  $types_sanitized = array();
647  foreach ($types as $type) {
648  $types_sanitized[] = sanitise_string($type);
649  }
650 
651  $type_str = implode("','", $types_sanitized);
652  return "(rv.action_type IN ('$type_str'))";
653 }
654 
665  if (!$views) {
666  return '';
667  }
668 
669  if (!is_array($views)) {
670  $views = sanitise_string($views);
671  return "(rv.view = '$views')";
672  }
673 
674  // sanitize views array
675  $views_sanitized = array();
676  foreach ($views as $view) {
677  $views_sanitized[] = sanitise_string($view);
678  }
679 
680  $view_str = implode("','", $views_sanitized);
681  return "(rv.view IN ('$view_str'))";
682 }
683 
692 function update_river_access_by_object($object_guid, $access_id) {
693  // Sanitise
694  $object_guid = (int) $object_guid;
695  $access_id = (int) $access_id;
696 
697  // Load config
698  global $CONFIG;
699 
700  $query = "UPDATE {$CONFIG->dbprefix}river
701  SET access_id = {$access_id}
702  WHERE object_guid = {$object_guid}";
703  return update_data($query);
704 }
705 
713 function _elgg_river_page_handler($page) {
714  global $CONFIG;
715 
717 
718  // make a URL segment available in page handler script
719  $page_type = elgg_extract(0, $page, 'all');
720  $page_type = preg_replace('[\W]', '', $page_type);
721  if ($page_type == 'owner') {
722  elgg_gatekeeper();
723  $page_username = elgg_extract(1, $page, '');
724  if ($page_username == elgg_get_logged_in_user_entity()->username) {
725  $page_type = 'mine';
726  } else {
728  set_input('subject_username', $page_username);
729  }
730  }
731  set_input('page_type', $page_type);
732 
733  require_once("{$CONFIG->path}pages/river.php");
734  return true;
735 }
736 
741 function _elgg_river_test($hook, $type, $value) {
742  global $CONFIG;
743  $value[] = $CONFIG->path . 'engine/tests/ElggCoreRiverAPITest.php';
744  return $value;
745 }
746 
756 function _elgg_river_disable($event, $type, $entity) {
757 
758  if (!elgg_instanceof($entity)) {
759  return true;
760  }
761 
762  $dbprefix = elgg_get_config('dbprefix');
763  $query = <<<QUERY
764  UPDATE {$dbprefix}river AS rv
765  SET rv.enabled = 'no'
766  WHERE (rv.subject_guid = {$entity->guid} OR rv.object_guid = {$entity->guid} OR rv.target_guid = {$entity->guid});
767 QUERY;
768 
769  update_data($query);
770  return true;
771 }
772 
773 
783 function _elgg_river_enable($event, $type, $entity) {
784 
785  if (!elgg_instanceof($entity)) {
786  return true;
787  }
788 
789  $dbprefix = elgg_get_config('dbprefix');
790  $query = <<<QUERY
791  UPDATE {$dbprefix}river AS rv
792  LEFT JOIN {$dbprefix}entities AS se ON se.guid = rv.subject_guid
793  LEFT JOIN {$dbprefix}entities AS oe ON oe.guid = rv.object_guid
794  LEFT JOIN {$dbprefix}entities AS te ON te.guid = rv.target_guid
795  SET rv.enabled = 'yes'
796  WHERE (
797  (se.enabled = 'yes' OR se.guid IS NULL) AND
798  (oe.enabled = 'yes' OR oe.guid IS NULL) AND
799  (te.enabled = 'yes' OR te.guid IS NULL)
800  )
801  AND (se.guid = {$entity->guid} OR oe.guid = {$entity->guid} OR te.guid = {$entity->guid});
802 QUERY;
803 
804  update_data($query);
805  return true;
806 }
807 
812 function _elgg_river_init() {
813  elgg_register_page_handler('activity', '_elgg_river_page_handler');
814  $item = new ElggMenuItem('activity', elgg_echo('activity'), 'activity');
816 
817  elgg_register_widget_type('river_widget', elgg_echo('river:widget:title'), elgg_echo('river:widget:description'));
818 
819  elgg_register_action('river/delete', '', 'admin');
820 
821  elgg_register_plugin_hook_handler('unit_test', 'system', '_elgg_river_test');
822 }
823 
824 elgg_register_event_handler('init', 'system', '_elgg_river_init');
825 elgg_register_event_handler('disable:after', 'all', '_elgg_river_disable');
826 elgg_register_event_handler('enable:after', 'all', '_elgg_river_enable');
elgg_list_river(array $options=array())
List river items.
Definition: river.php:490
_elgg_river_get_action_where_sql($types)
Get the where clause based on river action type strings.
Definition: river.php:635
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:812
$table
Definition: cron.php:28
$page_type
Definition: river.php:8
_elgg_river_get_view_where_sql($views)
Get the where clause based on river view strings.
Definition: river.php:664
_elgg_retrieve_cached_entity($guid)
Retrieve a entity from the cache.
Definition: entities.php:134
$object
Definition: upgrade.php:12
_elgg_river_test($hook, $type, $value)
Register river unit tests private.
Definition: river.php:741
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:1238
update_entity_last_action($guid, $posted=null)
Update the last_action column in the entities table for $guid.
Definition: entities.php:1917
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:438
$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:72
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:1464
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Register a callback as a plugin hook handler.
Definition: elgglib.php:853
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
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:692
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 ElggEntity and optionally for type and subtype.
Definition: entities.php:1886
$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
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 ElggRiverItem.
Definition: river.php:534
$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:2134
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
Definition: entities.php:777
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:925
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:73
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:299
$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:669
_elgg_river_enable($event, $type, $entity)
Enable river entries that reference a re-enabled entity as subject/object/target. ...
Definition: river.php:783
$posted
Definition: comment.php:61
$guids
_elgg_river_disable($event, $type, $entity)
Disable river entries that reference a disabled entity as subject/object/target.
Definition: river.php:756
get_data($query, $callback="")
Retrieve rows from the database.
Definition: database.php:50
$count
Definition: tools.php:19
elgg_get_river(array $options=array())
Get river items.
Definition: river.php:286
elgg_admin_gatekeeper()
Used at the top of a page to mark it as admin only.
Definition: pagehandler.php:83
$subtypes
elgg_delete_river(array $options=array())
Delete river items.
Definition: river.php:168
$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:18
_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
$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:343
_elgg_river_page_handler($page)
Page handler for activity.
Definition: river.php:713
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
$options
Main activity stream list page.
Definition: river.php:6
$type
Definition: river.php:9
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:557
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:604