make_url_footnote

函式
make_url_footnote ( $content )
引數
  • (string) $content Content to get links.
    Required:
返回值
  • (string) HTML stripped out of content with links at the bottom.
定義位置
相關方法
get_url_in_contentget_footer_make_url_clickable_cbcore_update_footertype_url_form_file
引入
0.71
棄用
2.9.0

make_url_footnote: 這不是WordPress中的一個函式。它可能是一個特定於某個網站或外掛的自定義函式。

剝離HTML並將連結放在剝離內容的底部。

搜尋所有的連結,把它們從內容中剝離出來,並把它們放在內容底部的數字。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function make_url_footnote( $content ) {
_deprecated_function( __FUNCTION__, '2.9.0', '' );
preg_match_all( '/<a(.+?)href="(.+?)"(.*?)>(.+?)</a>/', $content, $matches );
$links_summary = "n";
for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) {
$link_match = $matches[0][$i];
$link_number = '['.($i+1).']';
$link_url = $matches[2][$i];
$link_text = $matches[4][$i];
$content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
$link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
$links_summary .= "n" . $link_number . ' ' . $link_url;
}
$content = strip_tags( $content );
$content .= $links_summary;
return $content;
}
function make_url_footnote( $content ) { _deprecated_function( __FUNCTION__, '2.9.0', '' ); preg_match_all( '/<a(.+?)href="(.+?)"(.*?)>(.+?)</a>/', $content, $matches ); $links_summary = "n"; for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) { $link_match = $matches[0][$i]; $link_number = '['.($i+1).']'; $link_url = $matches[2][$i]; $link_text = $matches[4][$i]; $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; $links_summary .= "n" . $link_number . ' ' . $link_url; } $content = strip_tags( $content ); $content .= $links_summary; return $content; }
function make_url_footnote( $content ) {
	_deprecated_function( __FUNCTION__, '2.9.0', '' );
	preg_match_all( '/<a(.+?)href="(.+?)"(.*?)>(.+?)</a>/', $content, $matches );
	$links_summary = "n";
	for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) {
		$link_match = $matches[0][$i];
		$link_number = '['.($i+1).']';
		$link_url = $matches[2][$i];
		$link_text = $matches[4][$i];
		$content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
		$link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
		$links_summary .= "n" . $link_number . ' ' . $link_url;
	}
	$content  = strip_tags( $content );
	$content .= $links_summary;
	return $content;
}

常見問題

FAQs
檢視更多 >