| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Helpers; |
| 4 |
|
| 5 |
/** |
| 6 |
* A helper object for the Yoast products. |
| 7 |
*/ |
| 8 |
class Product_Helper { |
| 9 |
|
| 10 |
/** |
| 11 |
* Gets the product name. |
| 12 |
* |
| 13 |
* @return string |
| 14 |
*/ |
| 15 |
public function get_product_name() { |
| 16 |
if ( $this->is_premium() ) { |
| 17 |
return 'Yoast SEO Premium'; |
| 18 |
} |
| 19 |
|
| 20 |
return 'Yoast SEO'; |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Gets the product name in the head section. |
| 25 |
* |
| 26 |
* @return string |
| 27 |
*/ |
| 28 |
public function get_name() { |
| 29 |
return $this->get_product_name() . ' plugin'; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Checks if the installed version is Yoast SEO Premium. |
| 34 |
* |
| 35 |
* @return bool True when is premium. |
| 36 |
*/ |
| 37 |
public function is_premium() { |
| 38 |
return \defined( 'WPSEO_PREMIUM_FILE' ); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Gets the Premium version if defined, returns null otherwise. |
| 43 |
* |
| 44 |
* @return string|null The Premium version or null when premium version is not defined. |
| 45 |
*/ |
| 46 |
public function get_premium_version() { |
| 47 |
if ( \defined( 'WPSEO_PREMIUM_VERSION' ) ) { |
| 48 |
return \WPSEO_PREMIUM_VERSION; |
| 49 |
} |
| 50 |
|
| 51 |
return null; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Gets the version. |
| 56 |
* |
| 57 |
* @return string The version. |
| 58 |
*/ |
| 59 |
public function get_version() { |
| 60 |
return \WPSEO_VERSION; |
| 61 |
} |
| 62 |
} |
| 63 |
|