aboutsummaryrefslogtreecommitdiff
path: root/app/FreshRSS.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-28 23:09:39 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-28 23:09:39 +0100
commit96bdbafceac44af2159e6b80d3d403e0608991d9 (patch)
treecdea25a7a4835ca4852666ff68b23e22e4c9d3c2 /app/FreshRSS.php
parent856d2c125b1592df0f98a141f3de599c5089ce02 (diff)
Refactorisation FreshRSS_Configuration
Implémente https://github.com/marienfressinaud/FreshRSS/issues/260 (évite les comparaisons de chaînes au profit des vrais booléens et entiers) Grosse simplification et réduction du code relatif à la configuration. Supprime ConfigurationDAO. Permet de simplifier considérablement configureController. Évite de multiples copies des mêmes données en mémoire. Évite de garder plusieurs versions de la configuration en mémoire (auparavant : dans un tableau au niveau de ModelArray + au niveau de FreshRSS_Configuration + en Session + des copies temporaires comme ConfigurationDAO). Ne stocke plus 'conf' en Session (n'était presque pas utilisé). Évite de recharger plusieurs fois Translate inutilement. Contribue à https://github.com/marienfressinaud/FreshRSS/issues/303
Diffstat (limited to 'app/FreshRSS.php')
-rw-r--r--app/FreshRSS.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/app/FreshRSS.php b/app/FreshRSS.php
index 60610e352..05c8ec8e0 100644
--- a/app/FreshRSS.php
+++ b/app/FreshRSS.php
@@ -2,7 +2,6 @@
class FreshRSS extends Minz_FrontController {
public function init () {
Minz_Session::init ('FreshRSS');
- Minz_Translate::init ();
$this->loadParamsView ();
$this->loadStylesAndScripts ();
@@ -11,26 +10,26 @@ class FreshRSS extends Minz_FrontController {
private function loadParamsView () {
try {
- $this->conf = Minz_Session::param ('conf', new FreshRSS_Configuration ());
+ $this->conf = new FreshRSS_Configuration();
} catch (Minz_Exception $e) {
// Permission denied or conf file does not exist
// it's critical!
- print $e->getMessage();
- exit();
+ die($e->getMessage());
}
Minz_View::_param ('conf', $this->conf);
- Minz_Session::_param ('language', $this->conf->language ());
+ Minz_Session::_param ('language', $this->conf->language);
+ Minz_Translate::init();
$output = Minz_Request::param ('output');
- if(!$output) {
- $output = $this->conf->viewMode();
+ if (!$output) {
+ $output = $this->conf->view_mode;
Minz_Request::_param ('output', $output);
}
}
private function loadStylesAndScripts () {
- $theme = FreshRSS_Themes::get_infos($this->conf->theme());
+ $theme = FreshRSS_Themes::get_infos($this->conf->theme);
if ($theme) {
foreach($theme["files"] as $file) {
Minz_View::appendStyle (Minz_Url::display ('/themes/' . $theme['path'] . '/' . $file . '?' . @filemtime(PUBLIC_PATH . '/themes/' . $theme['path'] . '/' . $file)));
@@ -40,7 +39,7 @@ class FreshRSS extends Minz_FrontController {
if (login_is_conf ($this->conf)) {
Minz_View::appendScript ('https://login.persona.org/include.js');
}
- $includeLazyLoad = $this->conf->lazyload () === 'yes' && ($this->conf->displayPosts () === 'yes' || Minz_Request::param ('output') === 'reader');
+ $includeLazyLoad = $this->conf->lazyload && ($this->conf->display_posts || Minz_Request::param ('output') === 'reader');
Minz_View::appendScript (Minz_Url::display ('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.min.js')), false, !$includeLazyLoad, !$includeLazyLoad);
if ($includeLazyLoad) {
Minz_View::appendScript (Minz_Url::display ('/scripts/jquery.lazyload.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.lazyload.min.js')));