Allow hotlinking images
This commit is contained in:
@@ -9,6 +9,22 @@ namespace dokuwiki\plugin\luxtools;
|
||||
*/
|
||||
class ThumbnailHelper
|
||||
{
|
||||
/**
|
||||
* Check if a string is a HTTP/HTTPS URL.
|
||||
*
|
||||
* @param string $url
|
||||
* @return bool
|
||||
*/
|
||||
public static function isRemoteUrl(string $url): bool
|
||||
{
|
||||
if ($url === '') return false;
|
||||
$parts = @parse_url($url);
|
||||
if (!is_array($parts)) return false;
|
||||
if (empty($parts['scheme']) || empty($parts['host'])) return false;
|
||||
$scheme = strtolower((string)$parts['scheme']);
|
||||
return in_array($scheme, ['http', 'https'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get thumbnail URL and metadata for rendering.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user