MarkdownProfileBlock.php 849 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. if (!defined('GNUSOCIAL')) {
  3. exit(1);
  4. }
  5. class MarkdownProfileBlock extends AccountProfileBlock
  6. {
  7. protected $profile = null;
  8. function __construct(Action $out, Profile $profile)
  9. {
  10. parent::__construct($out, $profile);
  11. $this->profile = $profile;
  12. }
  13. function show() {
  14. ProfileBlock::show();
  15. }
  16. function showDescription()
  17. {
  18. $description = $this->description();
  19. $markdown_parser = new \Michelf\Markdown();
  20. $rendered = $markdown_parser->defaultTransform($description);
  21. $safe = common_purify($rendered);
  22. if (!empty($description)) {
  23. $this->out->elementStart(
  24. 'div',
  25. 'profile_block_description'
  26. );
  27. $this->out->raw($safe);
  28. $this->out->elementEnd('div');
  29. }
  30. }
  31. }