friendica/src/Module/BaseSettings.php

130 lines
3.9 KiB
PHP
Raw Normal View History

<?php
2020-02-09 15:45:36 +01:00
/**
2021-03-29 08:40:20 +02:00
* @copyright Copyright (C) 2010-2021, the Friendica project
2020-02-09 15:45:36 +01:00
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Content\Feature;
use Friendica\Core\Renderer;
use Friendica\DI;
2020-01-23 05:14:14 +01:00
class BaseSettings extends BaseModule
{
public static function content(array $parameters = [])
{
$a = DI::app();
$tpl = Renderer::getMarkupTemplate('settings/head.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$ispublic' => DI::l10n()->t('everybody')
]);
$tabs = [];
$tabs[] = [
'label' => DI::l10n()->t('Account'),
'url' => 'settings',
2021-07-25 17:23:37 +02:00
'selected' => ((DI::args()->getArgc() == 1) && (DI::args()->getArgv() === 'settings') ? 'active' : ''),
'accesskey' => 'o',
];
$tabs[] = [
'label' => DI::l10n()->t('Two-factor authentication'),
'url' => 'settings/2fa',
2021-07-25 17:23:37 +02:00
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === '2fa') ? 'active' : ''),
'accesskey' => 'o',
];
$tabs[] = [
'label' => DI::l10n()->t('Profile'),
'url' => 'settings/profile',
2021-07-25 17:23:37 +02:00
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'profile') ? 'active' : ''),
'accesskey' => 'p',
];
if (Feature::get()) {
$tabs[] = [
'label' => DI::l10n()->t('Additional features'),
'url' => 'settings/features',
2021-07-25 17:23:37 +02:00
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'features') ? 'active' : ''),
'accesskey' => 't',
];
}
$tabs[] = [
'label' => DI::l10n()->t('Display'),
'url' => 'settings/display',
2021-07-25 17:23:37 +02:00
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'display') ? 'active' : ''),
'accesskey' => 'i',
];
$tabs[] = [
'label' => DI::l10n()->t('Social Networks'),
'url' => 'settings/connectors',
2021-07-25 17:23:37 +02:00
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'connectors') ? 'active' : ''),
'accesskey' => 'w',
];
$tabs[] = [
'label' => DI::l10n()->t('Addons'),
'url' => 'settings/addon',
2021-07-25 17:23:37 +02:00
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'addon') ? 'active' : ''),
'accesskey' => 'l',
];
$tabs[] = [
2020-02-19 08:09:29 +01:00
'label' => DI::l10n()->t('Manage Accounts'),
'url' => 'settings/delegation',
2021-07-25 17:23:37 +02:00
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'delegation') ? 'active' : ''),
'accesskey' => 'd',
];
$tabs[] = [
'label' => DI::l10n()->t('Connected apps'),
'url' => 'settings/oauth',
2021-07-25 17:23:37 +02:00
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'oauth') ? 'active' : ''),
'accesskey' => 'b',
];
$tabs[] = [
'label' => DI::l10n()->t('Export personal data'),
2019-11-02 12:44:46 +01:00
'url' => 'settings/userexport',
2021-07-25 17:23:37 +02:00
'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'userexport') ? 'active' : ''),
'accesskey' => 'e',
];
$tabs[] = [
'label' => DI::l10n()->t('Remove account'),
'url' => 'removeme',
2021-07-25 17:23:37 +02:00
'selected' => ((DI::args()->getArgc() == 1) && (DI::args()->getArgv() === 'removeme') ? 'active' : ''),
'accesskey' => 'r',
];
$tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl");
DI::page()['aside'] = Renderer::replaceMacros($tabtpl, [
'$title' => DI::l10n()->t('Settings'),
'$class' => 'settings-widget',
'$items' => $tabs,
]);
}
}