mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-15 04:54:01 +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:
@@ -9,7 +9,7 @@ class GiphyBridge extends BridgeAbstract{
|
||||
$this->name = "Giphy Bridge";
|
||||
$this->uri = "http://giphy.com/";
|
||||
$this->description = "Bridge for giphy.com";
|
||||
$this->update = "2016-08-09";
|
||||
$this->update = '2016-08-17';
|
||||
|
||||
$this->parameters["By tag"] =
|
||||
'[
|
||||
@@ -33,10 +33,10 @@ class GiphyBridge extends BridgeAbstract{
|
||||
$html = '';
|
||||
$base_url = 'http://giphy.com';
|
||||
if (isset($param['s'])) { /* keyword search mode */
|
||||
$html = $this->file_get_html($base_url.'/search/'.urlencode($param['s'].'/')) or $this->returnError('No results for this query.', 404);
|
||||
$html = $this->file_get_html($base_url.'/search/'.urlencode($param['s'].'/')) or $this->returnServerError('No results for this query.');
|
||||
}
|
||||
else {
|
||||
$this->returnError('You must specify a search worf (?s=...).', 400);
|
||||
$this->returnClientError('You must specify a search worf (?s=...).');
|
||||
}
|
||||
|
||||
$max = GIPHY_LIMIT;
|
||||
@@ -51,7 +51,7 @@ class GiphyBridge extends BridgeAbstract{
|
||||
$node = $entry->first_child();
|
||||
$href = $node->getAttribute('href');
|
||||
|
||||
$html2 = $this->file_get_html($base_url . $href) or $this->returnError('No results for this query.', 404);
|
||||
$html2 = $this->file_get_html($base_url . $href) or $this->returnServerError('No results for this query.');
|
||||
$figure = $html2->getElementByTagName('figure');
|
||||
$img = $figure->firstChild();
|
||||
$caption = $figure->lastChild();
|
||||
|
Reference in New Issue
Block a user