PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | json-endpoints/class.wpcom-json-api-taxonomy-endpoint.php +55 -0 16.2-beta → 16.3 View file →
@@ -1,0 +1,55 @@
1 +<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 +
3 +if ( ! defined( 'ABSPATH' ) ) {
4 + exit( 0 );
5 +}
6 +
7 +/**
8 + * Taxonomy endpoint.
9 + */
10 +abstract class WPCOM_JSON_API_Taxonomy_Endpoint extends WPCOM_JSON_API_Endpoint {
11 +
12 + /**
13 + * Category object format.
14 + *
15 + * @var array
16 + */
17 + public $category_object_format = array(
18 + 'ID' => '(int) The category ID.',
19 + 'name' => '(string) The name of the category.',
20 + 'slug' => '(string) The slug of the category.',
21 + 'description' => '(string) The description of the category.',
22 + 'post_count' => '(int) The number of posts using this category.',
23 + 'feed_url' => '(string) The URL of the feed for this category.',
24 + 'parent' => '(int) The parent ID for the category.',
25 + 'meta' => '(object) Meta data',
26 + );
27 +
28 + /**
29 + * Tag object format.
30 + *
31 + * @var array
32 + */
33 + public $tag_object_format = array(
34 + 'ID' => '(int) The tag ID.',
35 + 'name' => '(string) The name of the tag.',
36 + 'slug' => '(string) The slug of the tag.',
37 + 'description' => '(string) The description of the tag.',
38 + 'post_count' => '(int) The number of posts using this t.',
39 + 'meta' => '(object) Meta data',
40 + );
41 +
42 + /**
43 + * Constructor function.
44 + *
45 + * @param string|array|object $args - the arguments.
46 + */
47 + public function __construct( $args ) {
48 + parent::__construct( $args );
49 + if ( preg_match( '#/tags/#i', $this->path ) ) {
50 + $this->response_format =& $this->tag_object_format;
51 + } else {
52 + $this->response_format =& $this->category_object_format;
53 + }
54 + }
55 +}