aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Tokens.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-01-21 07:28:24 +0000
committerMario <mario@mariovavti.com>2022-01-21 07:28:24 +0000
commit755d0f54f7ddfc2a932e17c425c7a1aacb8d7efb (patch)
treedb1616efe407092127a273de1889bc1cd852132f /Zotlabs/Widget/Tokens.php
parenta40babbf0d09e0131a00a1e88d359caebb997a65 (diff)
parentf62d66ff25ffac7dbfdc663d2a64c5b415b6e294 (diff)
downloadvolse-hubzilla-755d0f54f7ddfc2a932e17c425c7a1aacb8d7efb.tar.gz
volse-hubzilla-755d0f54f7ddfc2a932e17c425c7a1aacb8d7efb.tar.bz2
volse-hubzilla-755d0f54f7ddfc2a932e17c425c7a1aacb8d7efb.zip
Merge branch '7.0RC'
Diffstat (limited to 'Zotlabs/Widget/Tokens.php')
-rw-r--r--Zotlabs/Widget/Tokens.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/Zotlabs/Widget/Tokens.php b/Zotlabs/Widget/Tokens.php
new file mode 100644
index 000000000..8c31003fc
--- /dev/null
+++ b/Zotlabs/Widget/Tokens.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Tokens {
+
+ function widget($arr) {
+
+ $o = '';
+
+ $tokens = q("SELECT atoken_id, atoken_name FROM atoken WHERE atoken_uid = %d",
+ intval(local_channel())
+ );
+
+ if (!$tokens) {
+ return $o;
+ }
+
+ $menu_items = [];
+ $z_root = z_root();
+ $active = argv(1) ?? '';
+
+ foreach($tokens as $token) {
+ $menu_items[] = [
+ 'href' => $z_root . '/tokens/' . $token['atoken_id'],
+ 'label' => $token['atoken_name'],
+ 'title' => '',
+ 'active' => ($active === $token['atoken_id'])
+ ];
+ }
+
+ if ($active) {
+ $menu_items[] = [
+ 'href' => $z_root . '/tokens',
+ 'label' => '<i class="fa fa-plus"></i> &nbsp;' . t('Add new guest'),
+ 'title' => '',
+ 'active' => ''
+ ];
+ }
+
+ $tpl = get_markup_template("widget_menu.tpl");
+ $o .= replace_macros($tpl, [
+ '$title' => t('Guest access'),
+ '$menu_items' => $menu_items,
+
+ ]);
+
+ return $o;
+
+ }
+}