diff options
author | Mario <mario@mariovavti.com> | 2021-08-22 09:20:40 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-08-22 09:20:40 +0000 |
commit | 3bb71a6ba88c42744652d793ae767cf0c79388bd (patch) | |
tree | a836e21e4dfb1e14aab0b316bdf5ab71e328f34e /Zotlabs | |
parent | 7093b66b76424efe311b67ed18141f6a478bf875 (diff) | |
download | volse-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')
-rw-r--r-- | Zotlabs/Lib/Apps.php | 37 | ||||
-rw-r--r-- | Zotlabs/Module/Bookmarks.php | 7 |
2 files changed, 39 insertions, 5 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; + } } diff --git a/Zotlabs/Module/Bookmarks.php b/Zotlabs/Module/Bookmarks.php index 000e2893f..ea34754da 100644 --- a/Zotlabs/Module/Bookmarks.php +++ b/Zotlabs/Module/Bookmarks.php @@ -74,10 +74,7 @@ class Bookmarks extends \Zotlabs\Web\Controller { if(! Apps::system_app_installed(local_channel(), 'Bookmarks')) { //Do not display any associated widgets at this point App::$pdl = ''; - - $o = '<b>' . t('Bookmarks App') . ' (' . t('Not Installed') . '):</b><br>'; - $o .= t('Bookmark links from posts and manage them'); - return $o; + return Apps::app_render_install('Bookmarks'); } require_once('include/menu.php'); @@ -89,7 +86,7 @@ class Bookmarks extends \Zotlabs\Web\Controller { $o .= '<div class="generic-content-wrapper-styled">'; - $o .= '<h3>' . t('My Bookmarks') . '</h3>'; + $o .= '<h3>' . t('Bookmarks') . '</h3>'; $x = menu_list(local_channel(),'',MENU_BOOKMARK); |