1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Leonidas\Library\System\Model\Site; |
4
|
|
|
|
5
|
|
|
use Leonidas\Contracts\System\Model\Site\SiteInterface; |
6
|
|
|
use Leonidas\Library\System\Model\Abstracts\GetAccessGrantedTrait; |
7
|
|
|
use Leonidas\Library\System\Model\GetAccessProvider; |
8
|
|
|
|
9
|
|
|
class Site implements SiteInterface |
10
|
|
|
{ |
11
|
|
|
use GetAccessGrantedTrait; |
12
|
|
|
|
13
|
|
|
protected string $title; |
14
|
|
|
|
15
|
|
|
protected string $description; |
16
|
|
|
|
17
|
|
|
protected string $icon; |
18
|
|
|
|
19
|
|
|
protected string $url; |
20
|
|
|
|
21
|
|
|
protected string $adminUrl; |
22
|
|
|
|
23
|
|
|
protected string $charset; |
24
|
|
|
|
25
|
|
|
protected string $locale; |
26
|
|
|
|
27
|
|
|
protected string $languageAttributes; |
28
|
|
|
|
29
|
|
|
protected string $rssUrl; |
30
|
|
|
|
31
|
|
|
protected string $rss2Url; |
32
|
|
|
|
33
|
|
|
protected string $atomUrl; |
34
|
|
|
|
35
|
|
|
protected string $rdfUrl; |
36
|
|
|
|
37
|
|
|
protected string $pingbackUrl; |
38
|
|
|
|
39
|
|
|
public function __construct() |
40
|
|
|
{ |
41
|
|
|
$this->getAccessProvider = new GetAccessProvider($this); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function getTitle(): string |
45
|
|
|
{ |
46
|
|
|
return $this->title ??= get_bloginfo('name'); |
|
|
|
|
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function getDescription(): string |
50
|
|
|
{ |
51
|
|
|
return $this->description ??= get_bloginfo('description'); |
|
|
|
|
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getIcon(int $size = 512): string |
55
|
|
|
{ |
56
|
|
|
return $this->icon ??= get_site_icon_url($size); |
|
|
|
|
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function getUrl(): string |
60
|
|
|
{ |
61
|
|
|
return $this->url ??= get_home_url(); |
|
|
|
|
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function getAdminUrl(): string |
65
|
|
|
{ |
66
|
|
|
return $this->adminUrl ??= get_admin_url(); |
|
|
|
|
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function getCharset(): string |
70
|
|
|
{ |
71
|
|
|
return $this->charset ??= get_bloginfo('charset'); |
|
|
|
|
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function getLocale(): string |
75
|
|
|
{ |
76
|
|
|
return $this->locale ??= get_locale(); |
|
|
|
|
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function getLanguageAttributes(): string |
80
|
|
|
{ |
81
|
|
|
return $this->languageAttributes ??= get_language_attributes(); |
|
|
|
|
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function getRssUrl(): string |
85
|
|
|
{ |
86
|
|
|
return $this->rssUrl ??= get_feed_link('rss'); |
|
|
|
|
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function getRss2Url(): string |
90
|
|
|
{ |
91
|
|
|
return $this->rss2Url ??= get_feed_link('rss2'); |
|
|
|
|
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function getAtomUrl(): string |
95
|
|
|
{ |
96
|
|
|
return $this->atomUrl ??= get_feed_link('atom'); |
|
|
|
|
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function getRdfUrl(): string |
100
|
|
|
{ |
101
|
|
|
return $this->rdfUrl ??= get_feed_link('rdf'); |
|
|
|
|
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function getPingbackUrl(): string |
105
|
|
|
{ |
106
|
|
|
return $this->pingbackUrl ??= get_bloginfo('pingback_url'); |
|
|
|
|
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|