admin
3 months ago
debug
3 months ago
open-graph
3 months ago
slack
2 years ago
twitter
2 years ago
webmaster
8 months ago
abstract-indexable-presenter.php
4 years ago
abstract-indexable-tag-presenter.php
3 months ago
abstract-presenter.php
5 years ago
breadcrumbs-presenter.php
1 year ago
canonical-presenter.php
1 year ago
meta-author-presenter.php
3 years ago
meta-description-presenter.php
3 months ago
rel-next-presenter.php
2 years ago
rel-prev-presenter.php
2 years ago
robots-presenter.php
4 years ago
robots-txt-presenter.php
1 month ago
schema-presenter.php
2 years ago
score-icon-presenter.php
3 months ago
title-presenter.php
2 years ago
url-list-presenter.php
3 months ago
score-icon-presenter.php
49 lines
| 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 |