Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

78 lines
1.7 KiB

  1. <?php
  2. /**
  3. * Theme settings
  4. */
  5. use Friendica\App;
  6. use Friendica\Core\Config;
  7. use Friendica\Core\L10n;
  8. use Friendica\Core\Renderer;
  9. use Friendica\DI;
  10. function theme_content(App $a)
  11. {
  12. if (!local_user()) {
  13. return;
  14. }
  15. $colorset = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
  16. $user = true;
  17. return clean_form($a, $colorset, $user);
  18. }
  19. function theme_post(App $a)
  20. {
  21. if (! local_user()) {
  22. return;
  23. }
  24. if (isset($_POST['duepuntozero-settings-submit'])) {
  25. DI::pConfig()->set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
  26. }
  27. }
  28. function theme_admin(App $a)
  29. {
  30. $colorset = Config::get('duepuntozero', 'colorset');
  31. $user = false;
  32. return clean_form($a, $colorset, $user);
  33. }
  34. function theme_admin_post(App $a)
  35. {
  36. if (isset($_POST['duepuntozero-settings-submit'])) {
  37. Config::set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
  38. }
  39. }
  40. /// @TODO $a is no longer used
  41. function clean_form(App $a, &$colorset, $user)
  42. {
  43. $colorset = [
  44. 'default' => L10n::t('default'),
  45. 'greenzero' => L10n::t('greenzero'),
  46. 'purplezero' => L10n::t('purplezero'),
  47. 'easterbunny' => L10n::t('easterbunny'),
  48. 'darkzero' => L10n::t('darkzero'),
  49. 'comix' => L10n::t('comix'),
  50. 'slackr' => L10n::t('slackr'),
  51. ];
  52. if ($user) {
  53. $color = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
  54. } else {
  55. $color = Config::get('duepuntozero', 'colorset');
  56. }
  57. $t = Renderer::getMarkupTemplate("theme_settings.tpl");
  58. $o = Renderer::replaceMacros($t, [
  59. '$submit' => L10n::t('Submit'),
  60. '$title' => L10n::t("Theme settings"),
  61. '$colorset' => ['duepuntozero_colorset', L10n::t('Variations'), $color, '', $colorset],
  62. ]);
  63. return $o;
  64. }