Elgg  Version 6.3
LegacyQueryOptionsAdapter.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Elgg\Config;
19 
25 trait LegacyQueryOptionsAdapter {
26 
34  public function normalizeOptions(array $options = []): array {
35 
36  if (!isset($options['__original_options'])) {
37  $options['__original_options'] = $options;
38  }
39 
40  $options = array_merge($this->getDefaults(), $options);
41 
42  $options = $this->normalizeGuidOptions($options);
43  $options = $this->normalizeTimeOptions($options);
44  $options = $this->normalizeAccessOptions($options);
45  $options = $this->normalizeTypeSubtypeOptions($options);
46  $options = $this->normalizeRelationshipOptions($options);
47  $options = $this->normalizeAnnotationOptions($options);
48  $options = $this->normalizeMetadataOptions($options);
49  $options = $this->normalizeMetadataSearchOptions($options);
50  $options = $this->normalizeQueryClauses($options);
51  $options = $this->normalizeJoinClauses($options);
52  $options = $this->normalizeOrderByClauses($options);
53 
54  return $options;
55  }
56 
62  protected function getDefaults(): array {
63  return [
64  'types' => null,
65  'subtypes' => null,
66  'type_subtype_pairs' => null,
67  'guids' => null,
68  'owner_guids' => null,
69  'container_guids' => null,
70  'access_ids' => null,
71 
72  'created_after' => null,
73  'created_before' => null,
74  'updated_after' => null,
75  'updated_before' => null,
76  'last_action_after' => null,
77  'last_action_before' => null,
78 
79  'sort_by' => [],
80  'order_by' => null,
81  'count' => false,
82  'limit' => elgg_get_config('default_limit'),
83  'offset' => 0,
84 
85  'selects' => [],
86  'wheres' => [],
87  'joins' => [],
88  'having' => null,
89  'group_by' => null,
90 
91  'metadata_name_value_pairs' => null,
92  'metadata_name_value_pairs_operator' => 'AND',
93  'metadata_case_sensitive' => true,
94  'metadata_ids' => null,
95  'metadata_created_after' => null,
96  'metadata_created_before' => null,
97  'metadata_calculation' => null,
98 
99  'search_name_value_pairs' => null,
100 
101  'annotation_names' => null,
102  'annotation_values' => null,
103  'annotation_name_value_pairs' => null,
104  'annotation_name_value_pairs_operator' => 'AND',
105  'annotation_case_sensitive' => true,
106  'annotation_ids' => null,
107  'annotation_created_after' => null,
108  'annotation_created_before' => null,
109  'annotation_owner_guids' => null,
110  'annotation_calculation' => null,
111 
112  'relationship_pairs' => [],
113 
114  'relationship' => null,
115  'relationship_guid' => null,
116  'inverse_relationship' => false,
117  'relationship_join_on' => 'guid',
118  'relationship_created_after' => null,
119  'relationship_created_before' => null,
120 
121  'preload_owners' => false,
122  'preload_containers' => false,
123  'callback' => null,
124  'distinct' => true,
125 
126  'batch' => false,
127  'batch_inc_offset' => true,
128  'batch_size' => 25,
129  ];
130  }
131 
139  protected function normalizeAccessOptions(array $options = []): array {
140  return $this->normalizePluralOptions($options, ['access_id']);
141  }
142 
151  protected function normalizeTypeSubtypeOptions(array $options = []): array {
152  $options = $this->normalizePluralOptions($options, [
153  'type',
154  'subtype',
155  ]);
156 
157  if (isset($options['type_subtype_pair'])) {
158  elgg_deprecated_notice("Using the singular option 'type_subtype_pair' is deprecated. Update your code to use the plural 'type_subtype_pairs' instead.", '6.3');
159  }
160 
161  // can't use helper function with type_subtype_pair because
162  // it's already an array...just need to merge it
163  if (isset($options['type_subtype_pair']) && isset($options['type_subtype_pairs'])) {
164  $options['type_subtype_pairs'] = array_merge((array) $options['type_subtype_pairs'], (array) $options['type_subtype_pair']);
165  } else if (isset($options['type_subtype_pair'])) {
166  $options['type_subtype_pairs'] = (array) $options['type_subtype_pair'];
167  } else if (isset($options['type_subtype_pairs'])) {
168  $options['type_subtype_pairs'] = (array) $options['type_subtype_pairs'];
169  } else if (isset($options['types'])) {
170  $options['type_subtype_pairs'] = [];
171  if ($options['types']) {
172  foreach ((array) $options['types'] as $type) {
173  $options['type_subtype_pairs'][$type] = isset($options['subtypes']) ? (array) $options['subtypes'] : null;
174  }
175  }
176  } else if (isset($options['subtypes'])) {
177  throw new InvalidArgumentException('If filtering for entity subtypes it is required to provide one or more entity types.');
178  }
179 
180  if (isset($options['type_subtype_pairs']) && is_array($options['type_subtype_pairs'])) {
181  foreach ($options['type_subtype_pairs'] as $type => $subtypes) {
182  if (!in_array($type, Config::ENTITY_TYPES)) {
183  elgg_log("'$type' is not a valid entity type", \Psr\Log\LogLevel::WARNING);
184  }
185 
186  if (!empty($subtypes) && !is_array($subtypes)) {
187  $options['type_subtype_pairs'][$type] = [$subtypes];
188  }
189  }
190  }
191 
192  unset($options['type_subtype_pair']);
193  unset($options['types']);
194  unset($options['subtypes']);
195 
196  return $options;
197  }
198 
206  protected function normalizeMetadataOptions(array $options = []): array {
207  $options = $this->normalizePluralOptions($options, [
208  'metadata_id',
209  'metadata_name',
210  'metadata_value',
211  'metadata_name_value_pair',
212  ]);
213 
214  $options = $this->normalizePairedOptions('metadata', $options);
215 
216  $props = [
217  'metadata_ids',
218  'metadata_created_after',
219  'metadata_created_before',
220  ];
221 
222  foreach ($props as $prop) {
223  if (isset($options[$prop]) && empty($options['metadata_name_value_pairs'])) {
224  $options['metadata_name_value_pairs'][] = [
225  $prop => $options[$prop]
226  ];
227  }
228  }
229 
230  foreach ($options['metadata_name_value_pairs'] as $key => $pair) {
231  if ($pair instanceof Clause) {
232  continue;
233  }
234 
235  foreach ($props as $prop) {
236  if (!isset($pair[$prop])) {
237  $options['metadata_name_value_pairs'][$key][$prop] = elgg_extract($prop, $options);
238  }
239  }
240 
241  $options['metadata_name_value_pairs'][$key]['entity_guids'] = $options['guids'];
242  }
243 
244  $options['metadata_name_value_pairs'] = $this->removeKeyPrefix('metadata_', $options['metadata_name_value_pairs']);
245 
246  foreach ($options['metadata_name_value_pairs'] as $key => $pair) {
247  if ($pair instanceof WhereClause) {
248  continue;
249  }
250 
251  $class = MetadataWhereClause::class;
252  if (isset($pair['name']) && in_array($pair['name'], \ElggEntity::PRIMARY_ATTR_NAMES)) {
253  $class = AttributeWhereClause::class;
254  }
255 
256  $pair = $this->normalizePluralOptions($pair, ['name', 'value']);
257 
258  $options['metadata_name_value_pairs'][$key] = $class::factory($pair);
259  }
260 
261  return $options;
262  }
263 
272  protected function normalizeMetadataSearchOptions(array $options = []): array {
273  $options = $this->normalizePluralOptions($options, ['search_name_value_pair']);
274 
275  $options = $this->normalizePairedOptions('search', $options);
276 
277  foreach ($options['search_name_value_pairs'] as $key => $pair) {
278  if ($pair instanceof Clause) {
279  continue;
280  }
281 
282  $options['search_name_value_pairs'][$key]['entity_guids'] = $options['guids'];
283  }
284 
285  $options['search_name_value_pairs'] = $this->removeKeyPrefix('metadata_', $options['search_name_value_pairs']);
286 
287  foreach ($options['search_name_value_pairs'] as $key => $pair) {
288  if ($pair instanceof WhereClause) {
289  continue;
290  }
291 
292  $class = MetadataWhereClause::class;
293  if (isset($pair['name']) && in_array($pair['name'], \ElggEntity::PRIMARY_ATTR_NAMES)) {
294  $class = AttributeWhereClause::class;
295  }
296 
297  $pair = $this->normalizePluralOptions($pair, ['name', 'value']);
298 
299  $options['search_name_value_pairs'][$key] = $class::factory($pair);
300  }
301 
302  return $options;
303  }
304 
312  protected function normalizeAnnotationOptions(array $options = []): array {
313  $options = $this->normalizePluralOptions($options, [
314  'annotation_id',
315  'annotation_name',
316  'annotation_value',
317  'annotation_name_value_pair',
318  ]);
319 
320  $options = $this->normalizePairedOptions('annotation', $options);
321 
322  $props = [
323  'annotation_ids',
324  'annotation_owner_guids',
325  'annotation_created_after',
326  'annotation_created_before',
327  'annotation_sort_by_calculation',
328  ];
329 
330  foreach ($props as $prop) {
331  if (isset($options[$prop]) && empty($options['annotation_name_value_pairs'])) {
332  $options['annotation_name_value_pairs'][] = [
333  $prop => $options[$prop]
334  ];
335  }
336  }
337 
338  foreach ($options['annotation_name_value_pairs'] as $key => $pair) {
339  if ($pair instanceof WhereClause) {
340  continue;
341  }
342 
343  foreach ($props as $prop) {
344  if (!isset($pair[$prop])) {
345  $options['annotation_name_value_pairs'][$key][$prop] = elgg_extract($prop, $options);
346  }
347  }
348 
349  $options['annotation_name_value_pairs'][$key]['entity_guids'] = $options['guids'];
350  }
351 
352  $options['annotation_name_value_pairs'] = $this->removeKeyPrefix('annotation_', $options['annotation_name_value_pairs']);
353 
354  foreach ($options['annotation_name_value_pairs'] as $key => $pair) {
355  if ($pair instanceof WhereClause) {
356  continue;
357  }
358 
359  $pair = $this->normalizePluralOptions($pair, ['name', 'value']);
360 
361  if (!empty($pair['sort_by_calculation']) && empty($options['order_by'])) {
362  $pair['sort_by_direction'] = 'desc';
363  }
364 
365  $options['annotation_name_value_pairs'][$key] = AnnotationWhereClause::factory($pair);
366  }
367 
368  return $options;
369  }
370 
379  protected function normalizePairedOptions(string $type = 'metadata', array $options = []): array {
380  if (!is_array($options["{$type}_name_value_pairs"])) {
381  $options["{$type}_name_value_pairs"] = [];
382  }
383 
384  $case_sensitive_default = elgg_extract("{$type}_case_sensitive", $options, true);
385 
394  if (isset($options["{$type}_name_value_pairs"]['name'])) {
395  $options["{$type}_name_value_pairs"][] = [
396  'name' => $options["{$type}_name_value_pairs"]['name'],
397  'value' => elgg_extract('value', $options["{$type}_name_value_pairs"]),
398  'comparison' => elgg_extract('operand', $options["{$type}_name_value_pairs"], '='),
399  'case_sensitive' => elgg_extract('case_sensitive', $options["{$type}_name_value_pairs"], $case_sensitive_default)
400  ];
401 
402  unset($options["{$type}_name_value_pairs"]['name']);
403  unset($options["{$type}_name_value_pairs"]['value']);
404  unset($options["{$type}_name_value_pairs"]['operand']);
405  unset($options["{$type}_name_value_pairs"]['case_sensitive']);
406  }
407 
419  foreach ($options["{$type}_name_value_pairs"] as $index => $pair) {
420  if (is_array($pair)) {
421  $keys = array_keys($pair);
422  if (count($keys) === 1 && is_string($keys[0]) && $keys[0] !== 'name' && $keys[0] !== 'value') {
423  $options["{$type}_name_value_pairs"][$index] = [
424  'name' => $keys[0],
425  'value' => $pair[$keys[0]],
426  'comparison' => '=',
427  ];
428  }
429  }
430  }
431 
439  foreach ($options["{$type}_name_value_pairs"] as $index => $values) {
440  if ($values instanceof Clause) {
441  continue;
442  }
443 
444  if (is_array($values)) {
445  if (isset($values['name']) || isset($values['value'])) {
446  continue;
447  }
448  }
449 
450  $options["{$type}_name_value_pairs"][$index] = [
451  'name' => $index,
452  'value' => $values,
453  'comparison' => '=',
454  ];
455  }
456 
457  if (isset($options["{$type}_names"]) || isset($options["{$type}_values"])) {
458  $options["{$type}_name_value_pairs"][] = [
459  'name' => isset($options["{$type}_names"]) ? (array) $options["{$type}_names"] : null,
460  'value' => isset($options["{$type}_values"]) ? (array) $options["{$type}_values"] : null,
461  'comparison' => '=',
462  ];
463  }
464 
465  foreach ($options["{$type}_name_value_pairs"] as $key => $value) {
466  if ($value instanceof Clause) {
467  continue;
468  }
469 
470  if (!isset($value['case_sensitive'])) {
471  $value['case_sensitive'] = $case_sensitive_default;
472  }
473 
474  if (isset($value['type'])) {
475  $value['value_type'] = $value['type'];
476  unset($value['type']);
477  }
478 
479  if (!isset($value['value_type'])) {
480  if (isset($value['value']) && is_bool($value['value'])) {
481  $value['value'] = (int) $value['value'];
482  }
483 
484  if (isset($value['value']) && is_int($value['value'])) {
485  $value['value_type'] = ELGG_VALUE_INTEGER;
486  } else {
487  $value['value_type'] = ELGG_VALUE_STRING;
488  }
489  }
490 
491  if (!isset($value['comparison']) && isset($value['operand'])) {
492  $value['comparison'] = $value['operand'];
493  unset($value['operand']);
494  }
495 
496  $options["{$type}_name_value_pairs"][$key] = $value;
497  }
498 
499  unset($options["{$type}_names"]);
500  unset($options["{$type}_values"]);
501  unset($options["{$type}_case_sensitive"]);
502 
503  return $options;
504  }
505 
513  protected function normalizeRelationshipOptions(array $options = []): array {
514  $defaults = [
515  'relationship_ids' => null,
516  'relationship' => null,
517  'relationship_guid' => null,
518  'inverse_relationship' => false,
519  'relationship_join_on' => 'guid',
520  'relationship_created_after' => null,
521  'relationship_created_before' => null,
522  ];
523 
524  $simple_pair = [];
525  foreach (array_keys($defaults) as $prop) {
526  if (isset($options[$prop])) {
527  $simple_pair[$prop] = $options[$prop];
528  }
529 
530  unset($options[$prop]);
531  }
532 
533  $options['relationship_pairs'] = (array) $options['relationship_pairs'];
534  $options['relationship_pairs'][] = $simple_pair;
535 
536  foreach ($options['relationship_pairs'] as $index => $relationship_pair) {
537  if ($relationship_pair instanceof WhereClause) {
538  continue;
539  }
540 
541  $options['relationship_pairs'][$index] = array_merge($defaults, $relationship_pair);
542  }
543 
544  $options['relationship_pairs'] = $this->removeKeyPrefix('relationship_', $options['relationship_pairs']);
545 
546  foreach ($options['relationship_pairs'] as $key => $pair) {
547  if ($pair instanceof WhereClause) {
548  continue;
549  }
550 
551  if (!$pair['relationship'] && !$pair['guid'] && !$pair['ids']) {
552  unset($options['relationship_pairs'][$key]);
553  continue;
554  }
555 
556  $options['relationship_pairs'][$key] = RelationshipWhereClause::factory([
557  'ids' => $pair['ids'],
558  'names' => $pair['relationship'],
559  'join_on' => $pair['join_on'],
560  'inverse' => $pair['inverse_relationship'],
561  'created_after' => $pair['created_after'],
562  'created_before' => $pair['created_before'],
563  'guid_two' => $pair['inverse_relationship'] ? $pair['guid'] : null,
564  'guid_one' => !$pair['inverse_relationship'] ? $pair['guid'] : null,
565  ]);
566  }
567 
568  return $options;
569  }
570 
578  protected function normalizeGuidOptions(array $options = []): array {
579  $options = $this->normalizePluralOptions($options, [
580  'guid',
581  'owner_guid',
582  'container_guid',
583  'annotation_owner_guid',
584  ]);
585 
586  $names = [
587  'guids',
588  'owner_guids',
589  'container_guids',
590  'annotation_owner_guids',
591  'relationship_guid',
592  ];
593 
594  foreach ($names as $name) {
595  if (!isset($options[$name])) {
596  continue;
597  }
598 
599  if (!is_array($options[$name])) {
601  }
602 
603  foreach ($options[$name] as $key => $value) {
604  if ($value === false || $value === '') {
605  unset($options[$name][$key]);
606  }
607  }
608  }
609 
610  return $options;
611  }
612 
620  protected function normalizeTimeOptions(array $options = []): array {
621  $props = [
622  'modified',
623  'created',
624  'updated',
625  'metadata_created',
626  'annotation_created',
627  'relationship_created',
628  'last_action',
629  'posted',
630  ];
631 
632  $bounds = ['time_lower', 'time_upper', 'after', 'before'];
633 
634  foreach ($props as $prop) {
635  foreach ($bounds as $bound) {
636  $prop_name = "{$prop}_{$bound}";
637  if (!isset($options[$prop_name])) {
638  // required to remove key from array of defaults
639  unset($options[$prop_name]);
640  continue;
641  }
642 
643  $new_prop_name = $prop_name;
644  $new_prop_name = str_replace('modified', 'updated', $new_prop_name);
645  $new_prop_name = str_replace('posted', 'created', $new_prop_name);
646  $new_prop_name = str_replace('time_lower', 'after', $new_prop_name);
647  $new_prop_name = str_replace('time_upper', 'before', $new_prop_name);
648 
649  if ($new_prop_name === $prop_name) {
650  // no changes
651  continue;
652  }
653 
654  if (!isset($options[$new_prop_name])) {
655  elgg_deprecated_notice("Using the option '{$prop_name}' is deprecated. Update your code to use '{$new_prop_name}' instead.", '6.3');
656  $options[$new_prop_name] = elgg_extract($prop_name, $options);
657  }
658 
659  // always remove unwanted prop name
660  unset($options[$prop_name]);
661  }
662  }
663 
664  return $options;
665  }
666 
675  protected function removeKeyPrefix(string $prefix, array $array = []): array {
676  foreach ($array as $key => $value) {
677  $new_key = $key;
678  if (str_starts_with($key, $prefix)) {
679  $new_key = substr($key, strlen($prefix));
680  }
681 
682  if (!isset($array[$new_key])) {
683  $array[$new_key] = $value;
684  }
685 
686  if ($new_key !== $key) {
687  unset($array[$key]);
688  }
689 
690  if (is_array($array[$new_key])) {
691  $array[$new_key] = $this->removeKeyPrefix($prefix, $array[$new_key]);
692  }
693  }
694 
695  return $array;
696  }
697 
705  protected function normalizeJoinClauses(array $options = []): array {
706  $options = $this->normalizePluralOptions($options, ['join']);
707 
708  if (empty($options['joins'])) {
709  $options['joins'] = [];
710  return $options;
711  }
712 
713  if (!is_array($options['joins'])) {
714  $options['joins'] = [$options['joins']];
715  }
716 
717  foreach ($options['joins'] as $key => $join) {
718  if (empty($join)) {
719  unset($options['joins'][$key]);
720  continue;
721  }
722 
723  if ($join instanceof JoinClause) {
724  continue;
725  }
726 
727  if (is_string($join)) {
728  preg_match('/((LEFT|INNER|RIGHT)\s+)?JOIN\s+(.*?)\s+((as\s+)?(.*?)\s+)ON\s+(.*)$/im', $join, $parts);
729 
730  $type = !empty($parts[2]) ? strtolower($parts[2]) : 'inner';
731  $table = $parts[3];
732  $alias = $parts[6];
733  $condition = preg_replace('/\r|\n/', '', $parts[7]);
734 
735  $dbprefix = elgg_get_config('dbprefix');
736  if (!elgg_is_empty($dbprefix) && str_starts_with($table, $dbprefix)) {
737  $table = substr($table, strlen($dbprefix));
738  }
739 
740  $clause = new JoinClause($table, $alias, $condition, $type);
741  $options['joins'][$key] = $clause;
742  }
743  }
744 
745  return $options;
746  }
747 
755  protected function normalizeOrderByClauses(array $options = []): array {
756  $orders = $options['order_by'];
757  $options['order_by'] = [];
758 
759  if (!empty($orders)) {
760  if (is_string($orders)) {
761  $orders = explode(',', $orders);
762  } elseif (!is_array($orders)) {
763  $orders = [$orders];
764  }
765 
766  foreach ($orders as $order) {
767  if ($order instanceof OrderByClause) {
768  $options['order_by'][] = $order;
769  continue;
770  }
771 
772  $order = trim($order);
773  $parts = [];
774  if (preg_match('/(.*)(?=\s+(asc|desc))/i', $order, $parts)) {
775  $column = $parts[1];
776  $direction = $parts[2];
777  } else {
778  $column = $order;
779  $direction = 'ASC';
780  }
781 
782  $options['order_by'][] = new OrderByClause($column, $direction);
783  }
784  }
785 
786  $sort_by = $options['sort_by'];
787  if (!is_array($sort_by)) {
788  return $options;
789  }
790 
791  if (isset($sort_by['property'])) {
792  // single array variant, convert to an array of sort_by specs
793  $options['sort_by'] = [$sort_by];
794  }
795 
796  foreach ($options['sort_by'] as $sort_spec) {
797  $clause = new EntitySortByClause();
798  $clause->property = elgg_extract('property', $sort_spec);
799  $clause->property_type = elgg_extract('property_type', $sort_spec);
800  $clause->join_type = elgg_extract('join_type', $sort_spec, 'inner');
801  $clause->direction = elgg_extract('direction', $sort_spec);
802  $clause->signed = elgg_extract('signed', $sort_spec);
803  $clause->inverse_relationship = elgg_extract('inverse_relationship', $sort_spec);
804  $clause->relationship_guid = elgg_extract('relationship_guid', $sort_spec);
805 
806  $options['order_by'][] = $clause;
807  }
808 
809  return $options;
810  }
811 
821  protected function normalizeQueryClauses(array $options = []): array {
822  $options = $this->normalizePluralOptions($options, ['select', 'where']);
823 
824  $clauses = [
825  'group_by' => GroupByClause::class,
826  'having' => HavingClause::class,
827  'selects' => SelectClause::class,
828  'wheres' => WhereClause::class,
829  ];
830 
831  foreach ($clauses as $clause_key => $class_name) {
832  if (empty($options[$clause_key])) {
833  $options[$clause_key] = [];
834  continue;
835  }
836 
837  if (!is_array($options[$clause_key])) {
838  $options[$clause_key] = [$options[$clause_key]];
839  }
840 
841  foreach ($options[$clause_key] as $index => $expr) {
842  if ($expr instanceof $class_name) {
843  continue;
844  }
845 
846  if (empty($expr)) {
847  unset($options[$clause_key][$index]);
848  continue;
849  }
850 
851  $options[$clause_key][$index] = new $class_name($expr);
852  }
853  }
854 
855  return $options;
856  }
857 
870  public static function normalizePluralOptions(array $options, array $singulars): array {
871  foreach ($singulars as $singular) {
872  $plural = $singular . 's';
873 
874  if (array_key_exists($singular, $options)) {
875  if ($options[$singular] === ELGG_ENTITIES_ANY_VALUE) {
876  $options[$plural] = $options[$singular];
877  } else {
878  // Test for array refs #2641
879  if (!is_array($options[$singular])) {
880  $options[$plural] = [$options[$singular]];
881  } else {
882  $options[$plural] = $options[$singular];
883  }
884  }
885  }
886 
887  unset($options[$singular]);
888  }
889 
890  return $options;
891  }
892 }
if(! $user||! $user->canDelete()) $name
Definition: delete.php:22
$type
Definition: delete.php:21
$column
Definition: add.php:10
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin'], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
Definition: actions.php:73
$class
Definition: summary.php:44
foreach( $paths as $path)
Definition: autoloader.php:12
const PRIMARY_ATTR_NAMES
Definition: ElggEntity.php:61
const ENTITY_TYPES
Definition: Config.php:269
Builds queries for matching annotations against their properties.
static factory(array $attributes)
Build a new AnnotationWhereClause.
Builds queries for matching entities by their attributes.
Interface that allows resolving statements and/or extending query builder.
Definition: Clause.php:14
Extends QueryBuilder with clauses necessary to sort entity lists by entity properties.
Extends QueryBuilder with GROUP BY statements.
Extends QueryBuilder with HAVING clauses.
Extends QueryBuilder with JOIN clauses.
Definition: JoinClause.php:11
Builds clauses for filtering entities by properties in metadata table.
Extends QueryBuilder with ORDER BY clauses.
Builds clauses for filtering entities by their properties in entity_relationships table.
static factory(array $attributes)
Build a new RelationshipWhereClause.
Extends QueryBuilder with SELECT clauses.
Builds a clause from closure or composite expression.
Definition: WhereClause.php:11
Exception thrown if an argument is not of the expected type.
$subtypes
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
const ELGG_ENTITIES_ANY_VALUE
Constant to request the value of a parameter be ignored in elgg_get_*() functions.
Definition: constants.php:21
const ELGG_VALUE_STRING
Definition: constants.php:112
const ELGG_VALUE_INTEGER
Value types.
Definition: constants.php:111
if($who_can_change_language==='nobody') elseif($who_can_change_language==='admin_only' &&!elgg_is_admin_logged_in()) $options
Definition: language.php:20
$table
Definition: database.php:52
$index
Definition: gallery.php:40
if($item instanceof \ElggEntity) elseif($item instanceof \ElggRiverItem) elseif($item instanceof \ElggRelationship) elseif(is_callable([ $item, 'getType']))
Definition: item.php:48
elgg_deprecated_notice(string $msg, string $dep_version)
Log a notice about deprecated use of a function, view, etc.
Definition: elgglib.php:101
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
Definition: elgglib.php:88
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:240
elgg_is_empty($value)
Check if a value isn't empty, but allow 0 and '0'.
Definition: input.php:176
$defaults
Generic entity header upload helper.
Definition: header.php:6
$value
Definition: generic.php:51
if($container instanceof ElggGroup && $container->guid !=elgg_get_page_owner_guid()) $key
Definition: summary.php:44
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.
Definition: robots.php:10
$keys
Definition: access.php:31