entry_share_menu.phtml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. //TODO: To reduce output size, replace by an on-demand JavaScript menu, potentially using HTML template element
  5. ?>
  6. <ul class="dropdown-menu">
  7. <li class="dropdown-header"><?= _t('index.share') ?> <a href="<?= _url('configure', 'integration') ?>"><?= _i('configure') ?></a></li><?php
  8. $id = $this->entry->id();
  9. $link = $this->entry->link();
  10. $title = $this->entry->title() . ' · ' . ($this->feed === null ? '' : $this->feed->name());
  11. foreach (FreshRSS_Context::userConf()->sharing as $share_options) {
  12. $share = FreshRSS_Share::get($share_options['type']);
  13. if ($share === null) {
  14. continue;
  15. }
  16. $cssClass = $share->isDeprecated() ? ' error' : '';
  17. $share_options['id'] = $id;
  18. $share_options['link'] = $link;
  19. $share_options['title'] = $title;
  20. $share->update($share_options);
  21. ?><li class="item share<?= $cssClass ?>">
  22. <?php if ('GET' === $share->method()) {
  23. if ($share->HTMLtag() !== 'button') {?>
  24. <a target="_blank" rel="noreferrer" href="<?= $share->url() ?>" data-type="<?= $share->type() ?>"><?= $share->name() ?></a>
  25. <?php } else { ?>
  26. <button type="button" class="as-link" data-url="<?= $share->url() ?>" data-type="<?= $share->type() ?>" data-title="<?= htmlspecialchars($title) ?>"><?= $share->name() ?></button>
  27. <?php
  28. }
  29. } else {?>
  30. <a href="POST"><?= $share->name() ?></a>
  31. <form method="POST" action="<?= $share->url() ?>" disabled="disabled">
  32. <input type="hidden" value="<?= $link ?>" name="<?= $share->field() ?>"/>
  33. </form>
  34. <?php } ?>
  35. </li><?php
  36. }
  37. ?></ul>