remove blog URL before save it
This commit is contained in:
parent
7214890c44
commit
ab388b136e
@ -107,8 +107,8 @@ class Alias
|
||||
return;
|
||||
}
|
||||
|
||||
$url = trim($url);
|
||||
$destination = trim($destination);
|
||||
$url = self::removeBlogUrl($url);
|
||||
$destination = self::removeBlogUrl($destination);
|
||||
|
||||
if (empty($url)) {
|
||||
throw new Exception(__('Alias URL is empty.'));
|
||||
@ -159,4 +159,16 @@ class Alias
|
||||
->where('blog_id = ' . $sql->quote((string) dcCore::app()->blog->id))
|
||||
->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove blog URL from alias URLs.
|
||||
*
|
||||
* @param string $url The URL to clean
|
||||
*
|
||||
* @return string The cleaned URL
|
||||
*/
|
||||
public static function removeBlogUrl(string $url): string
|
||||
{
|
||||
return str_replace(dcCore::app()->blog->url, '', trim($url));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user