Version Description
Two new request arguments added: thumbnail_size
and post_type
Download this release
Release Info
Developer | dphiffer |
Plugin | JSON API |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- json-api.php +1 -1
- models/post.php +4 -1
- readme.txt +14 -3
- singletons/introspector.php +4 -0
json-api.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: JSON API
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/json-api/
|
5 |
Description: A RESTful API for WordPress
|
6 |
-
Version: 1.0.
|
7 |
Author: Dan Phiffer
|
8 |
Author URI: http://phiffer.org/
|
9 |
*/
|
3 |
Plugin Name: JSON API
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/json-api/
|
5 |
Description: A RESTful API for WordPress
|
6 |
+
Version: 1.0.3
|
7 |
Author: Dan Phiffer
|
8 |
Author URI: http://phiffer.org/
|
9 |
*/
|
models/post.php
CHANGED
@@ -266,7 +266,10 @@ class JSON_API_Post {
|
|
266 |
}
|
267 |
|
268 |
function get_thumbnail_size() {
|
269 |
-
|
|
|
|
|
|
|
270 |
$sizes = get_intermediate_image_sizes();
|
271 |
if (in_array('post-thumbnail', $sizes)) {
|
272 |
return 'post-thumbnail';
|
266 |
}
|
267 |
|
268 |
function get_thumbnail_size() {
|
269 |
+
global $json_api;
|
270 |
+
if ($json_api->query->thumbnail_size) {
|
271 |
+
return $json_api->query->thumbnail_size;
|
272 |
+
} else if (function_exists('get_intermediate_image_sizes')) {
|
273 |
$sizes = get_intermediate_image_sizes();
|
274 |
if (in_array('post-thumbnail', $sizes)) {
|
275 |
return 'post-thumbnail';
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: json, api, ajax, cms, admin, integration, moma
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 3.0
|
7 |
-
Stable tag: 1.0.
|
8 |
|
9 |
A RESTful API for WordPress
|
10 |
|
@@ -213,7 +213,9 @@ Returns an array of recent posts. You can invoke this from the WordPress home pa
|
|
213 |
|
214 |
= Optional arguments =
|
215 |
|
|
|
216 |
* `page` - return a specific page number from the results
|
|
|
217 |
|
218 |
= Response =
|
219 |
|
@@ -664,6 +666,9 @@ Developers familiar with WordPress may notice that many names for properties and
|
|
664 |
* `thumbnail` - String (only included if a post thumbnail has been specified)
|
665 |
* `custom_fields` - Object (included by setting the `custom_fields` argument to a comma-separated list of custom field names)
|
666 |
|
|
|
|
|
|
|
667 |
== 4.2. Category response object ==
|
668 |
|
669 |
* `id` - Integer
|
@@ -873,10 +878,13 @@ Here is an example of how you might use the introspector:
|
|
873 |
);
|
874 |
}
|
875 |
|
876 |
-
|
877 |
== Changelog ==
|
878 |
|
879 |
-
= 1.0.
|
|
|
|
|
|
|
|
|
880 |
* Removed an inaccurate section from readme.txt about supporting `query_posts` arguments
|
881 |
* Changed controller info block format to use "Controller name" and "Controller description"
|
882 |
* Made admin page more robust about handling errors loading controllers
|
@@ -954,6 +962,9 @@ Here is an example of how you might use the introspector:
|
|
954 |
|
955 |
== Upgrade Notice ==
|
956 |
|
|
|
|
|
|
|
957 |
= 1.0.2 =
|
958 |
Minor bugfix release
|
959 |
|
4 |
Tags: json, api, ajax, cms, admin, integration, moma
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 3.0
|
7 |
+
Stable tag: 1.0.3
|
8 |
|
9 |
A RESTful API for WordPress
|
10 |
|
213 |
|
214 |
= Optional arguments =
|
215 |
|
216 |
+
* `count` - determines how many posts per page are returned (default value is 10)
|
217 |
* `page` - return a specific page number from the results
|
218 |
+
* `post_type` - used to retrieve custom post types
|
219 |
|
220 |
= Response =
|
221 |
|
666 |
* `thumbnail` - String (only included if a post thumbnail has been specified)
|
667 |
* `custom_fields` - Object (included by setting the `custom_fields` argument to a comma-separated list of custom field names)
|
668 |
|
669 |
+
__Note__
|
670 |
+
The `thumbnail` attribute returns a URL to the image size specified by the optional `thumbnail_size` request argument. By default this will use the `thumbnail` or `post-thumbnail` sizes, depending on your version of WordPress. See [Mark Jaquith's post on the topic](http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/) for more information.
|
671 |
+
|
672 |
== 4.2. Category response object ==
|
673 |
|
674 |
* `id` - Integer
|
878 |
);
|
879 |
}
|
880 |
|
|
|
881 |
== Changelog ==
|
882 |
|
883 |
+
= 1.0.3 (2010-07-07): =
|
884 |
+
* Added request argument `thumbnail_size` to support different sizes of featured images (see also: `add_image_size` WordPress function)
|
885 |
+
* Added request argument `post_type` to support custom post types (props Mark Harris)
|
886 |
+
|
887 |
+
= 1.0.2 (2010-07-02): =
|
888 |
* Removed an inaccurate section from readme.txt about supporting `query_posts` arguments
|
889 |
* Changed controller info block format to use "Controller name" and "Controller description"
|
890 |
* Made admin page more robust about handling errors loading controllers
|
962 |
|
963 |
== Upgrade Notice ==
|
964 |
|
965 |
+
= 1.0.3 =
|
966 |
+
Two new request arguments added: `thumbnail_size` and `post_type`
|
967 |
+
|
968 |
= 1.0.2 =
|
969 |
Minor bugfix release
|
970 |
|
singletons/introspector.php
CHANGED
@@ -276,6 +276,10 @@ class JSON_API_Introspector {
|
|
276 |
$query['posts_per_page'] = $json_api->query->count;
|
277 |
}
|
278 |
|
|
|
|
|
|
|
|
|
279 |
if (!empty($query)) {
|
280 |
query_posts($query);
|
281 |
}
|
276 |
$query['posts_per_page'] = $json_api->query->count;
|
277 |
}
|
278 |
|
279 |
+
if ($json_api->query->post_type) {
|
280 |
+
$query['post_type'] = $json_api->query->post_type;
|
281 |
+
}
|
282 |
+
|
283 |
if (!empty($query)) {
|
284 |
query_posts($query);
|
285 |
}
|