summaryrefslogtreecommitdiff
path: root/app/models/RSSConfiguration.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/RSSConfiguration.php')
-rwxr-xr-xapp/models/RSSConfiguration.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php
index ca56ec3a8..00fe3fe52 100755
--- a/app/models/RSSConfiguration.php
+++ b/app/models/RSSConfiguration.php
@@ -1,6 +1,11 @@
<?php
class RSSConfiguration extends Model {
+ private $available_languages = array (
+ 'en' => 'English',
+ 'fr' => 'Français',
+ );
+ private $language;
private $posts_per_page;
private $default_view;
private $display_posts;
@@ -13,6 +18,7 @@ class RSSConfiguration extends Model {
public function __construct () {
$confDAO = new RSSConfigurationDAO ();
+ $this->_language ($confDAO->language);
$this->_postsPerPage ($confDAO->posts_per_page);
$this->_defaultView ($confDAO->default_view);
$this->_displayPosts ($confDAO->display_posts);
@@ -24,6 +30,12 @@ class RSSConfiguration extends Model {
$this->_urlShaarli ($confDAO->url_shaarli);
}
+ public function availableLanguages () {
+ return $this->available_languages;
+ }
+ public function language () {
+ return $this->language;
+ }
public function postsPerPage () {
return $this->posts_per_page;
}
@@ -60,7 +72,13 @@ class RSSConfiguration extends Model {
public function urlShaarli () {
return $this->url_shaarli;
}
-
+
+ public function _language ($value) {
+ if (!isset ($this->available_languages[$value])) {
+ $value = 'en';
+ }
+ $this->language = $value;
+ }
public function _postsPerPage ($value) {
if (is_int (intval ($value))) {
$this->posts_per_page = $value;
@@ -122,6 +140,7 @@ class RSSConfiguration extends Model {
}
class RSSConfigurationDAO extends Model_array {
+ public $language = 'en';
public $posts_per_page = 20;
public $default_view = 'not_read';
public $display_posts = 'no';
@@ -146,7 +165,10 @@ class RSSConfigurationDAO extends Model_array {
public function __construct () {
parent::__construct (PUBLIC_PATH . '/data/Configuration.array.php');
-
+
+ if (isset ($this->array['language'])) {
+ $this->language = $this->array['language'];
+ }
if (isset ($this->array['posts_per_page'])) {
$this->posts_per_page = $this->array['posts_per_page'];
}