class.wpcom-json-api-taxonomy-endpoint.php 1.2 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. abstract class WPCOM_JSON_API_Taxonomy_Endpoint extends WPCOM_JSON_API_Endpoint {
  3. public $category_object_format = array(
  4. 'ID' => '(int) The category ID.',
  5. 'name' => "(string) The name of the category.",
  6. 'slug' => "(string) The slug of the category.",
  7. 'description' => '(string) The description of the category.',
  8. 'post_count' => "(int) The number of posts using this category.",
  9. 'feed_url' => '(string) The URL of the feed for this category.',
  10. 'parent' => "(int) The parent ID for the category.",
  11. 'meta' => '(object) Meta data',
  12. );
  13. public $tag_object_format = array(
  14. 'ID' => '(int) The tag ID.',
  15. 'name' => "(string) The name of the tag.",
  16. 'slug' => "(string) The slug of the tag.",
  17. 'description' => '(string) The description of the tag.',
  18. 'post_count' => "(int) The number of posts using this t.",
  19. 'meta' => '(object) Meta data',
  20. );
  21. function __construct( $args ) {
  22. parent::__construct( $args );
  23. if ( preg_match( '#/tags/#i', $this->path ) )
  24. $this->response_format =& $this->tag_object_format;
  25. else
  26. $this->response_format =& $this->category_object_format;
  27. }
  28. }