Not sure if anyone is a familiar with CKEditor, but it's an HTML WSYIWYG editor that can be added to a website to modify content. With CKEditor you can do a lot of different things along with making links. When you click the link button, you have a few options, [url]http://,[/url] [url]ftp://,[/url] [url]https://,[/url] [url]news://,[/url] and other(for internal links)
I'm trying to develop a way without trying to edit the CKEditor javascript, to make it so when the user chooses other(meaning [url]http://,[/url] [url]ftp://,[/url] [url]https://,[/url] or news:// doesn't exist) that it adds a php variable to the beginning of the link.
Ex:
<a href="test1">Test Page</a>
reformed to
<a href="<?php echo $baseDirectory; ?>test1>Test Page</a>
I've accomplished this by doing:
$pattern = "/href=/";
$test= preg_replace($pattern, '<a href="<?php echo $baseDirectory; ?>', $test);
$test = str_replace('<a href="<?php echo $baseDirectory; ?>\"', '<a href="<?php echo $baseDirectory; ?>', $test);
$test = str_replace('\"', '"', $test);
But when I choose another option other than other it adds it to it as well so:
<a href="http://google.com">Google</a>
gets reformed to
<a href=<?php echo $baseDirectory; ?>http://google.com</a>
I need it so it only adds it to the other option, not the [url]http://,[/url] [url]ftp://,[/url] [url]https://,[/url] news:// options.