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 / helpers / home-url-helper.php

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

46 lines 681 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 static::$home_url ??= \home_url();
31
32 return static::$home_url;
33 }
34
35 /**
36 * Retrieves the home url that has been parsed.
37 *
38 * @return array The parsed url.
39 */
40 public function get_parsed() {
41 static::$parsed_home_url ??= \wp_parse_url( $this->get() );
42
43 return static::$parsed_home_url;
44 }
45 }
46