Elgg  Version master
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->normalizeAccessOptions($options);
44  $options = $this->normalizeTypeSubtypeOptions($options);
45  $options = $this->normalizeRelationshipOptions($options);
46  $options = $this->normalizeAnnotationOptions($options);
47  $options = $this->normalizeMetadataOptions($options);
48  $options = $this->normalizeMetadataSearchOptions($options);
49  $options = $this->normalizeQueryClauses($options);
50  $options = $this->normalizeJoinClauses($options);
51  $options = $this->normalizeOrderByClauses($options);
52 
53  return $options;
54  }
55 
61  protected function getDefaults(): array {
62  return [
63  'types' => null,
64  'subtypes' => null,
65  'type_subtype_pairs' => null,
66  'guids' => null,
67  'owner_guids' => null,
68  'container_guids' => null,
69  'access_ids' => null,
70 
71  'created_after' => null,
72  'created_before' => null,
73  'updated_after' => null,
74  'updated_before' => null,
75  'last_action_after' => null,
76  'last_action_before' => null,
77 
78  'sort_by' => [],
79  'order_by' => null,
80  'count' => false,
81  'limit' => elgg_get_config('default_limit'),
82  'offset' => 0,
83 
84  'selects' => [],
85  'wheres' => [],
86  'joins' => [],
87  'having' => null,
88  'group_by' => null,
89 
90  'metadata_name_value_pairs' => null,
91  'metadata_name_value_pairs_operator' => 'AND',
92  'metadata_case_sensitive' => true,
93  'metadata_ids' => null,
94  'metadata_created_after' => null,
95  'metadata_created_before' => null,
96  'metadata_calculation' => null,
97 
98  'search_name_value_pairs' => null,
99 
100  'annotation_names' => null,
101  'annotation_values' => null,
102  'annotation_name_value_pairs' => null,
103  'annotation_name_value_pairs_operator' => 'AND',
104  'annotation_case_sensitive' => true,
105  'annotation_ids' => null,
106  'annotation_created_after' => null,
107  'annotation_created_before' => null,
108  'annotation_owner_guids' => null,
109  'annotation_calculation' => null,
110 
111  'relationship_pairs' => [],
112 
113  'relationship' => null,
114  'relationship_guid' => null,
115  'inverse_relationship' => false,
116  'relationship_join_on' => 'guid',
117  'relationship_created_after' => null,
118  'relationship_created_before' => null,
119 
120  'preload_owners' => false,
121  'preload_containers' => false,
122  'callback' => null,
123  'distinct' => true,
124 
125  'batch' => false,
126  'batch_inc_offset' => true,
127  'batch_size' => 25,
128  ];
129  }
130 
138  protected function normalizeAccessOptions(array $options = []): array {
139  return $this->normalizePluralOptions($options, ['access_id']);
140  }
141 
150  protected function normalizeTypeSubtypeOptions(array $options = []): array {
151  $options = $this->normalizePluralOptions($options, [
152  'type',
153  'subtype',
154  ]);
155 
156  if (isset($options['type_subtype_pairs'])) {
157  $options['type_subtype_pairs'] = (array) $options['type_subtype_pairs'];
158  } else if (isset($options['types'])) {
159  $options['type_subtype_pairs'] = [];
160  if ($options['types']) {
161  foreach ((array) $options['types'] as $type) {
162  $options['type_subtype_pairs'][$type] = isset($options['subtypes']) ? (array) $options['subtypes'] : null;
163  }
164  }
165  } else if (isset($options['subtypes'])) {
166  throw new InvalidArgumentException('If filtering for entity subtypes it is required to provide one or more entity types.');
167  }
168 
169  if (isset($options['type_subtype_pairs']) && is_array($options['type_subtype_pairs'])) {
170  foreach ($options['type_subtype_pairs'] as $type => $subtypes) {
171  if (!in_array($type, Config::ENTITY_TYPES)) {
172  elgg_log("'$type' is not a valid entity type", \Psr\Log\LogLevel::WARNING);
173  }
174 
175  if (!empty($subtypes) && !is_array($subtypes)) {
176  $options['type_subtype_pairs'][$type] = [$subtypes];
177  }
178  }
179  }
180 
181  unset($options['types']);
182  unset($options['subtypes']);
183 
184  return $options;
185  }
186 
194  protected function normalizeMetadataOptions(array $options = []): array {
195  $options = $this->normalizePluralOptions($options, [
196  'metadata_id',
197  'metadata_name',
198  'metadata_value',
199  'metadata_name_value_pair',
200  ]);
201 
202  $options = $this->normalizePairedOptions('metadata', $options);
203 
204  $props = [
205  'metadata_ids',
206  'metadata_created_after',
207  'metadata_created_before',
208  ];
209 
210  foreach ($props as $prop) {
211  if (isset($options[$prop]) && empty($options['metadata_name_value_pairs'])) {
212  $options['metadata_name_value_pairs'][] = [
213  $prop => $options[$prop]
214  ];
215  }
216  }
217 
218  foreach ($options['metadata_name_value_pairs'] as $key => $pair) {
219  if ($pair instanceof Clause) {
220  continue;
221  }
222 
223  foreach ($props as $prop) {
224  if (!isset($pair[$prop])) {
225  $options['metadata_name_value_pairs'][$key][$prop] = elgg_extract($prop, $options);
226  }
227  }
228 
229  $options['metadata_name_value_pairs'][$key]['entity_guids'] = $options['guids'];
230  }
231 
232  $options['metadata_name_value_pairs'] = $this->removeKeyPrefix('metadata_', $options['metadata_name_value_pairs']);
233 
234  foreach ($options['metadata_name_value_pairs'] as $key => $pair) {
235  if ($pair instanceof WhereClause) {
236  continue;
237  }
238 
239  $class = MetadataWhereClause::class;
240  if (isset($pair['name']) && in_array($pair['name'], \ElggEntity::PRIMARY_ATTR_NAMES)) {
241  $class = AttributeWhereClause::class;
242  }
243 
244  $pair = $this->normalizePluralOptions($pair, ['name', 'value']);
245 
246  $options['metadata_name_value_pairs'][$key] = $class::factory($pair);
247  }
248 
249  return $options;
250  }
251 
260  protected function normalizeMetadataSearchOptions(array $options = []): array {
261  $options = $this->normalizePluralOptions($options, ['search_name_value_pair']);
262 
263  $options = $this->normalizePairedOptions('search', $options);
264 
265  foreach ($options['search_name_value_pairs'] as $key => $pair) {
266  if ($pair instanceof Clause) {
267  continue;
268  }
269 
270  $options['search_name_value_pairs'][$key]['entity_guids'] = $options['guids'];
271  }
272 
273  $options['search_name_value_pairs'] = $this->removeKeyPrefix('metadata_', $options['search_name_value_pairs']);
274 
275  foreach ($options['search_name_value_pairs'] as $key => $pair) {
276  if ($pair instanceof WhereClause) {
277  continue;
278  }
279 
280  $class = MetadataWhereClause::class;
281  if (isset($pair['name']) && in_array($pair['name'], \ElggEntity::PRIMARY_ATTR_NAMES)) {
282  $class = AttributeWhereClause::class;
283  }
284 
285  $pair = $this->normalizePluralOptions($pair, ['name', 'value']);
286 
287  $options['search_name_value_pairs'][$key] = $class::factory($pair);
288  }
289 
290  return $options;
291  }
292 
300  protected function normalizeAnnotationOptions(array $options = []): array {
301  $options = $this->normalizePluralOptions($options, [
302  'annotation_id',
303  'annotation_name',
304  'annotation_value',
305  'annotation_name_value_pair',
306  ]);
307 
308  $options = $this->normalizePairedOptions('annotation', $options);
309 
310  $props = [
311  'annotation_ids',
312  'annotation_owner_guids',
313  'annotation_created_after',
314  'annotation_created_before',
315  'annotation_sort_by_calculation',
316  ];
317 
318  foreach ($props as $prop) {
319  if (isset($options[$prop]) && empty($options['annotation_name_value_pairs'])) {
320  $options['annotation_name_value_pairs'][] = [
321  $prop => $options[$prop]
322  ];
323  }
324  }
325 
326  foreach ($options['annotation_name_value_pairs'] as $key => $pair) {
327  if ($pair instanceof WhereClause) {
328  continue;
329  }
330 
331  foreach ($props as $prop) {
332  if (!isset($pair[$prop])) {
333  $options['annotation_name_value_pairs'][$key][$prop] = elgg_extract($prop, $options);
334  }
335  }
336 
337  $options['annotation_name_value_pairs'][$key]['entity_guids'] = $options['guids'];
338  }
339 
340  $options['annotation_name_value_pairs'] = $this->removeKeyPrefix('annotation_', $options['annotation_name_value_pairs']);
341 
342  foreach ($options['annotation_name_value_pairs'] as $key => $pair) {
343  if ($pair instanceof WhereClause) {
344  continue;
345  }
346 
347  $pair = $this->normalizePluralOptions($pair, ['name', 'value']);
348 
349  if (!empty($pair['sort_by_calculation']) && empty($options['order_by'])) {
350  $pair['sort_by_direction'] = 'desc';
351  }
352 
353  $options['annotation_name_value_pairs'][$key] = AnnotationWhereClause::factory($pair);
354  }
355 
356  return $options;
357  }
358 
367  protected function normalizePairedOptions(string $type = 'metadata', array $options = []): array {
368  if (!is_array($options["{$type}_name_value_pairs"])) {
369  $options["{$type}_name_value_pairs"] = [];
370  }
371 
372  $case_sensitive_default = elgg_extract("{$type}_case_sensitive", $options, true);
373 
382  if (isset($options["{$type}_name_value_pairs"]['name'])) {
383  $options["{$type}_name_value_pairs"][] = [
384  'name' => $options["{$type}_name_value_pairs"]['name'],
385  'value' => elgg_extract('value', $options["{$type}_name_value_pairs"]),
386  'comparison' => elgg_extract('operand', $options["{$type}_name_value_pairs"], '='),
387  'case_sensitive' => elgg_extract('case_sensitive', $options["{$type}_name_value_pairs"], $case_sensitive_default)
388  ];
389 
390  unset($options["{$type}_name_value_pairs"]['name']);
391  unset($options["{$type}_name_value_pairs"]['value']);
392  unset($options["{$type}_name_value_pairs"]['operand']);
393  unset($options["{$type}_name_value_pairs"]['case_sensitive']);
394  }
395 
407  foreach ($options["{$type}_name_value_pairs"] as $index => $pair) {
408  if (is_array($pair)) {
409  $keys = array_keys($pair);
410  if (count($keys) === 1 && is_string($keys[0]) && $keys[0] !== 'name' && $keys[0] !== 'value') {
411  $options["{$type}_name_value_pairs"][$index] = [
412  'name' => $keys[0],
413  'value' => $pair[$keys[0]],
414  'comparison' => '=',
415  ];
416  }
417  }
418  }
419 
427  foreach ($options["{$type}_name_value_pairs"] as $index => $values) {
428  if ($values instanceof Clause) {
429  continue;
430  }
431 
432  if (is_array($values)) {
433  if (isset($values['name']) || isset($values['value'])) {
434  continue;
435  }
436  }
437 
438  $options["{$type}_name_value_pairs"][$index] = [
439  'name' => $index,
440  'value' => $values,
441  'comparison' => '=',
442  ];
443  }
444 
445  if (isset($options["{$type}_names"]) || isset($options["{$type}_values"])) {
446  $options["{$type}_name_value_pairs"][] = [
447  'name' => isset($options["{$type}_names"]) ? (array) $options["{$type}_names"] : null,
448  'value' => isset($options["{$type}_values"]) ? (array) $options["{$type}_values"] : null,
449  'comparison' => '=',
450  ];
451  }
452 
453  foreach ($options["{$type}_name_value_pairs"] as $key => $value) {
454  if ($value instanceof Clause) {
455  continue;
456  }
457 
458  if (!isset($value['case_sensitive'])) {
459  $value['case_sensitive'] = $case_sensitive_default;
460  }
461 
462  if (isset($value['type'])) {
463  $value['value_type'] = $value['type'];
464  unset($value['type']);
465  }
466 
467  if (!isset($value['value_type'])) {
468  if (isset($value['value']) && is_bool($value['value'])) {
469  $value['value'] = (int) $value['value'];
470  }
471 
472  if (isset($value['value']) && is_int($value['value'])) {
473  $value['value_type'] = ELGG_VALUE_INTEGER;
474  } else {
475  $value['value_type'] = ELGG_VALUE_STRING;
476  }
477  }
478 
479  if (!isset($value['comparison']) && isset($value['operand'])) {
480  $value['comparison'] = $value['operand'];
481  unset($value['operand']);
482  }
483 
484  $options["{$type}_name_value_pairs"][$key] = $value;
485  }
486 
487  unset($options["{$type}_names"]);
488  unset($options["{$type}_values"]);
489  unset($options["{$type}_case_sensitive"]);
490 
491  return $options;
492  }
493 
501  protected function normalizeRelationshipOptions(array $options = []): array {
502  $defaults = [
503  'relationship_ids' => null,
504  'relationship' => null,
505  'relationship_guid' => null,
506  'inverse_relationship' => false,
507  'relationship_join_on' => 'guid',
508  'relationship_created_after' => null,
509  'relationship_created_before' => null,
510  ];
511 
512  $simple_pair = [];
513  foreach (array_keys($defaults) as $prop) {
514  if (isset($options[$prop])) {
515  $simple_pair[$prop] = $options[$prop];
516  }
517 
518  unset($options[$prop]);
519  }
520 
521  $options['relationship_pairs'] = (array) $options['relationship_pairs'];
522  $options['relationship_pairs'][] = $simple_pair;
523 
524  foreach ($options['relationship_pairs'] as $index => $relationship_pair) {
525  if ($relationship_pair instanceof WhereClause) {
526  continue;
527  }
528 
529  $options['relationship_pairs'][$index] = array_merge($defaults, $relationship_pair);
530  }
531 
532  $options['relationship_pairs'] = $this->removeKeyPrefix('relationship_', $options['relationship_pairs']);
533 
534  foreach ($options['relationship_pairs'] as $key => $pair) {
535  if ($pair instanceof WhereClause) {
536  continue;
537  }
538 
539  if (!$pair['relationship'] && !$pair['guid'] && !$pair['ids']) {
540  unset($options['relationship_pairs'][$key]);
541  continue;
542  }
543 
544  $options['relationship_pairs'][$key] = RelationshipWhereClause::factory([
545  'ids' => $pair['ids'],
546  'names' => $pair['relationship'],
547  'join_on' => $pair['join_on'],
548  'inverse' => $pair['inverse_relationship'],
549  'created_after' => $pair['created_after'],
550  'created_before' => $pair['created_before'],
551  'guid_two' => $pair['inverse_relationship'] ? $pair['guid'] : null,
552  'guid_one' => !$pair['inverse_relationship'] ? $pair['guid'] : null,
553  ]);
554  }
555 
556  return $options;
557  }
558 
566  protected function normalizeGuidOptions(array $options = []): array {
567  $options = $this->normalizePluralOptions($options, [
568  'guid',
569  'owner_guid',
570  'container_guid',
571  'annotation_owner_guid',
572  ]);
573 
574  $names = [
575  'guids',
576  'owner_guids',
577  'container_guids',
578  'annotation_owner_guids',
579  'relationship_guid',
580  ];
581 
582  foreach ($names as $name) {
583  if (!isset($options[$name])) {
584  continue;
585  }
586 
587  if (!is_array($options[$name])) {
589  }
590 
591  foreach ($options[$name] as $key => $value) {
592  if ($value === false || $value === '') {
593  unset($options[$name][$key]);
594  }
595  }
596  }
597 
598  return $options;
599  }
600 
609  protected function removeKeyPrefix(string $prefix, array $array = []): array {
610  foreach ($array as $key => $value) {
611  $new_key = $key;
612  if (str_starts_with($key, $prefix)) {
613  $new_key = substr($key, strlen($prefix));
614  }
615 
616  if (!isset($array[$new_key])) {
617  $array[$new_key] = $value;
618  }
619 
620  if ($new_key !== $key) {
621  unset($array[$key]);
622  }
623 
624  if (is_array($array[$new_key])) {
625  $array[$new_key] = $this->removeKeyPrefix($prefix, $array[$new_key]);
626  }
627  }
628 
629  return $array;
630  }
631 
639  protected function normalizeJoinClauses(array $options = []): array {
640  $options = $this->normalizePluralOptions($options, ['join']);
641 
642  if (empty($options['joins'])) {
643  $options['joins'] = [];
644  return $options;
645  }
646 
647  if (!is_array($options['joins'])) {
648  $options['joins'] = [$options['joins']];
649  }
650 
651  foreach ($options['joins'] as $key => $join) {
652  if (empty($join)) {
653  unset($options['joins'][$key]);
654  continue;
655  }
656 
657  if ($join instanceof JoinClause) {
658  continue;
659  }
660 
661  if (is_string($join)) {
662  preg_match('/((LEFT|INNER|RIGHT)\s+)?JOIN\s+(.*?)\s+((as\s+)?(.*?)\s+)ON\s+(.*)$/im', $join, $parts);
663 
664  $type = !empty($parts[2]) ? strtolower($parts[2]) : 'inner';
665  $table = $parts[3];
666  $alias = $parts[6];
667  $condition = preg_replace('/\r|\n/', '', $parts[7]);
668 
669  $dbprefix = elgg_get_config('dbprefix');
670  if (!elgg_is_empty($dbprefix) && str_starts_with($table, $dbprefix)) {
671  $table = substr($table, strlen($dbprefix));
672  }
673 
674  $clause = new JoinClause($table, $alias, $condition, $type);
675  $options['joins'][$key] = $clause;
676  }
677  }
678 
679  return $options;
680  }
681 
689  protected function normalizeOrderByClauses(array $options = []): array {
690  $orders = $options['order_by'];
691  $options['order_by'] = [];
692 
693  if (!empty($orders)) {
694  if (is_string($orders)) {
695  $orders = explode(',', $orders);
696  } elseif (!is_array($orders)) {
697  $orders = [$orders];
698  }
699 
700  foreach ($orders as $order) {
701  if ($order instanceof OrderByClause) {
702  $options['order_by'][] = $order;
703  continue;
704  }
705 
706  $order = trim($order);
707  $parts = [];
708  if (preg_match('/(.*)(?=\s+(asc|desc))/i', $order, $parts)) {
709  $column = $parts[1];
710  $direction = $parts[2];
711  } else {
712  $column = $order;
713  $direction = 'ASC';
714  }
715 
716  $options['order_by'][] = new OrderByClause($column, $direction);
717  }
718  }
719 
720  $sort_by = $options['sort_by'];
721  if (!is_array($sort_by)) {
722  return $options;
723  }
724 
725  if (isset($sort_by['property'])) {
726  // single array variant, convert to an array of sort_by specs
727  $options['sort_by'] = [$sort_by];
728  }
729 
730  foreach ($options['sort_by'] as $sort_spec) {
731  $clause = new EntitySortByClause();
732  $clause->property = elgg_extract('property', $sort_spec);
733  $clause->property_type = elgg_extract('property_type', $sort_spec);
734  $clause->join_type = elgg_extract('join_type', $sort_spec, 'inner');
735  $clause->direction = elgg_extract('direction', $sort_spec);
736  $clause->signed = elgg_extract('signed', $sort_spec);
737  $clause->inverse_relationship = elgg_extract('inverse_relationship', $sort_spec);
738  $clause->relationship_guid = elgg_extract('relationship_guid', $sort_spec);
739 
740  $options['order_by'][] = $clause;
741  }
742 
743  return $options;
744  }
745 
755  protected function normalizeQueryClauses(array $options = []): array {
756  $options = $this->normalizePluralOptions($options, ['select', 'where']);
757 
758  $clauses = [
759  'group_by' => GroupByClause::class,
760  'having' => HavingClause::class,
761  'selects' => SelectClause::class,
762  'wheres' => WhereClause::class,
763  ];
764 
765  foreach ($clauses as $clause_key => $class_name) {
766  if (empty($options[$clause_key])) {
767  $options[$clause_key] = [];
768  continue;
769  }
770 
771  if (!is_array($options[$clause_key])) {
772  $options[$clause_key] = [$options[$clause_key]];
773  }
774 
775  foreach ($options[$clause_key] as $index => $expr) {
776  if ($expr instanceof $class_name) {
777  continue;
778  }
779 
780  if (empty($expr)) {
781  unset($options[$clause_key][$index]);
782  continue;
783  }
784 
785  $options[$clause_key][$index] = new $class_name($expr);
786  }
787  }
788 
789  return $options;
790  }
791 
804  public static function normalizePluralOptions(array $options, array $singulars): array {
805  foreach ($singulars as $singular) {
806  $plural = $singular . 's';
807 
808  if (array_key_exists($singular, $options)) {
809  if ($options[$singular] === ELGG_ENTITIES_ANY_VALUE) {
810  $options[$plural] = $options[$singular];
811  } else {
812  // Test for array refs #2641
813  if (!is_array($options[$singular])) {
814  $options[$plural] = [$options[$singular]];
815  } else {
816  $options[$plural] = $options[$singular];
817  }
818  }
819  }
820 
821  unset($options[$singular]);
822  }
823 
824  return $options;
825  }
826 }
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_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
Definition: elgglib.php:84
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:236
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