aboutsummaryrefslogtreecommitdiff
path: root/app/FreshRSS.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-04-23 22:03:07 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-04-23 22:03:07 +0200
commitae6ade25d59942a25c79155c90fc76fb22d08cea (patch)
tree89a74359074cad1d62bc844ed3bc6be719c2ee3c /app/FreshRSS.php
parentbe4f588911c5ef4ad2108154fea0433a90b6e791 (diff)
parentb042d3a7728037db90a9306c61091be0a8ac42c4 (diff)
Merge branch 'http2_headers' into dev
Diffstat (limited to 'app/FreshRSS.php')
-rw-r--r--app/FreshRSS.php37
1 files changed, 19 insertions, 18 deletions
diff --git a/app/FreshRSS.php b/app/FreshRSS.php
index bafa970da..562d8e2cd 100644
--- a/app/FreshRSS.php
+++ b/app/FreshRSS.php
@@ -34,7 +34,7 @@ class FreshRSS extends Minz_FrontController {
// Auth has to be initialized before using currentUser session parameter
// because it's this part which create this parameter.
- $this->initAuth();
+ self::initAuth();
// Then, register the user configuration and use the configuration setter
// created above.
@@ -46,10 +46,7 @@ class FreshRSS extends Minz_FrontController {
// Finish to initialize the other FreshRSS / Minz components.
FreshRSS_Context::init();
- $this->initI18n();
- FreshRSS_Share::load(join_path(DATA_PATH, 'shares.php'));
- $this->loadStylesAndScripts();
- $this->loadNotifications();
+ self::initI18n();
// Enable extensions for the current (logged) user.
if (FreshRSS_Auth::hasAccess()) {
$ext_list = FreshRSS_Context::$user_conf->extensions_enabled;
@@ -57,7 +54,7 @@ class FreshRSS extends Minz_FrontController {
}
}
- private function initAuth() {
+ private static function initAuth() {
FreshRSS_Auth::init();
if (Minz_Request::isPost() && !is_referer_from_same_domain()) {
// Basic protection against XSRF attacks
@@ -74,12 +71,12 @@ class FreshRSS extends Minz_FrontController {
}
}
- private function initI18n() {
+ private static function initI18n() {
Minz_Session::_param('language', FreshRSS_Context::$user_conf->language);
Minz_Translate::init(FreshRSS_Context::$user_conf->language);
}
- private function loadStylesAndScripts() {
+ private static function loadStylesAndScripts() {
$theme = FreshRSS_Themes::load(FreshRSS_Context::$user_conf->theme);
if ($theme) {
foreach($theme['files'] as $file) {
@@ -91,9 +88,9 @@ class FreshRSS extends Minz_FrontController {
$filename = $file;
}
$filetime = @filemtime(PUBLIC_PATH . '/themes/' . $theme_id . '/' . $filename);
- Minz_View::appendStyle(Minz_Url::display(
- '/themes/' . $theme_id . '/' . $filename . '?' . $filetime
- ));
+ $url = '/themes/' . $theme_id . '/' . $filename . '?' . $filetime;
+ header('Link: <' . Minz_Url::display($url, '', 'root') . '>;rel=preload', false); //HTTP2
+ Minz_View::appendStyle(Minz_Url::display($url));
}
}
@@ -110,6 +107,14 @@ class FreshRSS extends Minz_FrontController {
}
}
+ private static function loadNotifications() {
+ $notif = Minz_Session::param('notification');
+ if ($notif) {
+ Minz_View::_param('notification', $notif);
+ Minz_Session::_param('notification');
+ }
+ }
+
public static function preLayout() {
switch (Minz_Request::controllerName()) {
case 'index':
@@ -123,13 +128,9 @@ class FreshRSS extends Minz_FrontController {
break;
}
header("X-Content-Type-Options: nosniff");
- }
- private function loadNotifications() {
- $notif = Minz_Session::param('notification');
- if ($notif) {
- Minz_View::_param('notification', $notif);
- Minz_Session::_param('notification');
- }
+ FreshRSS_Share::load(join_path(DATA_PATH, 'shares.php'));
+ self::loadStylesAndScripts();
+ self::loadNotifications();
}
}