968 | | * Strip HTML and put links at the bottom of stripped content. |
969 | | * |
970 | | * Searches for all of the links, strips them out of the content, and places |
971 | | * them at the bottom of the content with numbers. |
972 | | * |
973 | | * @since 0.71 |
974 | | * |
975 | | * @param string $content Content to get links |
976 | | * @return string HTML stripped out of content with links at the bottom. |
977 | | */ |
978 | | function make_url_footnote( $content ) { |
979 | | preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches ); |
980 | | $links_summary = "\n"; |
981 | | for ( $i=0; $i<count($matches[0]); $i++ ) { |
982 | | $link_match = $matches[0][$i]; |
983 | | $link_number = '['.($i+1).']'; |
984 | | $link_url = $matches[2][$i]; |
985 | | $link_text = $matches[4][$i]; |
986 | | $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); |
987 | | $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; |
988 | | $links_summary .= "\n" . $link_number . ' ' . $link_url; |
989 | | } |
990 | | $content = strip_tags( $content ); |
991 | | $content .= $links_summary; |
992 | | return $content; |
993 | | } |
994 | | |
995 | | /** |