1
1
<?php
2
- /**
3
- * MslsOutput
4
- * @author Dennis Ploetner <[email protected] >
5
- * @since 0.9.8
6
- */
7
2
8
3
namespace lloc \Msls ;
9
4
10
5
use lloc \Msls \Map \HrefLang ;
11
6
12
7
/**
13
8
* Output in the frontend
9
+ *
14
10
* @package Msls
15
11
*/
16
12
class MslsOutput extends MslsMain {
17
13
18
14
/**
19
15
* Holds the format for the output
16
+ *
20
17
* @var array $tags
21
18
*/
22
19
protected $ tags ;
23
20
24
21
/**
25
22
* Creates and gets the output as an array
26
23
*
27
- * @param int $display
24
+ * @param int $display
28
25
* @param bool $filter
29
26
* @param bool $exists
30
27
*
@@ -33,7 +30,7 @@ class MslsOutput extends MslsMain {
33
30
* @uses MslsOptions
34
31
*/
35
32
public function get ( $ display , $ filter = false , $ exists = false ) {
36
- $ arr = [] ;
33
+ $ arr = array () ;
37
34
38
35
$ blogs = $ this ->collection ->get_filtered ( $ filter );
39
36
if ( $ blogs ) {
@@ -73,9 +70,8 @@ public function get( $display, $filter = false, $exists = false ) {
73
70
* @param bool $is_current_blog
74
71
*
75
72
* @since 0.9.8
76
- *
77
73
*/
78
- $ arr [] = ( string ) apply_filters ( 'msls_output_get ' , $ url , $ link , $ is_current_blog );
74
+ $ arr [] = (string ) apply_filters ( 'msls_output_get ' , $ url , $ link , $ is_current_blog );
79
75
} else {
80
76
$ arr [] = sprintf (
81
77
'<a href="%s" title="%s"%s>%s</a> ' ,
@@ -101,7 +97,7 @@ public function get_alternate_links() {
101
97
$ hreflang = new HrefLang ( $ blogs );
102
98
$ options = MslsOptions::create ();
103
99
104
- $ arr = [] ;
100
+ $ arr = array () ;
105
101
$ default = '' ;
106
102
107
103
foreach ( $ blogs ->get_objects () as $ blog ) {
@@ -132,6 +128,7 @@ public function get_alternate_links() {
132
128
133
129
/**
134
130
* Returns a string when the object will be treated like a string
131
+ *
135
132
* @return string
136
133
*/
137
134
public function __toString () {
@@ -147,32 +144,32 @@ public function __toString() {
147
144
$ tags = $ this ->get_tags ();
148
145
149
146
return $ tags ['before_output ' ] . $ tags ['before_item ' ] .
150
- implode ( $ tags ['after_item ' ] . $ tags ['before_item ' ], $ arr ) .
151
- $ tags ['after_item ' ] . $ tags ['after_output ' ];
147
+ implode ( $ tags ['after_item ' ] . $ tags ['before_item ' ], $ arr ) .
148
+ $ tags ['after_item ' ] . $ tags ['after_output ' ];
152
149
}
153
150
154
151
/**
155
152
* Gets tags for the output
153
+ *
156
154
* @return array
157
155
*/
158
156
public function get_tags () {
159
157
if ( empty ( $ this ->tags ) ) {
160
- $ this ->tags = [
158
+ $ this ->tags = array (
161
159
'before_item ' => $ this ->options ->before_item ,
162
160
'after_item ' => $ this ->options ->after_item ,
163
161
'before_output ' => $ this ->options ->before_output ,
164
162
'after_output ' => $ this ->options ->after_output ,
165
- ] ;
163
+ ) ;
166
164
167
165
/**
168
166
* Returns tags array for the output
169
167
*
170
168
* @param array $tags
171
169
*
172
170
* @since 1.0
173
- *
174
171
*/
175
- $ this ->tags = ( array ) apply_filters ( 'msls_output_get_tags ' , $ this ->tags );
172
+ $ this ->tags = (array ) apply_filters ( 'msls_output_get_tags ' , $ this ->tags );
176
173
}
177
174
178
175
return $ this ->tags ;
@@ -185,7 +182,7 @@ public function get_tags() {
185
182
*
186
183
* @return MslsOutput
187
184
*/
188
- public function set_tags ( array $ arr = [] ) {
185
+ public function set_tags ( array $ arr = array () ) {
189
186
$ this ->tags = wp_parse_args ( $ this ->get_tags (), $ arr );
190
187
191
188
return $ this ;
@@ -195,8 +192,8 @@ public function set_tags( array $arr = [] ) {
195
192
* Returns true if the requirements not fulfilled
196
193
*
197
194
* @param MslsOptions|null $thing
198
- * @param boolean $exists
199
- * @param string $language
195
+ * @param boolean $exists
196
+ * @param string $language
200
197
*
201
198
* @return boolean
202
199
*/
@@ -207,5 +204,4 @@ public function is_requirements_not_fulfilled( $thing, $exists, $language ) {
207
204
208
205
return MslsOptions::class != get_class ( $ thing ) && ! $ thing ->has_value ( $ language ) && $ exists ;
209
206
}
210
-
211
207
}
0 commit comments