aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Extend/Widget.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Extend/Widget.php')
-rw-r--r--Zotlabs/Extend/Widget.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/Zotlabs/Extend/Widget.php b/Zotlabs/Extend/Widget.php
new file mode 100644
index 000000000..dee64c61b
--- /dev/null
+++ b/Zotlabs/Extend/Widget.php
@@ -0,0 +1,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);
+ }
+}