2012-03-30 13:45:23 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Theme settings
|
|
|
|
*/
|
|
|
|
|
2017-04-30 04:07:00 +00:00
|
|
|
use Friendica\App;
|
2017-11-07 02:22:52 +00:00
|
|
|
use Friendica\Core\Config;
|
2018-01-22 12:29:50 +00:00
|
|
|
use Friendica\Core\L10n;
|
2018-10-31 14:35:50 +00:00
|
|
|
use Friendica\Core\Renderer;
|
2020-01-18 15:50:57 +00:00
|
|
|
use Friendica\DI;
|
2017-04-30 04:07:00 +00:00
|
|
|
|
2017-01-09 12:06:08 +00:00
|
|
|
function theme_content(App $a) {
|
2016-12-20 10:56:34 +00:00
|
|
|
if (!local_user()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-01-18 15:50:57 +00:00
|
|
|
$align = DI::pConfig()->get(local_user(), 'quattro', 'align' );
|
|
|
|
$color = DI::pConfig()->get(local_user(), 'quattro', 'color' );
|
|
|
|
$tfs = DI::pConfig()->get(local_user(),"quattro","tfs");
|
|
|
|
$pfs = DI::pConfig()->get(local_user(),"quattro","pfs");
|
2016-12-20 10:56:34 +00:00
|
|
|
|
2012-10-01 12:58:05 +00:00
|
|
|
return quattro_form($a,$align, $color, $tfs, $pfs);
|
2012-04-13 09:21:15 +00:00
|
|
|
}
|
|
|
|
|
2017-01-09 12:06:08 +00:00
|
|
|
function theme_post(App $a) {
|
2016-12-20 10:56:34 +00:00
|
|
|
if (! local_user()) {
|
2012-04-13 09:21:15 +00:00
|
|
|
return;
|
2016-12-20 10:56:34 +00:00
|
|
|
}
|
|
|
|
|
2012-04-13 09:21:15 +00:00
|
|
|
if (isset($_POST['quattro-settings-submit'])){
|
2020-01-18 15:54:50 +00:00
|
|
|
DI::pConfig()->set(local_user(), 'quattro', 'align', $_POST['quattro_align']);
|
|
|
|
DI::pConfig()->set(local_user(), 'quattro', 'color', $_POST['quattro_color']);
|
|
|
|
DI::pConfig()->set(local_user(), 'quattro', 'tfs', $_POST['quattro_tfs']);
|
|
|
|
DI::pConfig()->set(local_user(), 'quattro', 'pfs', $_POST['quattro_pfs']);
|
2012-04-13 09:21:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-09 12:06:08 +00:00
|
|
|
function theme_admin(App $a) {
|
2017-11-07 02:22:52 +00:00
|
|
|
$align = Config::get('quattro', 'align' );
|
|
|
|
$color = Config::get('quattro', 'color' );
|
|
|
|
$tfs = Config::get("quattro","tfs");
|
|
|
|
$pfs = Config::get("quattro","pfs");
|
2012-10-01 12:58:05 +00:00
|
|
|
|
|
|
|
return quattro_form($a,$align, $color, $tfs, $pfs);
|
2012-04-13 09:21:15 +00:00
|
|
|
}
|
|
|
|
|
2017-01-09 12:06:08 +00:00
|
|
|
function theme_admin_post(App $a) {
|
2012-04-13 09:21:15 +00:00
|
|
|
if (isset($_POST['quattro-settings-submit'])){
|
2017-11-07 02:22:52 +00:00
|
|
|
Config::set('quattro', 'align', $_POST['quattro_align']);
|
|
|
|
Config::set('quattro', 'color', $_POST['quattro_color']);
|
|
|
|
Config::set('quattro', 'tfs', $_POST['quattro_tfs']);
|
|
|
|
Config::set('quattro', 'pfs', $_POST['quattro_pfs']);
|
2012-04-13 09:21:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-19 13:26:13 +00:00
|
|
|
/// @TODO $a is no longer used here
|
2017-01-09 12:06:08 +00:00
|
|
|
function quattro_form(App $a, $align, $color, $tfs, $pfs) {
|
2018-01-15 13:05:12 +00:00
|
|
|
$colors = [
|
2016-12-22 10:37:23 +00:00
|
|
|
"dark" => "Quattro",
|
|
|
|
"lilac" => "Lilac",
|
|
|
|
"green" => "Green",
|
2018-01-15 13:05:12 +00:00
|
|
|
];
|
2016-12-22 10:37:23 +00:00
|
|
|
|
|
|
|
if ($tfs === false) {
|
|
|
|
$tfs = "20";
|
|
|
|
}
|
|
|
|
if ($pfs === false) {
|
|
|
|
$pfs = "12";
|
|
|
|
}
|
|
|
|
|
2018-10-31 14:44:06 +00:00
|
|
|
$t = Renderer::getMarkupTemplate("theme_settings.tpl" );
|
2018-10-31 14:35:50 +00:00
|
|
|
$o = Renderer::replaceMacros($t, [
|
2018-01-22 12:29:50 +00:00
|
|
|
'$submit' => L10n::t('Submit'),
|
|
|
|
'$title' => L10n::t("Theme settings"),
|
|
|
|
'$align' => ['quattro_align', L10n::t('Alignment'), $align, '', ['left' => L10n::t('Left'), 'center' => L10n::t('Center')]],
|
|
|
|
'$color' => ['quattro_color', L10n::t('Color scheme'), $color, '', $colors],
|
|
|
|
'$pfs' => ['quattro_pfs', L10n::t('Posts font size'), $pfs],
|
|
|
|
'$tfs' => ['quattro_tfs', L10n::t('Textareas font size'), $tfs],
|
2018-01-15 13:05:12 +00:00
|
|
|
]);
|
2012-03-30 13:45:23 +00:00
|
|
|
return $o;
|
|
|
|
}
|