From 451a06a597fcb1c62bfb2dd61353df15234a8d6b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 27 Apr 2019 22:23:29 -0400 Subject: [PATCH] Various code inspection items - Fix class extension in Module\Admin\Item\Source - Remove useless condition in Module\Admin\Features --- src/Module/Admin/Features.php | 45 ++++++++++++++------------------ src/Module/Admin/Item/Source.php | 9 ++++--- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/Module/Admin/Features.php b/src/Module/Admin/Features.php index e127b8c19f..cb9acf4eb1 100644 --- a/src/Module/Admin/Features.php +++ b/src/Module/Admin/Features.php @@ -5,7 +5,6 @@ namespace Friendica\Module\Admin; use Friendica\Content\Feature; use Friendica\Core\Config; use Friendica\Core\L10n; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\Module\BaseAdminModule; @@ -47,33 +46,29 @@ class Features extends BaseAdminModule { parent::content(); - $a = self::getApp(); - - if (($a->argc > 1) && ($a->getArgumentValue(1) === 'features')) { - $arr = []; - $features = Feature::get(false); + $arr = []; + $features = Feature::get(false); - foreach ($features as $fname => $fdata) { - $arr[$fname] = []; - $arr[$fname][0] = $fdata[0]; - foreach (array_slice($fdata, 1) as $f) { - $set = Config::get('feature', $f[0], $f[3]); - $arr[$fname][1][] = [ - ['feature_' . $f[0], $f[1], $set, $f[2], [L10n::t('Off'), L10n::t('On')]], - ['featurelock_' . $f[0], L10n::t('Lock feature %s', $f[1]), (($f[4] !== false) ? "1" : ''), '', [L10n::t('Off'), L10n::t('On')]] - ]; - } + foreach ($features as $fname => $fdata) { + $arr[$fname] = []; + $arr[$fname][0] = $fdata[0]; + foreach (array_slice($fdata, 1) as $f) { + $set = Config::get('feature', $f[0], $f[3]); + $arr[$fname][1][] = [ + ['feature_' . $f[0], $f[1], $set, $f[2], [L10n::t('Off'), L10n::t('On')]], + ['featurelock_' . $f[0], L10n::t('Lock feature %s', $f[1]), (($f[4] !== false) ? "1" : ''), '', [L10n::t('Off'), L10n::t('On')]] + ]; } + } - $tpl = Renderer::getMarkupTemplate('admin/features.tpl'); - $o = Renderer::replaceMacros($tpl, [ - '$form_security_token' => parent::getFormSecurityToken("admin_manage_features"), - '$title' => L10n::t('Manage Additional Features'), - '$features' => $arr, - '$submit' => L10n::t('Save Settings'), - ]); + $tpl = Renderer::getMarkupTemplate('admin/features.tpl'); + $o = Renderer::replaceMacros($tpl, [ + '$form_security_token' => parent::getFormSecurityToken("admin_manage_features"), + '$title' => L10n::t('Manage Additional Features'), + '$features' => $arr, + '$submit' => L10n::t('Save Settings'), + ]); - return $o; - } + return $o; } } \ No newline at end of file diff --git a/src/Module/Admin/Item/Source.php b/src/Module/Admin/Item/Source.php index f5eb5afb68..1e85b7dc70 100644 --- a/src/Module/Admin/Item/Source.php +++ b/src/Module/Admin/Item/Source.php @@ -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 */ -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]; } -- 2.39.5