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

WPSEO_Sitemaps_Renderer::sitemap_url() public Yoast 1.0

Build the <url> tag for a given URL.

Ищем WP-разработчика! Фулл-тайм, удаленка, хорошая зарплата, соц. пакет. Подробности.
Компания Boosta.

Public access for backwards compatibility reasons.

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

Хуки из метода

Возвращает

Строку.

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

$WPSEO_Sitemaps_Renderer = new WPSEO_Sitemaps_Renderer();
$WPSEO_Sitemaps_Renderer->sitemap_url( $url );
$url(массив) (обязательный)
Array of parts that make up this entry.

Код WPSEO_Sitemaps_Renderer::sitemap_url() Yoast 17.4

public function sitemap_url( $url ) {

	$date = null;


	if ( ! empty( $url['mod'] ) ) {
		// Create a DateTime object date in the correct timezone.
		$date = YoastSEO()->helpers->date->format( $url['mod'] );
	}

	$url['loc'] = htmlspecialchars( $url['loc'], ENT_COMPAT, $this->output_charset, false );

	$output  = "\t<url>\n";
	$output .= "\t\t<loc>" . $this->encode_url_rfc3986( $url['loc'] ) . "</loc>\n";
	$output .= empty( $date ) ? '' : "\t\t<lastmod>" . htmlspecialchars( $date, ENT_COMPAT, $this->output_charset, false ) . "</lastmod>\n";

	if ( empty( $url['images'] ) ) {
		$url['images'] = [];
	}

	foreach ( $url['images'] as $img ) {

		if ( empty( $img['src'] ) ) {
			continue;
		}

		$output .= "\t\t<image:image>\n";
		$output .= "\t\t\t<image:loc>" . esc_html( $this->encode_url_rfc3986( $img['src'] ) ) . "</image:loc>\n";

		if ( ! empty( $img['title'] ) ) {

			$title = $img['title'];

			if ( $this->needs_conversion ) {
				$title = mb_convert_encoding( $title, $this->output_charset, $this->charset );
			}

			$title   = _wp_specialchars( html_entity_decode( $title, ENT_QUOTES, $this->output_charset ) );
			$output .= "\t\t\t<image:title><![CDATA[{$title}]]></image:title>\n";
		}

		if ( ! empty( $img['alt'] ) ) {

			$alt = $img['alt'];

			if ( $this->needs_conversion ) {
				$alt = mb_convert_encoding( $alt, $this->output_charset, $this->charset );
			}

			$alt     = _wp_specialchars( html_entity_decode( $alt, ENT_QUOTES, $this->output_charset ) );
			$output .= "\t\t\t<image:caption><![CDATA[{$alt}]]></image:caption>\n";
		}

		$output .= "\t\t</image:image>\n";
	}
	unset( $img, $title, $alt );

	$output .= "\t</url>\n";

	/**
	 * Filters the output for the sitemap URL tag.
	 *
	 * @api   string $output The output for the sitemap url tag.
	 *
	 * @param array $url The sitemap URL array on which the output is based.
	 */
	return apply_filters( 'wpseo_sitemap_url', $output, $url );
}