PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.8
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.8
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 / url-list-presenter.php

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

49 lines 983 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 the URL list.
7 */
8 class Url_List_Presenter extends Abstract_Presenter {
9
10 /**
11 * A list of arrays containing titles and URLs.
12 *
13 * @var array
14 */
15 private $links;
16
17 /**
18 * Classname for the URL list.
19 *
20 * @var string
21 */
22 private $class_name;
23
24 /**
25 * Url_List_Presenter constructor.
26 *
27 * @param array $links A list of arrays containing titles and urls.
28 * @param string $class_name Classname for the url list.
29 */
30 public function __construct( $links, $class_name = 'yoast-url-list' ) {
31 $this->links = $links;
32 $this->class_name = $class_name;
33 }
34
35 /**
36 * Presents the URL list.
37 *
38 * @return string The URL list.
39 */
40 public function present() {
41 $output = '<ul class="' . $this->class_name . '">';
42 foreach ( $this->links as $link ) {
43 $output .= '<li><a href="' . $link['permalink'] . '">' . $link['title'] . '</a></li>';
44 }
45 $output .= '</ul>';
46 return $output;
47 }
48 }
49