1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
|
<?php
/**
* @return str
* @deprecated 1.8 Use elgg_list_entities_from_access_id()
*/
function list_entities_from_access_id($access_id, $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = true, $pagination = true) {
elgg_deprecated_notice("All list_entities* functions were deprecated in 1.8. Use elgg_list_entities* instead.", 1.8);
echo elgg_list_entities_from_access_id(array('access_id' => $access_id,
'types' => $entity_type, 'subtypes' => $entity_subtype, 'owner_guids' => $owner_guid,
'limit' => $limit, 'full_view' => $fullview, 'list_type_toggle' => $listtypetoggle,
'pagination' => $pagination,));
}
/**
* @deprecated 1.8 Use {@link elgg_register_action()} instead
*/
function register_action($action, $public = false, $filename = "", $admin_only = false) {
elgg_deprecated_notice("register_action() was deprecated by elgg_register_action()", 1.8);
if ($admin_only) {
$access = 'admin';
} elseif ($public) {
$access = 'public';
} else {
$access = 'logged_in';
}
return elgg_register_action($action, $filename, $access);
}
/**
* Register an admin page with the admin panel.
* This function extends the view "admin/main" with the provided view.
* This view should provide a description and either a control or a link to.
*
* Usage:
* - To add a control to the main admin panel then extend admin/main
* - To add a control to a new page create a page which renders a view admin/subpage
* (where subpage is your new page -
* nb. some pages already exist that you can extend), extend the main view to point to it,
* and add controls to your new view.
*
* At the moment this is essentially a wrapper around elgg_extend_view().
*
* @param string $new_admin_view The view associated with the control you're adding
* @param string $view The view to extend, by default this is 'admin/main'.
* @param int $priority Optional priority to govern the appearance in the list.
*
* @deprecated 1.8 Extend admin views manually
*
* @return void
*/
function extend_elgg_admin_page($new_admin_view, $view = 'admin/main', $priority = 500) {
elgg_deprecated_notice('extend_elgg_admin_page() does nothing. Extend admin views manually.', 1.8);
}
/**
* Get entities ordered by a mathematical calculation
*
* @deprecated 1.8 Use elgg_get_entities_from_annotation_calculation()
*
* @param string $sum What sort of calculation to perform
* @param string $entity_type Type of Entity
* @param string $entity_subtype Subtype of Entity
* @param string $name Name of annotation
* @param string $mdname Metadata name
* @param string $mdvalue Metadata value
* @param int $owner_guid GUID of owner of annotation
* @param int $limit Limit of results
* @param int $offset Offset of results
* @param string $orderdir Order of results
* @param bool $count Return count or entities
*
* @return mixed
*/
function get_entities_from_annotations_calculate_x($sum = "sum", $entity_type = "", $entity_subtype = "", $name = "", $mdname = '', $mdvalue = '', $owner_guid = 0, $limit = 10, $offset = 0, $orderdir = 'desc', $count = false) {
$msg = 'get_entities_from_annotations_calculate_x() is deprecated by elgg_get_entities_from_annotation_calculation().';
elgg_deprecated_notice($msg, 1.8);
$options = array();
$options['calculation'] = $sum;
if ($entity_type) {
$options['types'] = $entity_type;
}
if ($entity_subtype) {
$options['subtypes'] = $entity_subtype;
}
$options['annotation_names'] = $name;
if ($mdname) {
$options['metadata_names'] = $mdname;
}
if ($mdvalue) {
$options['metadata_values'] = $mdvalue;
}
// original function rewrote this to container guid.
if ($owner_guid) {
if (is_array($owner_guid)) {
$options['container_guids'] = $owner_guid;
} else {
$options['container_guid'] = $owner_guid;
}
}
$options['limit'] = $limit;
$options['offset'] = $offset;
$options['order_by'] = "calculated $orderdir";
$options['count'] = $count;
return elgg_get_entities_from_annotation_calculation($options);
}
/**
* Returns entities ordered by the sum of an annotation
*
* @deprecated 1.8 Use elgg_get_entities_from_annotation_calculation()
*
* @param string $entity_type Type of Entity
* @param string $entity_subtype Subtype of Entity
* @param string $name Name of annotation
* @param string $mdname Metadata name
* @param string $mdvalue Metadata value
* @param int $owner_guid GUID of owner of annotation
* @param int $limit Limit of results
* @param int $offset Offset of results
* @param string $orderdir Order of results
* @param bool $count Return count or entities
*
* @return unknown
*/
function get_entities_from_annotation_count($entity_type = "", $entity_subtype = "", $name = "", $mdname = '', $mdvalue = '', $owner_guid = 0, $limit = 10, $offset = 0, $orderdir = 'desc', $count = false) {
$msg = 'get_entities_from_annotation_count() is deprecated by elgg_get_entities_from_annotation_calculation().';
elgg_deprecated_notice($msg, 1.8);
$options = array();
$options['calculation'] = 'sum';
if ($entity_type) {
$options['types'] = $entity_type;
}
if ($entity_subtype) {
$options['subtypes'] = $entity_subtype;
}
$options['annotation_names'] = $name;
if ($mdname) {
$options['metadata_names'] = $mdname;
}
if ($mdvalue) {
$options['metadata_values'] = $mdvalue;
}
if ($owner_guid) {
if (is_array($owner_guid)) {
$options['owner_guids'] = $owner_guid;
} else {
$options['owner_guid'] = $owner_guid;
}
}
$options['limit'] = $limit;
$options['offset'] = $offset;
$options['order_by'] = "calculated $orderdir";
$options['count'] = $count;
return elgg_get_entities_from_annotation_calculation($options);
}
/**
* Lists entities by the totals of a particular kind of annotation
*
* @deprecated 1.8 Use elgg_list_entities_from_annotation_calculation()
*
* @param string $entity_type Type of entity.
* @param string $entity_subtype Subtype of entity.
* @param string $name Name of annotation.
* @param int $limit Maximum number of results to return.
* @param int $owner_guid Owner.
* @param int $group_guid Group container. Currently only supported if entity_type is object
* @param boolean $asc Whether to list in ascending or descending order (default: desc)
* @param boolean $fullview Whether to display the entities in full
* @param boolean $listtypetoggle Can the 'gallery' view can be displayed (default: no)
* @param boolean $pagination Add pagination
* @param string $orderdir Order desc or asc
*
* @return string Formatted entity list
*/
function list_entities_from_annotation_count($entity_type = "", $entity_subtype = "", $name = "", $limit = 10, $owner_guid = 0, $group_guid = 0, $asc = false, $fullview = true, $listtypetoggle = false, $pagination = true, $orderdir = 'desc') {
$msg = 'list_entities_from_annotation_count() is deprecated by elgg_list_entities_from_annotation_calculation().';
elgg_deprecated_notice($msg, 1.8);
$options = array();
$options['calculation'] = 'sum';
if ($entity_type) {
$options['types'] = $entity_type;
}
if ($entity_subtype) {
$options['subtypes'] = $entity_subtype;
}
$options['annotation_names'] = $name;
if ($owner_guid) {
if (is_array($owner_guid)) {
$options['owner_guids'] = $owner_guid;
} else {
$options['owner_guid'] = $owner_guid;
}
}
$options['full_view'] = $fullview;
$options['list_type_toggle'] = $listtypetoggle;
$options['pagination'] = $pagination;
$options['limit'] = $limit;
$options['order_by'] = "calculated $orderdir";
return elgg_get_entities_from_annotation_calculation($options);
}
/**
* Adds an entry in $CONFIG[$register_name][$subregister_name].
*
* This is only used for the site-wide menu. See {@link add_menu()}.
*
* @param string $register_name The name of the top-level register
* @param string $subregister_name The name of the subregister
* @param mixed $subregister_value The value of the subregister
* @param array $children_array Optionally, an array of children
*
* @return true|false Depending on success
* @deprecated 1.8
*/
function add_to_register($register_name, $subregister_name, $subregister_value, $children_array = array()) {
elgg_deprecated_notice("add_to_register() has been deprecated", 1.8);
global $CONFIG;
if (empty($register_name) || empty($subregister_name)) {
return false;
}
if (!isset($CONFIG->registers)) {
$CONFIG->registers = array();
}
if (!isset($CONFIG->registers[$register_name])) {
$CONFIG->registers[$register_name] = array();
}
$subregister = new stdClass;
$subregister->name = $subregister_name;
$subregister->value = $subregister_value;
if (is_array($children_array)) {
$subregister->children = $children_array;
}
$CONFIG->registers[$register_name][$subregister_name] = $subregister;
return true;
}
/**
* Removes a register entry from $CONFIG[register_name][subregister_name]
*
* This is used to by {@link remove_menu()} to remove site-wide menu items.
*
* @param string $register_name The name of the top-level register
* @param string $subregister_name The name of the subregister
*
* @return true|false Depending on success
* @since 1.7.0
* @deprecated 1.8
*/
function remove_from_register($register_name, $subregister_name) {
elgg_deprecated_notice("remove_from_register() has been deprecated", 1.8);
global $CONFIG;
if (empty($register_name) || empty($subregister_name)) {
return false;
}
if (!isset($CONFIG->registers)) {
return false;
}
if (!isset($CONFIG->registers[$register_name])) {
return false;
}
if (isset($CONFIG->registers[$register_name][$subregister_name])) {
unset($CONFIG->registers[$register_name][$subregister_name]);
return true;
}
return false;
}
/**
* If it exists, returns a particular register as an array
*
* @param string $register_name The name of the register
*
* @return array|false Depending on success
* @deprecated 1.8
*/
function get_register($register_name) {
elgg_deprecated_notice("get_register() has been deprecated", 1.8);
global $CONFIG;
if (isset($CONFIG->registers[$register_name])) {
return $CONFIG->registers[$register_name];
}
return false;
}
/**
* Deprecated events core function. Code divided between elgg_register_event_handler()
* and trigger_elgg_event().
*
* @param string $event The type of event (eg 'init', 'update', 'delete')
* @param string $object_type The type of object (eg 'system', 'blog', 'user')
* @param string $function The name of the function that will handle the event
* @param int $priority Priority to call handler. Lower numbers called first (default 500)
* @param boolean $call Set to true to call the event rather than add to it (default false)
* @param mixed $object Optionally, the object the event is being performed on (eg a user)
*
* @return true|false Depending on success
* @deprecated 1.8 Use explicit register/trigger event functions
*/
function events($event = "", $object_type = "", $function = "", $priority = 500, $call = false, $object = null) {
elgg_deprecated_notice('events() has been deprecated.', 1.8);
// leaving this here just in case someone was directly calling this internal function
if (!$call) {
return elgg_register_event_handler($event, $object_type, $function, $priority);
} else {
return trigger_elgg_event($event, $object_type, $object);
}
}
/**
* @deprecated 1.8 Use elgg_register_event_handler() instead
*/
function register_elgg_event_handler($event, $object_type, $callback, $priority = 500) {
elgg_deprecated_notice("register_elgg_event_handler() was deprecated by elgg_register_event_handler()", 1.8);
return elgg_register_event_handler($event, $object_type, $callback, $priority);
}
/**
* @deprecated 1.8 Use elgg_unregister_event_handler instead
*/
function unregister_elgg_event_handler($event, $object_type, $callback) {
elgg_deprecated_notice('unregister_elgg_event_handler => elgg_unregister_event_handler', 1.8);
elgg_unregister_event_handler($event, $object_type, $callback);
}
/**
* @deprecated 1.8 Use elgg_trigger_event() instead
*/
function trigger_elgg_event($event, $object_type, $object = null) {
elgg_deprecated_notice('trigger_elgg_event() was deprecated by elgg_trigger_event()', 1.8);
return elgg_trigger_event($event, $object_type, $object);
}
/**
* @deprecated 1.8 Use elgg_register_plugin_hook_handler() instead
*/
function register_plugin_hook($hook, $type, $callback, $priority = 500) {
elgg_deprecated_notice("register_plugin_hook() was deprecated by elgg_register_plugin_hook_handler()", 1.8);
return elgg_register_plugin_hook_handler($hook, $type, $callback, $priority);
}
/**
* @deprecated 1.8 Use elgg_unregister_plugin_hook_handler() instead
*/
function unregister_plugin_hook($hook, $entity_type, $callback) {
elgg_deprecated_notice("unregister_plugin_hook() was deprecated by elgg_unregister_plugin_hook_handler()", 1.8);
elgg_unregister_plugin_hook_handler($hook, $entity_type, $callback);
}
/**
* @deprecated 1.8 Use elgg_trigger_plugin_hook() instead
*/
function trigger_plugin_hook($hook, $type, $params = null, $returnvalue = null) {
elgg_deprecated_notice("trigger_plugin_hook() was deprecated by elgg_trigger_plugin_hook()", 1.8);
return elgg_trigger_plugin_hook($hook, $type, $params, $returnvalue);
}
/**
* Checks if code is being called from a certain function.
*
* To use, call this function with the function name (and optional
* file location) that it has to be called from, it will either
* return true or false.
*
* e.g.
*
* function my_secure_function()
* {
* if (!call_gatekeeper("my_call_function"))
* return false;
*
* ... do secure stuff ...
* }
*
* function my_call_function()
* {
* // will work
* my_secure_function();
* }
*
* function bad_function()
* {
* // Will not work
* my_secure_function();
* }
*
* @param mixed $function The function that this function must have in its call stack,
* to test against a method pass an array containing a class and
* method name.
* @param string $file Optional file that the function must reside in.
*
* @return bool
*
* @deprecated 1.8 A neat but pointless function
*/
function call_gatekeeper($function, $file = "") {
elgg_deprecated_notice("call_gatekeeper() is neat but pointless", 1.8);
// Sanity check
if (!$function) {
return false;
}
// Check against call stack to see if this is being called from the correct location
$callstack = debug_backtrace();
$stack_element = false;
foreach ($callstack as $call) {
if (is_array($function)) {
if ((strcmp($call['class'], $function[0]) == 0) && (strcmp($call['function'], $function[1]) == 0)) {
$stack_element = $call;
}
} else {
if (strcmp($call['function'], $function) == 0) {
$stack_element = $call;
}
}
}
if (!$stack_element) {
return false;
}
// If file then check that this it is being called from this function
if ($file) {
$mirror = null;
if (is_array($function)) {
$mirror = new ReflectionMethod($function[0], $function[1]);
} else {
$mirror = new ReflectionFunction($function);
}
if ((!$mirror) || (strcmp($file, $mirror->getFileName()) != 0)) {
return false;
}
}
return true;
}
/**
* This function checks to see if it is being called at somepoint by a function defined somewhere
* on a given path (optionally including subdirectories).
*
* This function is similar to call_gatekeeper() but returns true if it is being called
* by a method or function which has been defined on a given path or by a specified file.
*
* @param string $path The full path and filename that this function must have
* in its call stack If a partial path is given and
* $include_subdirs is true, then the function will return
* true if called by any function in or below the specified path.
* @param bool $include_subdirs Are subdirectories of the path ok, or must you specify an
* absolute path and filename.
* @param bool $strict_mode If true then the calling method or function must be directly
* called by something on $path, if false the whole call stack is
* searched.
*
* @return void
*
* @deprecated 1.8 A neat but pointless function
*/
function callpath_gatekeeper($path, $include_subdirs = true, $strict_mode = false) {
elgg_deprecated_notice("callpath_gatekeeper() is neat but pointless", 1.8);
global $CONFIG;
$path = sanitise_string($path);
if ($path) {
$callstack = debug_backtrace();
foreach ($callstack as $call) {
$call['file'] = str_replace("\\", "/", $call['file']);
if ($include_subdirs) {
if (strpos($call['file'], $path) === 0) {
if ($strict_mode) {
$callstack[1]['file'] = str_replace("\\", "/", $callstack[1]['file']);
if ($callstack[1] === $call) {
return true;
}
} else {
return true;
}
}
} else {
if (strcmp($path, $call['file']) == 0) {
if ($strict_mode) {
if ($callstack[1] === $call) {
return true;
}
} else {
return true;
}
}
}
}
return false;
}
if (isset($CONFIG->debug)) {
system_message("Gatekeeper'd function called from {$callstack[1]['file']}:" . "{$callstack[1]['line']}\n\nStack trace:\n\n" . print_r($callstack, true));
}
return false;
}
/**
* Returns SQL where clause for owner and containers.
*
* @deprecated 1.8 Use elgg_get_guid_based_where_sql();
*
* @param string $table Entity table prefix as defined in SELECT...FROM entities $table
* @param NULL|array $owner_guids Owner GUIDs
*
* @return FALSE|str
* @since 1.7.0
* @access private
*/
function elgg_get_entity_owner_where_sql($table, $owner_guids) {
elgg_deprecated_notice('elgg_get_entity_owner_where_sql() is deprecated by elgg_get_guid_based_where_sql().', 1.8);
return elgg_get_guid_based_where_sql("{$table}.owner_guid", $owner_guids);
}
/**
* Returns SQL where clause for containers.
*
* @deprecated 1.8 Use elgg_get_guid_based_where_sql();
*
* @param string $table Entity table prefix as defined in
* SELECT...FROM entities $table
* @param NULL|array $container_guids Array of container guids
*
* @return FALSE|string
* @since 1.7.0
* @access private
*/
function elgg_get_entity_container_where_sql($table, $container_guids) {
elgg_deprecated_notice('elgg_get_entity_container_where_sql() is deprecated by elgg_get_guid_based_where_sql().', 1.8);
return elgg_get_guid_based_where_sql("{$table}.container_guid", $container_guids);
}
/**
* Returns SQL where clause for site entities
*
* @deprecated 1.8 Use elgg_get_guid_based_where_sql()
*
* @param string $table Entity table prefix as defined in SELECT...FROM entities $table
* @param NULL|array $site_guids Array of site guids
*
* @return FALSE|string
* @since 1.7.0
* @access private
*/
function elgg_get_entity_site_where_sql($table, $site_guids) {
elgg_deprecated_notice('elgg_get_entity_site_where_sql() is deprecated by elgg_get_guid_based_where_sql().', 1.8);
return elgg_get_guid_based_where_sql("{$table}.site_guid", $site_guids);
}
/**
* Return an array of objects in a given container.
*
* @see get_entities()
*
* @param int $group_guid The container (defaults to current page owner)
* @param string $subtype The subtype
* @param int $owner_guid Owner
* @param int $site_guid The site
* @param string $order_by Order
* @param int $limit Limit on number of elements to return, by default 10.
* @param int $offset Where to start, by default 0.
* @param bool $count Whether to return the entities or a count of them.
*
* @return array|false
* @deprecated 1.8 Use elgg_get_entities() instead
*/
function get_objects_in_group($group_guid, $subtype = "", $owner_guid = 0, $site_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = FALSE) {
elgg_deprecated_notice("get_objects_in_group was deprected in 1.8. Use elgg_get_entities() instead", 1.8);
global $CONFIG;
if ($subtype === FALSE || $subtype === null || $subtype === 0) {
return FALSE;
}
if ($order_by == "") {
$order_by = "e.time_created desc";
}
$order_by = sanitise_string($order_by);
$limit = (int)$limit;
$offset = (int)$offset;
$site_guid = (int)$site_guid;
if ($site_guid == 0) {
$site_guid = $CONFIG->site_guid;
}
$container_guid = (int)$group_guid;
if ($container_guid == 0) {
$container_guid = elgg_get_page_owner_guid();
}
$where = array();
$where[] = "e.type='object'";
if (!empty($subtype)) {
if (!$subtype = get_subtype_id('object', $subtype)) {
return FALSE;
}
$where[] = "e.subtype=$subtype";
}
if ($owner_guid != "") {
if (!is_array($owner_guid)) {
$owner_guid = (int)$owner_guid;
$where[] = "e.container_guid = '$owner_guid'";
} else if (sizeof($owner_guid) > 0) {
// Cast every element to the owner_guid array to int
$owner_guid = array_map("sanitise_int", $owner_guid);
$owner_guid = implode(",", $owner_guid);
$where[] = "e.container_guid in ({$owner_guid})";
}
}
if ($site_guid > 0) {
$where[] = "e.site_guid = {$site_guid}";
}
if ($container_guid > 0) {
$where[] = "e.container_guid = {$container_guid}";
}
if (!$count) {
$query = "SELECT * from {$CONFIG->dbprefix}entities e" . " join {$CONFIG->dbprefix}objects_entity o on e.guid=o.guid where ";
} else {
$query = "SELECT count(e.guid) as total from {$CONFIG->dbprefix}entities e" . " join {$CONFIG->dbprefix}objects_entity o on e.guid=o.guid where ";
}
foreach ($where as $w) {
$query .= " $w and ";
}
// Add access controls
$query .= get_access_sql_suffix('e');
if (!$count) {
$query .= " order by $order_by";
// Add order and limit
if ($limit) {
$query .= " limit $offset, $limit";
}
$dt = get_data($query, "entity_row_to_elggstar");
return $dt;
} else {
$total = get_data_row($query);
return $total->total;
}
}
/**
* Lists entities that belong to a group.
*
* @param string $subtype The arbitrary subtype of the entity
* @param int $owner_guid The GUID of the owning user
* @param int $container_guid The GUID of the containing group
* @param int $limit The number of entities to display per page (default: 10)
* @param bool $fullview Whether or not to display the full view (default: true)
* @param bool $listtypetoggle Whether or not to allow gallery view (default: true)
* @param bool $pagination Whether to display pagination (default: true)
*
* @return string List of parsed entities
*
* @see elgg_list_entities()
* @deprecated 1.8 Use elgg_list_entities() instead
*/
function list_entities_groups($subtype = "", $owner_guid = 0, $container_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = true, $pagination = true) {
elgg_deprecated_notice("list_entities_groups was deprecated in 1.8. Use elgg_list_entities() instead.", 1.8);
$offset = (int)get_input('offset');
$count = get_objects_in_group($container_guid, $subtype, $owner_guid, 0, "", $limit, $offset, true);
$entities = get_objects_in_group($container_guid, $subtype, $owner_guid, 0, "", $limit, $offset);
return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $listtypetoggle, $pagination);
}
/**
* Get all the entities from metadata from a group.
*
* @param int $group_guid The ID of the group.
* @param mixed $meta_name Metadata name
* @param mixed $meta_value Metadata value
* @param string $entity_type The type of entity to look for, eg 'site' or 'object'
* @param string $entity_subtype The subtype of the entity.
* @param int $owner_guid Owner guid
* @param int $limit Limit
* @param int $offset Offset
* @param string $order_by Optional ordering.
* @param int $site_guid Site GUID. 0 for current, -1 for any
* @param bool $count Return count instead of entities
*
* @return array|false
* @deprecated 1.8 Use elgg_get_entities_from_metadata()
*/
function get_entities_from_metadata_groups($group_guid, $meta_name, $meta_value = "", $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $count = false) {
elgg_deprecated_notice("get_entities_from_metadata_groups was deprecated in 1.8.", 1.8);
global $CONFIG;
$meta_n = get_metastring_id($meta_name);
$meta_v = get_metastring_id($meta_value);
$entity_type = sanitise_string($entity_type);
$entity_subtype = get_subtype_id($entity_type, $entity_subtype);
$limit = (int)$limit;
$offset = (int)$offset;
if ($order_by == "") {
$order_by = "e.time_created desc";
}
$order_by = sanitise_string($order_by);
$site_guid = (int)$site_guid;
if (is_array($owner_guid)) {
foreach ($owner_guid as $key => $guid) {
$owner_guid[$key] = (int)$guid;
}
} else {
$owner_guid = (int)$owner_guid;
}
if ($site_guid == 0) {
$site_guid = $CONFIG->site_guid;
}
$container_guid = (int)$group_guid;
if ($container_guid == 0) {
$container_guid = elgg_get_page_owner_guid();
}
$where = array();
if ($entity_type != "") {
$where[] = "e.type='$entity_type'";
}
if ($entity_subtype) {
$where[] = "e.subtype=$entity_subtype";
}
if ($meta_name != "") {
$where[] = "m.name_id='$meta_n'";
}
if ($meta_value != "") {
$where[] = "m.value_id='$meta_v'";
}
if ($site_guid > 0) {
$where[] = "e.site_guid = {$site_guid}";
}
if ($container_guid > 0) {
$where[] = "e.container_guid = {$container_guid}";
}
if (is_array($owner_guid)) {
$where[] = "e.container_guid in (" . implode(",", $owner_guid) . ")";
} else if ($owner_guid > 0) {
$where[] = "e.container_guid = {$owner_guid}";
}
if (!$count) {
$query = "SELECT distinct e.* ";
} else {
$query = "SELECT count(e.guid) as total ";
}
$query .= "from {$CONFIG->dbprefix}entities e" . " JOIN {$CONFIG->dbprefix}metadata m on e.guid = m.entity_guid " . " JOIN {$CONFIG->dbprefix}objects_entity o on e.guid = o.guid where";
foreach ($where as $w) {
$query .= " $w and ";
}
// Add access controls
$query .= get_access_sql_suffix("e");
if (!$count) {
$query .= " order by $order_by limit $offset, $limit"; // Add order and limit
return get_data($query, "entity_row_to_elggstar");
} else {
if ($row = get_data_row($query)) {
return $row->total;
}
}
return false;
}
/**
* As get_entities_from_metadata_groups() but with multiple entities.
*
* @param int $group_guid The ID of the group.
* @param array $meta_array Array of 'name' => 'value' pairs
* @param string $entity_type The type of entity to look for, eg 'site' or 'object'
* @param string $entity_subtype The subtype of the entity.
* @param int $owner_guid Owner GUID
* @param int $limit Limit
* @param int $offset Offset
* @param string $order_by Optional ordering.
* @param int $site_guid Site GUID. 0 for current, -1 for any
* @param bool $count Return count of entities instead of entities
*
* @return int|array List of ElggEntities, or the total number if count is set to false
* @deprecated 1.8 Use elgg_get_entities_from_metadata()
*/
function get_entities_from_metadata_groups_multi($group_guid, $meta_array, $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $count = false) {
elgg_deprecated_notice("get_entities_from_metadata_groups_multi was deprecated in 1.8.", 1.8);
global $CONFIG;
if (!is_array($meta_array) || sizeof($meta_array) == 0) {
return false;
}
$where = array();
$mindex = 1;
$join = "";
foreach ($meta_array as $meta_name => $meta_value) {
$meta_n = get_metastring_id($meta_name);
$meta_v = get_metastring_id($meta_value);
$join .= " JOIN {$CONFIG->dbprefix}metadata m{$mindex} on e.guid = m{$mindex}.entity_guid" . " JOIN {$CONFIG->dbprefix}objects_entity o on e.guid = o.guid ";
if ($meta_name != "") {
$where[] = "m{$mindex}.name_id='$meta_n'";
}
if ($meta_value != "") {
$where[] = "m{$mindex}.value_id='$meta_v'";
}
$mindex++;
}
$entity_type = sanitise_string($entity_type);
$entity_subtype = get_subtype_id($entity_type, $entity_subtype);
$limit = (int)$limit;
$offset = (int)$offset;
if ($order_by == "") {
$order_by = "e.time_created desc";
}
$order_by = sanitise_string($order_by);
$owner_guid = (int)$owner_guid;
$site_guid = (int)$site_guid;
if ($site_guid == 0) {
$site_guid = $CONFIG->site_guid;
}
//$access = get_access_list();
if ($entity_type != "") {
$where[] = "e.type = '{$entity_type}'";
}
if ($entity_subtype) {
$where[] = "e.subtype = {$entity_subtype}";
}
if ($site_guid > 0) {
$where[] = "e.site_guid = {$site_guid}";
}
if ($owner_guid > 0) {
$where[] = "e.owner_guid = {$owner_guid}";
}
if ($container_guid > 0) {
$where[] = "e.container_guid = {$container_guid}";
}
if ($count) {
$query = "SELECT count(e.guid) as total ";
} else {
$query = "SELECT distinct e.* ";
}
$query .= " from {$CONFIG->dbprefix}entities e {$join} where";
foreach ($where as $w) {
$query .= " $w and ";
}
$query .= get_access_sql_suffix("e"); // Add access controls
if (!$count) {
$query .= " order by $order_by limit $offset, $limit"; // Add order and limit
return get_data($query, "entity_row_to_elggstar");
} else {
if ($count = get_data_row($query)) {
return $count->total;
}
}
return false;
}
/**
* List items within a given geographic area.
*
* @param real $lat Latitude
* @param real $long Longitude
* @param real $radius The radius
* @param string $type The type of entity (eg "user", "object" etc)
* @param string $subtype The arbitrary subtype of the entity
* @param int $owner_guid The GUID of the owning user
* @param int $limit The number of entities to display per page (default: 10)
* @param bool $fullview Whether or not to display the full view (default: true)
* @param bool $listtypetoggle Whether or not to allow gallery view
* @param bool $navigation Display pagination? Default: true
*
* @return string A viewable list of entities
* @deprecated 1.8
*/
function list_entities_in_area($lat, $long, $radius, $type = "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = false, $navigation = true) {
elgg_deprecated_notice('list_entities_in_area() was deprecated. Use elgg_list_entities_from_location()', 1.8);
$options = array();
$options['latitude'] = $lat;
$options['longitude'] = $long;
$options['distance'] = $radius;
if ($type) {
$options['types'] = $type;
}
if ($subtype) {
$options['subtypes'] = $subtype;
}
if ($owner_guid) {
if (is_array($owner_guid)) {
$options['owner_guids'] = $owner_guid;
} else {
$options['owner_guid'] = $owner_guid;
}
}
$options['limit'] = $limit;
$options['full_view'] = $fullview;
$options['list_type_toggle'] = $listtypetoggle;
$options['pagination'] = $pagination;
return elgg_list_entities_from_location($options);
}
/**
* List entities in a given location
*
* @param string $location Location
* @param string $type The type of entity (eg "user", "object" etc)
* @param string $subtype The arbitrary subtype of the entity
* @param int $owner_guid The GUID of the owning user
* @param int $limit The number of entities to display per page (default: 10)
* @param bool $fullview Whether or not to display the full view (default: true)
* @param bool $listtypetoggle Whether or not to allow gallery view
* @param bool $navigation Display pagination? Default: true
*
* @return string A viewable list of entities
* @deprecated 1.8
*/
function list_entities_location($location, $type = "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = false, $navigation = true) {
elgg_deprecated_notice('list_entities_location() was deprecated. Use elgg_list_entities_from_metadata()', 1.8);
return list_entities_from_metadata('location', $location, $type, $subtype, $owner_guid, $limit, $fullview, $listtypetoggle, $navigation);
}
/**
* Return entities within a given geographic area.
*
* @param float $lat Latitude
* @param float $long Longitude
* @param float $radius The radius
* @param string $type The type of entity (eg "user", "object" etc)
* @param string $subtype The arbitrary subtype of the entity
* @param int $owner_guid The GUID of the owning user
* @param string $order_by The field to order by; by default, time_created desc
* @param int $limit The number of entities to return; 10 by default
* @param int $offset The indexing offset, 0 by default
* @param boolean $count Count entities
* @param int $site_guid Site GUID. 0 for current, -1 for any
* @param int|array $container_guid Container GUID
*
* @return array A list of entities.
* @deprecated 1.8
*/
function get_entities_in_area($lat, $long, $radius, $type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = NULL) {
elgg_deprecated_notice('get_entities_in_area() was deprecated by elgg_get_entities_from_location()!', 1.8);
$options = array();
$options['latitude'] = $lat;
$options['longitude'] = $long;
$options['distance'] = $radius;
// set container_guid to owner_guid to emulate old functionality
if ($owner_guid != "") {
if (is_null($container_guid)) {
$container_guid = $owner_guid;
}
}
if ($type) {
$options['types'] = $type;
}
if ($subtype) {
$options['subtypes'] = $subtype;
}
if ($owner_guid) {
if (is_array($owner_guid)) {
$options['owner_guids'] = $owner_guid;
} else {
$options['owner_guid'] = $owner_guid;
}
}
if ($container_guid) {
if (is_array($container_guid)) {
$options['container_guids'] = $container_guid;
} else {
$options['container_guid'] = $container_guid;
}
}
$options['limit'] = $limit;
if ($offset) {
$options['offset'] = $offset;
}
if ($order_by) {
$options['order_by'];
}
if ($site_guid) {
$options['site_guid'];
}
if ($count) {
$options['count'] = $count;
}
return elgg_get_entities_from_location($options);
}
/**
* Return a list of entities suitable for display based on the given search criteria.
*
* @see elgg_view_entity_list
*
* @deprecated 1.8 Use elgg_list_entities_from_metadata
*
* @param mixed $meta_name Metadata name to search on
* @param mixed $meta_value The value to match, optionally
* @param string $entity_type The type of entity to look for, eg 'site' or 'object'
* @param string $entity_subtype The subtype of the entity
* @param int $owner_guid Owner GUID
* @param int $limit Number of entities to display per page
* @param bool $fullview WDisplay the full view (default: true)
* @param bool $listtypetoggle Allow users to toggle to the gallery view. Default: true
* @param bool $pagination Display pagination? Default: true
* @param bool $case_sensitive Case sensitive metadata names?
*
* @return string
*
* @return string A list of entities suitable for display
*/
function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type = ELGG_ENTITIES_ANY_VALUE, $entity_subtype = ELGG_ENTITIES_ANY_VALUE, $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = true, $pagination = true, $case_sensitive = true) {
elgg_deprecated_notice('list_entities_from_metadata() was deprecated by elgg_list_entities_from_metadata()!', 1.8);
$offset = (int)get_input('offset');
$limit = (int)$limit;
$options = array('metadata_name' => $meta_name, 'metadata_value' => $meta_value,
'types' => $entity_type, 'subtypes' => $entity_subtype, 'owner_guid' => $owner_guid,
'limit' => $limit, 'offset' => $offset, 'count' => TRUE,
'metadata_case_sensitive' => $case_sensitive);
$count = elgg_get_entities_from_metadata($options);
$options['count'] = FALSE;
$entities = elgg_get_entities_from_metadata($options);
return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $listtypetoggle, $pagination);
}
/**
* Returns a viewable list of entities based on the given search criteria.
*
* @see elgg_view_entity_list
*
* @param array $meta_array Array of 'name' => 'value' pairs
* @param string $entity_type The type of entity to look for, eg 'site' or 'object'
* @param string $entity_subtype The subtype of the entity.
* @param int $owner_guid Owner GUID
* @param int $limit Limit
* @param bool $fullview WDisplay the full view (default: true)
* @param bool $listtypetoggle Allow users to toggle to the gallery view. Default: true
* @param bool $pagination Display pagination? Default: true
*
* @return string List of ElggEntities suitable for display
*
* @deprecated 1.8 Use elgg_list_entities_from_metadata() instead
*/
function list_entities_from_metadata_multi($meta_array, $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = true, $pagination = true) {
elgg_deprecated_notice(elgg_echo('deprecated:function', array(
'list_entities_from_metadata_multi', 'elgg_get_entities_from_metadata')), 1.8);
$offset = (int)get_input('offset');
$limit = (int)$limit;
$count = get_entities_from_metadata_multi($meta_array, $entity_type, $entity_subtype, $owner_guid, $limit, $offset, "", $site_guid, true);
$entities = get_entities_from_metadata_multi($meta_array, $entity_type, $entity_subtype, $owner_guid, $limit, $offset, "", $site_guid, false);
return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $listtypetoggle, $pagination);
}
/**
* Deprecated by elgg_register_menu_item(). Set $menu_name to 'page'.
*
* @see elgg_register_menu_item()
* @deprecated 1.8
*
* @param string $label The label
* @param string $link The link
* @param string $group The group to store item in
* @param boolean $onclick Add a confirmation when clicked?
* @param boolean $selected Is menu item selected
*
* @return bool
*/
function add_submenu_item($label, $link, $group = 'default', $onclick = false, $selected = NULL) {
elgg_deprecated_notice('add_submenu_item was deprecated by elgg_register_menu_item', 1.8);
// submenu items were added in the page setup hook usually by checking
// the context. We'll pass in the current context here, which will
// emulate that effect.
// if context == 'main' (default) it probably means they always wanted
// the menu item to show up everywhere.
$context = elgg_get_context();
if ($context == 'main') {
$context = 'all';
}
$item = array('name' => $label, 'title' => $label, 'url' => $link, 'context' => $context,
'section' => $group,);
if ($selected) {
$item['selected'] = true;
}
if ($onclick) {
$js = "onclick=\"javascript:return confirm('" . elgg_echo('deleteconfirm') . "')\"";
$item['vars'] = array('js' => $js);
}
return elgg_register_menu_item('page', $item);
}
/**
* Use elgg_view_menu(). Set $menu_name to 'owner_block'.
*
* @see elgg_view_menu()
* @deprecated 1.8
*
* @return string
*/
function get_submenu() {
elgg_deprecated_notice("get_submenu() has been deprecated by elgg_view_menu()", 1.8);
return elgg_view_menu('owner_block', array('entity' => $owner,
'class' => 'elgg-owner-block-menu',));
}
/**
* Adds an item to the site-wide menu.
*
* You can obtain the menu array by calling {@link get_register('menu')}
*
* @param string $menu_name The name of the menu item
* @param string $menu_url The URL of the page
* @param array $menu_children Optionally, an array of submenu items (not used)
* @param string $context (not used)
*
* @return true|false Depending on success
* @deprecated 1.8 use elgg_register_menu_item() for the menu 'site'
*/
function add_menu($menu_name, $menu_url, $menu_children = array(), $context = "") {
elgg_deprecated_notice('add_menu() deprecated by elgg_register_menu_item()', 1.8);
return elgg_register_menu_item('site', array('name' => $menu_name, 'title' => $menu_name,
'url' => $menu_url,));
}
/**
* Removes an item from the menu register
*
* @param string $menu_name The name of the menu item
*
* @return true|false Depending on success
* @deprecated 1.8
*/
function remove_menu($menu_name) {
elgg_deprecated_notice("remove_menu() deprecated by elgg_unregister_menu_item()", 1.8);
return elgg_unregister_menu_item('site', $menu_name);
}
/**
* When given a title, returns a version suitable for inclusion in a URL
*
* @param string $title The title
*
* @return string The optimised title
* @deprecated 1.8
*/
function friendly_title($title) {
elgg_deprecated_notice('friendly_title was deprecated by elgg_get_friendly_title', 1.8);
return elgg_get_friendly_title($title);
}
/**
* Displays a UNIX timestamp in a friendly way (eg "less than a minute ago")
*
* @param int $time A UNIX epoch timestamp
*
* @return string The friendly time
* @deprecated 1.8
*/
function friendly_time($time) {
elgg_deprecated_notice('friendly_time was deprecated by elgg_view_friendly_time', 1.8);
return elgg_view_friendly_time($time);
}
/**
* Filters a string into an array of significant words
*
* @deprecated 1.8
*
* @param string $string A string
*
* @return array
*/
function filter_string($string) {
elgg_deprecated_notice('filter_string() was deprecated!', 1.8);
// Convert it to lower and trim
$string = strtolower($string);
$string = trim($string);
// Remove links and email addresses
// match protocol://address/path/file.extension?some=variable&another=asf%
$string = preg_replace("/\s([a-zA-Z]+:\/\/[a-z][a-z0-9\_\.\-]*[a-z]{2,6}" . "[a-zA-Z0-9\/\*\-\?\&\%\=]*)([\s|\.|\,])/iu", " ", $string);
// match www.something.domain/path/file.extension?some=variable&another=asf%
$string = preg_replace("/\s(www\.[a-z][a-z0-9\_\.\-]*[a-z]{2,6}" . "[a-zA-Z0-9\/\*\-\?\&\%\=]*)([\s|\.|\,])/iu", " ", $string);
// match name@address
$string = preg_replace("/\s([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]" . "*\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})([\s|\.|\,])/iu", " ", $string);
// Sanitise the string; remove unwanted characters
$string = preg_replace('/\W/ui', ' ', $string);
// Explode it into an array
$terms = explode(' ', $string);
// Remove any blacklist terms
//$terms = array_filter($terms, 'remove_blacklist');
return $terms;
}
/**
* Returns true if the word in $input is considered significant
*
* @deprecated 1.8
*
* @param string $input A word
*
* @return true|false
*/
function remove_blacklist($input) {
elgg_deprecated_notice('remove_blacklist() was deprecated!', 1.8);
global $CONFIG;
if (!is_array($CONFIG->wordblacklist)) {
return $input;
}
if (strlen($input) < 3 || in_array($input, $CONFIG->wordblacklist)) {
return false;
}
return true;
}
/**
* Gets the guid of the entity that owns the current page.
*
* @deprecated 1.8 Use elgg_get_page_owner_guid()
*
* @return int The current page owner guid (0 if none).
*/
function page_owner() {
elgg_deprecated_notice('page_owner() was deprecated by elgg_get_page_owner_guid().', 1.8);
return elgg_get_page_owner_guid();
}
/**
* Gets the owner entity for the current page.
*
* @deprecated 1.8 Use elgg_get_page_owner()
* @return ElggEntity|false The current page owner or false if none.
*/
function page_owner_entity() {
elgg_deprecated_notice('page_owner_entity() was deprecated by elgg_get_page_owner_entity().', 1.8);
return elgg_get_page_owner_entity();
}
/**
* Registers a page owner handler function
*
* @param string $functionname The callback function
*
* @deprecated 1.8 Use the 'page_owner', 'system' plugin hook
* @return void
*/
function add_page_owner_handler($functionname) {
elgg_deprecated_notice("add_page_owner_handler() was deprecated by the plugin hook 'page_owner', 'system'.", 1.8);
}
/**
* Set a page owner entity
*
* @param int $entitytoset The GUID of the entity
*
* @deprecated 1.8 Use elgg_set_page_owner_guid()
* @return void
*/
function set_page_owner($entitytoset = -1) {
elgg_deprecated_notice('set_page_owner() was deprecated by elgg_set_page_owner_guid().', 1.8);
elgg_set_page_owner_guid($entitytoset);
}
/**
* Sets the functional context of a page
*
* @deprecated 1.8 Use elgg_set_context()
*
* @param string $context The context of the page
*
* @return mixed Either the context string, or false on failure
*/
function set_context($context) {
elgg_deprecated_notice('set_context() was deprecated by elgg_set_context().', 1.8);
elgg_set_context($context);
if (empty($context)) {
return false;
}
return $context;
}
/**
* Returns the functional context of a page
*
* @deprecated 1.8 Use elgg_get_context()
*
* @return string The context, or 'main' if no context has been provided
*/
function get_context() {
elgg_deprecated_notice('get_context() was deprecated by elgg_get_context().', 1.8);
return elgg_get_context();
// @todo - used to set context based on calling script
// $context = get_plugin_name(true)
}
/**
* Returns a list of plugins to load, in the order that they should be loaded.
*
* @deprecated 1.8
*
* @return array List of plugins
*/
function get_plugin_list() {
elgg_deprecated_notice('get_plugin_list() is deprecated by elgg_get_plugin_ids_in_dir() or elgg_get_plugins()', 1.8);
$plugins = elgg_get_plugins('any');
$list = array();
if ($plugins) {
foreach ($plugins as $i => $plugin) {
// in <=1.7 this returned indexed by multiples of 10.
// uh...sure...why not.
$index = ($i + 1) * 10;
$list[$index] = $plugin->getID();
}
}
return $list;
}
/**
* Regenerates the list of known plugins and saves it to the current site
*
* Important: You should regenerate simplecache and the viewpath cache after executing this function
* otherwise you may experience view display artifacts. Do this with the following code:
*
* elgg_view_regenerate_simplecache();
* elgg_filepath_cache_reset();
*
* @deprecated 1.8
*
* @param array $pluginorder Optionally, a list of existing plugins and their orders
*
* @return array The new list of plugins and their orders
*/
function regenerate_plugin_list($pluginorder = FALSE) {
$msg = 'regenerate_plugin_list() is (sorta) deprecated by elgg_generate_plugin_entities() and'
. ' elgg_set_plugin_priorities().';
elgg_deprecated_notice($msg, 1.8);
// they're probably trying to set it?
if ($pluginorder) {
if (elgg_generate_plugin_entities()) {
// sort the plugins by the index numerically since we used
// weird indexes in the old system.
ksort($pluginorder, SORT_NUMERIC);
return elgg_set_plugin_priorities($pluginorder);
}
return false;
} else {
// they're probably trying to regenerate from disk?
return elgg_generate_plugin_entities();
}
}
/**
* Get the name of the most recent plugin to be called in the
* call stack (or the plugin that owns the current page, if any).
*
* i.e., if the last plugin was in /mod/foobar/, get_plugin_name would return foo_bar.
*
* @deprecated 1.8
*
* @param boolean $mainfilename If set to true, this will instead determine the
* context from the main script filename called by
* the browser. Default = false.
*
* @return string|false Plugin name, or false if no plugin name was called
*/
function get_plugin_name($mainfilename = false) {
elgg_deprecated_notice('get_plugin_name() is deprecated by elgg_get_calling_plugin_id()', 1.8);
return elgg_get_calling_plugin_id($mainfilename);
}
/**
* Load and parse a plugin manifest from a plugin XML file.
*
* @example plugins/manifest.xml Example 1.8-style manifest file.
*
* @deprecated 1.8
*
* @param string $plugin Plugin name.
* @return array of values
*/
function load_plugin_manifest($plugin) {
elgg_deprecated_notice('load_plugin_manifest() is deprecated by ElggPlugin->getManifest()', 1.8);
$xml_file = elgg_get_plugins_path() . "$plugin/manifest.xml";
try {
$manifest = new ElggPluginManifest($xml_file, $plugin);
} catch(Exception $e) {
return false;
}
return $manifest->getManifest();
}
/**
* This function checks a plugin manifest 'elgg_version' value against the current install
* returning TRUE if the elgg_version is >= the current install's version.
*
* @deprecated 1.8
*
* @param string $manifest_elgg_version_string The build version (eg 2009010201).
* @return bool
*/
function check_plugin_compatibility($manifest_elgg_version_string) {
elgg_deprecated_notice('check_plugin_compatibility() is deprecated by ElggPlugin->canActivate()', 1.8);
$version = get_version();
if (strpos($manifest_elgg_version_string, '.') === false) {
// Using version
$req_version = (int)$manifest_elgg_version_string;
return ($version >= $req_version);
}
return false;
}
/**
* Shorthand function for finding the plugin settings.
*
* @deprecated 1.8
*
* @param string $plugin_id Optional plugin id, if not specified
* then it is detected from where you are calling.
*
* @return mixed
*/
function find_plugin_settings($plugin_id = null) {
elgg_deprecated_notice('find_plugin_setting() is deprecated by elgg_get_calling_plugin_entity() or elgg_get_plugin_from_id()', 1.8);
if ($plugin_id) {
return elgg_get_plugin_from_id($plugin_id);
} else {
return elgg_get_calling_plugin_entity();
}
}
/**
* Return an array of installed plugins.
*
* @deprecated 1.8
*
* @param string $status any|enabled|disabled
* @return array
*/
function get_installed_plugins($status = 'all') {
global $CONFIG;
elgg_deprecated_notice('get_installed_plugins() was deprecated by elgg_get_plugins()', 1.8);
$plugins = elgg_get_plugins($status);
if (!$plugins) {
return array();
}
$installed_plugins = array();
foreach ($plugins as $plugin) {
if (!$plugin->isValid()) {
continue;
}
$installed_plugins[$plugin->getID()] = array(
'active' => $plugin->isActive(),
'manifest' => $plugin->manifest->getManifest()
);
}
return $installed_plugins;
}
/**
* Enable a plugin for a site (default current site)
*
* Important: You should regenerate simplecache and the viewpath cache after executing this function
* otherwise you may experience view display artifacts. Do this with the following code:
*
* elgg_view_regenerate_simplecache();
* elgg_filepath_cache_reset();
*
* @deprecated 1.8
*
* @param string $plugin The plugin name.
* @param int $site_guid The site id, if not specified then this is detected.
*
* @return array
* @throws InvalidClassException
*/
function enable_plugin($plugin, $site_guid = null) {
elgg_deprecated_notice('enable_plugin() was deprecated by ElggPlugin->activate()', 1.8);
$plugin = sanitise_string($plugin);
$site_guid = (int) $site_guid;
if (!$site_guid) {
$site = get_config('site');
$site_guid = $site->guid;
}
try {
$plugin = new ElggPlugin($plugin);
} catch(Exception $e) {
return false;
}
if (!$plugin->canActivate($site_guid)) {
return false;
}
return $plugin->activate($site_guid);
}
/**
* Disable a plugin for a site (default current site)
*
* Important: You should regenerate simplecache and the viewpath cache after executing this function
* otherwise you may experience view display artifacts. Do this with the following code:
*
* elgg_view_regenerate_simplecache();
* elgg_filepath_cache_reset();
*
* @deprecated 1.8
*
* @param string $plugin The plugin name.
* @param int $site_guid The site id, if not specified then this is detected.
*
* @return bool
* @throws InvalidClassException
*/
function disable_plugin($plugin, $site_guid = 0) {
elgg_deprecated_notice('disable_plugin() was deprecated by ElggPlugin->deactivate()', 1.8);
$plugin = sanitise_string($plugin);
$site_guid = (int) $site_guid;
if (!$site_guid) {
$site = get_config('site');
$site_guid = $site->guid;
}
try {
$plugin = new ElggPlugin($plugin);
} catch(Exception $e) {
return false;
}
return $plugin->deactivate($site_guid);
}
/**
* Return whether a plugin is enabled or not.
*
* @deprecated 1.8
*
* @param string $plugin The plugin name.
* @param int $site_guid The site id, if not specified then this is detected.
*
* @return bool
*/
function is_plugin_enabled($plugin, $site_guid = 0) {
elgg_deprecated_notice('is_plugin_enabled() was deprecated by ElggPlugin->isActive()', 1.8);
$plugin = sanitise_string($plugin);
$site_guid = (int) $site_guid;
if (!$site_guid) {
$site = get_config('site');
$site_guid = $site->guid;
}
try {
$plugin = new ElggPlugin($plugin);
} catch(Exception $e) {
return false;
}
return $plugin->isActive($site_guid);
}
/**
* Get entities based on their private data.
*
* @param string $name The name of the setting
* @param string $value The value of the setting
* @param string $type The type of entity (eg "user", "object" etc)
* @param string $subtype The arbitrary subtype of the entity
* @param int $owner_guid The GUID of the owning user
* @param string $order_by The field to order by; by default, time_created desc
* @param int $limit The number of entities to return; 10 by default
* @param int $offset The indexing offset, 0 by default
* @param boolean $count Return a count of entities
* @param int $site_guid The site to get entities for. 0 for current, -1 for any
* @param mixed $container_guid The container(s) GUIDs
*
* @return array A list of entities.
* @deprecated 1.8
*/
function get_entities_from_private_setting($name = "", $value = "", $type = "", $subtype = "",
$owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0,
$container_guid = null) {
elgg_deprecated_notice('get_entities_from_private_setting() was deprecated by elgg_get_entities_from_private_setting()!', 1.8);
$options = array();
$options['private_setting_name'] = $name;
$options['private_setting_value'] = $value;
// set container_guid to owner_guid to emulate old functionality
if ($owner_guid != "") {
if (is_null($container_guid)) {
$container_guid = $owner_guid;
}
}
if ($type) {
$options['types'] = $type;
}
if ($subtype) {
$options['subtypes'] = $subtype;
}
if ($owner_guid) {
if (is_array($owner_guid)) {
$options['owner_guids'] = $owner_guid;
} else {
$options['owner_guid'] = $owner_guid;
}
}
if ($container_guid) {
if (is_array($container_guid)) {
$options['container_guids'] = $container_guid;
} else {
$options['container_guid'] = $container_guid;
}
}
$options['limit'] = $limit;
if ($offset) {
$options['offset'] = $offset;
}
if ($order_by) {
$options['order_by'];
}
if ($site_guid) {
$options['site_guid'];
}
if ($count) {
$options['count'] = $count;
}
return elgg_get_entities_from_private_settings($options);
}
/**
* Get entities based on their private data by multiple keys.
*
* @param string $name The name of the setting
* @param mixed $type Entity type
* @param string $subtype Entity subtype
* @param int $owner_guid The GUID of the owning user
* @param string $order_by The field to order by; by default, time_created desc
* @param int $limit The number of entities to return; 10 by default
* @param int $offset The indexing offset, 0 by default
* @param bool $count Count entities
* @param int $site_guid Site GUID. 0 for current, -1 for any.
* @param mixed $container_guid Container GUID
*
* @return array A list of entities.
* @deprecated 1.8
*/
function get_entities_from_private_setting_multi(array $name, $type = "", $subtype = "",
$owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false,
$site_guid = 0, $container_guid = null) {
elgg_deprecated_notice('get_entities_from_private_setting_multi() was deprecated by elgg_get_entities_from_private_setting()!', 1.8);
$options = array();
$pairs = array();
foreach ($name as $setting_name => $setting_value) {
$pairs[] = array('name' => $setting_name, 'value' => $setting_value);
}
$options['private_setting_name_value_pairs'] = $pairs;
// set container_guid to owner_guid to emulate old functionality
if ($owner_guid != "") {
if (is_null($container_guid)) {
$container_guid = $owner_guid;
}
}
if ($type) {
$options['types'] = $type;
}
if ($subtype) {
$options['subtypes'] = $subtype;
}
if ($owner_guid) {
if (is_array($owner_guid)) {
$options['owner_guids'] = $owner_guid;
} else {
$options['owner_guid'] = $owner_guid;
}
}
if ($container_guid) {
if (is_array($container_guid)) {
$options['container_guids'] = $container_guid;
} else {
$options['container_guid'] = $container_guid;
}
}
$options['limit'] = $limit;
if ($offset) {
$options['offset'] = $offset;
}
if ($order_by) {
$options['order_by'];
}
if ($site_guid) {
$options['site_guid'];
}
if ($count) {
$options['count'] = $count;
}
return elgg_get_entities_from_private_settings($options);
}
/**
* Returns a viewable list of entities by relationship
*
* @see elgg_view_entity_list
*
* @deprecated 1.8 Use elgg_list_entities_from_relationship()
*
* @param string $relationship The relationship eg "friends_of"
* @param int $relationship_guid The guid of the entity to use query
* @param bool $inverse_relationship Reverse the normal function of the query to instead say "give me all entities for whome $relationship_guid is a $relationship of"
* @param string $type The type of entity (eg 'object')
* @param string $subtype The entity subtype
* @param int $owner_guid The owner (default: all)
* @param int $limit The number of entities to display on a page
* @param true|false $fullview Whether or not to display the full view (default: true)
* @param true|false $viewtypetoggle Whether or not to allow gallery view
* @param true|false $pagination Whether to display pagination (default: true)
* @param bool $order_by SQL order by clause
* @return string The viewable list of entities
*/
function list_entities_from_relationship($relationship, $relationship_guid,
$inverse_relationship = false, $type = ELGG_ENTITIES_ANY_VALUE,
$subtype = ELGG_ENTITIES_ANY_VALUE, $owner_guid = 0, $limit = 10,
$fullview = true, $listtypetoggle = false, $pagination = true, $order_by = '') {
elgg_deprecated_notice("list_entities_from_relationship was deprecated by elgg_list_entities_from_relationship()!", 1.8);
return elgg_list_entities_from_relationship(array(
'relationship' => $relationship,
'relationship_guid' => $relationship_guid,
'inverse_relationship' => $inverse_relationship,
'types' => $type,
'subtypes' => $subtype,
'owner_guid' => $owner_guid,
'order_by' => $order_by,
'limit' => $limit,
'full_view' => $fullview,
'list_type_toggle' => $listtypetoggle,
'pagination' => $pagination,
));
}
/**
* Gets the number of entities by a the number of entities related to them in a particular way.
* This is a good way to get out the users with the most friends, or the groups with the
* most members.
*
* @deprecated 1.8 Use elgg_get_entities_from_relationship_count()
*
* @param string $relationship The relationship eg "friends_of"
* @param bool $inverse_relationship Inverse relationship owners
* @param string $type The type of entity (default: all)
* @param string $subtype The entity subtype (default: all)
* @param int $owner_guid The owner of the entities (default: none)
* @param int $limit Limit
* @param int $offset Offset
* @param bool $count Return a count instead of entities
* @param int $site_guid Site GUID
*
* @return array|int|false An array of entities, or the number of entities, or false on failure
*/
function get_entities_by_relationship_count($relationship, $inverse_relationship = true, $type = "",
$subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $count = false, $site_guid = 0) {
elgg_deprecated_notice('get_entities_by_relationship_count() is deprecated by elgg_get_entities_from_relationship_count()', 1.8);
$options = array();
$options['relationship'] = $relationship;
// this used to default to true, which is wrong.
// flip it for the new function
$options['inverse_relationship'] = !$inverse_relationship;
if ($type) {
$options['types'] = $type;
}
if ($subtype) {
$options['subtypes'] = $subtype;
}
if ($owner_guid) {
$options['owner_guid'] = $owner_guid;
}
$options['limit'] = $limit;
if ($offset) {
$options['offset'] = $offset;
}
if ($site_guid) {
$options['site_guid'];
}
if ($count) {
$options['count'] = $count;
}
return elgg_get_entities_from_relationship_count($options);
}
/**
* Displays a human-readable list of entities
*
* @deprecated 1.8
*
* @param string $relationship The relationship eg "friends_of"
* @param bool $inverse_relationship Inverse relationship owners
* @param string $type The type of entity (eg 'object')
* @param string $subtype The entity subtype
* @param int $owner_guid The owner (default: all)
* @param int $limit The number of entities to display on a page
* @param bool $fullview Whether or not to display the full view (default: true)
* @param bool $listtypetoggle Whether or not to allow gallery view
* @param bool $pagination Whether to display pagination (default: true)
*
* @return string The viewable list of entities
*/
function list_entities_by_relationship_count($relationship, $inverse_relationship = true,
$type = "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true,
$listtypetoggle = false, $pagination = true) {
elgg_deprecated_notice('list_entities_by_relationship_count() was deprecated by elgg_list_entities_from_relationship_count()', 1.8);
$options = array();
$options['relationship'] = $relationship;
// this used to default to true, which is wrong.
// flip it for the new function
$options['inverse_relationship'] = !$inverse_relationship;
if ($type) {
$options['types'] = $type;
}
if ($subtype) {
$options['subtypes'] = $subtype;
}
if ($owner_guid) {
$options['owner_guid'] = $owner_guid;
}
$options['limit'] = $limit;
$options['full_view'] = $fullview;
return elgg_list_entities_from_relationship_count($options);
}
/**
* Gets the number of entities by a the number of entities related to
* them in a particular way also constrained by metadata.
*
* @deprecated 1.8
*
* @param string $relationship The relationship eg "friends_of"
* @param int $relationship_guid The guid of the entity to use query
* @param bool $inverse_relationship Inverse relationship owner
* @param String $meta_name The metadata name
* @param String $meta_value The metadata value
* @param string $type The type of entity (default: all)
* @param string $subtype The entity subtype (default: all)
* @param int $owner_guid The owner of the entities (default: none)
* @param int $limit Limit
* @param int $offset Offset
* @param bool $count Return a count instead of entities
* @param int $site_guid Site GUID
*
* @return array|int|false An array of entities, or the number of entities, or false on failure
*/
function get_entities_from_relationships_and_meta($relationship, $relationship_guid,
$inverse_relationship = false, $meta_name = "", $meta_value = "", $type = "",
$subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $count = false, $site_guid = 0) {
elgg_deprecated_notice('get_entities_from_relationship_and_meta() was deprecated by elgg_get_entities_from_relationship()!', 1.7);
$options = array();
$options['relationship'] = $relationship;
$options['relationship_guid'] = $relationship_guid;
$options['inverse_relationship'] = $inverse_relationship;
if ($meta_value) {
$options['values'] = $meta_value;
}
if ($entity_type) {
$options['types'] = $entity_type;
}
if ($type) {
$options['types'] = $type;
}
if ($subtype) {
$options['subtypes'] = $subtype;
}
if ($owner_guid) {
$options['owner_guid'] = $owner_guid;
}
if ($limit) {
$options['limit'] = $limit;
}
if ($offset) {
$options['offset'] = $offset;
}
if ($order_by) {
$options['order_by'];
}
if ($site_guid) {
$options['site_guid'];
}
if ($count) {
$options['count'] = $count;
}
return elgg_get_entities_from_relationship($options);
}
/**
* Retrieves items from the river. All parameters are optional.
*
* @param int|array $subject_guid Acting entity to restrict to. Default: all
* @param int|array $object_guid Entity being acted on to restrict to. Default: all
* @param string $subject_relationship If set to a relationship type, this will use
* $subject_guid as the starting point and set the
* subjects to be all users this
* entity has this relationship with (eg 'friend').
* Default: blank
* @param string $type The type of entity to restrict to. Default: all
* @param string $subtype The subtype of entity to restrict to. Default: all
* @param string $action_type The type of river action to restrict to. Default: all
* @param int $limit The number of items to retrieve. Default: 20
* @param int $offset The page offset. Default: 0
* @param int $posted_min The minimum time period to look at. Default: none
* @param int $posted_max The maximum time period to look at. Default: none
*
* @return array|false Depending on success
* @deprecated 1.8
*/
function get_river_items($subject_guid = 0, $object_guid = 0, $subject_relationship = '',
$type = '', $subtype = '', $action_type = '', $limit = 20, $offset = 0, $posted_min = 0,
$posted_max = 0) {
elgg_deprecated_notice("get_river_items deprecated by elgg_get_river", 1.8);
$options = array();
if ($subject_guid) {
$options['subject_guid'] = $subject_guid;
}
if ($object_guid) {
$options['object_guid'] = $object_guid;
}
if ($subject_relationship) {
$options['relationship'] = $subject_relationship;
unset($options['subject_guid']);
$options['relationship_guid'] = $subject_guid;
}
if ($type) {
$options['type'] = $type;
}
if ($subtype) {
$options['subtype'] = $subtype;
}
if ($action_type) {
$options['action_type'] = $action_type;
}
$options['limit'] = $limit;
$options['offset'] = $offset;
if ($posted_min) {
$options['posted_time_lower'] = $posted_min;
}
if ($posted_max) {
$options['posted_time_upper'] = $posted_max;
}
return elgg_get_river($options);
}
/**
* Returns a human-readable version of the river.
*
* @param int|array $subject_guid Acting entity to restrict to. Default: all
* @param int|array $object_guid Entity being acted on to restrict to. Default: all
* @param string $subject_relationship If set to a relationship type, this will use
* $subject_guid as the starting point and set
* the subjects to be all users this entity has this
* relationship with (eg 'friend'). Default: blank
* @param string $type The type of entity to restrict to. Default: all
* @param string $subtype The subtype of entity to restrict to. Default: all
* @param string $action_type The type of river action to restrict to. Default: all
* @param int $limit The number of items to retrieve. Default: 20
* @param int $posted_min The minimum time period to look at. Default: none
* @param int $posted_max The maximum time period to look at. Default: none
* @param bool $pagination Show pagination?
*
* @return string Human-readable river.
* @deprecated 1.8
*/
function elgg_view_river_items($subject_guid = 0, $object_guid = 0, $subject_relationship = '',
$type = '', $subtype = '', $action_type = '', $limit = 20, $posted_min = 0,
$posted_max = 0, $pagination = true) {
elgg_deprecated_notice("elgg_view_river_items deprecated for elgg_list_river", 1.8);
$river_items = get_river_items($subject_guid, $object_guid, $subject_relationship,
$type, $subtype, $action_type, $limit + 1, $posted_min, $posted_max);
// Get input from outside world and sanitise it
$offset = (int) get_input('offset', 0);
// view them
$params = array(
'items' => $river_items,
'count' => count($river_items),
'offset' => $offset,
'limit' => $limit,
'pagination' => $pagination,
'list-class' => 'elgg-river-list',
);
return elgg_view('layout/objects/list', $params);
}
/**
* Construct and execute the query required for the activity stream.
*
* @deprecated 1.8
*/
function get_activity_stream_data($limit = 10, $offset = 0, $type = "", $subtype = "",
$owner_guid = "", $owner_relationship = "") {
elgg_deprecated_notice("get_activity_stream_data was deprecated", 1.8);
global $CONFIG;
$limit = (int)$limit;
$offset = (int)$offset;
if ($type) {
if (!is_array($type)) {
$type = array(sanitise_string($type));
} else {
foreach ($type as $k => $v) {
$type[$k] = sanitise_string($v);
}
}
}
if ($subtype) {
if (!is_array($subtype)) {
$subtype = array(sanitise_string($subtype));
} else {
foreach ($subtype as $k => $v) {
$subtype[$k] = sanitise_string($v);
}
}
}
if ($owner_guid) {
if (is_array($owner_guid)) {
foreach ($owner_guid as $k => $v) {
$owner_guid[$k] = (int)$v;
}
} else {
$owner_guid = array((int)$owner_guid);
}
}
$owner_relationship = sanitise_string($owner_relationship);
// Get a list of possible views
$activity_events = array();
$activity_views = array_merge(elgg_view_tree('activity', 'default'),
elgg_view_tree('river', 'default'));
$done = array();
foreach ($activity_views as $view) {
$fragments = explode('/', $view);
$tmp = explode('/', $view, 2);
$tmp = $tmp[1];
if ((isset($fragments[0])) && (($fragments[0] == 'river') || ($fragments[0] == 'activity'))
&& (!in_array($tmp, $done))) {
if (isset($fragments[1])) {
$f = array();
for ($n = 1; $n < count($fragments); $n++) {
$val = sanitise_string($fragments[$n]);
switch($n) {
case 1: $key = 'type'; break;
case 2: $key = 'subtype'; break;
case 3: $key = 'event'; break;
}
$f[$key] = $val;
}
// Filter result based on parameters
$add = true;
if ($type) {
if (!in_array($f['type'], $type)) {
$add = false;
}
}
if (($add) && ($subtype)) {
if (!in_array($f['subtype'], $subtype)) {
$add = false;
}
}
if (($add) && ($event)) {
if (!in_array($f['event'], $event)) {
$add = false;
}
}
if ($add) {
$activity_events[] = $f;
}
}
$done[] = $tmp;
}
}
$n = 0;
foreach ($activity_events as $details) {
// Get what we're talking about
if ($details['subtype'] == 'default') {
$details['subtype'] = '';
}
if (($details['type']) && ($details['event'])) {
if ($n > 0) {
$obj_query .= " or ";
}
$access = "";
if ($details['type'] != 'relationship') {
$access = " and " . get_access_sql_suffix('sl');
}
$obj_query .= "( sl.object_type='{$details['type']}'
AND sl.object_subtype='{$details['subtype']}'
AND sl.event='{$details['event']}' $access )";
$n++;
}
}
// User
if ((count($owner_guid)) && ($owner_guid[0] != 0)) {
$user = " and sl.performed_by_guid in (" . implode(',', $owner_guid) . ")";
if ($owner_relationship) {
$friendsarray = "";
if ($friends = elgg_get_entities_from_relationship(array(
'relationship' => $owner_relationship,
'relationship_guid' => $owner_guid[0],
'inverse_relationship' => FALSE,
'types' => 'user',
'subtypes' => $subtype,
'limit' => 9999))
) {
$friendsarray = array();
foreach ($friends as $friend) {
$friendsarray[] = $friend->getGUID();
}
$user = " and sl.performed_by_guid in (" . implode(',', $friendsarray) . ")";
}
}
}
$query = "SELECT sl.* FROM {$CONFIG->dbprefix}system_log sl
WHERE 1 $user AND ($obj_query)
ORDER BY sl.time_created desc limit $offset, $limit";
return get_data($query);
}
/**
* Perform standard authentication with a given username and password.
* Returns an ElggUser object for use with login.
*
* @see login
*
* @param string $username The username, optionally (for standard logins)
* @param string $password The password, optionally (for standard logins)
*
* @return ElggUser|false The authenticated user object, or false on failure.
*
* @deprecated 1.8 Use elgg_authenticate
*/
function authenticate($username, $password) {
elgg_deprecated_notice('authenticate() has been deprecated for elgg_authenticate()', 1.8);
$pam = new ElggPAM('user');
$credentials = array('username' => $username, 'password' => $password);
$result = $pam->authenticate($credentials);
if ($result) {
return get_user_by_username($username);
}
return false;
}
/**
* Get the members of a site.
*
* @param int $site_guid Site GUID
* @param int $limit User GUID
* @param int $offset Offset
*
* @return mixed
* @deprecated 1.8 Use ElggSite::getMembers()
*/
function get_site_members($site_guid, $limit = 10, $offset = 0) {
elgg_deprecated_notice("get_site_members() deprecated.
Use ElggSite::getMembers()", 1.8);
$site = get_entity($site_guid);
if ($site) {
return $site->getMembers($limit, $offset);
}
return false;
}
/**
* Display a list of site members
*
* @param int $site_guid The GUID of the site
* @param int $limit The number of members to display on a page
* @param bool $fullview Whether or not to display the full view (default: true)
*
* @return string A displayable list of members
* @deprecated 1.8 Use ElggSite::listMembers()
*/
function list_site_members($site_guid, $limit = 10, $fullview = true) {
elgg_deprecated_notice("list_site_members() deprecated.
Use ElggSite::listMembers()", 1.8);
$options = array(
'limit' => $limit,
'full_view' => $full_view,
);
$site = get_entity($site_guid);
if ($site) {
return $site->listMembers($options);
}
return '';
}
/**
* Add a collection to a site.
*
* @param int $site_guid Site GUID
* @param int $collection_guid Collection GUID
*
* @return mixed
* @deprecated 1.8
*/
function add_site_collection($site_guid, $collection_guid) {
elgg_deprecated_notice("add_site_collection has been deprecated", 1.8);
global $CONFIG;
$site_guid = (int)$site_guid;
$collection_guid = (int)$collection_guid;
return add_entity_relationship($collection_guid, "member_of_site", $site_guid);
}
/**
* Remove a collection from a site.
*
* @param int $site_guid Site GUID
* @param int $collection_guid Collection GUID
*
* @return mixed
* @deprecated 1.8
*/
function remove_site_collection($site_guid, $collection_guid) {
elgg_deprecated_notice("remove_site_collection has been deprecated", 1.8);
$site_guid = (int)$site_guid;
$collection_guid = (int)$collection_guid;
return remove_entity_relationship($collection_guid, "member_of_site", $site_guid);
}
/**
* Get the collections belonging to a site.
*
* @param int $site_guid Site GUID
* @param string $subtype Subtype
* @param int $limit Limit
* @param int $offset Offset
*
* @return mixed
* @deprecated 1.8
*/
function get_site_collections($site_guid, $subtype = "", $limit = 10, $offset = 0) {
elgg_deprecated_notice("get_site_collections has been deprecated", 1.8);
$site_guid = (int)$site_guid;
$subtype = sanitise_string($subtype);
$limit = (int)$limit;
$offset = (int)$offset;
// collection isn't a valid type. This won't work.
return elgg_get_entities_from_relationship(array(
'relationship' => 'member_of_site',
'relationship_guid' => $site_guid,
'inverse_relationship' => TRUE,
'types' => 'collection',
'subtypes' => $subtype,
'limit' => $limit,
'offset' => $offset
));
}
/**
* Get an array of tags with weights for use with the output/tagcloud view.
*
* @deprecated 1.8 Use elgg_get_tags().
*
* @param int $threshold Get the threshold of minimum number of each tags to
* bother with (ie only show tags where there are more
* than $threshold occurances)
* @param int $limit Number of tags to return
* @param string $metadata_name Optionally, the name of the field you want to grab for
* @param string $entity_type Optionally, the entity type ('object' etc)
* @param string $entity_subtype The entity subtype, optionally
* @param int $owner_guid The GUID of the tags owner, optionally
* @param int $site_guid Optionally, the site to restrict to (default is the current site)
* @param int $start_ts Optionally specify a start timestamp for tags used to
* generate cloud.
* @param int $end_ts Optionally specify an end timestamp for tags used to generate cloud
*
* @return array|false Array of objects with ->tag and ->total values, or false on failure
*/
function get_tags($threshold = 1, $limit = 10, $metadata_name = "", $entity_type = "object",
$entity_subtype = "", $owner_guid = "", $site_guid = -1, $start_ts = "", $end_ts = "") {
elgg_deprecated_notice('get_tags() has been replaced by elgg_get_tags()', 1.8);
if (is_array($metadata_name)) {
return false;
}
$options = array();
if ($metadata_name === '') {
$options['tag_names'] = array();
} else {
$options['tag_names'] = array($metadata_name);
}
$options['threshold'] = $threshold;
$options['limit'] = $limit;
// rewrite owner_guid to container_guid to emulate old functionality
$container_guid = $owner_guid;
if ($container_guid) {
$options['container_guids'] = $container_guid;
}
if ($entity_type) {
$options['type'] = $entity_type;
}
if ($entity_subtype) {
$options['subtype'] = $entity_subtype;
}
if ($site_guid != -1) {
$options['site_guids'] = $site_guid;
}
if ($end_ts) {
$options['created_time_upper'] = $end_ts;
}
if ($start_ts) {
$options['created_time_lower'] = $start_ts;
}
$r = elgg_get_tags($options);
return $r;
}
/**
* Loads and displays a tagcloud given particular criteria.
*
* @deprecated 1.8 use elgg_view_tagcloud()
*
* @param int $threshold Get the threshold of minimum number of each tags
* to bother with (ie only show tags where there are
* more than $threshold occurances)
* @param int $limit Number of tags to return
* @param string $metadata_name Optionally, the name of the field you want to grab for
* @param string $entity_type Optionally, the entity type ('object' etc)
* @param string $entity_subtype The entity subtype, optionally
* @param int $owner_guid The GUID of the tags owner, optionally
* @param int $site_guid Optionally, the site to restrict to (default is the current site)
* @param int $start_ts Optionally specify a start timestamp for tags used to
* generate cloud.
* @param int $end_ts Optionally specify an end timestamp for tags used to generate
* cloud.
*
* @return string The HTML (or other, depending on view type) of the tagcloud.
*/
function display_tagcloud($threshold = 1, $limit = 10, $metadata_name = "", $entity_type = "object",
$entity_subtype = "", $owner_guid = "", $site_guid = -1, $start_ts = "", $end_ts = "") {
elgg_deprecated_notice('display_tagcloud() was deprecated by elgg_view_tagcloud()!', 1.8);
$tags = get_tags($threshold, $limit, $metadata_name, $entity_type,
$entity_subtype, $owner_guid, $site_guid, $start_ts, $end_ts);
return elgg_view('output/tagcloud', array(
'value' => $tags,
'type' => $entity_type,
'subtype' => $entity_subtype,
));
}
/**
* Obtains a list of objects owned by a user
*
* @param int $user_guid The GUID of the owning user
* @param string $subtype Optionally, the subtype of objects
* @param int $limit The number of results to return (default 10)
* @param int $offset Indexing offset, if any
* @param int $timelower The earliest time the entity can have been created. Default: all
* @param int $timeupper The latest time the entity can have been created. Default: all
*
* @return false|array An array of ElggObjects or false, depending on success
* @deprecated 1.8 Use elgg_get_entities() instead
*/
function get_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $limit = 10,
$offset = 0, $timelower = 0, $timeupper = 0) {
elgg_deprecated_notice("get_user_objects() was deprecated in favor of elgg_get_entities()", 1.8);
$ntt = elgg_get_entities(array(
'type' => 'object',
'subtype' => $subtype,
'owner_guid' => $user_guid,
'limit' => $limit,
'offset' => $offset,
'container_guid' => $user_guid,
'created_time_lower' => $timelower,
'created_time_upper' => $timeupper
));
return $ntt;
}
/**
* Counts the objects (optionally of a particular subtype) owned by a user
*
* @param int $user_guid The GUID of the owning user
* @param string $subtype Optionally, the subtype of objects
* @param int $timelower The earliest time the entity can have been created. Default: all
* @param int $timeupper The latest time the entity can have been created. Default: all
*
* @return int The number of objects the user owns (of this subtype)
* @deprecated 1.8 Use elgg_get_entities() instead
*/
function count_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $timelower = 0,
$timeupper = 0) {
elgg_deprecated_notice("count_user_objects() was deprecated in favor of elgg_get_entities()", 1.8);
$total = elgg_get_entities(array(
'type' => 'object',
'subtype' => $subtype,
'owner_guid' => $user_guid,
'count' => TRUE,
'container_guid' => $user_guid,
'created_time_lower' => $timelower,
'created_time_upper' => $timeupper
));
return $total;
}
/**
* Displays a list of user objects of a particular subtype, with navigation.
*
* @see elgg_view_entity_list
*
* @param int $user_guid The GUID of the user
* @param string $subtype The object subtype
* @param int $limit The number of entities to display on a page
* @param bool $fullview Whether or not to display the full view (default: true)
* @param bool $listtypetoggle Whether or not to allow gallery view (default: true)
* @param bool $pagination Whether to display pagination (default: true)
* @param int $timelower The earliest time the entity can have been created. Default: all
* @param int $timeupper The latest time the entity can have been created. Default: all
*
* @return string The list in a form suitable to display
* @deprecated 1.8 Use elgg_list_entities() instead
*/
function list_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $limit = 10,
$fullview = true, $listtypetoggle = true, $pagination = true, $timelower = 0, $timeupper = 0) {
elgg_deprecated_notice("list_user_objects() was deprecated in favor of elgg_list_entities()", 1.8);
$offset = (int) get_input('offset');
$limit = (int) $limit;
$count = (int) count_user_objects($user_guid, $subtype, $timelower, $timeupper);
$entities = get_user_objects($user_guid, $subtype, $limit, $offset, $timelower, $timeupper);
return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $listtypetoggle,
$pagination);
}
/**
* Get user objects by an array of metadata
*
* @param int $user_guid The GUID of the owning user
* @param string $subtype Optionally, the subtype of objects
* @param array $metadata An array of metadata
* @param int $limit The number of results to return (default 10)
* @param int $offset Indexing offset, if any
*
* @return false|array An array of ElggObjects or false, depending on success
* @deprecated 1.8 Use elgg_get_entities_from_metadata() instead
*/
function get_user_objects_by_metadata($user_guid, $subtype = "", $metadata = array(),
$limit = 0, $offset = 0) {
elgg_deprecated_notice("get_user_objects_by_metadata() was deprecated in favor of elgg_get_entities_from_metadata()", 1.8);
return get_entities_from_metadata_multi($metadata, "object", $subtype, $user_guid,
$limit, $offset);
}
/**
* Set the validation status for a user.
*
* @param bool $status Validated (true) or false
* @param string $method Optional method to say how a user was validated
* @return bool
* @deprecated 1.8
*/
function set_user_validation_status($user_guid, $status, $method = '') {
elgg_deprecated_notice("set_user_validation_status() is deprecated", 1.8);
return elgg_set_user_validation_status($user_guid, $status, $method);
}
/**
* Trigger an event requesting that a user guid be validated somehow - either by email address or some other way.
*
* This function invalidates any existing validation value.
*
* @param int $user_guid User's GUID
* @deprecated 1.8
*/
function request_user_validation($user_guid) {
elgg_deprecated_notice("request_user_validation() is deprecated.
Plugins should register for the 'register, user' plugin hook", 1.8);
$user = get_entity($user_guid);
if (($user) && ($user instanceof ElggUser)) {
// invalidate any existing validations
set_user_validation_status($user_guid, false);
// request validation
trigger_elgg_event('validate', 'user', $user);
}
}
/**
* Register a user settings page with the admin panel.
* This function extends the view "usersettings/main" with the provided view.
* This view should provide a description and either a control or a link to.
*
* Usage:
* - To add a control to the main admin panel then extend usersettings/main
* - To add a control to a new page create a page which renders a view
* usersettings/subpage (where subpage is your new page -
* nb. some pages already exist that you can extend), extend the main view
* to point to it, and add controls to your new view.
*
* At the moment this is essentially a wrapper around elgg_extend_view().
*
* @param string $new_settings_view The view associated with the control you're adding
* @param string $view The view to extend, by default this is 'usersettings/main'.
* @param int $priority Optional priority to govern the appearance in the list.
*
* @return bool
* @deprecated 1.8 Extend one of the views in core/settings
*/
function extend_elgg_settings_page($new_settings_view, $view = 'usersettings/main',
$priority = 500) {
// see views: /core/settings
elgg_deprecated_notice("extend_elgg_settings_page has been deprecated. Extend one of the settings views instead", 1.8);
return elgg_extend_view($view, $new_settings_view, $priority);
}
/**
* @deprecated 1.8 Use elgg_view_page()
*/
function page_draw($title, $body, $sidebar = "") {
elgg_deprecated_notice("page_draw() was deprecated in favor of elgg_view_page() in 1.8.", 1.8);
$vars = array(
'sidebar' => $sidebar
);
echo elgg_view_page($title, $body, 'default', $vars);
}
/**
* Wrapper function to display search listings.
*
* @param string $icon The icon for the listing
* @param string $info Any information that needs to be displayed.
*
* @return string The HTML (etc) representing the listing
* @deprecated 1.8 use elgg_view_image_block()
*/
function elgg_view_listing($icon, $info) {
elgg_deprecated_notice('elgg_view_listing deprecated by elgg_view_image_block', 1.8);
return elgg_view('layout/objects/image_block', array('image' => $icon, 'body' => $info));
}
|