layout.phtml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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="shortcut icon" id="favicon" type="image/x-icon" sizes="16x16 64x64" href="<?= Minz_Url::display('/favicon.ico') ?>" />
  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. $url_rss['params']['user'] = Minz_User::name() ?? '';
  57. $url_rss['params']['token'] = FreshRSS_Context::userConf()->token;
  58. unset($url_rss['params']['rid']);
  59. if (FreshRSS_Context::userConf()->since_hours_posts_per_rss) {
  60. $url_rss['params']['hours'] = FreshRSS_Context::userConf()->since_hours_posts_per_rss;
  61. }
  62. ?>
  63. <link rel="alternate" type="application/rss+xml" title="<?= $this->rss_title ?>" href="<?= Minz_Url::display($url_rss) ?>" />
  64. <?php } if (FreshRSS_Context::isAll() || FreshRSS_Context::isAllAndCategories() || FreshRSS_Context::isAllAndArchived() || FreshRSS_Context::isCategory() || FreshRSS_Context::isFeed()) {
  65. $opml_rss = $url_base;
  66. $opml_rss['a'] = 'opml';
  67. $opml_rss['params']['user'] = Minz_User::name() ?? '';
  68. $opml_rss['params']['token'] = FreshRSS_Context::userConf()->token;
  69. unset($opml_rss['params']['rid']);
  70. ?>
  71. <link rel="outline" type="text/x-opml" title="OPML" href="<?= Minz_Url::display($opml_rss) ?>" />
  72. <?php } if (FreshRSS_Context::systemConf()->allow_robots) { ?>
  73. <meta name="description" content="<?= htmlspecialchars(FreshRSS_Context::$name . ' | ' . FreshRSS_Context::$description, ENT_COMPAT, 'UTF-8') ?>" />
  74. <?php } else { ?>
  75. <meta name="robots" content="noindex,nofollow" />
  76. <?php } ?>
  77. </head>
  78. <body class="<?= Minz_Request::actionName() ?>">
  79. <?php
  80. if (!Minz_Request::paramBoolean('ajax')) {
  81. flush();
  82. $this->partial('header');
  83. }
  84. ?>
  85. <div id="global">
  86. <?php
  87. flush();
  88. if (isset($this->callbackBeforeFeeds)) {
  89. call_user_func($this->callbackBeforeFeeds, $this);
  90. }
  91. $this->render();
  92. ?>
  93. </div>
  94. <?php
  95. $msg = '';
  96. $status = 'closed';
  97. $notificationName = '';
  98. $notif = Minz_Request::getNotification();
  99. if (!empty($notif)) {
  100. $msg = $notif['content'];
  101. $status = $notif['type'];
  102. $notificationName = $notif['notificationName'];
  103. invalidateHttpCache();
  104. }
  105. ?>
  106. <div role="dialog" id="notification" class="notification <?= $status ?> <?= $notificationName ?>" aria-describedby="dialogMsg">
  107. <span class="msg" id="dialogMsg"><?= $msg ?></span>
  108. <button class="close" title="<?= _t('gen.action.close') ?>"><?= _i('close') ?></button>
  109. </div>
  110. </body>
  111. </html>