| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Presenters; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\Presentations\Indexable_Presentation; |
| 6 |
|
| 7 |
\_deprecated_file( \basename( __FILE__ ), 'WPSEO 14.9' ); |
| 8 |
|
| 9 |
/** |
| 10 |
* Presenter class for the googlebot output. |
| 11 |
*/ |
| 12 |
class Googlebot_Presenter extends Abstract_Indexable_Presenter { |
| 13 |
|
| 14 |
/** |
| 15 |
* Returns the googlebot output. |
| 16 |
* |
| 17 |
* @deprecated 14.9 Values merged into the robots meta tag. |
| 18 |
* @codeCoverageIgnore |
| 19 |
* |
| 20 |
* @return string The googlebot output tag. |
| 21 |
*/ |
| 22 |
public function present() { |
| 23 |
\_deprecated_function( __METHOD__, 'WPSEO 14.9' ); |
| 24 |
|
| 25 |
$googlebot = \implode( ', ', $this->get() ); |
| 26 |
$googlebot = $this->filter( $googlebot ); |
| 27 |
|
| 28 |
if ( \is_string( $googlebot ) && $googlebot !== '' ) { |
| 29 |
return \sprintf( '<meta name="googlebot" content="%s" />', \esc_attr( $googlebot ) ); |
| 30 |
} |
| 31 |
|
| 32 |
return ''; |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Gets the raw value of a presentation. |
| 37 |
* |
| 38 |
* @deprecated 14.9 Values merged into the robots meta tag. |
| 39 |
* @codeCoverageIgnore |
| 40 |
* |
| 41 |
* @return array The raw value. |
| 42 |
*/ |
| 43 |
public function get() { |
| 44 |
\_deprecated_function( __METHOD__, 'WPSEO 14.9' ); |
| 45 |
|
| 46 |
return $this->presentation->googlebot; |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* Run the googlebot output content through the `wpseo_googlebot` filter. |
| 51 |
* |
| 52 |
* @param string $googlebot The meta googlebot output to filter. |
| 53 |
* |
| 54 |
* @return string The filtered meta googlebot output. |
| 55 |
*/ |
| 56 |
private function filter( $googlebot ) { |
| 57 |
/** |
| 58 |
* Filter: 'wpseo_googlebot' - Allows filtering of the meta googlebot output of Yoast SEO. |
| 59 |
* |
| 60 |
* @api string $googlebot The meta googlebot directives to be echoed. |
| 61 |
* |
| 62 |
* @param Indexable_Presentation $presentation The presentation of an indexable. |
| 63 |
*/ |
| 64 |
return (string) \apply_filters( 'wpseo_googlebot', $googlebot, $this->presentation ); |
| 65 |
} |
| 66 |
} |
| 67 |
|