make_url_footnote

Strip HTML and put links at the bottom of stripped content.

Description

(string) make_url_footnote( (string) $content ); 

Searches for all of the links, strips them out of the content, and places them at the bottom of the content with numbers.

Returns (string)

HTML stripped out of content with links at the bottom.

Parameters (1)

0. $content (string)
Content to get links

Usage

  1. if ( !function_exists( 'make_url_footnote' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // Content to get links 
  5. $content = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = make_url_footnote($content); 
  9.  

Defined (1)

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

/wp-includes/deprecated.php  
  1. function make_url_footnote( $content ) { 
  2. _deprecated_function( __FUNCTION__, '2.9.0', '' ); 
  3. preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches ); 
  4. $links_summary = "\n"; 
  5. for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) { 
  6. $link_match = $matches[0][$i]; 
  7. $link_number = '['.($i+1).']'; 
  8. $link_url = $matches[2][$i]; 
  9. $link_text = $matches[4][$i]; 
  10. $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); 
  11. $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; 
  12. $links_summary .= "\n" . $link_number . ' ' . $link_url; 
  13. $content = strip_tags( $content ); 
  14. $content .= $links_summary; 
  15. return $content;