@@ -48,38 +48,38 @@ public static function register_tests( $tests ) {
4848 */
4949 public static function test_wellknown_endpoint () {
5050 $ result = array (
51- 'label ' => __ ( 'NodeInfo discovery is working ' , 'nodeinfo ' ),
51+ 'label ' => \ __ ( 'NodeInfo discovery is working ' , 'nodeinfo ' ),
5252 'status ' => 'good ' ,
5353 'badge ' => array (
54- 'label ' => __ ( 'Fediverse ' , 'nodeinfo ' ),
54+ 'label ' => \ __ ( 'Fediverse ' , 'nodeinfo ' ),
5555 'color ' => 'green ' ,
5656 ),
57- 'description ' => sprintf (
57+ 'description ' => \ sprintf (
5858 '<p>%s</p> ' ,
59- __ ( 'The NodeInfo discovery endpoint is accessible and other Fediverse servers can find information about your site. ' , 'nodeinfo ' )
59+ \ __ ( 'The NodeInfo discovery endpoint is accessible and other Fediverse servers can find information about your site. ' , 'nodeinfo ' )
6060 ),
6161 'actions ' => '' ,
6262 'test ' => 'nodeinfo_wellknown ' ,
6363 );
6464
65- $ url = home_url ( '/.well-known/nodeinfo ' );
66- $ response = wp_remote_get (
65+ $ url = \ home_url ( '/.well-known/nodeinfo ' );
66+ $ response = \ wp_remote_get (
6767 $ url ,
6868 array (
6969 'timeout ' => 10 ,
7070 'sslverify ' => false ,
7171 )
7272 );
7373
74- if ( is_wp_error ( $ response ) ) {
74+ if ( \ is_wp_error ( $ response ) ) {
7575 $ result ['status ' ] = 'critical ' ;
76- $ result ['label ' ] = __ ( 'NodeInfo discovery endpoint is not accessible ' , 'nodeinfo ' );
77- $ result ['description ' ] = sprintf (
76+ $ result ['label ' ] = \ __ ( 'NodeInfo discovery endpoint is not accessible ' , 'nodeinfo ' );
77+ $ result ['description ' ] = \ sprintf (
7878 '<p>%s</p><p>%s</p> ' ,
79- __ ( 'The NodeInfo discovery endpoint could not be reached. Other Fediverse servers may not be able to discover your site. ' , 'nodeinfo ' ),
80- sprintf (
79+ \ __ ( 'The NodeInfo discovery endpoint could not be reached. Other Fediverse servers may not be able to discover your site. ' , 'nodeinfo ' ),
80+ \ sprintf (
8181 /* translators: %s: Error message */
82- __ ( 'Error: %s ' , 'nodeinfo ' ),
82+ \ __ ( 'Error: %s ' , 'nodeinfo ' ),
8383 $ response ->get_error_message ()
8484 )
8585 );
@@ -88,17 +88,17 @@ public static function test_wellknown_endpoint() {
8888 return $ result ;
8989 }
9090
91- $ status_code = wp_remote_retrieve_response_code ( $ response );
91+ $ status_code = \ wp_remote_retrieve_response_code ( $ response );
9292
9393 if ( 200 !== $ status_code ) {
9494 $ result ['status ' ] = 'critical ' ;
95- $ result ['label ' ] = __ ( 'NodeInfo discovery endpoint returned an error ' , 'nodeinfo ' );
96- $ result ['description ' ] = sprintf (
95+ $ result ['label ' ] = \ __ ( 'NodeInfo discovery endpoint returned an error ' , 'nodeinfo ' );
96+ $ result ['description ' ] = \ sprintf (
9797 '<p>%s</p><p>%s</p> ' ,
98- __ ( 'The NodeInfo discovery endpoint returned an unexpected status code. This may indicate a server configuration issue. ' , 'nodeinfo ' ),
99- sprintf (
98+ \ __ ( 'The NodeInfo discovery endpoint returned an unexpected status code. This may indicate a server configuration issue. ' , 'nodeinfo ' ),
99+ \ sprintf (
100100 /* translators: %d: HTTP status code */
101- __ ( 'HTTP Status: %d ' , 'nodeinfo ' ),
101+ \ __ ( 'HTTP Status: %d ' , 'nodeinfo ' ),
102102 $ status_code
103103 )
104104 );
@@ -107,25 +107,25 @@ public static function test_wellknown_endpoint() {
107107 return $ result ;
108108 }
109109
110- $ body = wp_remote_retrieve_body ( $ response );
111- $ data = json_decode ( $ body , true );
110+ $ body = \ wp_remote_retrieve_body ( $ response );
111+ $ data = \ json_decode ( $ body , true );
112112
113113 if ( empty ( $ data ['links ' ] ) ) {
114114 $ result ['status ' ] = 'recommended ' ;
115- $ result ['label ' ] = __ ( 'NodeInfo discovery returns incomplete data ' , 'nodeinfo ' );
116- $ result ['description ' ] = sprintf (
115+ $ result ['label ' ] = \ __ ( 'NodeInfo discovery returns incomplete data ' , 'nodeinfo ' );
116+ $ result ['description ' ] = \ sprintf (
117117 '<p>%s</p> ' ,
118- __ ( 'The NodeInfo discovery endpoint is accessible but does not contain the expected links. This may indicate a plugin conflict or configuration issue. ' , 'nodeinfo ' )
118+ \ __ ( 'The NodeInfo discovery endpoint is accessible but does not contain the expected links. This may indicate a plugin conflict or configuration issue. ' , 'nodeinfo ' )
119119 );
120120 $ result ['badge ' ]['color ' ] = 'orange ' ;
121121
122122 return $ result ;
123123 }
124124
125- $ result ['actions ' ] = sprintf (
125+ $ result ['actions ' ] = \ sprintf (
126126 '<p><a href="%s" target="_blank">%s</a></p> ' ,
127- esc_url ( $ url ),
128- __ ( 'View NodeInfo discovery document ' , 'nodeinfo ' )
127+ \ esc_url ( $ url ),
128+ \ __ ( 'View NodeInfo discovery document ' , 'nodeinfo ' )
129129 );
130130
131131 return $ result ;
@@ -138,39 +138,39 @@ public static function test_wellknown_endpoint() {
138138 */
139139 public static function test_nodeinfo_endpoint () {
140140 $ result = array (
141- 'label ' => __ ( 'NodeInfo endpoint is working ' , 'nodeinfo ' ),
141+ 'label ' => \ __ ( 'NodeInfo endpoint is working ' , 'nodeinfo ' ),
142142 'status ' => 'good ' ,
143143 'badge ' => array (
144- 'label ' => __ ( 'Fediverse ' , 'nodeinfo ' ),
144+ 'label ' => \ __ ( 'Fediverse ' , 'nodeinfo ' ),
145145 'color ' => 'green ' ,
146146 ),
147- 'description ' => sprintf (
147+ 'description ' => \ sprintf (
148148 '<p>%s</p> ' ,
149- __ ( 'The NodeInfo REST endpoint returns valid data about your site. ' , 'nodeinfo ' )
149+ \ __ ( 'The NodeInfo REST endpoint returns valid data about your site. ' , 'nodeinfo ' )
150150 ),
151151 'actions ' => '' ,
152152 'test ' => 'nodeinfo_endpoint ' ,
153153 );
154154
155155 // Test the latest version (2.2).
156- $ url = get_rest_url ( null , '/nodeinfo/2.2 ' );
157- $ response = wp_remote_get (
156+ $ url = \ get_rest_url ( null , '/nodeinfo/2.2 ' );
157+ $ response = \ wp_remote_get (
158158 $ url ,
159159 array (
160160 'timeout ' => 10 ,
161161 'sslverify ' => false ,
162162 )
163163 );
164164
165- if ( is_wp_error ( $ response ) ) {
165+ if ( \ is_wp_error ( $ response ) ) {
166166 $ result ['status ' ] = 'critical ' ;
167- $ result ['label ' ] = __ ( 'NodeInfo REST endpoint is not accessible ' , 'nodeinfo ' );
168- $ result ['description ' ] = sprintf (
167+ $ result ['label ' ] = \ __ ( 'NodeInfo REST endpoint is not accessible ' , 'nodeinfo ' );
168+ $ result ['description ' ] = \ sprintf (
169169 '<p>%s</p><p>%s</p> ' ,
170- __ ( 'The NodeInfo REST endpoint could not be reached. This may indicate that the REST API is disabled or blocked. ' , 'nodeinfo ' ),
171- sprintf (
170+ \ __ ( 'The NodeInfo REST endpoint could not be reached. This may indicate that the REST API is disabled or blocked. ' , 'nodeinfo ' ),
171+ \ sprintf (
172172 /* translators: %s: Error message */
173- __ ( 'Error: %s ' , 'nodeinfo ' ),
173+ \ __ ( 'Error: %s ' , 'nodeinfo ' ),
174174 $ response ->get_error_message ()
175175 )
176176 );
@@ -179,17 +179,17 @@ public static function test_nodeinfo_endpoint() {
179179 return $ result ;
180180 }
181181
182- $ status_code = wp_remote_retrieve_response_code ( $ response );
182+ $ status_code = \ wp_remote_retrieve_response_code ( $ response );
183183
184184 if ( 200 !== $ status_code ) {
185185 $ result ['status ' ] = 'critical ' ;
186- $ result ['label ' ] = __ ( 'NodeInfo REST endpoint returned an error ' , 'nodeinfo ' );
187- $ result ['description ' ] = sprintf (
186+ $ result ['label ' ] = \ __ ( 'NodeInfo REST endpoint returned an error ' , 'nodeinfo ' );
187+ $ result ['description ' ] = \ sprintf (
188188 '<p>%s</p><p>%s</p> ' ,
189- __ ( 'The NodeInfo REST endpoint returned an unexpected status code. ' , 'nodeinfo ' ),
190- sprintf (
189+ \ __ ( 'The NodeInfo REST endpoint returned an unexpected status code. ' , 'nodeinfo ' ),
190+ \ sprintf (
191191 /* translators: %d: HTTP status code */
192- __ ( 'HTTP Status: %d ' , 'nodeinfo ' ),
192+ \ __ ( 'HTTP Status: %d ' , 'nodeinfo ' ),
193193 $ status_code
194194 )
195195 );
@@ -198,25 +198,25 @@ public static function test_nodeinfo_endpoint() {
198198 return $ result ;
199199 }
200200
201- $ body = wp_remote_retrieve_body ( $ response );
202- $ data = json_decode ( $ body , true );
201+ $ body = \ wp_remote_retrieve_body ( $ response );
202+ $ data = \ json_decode ( $ body , true );
203203
204204 if ( empty ( $ data ['software ' ]['name ' ] ) || empty ( $ data ['version ' ] ) ) {
205205 $ result ['status ' ] = 'recommended ' ;
206- $ result ['label ' ] = __ ( 'NodeInfo endpoint returns incomplete data ' , 'nodeinfo ' );
207- $ result ['description ' ] = sprintf (
206+ $ result ['label ' ] = \ __ ( 'NodeInfo endpoint returns incomplete data ' , 'nodeinfo ' );
207+ $ result ['description ' ] = \ sprintf (
208208 '<p>%s</p> ' ,
209- __ ( 'The NodeInfo endpoint is accessible but does not contain all expected fields. ' , 'nodeinfo ' )
209+ \ __ ( 'The NodeInfo endpoint is accessible but does not contain all expected fields. ' , 'nodeinfo ' )
210210 );
211211 $ result ['badge ' ]['color ' ] = 'orange ' ;
212212
213213 return $ result ;
214214 }
215215
216- $ result ['actions ' ] = sprintf (
216+ $ result ['actions ' ] = \ sprintf (
217217 '<p><a href="%s" target="_blank">%s</a></p> ' ,
218- esc_url ( $ url ),
219- __ ( 'View NodeInfo 2.2 endpoint ' , 'nodeinfo ' )
218+ \ esc_url ( $ url ),
219+ \ __ ( 'View NodeInfo 2.2 endpoint ' , 'nodeinfo ' )
220220 );
221221
222222 return $ result ;
0 commit comments