summaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/Feed.php9
-rw-r--r--app/Models/Share.php6
-rw-r--r--app/Models/StatsDAO.php20
-rw-r--r--app/Models/StatsDAOSQLite.php4
4 files changed, 18 insertions, 21 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index 23491ee8d..986cc5015 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -451,6 +451,10 @@ class FreshRSS_Feed extends Minz_Model {
Minz_Log::warning('Invalid callback for PubSubHubbub: ' . $this->url);
return false;
}
+ if (!$state) { //unsubscribe
+ $hubJson['lease_end'] = time() - 60;
+ file_put_contents($hubFilename, json_encode($hubJson));
+ }
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $this->hubUrl,
@@ -470,11 +474,6 @@ class FreshRSS_Feed extends Minz_Model {
'PubSubHubbub ' . ($state ? 'subscribe' : 'unsubscribe') . ' to ' . $this->selfUrl .
' with callback ' . $callbackUrl . ': ' . $info['http_code'] . ' ' . $response . "\n", FILE_APPEND);
- if (!$state) { //unsubscribe
- $hubJson['lease_end'] = time() - 60;
- file_put_contents($hubFilename, json_encode($hubJson));
- }
-
if (substr($info['http_code'], 0, 1) == '2') {
return true;
} else {
diff --git a/app/Models/Share.php b/app/Models/Share.php
index 2a05f2ee9..1c8a7e767 100644
--- a/app/Models/Share.php
+++ b/app/Models/Share.php
@@ -119,11 +119,9 @@ class FreshRSS_Share {
);
foreach ($options as $key => $value) {
- if (!isset($available_options[$key])) {
- continue;
+ if (isset($available_options[$key])) {
+ $this->{$available_options[$key]} = $value;
}
-
- $this->$available_options[$key] = $value;
}
}
diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php
index 80caccc49..5ca333396 100644
--- a/app/Models/StatsDAO.php
+++ b/app/Models/StatsDAO.php
@@ -55,9 +55,9 @@ SQL;
/**
* Calculates entry count per day on a 30 days period.
- * Returns the result as a JSON string.
+ * Returns the result as a JSON object.
*
- * @return string
+ * @return JSON object
*/
public function calculateEntryCount() {
$count = $this->initEntryCountArray();
@@ -257,9 +257,9 @@ SQL;
/**
* Calculates feed count per category.
- * Returns the result as a JSON string.
+ * Returns the result as a JSON object.
*
- * @return string
+ * @return JSON object
*/
public function calculateFeedByCategory() {
$sql = <<<SQL
@@ -282,7 +282,7 @@ SQL;
* Calculates entry count per category.
* Returns the result as a JSON string.
*
- * @return string
+ * @return JSON object
*/
public function calculateEntryByCategory() {
$sql = <<<SQL
@@ -357,7 +357,7 @@ SQL;
$serie[] = array($key, $value);
}
- return json_encode($serie);
+ return $serie;
}
protected function convertToPieSerie($data) {
@@ -368,7 +368,7 @@ SQL;
$serie[] = $value;
}
- return json_encode($serie);
+ return $serie;
}
/**
@@ -411,17 +411,17 @@ SQL;
}
/**
- * Translates array content and encode it as JSON
+ * Translates array content
*
* @param array $data
- * @return string
+ * @return JSON object
*/
private function convertToTranslatedJson($data = array()) {
$translated = array_map(function($a) {
return _t('gen.date.' . $a);
}, $data);
- return json_encode($translated);
+ return $translated;
}
}
diff --git a/app/Models/StatsDAOSQLite.php b/app/Models/StatsDAOSQLite.php
index bb2336532..9bfe8b20a 100644
--- a/app/Models/StatsDAOSQLite.php
+++ b/app/Models/StatsDAOSQLite.php
@@ -4,9 +4,9 @@ class FreshRSS_StatsDAOSQLite extends FreshRSS_StatsDAO {
/**
* Calculates entry count per day on a 30 days period.
- * Returns the result as a JSON string.
+ * Returns the result as a JSON object.
*
- * @return string
+ * @return JSON object
*/
public function calculateEntryCount() {
$count = $this->initEntryCountArray();