<?php
-
/**
* Theme settings
*/
use Friendica\App;
-use Friendica\Core\System;
+use Friendica\Core\Config;
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\DI;
function theme_content(App $a) {
if (!local_user()) {
return;
}
- $align = get_pconfig(local_user(), 'quattro', 'align' );
- $color = get_pconfig(local_user(), 'quattro', 'color' );
- $tfs = get_pconfig(local_user(),"quattro","tfs");
- $pfs = get_pconfig(local_user(),"quattro","pfs");
+ $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");
return quattro_form($a,$align, $color, $tfs, $pfs);
}
}
if (isset($_POST['quattro-settings-submit'])){
- set_pconfig(local_user(), 'quattro', 'align', $_POST['quattro_align']);
- set_pconfig(local_user(), 'quattro', 'color', $_POST['quattro_color']);
- set_pconfig(local_user(), 'quattro', 'tfs', $_POST['quattro_tfs']);
- set_pconfig(local_user(), 'quattro', 'pfs', $_POST['quattro_pfs']);
+ 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']);
}
}
function theme_admin(App $a) {
- $align = get_config('quattro', 'align' );
- $color = get_config('quattro', 'color' );
- $tfs = get_config("quattro","tfs");
- $pfs = get_config("quattro","pfs");
+ $align = Config::get('quattro', 'align' );
+ $color = Config::get('quattro', 'color' );
+ $tfs = Config::get("quattro","tfs");
+ $pfs = Config::get("quattro","pfs");
return quattro_form($a,$align, $color, $tfs, $pfs);
}
function theme_admin_post(App $a) {
if (isset($_POST['quattro-settings-submit'])){
- set_config('quattro', 'align', $_POST['quattro_align']);
- set_config('quattro', 'color', $_POST['quattro_color']);
- set_config('quattro', 'tfs', $_POST['quattro_tfs']);
- set_config('quattro', 'pfs', $_POST['quattro_pfs']);
+ 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']);
}
}
/// @TODO $a is no longer used here
function quattro_form(App $a, $align, $color, $tfs, $pfs) {
- $colors = array(
+ $colors = [
"dark" => "Quattro",
"lilac" => "Lilac",
"green" => "Green",
- );
+ ];
if ($tfs === false) {
$tfs = "20";
$pfs = "12";
}
- $t = get_markup_template("theme_settings.tpl" );
- $o .= replace_macros($t, array(
- '$submit' => t('Submit'),
- '$baseurl' => System::baseUrl(),
- '$title' => t("Theme settings"),
- '$align' => array('quattro_align', t('Alignment'), $align, '', array('left'=>t('Left'), 'center'=>t('Center'))),
- '$color' => array('quattro_color', t('Color scheme'), $color, '', $colors),
- '$pfs' => array('quattro_pfs', t('Posts font size'), $pfs),
- '$tfs' => array('quattro_tfs', t('Textareas font size'), $tfs),
- ));
+ $t = Renderer::getMarkupTemplate("theme_settings.tpl" );
+ $o = Renderer::replaceMacros($t, [
+ '$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],
+ ]);
return $o;
}