aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Configuration.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-31 17:21:20 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-31 17:21:20 +0100
commit105729639bd06c27536bbdd2968873046278d59f (patch)
tree30dcf7e3ae471b30810fb22ed701e0bb7d034fc8 /app/Models/Configuration.php
parentcaf98a6468dcea5ae8c38062e4eb527cb3667db9 (diff)
parentee50df518310d3aee5efb5a0c15548b457d10e7e (diff)
Merge branch 'beta' into hotfixes
Diffstat (limited to 'app/Models/Configuration.php')
-rw-r--r--app/Models/Configuration.php58
1 files changed, 32 insertions, 26 deletions
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
index 95f819779..53f136513 100644
--- a/app/Models/Configuration.php
+++ b/app/Models/Configuration.php
@@ -14,7 +14,8 @@ class FreshRSS_Configuration {
'apiPasswordHash' => '', //CRYPT_BLOWFISH
'posts_per_page' => 20,
'view_mode' => 'normal',
- 'default_view' => FreshRSS_Entry::STATE_NOT_READ,
+ 'default_view' => 'adaptive',
+ 'default_state' => FreshRSS_Entry::STATE_NOT_READ,
'auto_load_more' => true,
'display_posts' => false,
'display_categories' => false,
@@ -47,6 +48,7 @@ class FreshRSS_Configuration {
'focus_search' => 'a',
'user_filter' => 'u',
'help' => 'f1',
+ 'close_dropdown' => 'escape',
),
'topline_read' => true,
'topline_favorite' => true,
@@ -139,44 +141,48 @@ class FreshRSS_Configuration {
}
$this->data['language'] = $value;
}
- public function _posts_per_page ($value) {
+ public function _posts_per_page($value) {
$value = intval($value);
$this->data['posts_per_page'] = $value > 0 ? $value : 10;
}
- public function _view_mode ($value) {
+ public function _view_mode($value) {
if ($value === 'global' || $value === 'reader') {
$this->data['view_mode'] = $value;
} else {
$this->data['view_mode'] = 'normal';
}
}
- public function _default_view ($value) {
+ public function _default_view($value) {
switch ($value) {
- case FreshRSS_Entry::STATE_ALL:
- // left blank on purpose
- case FreshRSS_Entry::STATE_NOT_READ:
- // left blank on purpose
- case FreshRSS_Entry::STATE_STRICT + FreshRSS_Entry::STATE_NOT_READ:
+ case 'all':
$this->data['default_view'] = $value;
+ $this->data['default_state'] = (FreshRSS_Entry::STATE_READ +
+ FreshRSS_Entry::STATE_NOT_READ);
break;
+ case 'adaptive':
+ case 'unread':
default:
- $this->data['default_view'] = FreshRSS_Entry::STATE_ALL;
- break;
+ $this->data['default_view'] = $value;
+ $this->data['default_state'] = FreshRSS_Entry::STATE_NOT_READ;
}
}
- public function _display_posts ($value) {
+ public function _default_state($value) {
+ $this->data['default_state'] = (int)$value;
+ }
+
+ public function _display_posts($value) {
$this->data['display_posts'] = ((bool)$value) && $value !== 'no';
}
- public function _display_categories ($value) {
+ public function _display_categories($value) {
$this->data['display_categories'] = ((bool)$value) && $value !== 'no';
}
public function _hide_read_feeds($value) {
$this->data['hide_read_feeds'] = (bool)$value;
}
- public function _onread_jump_next ($value) {
+ public function _onread_jump_next($value) {
$this->data['onread_jump_next'] = ((bool)$value) && $value !== 'no';
}
- public function _lazyload ($value) {
+ public function _lazyload($value) {
$this->data['lazyload'] = ((bool)$value) && $value !== 'no';
}
public function _sticky_post($value) {
@@ -185,7 +191,7 @@ class FreshRSS_Configuration {
public function _reading_confirm($value) {
$this->data['reading_confirm'] = ((bool)$value) && $value !== 'no';
}
- public function _sort_order ($value) {
+ public function _sort_order($value) {
$this->data['sort_order'] = $value === 'ASC' ? 'ASC' : 'DESC';
}
public function _old_entries($value) {
@@ -200,20 +206,20 @@ class FreshRSS_Configuration {
$value = intval($value);
$this->data['ttl_default'] = $value >= -1 ? $value : 3600;
}
- public function _shortcuts ($values) {
+ public function _shortcuts($values) {
foreach ($values as $key => $value) {
if (isset($this->data['shortcuts'][$key])) {
$this->data['shortcuts'][$key] = $value;
}
}
}
- public function _passwordHash ($value) {
+ public function _passwordHash($value) {
$this->data['passwordHash'] = ctype_graph($value) && (strlen($value) >= 60) ? $value : '';
}
- public function _apiPasswordHash ($value) {
+ public function _apiPasswordHash($value) {
$this->data['apiPasswordHash'] = ctype_graph($value) && (strlen($value) >= 60) ? $value : '';
}
- public function _mail_login ($value) {
+ public function _mail_login($value) {
$value = filter_var($value, FILTER_VALIDATE_EMAIL);
if ($value) {
$this->data['mail_login'] = $value;
@@ -221,17 +227,17 @@ class FreshRSS_Configuration {
$this->data['mail_login'] = '';
}
}
- public function _anon_access ($value) {
+ public function _anon_access($value) {
$this->data['anon_access'] = ((bool)$value) && $value !== 'no';
}
- public function _mark_when ($values) {
+ public function _mark_when($values) {
foreach ($values as $key => $value) {
if (isset($this->data['mark_when'][$key])) {
$this->data['mark_when'][$key] = ((bool)$value) && $value !== 'no';
}
}
}
- public function _sharing ($values) {
+ public function _sharing($values) {
$this->data['sharing'] = array();
$unique = array();
foreach ($values as $value) {
@@ -242,7 +248,7 @@ class FreshRSS_Configuration {
// Verify URL and add default value when needed
if (isset($value['url'])) {
$is_url = (
- filter_var ($value['url'], FILTER_VALIDATE_URL) ||
+ filter_var($value['url'], FILTER_VALIDATE_URL) ||
(version_compare(PHP_VERSION, '5.3.3', '<') &&
(strpos($value, '-') > 0) &&
($value === filter_var($value, FILTER_SANITIZE_URL)))
@@ -266,7 +272,7 @@ class FreshRSS_Configuration {
}
}
}
- public function _queries ($values) {
+ public function _queries($values) {
$this->data['queries'] = array();
foreach ($values as $value) {
$value = array_filter($value);
@@ -291,7 +297,7 @@ class FreshRSS_Configuration {
}
}
- public function _html5_notif_timeout ($value) {
+ public function _html5_notif_timeout($value) {
$value = intval($value);
$this->data['html5_notif_timeout'] = $value >= 0 ? $value : 0;
}