mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-22 09:35:28 +03:00
refactor: prepare for PSR2 (#2859)
This commit is contained in:
parent
d2313bddcc
commit
5076d09de6
24 changed files with 140 additions and 146 deletions
|
@ -15,7 +15,7 @@ class DisplayAction implements ActionInterface
|
||||||
{
|
{
|
||||||
public $userData = [];
|
public $userData = [];
|
||||||
|
|
||||||
private function get_return_code($error) {
|
private function getReturnCode($error) {
|
||||||
$returnCode = $error->getCode();
|
$returnCode = $error->getCode();
|
||||||
if ($returnCode === 301 || $returnCode === 302) {
|
if ($returnCode === 301 || $returnCode === 302) {
|
||||||
# Don't pass redirect codes to the exterior
|
# Don't pass redirect codes to the exterior
|
||||||
|
@ -184,7 +184,7 @@ class DisplayAction implements ActionInterface
|
||||||
|
|
||||||
$items[] = $item;
|
$items[] = $item;
|
||||||
} elseif(Configuration::getConfig('error', 'output') === 'http') {
|
} elseif(Configuration::getConfig('error', 'output') === 'http') {
|
||||||
header('Content-Type: text/html', true, $this->get_return_code($e));
|
header('Content-Type: text/html', true, $this->getReturnCode($e));
|
||||||
die(buildTransformException($e, $bridge));
|
die(buildTransformException($e, $bridge));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,10 @@ class BAEBridge extends BridgeAbstract {
|
||||||
|
|
||||||
$content = $htmlDetail->find('article p', 0)->innertext;
|
$content = $htmlDetail->find('article p', 0)->innertext;
|
||||||
if (!empty($this->getInput('keyword'))) {
|
if (!empty($this->getInput('keyword'))) {
|
||||||
$keyword = $this->remove_accents(strtolower($this->getInput('keyword')));
|
$keyword = $this->removeAccents(strtolower($this->getInput('keyword')));
|
||||||
$cleanTitle = $this->remove_accents(strtolower($item['title']));
|
$cleanTitle = $this->removeAccents(strtolower($item['title']));
|
||||||
if (strpos($cleanTitle, $keyword) === false) {
|
if (strpos($cleanTitle, $keyword) === false) {
|
||||||
$cleanContent = $this->remove_accents(strtolower($content));
|
$cleanContent = $this->removeAccents(strtolower($content));
|
||||||
if (strpos($cleanContent, $keyword) === false) {
|
if (strpos($cleanContent, $keyword) === false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class BAEBridge extends BridgeAbstract {
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function remove_accents($string) {
|
private function removeAccents($string) {
|
||||||
$chars = array(
|
$chars = array(
|
||||||
// Decompositions for Latin-1 Supplement
|
// Decompositions for Latin-1 Supplement
|
||||||
'ª' => 'a', 'º' => 'o',
|
'ª' => 'a', 'º' => 'o',
|
||||||
|
|
|
@ -39,7 +39,7 @@ class CVEDetailsBridge extends BridgeAbstract {
|
||||||
// Because of the optional product ID, we need to attach it if it is
|
// Because of the optional product ID, we need to attach it if it is
|
||||||
// set. The search result page has the exact same structure (with and
|
// set. The search result page has the exact same structure (with and
|
||||||
// without the product ID).
|
// without the product ID).
|
||||||
private function _buildURL() {
|
private function buildUrl() {
|
||||||
$url = self::URI . '/vulnerability-list/vendor_id-' . $this->getInput('vendor_id');
|
$url = self::URI . '/vulnerability-list/vendor_id-' . $this->getInput('vendor_id');
|
||||||
if ($this->getInput('product_id') !== '') {
|
if ($this->getInput('product_id') !== '') {
|
||||||
$url .= '/product_id-' . $this->getInput('product_id');
|
$url .= '/product_id-' . $this->getInput('product_id');
|
||||||
|
@ -54,8 +54,8 @@ class CVEDetailsBridge extends BridgeAbstract {
|
||||||
|
|
||||||
// Make the actual request to cvedetails.com and stores the response
|
// Make the actual request to cvedetails.com and stores the response
|
||||||
// (HTML) for later use and extract vendor and product from it.
|
// (HTML) for later use and extract vendor and product from it.
|
||||||
private function _fetchContent() {
|
private function fetchContent() {
|
||||||
$html = getSimpleHTMLDOM($this->_buildURL());
|
$html = getSimpleHTMLDOM($this->buildUrl());
|
||||||
$this->html = defaultLinkTo($html, self::URI);
|
$this->html = defaultLinkTo($html, self::URI);
|
||||||
|
|
||||||
$vendor = $html->find('#contentdiv > h1 > a', 0);
|
$vendor = $html->find('#contentdiv > h1 > a', 0);
|
||||||
|
@ -80,7 +80,7 @@ class CVEDetailsBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->html == null) {
|
if ($this->html == null) {
|
||||||
$this->_fetchContent();
|
$this->fetchContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = 'CVE Vulnerabilities for ' . $this->vendor;
|
$name = 'CVE Vulnerabilities for ' . $this->vendor;
|
||||||
|
@ -94,7 +94,7 @@ class CVEDetailsBridge extends BridgeAbstract {
|
||||||
// Pull the data from the HTML response and fill the items..
|
// Pull the data from the HTML response and fill the items..
|
||||||
public function collectData() {
|
public function collectData() {
|
||||||
if ($this->html == null) {
|
if ($this->html == null) {
|
||||||
$this->_fetchContent();
|
$this->fetchContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->html->find('#vulnslisttable .srrowns') as $i => $tr) {
|
foreach ($this->html->find('#vulnslisttable .srrowns') as $i => $tr) {
|
||||||
|
|
|
@ -395,7 +395,7 @@ class FacebookBridge extends BridgeAbstract {
|
||||||
/**
|
/**
|
||||||
* Bypass external link redirection
|
* Bypass external link redirection
|
||||||
*/
|
*/
|
||||||
private function unescape_fb_link($content){
|
private function unescapeFacebookLink($content){
|
||||||
return preg_replace_callback('/ href=\"([^"]+)\"/i', function($matches){
|
return preg_replace_callback('/ href=\"([^"]+)\"/i', function($matches){
|
||||||
if(is_array($matches) && count($matches) > 1) {
|
if(is_array($matches) && count($matches) > 1) {
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ class FacebookBridge extends BridgeAbstract {
|
||||||
/**
|
/**
|
||||||
* Remove Facebook's tracking code
|
* Remove Facebook's tracking code
|
||||||
*/
|
*/
|
||||||
private function remove_tracking_codes($content){
|
private function removeTrackingCodes($content){
|
||||||
return preg_replace_callback('/ href=\"([^"]+)\"/i', function($matches){
|
return preg_replace_callback('/ href=\"([^"]+)\"/i', function($matches){
|
||||||
if(is_array($matches) && count($matches) > 1) {
|
if(is_array($matches) && count($matches) > 1) {
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ class FacebookBridge extends BridgeAbstract {
|
||||||
* Convert textual representation of emoticons back to ASCII emoticons.
|
* Convert textual representation of emoticons back to ASCII emoticons.
|
||||||
* i.e. "<i><u>smile emoticon</u></i>" => ":)"
|
* i.e. "<i><u>smile emoticon</u></i>" => ":)"
|
||||||
*/
|
*/
|
||||||
private function unescape_fb_emote($content){
|
private function unescapeFacebookEmote($content){
|
||||||
return preg_replace_callback('/<i><u>([^ <>]+) ([^<>]+)<\/u><\/i>/i', function($matches){
|
return preg_replace_callback('/<i><u>([^ <>]+) ([^<>]+)<\/u><\/i>/i', function($matches){
|
||||||
static $facebook_emoticons = array(
|
static $facebook_emoticons = array(
|
||||||
'smile' => ':)',
|
'smile' => ':)',
|
||||||
|
@ -669,7 +669,7 @@ EOD;
|
||||||
// Remove html nodes, keep only img, links, basic formatting
|
// Remove html nodes, keep only img, links, basic formatting
|
||||||
$content = strip_tags($content, '<a><img><i><u><br><p>');
|
$content = strip_tags($content, '<a><img><i><u><br><p>');
|
||||||
|
|
||||||
$content = $this->unescape_fb_link($content);
|
$content = $this->unescapeFacebookLink($content);
|
||||||
|
|
||||||
// Clean useless html tag properties and fix link closing tags
|
// Clean useless html tag properties and fix link closing tags
|
||||||
foreach (array(
|
foreach (array(
|
||||||
|
@ -690,7 +690,7 @@ EOD;
|
||||||
|
|
||||||
$content = preg_replace('/<\/a [^>]+>/i', '</a>', $content);
|
$content = preg_replace('/<\/a [^>]+>/i', '</a>', $content);
|
||||||
|
|
||||||
$this->unescape_fb_emote($content);
|
$this->unescapeFacebookEmote($content);
|
||||||
|
|
||||||
// Restore links in the post before further parsing
|
// Restore links in the post before further parsing
|
||||||
$post = defaultLinkTo($post, self::URI);
|
$post = defaultLinkTo($post, self::URI);
|
||||||
|
@ -698,7 +698,7 @@ EOD;
|
||||||
// Restore links in the content before adding to the item
|
// Restore links in the content before adding to the item
|
||||||
$content = defaultLinkTo($content, self::URI);
|
$content = defaultLinkTo($content, self::URI);
|
||||||
|
|
||||||
$content = $this->remove_tracking_codes($content);
|
$content = $this->removeTrackingCodes($content);
|
||||||
|
|
||||||
// Retrieve date of the post
|
// Retrieve date of the post
|
||||||
$date = $post->find('abbr')[0];
|
$date = $post->find('abbr')[0];
|
||||||
|
|
|
@ -44,13 +44,13 @@ class FeedExpanderExampleBridge extends FeedExpander {
|
||||||
protected function parseItem($newsItem) {
|
protected function parseItem($newsItem) {
|
||||||
switch($this->getInput('version')) {
|
switch($this->getInput('version')) {
|
||||||
case 'rss_0_9_1':
|
case 'rss_0_9_1':
|
||||||
return $this->parseRSS_0_9_1_Item($newsItem);
|
return $this->parseRss091Item($newsItem);
|
||||||
break;
|
break;
|
||||||
case 'rss_1_0':
|
case 'rss_1_0':
|
||||||
return $this->parseRSS_1_0_Item($newsItem);
|
return $this->parseRss1Item($newsItem);
|
||||||
break;
|
break;
|
||||||
case 'rss_2_0':
|
case 'rss_2_0':
|
||||||
return $this->parseRSS_2_0_Item($newsItem);
|
return $this->parseRss2Item($newsItem);
|
||||||
break;
|
break;
|
||||||
case 'atom_1_0':
|
case 'atom_1_0':
|
||||||
return $this->parseATOMItem($newsItem);
|
return $this->parseATOMItem($newsItem);
|
||||||
|
|
|
@ -39,36 +39,36 @@ class FicbookBridge extends BridgeAbstract {
|
||||||
|
|
||||||
public function getURI() {
|
public function getURI() {
|
||||||
switch($this->queriedContext) {
|
switch($this->queriedContext) {
|
||||||
case 'Site News': {
|
case 'Site News':
|
||||||
// For some reason this is not HTTPS
|
// For some reason this is not HTTPS
|
||||||
return 'http://ficbook.net/sitenews';
|
return 'http://ficbook.net/sitenews';
|
||||||
}
|
|
||||||
case 'Fiction Updates': {
|
case 'Fiction Updates':
|
||||||
return self::URI
|
return self::URI
|
||||||
. 'readfic/'
|
. 'readfic/'
|
||||||
. urlencode($this->getInput('fiction_id'));
|
. urlencode($this->getInput('fiction_id'));
|
||||||
}
|
|
||||||
case 'Fiction Comments': {
|
case 'Fiction Comments':
|
||||||
return self::URI
|
return self::URI
|
||||||
. 'readfic/'
|
. 'readfic/'
|
||||||
. urlencode($this->getInput('fiction_id'))
|
. urlencode($this->getInput('fiction_id'))
|
||||||
. '/comments#content';
|
. '/comments#content';
|
||||||
}
|
|
||||||
default: return parent::getURI();
|
default: return parent::getURI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() {
|
public function getName() {
|
||||||
switch($this->queriedContext) {
|
switch($this->queriedContext) {
|
||||||
case 'Site News': {
|
case 'Site News':
|
||||||
return $this->queriedContext . ' | ' . self::NAME;
|
return $this->queriedContext . ' | ' . self::NAME;
|
||||||
}
|
|
||||||
case 'Fiction Updates': {
|
case 'Fiction Updates':
|
||||||
return $this->titleName . ' | ' . self::NAME;
|
return $this->titleName . ' | ' . self::NAME;
|
||||||
}
|
|
||||||
case 'Fiction Comments': {
|
case 'Fiction Comments':
|
||||||
return $this->titleName . ' | Comments | ' . self::NAME;
|
return $this->titleName . ' | Comments | ' . self::NAME;
|
||||||
}
|
|
||||||
default: return self::NAME;
|
default: return self::NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,48 +98,48 @@ class GiteaBridge extends BridgeAbstract {
|
||||||
|
|
||||||
public function getURI() {
|
public function getURI() {
|
||||||
switch($this->queriedContext) {
|
switch($this->queriedContext) {
|
||||||
case 'Commits': {
|
case 'Commits':
|
||||||
return $this->getInput('host')
|
return $this->getInput('host')
|
||||||
. '/' . $this->getInput('user')
|
. '/' . $this->getInput('user')
|
||||||
. '/' . $this->getInput('project')
|
. '/' . $this->getInput('project')
|
||||||
. '/commits/' . $this->getInput('branch');
|
. '/commits/' . $this->getInput('branch');
|
||||||
} break;
|
|
||||||
case 'Issues': {
|
case 'Issues':
|
||||||
return $this->getInput('host')
|
return $this->getInput('host')
|
||||||
. '/' . $this->getInput('user')
|
. '/' . $this->getInput('user')
|
||||||
. '/' . $this->getInput('project')
|
. '/' . $this->getInput('project')
|
||||||
. '/issues/';
|
. '/issues/';
|
||||||
} break;
|
|
||||||
case 'Single issue': {
|
case 'Single issue':
|
||||||
return $this->getInput('host')
|
return $this->getInput('host')
|
||||||
. '/' . $this->getInput('user')
|
. '/' . $this->getInput('user')
|
||||||
. '/' . $this->getInput('project')
|
. '/' . $this->getInput('project')
|
||||||
. '/issues/' . $this->getInput('issue');
|
. '/issues/' . $this->getInput('issue');
|
||||||
} break;
|
|
||||||
case 'Releases': {
|
case 'Releases':
|
||||||
return $this->getInput('host')
|
return $this->getInput('host')
|
||||||
. '/' . $this->getInput('user')
|
. '/' . $this->getInput('user')
|
||||||
. '/' . $this->getInput('project')
|
. '/' . $this->getInput('project')
|
||||||
. '/releases/';
|
. '/releases/';
|
||||||
} break;
|
|
||||||
case 'Tags': {
|
case 'Tags':
|
||||||
return $this->getInput('host')
|
return $this->getInput('host')
|
||||||
. '/' . $this->getInput('user')
|
. '/' . $this->getInput('user')
|
||||||
. '/' . $this->getInput('project')
|
. '/' . $this->getInput('project')
|
||||||
. '/tags/';
|
. '/tags/';
|
||||||
} break;
|
|
||||||
case 'Pull requests': {
|
case 'Pull requests':
|
||||||
return $this->getInput('host')
|
return $this->getInput('host')
|
||||||
. '/' . $this->getInput('user')
|
. '/' . $this->getInput('user')
|
||||||
. '/' . $this->getInput('project')
|
. '/' . $this->getInput('project')
|
||||||
. '/pulls/';
|
. '/pulls/';
|
||||||
} break;
|
|
||||||
case 'Single pull request': {
|
case 'Single pull request':
|
||||||
return $this->getInput('host')
|
return $this->getInput('host')
|
||||||
. '/' . $this->getInput('user')
|
. '/' . $this->getInput('user')
|
||||||
. '/' . $this->getInput('project')
|
. '/' . $this->getInput('project')
|
||||||
. '/pulls/' . $this->getInput('pull_request');
|
. '/pulls/' . $this->getInput('pull_request');
|
||||||
} break;
|
|
||||||
default: return parent::getURI();
|
default: return parent::getURI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,27 +152,27 @@ class GiteaBridge extends BridgeAbstract {
|
||||||
$this->title = $html->find('[property="og:title"]', 0)->content;
|
$this->title = $html->find('[property="og:title"]', 0)->content;
|
||||||
|
|
||||||
switch($this->queriedContext) {
|
switch($this->queriedContext) {
|
||||||
case 'Commits': {
|
case 'Commits':
|
||||||
$this->collectCommitsData($html);
|
$this->collectCommitsData($html);
|
||||||
} break;
|
break;
|
||||||
case 'Issues': {
|
case 'Issues':
|
||||||
$this->collectIssuesData($html);
|
$this->collectIssuesData($html);
|
||||||
} break;
|
break;
|
||||||
case 'Pull requests': {
|
case 'Pull requests':
|
||||||
$this->collectPullRequestsData($html);
|
$this->collectPullRequestsData($html);
|
||||||
} break;
|
break;
|
||||||
case 'Single issue': {
|
case 'Single issue':
|
||||||
$this->collectSingleIssueOrPrData($html);
|
$this->collectSingleIssueOrPrData($html);
|
||||||
} break;
|
break;
|
||||||
case 'Single pull request': {
|
case 'Single pull request':
|
||||||
$this->collectSingleIssueOrPrData($html);
|
$this->collectSingleIssueOrPrData($html);
|
||||||
} break;
|
break;
|
||||||
case 'Releases': {
|
case 'Releases':
|
||||||
$this->collectReleasesData($html);
|
$this->collectReleasesData($html);
|
||||||
} break;
|
break;
|
||||||
case 'Tags': {
|
case 'Tags':
|
||||||
$this->collectTagsData($html);
|
$this->collectTagsData($html);
|
||||||
} break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -263,23 +263,22 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||||
$path_segments = array_values(array_filter(explode('/', $url_components['path'])));
|
$path_segments = array_values(array_filter(explode('/', $url_components['path'])));
|
||||||
|
|
||||||
switch(count($path_segments)) {
|
switch(count($path_segments)) {
|
||||||
case 2: { // Project issues
|
case 2: // Project issues
|
||||||
list($user, $project) = $path_segments;
|
list($user, $project) = $path_segments;
|
||||||
$show_comments = 'off';
|
$show_comments = 'off';
|
||||||
} break;
|
break;
|
||||||
case 3: { // Project issues with issue comments
|
case 3: // Project issues with issue comments
|
||||||
if($path_segments[2] !== static::URL_PATH) {
|
if($path_segments[2] !== static::URL_PATH) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
list($user, $project) = $path_segments;
|
list($user, $project) = $path_segments;
|
||||||
$show_comments = 'on';
|
$show_comments = 'on';
|
||||||
} break;
|
break;
|
||||||
case 4: { // Issue comments
|
case 4: // Issue comments
|
||||||
list($user, $project, /* issues */, $issue) = $path_segments;
|
list($user, $project, /* issues */, $issue) = $path_segments;
|
||||||
} break;
|
break;
|
||||||
default: {
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|
|
@ -64,30 +64,30 @@ class GogsBridge extends BridgeAbstract {
|
||||||
|
|
||||||
public function getURI() {
|
public function getURI() {
|
||||||
switch($this->queriedContext) {
|
switch($this->queriedContext) {
|
||||||
case 'Commits': {
|
case 'Commits':
|
||||||
return $this->getInput('host')
|
return $this->getInput('host')
|
||||||
. '/' . $this->getInput('user')
|
. '/' . $this->getInput('user')
|
||||||
. '/' . $this->getInput('project')
|
. '/' . $this->getInput('project')
|
||||||
. '/commits/' . $this->getInput('branch');
|
. '/commits/' . $this->getInput('branch');
|
||||||
} break;
|
|
||||||
case 'Issues': {
|
case 'Issues':
|
||||||
return $this->getInput('host')
|
return $this->getInput('host')
|
||||||
. '/' . $this->getInput('user')
|
. '/' . $this->getInput('user')
|
||||||
. '/' . $this->getInput('project')
|
. '/' . $this->getInput('project')
|
||||||
. '/issues/';
|
. '/issues/';
|
||||||
} break;
|
|
||||||
case 'Single issue': {
|
case 'Single issue':
|
||||||
return $this->getInput('host')
|
return $this->getInput('host')
|
||||||
. '/' . $this->getInput('user')
|
. '/' . $this->getInput('user')
|
||||||
. '/' . $this->getInput('project')
|
. '/' . $this->getInput('project')
|
||||||
. '/issues/' . $this->getInput('issue');
|
. '/issues/' . $this->getInput('issue');
|
||||||
} break;
|
|
||||||
case 'Releases': {
|
case 'Releases':
|
||||||
return $this->getInput('host')
|
return $this->getInput('host')
|
||||||
. '/' . $this->getInput('user')
|
. '/' . $this->getInput('user')
|
||||||
. '/' . $this->getInput('project')
|
. '/' . $this->getInput('project')
|
||||||
. '/releases/';
|
. '/releases/';
|
||||||
} break;
|
|
||||||
default: return parent::getURI();
|
default: return parent::getURI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,18 +115,18 @@ class GogsBridge extends BridgeAbstract {
|
||||||
$this->title = $html->find('[property="og:title"]', 0)->content;
|
$this->title = $html->find('[property="og:title"]', 0)->content;
|
||||||
|
|
||||||
switch($this->queriedContext) {
|
switch($this->queriedContext) {
|
||||||
case 'Commits': {
|
case 'Commits':
|
||||||
$this->collectCommitsData($html);
|
$this->collectCommitsData($html);
|
||||||
} break;
|
break;
|
||||||
case 'Issues': {
|
case 'Issues':
|
||||||
$this->collectIssuesData($html);
|
$this->collectIssuesData($html);
|
||||||
} break;
|
break;
|
||||||
case 'Single issue': {
|
case 'Single issue':
|
||||||
$this->collectSingleIssueData($html);
|
$this->collectSingleIssueData($html);
|
||||||
} break;
|
break;
|
||||||
case 'Releases': {
|
case 'Releases':
|
||||||
$this->collectReleasesData($html);
|
$this->collectReleasesData($html);
|
||||||
} break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ class IPBBridge extends FeedExpander {
|
||||||
case $this->isTopic($html):
|
case $this->isTopic($html):
|
||||||
$this->collectTopic($html, $limit);
|
$this->collectTopic($html, $limit);
|
||||||
break;
|
break;
|
||||||
case $this->isForum($html);
|
case $this->isForum($html):
|
||||||
$this->collectForum($html);
|
$this->collectForum($html);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -78,7 +78,9 @@ Returns feeds for bug comments';
|
||||||
// Order comments
|
// Order comments
|
||||||
switch($sorting) {
|
switch($sorting) {
|
||||||
case 'lf': $comments = array_reverse($comments, true);
|
case 'lf': $comments = array_reverse($comments, true);
|
||||||
|
// fall-through
|
||||||
case 'of':
|
case 'of':
|
||||||
|
// fall-through
|
||||||
default: // Nothing to do, keep original order
|
default: // Nothing to do, keep original order
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ class LWNprevBridge extends BridgeAbstract{
|
||||||
|
|
||||||
private $editionTimeStamp;
|
private $editionTimeStamp;
|
||||||
|
|
||||||
function getURI(){
|
public function getURI(){
|
||||||
return self::URI . 'free/bigpage';
|
return self::URI . 'free/bigpage';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +144,7 @@ EOD;
|
||||||
if($cat->getAttribute('class') !== 'Cat2HL') {
|
if($cat->getAttribute('class') !== 'Cat2HL') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fall-through? Looks like a bug
|
||||||
case 'Cat2HL':
|
case 'Cat2HL':
|
||||||
$cat2 = $cat->textContent;
|
$cat2 = $cat->textContent;
|
||||||
$cat = $cat->previousSibling;
|
$cat = $cat->previousSibling;
|
||||||
|
@ -155,6 +156,7 @@ EOD;
|
||||||
if($cat->getAttribute('class') !== 'Cat1HL') {
|
if($cat->getAttribute('class') !== 'Cat1HL') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fall-through? Looks like a bug
|
||||||
case 'Cat1HL':
|
case 'Cat1HL':
|
||||||
$cat1 = $cat->textContent;
|
$cat1 = $cat->textContent;
|
||||||
$cats[0] = $cat1;
|
$cats[0] = $cat1;
|
||||||
|
|
|
@ -113,6 +113,7 @@ class MoinMoinBridge extends BridgeAbstract {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fall-through
|
||||||
case 'separator':
|
case 'separator':
|
||||||
default: // Use contents from the current page
|
default: // Use contents from the current page
|
||||||
$item['content'] = $this->cleanArticle($section[2]);
|
$item['content'] = $this->cleanArticle($section[2]);
|
||||||
|
|
|
@ -48,12 +48,10 @@ class NationalGeographicBridge extends BridgeAbstract {
|
||||||
|
|
||||||
public function getURI() {
|
public function getURI() {
|
||||||
switch ($this->queriedContext) {
|
switch ($this->queriedContext) {
|
||||||
case self::CONTEXT_BY_TOPIC: {
|
case self::CONTEXT_BY_TOPIC:
|
||||||
return self::URI . $this->getInput(self::PARAMETER_TOPIC);
|
return self::URI . $this->getInput(self::PARAMETER_TOPIC);
|
||||||
} break;
|
default:
|
||||||
default: {
|
|
||||||
return parent::getURI();
|
return parent::getURI();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,26 +66,21 @@ class NationalGeographicBridge extends BridgeAbstract {
|
||||||
public function collectData() {
|
public function collectData() {
|
||||||
$this->topicName = $this->getTopicName($this->getInput(self::PARAMETER_TOPIC));
|
$this->topicName = $this->getTopicName($this->getInput(self::PARAMETER_TOPIC));
|
||||||
switch($this->topicName) {
|
switch($this->topicName) {
|
||||||
case self::TOPIC_MAGAZINE: {
|
case self::TOPIC_MAGAZINE:
|
||||||
return $this->collectMagazine();
|
return $this->collectMagazine();
|
||||||
} break;
|
case self::TOPIC_LATEST_STORIES:
|
||||||
case self::TOPIC_LATEST_STORIES: {
|
|
||||||
return $this->collectLatestStories();
|
return $this->collectLatestStories();
|
||||||
} break;
|
default:
|
||||||
default: {
|
|
||||||
returnServerError('Unknown topic: "' . $this->topicName . '"');
|
returnServerError('Unknown topic: "' . $this->topicName . '"');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() {
|
public function getName() {
|
||||||
switch ($this->queriedContext) {
|
switch ($this->queriedContext) {
|
||||||
case self::CONTEXT_BY_TOPIC: {
|
case self::CONTEXT_BY_TOPIC:
|
||||||
return static::NAME . ': ' . $this->topicName;
|
return static::NAME . ': ' . $this->topicName;
|
||||||
} break;
|
default:
|
||||||
default: {
|
|
||||||
return parent::getName();
|
return parent::getName();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +320,7 @@ EOD;
|
||||||
case 'video':
|
case 'video':
|
||||||
$content .= $this->handleImages($module, $module['cmsType']);
|
$content .= $this->handleImages($module, $module['cmsType']);
|
||||||
break;
|
break;
|
||||||
case 'pullquote';
|
case 'pullquote':
|
||||||
$quote = $module['quote'];
|
$quote = $module['quote'];
|
||||||
$author_name = '';
|
$author_name = '';
|
||||||
$authors = (isset($module['byLineProps']['authors']) ? $module['byLineProps']['authors'] : array());
|
$authors = (isset($module['byLineProps']['authors']) ? $module['byLineProps']['authors'] : array());
|
||||||
|
|
|
@ -110,7 +110,7 @@ EOD;
|
||||||
//preg_replace used for images with spaces in the url
|
//preg_replace used for images with spaces in the url
|
||||||
|
|
||||||
switch($dimensions) {
|
switch($dimensions) {
|
||||||
case 'None': {
|
case 'None':
|
||||||
foreach($media as $image) {
|
foreach($media as $image) {
|
||||||
$imageURL = preg_replace('[ ]', '%20', $image['url']);
|
$imageURL = preg_replace('[ ]', '%20', $image['url']);
|
||||||
$text .= <<<EOD
|
$text .= <<<EOD
|
||||||
|
@ -120,8 +120,8 @@ EOD;
|
||||||
EOD;
|
EOD;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 'Small': {
|
case 'Small':
|
||||||
foreach($media as $image) {
|
foreach($media as $image) {
|
||||||
$imageURL = preg_replace('[ ]', '%20', $image['small_image_url']);
|
$imageURL = preg_replace('[ ]', '%20', $image['small_image_url']);
|
||||||
$text .= <<<EOD
|
$text .= <<<EOD
|
||||||
|
@ -134,8 +134,8 @@ EOD;
|
||||||
EOD;
|
EOD;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 'Full': {
|
case 'Full':
|
||||||
foreach($media as $image) {
|
foreach($media as $image) {
|
||||||
$imageURL = preg_replace('[ ]', '%20', $image['url']);
|
$imageURL = preg_replace('[ ]', '%20', $image['url']);
|
||||||
$text .= <<<EOD
|
$text .= <<<EOD
|
||||||
|
@ -148,7 +148,7 @@ EOD;
|
||||||
EOD;
|
EOD;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ class RaceDepartmentBridge extends FeedExpander {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parseItem($feedItem) {
|
protected function parseItem($feedItem) {
|
||||||
$item = parent::parseRSS_2_0_Item($feedItem);
|
$item = parent::parseRss2Item($feedItem);
|
||||||
|
|
||||||
//fetch page
|
//fetch page
|
||||||
$articlePage = getSimpleHTMLDOMCached($feedItem->link);
|
$articlePage = getSimpleHTMLDOMCached($feedItem->link);
|
||||||
|
|
|
@ -266,8 +266,10 @@ EOD
|
||||||
switch($this->queriedContext) {
|
switch($this->queriedContext) {
|
||||||
case 'By keyword or hashtag':
|
case 'By keyword or hashtag':
|
||||||
returnServerError('No results for this query.');
|
returnServerError('No results for this query.');
|
||||||
|
// fall-through
|
||||||
case 'By username':
|
case 'By username':
|
||||||
returnServerError('Requested username can\'t be found.');
|
returnServerError('Requested username can\'t be found.');
|
||||||
|
// fall-through
|
||||||
case 'By list':
|
case 'By list':
|
||||||
returnServerError('Requested username or list can\'t be found');
|
returnServerError('Requested username or list can\'t be found');
|
||||||
}
|
}
|
||||||
|
@ -613,6 +615,7 @@ EOD;
|
||||||
} catch (HttpException $e) {
|
} catch (HttpException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
case 401:
|
case 401:
|
||||||
|
// fall-through
|
||||||
case 403:
|
case 403:
|
||||||
if ($retries) {
|
if ($retries) {
|
||||||
$retries--;
|
$retries--;
|
||||||
|
@ -620,6 +623,7 @@ EOD;
|
||||||
$this->getApiKey(1);
|
$this->getApiKey(1);
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
|
// fall-through
|
||||||
default:
|
default:
|
||||||
$code = $e->getCode();
|
$code = $e->getCode();
|
||||||
$data = $e->getMessage();
|
$data = $e->getMessage();
|
||||||
|
|
|
@ -259,10 +259,13 @@ EOD
|
||||||
switch($this->queriedContext) {
|
switch($this->queriedContext) {
|
||||||
case 'By keyword or hashtag':
|
case 'By keyword or hashtag':
|
||||||
returnServerError('No results for this query.');
|
returnServerError('No results for this query.');
|
||||||
|
// fall-through
|
||||||
case 'By username':
|
case 'By username':
|
||||||
returnServerError('Requested username cannnot be found.');
|
returnServerError('Requested username cannnot be found.');
|
||||||
|
// fall-through
|
||||||
case 'By list ID':
|
case 'By list ID':
|
||||||
returnServerError('Requested list cannnot be found');
|
returnServerError('Requested list cannnot be found');
|
||||||
|
// fall-through
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,9 @@ if (isset($argv)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$actionFac = new ActionFactory();
|
||||||
|
|
||||||
$actionFac = new \ActionFactory();
|
if (array_key_exists('action', $params)) {
|
||||||
|
|
||||||
if(array_key_exists('action', $params)) {
|
|
||||||
$action = $actionFac->create($params['action']);
|
$action = $actionFac->create($params['action']);
|
||||||
$action->userData = $params;
|
$action->userData = $params;
|
||||||
$action->execute();
|
$action->execute();
|
||||||
|
@ -25,8 +24,9 @@ try {
|
||||||
$showInactive = filter_input(INPUT_GET, 'show_inactive', FILTER_VALIDATE_BOOLEAN);
|
$showInactive = filter_input(INPUT_GET, 'show_inactive', FILTER_VALIDATE_BOOLEAN);
|
||||||
echo BridgeList::create($showInactive);
|
echo BridgeList::create($showInactive);
|
||||||
}
|
}
|
||||||
} catch(\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
error_log($e);
|
error_log($e);
|
||||||
|
|
||||||
$code = $e->getCode();
|
$code = $e->getCode();
|
||||||
if ($code !== -1) {
|
if ($code !== -1) {
|
||||||
header('Content-Type: text/plain', true, $code);
|
header('Content-Type: text/plain', true, $code);
|
||||||
|
|
|
@ -22,5 +22,5 @@ interface ActionInterface {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function execute();
|
public function execute();
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,7 +286,7 @@ This bridge is not fetching its content through a secure connection</div>';
|
||||||
* @param bool $isActive Indicates if the bridge is active or not
|
* @param bool $isActive Indicates if the bridge is active or not
|
||||||
* @return string The bridge card
|
* @return string The bridge card
|
||||||
*/
|
*/
|
||||||
static function displayBridgeCard($bridgeName, $formats, $isActive = true){
|
public static function displayBridgeCard($bridgeName, $formats, $isActive = true){
|
||||||
|
|
||||||
$bridgeFac = new \BridgeFactory();
|
$bridgeFac = new \BridgeFactory();
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ EOD;
|
||||||
* if enabled.
|
* if enabled.
|
||||||
* @return string The home page
|
* @return string The home page
|
||||||
*/
|
*/
|
||||||
static function create($showInactive = true) {
|
public static function create($showInactive = true) {
|
||||||
|
|
||||||
$totalBridges = 0;
|
$totalBridges = 0;
|
||||||
$totalActiveBridges = 0;
|
$totalActiveBridges = 0;
|
||||||
|
|
|
@ -111,14 +111,17 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
case isset($rssContent->item[0]):
|
case isset($rssContent->item[0]):
|
||||||
Debug::log('Detected RSS 1.0 format');
|
Debug::log('Detected RSS 1.0 format');
|
||||||
$this->feedType = self::FEED_TYPE_RSS_1_0;
|
$this->feedType = self::FEED_TYPE_RSS_1_0;
|
||||||
|
$this->collectRss1($rssContent, $maxItems);
|
||||||
break;
|
break;
|
||||||
case isset($rssContent->channel[0]):
|
case isset($rssContent->channel[0]):
|
||||||
Debug::log('Detected RSS 0.9x or 2.0 format');
|
Debug::log('Detected RSS 0.9x or 2.0 format');
|
||||||
$this->feedType = self::FEED_TYPE_RSS_2_0;
|
$this->feedType = self::FEED_TYPE_RSS_2_0;
|
||||||
|
$this->collectRss2($rssContent, $maxItems);
|
||||||
break;
|
break;
|
||||||
case isset($rssContent->entry[0]):
|
case isset($rssContent->entry[0]):
|
||||||
Debug::log('Detected ATOM format');
|
Debug::log('Detected ATOM format');
|
||||||
$this->feedType = self::FEED_TYPE_ATOM_1_0;
|
$this->feedType = self::FEED_TYPE_ATOM_1_0;
|
||||||
|
$this->collectAtom1($rssContent, $maxItems);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Debug::log('Unknown feed format/version');
|
Debug::log('Unknown feed format/version');
|
||||||
|
@ -126,9 +129,6 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log('Calling function "collect_' . $this->feedType . '_data"');
|
|
||||||
$this->{'collect_' . $this->feedType . '_data'}($rssContent, $maxItems);
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,8 +145,8 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
* @todo Instead of passing $maxItems to all functions, just add all items
|
* @todo Instead of passing $maxItems to all functions, just add all items
|
||||||
* and remove excessive items later.
|
* and remove excessive items later.
|
||||||
*/
|
*/
|
||||||
protected function collect_RSS_1_0_data($rssContent, $maxItems){
|
protected function collectRss1($rssContent, $maxItems){
|
||||||
$this->load_RSS_2_0_feed_data($rssContent->channel[0]);
|
$this->loadRss2Data($rssContent->channel[0]);
|
||||||
foreach($rssContent->item as $item) {
|
foreach($rssContent->item as $item) {
|
||||||
Debug::log('parsing item ' . var_export($item, true));
|
Debug::log('parsing item ' . var_export($item, true));
|
||||||
$tmp_item = $this->parseItem($item);
|
$tmp_item = $this->parseItem($item);
|
||||||
|
@ -170,13 +170,13 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
* @todo Instead of passing $maxItems to all functions, just add all items
|
* @todo Instead of passing $maxItems to all functions, just add all items
|
||||||
* and remove excessive items later.
|
* and remove excessive items later.
|
||||||
*/
|
*/
|
||||||
protected function collect_RSS_2_0_data($rssContent, $maxItems){
|
protected function collectRss2($rssContent, $maxItems){
|
||||||
$rssContent = $rssContent->channel[0];
|
$rssContent = $rssContent->channel[0];
|
||||||
Debug::log('RSS content is ===========\n'
|
Debug::log('RSS content is ===========\n'
|
||||||
. var_export($rssContent, true)
|
. var_export($rssContent, true)
|
||||||
. '===========');
|
. '===========');
|
||||||
|
|
||||||
$this->load_RSS_2_0_feed_data($rssContent);
|
$this->loadRss2Data($rssContent);
|
||||||
foreach($rssContent->item as $item) {
|
foreach($rssContent->item as $item) {
|
||||||
Debug::log('parsing item ' . var_export($item, true));
|
Debug::log('parsing item ' . var_export($item, true));
|
||||||
$tmp_item = $this->parseItem($item);
|
$tmp_item = $this->parseItem($item);
|
||||||
|
@ -200,8 +200,8 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
* @todo Instead of passing $maxItems to all functions, just add all items
|
* @todo Instead of passing $maxItems to all functions, just add all items
|
||||||
* and remove excessive items later.
|
* and remove excessive items later.
|
||||||
*/
|
*/
|
||||||
protected function collect_ATOM_1_0_data($content, $maxItems){
|
protected function collectAtom1($content, $maxItems){
|
||||||
$this->load_ATOM_feed_data($content);
|
$this->loadAtomData($content);
|
||||||
foreach($content->entry as $item) {
|
foreach($content->entry as $item) {
|
||||||
Debug::log('parsing item ' . var_export($item, true));
|
Debug::log('parsing item ' . var_export($item, true));
|
||||||
$tmp_item = $this->parseItem($item);
|
$tmp_item = $this->parseItem($item);
|
||||||
|
@ -212,16 +212,6 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert RSS 2.0 time to timestamp
|
|
||||||
*
|
|
||||||
* @param object $item A feed item
|
|
||||||
* @return int The timestamp
|
|
||||||
*/
|
|
||||||
protected function RSS_2_0_time_to_timestamp($item){
|
|
||||||
return DateTime::createFromFormat('D, d M Y H:i:s e', $item->pubDate)->getTimestamp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load RSS 2.0 feed data into RSS-Bridge
|
* Load RSS 2.0 feed data into RSS-Bridge
|
||||||
*
|
*
|
||||||
|
@ -230,7 +220,7 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
*
|
*
|
||||||
* @todo set title, link, description, language, and so on
|
* @todo set title, link, description, language, and so on
|
||||||
*/
|
*/
|
||||||
protected function load_RSS_2_0_feed_data($rssContent){
|
protected function loadRss2Data($rssContent){
|
||||||
$this->title = trim((string)$rssContent->title);
|
$this->title = trim((string)$rssContent->title);
|
||||||
$this->uri = trim((string)$rssContent->link);
|
$this->uri = trim((string)$rssContent->link);
|
||||||
|
|
||||||
|
@ -245,7 +235,7 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
* @param object $content The Atom content
|
* @param object $content The Atom content
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function load_ATOM_feed_data($content){
|
protected function loadAtomData($content){
|
||||||
$this->title = (string)$content->title;
|
$this->title = (string)$content->title;
|
||||||
|
|
||||||
// Find best link (only one, or first of 'alternate')
|
// Find best link (only one, or first of 'alternate')
|
||||||
|
@ -282,7 +272,7 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
*/
|
*/
|
||||||
protected function parseATOMItem($feedItem){
|
protected function parseATOMItem($feedItem){
|
||||||
// Some ATOM entries also contain RSS 2.0 fields
|
// Some ATOM entries also contain RSS 2.0 fields
|
||||||
$item = $this->parseRSS_2_0_Item($feedItem);
|
$item = $this->parseRss2Item($feedItem);
|
||||||
|
|
||||||
if(isset($feedItem->id)) $item['uri'] = (string)$feedItem->id;
|
if(isset($feedItem->id)) $item['uri'] = (string)$feedItem->id;
|
||||||
if(isset($feedItem->title)) $item['title'] = (string)$feedItem->title;
|
if(isset($feedItem->title)) $item['title'] = (string)$feedItem->title;
|
||||||
|
@ -317,7 +307,7 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
* @todo To reduce confusion, the RSS-Bridge item should maybe have a class
|
* @todo To reduce confusion, the RSS-Bridge item should maybe have a class
|
||||||
* of its own?
|
* of its own?
|
||||||
*/
|
*/
|
||||||
protected function parseRSS_0_9_1_Item($feedItem){
|
protected function parseRss091Item($feedItem){
|
||||||
$item = array();
|
$item = array();
|
||||||
if(isset($feedItem->link)) $item['uri'] = (string)$feedItem->link;
|
if(isset($feedItem->link)) $item['uri'] = (string)$feedItem->link;
|
||||||
if(isset($feedItem->title)) $item['title'] = (string)$feedItem->title;
|
if(isset($feedItem->title)) $item['title'] = (string)$feedItem->title;
|
||||||
|
@ -338,9 +328,9 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
* @todo To reduce confusion, the RSS-Bridge item should maybe have a class
|
* @todo To reduce confusion, the RSS-Bridge item should maybe have a class
|
||||||
* of its own?
|
* of its own?
|
||||||
*/
|
*/
|
||||||
protected function parseRSS_1_0_Item($feedItem){
|
protected function parseRss1Item($feedItem){
|
||||||
// 1.0 adds optional elements around the 0.91 standard
|
// 1.0 adds optional elements around the 0.91 standard
|
||||||
$item = $this->parseRSS_0_9_1_Item($feedItem);
|
$item = $this->parseRss091Item($feedItem);
|
||||||
|
|
||||||
$namespaces = $feedItem->getNamespaces(true);
|
$namespaces = $feedItem->getNamespaces(true);
|
||||||
if(isset($namespaces['dc'])) {
|
if(isset($namespaces['dc'])) {
|
||||||
|
@ -362,9 +352,9 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
* @todo To reduce confusion, the RSS-Bridge item should maybe have a class
|
* @todo To reduce confusion, the RSS-Bridge item should maybe have a class
|
||||||
* of its own?
|
* of its own?
|
||||||
*/
|
*/
|
||||||
protected function parseRSS_2_0_Item($feedItem){
|
protected function parseRss2Item($feedItem){
|
||||||
// Primary data is compatible to 0.91 with some additional data
|
// Primary data is compatible to 0.91 with some additional data
|
||||||
$item = $this->parseRSS_0_9_1_Item($feedItem);
|
$item = $this->parseRss091Item($feedItem);
|
||||||
|
|
||||||
$namespaces = $feedItem->getNamespaces(true);
|
$namespaces = $feedItem->getNamespaces(true);
|
||||||
if(isset($namespaces['dc'])) $dc = $feedItem->children($namespaces['dc']);
|
if(isset($namespaces['dc'])) $dc = $feedItem->children($namespaces['dc']);
|
||||||
|
@ -418,10 +408,10 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
protected function parseItem($item){
|
protected function parseItem($item){
|
||||||
switch($this->feedType) {
|
switch($this->feedType) {
|
||||||
case self::FEED_TYPE_RSS_1_0:
|
case self::FEED_TYPE_RSS_1_0:
|
||||||
return $this->parseRSS_1_0_Item($item);
|
return $this->parseRss1Item($item);
|
||||||
break;
|
break;
|
||||||
case self::FEED_TYPE_RSS_2_0:
|
case self::FEED_TYPE_RSS_2_0:
|
||||||
return $this->parseRSS_2_0_Item($item);
|
return $this->parseRss2Item($item);
|
||||||
break;
|
break;
|
||||||
case self::FEED_TYPE_ATOM_1_0:
|
case self::FEED_TYPE_ATOM_1_0:
|
||||||
return $this->parseATOMItem($item);
|
return $this->parseATOMItem($item);
|
||||||
|
|
|
@ -483,7 +483,7 @@ class FeedItem {
|
||||||
* @param string $name Property name
|
* @param string $name Property name
|
||||||
* @param mixed $value Property value
|
* @param mixed $value Property value
|
||||||
*/
|
*/
|
||||||
function __set($name, $value) {
|
public function __set($name, $value) {
|
||||||
switch($name) {
|
switch($name) {
|
||||||
case 'uri': $this->setURI($value); break;
|
case 'uri': $this->setURI($value); break;
|
||||||
case 'title': $this->setTitle($value); break;
|
case 'title': $this->setTitle($value); break;
|
||||||
|
@ -506,7 +506,7 @@ class FeedItem {
|
||||||
* @param string $name Property name
|
* @param string $name Property name
|
||||||
* @return mixed Property value
|
* @return mixed Property value
|
||||||
*/
|
*/
|
||||||
function __get($name) {
|
public function __get($name) {
|
||||||
switch($name) {
|
switch($name) {
|
||||||
case 'uri': return $this->getURI();
|
case 'uri': return $this->getURI();
|
||||||
case 'title': return $this->getTitle();
|
case 'title': return $this->getTitle();
|
||||||
|
|
Loading…
Reference in a new issue