mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 19:21:40 +09:00
Convert all relative src attributes, not just images
This commit is contained in:
parent
9e78e9057f
commit
e51836c0d9
2 changed files with 7 additions and 14 deletions
|
|
@ -193,14 +193,11 @@ class HTMLDisplayHandler
|
|||
// handles a relative path generated by using the rewrite module
|
||||
if(Context::isAllowRewrite())
|
||||
{
|
||||
$url = parse_url(Context::getRequestUri());
|
||||
$real_path = $url['path'];
|
||||
|
||||
$pattern = '/src=("|\'){1}(\.\/)?(files\/attach|files\/cache|files\/faceOff|files\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\/([^"\']+)\.(jpg|jpeg|png|gif)("|\'){1}/s';
|
||||
$output = preg_replace($pattern, 'src=$1' . $real_path . '$3/$4.$5$6', $output);
|
||||
$pattern = '/src=("|\'){1}(?:\.\/)?((?:files\/(?:attach|cache|faceOff|member_extra_info|thumbnails)|addons|common|(?:m\.)?layouts|modules|widgets|widgetstyle)\/[^"\']+)("|\'){1}/s';
|
||||
$output = preg_replace($pattern, 'src=$1' . \RX_BASEURL . '$2$3', $output);
|
||||
|
||||
$pattern = '/href=("|\'){1}(\?[^"\']+)/s';
|
||||
$output = preg_replace($pattern, 'href=$1' . $real_path . '$2', $output);
|
||||
$output = preg_replace($pattern, 'href=$1' . \RX_BASEURL . '$2', $output);
|
||||
|
||||
if(Context::get('vid'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,17 +63,13 @@ class image_link extends EditorHandler
|
|||
|
||||
// Image containing the address to the address conversion request uri (rss output, etc. purposes)
|
||||
$temp_src = explode('/', $src);
|
||||
if(substr($src, 0,2)=='./')
|
||||
if(substr($src, 0, 2) === './')
|
||||
{
|
||||
$src = Context::getRequestUri().substr($src, 2);
|
||||
$src = \RX_BASEURL . substr($src, 2);
|
||||
}
|
||||
else if(substr($src , 0, 1)=='/')
|
||||
elseif(substr($src, 0, 1) !== '/' && strpos($temp_src[0], ':') !== false)
|
||||
{
|
||||
$src = Rhymix\Framework\URL::getCurrentDomainURL($src);
|
||||
}
|
||||
else if(!strpos($temp_src[0],':') && $src)
|
||||
{
|
||||
$src = Context::getRequestUri().$src;
|
||||
$src = \RX_BASEURL . $src;
|
||||
}
|
||||
|
||||
$attr_output = array();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue