_make_url_clickable_cb [ WordPress Function ]
_make_url_clickable_cb ( $matches )
| Access: |
|
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: _make_email_clickable_cb, _make_web_ftp_clickable_cb, make_clickable, make_url_footnote, _maybe_update_core
Callback to convert URI match to HTML A element.
This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link make_clickable()}.
Source
<?php
function _make_url_clickable_cb($matches) {
$url = $matches[2];
if ( ')' == $matches[3] && strpos( $url, '(' ) ) {
// If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL.
// Then we can let the parenthesis balancer do its thing below.
$url .= $matches[3];
$suffix = '';
} else {
$suffix = $matches[3];
}
// Include parentheses in the URL only if paired
while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) {
$suffix = strrchr( $url, ')' ) . $suffix;
$url = substr( $url, 0, strrpos( $url, ')' ) );
}
$url = esc_url($url);
if ( empty($url) )
return $matches[0];
return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- _make_url_clickable_cb() WordPress function reference, arguments ...
_make_url_clickable_cb(). Callback to convert URI match to HTML A element. This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link ...
queryposts.com - PHP Function to Auto Convert URL into Clickable Hyperlink (Anchor ...
Sep 2, 2009 ... function _make_url_clickable_cb($matches) { $ret = ''; $url = $matches[2]; if ( empty($url) ) return $matches[0]; // removed trailing [.,;:] from URL ...
zenverse.net - php - How do I call a function within the same class as a callback of ...
(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret); if (null ! ... function _make_url_clickable_cb($matches) { $url = $matches[2]; $suffix = '' ...
stackoverflow.com - November | 2010 | sam j levy
Nov 14, 2010 ... function _make_url_clickable_cb($matches) {. $ret = '';. $url = $matches[2];. if ( empty($url) ). return $matches[0];. // removed trailing [.,;:] from ...
samjlevy.com