/**
 * This method processes a string and replaces all instances of & with & in links only.
 *
 * @param   string  $input  String to process
 *
 * @return  string  Processed string
 *
 * @since   1.7.0
 */
public static function linkXHTMLSafe($input)
{
    $regex = 'href="([^"]*(&(amp;){0})[^"]*)*?"';
    return preg_replace_callback("#{$regex}#i", array('\\Joomla\\CMS\\Filter\\OutputFilter', 'ampReplaceCallback'), $input);
}