markdownsettings.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. if (!defined('GNUSOCIAL')) {
  3. exit(1);
  4. }
  5. class MarkdownSettingsForm extends Form
  6. {
  7. function __construct($out=null)
  8. {
  9. parent::__construct($out);
  10. }
  11. function id()
  12. {
  13. return 'markdown_settings';
  14. }
  15. function formClass()
  16. {
  17. return 'form_settings';
  18. }
  19. function action()
  20. {
  21. return common_local_url('markdownsettings');
  22. }
  23. function formData()
  24. {
  25. $user = common_current_user();
  26. $profile = $user->getProfile();
  27. $this->out->elementStart('fieldset');
  28. $this->out->elementStart('ul', 'form_data');
  29. // Get current user settings
  30. $user_settings = Profile_prefs::getData($profile, MarkdownPlugin::NAME_SPACE, 'enabled', false);
  31. // Enabled?
  32. $this->li();
  33. $this->out->checkbox(
  34. 'enabled', // id
  35. 'Parse my notices as markdown', // label
  36. $user_settings // checked
  37. );
  38. $this->unli();
  39. $this->elementEnd('ul');
  40. $this->elementEnd('fieldset');
  41. }
  42. function formActions()
  43. {
  44. $this->out->submit('markdown-settings-submit', _m('BUTTON', 'Save'), 'submit', 'submit');
  45. }
  46. }