mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-29 11:00:10 +02:00
fix: php errors (notices) (#3115)
This commit is contained in:
@@ -313,6 +313,7 @@ class BandcampBridge extends BridgeAbstract
|
||||
private function apiGet($endpoint, $query_data)
|
||||
{
|
||||
$url = self::URI . 'api/' . $endpoint . '?' . http_build_query($query_data);
|
||||
// todo: 429 Too Many Requests happens a lot
|
||||
$data = json_decode(getContents($url));
|
||||
return $data;
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ class GoogleSearchBridge extends BridgeAbstract
|
||||
|
||||
public function collectData()
|
||||
{
|
||||
// todo: wrap this in try..catch because 429 too many requests happens a lot
|
||||
$dom = getSimpleHTMLDOM($this->getURI(), ['Accept-language: en-US']);
|
||||
if (!$dom) {
|
||||
returnServerError('No results for this query.');
|
||||
|
@@ -40,6 +40,9 @@ class MoebooruBridge extends BridgeAbstract
|
||||
|
||||
foreach ($data as $datai) {
|
||||
$json = json_decode($datai, true);
|
||||
if ($json === null) {
|
||||
continue;
|
||||
}
|
||||
$item = [];
|
||||
$item['uri'] = $this->getURI() . '/post/show/' . $json['id'];
|
||||
$item['postid'] = $json['id'];
|
||||
|
@@ -26,9 +26,10 @@ class NasaApodBridge extends BridgeAbstract
|
||||
//Extract image and explanation
|
||||
$image_wrapper = $picture_html->find('a', 1);
|
||||
$image_path = $image_wrapper->href;
|
||||
// This image is not present when youtube embed
|
||||
$img_placeholder = $image_wrapper->find('img', 0);
|
||||
$img_alt = $img_placeholder->alt;
|
||||
$img_style = $img_placeholder->style;
|
||||
$img_alt = $img_placeholder->alt ?? '';
|
||||
$img_style = $img_placeholder->style ?? '';
|
||||
$image_uri = self::URI . $image_path;
|
||||
$new_img_placeholder = "<img src=\"$image_uri\" alt=\"$img_alt\" style=\"$img_style\">";
|
||||
$media = "<a href=\"$image_uri\">$new_img_placeholder</a>";
|
||||
|
@@ -170,10 +170,8 @@ class NationalGeographicBridge extends BridgeAbstract
|
||||
$image = $story['img'];
|
||||
$item['enclosures'][] = $image['src'];
|
||||
|
||||
$tags = $story['tags'];
|
||||
foreach ($tags as $tag) {
|
||||
$tag_name = $tag['name'];
|
||||
$item['categories'][] = $tag_name;
|
||||
foreach ($story['tags'] as $tag) {
|
||||
$item['categories'][] = $tag['name'] ?? $tag;
|
||||
}
|
||||
|
||||
$this->items[] = $item;
|
||||
|
@@ -150,8 +150,6 @@ class RedditBridge extends BridgeAbstract
|
||||
$flair = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($subreddits as $subreddit) {
|
||||
$name = trim($subreddit);
|
||||
$values = getContents(self::URI
|
||||
@@ -207,14 +205,17 @@ class RedditBridge extends BridgeAbstract
|
||||
|
||||
$item['content']
|
||||
= htmlspecialchars_decode($data->selftext_html);
|
||||
} elseif (isset($data->post_hint) ? $data->post_hint == 'link' : false) {
|
||||
} elseif (isset($data->post_hint) && $data->post_hint == 'link') {
|
||||
// Link with preview
|
||||
|
||||
if (isset($data->media)) {
|
||||
// Reddit embeds content for some sites (e.g. Twitter)
|
||||
$embed = htmlspecialchars_decode(
|
||||
$data->media->oembed->html
|
||||
);
|
||||
// todo: maybe switch on the type
|
||||
if (isset($data->media->oembed->html)) {
|
||||
// Reddit embeds content for some sites (e.g. Twitter)
|
||||
$embed = htmlspecialchars_decode($data->media->oembed->html);
|
||||
} else {
|
||||
$embed = '';
|
||||
}
|
||||
} else {
|
||||
$embed = '';
|
||||
}
|
||||
|
@@ -498,13 +498,15 @@ EOD;
|
||||
break;
|
||||
case 'table':
|
||||
$table = '<table>';
|
||||
$theaders = $content['header'];
|
||||
$tr = '<tr>';
|
||||
foreach ($theaders as $header) {
|
||||
$tr .= '<th>' . $header . '</th>';
|
||||
$theaders = $content['header'] ?? null;
|
||||
if ($theaders) {
|
||||
$tr = '<tr>';
|
||||
foreach ($theaders as $header) {
|
||||
$tr .= '<th>' . $header . '</th>';
|
||||
}
|
||||
$tr .= '</tr>';
|
||||
$table .= $tr;
|
||||
}
|
||||
$tr .= '</tr>';
|
||||
$table .= $tr;
|
||||
$rows = $content['rows'];
|
||||
foreach ($rows as $row) {
|
||||
$tr = '<tr>';
|
||||
|
Reference in New Issue
Block a user