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
|
@ -5,7 +5,6 @@ namespace Friendica\Module\Admin;
|
||||||
use Friendica\Content\Feature;
|
use Friendica\Content\Feature;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Module\BaseAdminModule;
|
use Friendica\Module\BaseAdminModule;
|
||||||
|
|
||||||
|
@ -47,33 +46,29 @@ class Features extends BaseAdminModule
|
||||||
{
|
{
|
||||||
parent::content();
|
parent::content();
|
||||||
|
|
||||||
$a = self::getApp();
|
$arr = [];
|
||||||
|
$features = Feature::get(false);
|
||||||
|
|
||||||
if (($a->argc > 1) && ($a->getArgumentValue(1) === 'features')) {
|
foreach ($features as $fname => $fdata) {
|
||||||
$arr = [];
|
$arr[$fname] = [];
|
||||||
$features = Feature::get(false);
|
$arr[$fname][0] = $fdata[0];
|
||||||
|
foreach (array_slice($fdata, 1) as $f) {
|
||||||
foreach ($features as $fname => $fdata) {
|
$set = Config::get('feature', $f[0], $f[3]);
|
||||||
$arr[$fname] = [];
|
$arr[$fname][1][] = [
|
||||||
$arr[$fname][0] = $fdata[0];
|
['feature_' . $f[0], $f[1], $set, $f[2], [L10n::t('Off'), L10n::t('On')]],
|
||||||
foreach (array_slice($fdata, 1) as $f) {
|
['featurelock_' . $f[0], L10n::t('Lock feature %s', $f[1]), (($f[4] !== false) ? "1" : ''), '', [L10n::t('Off'), L10n::t('On')]]
|
||||||
$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\L10n;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Model;
|
use Friendica\Model;
|
||||||
|
use Friendica\Module\BaseAdminModule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hypolite Petovan <mrpetovan@gmail.com>
|
* @author Hypolite Petovan <mrpetovan@gmail.com>
|
||||||
*/
|
*/
|
||||||
class Source extends \Friendica\BaseModule
|
class Source extends BaseAdminModule
|
||||||
|
|
||||||
{
|
{
|
||||||
public static function content()
|
public static function content()
|
||||||
{
|
{
|
||||||
if (!is_site_admin()) {
|
parent::content();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
|
|
||||||
|
$guid = null;
|
||||||
if (!empty($a->argv[1])) {
|
if (!empty($a->argv[1])) {
|
||||||
$guid = $a->argv[1];
|
$guid = $a->argv[1];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue