PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.3
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.3
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / presenters / googlebot-presenter.php

googlebot-presenter.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.3, at src/presenters/googlebot-presenter.php

67 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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