4
0

entry_bottom.phtml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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="item-element 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="item-element 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 labels">
  40. <div class="item-element dropdown dynamictags">
  41. <div id="dropdown-labels-<?= $this->entry->id() ?>" class="dropdown-target"></div>
  42. <a class="dropdown-toggle" href="#dropdown-labels-<?= $this->entry->id() ?>">
  43. <?= _i('label') ?><?= _t('index.menu.tags') ?>
  44. </a>
  45. <ul class="dropdown-menu dropdown-menu-scrollable scrollbar-thin">
  46. <li class="dropdown-header">
  47. <?= _t('index.menu.tags') ?>
  48. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  49. <a href="<?= _url('tag', 'index') ?>"><?= _i('configure') ?></a>
  50. <?php } ?>
  51. </li>
  52. <!-- Ajax -->
  53. </ul>
  54. <a class="dropdown-close" href="#close">❌</a>
  55. </div>
  56. </li><?php
  57. }
  58. $tags = $bottomline_tags ? $this->entry->tags() : null;
  59. if (!empty($tags)) {
  60. ?><li class="item tags">
  61. <div class="item-element dropdown">
  62. <div id="dropdown-tags-<?= $this->entry->id() ?>" class="dropdown-target"></div>
  63. <a class="dropdown-toggle" href="#dropdown-tags-<?= $this->entry->id() ?>">
  64. <?= _i('tag') ?><?= _t('index.tag.related') ?>
  65. </a>
  66. <ul class="dropdown-menu">
  67. <?php
  68. foreach ($tags as $tag) {
  69. ?><li class="item"><a href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>"><?= $tag ?></a></li><?php
  70. } ?>
  71. </ul>
  72. <a class="dropdown-close" href="#close">❌</a>
  73. </div>
  74. </li><?php
  75. }
  76. ?><li class="item share"><?php
  77. if ($bottomline_sharing) {
  78. ?><div class="item-element dropdown">
  79. <div id="dropdown-share-<?= $this->entry->id() ?>" class="dropdown-target"></div>
  80. <a class="dropdown-toggle" href="#dropdown-share-<?= $this->entry->id() ?>">
  81. <?= _i('share') ?><?= _t('index.share') ?>
  82. </a>
  83. <ul class="dropdown-menu">
  84. <li class="dropdown-header"><?= _t('index.share') ?> <a href="<?= _url('configure', 'integration') ?>"><?= _i('configure') ?></a></li><?php
  85. $id = $this->entry->id();
  86. $link = $this->entry->link();
  87. $title = $this->entry->title() . ' · ' . $this->feed->name();
  88. foreach (FreshRSS_Context::$user_conf->sharing as $share_options) {
  89. $share = FreshRSS_Share::get($share_options['type']);
  90. if ($share === null) {
  91. continue;
  92. }
  93. $cssClass = $share->isDeprecated() ? ' error' : '';
  94. $share_options['id'] = $id;
  95. $share_options['link'] = $link;
  96. $share_options['title'] = $title;
  97. $share->update($share_options);
  98. ?><li class="item share<?= $cssClass ?>">
  99. <?php if ('GET' === $share->method()) {
  100. if ($share->HTMLtag() !== 'button') {?>
  101. <a target="_blank" rel="noreferrer" href="<?= $share->url() ?>" data-type="<?= $share->type() ?>"><?= $share->name() ?></a>
  102. <?php } else { ?>
  103. <button type="button" class="as-link" data-url="<?= $share->url() ?>" data-type="<?= $share->type() ?>" data-title="<?= htmlspecialchars($title) ?>"><?= $share->name() ?></button>
  104. <?php
  105. }
  106. } else {?>
  107. <a href="POST"><?= $share->name() ?></a>
  108. <form method="POST" action="<?= $share->url() ?>" disabled="disabled">
  109. <input type="hidden" value="<?= $link ?>" name="<?= $share->field() ?>"/>
  110. </form>
  111. <?php } ?>
  112. </li><?php
  113. }
  114. ?></ul>
  115. <a class="dropdown-close" href="#close">❌</a>
  116. </div>
  117. <?php } ?>
  118. </li><?php
  119. if ($bottomline_date) {
  120. ?><li class="item date"><time datetime="<?= $this->entry->machineReadableDate() ?>" class="item-element"><?= $this->entry->date() ?></time>&nbsp;</li><?php
  121. }
  122. if ($bottomline_link) {
  123. ?><li class="item link"><a target="_blank" class="item-element" rel="noreferrer" href="<?= $this->entry->link() ?>" title="<?= _t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a></li><?php
  124. } ?>
  125. </ul>