Fix watermark AJAX cache URLs from plugin endpoint

This commit is contained in:
Terranom674
2026-08-15 21:55:03 +02:00
parent 35b26c6e33
commit 625892b66e

View File

@@ -156,9 +156,18 @@ function bratonien_tools_runtime_canonical_derivative_url($rel_url)
function bratonien_tools_runtime_absolute_url($relative_path) function bratonien_tools_runtime_absolute_url($relative_path)
{ {
$relative_path = ltrim((string)$relative_path, '/'); $relative_path = ltrim((string)$relative_path, '/');
if (function_exists('get_absolute_root_url')) if (function_exists('get_absolute_root_url'))
{ {
return rtrim(get_absolute_root_url(true), '/').'/'.$relative_path; $root = rtrim(get_absolute_root_url(true), '/');
$plugin_suffix = '/plugins/'.trim(BRATONIEN_TOOLS_ID, '/');
if (substr($root, -strlen($plugin_suffix)) === $plugin_suffix)
{
$root = substr($root, 0, -strlen($plugin_suffix));
}
return rtrim($root, '/').'/'.$relative_path;
} }
return '/'.$relative_path; return '/'.$relative_path;