Coding style

Remove spaces before parenthesis bis

See https://github.com/marienfressinaud/FreshRSS/issues/655
This commit is contained in:
Marien Fressinaud
2014-10-05 18:51:08 +02:00
parent 9a0d01be0c
commit b5dee73ea0
11 changed files with 229 additions and 229 deletions

View File

@@ -1,6 +1,6 @@
<?php
class FreshRSS_BadUrl_Exception extends FreshRSS_Feed_Exception {
public function __construct ($url) {
parent::__construct ('`' . $url . '` is not a valid URL');
public function __construct($url) {
parent::__construct('`' . $url . '` is not a valid URL');
}
}

View File

@@ -1,7 +1,7 @@
<?php
class FreshRSS_EntriesGetter_Exception extends Exception {
public function __construct ($message) {
parent::__construct ($message);
public function __construct($message) {
parent::__construct($message);
}
}

View File

@@ -1,6 +1,6 @@
<?php
class FreshRSS_Feed_Exception extends Exception {
public function __construct ($message) {
parent::__construct ($message);
public function __construct($message) {
parent::__construct($message);
}
}

View File

@@ -7,65 +7,65 @@ class FreshRSS_Category extends Minz_Model {
private $nbNotRead = -1;
private $feeds = null;
public function __construct ($name = '', $feeds = null) {
$this->_name ($name);
if (isset ($feeds)) {
$this->_feeds ($feeds);
public function __construct($name = '', $feeds = null) {
$this->_name($name);
if (isset($feeds)) {
$this->_feeds($feeds);
$this->nbFeed = 0;
$this->nbNotRead = 0;
foreach ($feeds as $feed) {
$this->nbFeed++;
$this->nbNotRead += $feed->nbNotRead ();
$this->nbNotRead += $feed->nbNotRead();
}
}
}
public function id () {
public function id() {
return $this->id;
}
public function name () {
public function name() {
return $this->name;
}
public function nbFeed () {
public function nbFeed() {
if ($this->nbFeed < 0) {
$catDAO = new FreshRSS_CategoryDAO ();
$this->nbFeed = $catDAO->countFeed ($this->id ());
$catDAO = new FreshRSS_CategoryDAO();
$this->nbFeed = $catDAO->countFeed($this->id());
}
return $this->nbFeed;
}
public function nbNotRead () {
public function nbNotRead() {
if ($this->nbNotRead < 0) {
$catDAO = new FreshRSS_CategoryDAO ();
$this->nbNotRead = $catDAO->countNotRead ($this->id ());
$catDAO = new FreshRSS_CategoryDAO();
$this->nbNotRead = $catDAO->countNotRead($this->id());
}
return $this->nbNotRead;
}
public function feeds () {
public function feeds() {
if ($this->feeds === null) {
$feedDAO = FreshRSS_Factory::createFeedDao();
$this->feeds = $feedDAO->listByCategory ($this->id ());
$this->feeds = $feedDAO->listByCategory($this->id());
$this->nbFeed = 0;
$this->nbNotRead = 0;
foreach ($this->feeds as $feed) {
$this->nbFeed++;
$this->nbNotRead += $feed->nbNotRead ();
$this->nbNotRead += $feed->nbNotRead();
}
}
return $this->feeds;
}
public function _id ($value) {
public function _id($value) {
$this->id = $value;
}
public function _name ($value) {
public function _name($value) {
$this->name = substr(trim($value), 0, 255);
}
public function _feeds ($values) {
if (!is_array ($values)) {
$values = array ($values);
public function _feeds($values) {
if (!is_array($values)) {
$values = array($values);
}
$this->feeds = $values;

View File

@@ -1,15 +1,15 @@
<?php
class FreshRSS_CategoryDAO extends Minz_ModelPdo {
public function addCategory ($valuesTmp) {
$sql = 'INSERT INTO `' . $this->prefix . 'category` (name) VALUES(?)';
$stm = $this->bd->prepare ($sql);
public function addCategory($valuesTmp) {
$sql = 'INSERT INTO `' . $this->prefix . 'category`(name) VALUES(?)';
$stm = $this->bd->prepare($sql);
$values = array (
$values = array(
substr($valuesTmp['name'], 0, 255),
);
if ($stm && $stm->execute ($values)) {
if ($stm && $stm->execute($values)) {
return $this->bd->lastInsertId();
} else {
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
@@ -31,16 +31,16 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
return $cat->id();
}
public function updateCategory ($id, $valuesTmp) {
public function updateCategory($id, $valuesTmp) {
$sql = 'UPDATE `' . $this->prefix . 'category` SET name=? WHERE id=?';
$stm = $this->bd->prepare ($sql);
$stm = $this->bd->prepare($sql);
$values = array (
$values = array(
$valuesTmp['name'],
$id
);
if ($stm && $stm->execute ($values)) {
if ($stm && $stm->execute($values)) {
return $stm->rowCount();
} else {
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
@@ -49,13 +49,13 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
}
}
public function deleteCategory ($id) {
public function deleteCategory($id) {
$sql = 'DELETE FROM `' . $this->prefix . 'category` WHERE id=?';
$stm = $this->bd->prepare ($sql);
$stm = $this->bd->prepare($sql);
$values = array ($id);
$values = array($id);
if ($stm && $stm->execute ($values)) {
if ($stm && $stm->execute($values)) {
return $stm->rowCount();
} else {
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
@@ -64,40 +64,40 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
}
}
public function searchById ($id) {
public function searchById($id) {
$sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=?';
$stm = $this->bd->prepare ($sql);
$stm = $this->bd->prepare($sql);
$values = array ($id);
$values = array($id);
$stm->execute ($values);
$res = $stm->fetchAll (PDO::FETCH_ASSOC);
$cat = self::daoToCategory ($res);
$stm->execute($values);
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
$cat = self::daoToCategory($res);
if (isset ($cat[0])) {
if (isset($cat[0])) {
return $cat[0];
} else {
return null;
}
}
public function searchByName ($name) {
public function searchByName($name) {
$sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE name=?';
$stm = $this->bd->prepare ($sql);
$stm = $this->bd->prepare($sql);
$values = array ($name);
$values = array($name);
$stm->execute ($values);
$res = $stm->fetchAll (PDO::FETCH_ASSOC);
$cat = self::daoToCategory ($res);
$stm->execute($values);
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
$cat = self::daoToCategory($res);
if (isset ($cat[0])) {
if (isset($cat[0])) {
return $cat[0];
} else {
return null;
}
}
public function listCategories ($prePopulateFeeds = true, $details = false) {
public function listCategories($prePopulateFeeds = true, $details = false) {
if ($prePopulateFeeds) {
$sql = 'SELECT c.id AS c_id, c.name AS c_name, '
. ($details ? 'f.* ' : 'f.id, f.name, f.url, f.website, f.priority, f.error, f.cache_nbEntries, f.cache_nbUnreads ')
@@ -105,80 +105,80 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
. 'LEFT OUTER JOIN `' . $this->prefix . 'feed` f ON f.category=c.id '
. 'GROUP BY f.id '
. 'ORDER BY c.name, f.name';
$stm = $this->bd->prepare ($sql);
$stm->execute ();
return self::daoToCategoryPrepopulated ($stm->fetchAll (PDO::FETCH_ASSOC));
$stm = $this->bd->prepare($sql);
$stm->execute();
return self::daoToCategoryPrepopulated($stm->fetchAll(PDO::FETCH_ASSOC));
} else {
$sql = 'SELECT * FROM `' . $this->prefix . 'category` ORDER BY name';
$stm = $this->bd->prepare ($sql);
$stm->execute ();
return self::daoToCategory ($stm->fetchAll (PDO::FETCH_ASSOC));
$stm = $this->bd->prepare($sql);
$stm->execute();
return self::daoToCategory($stm->fetchAll(PDO::FETCH_ASSOC));
}
}
public function getDefault () {
public function getDefault() {
$sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=1';
$stm = $this->bd->prepare ($sql);
$stm = $this->bd->prepare($sql);
$stm->execute ();
$res = $stm->fetchAll (PDO::FETCH_ASSOC);
$cat = self::daoToCategory ($res);
$stm->execute();
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
$cat = self::daoToCategory($res);
if (isset ($cat[0])) {
if (isset($cat[0])) {
return $cat[0];
} else {
return false;
}
}
public function checkDefault () {
$def_cat = $this->searchById (1);
public function checkDefault() {
$def_cat = $this->searchById(1);
if ($def_cat == null) {
$cat = new FreshRSS_Category (_t('default_category'));
$cat->_id (1);
$cat = new FreshRSS_Category(_t('default_category'));
$cat->_id(1);
$values = array (
'id' => $cat->id (),
'name' => $cat->name (),
$values = array(
'id' => $cat->id(),
'name' => $cat->name(),
);
$this->addCategory ($values);
$this->addCategory($values);
}
}
public function count () {
public function count() {
$sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'category`';
$stm = $this->bd->prepare ($sql);
$stm->execute ();
$res = $stm->fetchAll (PDO::FETCH_ASSOC);
$stm = $this->bd->prepare($sql);
$stm->execute();
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
return $res[0]['count'];
}
public function countFeed ($id) {
public function countFeed($id) {
$sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'feed` WHERE category=?';
$stm = $this->bd->prepare ($sql);
$values = array ($id);
$stm->execute ($values);
$res = $stm->fetchAll (PDO::FETCH_ASSOC);
$stm = $this->bd->prepare($sql);
$values = array($id);
$stm->execute($values);
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
return $res[0]['count'];
}
public function countNotRead ($id) {
public function countNotRead($id) {
$sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id WHERE category=? AND e.is_read=0';
$stm = $this->bd->prepare ($sql);
$values = array ($id);
$stm->execute ($values);
$res = $stm->fetchAll (PDO::FETCH_ASSOC);
$stm = $this->bd->prepare($sql);
$values = array($id);
$stm->execute($values);
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
return $res[0]['count'];
}
public static function findFeed($categories, $feed_id) {
foreach ($categories as $category) {
foreach ($category->feeds () as $feed) {
if ($feed->id () === $feed_id) {
foreach ($category->feeds() as $feed) {
if ($feed->id() === $feed_id) {
return $feed;
}
}
@@ -189,8 +189,8 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
public static function CountUnreads($categories, $minPriority = 0) {
$n = 0;
foreach ($categories as $category) {
foreach ($category->feeds () as $feed) {
if ($feed->priority () >= $minPriority) {
foreach ($category->feeds() as $feed) {
if ($feed->priority() >= $minPriority) {
$n += $feed->nbNotRead();
}
}
@@ -198,11 +198,11 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
return $n;
}
public static function daoToCategoryPrepopulated ($listDAO) {
$list = array ();
public static function daoToCategoryPrepopulated($listDAO) {
$list = array();
if (!is_array ($listDAO)) {
$listDAO = array ($listDAO);
if (!is_array($listDAO)) {
$listDAO = array($listDAO);
}
$previousLine = null;
@@ -210,11 +210,11 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
foreach ($listDAO as $line) {
if ($previousLine['c_id'] != null && $line['c_id'] !== $previousLine['c_id']) {
// End of the current category, we add it to the $list
$cat = new FreshRSS_Category (
$cat = new FreshRSS_Category(
$previousLine['c_name'],
FreshRSS_FeedDAO::daoToFeed ($feedsDao, $previousLine['c_id'])
FreshRSS_FeedDAO::daoToFeed($feedsDao, $previousLine['c_id'])
);
$cat->_id ($previousLine['c_id']);
$cat->_id($previousLine['c_id']);
$list[$previousLine['c_id']] = $cat;
$feedsDao = array(); //Prepare for next category
@@ -226,29 +226,29 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
// add the last category
if ($previousLine != null) {
$cat = new FreshRSS_Category (
$cat = new FreshRSS_Category(
$previousLine['c_name'],
FreshRSS_FeedDAO::daoToFeed ($feedsDao, $previousLine['c_id'])
FreshRSS_FeedDAO::daoToFeed($feedsDao, $previousLine['c_id'])
);
$cat->_id ($previousLine['c_id']);
$cat->_id($previousLine['c_id']);
$list[$previousLine['c_id']] = $cat;
}
return $list;
}
public static function daoToCategory ($listDAO) {
$list = array ();
public static function daoToCategory($listDAO) {
$list = array();
if (!is_array ($listDAO)) {
$listDAO = array ($listDAO);
if (!is_array($listDAO)) {
$listDAO = array($listDAO);
}
foreach ($listDAO as $key => $dao) {
$cat = new FreshRSS_Category (
$cat = new FreshRSS_Category(
$dao['name']
);
$cat->_id ($dao['id']);
$cat->_id($dao['id']);
$list[$key] = $cat;
}

View File

@@ -140,18 +140,18 @@ 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
@@ -165,19 +165,19 @@ class FreshRSS_Configuration {
break;
}
}
public function _display_posts ($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) {
@@ -186,7 +186,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) {
@@ -201,20 +201,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;
@@ -222,17 +222,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) {
@@ -243,7 +243,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)))
@@ -267,7 +267,7 @@ class FreshRSS_Configuration {
}
}
}
public function _queries ($values) {
public function _queries($values) {
$this->data['queries'] = array();
foreach ($values as $value) {
$value = array_filter($value);
@@ -292,7 +292,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;
}

View File

@@ -20,134 +20,134 @@ class FreshRSS_Entry extends Minz_Model {
private $feed;
private $tags;
public function __construct ($feed = '', $guid = '', $title = '', $author = '', $content = '',
$link = '', $pubdate = 0, $is_read = false, $is_favorite = false, $tags = '') {
$this->_guid ($guid);
$this->_title ($title);
$this->_author ($author);
$this->_content ($content);
$this->_link ($link);
$this->_date ($pubdate);
$this->_isRead ($is_read);
$this->_isFavorite ($is_favorite);
$this->_feed ($feed);
$this->_tags (preg_split('/[\s#]/', $tags));
public function __construct($feed = '', $guid = '', $title = '', $author = '', $content = '',
$link = '', $pubdate = 0, $is_read = false, $is_favorite = false, $tags = '') {
$this->_guid($guid);
$this->_title($title);
$this->_author($author);
$this->_content($content);
$this->_link($link);
$this->_date($pubdate);
$this->_isRead($is_read);
$this->_isFavorite($is_favorite);
$this->_feed($feed);
$this->_tags(preg_split('/[\s#]/', $tags));
}
public function id () {
public function id() {
return $this->id;
}
public function guid () {
public function guid() {
return $this->guid;
}
public function title () {
public function title() {
return $this->title;
}
public function author () {
public function author() {
return $this->author === null ? '' : $this->author;
}
public function content () {
public function content() {
return $this->content;
}
public function link () {
public function link() {
return $this->link;
}
public function date ($raw = false) {
public function date($raw = false) {
if ($raw) {
return $this->date;
} else {
return timestamptodate ($this->date);
return timestamptodate($this->date);
}
}
public function dateAdded ($raw = false) {
public function dateAdded($raw = false) {
$date = intval(substr($this->id, 0, -6));
if ($raw) {
return $date;
} else {
return timestamptodate ($date);
return timestamptodate($date);
}
}
public function isRead () {
public function isRead() {
return $this->is_read;
}
public function isFavorite () {
public function isFavorite() {
return $this->is_favorite;
}
public function feed ($object = false) {
public function feed($object = false) {
if ($object) {
$feedDAO = FreshRSS_Factory::createFeedDao();
return $feedDAO->searchById ($this->feed);
return $feedDAO->searchById($this->feed);
} else {
return $this->feed;
}
}
public function tags ($inString = false) {
public function tags($inString = false) {
if ($inString) {
return empty ($this->tags) ? '' : '#' . implode(' #', $this->tags);
return empty($this->tags) ? '' : '#' . implode(' #', $this->tags);
} else {
return $this->tags;
}
}
public function _id ($value) {
public function _id($value) {
$this->id = $value;
}
public function _guid ($value) {
public function _guid($value) {
$this->guid = $value;
}
public function _title ($value) {
public function _title($value) {
$this->title = $value;
}
public function _author ($value) {
public function _author($value) {
$this->author = $value;
}
public function _content ($value) {
public function _content($value) {
$this->content = $value;
}
public function _link ($value) {
public function _link($value) {
$this->link = $value;
}
public function _date ($value) {
public function _date($value) {
$value = intval($value);
$this->date = $value > 1 ? $value : time();
}
public function _isRead ($value) {
public function _isRead($value) {
$this->is_read = $value;
}
public function _isFavorite ($value) {
public function _isFavorite($value) {
$this->is_favorite = $value;
}
public function _feed ($value) {
public function _feed($value) {
$this->feed = $value;
}
public function _tags ($value) {
if (!is_array ($value)) {
$value = array ($value);
public function _tags($value) {
if (!is_array($value)) {
$value = array($value);
}
foreach ($value as $key => $t) {
if (!$t) {
unset ($value[$key]);
unset($value[$key]);
}
}
$this->tags = $value;
}
public function isDay ($day, $today) {
public function isDay($day, $today) {
$date = $this->dateAdded(true);
switch ($day) {
case FreshRSS_Days::TODAY:
$tomorrow = $today + 86400;
return $date >= $today && $date < $tomorrow;
case FreshRSS_Days::YESTERDAY:
$yesterday = $today - 86400;
return $date >= $yesterday && $date < $today;
case FreshRSS_Days::BEFORE_YESTERDAY:
$yesterday = $today - 86400;
return $date < $yesterday;
default:
return false;
case FreshRSS_Days::TODAY:
$tomorrow = $today + 86400;
return $date >= $today && $date < $tomorrow;
case FreshRSS_Days::YESTERDAY:
$yesterday = $today - 86400;
return $date >= $yesterday && $date < $today;
case FreshRSS_Days::BEFORE_YESTERDAY:
$yesterday = $today - 86400;
return $date < $yesterday;
default:
return false;
}
}
@@ -158,7 +158,7 @@ class FreshRSS_Entry extends Minz_Model {
$entryDAO = FreshRSS_Factory::createEntryDao();
$entry = $entryDAO->searchByGuid($this->feed, $this->guid);
if($entry) {
if ($entry) {
// l'article existe déjà en BDD, en se contente de recharger ce contenu
$this->content = $entry->content();
} else {
@@ -168,25 +168,25 @@ class FreshRSS_Entry extends Minz_Model {
htmlspecialchars_decode($this->link(), ENT_QUOTES), $pathEntries
);
} catch (Exception $e) {
// rien à faire, on garde l'ancien contenu (requête a échoué)
// rien à faire, on garde l'ancien contenu(requête a échoué)
}
}
}
}
public function toArray () {
return array (
'id' => $this->id (),
'guid' => $this->guid (),
'title' => $this->title (),
'author' => $this->author (),
'content' => $this->content (),
'link' => $this->link (),
'date' => $this->date (true),
'is_read' => $this->isRead (),
'is_favorite' => $this->isFavorite (),
'id_feed' => $this->feed (),
'tags' => $this->tags (true),
public function toArray() {
return array(
'id' => $this->id(),
'guid' => $this->guid(),
'title' => $this->title(),
'author' => $this->author(),
'content' => $this->content(),
'link' => $this->link(),
'date' => $this->date(true),
'is_read' => $this->isRead(),
'is_favorite' => $this->isFavorite(),
'id_feed' => $this->feed(),
'tags' => $this->tags(true),
);
}
}

View File

@@ -307,27 +307,27 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
$joinFeed = false;
$values = array();
switch ($type) {
case 'a':
$where .= 'f.priority > 0 ';
$joinFeed = true;
break;
case 's': //Deprecated: use $state instead
$where .= 'e1.is_favorite=1 ';
break;
case 'c':
$where .= 'f.category=? ';
$values[] = intval($id);
$joinFeed = true;
break;
case 'f':
$where .= 'e1.id_feed=? ';
$values[] = intval($id);
break;
case 'A':
$where .= '1 ';
break;
default:
throw new FreshRSS_EntriesGetter_Exception('Bad type in Entry->listByType: [' . $type . ']!');
case 'a':
$where .= 'f.priority > 0 ';
$joinFeed = true;
break;
case 's': //Deprecated: use $state instead
$where .= 'e1.is_favorite=1 ';
break;
case 'c':
$where .= 'f.category=? ';
$values[] = intval($id);
$joinFeed = true;
break;
case 'f':
$where .= 'e1.id_feed=? ';
$values[] = intval($id);
break;
case 'A':
$where .= '1 ';
break;
default:
throw new FreshRSS_EntriesGetter_Exception('Bad type in Entry->listByType: [' . $type . ']!');
}
if ($state & FreshRSS_Entry::STATE_NOT_READ) {

View File

@@ -5,22 +5,22 @@ class FreshRSS_Log extends Minz_Model {
private $level;
private $information;
public function date () {
public function date() {
return $this->date;
}
public function level () {
public function level() {
return $this->level;
}
public function info () {
public function info() {
return $this->information;
}
public function _date ($date) {
public function _date($date) {
$this->date = $date;
}
public function _level ($level) {
public function _level($level) {
$this->level = $level;
}
public function _info ($information) {
public function _info($information) {
$this->information = $information;
}
}

View File

@@ -2,15 +2,15 @@
class FreshRSS_LogDAO {
public static function lines() {
$logs = array ();
$logs = array();
$handle = @fopen(LOG_PATH . '/' . Minz_Session::param('currentUser', '_') . '.log', 'r');
if ($handle) {
while (($line = fgets($handle)) !== false) {
if (preg_match ('/^\[([^\[]+)\] \[([^\[]+)\] --- (.*)$/', $line, $matches)) {
if (preg_match('/^\[([^\[]+)\] \[([^\[]+)\] --- (.*)$/', $line, $matches)) {
$myLog = new FreshRSS_Log ();
$myLog->_date ($matches[1]);
$myLog->_level ($matches[2]);
$myLog->_info ($matches[3]);
$myLog->_date($matches[1]);
$myLog->_level($matches[2]);
$myLog->_info($matches[3]);
$logs[] = $myLog;
}
}

View File

@@ -415,7 +415,7 @@ SQL;
* @return string
*/
private function convertToTranslatedJson($data = array()) {
$translated = array_map(function ($a) {
$translated = array_map(function($a) {
return _t($a);
}, $data);