Various code inspection items
- Fix class extension in Module\Admin\Item\Source - Remove useless condition in Module\Admin\Features
This commit is contained in:
parent
6df37afb82
commit
451a06a597
2 changed files with 26 additions and 30 deletions
|
@ -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();
|
||||
$arr = [];
|
||||
$features = Feature::get(false);
|
||||
|
||||
if (($a->argc > 1) && ($a->getArgumentValue(1) === 'features')) {
|
||||
$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'),
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue