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 | * Get 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 | * Get 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() { |
||
72 | |||
73 | /** |
||
74 | * Gets the language stored in this object |
||
75 | * |
||
76 | * @param string $default |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | public function get_language( $default = 'en_US' ) { |
||
83 | |||
84 | /** |
||
85 | * Gets the alpha2-part of the language-code |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | public function get_alpha2() { |
||
94 | |||
95 | /** |
||
96 | * @param MslsOptions $options |
||
97 | * |
||
98 | * @return string|null |
||
99 | */ |
||
100 | public function get_url( $options ) { |
||
107 | |||
108 | /** |
||
109 | * @param MslsOptions $options |
||
110 | * |
||
111 | * @return string|null |
||
112 | */ |
||
113 | protected function get_permalink( $options ) { |
||
126 | |||
127 | /** |
||
128 | * @return string |
||
129 | */ |
||
130 | public function get_hreflang() { |
||
144 | |||
145 | |||
146 | /** |
||
147 | * Sort objects helper |
||
148 | * |
||
149 | * @param string $a |
||
150 | * @param string $b |
||
151 | * |
||
152 | * @return int |
||
153 | */ |
||
154 | public static function _cmp( $a, $b ) { |
||
161 | |||
162 | /** |
||
163 | * Sort objects by language |
||
164 | * |
||
165 | * @param MslsBlog $a |
||
166 | * @param MslsBlog $b |
||
167 | * |
||
168 | * @return int |
||
169 | */ |
||
170 | public static function language( MslsBlog $a, MslsBlog $b ) { |
||
173 | |||
174 | /** |
||
175 | * Sort objects by description |
||
176 | * |
||
177 | * @param MslsBlog $a |
||
178 | * @param MslsBlog $b |
||
179 | * |
||
180 | * @return int |
||
181 | */ |
||
182 | public static function description( MslsBlog $a, MslsBlog $b ) { |
||
185 | |||
186 | } |
||
187 |