'); - $content = $this->unescape_fb_link($content); + $content = $this->unescapeFacebookLink($content); // Clean useless html tag properties and fix link closing tags foreach (array( @@ -690,7 +690,7 @@ EOD; $content = preg_replace('/<\/a [^>]+>/i', '
', $content); - $this->unescape_fb_emote($content); + $this->unescapeFacebookEmote($content); // Restore links in the post before further parsing $post = defaultLinkTo($post, self::URI); @@ -698,7 +698,7 @@ EOD; // Restore links in the content before adding to the item $content = defaultLinkTo($content, self::URI); - $content = $this->remove_tracking_codes($content); + $content = $this->removeTrackingCodes($content); // Retrieve date of the post $date = $post->find('abbr')[0]; diff --git a/bridges/FeedExpanderExampleBridge.php b/bridges/FeedExpanderExampleBridge.php index f5b83071..708d4c13 100644 --- a/bridges/FeedExpanderExampleBridge.php +++ b/bridges/FeedExpanderExampleBridge.php @@ -44,13 +44,13 @@ class FeedExpanderExampleBridge extends FeedExpander { protected function parseItem($newsItem) { switch($this->getInput('version')) { case 'rss_0_9_1': - return $this->parseRSS_0_9_1_Item($newsItem); + return $this->parseRss091Item($newsItem); break; case 'rss_1_0': - return $this->parseRSS_1_0_Item($newsItem); + return $this->parseRss1Item($newsItem); break; case 'rss_2_0': - return $this->parseRSS_2_0_Item($newsItem); + return $this->parseRss2Item($newsItem); break; case 'atom_1_0': return $this->parseATOMItem($newsItem); diff --git a/bridges/FicbookBridge.php b/bridges/FicbookBridge.php index 6aef93b1..64cdb32d 100644 --- a/bridges/FicbookBridge.php +++ b/bridges/FicbookBridge.php @@ -39,36 +39,36 @@ class FicbookBridge extends BridgeAbstract { public function getURI() { switch($this->queriedContext) { - case 'Site News': { + case 'Site News': // For some reason this is not HTTPS return 'http://ficbook.net/sitenews'; - } - case 'Fiction Updates': { + + case 'Fiction Updates': return self::URI . 'readfic/' . urlencode($this->getInput('fiction_id')); - } - case 'Fiction Comments': { + + case 'Fiction Comments': return self::URI . 'readfic/' . urlencode($this->getInput('fiction_id')) . '/comments#content'; - } + default: return parent::getURI(); } } public function getName() { switch($this->queriedContext) { - case 'Site News': { + case 'Site News': return $this->queriedContext . ' | ' . self::NAME; - } - case 'Fiction Updates': { + + case 'Fiction Updates': return $this->titleName . ' | ' . self::NAME; - } - case 'Fiction Comments': { + + case 'Fiction Comments': return $this->titleName . ' | Comments | ' . self::NAME; - } + default: return self::NAME; } } diff --git a/bridges/GiteaBridge.php b/bridges/GiteaBridge.php index 5b393d54..f7b7b782 100644 --- a/bridges/GiteaBridge.php +++ b/bridges/GiteaBridge.php @@ -98,48 +98,48 @@ class GiteaBridge extends BridgeAbstract { public function getURI() { switch($this->queriedContext) { - case 'Commits': { + case 'Commits': return $this->getInput('host') . '/' . $this->getInput('user') . '/' . $this->getInput('project') . '/commits/' . $this->getInput('branch'); - } break; - case 'Issues': { + + case 'Issues': return $this->getInput('host') . '/' . $this->getInput('user') . '/' . $this->getInput('project') . '/issues/'; - } break; - case 'Single issue': { + + case 'Single issue': return $this->getInput('host') . '/' . $this->getInput('user') . '/' . $this->getInput('project') . '/issues/' . $this->getInput('issue'); - } break; - case 'Releases': { + + case 'Releases': return $this->getInput('host') . '/' . $this->getInput('user') . '/' . $this->getInput('project') . '/releases/'; - } break; - case 'Tags': { + + case 'Tags': return $this->getInput('host') . '/' . $this->getInput('user') . '/' . $this->getInput('project') . '/tags/'; - } break; - case 'Pull requests': { + + case 'Pull requests': return $this->getInput('host') . '/' . $this->getInput('user') . '/' . $this->getInput('project') . '/pulls/'; - } break; - case 'Single pull request': { + + case 'Single pull request': return $this->getInput('host') . '/' . $this->getInput('user') . '/' . $this->getInput('project') . '/pulls/' . $this->getInput('pull_request'); - } break; + default: return parent::getURI(); } } @@ -152,27 +152,27 @@ class GiteaBridge extends BridgeAbstract { $this->title = $html->find('[property="og:title"]', 0)->content; switch($this->queriedContext) { - case 'Commits': { + case 'Commits': $this->collectCommitsData($html); - } break; - case 'Issues': { + break; + case 'Issues': $this->collectIssuesData($html); - } break; - case 'Pull requests': { + break; + case 'Pull requests': $this->collectPullRequestsData($html); - } break; - case 'Single issue': { + break; + case 'Single issue': $this->collectSingleIssueOrPrData($html); - } break; - case 'Single pull request': { + break; + case 'Single pull request': $this->collectSingleIssueOrPrData($html); - } break; - case 'Releases': { + break; + case 'Releases': $this->collectReleasesData($html); - } break; - case 'Tags': { + break; + case 'Tags': $this->collectTagsData($html); - } break; + break; } } diff --git a/bridges/GithubIssueBridge.php b/bridges/GithubIssueBridge.php index 9c82e4e6..e3a0c73a 100644 --- a/bridges/GithubIssueBridge.php +++ b/bridges/GithubIssueBridge.php @@ -263,23 +263,22 @@ class GithubIssueBridge extends BridgeAbstract { $path_segments = array_values(array_filter(explode('/', $url_components['path']))); switch(count($path_segments)) { - case 2: { // Project issues + case 2: // Project issues list($user, $project) = $path_segments; $show_comments = 'off'; - } break; - case 3: { // Project issues with issue comments + break; + case 3: // Project issues with issue comments if($path_segments[2] !== static::URL_PATH) { return null; } list($user, $project) = $path_segments; $show_comments = 'on'; - } break; - case 4: { // Issue comments + break; + case 4: // Issue comments list($user, $project, /* issues */, $issue) = $path_segments; - } break; - default: { + break; + default: return null; - } } return array( diff --git a/bridges/GogsBridge.php b/bridges/GogsBridge.php index a2adc1f9..c90c8c57 100644 --- a/bridges/GogsBridge.php +++ b/bridges/GogsBridge.php @@ -64,30 +64,30 @@ class GogsBridge extends BridgeAbstract { public function getURI() { switch($this->queriedContext) { - case 'Commits': { + case 'Commits': return $this->getInput('host') . '/' . $this->getInput('user') . '/' . $this->getInput('project') . '/commits/' . $this->getInput('branch'); - } break; - case 'Issues': { + + case 'Issues': return $this->getInput('host') . '/' . $this->getInput('user') . '/' . $this->getInput('project') . '/issues/'; - } break; - case 'Single issue': { + + case 'Single issue': return $this->getInput('host') . '/' . $this->getInput('user') . '/' . $this->getInput('project') . '/issues/' . $this->getInput('issue'); - } break; - case 'Releases': { + + case 'Releases': return $this->getInput('host') . '/' . $this->getInput('user') . '/' . $this->getInput('project') . '/releases/'; - } break; + default: return parent::getURI(); } } @@ -115,18 +115,18 @@ class GogsBridge extends BridgeAbstract { $this->title = $html->find('[property="og:title"]', 0)->content; switch($this->queriedContext) { - case 'Commits': { + case 'Commits': $this->collectCommitsData($html); - } break; - case 'Issues': { + break; + case 'Issues': $this->collectIssuesData($html); - } break; - case 'Single issue': { + break; + case 'Single issue': $this->collectSingleIssueData($html); - } break; - case 'Releases': { + break; + case 'Releases': $this->collectReleasesData($html); - } break; + break; } } diff --git a/bridges/IPBBridge.php b/bridges/IPBBridge.php index 3895e383..af2ed390 100644 --- a/bridges/IPBBridge.php +++ b/bridges/IPBBridge.php @@ -68,7 +68,7 @@ class IPBBridge extends FeedExpander { case $this->isTopic($html): $this->collectTopic($html, $limit); break; - case $this->isForum($html); + case $this->isForum($html): $this->collectForum($html); break; default: diff --git a/bridges/KernelBugTrackerBridge.php b/bridges/KernelBugTrackerBridge.php index 0c56dedf..2677d717 100644 --- a/bridges/KernelBugTrackerBridge.php +++ b/bridges/KernelBugTrackerBridge.php @@ -78,7 +78,9 @@ Returns feeds for bug comments'; // Order comments switch($sorting) { case 'lf': $comments = array_reverse($comments, true); + // fall-through case 'of': + // fall-through default: // Nothing to do, keep original order } diff --git a/bridges/LWNprevBridge.php b/bridges/LWNprevBridge.php index 8033594b..40b1b129 100644 --- a/bridges/LWNprevBridge.php +++ b/bridges/LWNprevBridge.php @@ -8,7 +8,7 @@ class LWNprevBridge extends BridgeAbstract{ private $editionTimeStamp; - function getURI(){ + public function getURI(){ return self::URI . 'free/bigpage'; } @@ -144,6 +144,7 @@ EOD; if($cat->getAttribute('class') !== 'Cat2HL') { break; } + // fall-through? Looks like a bug case 'Cat2HL': $cat2 = $cat->textContent; $cat = $cat->previousSibling; @@ -155,6 +156,7 @@ EOD; if($cat->getAttribute('class') !== 'Cat1HL') { break; } + // fall-through? Looks like a bug case 'Cat1HL': $cat1 = $cat->textContent; $cats[0] = $cat1; diff --git a/bridges/MoinMoinBridge.php b/bridges/MoinMoinBridge.php index ca6e4581..1920c5a1 100644 --- a/bridges/MoinMoinBridge.php +++ b/bridges/MoinMoinBridge.php @@ -113,6 +113,7 @@ class MoinMoinBridge extends BridgeAbstract { break; } + // fall-through case 'separator': default: // Use contents from the current page $item['content'] = $this->cleanArticle($section[2]); diff --git a/bridges/NationalGeographicBridge.php b/bridges/NationalGeographicBridge.php index be8dfbd7..e5273a8e 100644 --- a/bridges/NationalGeographicBridge.php +++ b/bridges/NationalGeographicBridge.php @@ -48,12 +48,10 @@ class NationalGeographicBridge extends BridgeAbstract { public function getURI() { switch ($this->queriedContext) { - case self::CONTEXT_BY_TOPIC: { + case self::CONTEXT_BY_TOPIC: return self::URI . $this->getInput(self::PARAMETER_TOPIC); - } break; - default: { + default: return parent::getURI(); - } } } @@ -68,26 +66,21 @@ class NationalGeographicBridge extends BridgeAbstract { public function collectData() { $this->topicName = $this->getTopicName($this->getInput(self::PARAMETER_TOPIC)); switch($this->topicName) { - case self::TOPIC_MAGAZINE: { + case self::TOPIC_MAGAZINE: return $this->collectMagazine(); - } break; - case self::TOPIC_LATEST_STORIES: { + case self::TOPIC_LATEST_STORIES: return $this->collectLatestStories(); - } break; - default: { + default: returnServerError('Unknown topic: "' . $this->topicName . '"'); - } } } public function getName() { switch ($this->queriedContext) { - case self::CONTEXT_BY_TOPIC: { + case self::CONTEXT_BY_TOPIC: return static::NAME . ': ' . $this->topicName; - } break; - default: { + default: return parent::getName(); - } } } @@ -327,7 +320,7 @@ EOD; case 'video': $content .= $this->handleImages($module, $module['cmsType']); break; - case 'pullquote'; + case 'pullquote': $quote = $module['quote']; $author_name = ''; $authors = (isset($module['byLineProps']['authors']) ? $module['byLineProps']['authors'] : array()); diff --git a/bridges/PillowfortBridge.php b/bridges/PillowfortBridge.php index b78d83e3..527cc1c7 100644 --- a/bridges/PillowfortBridge.php +++ b/bridges/PillowfortBridge.php @@ -110,7 +110,7 @@ EOD; //preg_replace used for images with spaces in the url switch($dimensions) { - case 'None': { + case 'None': foreach($media as $image) { $imageURL = preg_replace('[ ]', '%20', $image['url']); $text .= <<