entry_bottom.phtml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /** @var FreshRSS_View $this */
  3. $sharing = array();
  4. if (FreshRSS_Auth::hasAccess()) {
  5. $sharing = FreshRSS_Context::$user_conf->sharing;
  6. }
  7. $bottomline_read = FreshRSS_Context::$user_conf->bottomline_read;
  8. $bottomline_favorite = FreshRSS_Context::$user_conf->bottomline_favorite;
  9. $bottomline_sharing = FreshRSS_Context::$user_conf->bottomline_sharing && (count($sharing) > 0);
  10. $bottomline_labels = true; //TODO
  11. $bottomline_tags = FreshRSS_Context::$user_conf->bottomline_tags;
  12. $bottomline_date = FreshRSS_Context::$user_conf->bottomline_date;
  13. $bottomline_link = FreshRSS_Context::$user_conf->bottomline_link;
  14. ?><ul class="horizontal-list bottom"><?php
  15. if (FreshRSS_Auth::hasAccess()) {
  16. if ($bottomline_read) {
  17. ?><li class="item manage"><?php
  18. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $this->entry->id()));
  19. if ($this->entry->isRead()) {
  20. $arUrl['params']['is_read'] = 0;
  21. }
  22. ?><a class="read" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?php
  23. echo _i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php
  24. ?></li><?php
  25. }
  26. if ($bottomline_favorite) {
  27. ?><li class="item manage"><?php
  28. $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $this->entry->id()));
  29. if ($this->entry->isFavorite()) {
  30. $arUrl['params']['is_favorite'] = 0;
  31. }
  32. ?><a class="bookmark" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?php
  33. echo _i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
  34. ?></li><?php
  35. }
  36. }
  37. // @phpstan-ignore-next-line
  38. if ($bottomline_labels) {
  39. ?><li class="item">
  40. <div class="dropdown dynamictags">
  41. <div id="dropdown-labels-<?= $this->entry->id() ?>" class="dropdown-target"></div>
  42. <?= FreshRSS_Themes::alt('label') ?>
  43. <a class="dropdown-toggle" href="#dropdown-labels-<?= $this->entry->id() ?>"><?php
  44. echo _t('index.menu.tags');
  45. ?></a>
  46. <ul class="dropdown-menu dropdown-menu-scrollable scrollbar-thin">
  47. <li class="dropdown-close"><a href="#close">❌</a></li>
  48. <!-- Ajax -->
  49. </ul>
  50. <div class="dropdown-close"><a href="#close">❌</a></div>
  51. </div>
  52. </li><?php
  53. }
  54. $tags = $bottomline_tags ? $this->entry->tags() : null;
  55. if (!empty($tags)) {
  56. ?><li class="item">
  57. <div class="dropdown">
  58. <div id="dropdown-tags-<?= $this->entry->id() ?>" class="dropdown-target"></div>
  59. <?= _i('tag') ?>
  60. <a class="dropdown-toggle" href="#dropdown-tags-<?= $this->entry->id() ?>"><?php
  61. echo _t('index.tag.related');
  62. ?></a>
  63. <ul class="dropdown-menu">
  64. <li class="dropdown-close"><a href="#close">❌</a></li><?php
  65. foreach ($tags as $tag) {
  66. ?><li class="item"><a href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>"><?= $tag ?></a></li><?php
  67. } ?>
  68. </ul>
  69. </div>
  70. </li><?php
  71. }
  72. ?><li class="item"><?php
  73. if ($bottomline_sharing) {
  74. ?><div class="dropdown">
  75. <div id="dropdown-share-<?= $this->entry->id() ?>" class="dropdown-target"></div>
  76. <a class="dropdown-toggle" href="#dropdown-share-<?= $this->entry->id() ?>">
  77. <?= _i('share') ?>
  78. <?= _t('index.share') ?>
  79. </a>
  80. <ul class="dropdown-menu">
  81. <li class="dropdown-close"><a href="#close">❌</a></li>
  82. <li class="dropdown-header"><?= _t('index.share') ?> <a href="<?= _url('configure', 'integration') ?>"><?= _i('configure') ?></a></li><?php
  83. $id = $this->entry->id();
  84. $link = $this->entry->link();
  85. $title = $this->entry->title() . ' · ' . $this->feed->name();
  86. foreach (FreshRSS_Context::$user_conf->sharing as $share_options) {
  87. $share = FreshRSS_Share::get($share_options['type']);
  88. if ($share === null) {
  89. continue;
  90. }
  91. $cssClass = $share->isDeprecated() ? ' error' : '';
  92. $share_options['id'] = $id;
  93. $share_options['link'] = $link;
  94. $share_options['title'] = $title;
  95. $share->update($share_options);
  96. ?><li class="item share<?= $cssClass ?>">
  97. <?php if ('GET' === $share->method()) {
  98. if ($share->HTMLtag() !== 'button') {?>
  99. <a target="_blank" rel="noreferrer" href="<?= $share->url() ?>" data-type="<?= $share->type() ?>"><?= $share->name() ?></a>
  100. <?php } else { ?>
  101. <button type="button" class="as-link" data-url="<?= $share->url() ?>" data-type="<?= $share->type() ?>" data-title="<?= htmlspecialchars($title) ?>"><?= $share->name() ?></button>
  102. <?php
  103. }
  104. } else {?>
  105. <a href="POST"><?= $share->name() ?></a>
  106. <form method="POST" action="<?= $share->url() ?>" disabled="disabled">
  107. <input type="hidden" value="<?= $link ?>" name="<?= $share->field() ?>"/>
  108. </form>
  109. <?php } ?>
  110. </li><?php
  111. }
  112. ?></ul>
  113. </div>
  114. <?php } ?>
  115. </li><?php
  116. if ($bottomline_date) {
  117. ?><li class="item date"><time datetime="<?= $this->entry->machineReadableDate() ?>"><?= $this->entry->date() ?></time>&nbsp;</li><?php
  118. }
  119. if ($bottomline_link) {
  120. ?><li class="item link"><a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" title="<?= _t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a></li><?php
  121. } ?>
  122. </ul>