1 | <?php |
||
15 | class MslsBlog { |
||
16 | |||
17 | /** |
||
18 | * WordPress generates such an object |
||
19 | * @var \StdClass |
||
20 | */ |
||
21 | private $obj; |
||
22 | |||
23 | /** |
||
24 | * Language-code eg. de_DE |
||
25 | * @var string |
||
26 | */ |
||
27 | private $language; |
||
28 | |||
29 | /** |
||
30 | * Description eg. Deutsch |
||
31 | * @var string |
||
32 | */ |
||
33 | private $description; |
||
34 | |||
35 | /** |
||
36 | * Constructor |
||
37 | * |
||
38 | * @param \StdClass $obj |
||
39 | * @param string $description |
||
40 | */ |
||
41 | public function __construct( $obj, $description ) { |
||
49 | |||
50 | /** |
||
51 | * Gets a member of the \StdClass-object by name |
||
52 | * |
||
53 | * The method return <em>null</em> if the requested member does not exists. |
||
54 | * |
||
55 | * @param string $key |
||
56 | * |
||
57 | * @return mixed|null |
||
58 | */ |
||
59 | final public function __get( $key ) { |
||
62 | |||
63 | /** |
||
64 | * Gets the description stored in this object |
||
65 | * |
||
66 | * The method returns the stored language if the description is empty. |
||
67 | * @return string |
||
68 | */ |
||
69 | public function get_description(): string { |
||
72 | |||
73 | /** |
||
74 | * Gets a customized title for the blog |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | public function get_title(): string { |
||
81 | |||
82 | /** |
||
83 | * Gets the language stored in this object |
||
84 | * |
||
85 | * @param string $default |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | public function get_language( $default = 'en_US' ) { |
||
92 | |||
93 | /** |
||
94 | * Gets the alpha2-part of the language-code |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | public function get_alpha2() { |
||
103 | |||
104 | /** |
||
105 | * @param MslsOptions $options |
||
106 | * |
||
107 | * @return string|null |
||
108 | */ |
||
109 | public function get_url( $options ) { |
||
116 | |||
117 | /** |
||
118 | * @param MslsOptions $options |
||
119 | * |
||
120 | * @return string|null |
||
121 | */ |
||
122 | protected function get_permalink( $options ) { |
||
137 | |||
138 | /** |
||
139 | * @return string |
||
140 | */ |
||
141 | public function get_hreflang() { |
||
155 | |||
156 | |||
157 | /** |
||
158 | * Sort objects helper |
||
159 | * |
||
160 | * @param string $a |
||
161 | * @param string $b |
||
162 | * |
||
163 | * @return int |
||
164 | */ |
||
165 | public static function _cmp( $a, $b ) { |
||
172 | |||
173 | /** |
||
174 | * Sort objects by language |
||
175 | * |
||
176 | * @param MslsBlog $a |
||
177 | * @param MslsBlog $b |
||
178 | * |
||
179 | * @return int |
||
180 | */ |
||
181 | public static function language( MslsBlog $a, MslsBlog $b ) { |
||
184 | |||
185 | /** |
||
186 | * Sort objects by description |
||
187 | * |
||
188 | * @param MslsBlog $a |
||
189 | * @param MslsBlog $b |
||
190 | * |
||
191 | * @return int |
||
192 | */ |
||
193 | public static function description( MslsBlog $a, MslsBlog $b ) { |
||
196 | |||
197 | } |
||
198 |