55*/
66
77class JSON_API_Core_Controller {
8-
8+
99 public function info () {
1010 global $ json_api ;
1111 $ php = '' ;
@@ -35,13 +35,13 @@ public function info() {
3535 );
3636 }
3737 }
38-
38+
3939 public function get_recent_posts () {
4040 global $ json_api ;
4141 $ posts = $ json_api ->introspector ->get_posts ();
4242 return $ this ->posts_result ($ posts );
4343 }
44-
44+
4545 public function get_posts () {
4646 global $ json_api ;
4747 $ url = parse_url ($ _SERVER ['REQUEST_URI ' ]);
@@ -57,7 +57,7 @@ public function get_posts() {
5757 $ result ['query ' ] = $ query ;
5858 return $ result ;
5959 }
60-
60+
6161 public function get_post () {
6262 global $ json_api , $ post ;
6363 $ post = $ json_api ->introspector ->get_current_post ();
@@ -99,7 +99,7 @@ public function get_page() {
9999 } else {
100100 $ json_api ->error ("Include 'id' or 'slug' var in your request. " );
101101 }
102-
102+
103103 // Workaround for https://core.trac.wordpress.org/ticket/12647
104104 if (empty ($ posts )) {
105105 $ url = $ _SERVER ['REQUEST_URI ' ];
@@ -114,7 +114,7 @@ public function get_page() {
114114 }
115115 $ posts = $ json_api ->introspector ->get_posts (array ('pagename ' => $ path ));
116116 }
117-
117+
118118 if (count ($ posts ) == 1 ) {
119119 if (!empty ($ children )) {
120120 $ json_api ->introspector ->attach_child_posts ($ posts [0 ]);
@@ -126,7 +126,7 @@ public function get_page() {
126126 $ json_api ->error ("Not found. " );
127127 }
128128 }
129-
129+
130130 public function get_date_posts () {
131131 global $ json_api ;
132132 if ($ json_api ->query ->date ) {
@@ -147,7 +147,7 @@ public function get_date_posts() {
147147 }
148148 return $ this ->posts_result ($ posts );
149149 }
150-
150+
151151 public function get_category_posts () {
152152 global $ json_api ;
153153 $ category = $ json_api ->introspector ->get_current_category ();
@@ -159,7 +159,7 @@ public function get_category_posts() {
159159 ));
160160 return $ this ->posts_object_result ($ posts , $ category );
161161 }
162-
162+
163163 public function get_tag_posts () {
164164 global $ json_api ;
165165 $ tag = $ json_api ->introspector ->get_current_tag ();
@@ -171,7 +171,7 @@ public function get_tag_posts() {
171171 ));
172172 return $ this ->posts_object_result ($ posts , $ tag );
173173 }
174-
174+
175175 public function get_author_posts () {
176176 global $ json_api ;
177177 $ author = $ json_api ->introspector ->get_current_author ();
@@ -183,7 +183,7 @@ public function get_author_posts() {
183183 ));
184184 return $ this ->posts_object_result ($ posts , $ author );
185185 }
186-
186+
187187 public function get_search_results () {
188188 global $ json_api ;
189189 if ($ json_api ->query ->search ) {
@@ -195,7 +195,7 @@ public function get_search_results() {
195195 }
196196 return $ this ->posts_result ($ posts );
197197 }
198-
198+
199199 public function get_date_index () {
200200 global $ json_api ;
201201 $ permalinks = $ json_api ->introspector ->get_date_archive_permalinks ();
@@ -205,7 +205,7 @@ public function get_date_index() {
205205 'tree ' => $ tree
206206 );
207207 }
208-
208+
209209 public function get_category_index () {
210210 global $ json_api ;
211211 $ args = null ;
@@ -220,7 +220,7 @@ public function get_category_index() {
220220 'categories ' => $ categories
221221 );
222222 }
223-
223+
224224 public function get_tag_index () {
225225 global $ json_api ;
226226 $ tags = $ json_api ->introspector ->get_tags ();
@@ -229,7 +229,7 @@ public function get_tag_index() {
229229 'tags ' => $ tags
230230 );
231231 }
232-
232+
233233 public function get_author_index () {
234234 global $ json_api ;
235235 $ authors = $ json_api ->introspector ->get_authors ();
@@ -238,12 +238,12 @@ public function get_author_index() {
238238 'authors ' => array_values ($ authors )
239239 );
240240 }
241-
241+
242242 public function get_page_index () {
243243 global $ json_api ;
244244 $ pages = array ();
245245 $ post_type = $ json_api ->query ->post_type ? $ json_api ->query ->post_type : 'page ' ;
246-
246+
247247 // Thanks to blinder for the fix!
248248 $ numberposts = empty ($ json_api ->query ->count ) ? -1 : $ json_api ->query ->count ;
249249 $ wp_posts = get_posts (array (
@@ -263,7 +263,7 @@ public function get_page_index() {
263263 'pages ' => $ pages
264264 );
265265 }
266-
266+
267267 public function get_nonce () {
268268 global $ json_api ;
269269 extract ($ json_api ->query ->get (array ('controller ' , 'method ' )));
@@ -286,7 +286,7 @@ public function get_nonce() {
286286 $ json_api ->error ("Include 'controller' and 'method' vars in your request. " );
287287 }
288288 }
289-
289+
290290 protected function get_object_posts ($ object , $ id_var , $ slug_var ) {
291291 global $ json_api ;
292292 $ object_id = "{$ type }_id " ;
@@ -311,7 +311,7 @@ protected function get_object_posts($object, $id_var, $slug_var) {
311311 }
312312 return $ posts ;
313313 }
314-
314+
315315 protected function posts_result ($ posts ) {
316316 global $ wp_query ;
317317 return array (
@@ -321,7 +321,7 @@ protected function posts_result($posts) {
321321 'posts ' => $ posts
322322 );
323323 }
324-
324+
325325 protected function posts_object_result ($ posts , $ object ) {
326326 global $ wp_query ;
327327 // Convert something like "JSON_API_Category" into "category"
@@ -333,7 +333,7 @@ protected function posts_object_result($posts, $object) {
333333 'posts ' => $ posts
334334 );
335335 }
336-
336+
337337}
338338
339339?>
0 commit comments