aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Extend/Widget.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-10-19 11:18:28 +0200
committerMario Vavti <mario@mariovavti.com>2018-10-19 11:18:28 +0200
commitfa9e9510e5d993d183feb942fe74be5fdd07f5cf (patch)
tree41fec09f527a9346e043b8099b458a97d81b03ed /Zotlabs/Extend/Widget.php
parent32de123db0ac526795a237ff46885fe8a332cbc0 (diff)
parent06b3ad1071c755757555baf941e2c0f446f97b21 (diff)
downloadvolse-hubzilla-fa9e9510e5d993d183feb942fe74be5fdd07f5cf.tar.gz
volse-hubzilla-fa9e9510e5d993d183feb942fe74be5fdd07f5cf.tar.bz2
volse-hubzilla-fa9e9510e5d993d183feb942fe74be5fdd07f5cf.zip
Merge branch '3.8RC'3.8
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);
+ }
+}