| 413 | | |
| 414 | | function make_url_footnote( $content ) { |
| 415 | | preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches ); |
| 416 | | $j = 0; |
| 417 | | for ( $i=0; $i<count($matches[0]); $i++ ) { |
| 418 | | $links_summary = ( !$j ) ? "\n" : $links_summary; |
| 419 | | $j++; |
| 420 | | $link_match = $matches[0][$i]; |
| 421 | | $link_number = '['.($i+1).']'; |
| 422 | | $link_url = $matches[2][$i]; |
| 423 | | $link_text = $matches[4][$i]; |
| 424 | | $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); |
| 425 | | $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; |
| 426 | | $links_summary .= "\n" . $link_number . ' ' . $link_url; |
| 427 | | } |
| 428 | | $content = strip_tags( $content ); |
| 429 | | $content .= $links_summary; |
| 430 | | return $content; |
| 431 | | } |
| 432 | | |
| 433 | | |