WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
класс не описан

WPSEO_Deprecated_Graph_Piece{} Yoast 10.2

Запрещена (устарела) с версии 14.0. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.

Returns schema Article data.

Хуков нет.

Возвращает

Null. Ничего.

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

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

Методы

  1. __construct( $class_name )
  2. is_needed()
  3. generate()

Список изменений

С версии 10.2 Введена.
Устарела с 14.0

Код WPSEO_Deprecated_Graph_Piece{} Yoast 15.1.1

<?php
abstract class WPSEO_Deprecated_Graph_Piece implements WPSEO_Graph_Piece {

	/**
	 * The meta tags context.
	 *
	 * @var Meta_Tags_Context
	 */
	private $context;

	/**
	 * The helpers surface.
	 *
	 * @var Helpers_Surface
	 */
	public $helpers;

	/**
	 * The date helper.
	 *
	 * @var WPSEO_Date_Helper
	 */
	protected $date;

	/**
	 * The new stable piece.
	 *
	 * @var Abstract_Schema_Piece
	 */
	protected $stable;

	/**
	 * The stable class name.
	 *
	 * @var string
	 */
	protected $stable_class_name;

	/**
	 * WPSEO_Schema_Article constructor.
	 *
	 * @param string $class_name The class name.
	 *
	 * @codeCoverageIgnore
	 * @deprecated 14.0
	 */
	public function __construct( $class_name ) {
		$this->stable_class_name = $class_name;
		$this->stable            = new $class_name();

		_deprecated_function( __METHOD__, 'WPSEO 14.0', $this->stable_class_name );

		$memoizer = YoastSEO()->classes->get( Meta_Tags_Context_Memoizer::class );

		// We cannot extend the stable graph piece because a property was made public on it that was previously private.
		// So instead, we instantiate a stable graph piece and delegate to it.
		$this->context         = $memoizer->for_current_page();
		$this->stable->context = $this->context;
		$this->helpers         = YoastSEO()->helpers;
		$this->stable->helpers = $this->helpers;
	}

	/**
	 * Determines whether or not a piece should be added to the graph.
	 *
	 * @codeCoverageIgnore
	 * @deprecated 14.0
	 *
	 * @return bool
	 */
	public function is_needed() {
		_deprecated_function( __METHOD__, 'WPSEO 14.0', $this->stable_class_name . '::is_needed' );

		return $this->stable->is_needed();
	}

	/**
	 * Returns Article data.
	 *
	 * @codeCoverageIgnore
	 * @deprecated 14.0
	 *
	 * @return array $data Article data.
	 */
	public function generate() {
		_deprecated_function( __METHOD__, 'WPSEO 14.0', $this->stable_class_name . '::generate' );

		return $this->stable->generate();
	}
}