_make_web_ftp_clickable_cb

Callback to convert URL match to HTML A element.

Description

(string) _make_web_ftp_clickable_cb( (array) $matches ); 

This function was backported from 2.5.0 to 2.3.2. Regex callback for make_clickable().

Returns (string)

HTML A element with URL address.

Parameters (1)

0. $matches (array)
Single Regex Match.

Usage

  1. if ( !function_exists( '_make_web_ftp_clickable_cb' ) ) { 
  2. require_once ABSPATH . WPINC . '/formatting.php'; 
  3.  
  4. // Single Regex Match. 
  5. $matches = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _make_web_ftp_clickable_cb($matches); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/formatting.php  
  1. function _make_web_ftp_clickable_cb( $matches ) { 
  2. $ret = ''; 
  3. $dest = $matches[2]; 
  4. $dest = 'http://' . $dest; 
  5.  
  6. // removed trailing [., ;:)] from URL 
  7. if ( in_array( substr($dest, -1), array('.', ', ', ';', ':', ')') ) === true ) { 
  8. $ret = substr($dest, -1); 
  9. $dest = substr($dest, 0, strlen($dest)-1); 
  10.  
  11. $dest = esc_url($dest); 
  12. if ( empty($dest) ) 
  13. return $matches[0]; 
  14.  
  15. return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";