blob: dee64c61b6f69f1fa9fc722fbc0e0a44faba4245 (
plain) (
blame)
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
|
<?php
namespace Zotlabs\Extend;
class Widget {
static function register($file,$widget) {
$rt = self::get();
$rt[] = [ $file, $widget ];
self::set($rt);
}
static function unregister($file,$widget) {
$rt = self::get();
if($rt) {
$n = [];
foreach($rt as $r) {
if($r[0] !== $file && $r[1] !== $widget) {
$n[] = $r;
}
}
self::set($n);
}
}
static function unregister_by_file($file) {
$rt = self::get();
if($rt) {
$n = [];
foreach($rt as $r) {
if($r[0] !== $file) {
$n[] = $r;
}
}
self::set($n);
}
}
static function get() {
return get_config('system','widgets',[]);
}
static function set($r) {
return set_config('system','widgets',$r);
}
}
|