diff options
| author | 2022-01-05 00:52:24 +0100 | |
|---|---|---|
| committer | 2022-01-05 00:52:24 +0100 | |
| commit | d339b6dd454d814ffc323fa9077b70e33339c479 (patch) | |
| tree | bf82e2b4beda3958502465ef76c223175a978afd /p/api | |
| parent | a6ea90e58b807d18fff601135e3e697b38895ca1 (diff) | |
[CI] PHPCS: check for opening brace on same line (#4122)
* [CI] PHPCS: check for opening brace on same line
* make fix-all
* Minor comments
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'p/api')
| -rw-r--r-- | p/api/fever.php | 72 | ||||
| -rw-r--r-- | p/api/greader.php | 15 |
2 files changed, 34 insertions, 53 deletions
diff --git a/p/api/fever.php b/p/api/fever.php index 6a7f10668..ca8d574d4 100644 --- a/p/api/fever.php +++ b/p/api/fever.php @@ -69,8 +69,7 @@ class FeverDAO extends Minz_ModelPdo * @param array $bindArray * @return string */ - protected function bindParamArray($prefix, $values, &$bindArray) - { + protected function bindParamArray($prefix, $values, &$bindArray) { $str = ''; for ($i = 0; $i < count($values); $i++) { $str .= ':' . $prefix . $i . ','; @@ -86,8 +85,7 @@ class FeverDAO extends Minz_ModelPdo * @param int|null $since_id * @return FreshRSS_Entry[] */ - public function findEntries(array $feed_ids, array $entry_ids, $max_id, $since_id) - { + public function findEntries(array $feed_ids, array $entry_ids, $max_id, $since_id) { $values = array(); $order = ''; $entryDAO = FreshRSS_Factory::createEntryDao(); @@ -151,8 +149,7 @@ class FeverAPI * API Password sent from client is the result of the md5 sum of * your FreshRSS "username:your-api-password" combination */ - private function authenticate() - { + private function authenticate() { FreshRSS_Context::$user_conf = null; Minz_Session::_param('currentUser'); $feverKey = empty($_POST['api_key']) ? '' : substr(trim($_POST['api_key']), 0, 128); @@ -182,8 +179,7 @@ class FeverAPI /** * @return bool */ - public function isAuthenticatedApiUser() - { + public function isAuthenticatedApiUser() { $this->authenticate(); if (FreshRSS_Context::$user_conf !== null) { @@ -199,8 +195,7 @@ class FeverAPI * @return array * @throws Exception */ - public function process() - { + public function process() { $response_arr = array(); if (!$this->isAuthenticatedApiUser()) { @@ -281,8 +276,7 @@ class FeverAPI * @param array $reply * @return string */ - public function wrap($status, array $reply = array()) - { + public function wrap($status, array $reply = array()) { $arr = array('api_version' => self::API_LEVEL, 'auth' => $status); if ($status === self::STATUS_OK) { @@ -298,8 +292,7 @@ class FeverAPI * * @return int */ - protected function lastRefreshedOnTime() - { + protected function lastRefreshedOnTime() { $lastUpdate = 0; $entries = $this->feedDAO->listFeedsOrderUpdate(-1, 1); @@ -315,8 +308,7 @@ class FeverAPI /** * @return array */ - protected function getFeeds() - { + protected function getFeeds() { $feeds = array(); $myFeeds = $this->feedDAO->listFeeds(); @@ -339,8 +331,7 @@ class FeverAPI /** * @return array */ - protected function getGroups() - { + protected function getGroups() { $groups = array(); $categoryDAO = FreshRSS_Factory::createCategoryDao(); @@ -360,8 +351,7 @@ class FeverAPI /** * @return array */ - protected function getFavicons() - { + protected function getFavicons() { $favicons = array(); $salt = FreshRSS_Context::$system_conf->salt; $myFeeds = $this->feedDAO->listFeeds(); @@ -387,16 +377,14 @@ class FeverAPI /** * @return int */ - protected function getTotalItems() - { + protected function getTotalItems() { return $this->entryDAO->count(); } /** * @return array */ - protected function getFeedsGroup() - { + protected function getFeedsGroup() { $groups = array(); $ids = array(); $myFeeds = $this->feedDAO->listFeeds(); @@ -420,8 +408,7 @@ class FeverAPI * AFAIK there is no 'hot links' alternative in FreshRSS * @return array */ - protected function getLinks() - { + protected function getLinks() { return array(); } @@ -429,16 +416,14 @@ class FeverAPI * @param array $ids * @return string */ - protected function entriesToIdList($ids = array()) - { + protected function entriesToIdList($ids = array()) { return implode(',', array_values($ids)); } /** * @return string */ - protected function getUnreadItemIds() - { + protected function getUnreadItemIds() { $entries = $this->entryDAO->listIdsWhere('a', '', FreshRSS_Entry::STATE_NOT_READ, 'ASC', 0); return $this->entriesToIdList($entries); } @@ -446,37 +431,31 @@ class FeverAPI /** * @return string */ - protected function getSavedItemIds() - { + protected function getSavedItemIds() { $entries = $this->entryDAO->listIdsWhere('a', '', FreshRSS_Entry::STATE_FAVORITE, 'ASC', 0); return $this->entriesToIdList($entries); } - protected function setItemAsRead($id) - { + protected function setItemAsRead($id) { return $this->entryDAO->markRead($id, true); } - protected function setItemAsUnread($id) - { + protected function setItemAsUnread($id) { return $this->entryDAO->markRead($id, false); } - protected function setItemAsSaved($id) - { + protected function setItemAsSaved($id) { return $this->entryDAO->markFavorite($id, true); } - protected function setItemAsUnsaved($id) - { + protected function setItemAsUnsaved($id) { return $this->entryDAO->markFavorite($id, false); } /** * @return array */ - protected function getItems() - { + protected function getItems() { $feed_ids = array(); $entry_ids = array(); $max_id = null; @@ -550,19 +529,16 @@ class FeverAPI * @param int $beforeTimestamp * @return int */ - protected function convertBeforeToId($beforeTimestamp) - { + protected function convertBeforeToId($beforeTimestamp) { return $beforeTimestamp == 0 ? 0 : $beforeTimestamp . '000000'; } - protected function setFeedAsRead($id, $before) - { + protected function setFeedAsRead($id, $before) { $before = $this->convertBeforeToId($before); return $this->entryDAO->markReadFeed($id, $before); } - protected function setGroupAsRead($id, $before) - { + protected function setGroupAsRead($id, $before) { $before = $this->convertBeforeToId($before); // special case to mark all items as read diff --git a/p/api/greader.php b/p/api/greader.php index d233fd957..1d7b1595b 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -49,7 +49,8 @@ if (PHP_INT_SIZE < 8) { //32-bit * @param string|int $dec * @return string */ - function dec2hex($dec) { //http://code.google.com/p/google-reader-api/wiki/ItemId + function dec2hex($dec) { + //http://code.google.com/p/google-reader-api/wiki/ItemId return str_pad(dechex($dec), 16, '0', STR_PAD_LEFT); } /** @@ -81,7 +82,8 @@ function headerVariable($headerName, $varName) { return isset($pairs[$varName]) ? $pairs[$varName] : null; } -function multiplePosts($name) { //https://bugs.php.net/bug.php?id=51633 +function multiplePosts($name) { + //https://bugs.php.net/bug.php?id=51633 global $ORIGINAL_INPUT; $inputs = explode('&', $ORIGINAL_INPUT); $result = array(); @@ -197,7 +199,8 @@ function authorizationToUser() { return ''; } -function clientLogin($email, $pass) { //http://web.archive.org/web/20130604091042/http://undoc.in/clientLogin.html +function clientLogin($email, $pass) { + //http://web.archive.org/web/20130604091042/http://undoc.in/clientLogin.html if (FreshRSS_user_Controller::checkUsername($email)) { FreshRSS_Context::initUser($email); if (FreshRSS_Context::$user_conf == null) { @@ -247,7 +250,8 @@ function checkToken($conf, $token) { unauthorized(); } -function userInfo() { //https://github.com/theoldreader/api#user-info +function userInfo() { + //https://github.com/theoldreader/api#user-info $user = Minz_Session::param('currentUser', '_'); exit(json_encode(array( 'userId' => $user, @@ -459,7 +463,8 @@ function quickadd($url) { } } -function unreadCount() { //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#unread-count +function unreadCount() { + //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#unread-count header('Content-Type: application/json; charset=UTF-8'); $totalUnreads = 0; |
