WP-API/WP-API — pull request #211 by kadamwhite (2014-05-23 15:27:03+00:00)
Title: Add /taxonomies routes

It is frequently desirable to know about all taxonomies, regardless
of the post type to which they are associated; it is also convenient
to be able to retrieve taxonomies from a base-level endpoint.

This adds the following routes to the taxonomies class:

- /taxonomies
- /taxonomies/(?P\w+)
- /taxonomies/(?P\w+)/terms
- /taxonomies/(?P\w+)/terms/(?P\w+)

Bug Reference: #198

**Details**

I have implemented this by augmenting the existing `get_taxonomies`, `get_taxonomy`, `get_terms` and `get_term` methods, rather than creating new ones. I re-ordered the arguments of these methods and set a default for `$type = ''` in the arguments for all route handlers to allow the same function to be used with or without a `` parameter.

If the type if `''`, then, `get_taxonomies` is used to retrieve all the registered taxonomies (for the base route), and the `$base_url` value is updated to reflect the new routes (for all endpoints accessed through `/taxonomies/`.