]> git.mxchange.org Git - friendica.git/commitdiff
moving mod/apps to src/Module/Apps
authorPhilipp Holzer <admin@philipp.info>
Sun, 24 Feb 2019 16:34:39 +0000 (17:34 +0100)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 23 Mar 2019 02:28:12 +0000 (22:28 -0400)
mod/apps.php [deleted file]
src/Module/Apps.php [new file with mode: 0644]

diff --git a/mod/apps.php b/mod/apps.php
deleted file mode 100644 (file)
index d497ce9..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/**
- * @file mod/apps.php
- */
-use Friendica\Content\Nav;
-use Friendica\Core\Config;
-use Friendica\Core\L10n;
-use Friendica\Core\Renderer;
-
-function apps_content()
-{
-       $privateaddons = Config::get('config', 'private_addons');
-       if ($privateaddons === "1") {
-               if (! local_user()) {
-                       info(L10n::t('You must be logged in to use addons. '));
-                       return;
-               };
-       }
-
-       $title = L10n::t('Applications');
-
-       $apps = Nav::getAppMenu();
-
-       if (count($apps) == 0) {
-               notice(L10n::t('No installed applications.') . EOL);
-       }
-
-       $tpl = Renderer::getMarkupTemplate('apps.tpl');
-       return Renderer::replaceMacros($tpl, [
-               '$title' => $title,
-               '$apps'  => $apps,
-       ]);
-}
diff --git a/src/Module/Apps.php b/src/Module/Apps.php
new file mode 100644 (file)
index 0000000..a23ac0a
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+
+namespace Friendica\Module;
+
+use Friendica\BaseModule;
+use Friendica\Content\Nav;
+use Friendica\Core\Config;
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+
+/**
+ * Shows the App menu
+ */
+class Apps extends BaseModule
+{
+       public static function init()
+       {
+               $privateaddons = Config::get('config', 'private_addons');
+               if ($privateaddons === "1") {
+                       if (!local_user()) {
+                               self::getApp()->internalRedirect();
+                       };
+               }
+       }
+
+       public static function content()
+       {
+               $apps = Nav::getAppMenu();
+
+               if (count($apps) == 0) {
+                       notice(L10n::t('No installed applications.') . EOL);
+               }
+
+               $tpl = Renderer::getMarkupTemplate('apps.tpl');
+               return Renderer::replaceMacros($tpl, [
+                       '$title' => L10n::t('Applications'),
+                       '$apps'  => $apps,
+               ]);
+       }
+}