summaryrefslogtreecommitdiff
path: root/plugins/af_redditimgur
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-08-23 10:56:31 +0300
committerAndrew Dolgov <[email protected]>2021-08-23 10:56:31 +0300
commit2c931df77ccba5e76bc1865584e870219596ff69 (patch)
treef902ce89ac849f6fd3c7d250489ccadf228ccbfd /plugins/af_redditimgur
parent5c6025447416616f47ab7b22d179d2b27a2c3eba (diff)
remove SELF_USER_AGENT custom constant, replaced with configurable Config::HTTP_USER_AGENT / Config::get_user_agent()
Diffstat (limited to 'plugins/af_redditimgur')
-rwxr-xr-xplugins/af_redditimgur/init.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php
index 3b4094b1b..732067557 100755
--- a/plugins/af_redditimgur/init.php
+++ b/plugins/af_redditimgur/init.php
@@ -785,7 +785,8 @@ class Af_RedditImgur extends Plugin {
}
- private function get_header($url, $header, $useragent = SELF_USER_AGENT) {
+ /** $useragent defaults to Config::get_user_agent() */
+ private function get_header($url, $header, $useragent = false) {
$ret = false;
if (function_exists("curl_init")) {
@@ -795,7 +796,7 @@ class Af_RedditImgur extends Plugin {
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("open_basedir"));
- curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
+ curl_setopt($ch, CURLOPT_USERAGENT, $useragent ? $useragent : Config::get_user_agent());
@curl_exec($ch);
$ret = curl_getinfo($ch, $header);
@@ -804,11 +805,11 @@ class Af_RedditImgur extends Plugin {
return $ret;
}
- private function get_content_type($url, $useragent = SELF_USER_AGENT) {
+ private function get_content_type($url, $useragent = false) {
return $this->get_header($url, CURLINFO_CONTENT_TYPE, $useragent);
}
- private function get_location($url, $useragent = SELF_USER_AGENT) {
+ private function get_location($url, $useragent = false) {
return $this->get_header($url, CURLINFO_EFFECTIVE_URL, $useragent);
}