aboutsummaryrefslogtreecommitdiff
path: root/app/FreshRSS.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/FreshRSS.php')
-rw-r--r--app/FreshRSS.php38
1 files changed, 25 insertions, 13 deletions
diff --git a/app/FreshRSS.php b/app/FreshRSS.php
index 17ff9ab21..54caef3bc 100644
--- a/app/FreshRSS.php
+++ b/app/FreshRSS.php
@@ -92,24 +92,36 @@ class FreshRSS extends Minz_FrontController {
Minz_Translate::init($language);
}
+ private static function getThemeFileUrl($theme_id, $filename) {
+ $filetime = @filemtime(PUBLIC_PATH . '/themes/' . $theme_id . '/' . $filename);
+ return '/themes/' . $theme_id . '/' . $filename . '?' . $filetime;
+ }
+
public static function loadStylesAndScripts() {
$theme = FreshRSS_Themes::load(FreshRSS_Context::$user_conf->theme);
if ($theme) {
foreach(array_reverse($theme['files']) as $file) {
- if ($file[0] === '_') {
- $theme_id = 'base-theme';
- $filename = substr($file, 1);
- } else {
- $theme_id = $theme['id'];
- $filename = $file;
- }
- if (_t('gen.dir') === 'rtl') {
- $filename = substr($filename, 0, -4);
- $filename = $filename . '.rtl.css';
+ switch (substr($file, -3)) {
+ case '.js':
+ $theme_id = $theme['id'];
+ $filename = $file;
+ Minz_View::prependScript(Minz_Url::display(FreshRSS::getThemeFileUrl($theme_id, $filename)));
+ break;
+ case '.css':
+ default:
+ if ($file[0] === '_') {
+ $theme_id = 'base-theme';
+ $filename = substr($file, 1);
+ } else {
+ $theme_id = $theme['id'];
+ $filename = $file;
+ }
+ if (_t('gen.dir') === 'rtl') {
+ $filename = substr($filename, 0, -4);
+ $filename = $filename . '.rtl.css';
+ }
+ Minz_View::prependStyle(Minz_Url::display(FreshRSS::getThemeFileUrl($theme_id, $filename)));
}
- $filetime = @filemtime(PUBLIC_PATH . '/themes/' . $theme_id . '/' . $filename);
- $url = '/themes/' . $theme_id . '/' . $filename . '?' . $filetime;
- Minz_View::prependStyle(Minz_Url::display($url));
}
}
//Use prepend to insert before extensions. Added in reverse order.