Back to DocumentRenderer class

Method _relToAbs

protected string
_relToAbs
(mixed $text)
Convert links in a text from relative to absolute
Parameters
  • string $text The text processed
Returns
  • string Text with converted links
Since
  • 1.7.0

Method _relToAbs - Source code

/**
 * Convert links in a text from relative to absolute
 *
 * @param   string  $text  The text processed
 *
 * @return  string   Text with converted links
 *
 * @since   1.7.0
 */
protected function _relToAbs($text)
{
    $base = Uri::base();
    $text = preg_replace("/(href|src)=\"(?!http|ftp|https|mailto|data|\\/\\/)([^\"]*)\"/", "\$1=\"{$base}\$2\"", $text);
    return $text;
}