aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Apps.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-08-22 09:20:40 +0000
committerMario <mario@mariovavti.com>2021-08-22 09:20:40 +0000
commit3bb71a6ba88c42744652d793ae767cf0c79388bd (patch)
treea836e21e4dfb1e14aab0b316bdf5ab71e328f34e /Zotlabs/Lib/Apps.php
parent7093b66b76424efe311b67ed18141f6a478bf875 (diff)
downloadvolse-hubzilla-3bb71a6ba88c42744652d793ae767cf0c79388bd.tar.gz
volse-hubzilla-3bb71a6ba88c42744652d793ae767cf0c79388bd.tar.bz2
volse-hubzilla-3bb71a6ba88c42744652d793ae767cf0c79388bd.zip
infrastructure to provide an app install widget for modules and make the bookmark app use it
Diffstat (limited to 'Zotlabs/Lib/Apps.php')
-rw-r--r--Zotlabs/Lib/Apps.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index 30c108cc1..d7d225e9a 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -575,6 +575,30 @@ class Apps {
));
}
+
+ /**
+ * @brief Render a simple app install button with app name and description.
+ *
+ * @param string $app app name
+ * @return string
+ */
+ static public function app_render_install($app) {
+
+ $papp = self::get_papp($app);
+
+ if (!$papp) {
+ return EMPTY_STR;
+ }
+
+ $papp_encoded = self::papp_encode($papp);
+
+ return replace_macros(get_markup_template('app_install.tpl'), [
+ '$papp' => $papp,
+ '$papp_encoded' => $papp_encoded,
+ '$install' => t('Install')
+ ]);
+ }
+
static public function app_install($uid,$app) {
if(! is_array($app)) {
@@ -1357,4 +1381,17 @@ class Apps {
return chunk_split(base64_encode(json_encode($papp)),72,"\n");
}
+ static public function get_papp($app) {
+
+ $r = q("select * from app where app_id = '%s' and app_channel = 0 limit 1",
+ dbesc(hash('whirlpool', $app))
+ );
+
+ if ($r) {
+ $papp = self::app_encode($r[0]);
+ return $papp;
+ }
+
+ return false;
+ }
}