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

Yoast\WP\SEO\Presenters

Abstract_Indexable_Tag_Presenter{} Yoast 1.0

Abstract presenter class for indexable tag presentations.

Хуков нет.

Возвращает

Null. Ничего.

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

$Abstract_Indexable_Tag_Presenter = new Abstract_Indexable_Tag_Presenter();
// use class methods

Методы

  1. escape( $value )
  2. present()

Код Abstract_Indexable_Tag_Presenter{} Yoast 15.6.2

<?php
abstract class Abstract_Indexable_Tag_Presenter extends Abstract_Indexable_Presenter {

	/**
	 * The tag format including placeholders.
	 *
	 * @var string
	 */
	protected $tag_format = '';

	/**
	 * The method of escaping to use.
	 *
	 * @var string
	 */
	protected $escaping = 'attribute';

	/**
	 * Returns a tag in the head.
	 *
	 * @return string The tag.
	 */
	public function present() {
		$value = $this->get();

		if ( \is_string( $value ) && $value !== '' ) {
			return \sprintf( $this->tag_format, $this->escape( $value ) );
		}

		return '';
	}

	/**
	 * Escaped the output.
	 *
	 * @param string $value The value.
	 *
	 * @return string The escaped value.
	 */
	protected function escape( $value ) {
		if ( $this->escaping === 'html' ) {
			return \esc_html( $value );
		}
		if ( $this->escaping === 'url' ) {
			return \esc_url( $value );
		}
		return \esc_attr( $value );
	}
}