aboutsummaryrefslogtreecommitdiff
path: root/app/FreshRSS.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-10-05 12:14:22 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-10-05 12:14:22 +0200
commitfebabccdd5e6db573ab80bd5c1758d136b91cd78 (patch)
treee72478f423302904d995402fb03caf8871f933bd /app/FreshRSS.php
parent5474803aa7a05e4afa851c88bf21fd8383bf59d9 (diff)
Primitive extension system
https://github.com/marienfressinaud/FreshRSS/issues/252 I have been using this extension system for a little while, in particular to include custom CSS and/or JavaScript (inclusion of PHP code is not done yet). There is very little code and it does not impact performances. I hurry to post it before https://github.com/marienfressinaud/FreshRSS/issues/655
Diffstat (limited to 'app/FreshRSS.php')
-rw-r--r--app/FreshRSS.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/FreshRSS.php b/app/FreshRSS.php
index cdf8962cb..58aac4059 100644
--- a/app/FreshRSS.php
+++ b/app/FreshRSS.php
@@ -17,6 +17,7 @@ class FreshRSS extends Minz_FrontController {
Minz_View::_param('loginOk', $loginOk);
$this->loadStylesAndScripts($loginOk); //TODO: Do not load that when not needed, e.g. some Ajax requests
$this->loadNotifications();
+ $this->loadExtensions();
}
private static function getCredentialsFromLongTermCookie() {
@@ -179,4 +180,24 @@ class FreshRSS extends Minz_FrontController {
Minz_Session::_param ('notification');
}
}
+
+ private function loadExtensions() {
+ $extensionPath = FRESHRSS_PATH . '/extensions/';
+ //TODO: Add a preference to load only user-selected extensions
+ foreach (scandir($extensionPath) as $key => $extension) {
+ if (ctype_alpha($extension)) {
+ $mtime = @filemtime($extensionPath . $extension . '/style.css');
+ if ($mtime !== false) {
+ Minz_View::appendStyle(Minz_Url::display('/ext.php?c&amp;e=' . $extension . '&amp;' . $mtime));
+ }
+ $mtime = @filemtime($extensionPath . $extension . '/script.js');
+ if ($mtime !== false) {
+ Minz_View::appendScript(Minz_Url::display('/ext.php?j&amp;e=' . $extension . '&amp;' . $mtime));
+ }
+ if (file_exists($extensionPath . $extension . '/module.php')) {
+ //TODO: include
+ }
+ }
+ }
+ }
}