PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.2
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.2
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 / helpers / home-url-helper.php

home-url-helper.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.2, at src/helpers/home-url-helper.php

50 lines 770 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\Helpers;
4
5 /**
6 * A helper object for the home URL.
7 */
8 class Home_Url_Helper {
9
10 /**
11 * The home url.
12 *
13 * @var string
14 */
15 protected static $home_url;
16
17 /**
18 * The parsed home url.
19 *
20 * @var array
21 */
22 protected static $parsed_home_url;
23
24 /**
25 * Retrieves the home url.
26 *
27 * @return string The home url.
28 */
29 public function get() {
30 if ( static::$home_url === null ) {
31 static::$home_url = \home_url();
32 }
33
34 return static::$home_url;
35 }
36
37 /**
38 * Retrieves the home url that has been parsed.
39 *
40 * @return array The parsed url.
41 */
42 public function get_parsed() {
43 if ( static::$parsed_home_url === null ) {
44 static::$parsed_home_url = \wp_parse_url( $this->get() );
45 }
46
47 return static::$parsed_home_url;
48 }
49 }
50