| 1 |
<?php |
| 2 |
|
| 3 |
use Yoast\WP\SEO\Presenters\Abstract_Indexable_Presenter; |
| 4 |
|
| 5 |
/** |
| 6 |
* Creates an Opengraph alternate locale meta tag to be consumed by Yoast SEO |
| 7 |
* Requires Yoast SEO 14.0 or newer. |
| 8 |
* |
| 9 |
* @since 2.7.3 |
| 10 |
*/ |
| 11 |
final class PLL_WPSEO_OGP extends Abstract_Indexable_Presenter { |
| 12 |
/** |
| 13 |
* Facebook locale |
| 14 |
* |
| 15 |
* @var string $locale |
| 16 |
*/ |
| 17 |
private $locale; |
| 18 |
|
| 19 |
/** |
| 20 |
* Constructor |
| 21 |
* |
| 22 |
* @since 2.7.3 |
| 23 |
* |
| 24 |
* @param string $locale Facebook locale. |
| 25 |
*/ |
| 26 |
public function __construct( $locale ) { |
| 27 |
$this->locale = $locale; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Returns the meta Opengraph alternate locale meta tag |
| 32 |
* |
| 33 |
* @since 2.7.3 |
| 34 |
* |
| 35 |
* @return string |
| 36 |
*/ |
| 37 |
public function present() { |
| 38 |
return sprintf( '<meta property="og:locale:alternate" content="%s" />', esc_attr( $this->get() ) ); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Returns the alternate locale |
| 43 |
* |
| 44 |
* @since 2.7.3 |
| 45 |
* |
| 46 |
* @return string |
| 47 |
*/ |
| 48 |
public function get() { |
| 49 |
return $this->locale; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
|