'; public const META_NAME_CONTENT = ''; public const LINK_REL_HREF = ''; public const DEFAULT_TAG_FORMAT = self::META_NAME_CONTENT; /** * The tag format including placeholders. * * @var string */ protected $tag_format = self::DEFAULT_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 ''; } /** * There may be some classes that are derived from this class that do not use the $key property * in their $tag_format string. In that case the key property will simply not be used. */ return \sprintf( $this->tag_format, $this->escape_value( $value ), $this->key, \is_admin_bar_showing() ? ' class="yoast-seo-meta-tag"' : '' ); } /** * Escaped the output. * * @param string $value The desired method of escaping; 'html', 'url' or 'attribute'. * * @return string The escaped value. */ protected function escape_value( $value ) { switch ( $this->escaping ) { case 'html': return \esc_html( $value ); case 'url': return \esc_url( $value, null, 'attribute' ); case 'attribute': default: return \esc_attr( $value ); } } }