layout.phtml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. FreshRSS::preLayout();
  5. $class = [];
  6. if (Minz_Request::controllerName() !== '') {
  7. $class[] = 'controller_' . Minz_Request::controllerName();
  8. } else {
  9. $class[] = 'file_' . pathinfo(is_string($_SERVER['SCRIPT_NAME'] ?? null) ? $_SERVER['SCRIPT_NAME'] : '', PATHINFO_FILENAME);
  10. }
  11. $dir = '';
  12. if (_t('gen.dir') === 'rtl') {
  13. $dir = ' dir="rtl"';
  14. $class[] = 'rtl';
  15. }
  16. $class[] = 'theme_' . FreshRSS_Context::userConf()->theme;
  17. if (FreshRSS_Context::userConf()->darkMode !== 'no') {
  18. $class[] = 'darkMode_' . FreshRSS_Context::userConf()->darkMode;
  19. }
  20. if (FreshRSS_Auth::hasAccess()) {
  21. $class[] = 'logged_in';
  22. }
  23. $class = array_map(
  24. fn($c) => preg_replace('/\s/', '', $c), $class
  25. );
  26. ?>
  27. <!DOCTYPE html>
  28. <html lang="<?= FreshRSS_Context::userConf()->language ?>"<?= $dir ?> xml:lang="<?= FreshRSS_Context::userConf()->language ?>" class="<?= implode(' ', $class) ?>">
  29. <head>
  30. <meta charset="UTF-8" />
  31. <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
  32. <?= FreshRSS_View::metaThemeColor() ?>
  33. <?= FreshRSS_View::headStyle() ?>
  34. <script id="jsonVars" type="application/json">
  35. <?php $this->renderHelper('javascript_vars'); ?>
  36. </script>
  37. <?= FreshRSS_View::headScript() ?>
  38. <link rel="manifest" href="<?= Minz_Url::display('/themes/manifest.json') ?>" />
  39. <link rel="icon" id="favicon" type="image/svg+xml" href="<?= Minz_Url::display('/themes/icons/favicon.svg') ?>" />
  40. <link rel="icon msapplication-TileImage apple-touch-icon" type="image/png" sizes="256x256" href="<?= Minz_Url::display('/themes/icons/favicon-256.png') ?>" />
  41. <link rel="apple-touch-icon" href="<?= Minz_Url::display('/themes/icons/apple-touch-icon.png') ?>" />
  42. <meta name="apple-mobile-web-app-capable" content="yes" />
  43. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  44. <meta name="apple-mobile-web-app-title" content="<?= FreshRSS_Context::systemConf()->title ?>">
  45. <meta name="msapplication-TileColor" content="#FFF" />
  46. <meta name="theme-color" content="#FFF" />
  47. <?php if (!FreshRSS_Context::systemConf()->allow_referrer) { ?>
  48. <meta name="referrer" content="never" />
  49. <?php } ?>
  50. <?= FreshRSS_View::headTitle() ?>
  51. <?php
  52. $url_base = Minz_Request::currentRequest();
  53. if ($this->rss_title != '') {
  54. $url_rss = $url_base;
  55. $url_rss['a'] = 'rss';
  56. if (FreshRSS_Auth::hasAccess()) {
  57. $url_rss['params']['user'] = Minz_User::name() ?? '';
  58. $url_rss['params']['token'] = FreshRSS_Context::userConf()->token;
  59. }
  60. unset($url_rss['params']['rid']);
  61. if (FreshRSS_Context::userConf()->since_hours_posts_per_rss) {
  62. $url_rss['params']['hours'] = FreshRSS_Context::userConf()->since_hours_posts_per_rss;
  63. }
  64. ?>
  65. <link rel="alternate" type="application/rss+xml" title="<?= $this->rss_title ?>" href="<?= Minz_Url::display($url_rss) ?>" />
  66. <?php } if (FreshRSS_Context::isAll() || FreshRSS_Context::isAllAndCategories() || FreshRSS_Context::isAllAndArchived() || FreshRSS_Context::isCategory() || FreshRSS_Context::isFeed()) {
  67. $opml_rss = $url_base;
  68. $opml_rss['a'] = 'opml';
  69. if (FreshRSS_Auth::hasAccess()) {
  70. $opml_rss['params']['user'] = Minz_User::name() ?? '';
  71. $opml_rss['params']['token'] = FreshRSS_Context::userConf()->token;
  72. }
  73. unset($opml_rss['params']['rid']);
  74. ?>
  75. <link rel="outline" type="text/x-opml" title="OPML" href="<?= Minz_Url::display($opml_rss) ?>" />
  76. <?php } if (FreshRSS_Context::systemConf()->allow_robots) { ?>
  77. <meta name="description" content="<?= htmlspecialchars(FreshRSS_Context::$name . ' | ' . FreshRSS_Context::$description, ENT_COMPAT, 'UTF-8') ?>" />
  78. <?php } else { ?>
  79. <meta name="robots" content="noindex,nofollow" />
  80. <?php } ?>
  81. </head>
  82. <body class="<?= Minz_Request::actionName() ?>">
  83. <?php
  84. if (!Minz_Request::paramBoolean('ajax')) {
  85. flush();
  86. $this->partial('header');
  87. }
  88. ?>
  89. <div id="global">
  90. <?php
  91. flush();
  92. if (isset($this->callbackBeforeFeeds)) {
  93. call_user_func($this->callbackBeforeFeeds, $this);
  94. }
  95. $this->render();
  96. ?>
  97. </div>
  98. <?php
  99. $msg = '';
  100. $status = 'closed';
  101. $notificationName = '';
  102. $notif = Minz_Request::getNotification();
  103. if (!empty($notif)) {
  104. $msg = $notif['content'];
  105. $status = $notif['type'];
  106. $notificationName = $notif['notificationName'];
  107. invalidateHttpCache();
  108. }
  109. ?>
  110. <div role="dialog" id="notification" class="notification <?= $status ?> <?= $notificationName ?>" aria-describedby="dialogMsg">
  111. <span class="msg" id="dialogMsg"><?= $msg ?></span>
  112. <button class="close" title="<?= _t('gen.action.close') ?>"><?= _i('close') ?></button>
  113. </div>
  114. </body>
  115. </html>