X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FProxy.php;h=e104073f0331e6f22cd9dfcdce9b829e39bb309a;hb=a98957eeb29cfb142dfc4cd3e03c5bdfbc373466;hp=dab08b18bb63da26ba4eaa0cf42dbe783478ca85;hpb=03038e7a3bb74bdab497d26b7f829a5c3036d1c2;p=friendica.git diff --git a/src/Util/Proxy.php b/src/Util/Proxy.php index dab08b18bb..e104073f03 100644 --- a/src/Util/Proxy.php +++ b/src/Util/Proxy.php @@ -1,13 +1,30 @@ . + * + */ namespace Friendica\Util; -use Friendica\Core\Config; -use Friendica\Core\System; use Friendica\DI; /** - * @brief Proxy utilities class + * Proxy utilities class */ class Proxy { @@ -40,14 +57,14 @@ class Proxy ]; /** - * @brief Private constructor + * Private constructor */ private function __construct () { // No instances from utilities classes } /** - * @brief Transform a remote URL into a local one. + * Transform a remote URL into a local one. * * This function only performs the URL replacement on http URL and if the * provided URL isn't local, "the isn't deactivated" (sic) and if the config @@ -76,12 +93,12 @@ class Proxy // Only continue if it isn't a local image and the isn't deactivated if (self::isLocalImage($url)) { - $url = str_replace(Strings::normaliseLink(System::baseUrl()) . '/', System::baseUrl() . '/', $url); + $url = str_replace(Strings::normaliseLink(DI::baseUrl()) . '/', DI::baseUrl() . '/', $url); return $url; } // Is the proxy disabled? - if (Config::get('system', 'proxy_disabled')) { + if (DI::config()->get('system', 'proxy_disabled')) { return $url; } @@ -109,7 +126,7 @@ class Proxy $longpath .= '.' . $extension; } - $proxypath = System::baseUrl() . '/proxy/' . $longpath; + $proxypath = DI::baseUrl() . '/proxy/' . $longpath; if ($size != '') { $size = ':' . $size; @@ -120,7 +137,7 @@ class Proxy if ((strlen($proxypath) > 250) && $writemode) { return $shortpath; } elseif (strlen($proxypath) > 250) { - return System::baseUrl() . '/proxy/' . $shortpath . '?url=' . urlencode($url); + return DI::baseUrl() . '/proxy/' . $shortpath . '?url=' . urlencode($url); } elseif ($writemode) { return $longpath; } else { @@ -129,7 +146,7 @@ class Proxy } /** - * @brief "Proxifies" HTML code's image tags + * "Proxifies" HTML code's image tags * * "Proxifies", means replaces image URLs in given HTML code with those from * proxy storage directory. @@ -141,13 +158,13 @@ class Proxy */ public static function proxifyHtml($html) { - $html = str_replace(Strings::normaliseLink(System::baseUrl()) . '/', System::baseUrl() . '/', $html); + $html = str_replace(Strings::normaliseLink(DI::baseUrl()) . '/', DI::baseUrl() . '/', $html); return preg_replace_callback('/(]*src *= *["\'])([^"\']+)(["\'][^>]*>)/siU', 'self::replaceUrl', $html); } /** - * @brief Checks if the URL is a local URL. + * Checks if the URL is a local URL. * * @param string $url * @return boolean @@ -164,14 +181,14 @@ class Proxy } // links normalised - bug #431 - $baseurl = Strings::normaliseLink(System::baseUrl()); + $baseurl = Strings::normaliseLink(DI::baseUrl()); $url = Strings::normaliseLink($url); return (substr($url, 0, strlen($baseurl)) == $baseurl); } /** - * @brief Return the array of query string parameters from a URL + * Return the array of query string parameters from a URL * * @param string $url URL to parse * @return array Associative array of query string parameters @@ -187,7 +204,7 @@ class Proxy } /** - * @brief Call-back method to replace the UR + * Call-back method to replace the UR * * @param array $matches Matches from preg_replace_callback() * @return string Proxified HTML image tag