Allow hotlinking images

This commit is contained in:
2026-01-26 09:38:52 +01:00
parent 16e80f81c0
commit 7a4ce8609c
4 changed files with 68 additions and 33 deletions

View File

@@ -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.
*