Skip to content

Instantly share code, notes, and snippets.

@VanTanev
Created March 26, 2010 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VanTanev/345175 to your computer and use it in GitHub Desktop.
Save VanTanev/345175 to your computer and use it in GitHub Desktop.
<?php
class myWidgetContentCkEditorView extends dmWidgetContentCkEditorView
{
const LINK_REGEX = '#href="(http?://)?(/)?(?<link_data>(\w+/\w+)|(page:\d+))(\s[\w\s-]+)?"#';
public function doRender()
{
return preg_replace_callback(self::LINK_REGEX, array($this, 'doLinks'), parent::doRender());
}
public function doLinks($matches)
{
try{
return 'href="'.$this->getHelper()->link($matches['link_data'])->getHref().'"';
} catch (Exception $e) {
return $matches[0];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment