Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
_make_web_ftp_clickable_cb() WordPress Function
The make_web_ftp_clickable_cb() function is a custom function used to make links clickable in WordPress. This function is used to make web and FTP links clickable in WordPress. This function is useful for making links clickable in WordPress posts and pages. This function is used by the WordPress make_clickable() function.
_make_web_ftp_clickable_cb( array $matches ) #
Callback to convert URL match to HTML A element.
Description
This function was backported from 2.5.0 to 2.3.2. Regex callback for make_clickable().
Parameters
- $matches
(array)(Required)Single Regex Match.
Return
(string) HTML A element with URL address.
Source
File: wp-includes/formatting.php
function _make_web_ftp_clickable_cb( $matches ) { $ret = ''; $dest = $matches[2]; $dest = 'http://' . $dest; // Removed trailing [.,;:)] from URL. $last_char = substr( $dest, -1 ); if ( in_array( $last_char, array( '.', ',', ';', ':', ')' ), true ) === true ) { $ret = $last_char; $dest = substr( $dest, 0, strlen( $dest ) - 1 ); } $dest = esc_url( $dest ); if ( empty( $dest ) ) { return $matches[0]; } if ( 'comment_text' === current_filter() ) { $rel = 'nofollow ugc'; } else { $rel = 'nofollow'; } /** This filter is documented in wp-includes/formatting.php */ $rel = apply_filters( 'make_clickable_rel', $rel, $dest ); $rel = esc_attr( $rel ); return $matches[1] . "<a href=\"$dest\" rel=\"$rel\">$dest</a>$ret"; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.3.2 | Introduced. |