Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add get_posts passthrough api method

  • Loading branch information...
commit 06b9bc542c92d156f467a98419dad2aab06a88b2 1 parent 1035fb4
@aMoniker aMoniker authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 controllers/core.php
View
20 controllers/core.php
@@ -41,6 +41,26 @@ public function get_recent_posts() {
$posts = $json_api->introspector->get_posts();
return $this->posts_result($posts);
}
+
+ public function get_posts() {
+ global $json_api;
+ $allowed_vars = array(
+ 'posts_per_page', 'numberposts', 'offset', 'category', 'orderby'
+ ,'order', 'include', 'exclude', 'meta_key', 'meta_value'
+ ,'post_type', 'post_mime_type', 'post_parent', 'post_status', 'suppress_filters'
+ );
+ extract($json_api->query->get($allowed_vars));
+
+ $args = array();
+ foreach ($allowed_vars as $allowed_var) {
+ if ($$allowed_var) {
+ $args[$allowed_var] = $$allowed_var;
+ }
+ }
+
+ $posts = $json_api->introspector->get_posts($args);
+ return $this->posts_result($posts);
+ }
public function get_post() {
global $json_api, $post;
Please sign in to comment.
Something went wrong with that request. Please try again.