1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-19 06:42:14 +02:00

bridges: Replace returnError function with more specific

Replacements depend on original error code:
400: returnClientError
404: returnServerError
500: returnServerError
501: returnServerError
This commit is contained in:
logmanoriginal
2016-08-17 14:45:08 +02:00
parent 73a1bcf3d6
commit 74f0572d91
124 changed files with 401 additions and 400 deletions

View File

@@ -12,7 +12,7 @@ class WordPressBridge extends BridgeAbstract {
$this->name = "Wordpress Bridge";
$this->uri = "https://wordpress.org/";
$this->description = "Returns the 3 newest full posts of a Wordpress blog";
$this->update = "2016-08-15";
$this->update = '2016-08-17';
$this->parameters[] =
'[
@@ -60,11 +60,11 @@ class WordPressBridge extends BridgeAbstract {
$this->processParams($param);
if (!$this->hasUrl()) {
$this->returnError('You must specify a URL', 400);
$this->returnClientError('You must specify a URL');
}
$this->url = $this->url.'/feed/atom';
$html = $this->file_get_html($this->url) or $this->returnError("Could not request {$this->url}.", 404);
$html = $this->file_get_html($this->url) or $this->returnServerError("Could not request {$this->url}.");
// Notice: We requested an ATOM feed, however some sites return RSS feeds instead!
$type = $this->DetectContentType($html);
@@ -128,7 +128,7 @@ class WordPressBridge extends BridgeAbstract {
}
}
} else {
$this->returnError("Sorry, {$this->url} doesn't seem to be a Wordpress blog.", 404);
$this->returnServerError("Sorry, {$this->url} doesn't seem to be a Wordpress blog.");
}
}