| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Presenters\Debug; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\Presenters\Abstract_Indexable_Presenter; |
| 6 |
|
| 7 |
/** |
| 8 |
* Presenter class for the debug open marker. |
| 9 |
*/ |
| 10 |
final class Marker_Open_Presenter extends Abstract_Indexable_Presenter { |
| 11 |
|
| 12 |
/** |
| 13 |
* Returns the debug close marker. |
| 14 |
* |
| 15 |
* @return string The debug close marker. |
| 16 |
*/ |
| 17 |
public function present() { |
| 18 |
/** |
| 19 |
* Filter: 'wpseo_debug_markers' - Allow disabling the debug markers. |
| 20 |
* |
| 21 |
* @param bool $show_markers True when the debug markers should be shown. |
| 22 |
*/ |
| 23 |
if ( ! \apply_filters( 'wpseo_debug_markers', true ) ) { |
| 24 |
return ''; |
| 25 |
} |
| 26 |
$product_name = \esc_html( $this->helpers->product->get_name() ); |
| 27 |
$is_premium = $this->helpers->product->is_premium(); |
| 28 |
|
| 29 |
$version = ( $is_premium ) ? $this->construct_version_info() : 'v' . \WPSEO_VERSION; |
| 30 |
|
| 31 |
$url = ( $is_premium ) ? 'https://yoast.com/product/yoast-seo-premium-wordpress/' : 'https://yoast.com/product/yoast-seo-wordpress/'; |
| 32 |
|
| 33 |
return \sprintf( |
| 34 |
'<!-- This site is optimized with the %1$s %2$s - %3$s -->', |
| 35 |
$product_name, |
| 36 |
$version, |
| 37 |
$url, |
| 38 |
); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Gets the plugin version information, including the free version if Premium is used. |
| 43 |
* |
| 44 |
* @return string The constructed version information. |
| 45 |
*/ |
| 46 |
private function construct_version_info() { |
| 47 |
/** |
| 48 |
* Filter: 'wpseo_hide_version' - can be used to hide the Yoast SEO version in the debug marker (only available in Yoast SEO Premium). |
| 49 |
* |
| 50 |
* @param bool $hide_version |
| 51 |
*/ |
| 52 |
if ( \apply_filters( 'wpseo_hide_version', false ) ) { |
| 53 |
return ''; |
| 54 |
} |
| 55 |
|
| 56 |
return 'v' . \WPSEO_PREMIUM_VERSION . ' (Yoast SEO v' . \WPSEO_VERSION . ')'; |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Gets the raw value of a presentation. |
| 61 |
* |
| 62 |
* @return string The raw value. |
| 63 |
*/ |
| 64 |
public function get() { |
| 65 |
return ''; |
| 66 |
} |
| 67 |
} |
| 68 |
|