JSON API - Version 1.0.5

Version Description

Minor improvement release

Download this release

Release Info

Developer dphiffer
Plugin Icon wp plugin JSON API
Version 1.0.5
Comparing to
See all releases

Code changes from version 1.0.4 to 1.0.5

Files changed (3) hide show
  1. controllers/core.php +10 -1
  2. json-api.php +1 -1
  3. readme.txt +24 -4
controllers/core.php CHANGED
@@ -8,11 +8,20 @@ class JSON_API_Core_Controller {
8
 
9
  public function info() {
10
  global $json_api;
 
11
  if (!empty($json_api->query->controller)) {
12
  return $json_api->controller_info($json_api->query->controller);
13
  } else {
14
  $dir = json_api_dir();
15
- $php = file_get_contents("$dir/json-api.php");
 
 
 
 
 
 
 
 
16
  if (preg_match('/^\s*Version:\s*(.+)$/m', $php, $matches)) {
17
  $version = $matches[1];
18
  } else {
8
 
9
  public function info() {
10
  global $json_api;
11
+ $php = '';
12
  if (!empty($json_api->query->controller)) {
13
  return $json_api->controller_info($json_api->query->controller);
14
  } else {
15
  $dir = json_api_dir();
16
+ if (file_exists("$dir/json-api.php")) {
17
+ $php = file_get_contents("$dir/json-api.php");
18
+ } else {
19
+ // Check one directory up, in case json-api.php was moved
20
+ $dir = dirname($dir);
21
+ if (file_exists("$dir/json-api.php")) {
22
+ $php = file_get_contents("$dir/json-api.php");
23
+ }
24
+ }
25
  if (preg_match('/^\s*Version:\s*(.+)$/m', $php, $matches)) {
26
  $version = $matches[1];
27
  } else {
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.4
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.5
7
  Author: Dan Phiffer
8
  Author URI: http://phiffer.org/
9
  */
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.4
8
 
9
  A RESTful API for WordPress
10
 
@@ -196,6 +196,7 @@ Returns information about JSON API.
196
  ]
197
  }
198
 
 
199
  = Response =
200
 
201
  {
@@ -283,7 +284,9 @@ Returns an array of posts/pages in a specific category.
283
 
284
  = Optional arguments =
285
 
 
286
  * `page` - return a specific page number from the results
 
287
 
288
  = Response =
289
 
@@ -311,7 +314,9 @@ Returns an array of posts/pages in a specific category.
311
 
312
  = Optional arguments =
313
 
 
314
  * `page` - return a specific page number from the results
 
315
 
316
  = Response =
317
 
@@ -341,7 +346,9 @@ Returns an array of posts/pages with a specific tag.
341
 
342
  = Optional arguments =
343
 
 
344
  * `page` - return a specific page number from the results
 
345
 
346
  = Response =
347
 
@@ -371,7 +378,9 @@ Returns an array of posts/pages written by a specific author.
371
 
372
  = Optional arguments =
373
 
 
374
  * `page` - return a specific page number from the results
 
375
 
376
  = Response =
377
 
@@ -400,7 +409,9 @@ Returns an array of posts/pages in response to a search query.
400
 
401
  = Optional arguments =
402
 
 
403
  * `page` - return a specific page number from the results
 
404
 
405
  = Response =
406
 
@@ -513,8 +524,8 @@ Returns a WordPress nonce value, required to call some data manipulation methods
513
 
514
  = Required arguments =
515
 
516
- * `controller` - the JSON API controller
517
- * `method` - the JSON API method
518
 
519
  = Response =
520
 
@@ -525,6 +536,8 @@ Returns a WordPress nonce value, required to call some data manipulation methods
525
  "nonce": "cefe01efd4"
526
  }
527
 
 
 
528
 
529
  = 2.2. Pages controller methods =
530
 
@@ -534,7 +547,7 @@ Creates a new post.
534
 
535
  = Required argument =
536
 
537
- * `nonce` - a security check value, available from the `get_nonce` method
538
 
539
  = Optional arguments =
540
 
@@ -902,6 +915,10 @@ The following are constants you can define in your `wp-config.php` folder:
902
 
903
  == Changelog ==
904
 
 
 
 
 
905
  = 1.0.4 (2010-07-07): =
906
  * Fixed a bug where the order of attachments didn't match the gallery
907
  * Added a section to the developer documentation for externalizing custom controllers
@@ -991,6 +1008,9 @@ The following are constants you can define in your `wp-config.php` folder:
991
 
992
  == Upgrade Notice ==
993
 
 
 
 
994
  = 1.0.4 =
995
  Minor bugfix/refactor release
996
 
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.5
8
 
9
  A RESTful API for WordPress
10
 
196
  ]
197
  }
198
 
199
+
200
  = Response =
201
 
202
  {
284
 
285
  = Optional arguments =
286
 
287
+ * `count` - determines how many posts per page are returned (default value is 10)
288
  * `page` - return a specific page number from the results
289
+ * `post_type` - used to retrieve custom post types
290
 
291
  = Response =
292
 
314
 
315
  = Optional arguments =
316
 
317
+ * `count` - determines how many posts per page are returned (default value is 10)
318
  * `page` - return a specific page number from the results
319
+ * `post_type` - used to retrieve custom post types
320
 
321
  = Response =
322
 
346
 
347
  = Optional arguments =
348
 
349
+ * `count` - determines how many posts per page are returned (default value is 10)
350
  * `page` - return a specific page number from the results
351
+ * `post_type` - used to retrieve custom post types
352
 
353
  = Response =
354
 
378
 
379
  = Optional arguments =
380
 
381
+ * `count` - determines how many posts per page are returned (default value is 10)
382
  * `page` - return a specific page number from the results
383
+ * `post_type` - used to retrieve custom post types
384
 
385
  = Response =
386
 
409
 
410
  = Optional arguments =
411
 
412
+ * `count` - determines how many posts per page are returned (default value is 10)
413
  * `page` - return a specific page number from the results
414
+ * `post_type` - used to retrieve custom post types
415
 
416
  = Response =
417
 
524
 
525
  = Required arguments =
526
 
527
+ * `controller` - the JSON API controller for the method you will use the nonce for
528
+ * `method` - the method you wish to call (currently `create_post` is the only method that requires a nonce)
529
 
530
  = Response =
531
 
536
  "nonce": "cefe01efd4"
537
  }
538
 
539
+ __Further reading__
540
+ To learn more about how nonces are used in WordPress, see [Mark Jaquith's article on the subject](http://markjaquith.wordpress.com/2006/06/02/wordpress-203-nonces/).
541
 
542
  = 2.2. Pages controller methods =
543
 
547
 
548
  = Required argument =
549
 
550
+ * `nonce` - available from the `get_nonce` method (call with vars `controller=posts` and `method=create_post`)
551
 
552
  = Optional arguments =
553
 
915
 
916
  == Changelog ==
917
 
918
+ = 1.0.5 (2010-07-08): =
919
+ * Added an check so that `json-api.php` can be moved one level above the `json-api` directory
920
+ * Added more documentation about using nonces
921
+
922
  = 1.0.4 (2010-07-07): =
923
  * Fixed a bug where the order of attachments didn't match the gallery
924
  * Added a section to the developer documentation for externalizing custom controllers
1008
 
1009
  == Upgrade Notice ==
1010
 
1011
+ = 1.0.5 =
1012
+ Minor improvement release
1013
+
1014
  = 1.0.4 =
1015
  Minor bugfix/refactor release
1016