функция
Устаревший since 0.71
make_url_footnote()
Устаревшее.
Помечено устаревшим с версии 2.9.0.
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
make_url_footnote( string $content ): string
Описание
Находит все ссылки, удаляет их из содержимого и размещает их в конце содержимого с нумерацией.
Оригинал (английский)
Searches for all of the links, strips them out of the content, and places them at the bottom of the content with numbers.
Параметры
$content
string
обязательный
Содержимое, из которого нужно получить ссылки.
Возвращаемое значение
string
Исходный код
wp-includes/deprecated.php:1737
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;
}
История изменений
| Версия | Описание |
|---|---|
| 2.9.0 | Устаревший. |
| 0.71 | Introduced. |

