WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Help_Command::parse_reference_links() private WP-CLI 1.0

Parse reference links from longdescription.

{} Это метод класса: Help_Command{}

Хуков нет.

Возвращает

Строку. The longdescription which has links as footnote.

Использование

$result = Help_Command::parse_reference_links( $longdesc );
$longdesc(строка) (обязательный)
The longdescription from the $command->get_longdesc().

Код Help_Command::parse_reference_links() WP-CLI 2.5.0

private static function parse_reference_links( $longdesc ) {
	$description = '';
	foreach ( explode( "\n", $longdesc ) as $line ) {
		if ( 0 === strpos( $line, '#' ) ) {
			break;
		}
		$description .= $line . "\n";
	}

	// Fires if it has description text at the head of `$longdesc`.
	if ( $description ) {
		$links   = []; // An array of URLs from the description.
		$pattern = '/\[.+?\]\((https?:\/\/.+?)\)/';
		$newdesc = preg_replace_callback(
			$pattern,
			function( $matches ) use ( &$links ) {
				static $count = 0;
				$count++;
				$links[] = $matches[1];
				return str_replace( '(' . $matches[1] . ')', '[' . $count . ']', $matches[0] );
			},
			$description
		);

		$footnote   = '';
		$link_count = count( $links );
		for ( $i = 0; $i < $link_count; $i++ ) {
			$n         = $i + 1;
			$footnote .= '[' . $n . '] ' . $links[ $i ] . "\n";
		}

		if ( $footnote ) {
			$newdesc  = trim( $newdesc ) . "\n\n---\n" . $footnote;
			$longdesc = str_replace( trim( $description ), trim( $newdesc ), $longdesc );
		}
	}

	return $longdesc;
}