Yoast\WP\SEO\Surfaces\Values
Meta::__get() public Yoast 1.0
Magic getter for presenting values through the appropriate presenter, if it exists.
{} Это метод класса: Meta{}
Хуки из метода
Возвращает
Разное
. The value, as presented by teh appropriate presenter.
Использование
$Meta = new Meta(); $Meta->__get( $name );
- $name(строка) (обязательный)
- The property to get.
Код Meta::__get() Meta:: get Yoast 16.1.1
public function __get( $name ) {
/** This filter is documented in src/integrations/front-end-integration.php */
$presentation = \apply_filters( 'wpseo_frontend_presentation', $this->context->presentation, $this->context );
if ( ! isset( $presentation->{$name} ) ) {
if ( isset( $this->context->{$name} ) ) {
$this->{$name} = $this->context->{$name};
return $this->{$name};
}
return null;
}
$presenter_namespace = 'Yoast\WP\SEO\Presenters\\';
$parts = \explode( '_', $name );
if ( $parts[0] === 'twitter' ) {
$presenter_namespace .= 'Twitter\\';
$parts = \array_slice( $parts, 1 );
}
elseif ( $parts[0] === 'open' && $parts[1] === 'graph' ) {
$presenter_namespace .= 'Open_Graph\\';
$parts = \array_slice( $parts, 2 );
}
$presenter_class = $presenter_namespace . \implode( '_', \array_map( 'ucfirst', $parts ) ) . '_Presenter';
if ( \class_exists( $presenter_class ) ) {
/**
* The indexable presenter.
*
* @var Abstract_Indexable_Presenter
*/
$presenter = new $presenter_class();
$presenter->presentation = $presentation;
$presenter->helpers = $this->helpers;
$presenter->replace_vars = $this->replace_vars;
$value = $presenter->get();
}
else {
$value = $presentation->{$name};
}
$this->{$name} = $value;
return $this->{$name};
}