summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-05 23:41:32 +0300
committerAndrew Dolgov <[email protected]>2021-02-05 23:41:32 +0300
commit403dca154c6b539de221f9e16174a0fdd0a1e896 (patch)
tree8187096f0e04ecb60440c8551514d990d0e85b2d /plugins
parentb4cbc792cc5fbbd5356f91038bf6cf5e67a19e42 (diff)
initial WIP for php8; bump php version requirement to 7.0
Diffstat (limited to 'plugins')
-rw-r--r--plugins/af_proxy_http/init.php2
-rwxr-xr-xplugins/af_redditimgur/init.php16
2 files changed, 10 insertions, 8 deletions
diff --git a/plugins/af_proxy_http/init.php b/plugins/af_proxy_http/init.php
index 86f5fc8ce..c7cded4c9 100644
--- a/plugins/af_proxy_http/init.php
+++ b/plugins/af_proxy_http/init.php
@@ -29,7 +29,7 @@ class Af_Proxy_Http extends Plugin {
$host->add_hook($host::HOOK_PREFS_TAB, $this);
- if (!$_SESSION['af_proxy_http_token'])
+ if (empty($_SESSION['af_proxy_http_token']))
$_SESSION['af_proxy_http_token'] = bin2hex(get_random_bytes(16));
}
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php
index 6eb530e27..610ff5389 100755
--- a/plugins/af_redditimgur/init.php
+++ b/plugins/af_redditimgur/init.php
@@ -101,7 +101,7 @@ class Af_RedditImgur extends Plugin {
private function process_post_media($data, $doc, $xpath, $anchor) {
$found = 0;
- if (is_array($data["media_metadata"])) {
+ if (isset($data["media_metadata"])) {
foreach ($data["media_metadata"] as $media) {
$media_url = htmlspecialchars_decode($media["s"]["u"]);
@@ -134,7 +134,9 @@ class Af_RedditImgur extends Plugin {
}
} */
- if (!$found && $data["post_hint"] == "hosted:video") {
+ $post_hint = $data["post_hint"] ?? false;
+
+ if (!$found && $post_hint == "hosted:video") {
$media_url = $data["url"];
if (isset($data["preview"]["images"][0]["source"]))
@@ -154,7 +156,7 @@ class Af_RedditImgur extends Plugin {
}
}
- if (!$found && $data["post_hint"] == "video") {
+ if (!$found && $post_hint == "video") {
$media_url = $data["url"];
if (isset($data["preview"]["images"][0]["source"]))
@@ -168,7 +170,7 @@ class Af_RedditImgur extends Plugin {
$found = 1;
}
- if (!$found && $data["post_hint"] == "image") {
+ if (!$found && $post_hint == "image") {
$media_url = $data["url"];
Debug::log("found image url: $media_url", Debug::$LOG_VERBOSE);
@@ -177,14 +179,14 @@ class Af_RedditImgur extends Plugin {
$found = 1;
}
- if (!$found && is_array($data["preview"]["images"])) {
+ if (!$found && isset($data["preview"]["images"])) {
foreach ($data["preview"]["images"] as $img) {
if (isset($img["source"]["url"])) {
$media_url = htmlspecialchars_decode($img["source"]["url"]);
$target_url = $data["url"];
if ($media_url) {
- if ($data["post_hint"] == "self") {
+ if ($post_hint == "self") {
Debug::log("found preview image url: $media_url (link: $target_url)", Debug::$LOG_VERBOSE);
$this->handle_as_image($doc, $anchor, $media_url, $target_url);
@@ -229,7 +231,7 @@ class Af_RedditImgur extends Plugin {
$data = $child["data"];
- if (is_array($data["crosspost_parent_list"])) {
+ if (isset($data["crosspost_parent_list"])) {
Debug::log("JSON: processing child crosspost_parent_list", Debug::$LOG_EXTENDED);
foreach ($data["crosspost_parent_list"] as $parent) {