aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Context.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-12-12 18:58:34 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-12-12 18:58:34 +0100
commiteabcf90f5266b746503fef5c438971d7d6a1689e (patch)
tree7f2d6d38d297a0f4c4b4e7d52e0d59ce7f7f025b /app/Models/Context.php
parent99763412c2f49e4e52b5a0343bb465141be76188 (diff)
parent6078888de631ea105410079888838503fd7acb3d (diff)
Merge branch 'dev' into beta
Conflicts: app/i18n/en.php app/i18n/fr.php
Diffstat (limited to 'app/Models/Context.php')
-rw-r--r--app/Models/Context.php44
1 files changed, 42 insertions, 2 deletions
diff --git a/app/Models/Context.php b/app/Models/Context.php
index 36c4087eb..c8a65063a 100644
--- a/app/Models/Context.php
+++ b/app/Models/Context.php
@@ -138,12 +138,12 @@ class FreshRSS_Context {
switch($type) {
case 'a':
self::$current_get['all'] = true;
- self::$name = _t('your_rss_feeds');
+ self::$name = _t('index.feed.title');
self::$get_unread = self::$total_unread;
break;
case 's':
self::$current_get['starred'] = true;
- self::$name = _t('your_favorites');
+ self::$name = _t('index.feed.title_fav');
self::$get_unread = self::$total_starred['unread'];
// Update state if favorite is not yet enabled.
@@ -265,4 +265,44 @@ class FreshRSS_Context {
}
}
}
+
+ /**
+ * Determine if the auto remove is available in the current context.
+ * This feature is available if:
+ * - it is activated in the configuration
+ * - the "read" state is not enable
+ * - the "unread" state is enable
+ *
+ * @return boolean
+ */
+ public static function isAutoRemoveAvailable() {
+ if (!self::$conf->auto_remove_article) {
+ return false;
+ }
+ if (self::isStateEnabled(FreshRSS_Entry::STATE_READ)) {
+ return false;
+ }
+ if (!self::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Determine if the "sticky post" option is enabled. It can be enable
+ * by the user when it is selected in the configuration page or by the
+ * application when the context allows to auto-remove articles when they
+ * are read.
+ *
+ * @return boolean
+ */
+ public static function isStickyPostEnabled() {
+ if (self::$conf->sticky_post) {
+ return true;
+ }
+ if (self::isAutoRemoveAvailable()) {
+ return true;
+ }
+ return false;
+ }
}