]> git.mxchange.org Git - friendica.git/commitdiff
Various code inspection items
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 28 Apr 2019 02:23:29 +0000 (22:23 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 2 May 2019 13:55:50 +0000 (09:55 -0400)
- Fix class extension in Module\Admin\Item\Source
- Remove useless condition in Module\Admin\Features

src/Module/Admin/Features.php
src/Module/Admin/Item/Source.php

index e127b8c19f9e4e03da170cec394e40dda0801374..cb9acf4eb1acdbab8d70dfe66673df18fd8aec2d 100644 (file)
@@ -5,7 +5,6 @@ namespace Friendica\Module\Admin;
 use Friendica\Content\Feature;\r
 use Friendica\Core\Config;\r
 use Friendica\Core\L10n;\r
-use Friendica\Core\Logger;\r
 use Friendica\Core\Renderer;\r
 use Friendica\Module\BaseAdminModule;\r
 \r
@@ -47,33 +46,29 @@ class Features extends BaseAdminModule
        {\r
                parent::content();\r
 \r
-               $a = self::getApp();\r
-\r
-               if (($a->argc > 1) && ($a->getArgumentValue(1) === 'features')) {\r
-                       $arr = [];\r
-                       $features = Feature::get(false);\r
+               $arr = [];\r
+               $features = Feature::get(false);\r
 \r
-                       foreach ($features as $fname => $fdata) {\r
-                               $arr[$fname] = [];\r
-                               $arr[$fname][0] = $fdata[0];\r
-                               foreach (array_slice($fdata, 1) as $f) {\r
-                                       $set = Config::get('feature', $f[0], $f[3]);\r
-                                       $arr[$fname][1][] = [\r
-                                               ['feature_' . $f[0], $f[1], $set, $f[2], [L10n::t('Off'), L10n::t('On')]],\r
-                                               ['featurelock_' . $f[0], L10n::t('Lock feature %s', $f[1]), (($f[4] !== false) ? "1" : ''), '', [L10n::t('Off'), L10n::t('On')]]\r
-                                       ];\r
-                               }\r
+               foreach ($features as $fname => $fdata) {\r
+                       $arr[$fname] = [];\r
+                       $arr[$fname][0] = $fdata[0];\r
+                       foreach (array_slice($fdata, 1) as $f) {\r
+                               $set = Config::get('feature', $f[0], $f[3]);\r
+                               $arr[$fname][1][] = [\r
+                                       ['feature_' . $f[0], $f[1], $set, $f[2], [L10n::t('Off'), L10n::t('On')]],\r
+                                       ['featurelock_' . $f[0], L10n::t('Lock feature %s', $f[1]), (($f[4] !== false) ? "1" : ''), '', [L10n::t('Off'), L10n::t('On')]]\r
+                               ];\r
                        }\r
+               }\r
 \r
-                       $tpl = Renderer::getMarkupTemplate('admin/features.tpl');\r
-                       $o = Renderer::replaceMacros($tpl, [\r
-                               '$form_security_token' => parent::getFormSecurityToken("admin_manage_features"),\r
-                               '$title' => L10n::t('Manage Additional Features'),\r
-                               '$features' => $arr,\r
-                               '$submit' => L10n::t('Save Settings'),\r
-                       ]);\r
+               $tpl = Renderer::getMarkupTemplate('admin/features.tpl');\r
+               $o = Renderer::replaceMacros($tpl, [\r
+                       '$form_security_token' => parent::getFormSecurityToken("admin_manage_features"),\r
+                       '$title' => L10n::t('Manage Additional Features'),\r
+                       '$features' => $arr,\r
+                       '$submit' => L10n::t('Save Settings'),\r
+               ]);\r
 \r
-                       return $o;\r
-               }\r
+               return $o;\r
        }\r
 }
\ No newline at end of file
index f5eb5afb68d12826bd0f71c2f86aa4bd5eddd4a9..1e85b7dc706913398b80a9fb63a15fa6b3fe1ba5 100644 (file)
@@ -5,20 +5,21 @@ namespace Friendica\Module\Admin\Item;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Model;
+use Friendica\Module\BaseAdminModule;
 
 /**
  * @author Hypolite Petovan <mrpetovan@gmail.com>
  */
-class Source extends \Friendica\BaseModule
+class Source extends BaseAdminModule
+
 {
        public static function content()
        {
-               if (!is_site_admin()) {
-                       return;
-               }
+               parent::content();
 
                $a = self::getApp();
 
+               $guid = null;
                if (!empty($a->argv[1])) {
                        $guid = $a->argv[1];
                }