Commit 676587dd authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-62: Ensuring that anchor links get processed during ckeditor link filtering.

parent 6d42294d
......@@ -246,8 +246,27 @@ function ckeditor_link_filter_info() {
}
function ckeditor_link_filter_process($text, $filter, $format, $langcode, $cache, $cache_id) {
_ckeditor_link_filter_process(NULL, $langcode);
return preg_replace_callback('`\bhref="'. preg_quote(base_path(), '`') .'([^?#"]+)`', '_ckeditor_link_filter_process', $text);
_ckeditor_link_filter_process(NULL, $langcode);
// If there are anchor links, process them and replace with full url.
if(preg_match('/"#([^?#"]+)"/', $text)) {
$text = preg_replace_callback('/"#([^?#"]+)"/', '_ckeditor_link_filter_process_anchors', $text);
}
// If there are drupal links, process them and replace with full url.
if(preg_match('`\bhref="'. preg_quote(base_path(), '`') .'([^?#"]+)`', $text)) {
$text = preg_replace_callback('`\bhref="' . preg_quote(base_path(), '`') . '([^?#"]+)`', '_ckeditor_link_filter_process', $text);
}
return $text;
}
function _ckeditor_link_filter_process_anchors($matches, $langcode = NULL) {
global $base_root;
$current_url = $base_root . request_uri();
return $current_url . '#' . $matches[1];
}
function _ckeditor_link_filter_process($matches, $langcode = NULL) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment