| @@ -51,9 +51,9 @@ | ||
| 51 | 51 | \register_rest_route( |
| 52 | 52 | $this->namespace, |
| 53 | 53 | '/' . $this->rest_base . '/(?P<version>\d\.\d)', |
| 54 | 54 | array( |
| 55 | - 'args' => array( | |
| 55 | + 'args' => array( | |
| 56 | 56 | 'version' => array( |
| 57 | 57 | 'description' => 'The version of the NodeInfo schema.', |
| 58 | 58 | 'type' => 'string', |
| 59 | 59 | 'required' => true, |
| @@ -63,9 +63,8 @@ | ||
| 63 | 63 | 'methods' => \WP_REST_Server::READABLE, |
| 64 | 64 | 'callback' => array( $this, 'get_item' ), |
| 65 | 65 | 'permission_callback' => '__return_true', |
| 66 | 66 | ), |
| 67 | - 'schema' => array( $this, 'get_item_schema' ), | |
| 68 | 67 | ) |
| 69 | 68 | ); |
| 70 | 69 | } |
| 71 | 70 | |
| @@ -156,9 +155,9 @@ | ||
| 156 | 155 | 'software' => array( |
| 157 | 156 | 'name' => 'wordpress', |
| 158 | 157 | 'version' => get_masked_wp_version(), |
| 159 | 158 | ), |
| 160 | - 'openRegistrations' => (bool) \get_option( 'users_can_register' ), | |
| 159 | + 'openRegistrations' => (bool) get_option( 'users_can_register' ), | |
| 161 | 160 | 'usage' => array( |
| 162 | 161 | 'localPosts' => (int) $posts->publish, |
| 163 | 162 | 'localComments' => $comments->approved, |
| 164 | 163 | ), |
| @@ -175,174 +174,6 @@ | ||
| 175 | 174 | * @param array $nodeinfo The NodeInfo data. |
| 176 | 175 | * @param string $version The NodeInfo version. |
| 177 | 176 | */ |
| 178 | 177 | return \apply_filters( 'nodeinfo_data', $nodeinfo, $version ); |
| 179 | - } | |
| 180 | - | |
| 181 | - /** | |
| 182 | - * Retrieves the NodeInfo schema, conforming to JSON Schema. | |
| 183 | - * | |
| 184 | - * @return array NodeInfo schema data. | |
| 185 | - */ | |
| 186 | - public function get_item_schema() { | |
| 187 | - return array( | |
| 188 | - '$schema' => 'http://json-schema.org/draft-04/schema#', | |
| 189 | - 'title' => 'nodeinfo', | |
| 190 | - 'type' => 'object', | |
| 191 | - 'properties' => array( | |
| 192 | - 'version' => array( | |
| 193 | - 'description' => 'The version of the NodeInfo schema.', | |
| 194 | - 'type' => 'string', | |
| 195 | - 'enum' => array( '2.0', '2.1' ), | |
| 196 | - ), | |
| 197 | - 'software' => array( | |
| 198 | - 'description' => 'Information about the software.', | |
| 199 | - 'type' => 'object', | |
| 200 | - 'properties' => array( | |
| 201 | - 'name' => array( | |
| 202 | - 'description' => 'The canonical name of this server software.', | |
| 203 | - 'type' => 'string', | |
| 204 | - ), | |
| 205 | - 'version' => array( | |
| 206 | - 'description' => 'The version of this server software.', | |
| 207 | - 'type' => 'string', | |
| 208 | - ), | |
| 209 | - 'homepage' => array( | |
| 210 | - 'description' => 'The url of the homepage of this server software.', | |
| 211 | - 'type' => 'string', | |
| 212 | - 'format' => 'uri', | |
| 213 | - ), | |
| 214 | - 'repository' => array( | |
| 215 | - 'description' => 'The url of the source code repository of this server software.', | |
| 216 | - 'type' => 'string', | |
| 217 | - 'format' => 'uri', | |
| 218 | - ), | |
| 219 | - ), | |
| 220 | - ), | |
| 221 | - 'protocols' => array( | |
| 222 | - 'description' => 'The protocols supported on this server.', | |
| 223 | - 'type' => 'array', | |
| 224 | - 'items' => array( | |
| 225 | - 'type' => 'string', | |
| 226 | - 'enum' => array( | |
| 227 | - 'activitypub', | |
| 228 | - 'buddycloud', | |
| 229 | - 'dfrn', | |
| 230 | - 'diaspora', | |
| 231 | - 'libertree', | |
| 232 | - 'ostatus', | |
| 233 | - 'pumpio', | |
| 234 | - 'tent', | |
| 235 | - 'xmpp', | |
| 236 | - 'zot', | |
| 237 | - ), | |
| 238 | - ), | |
| 239 | - ), | |
| 240 | - 'services' => array( | |
| 241 | - 'description' => 'The third party sites this server can connect to via their application API.', | |
| 242 | - 'type' => 'object', | |
| 243 | - 'properties' => array( | |
| 244 | - 'inbound' => array( | |
| 245 | - 'description' => 'The third party sites this server can retrieve messages from for combined display with regular traffic.', | |
| 246 | - 'type' => 'array', | |
| 247 | - 'items' => array( | |
| 248 | - 'type' => 'string', | |
| 249 | - 'enum' => array( | |
| 250 | - 'atom1.0', | |
| 251 | - 'gnusocial', | |
| 252 | - 'imap', | |
| 253 | - 'pnut', | |
| 254 | - 'pop3', | |
| 255 | - 'pumpio', | |
| 256 | - 'rss2.0', | |
| 257 | - 'twitter', | |
| 258 | - ), | |
| 259 | - ), | |
| 260 | - ), | |
| 261 | - 'outbound' => array( | |
| 262 | - 'description' => 'The third party sites this server can publish messages to on the behalf of a user.', | |
| 263 | - 'type' => 'array', | |
| 264 | - 'items' => array( | |
| 265 | - 'type' => 'string', | |
| 266 | - 'enum' => array( | |
| 267 | - 'atom1.0', | |
| 268 | - 'blogger', | |
| 269 | - 'buddycloud', | |
| 270 | - 'diaspora', | |
| 271 | - 'dreamwidth', | |
| 272 | - 'drupal', | |
| 273 | - 'facebook', | |
| 274 | - 'friendica', | |
| 275 | - 'gnusocial', | |
| 276 | - 'google', | |
| 277 | - 'insanejournal', | |
| 278 | - 'libertree', | |
| 279 | - 'linkedin', | |
| 280 | - 'livejournal', | |
| 281 | - 'mediagoblin', | |
| 282 | - 'myspace', | |
| 283 | - 'pinterest', | |
| 284 | - 'pnut', | |
| 285 | - 'posterous', | |
| 286 | - 'pumpio', | |
| 287 | - 'redmatrix', | |
| 288 | - 'rss2.0', | |
| 289 | - 'smtp', | |
| 290 | - 'tent', | |
| 291 | - 'tumblr', | |
| 292 | - 'twitter', | |
| 293 | - 'wordpress', | |
| 294 | - 'xmpp', | |
| 295 | - ), | |
| 296 | - ), | |
| 297 | - ), | |
| 298 | - ), | |
| 299 | - ), | |
| 300 | - 'openRegistrations' => array( | |
| 301 | - 'description' => 'Whether this server allows open self-registration.', | |
| 302 | - 'type' => 'boolean', | |
| 303 | - ), | |
| 304 | - 'usage' => array( | |
| 305 | - 'description' => 'Usage statistics for this server.', | |
| 306 | - 'type' => 'object', | |
| 307 | - 'properties' => array( | |
| 308 | - 'users' => array( | |
| 309 | - 'description' => 'Statistics about the users of this server.', | |
| 310 | - 'type' => 'object', | |
| 311 | - 'properties' => array( | |
| 312 | - 'total' => array( | |
| 313 | - 'description' => 'The total amount of on this server registered users.', | |
| 314 | - 'type' => 'integer', | |
| 315 | - 'minimum' => 0, | |
| 316 | - ), | |
| 317 | - 'activeMonth' => array( | |
| 318 | - 'description' => 'The amount of users that signed in at least once in the last 30 days.', | |
| 319 | - 'type' => 'integer', | |
| 320 | - 'minimum' => 0, | |
| 321 | - ), | |
| 322 | - 'activeHalfyear' => array( | |
| 323 | - 'description' => 'The amount of users that signed in at least once in the last 180 days.', | |
| 324 | - 'type' => 'integer', | |
| 325 | - 'minimum' => 0, | |
| 326 | - ), | |
| 327 | - ), | |
| 328 | - ), | |
| 329 | - 'localPosts' => array( | |
| 330 | - 'description' => 'The amount of posts that were made by users that are registered on this server.', | |
| 331 | - 'type' => 'integer', | |
| 332 | - 'minimum' => 0, | |
| 333 | - ), | |
| 334 | - 'localComments' => array( | |
| 335 | - 'description' => 'The amount of comments that were made by users that are registered on this server.', | |
| 336 | - 'type' => 'integer', | |
| 337 | - 'minimum' => 0, | |
| 338 | - ), | |
| 339 | - ), | |
| 340 | - ), | |
| 341 | - 'metadata' => array( | |
| 342 | - 'description' => 'Free form key value pairs for software specific values.', | |
| 343 | - 'type' => 'object', | |
| 344 | - ), | |
| 345 | - ), | |
| 346 | - ); | |
| 347 | 178 | } |
| 348 | 179 | } |