PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
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 / score-icon-presenter.php

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

49 lines 945 B
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 /**
6 * Presenter class for a score icon.
7 */
8 class Score_Icon_Presenter extends Abstract_Presenter {
9
10 /**
11 * Holds the title.
12 *
13 * @var string
14 */
15 protected $title;
16
17 /**
18 * Holds the CSS class.
19 *
20 * @var string
21 */
22 protected $css_class;
23
24 /**
25 * Constructs a Score_Icon_Presenter.
26 *
27 * @param string $title The title and screen reader text.
28 * @param string $css_class The CSS class.
29 */
30 public function __construct( $title, $css_class ) {
31 $this->title = $title;
32 $this->css_class = $css_class;
33 }
34
35 /**
36 * Presents the score icon.
37 *
38 * @return string The score icon.
39 */
40 public function present() {
41 return \sprintf(
42 '<div aria-hidden="true" title="%1$s" class="wpseo-score-icon %3$s"><span class="wpseo-score-text screen-reader-text">%2$s</span></div>',
43 \esc_attr( $this->title ),
44 \esc_html( $this->title ),
45 \esc_attr( $this->css_class ),
46 );
47 }
48 }
49