Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[url] tags have issues with quoted URLs #1

Open
hbtronix opened this issue Aug 16, 2010 · 0 comments
Open

[url] tags have issues with quoted URLs #1

hbtronix opened this issue Aug 16, 2010 · 0 comments

Comments

@hbtronix
Copy link

The plugin seems to cut off titles for quoted URLs and seems generally a bit flaky. To fix, replace the handle() method in link.php with this:

function handle($match, $state, $pos, &$handler) {
    if (preg_match('/^\\[url(=[\'"]?(.+?)[\'"]?)?\\](.+?)\\[\\/url\\]$/', $match, $m)) {
        $url = !empty($m[2])? $m[2] : $m[3];
        $title = $m[3];
    }

    // external link (accepts all protocols)
    if ( preg_match('#^([a-z0-9\-\.+]+?)://#i',$url) ) {
        $handler->_addCall('externallink',array($url,$title),$pos);

    // local link
    } elseif ( preg_match('!^#.+!',$url) ) {
        $handler->_addCall('locallink',array(substr($url,1),$title),$pos);

    // internal link
    } else {
        $handler->_addCall('internallink',array($url,$title),$pos);
    }
    return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant