]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Twitter-compatible API - factored out redundant JSON printing functions
authorzach <zach@controlyourself.ca>
Tue, 30 Sep 2008 21:25:26 +0000 (17:25 -0400)
committerzach <zach@controlyourself.ca>
Tue, 30 Sep 2008 21:25:26 +0000 (17:25 -0400)
darcs-hash:20080930212526-462f3-abe9f1f2fc395c751b2861e686d638ea0a8ca001.gz

actions/twitapidirect_messages.php
actions/twitapiusers.php
lib/twitterapi.php

index 8f0ecb449855871e49694f90fb50293db279383d..fcdf822e0465d814fe9d2c3a89bec64e7a1d6ec0 100644 (file)
@@ -215,7 +215,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
                        }
                }
 
-               $this->show_twitter_json_dmsgs($dmsgs);
+               $this->show_json_objects($dmsgs);
                $this->end_document('json');
 
        }
index 6dad5381842cb2be001924d53cb26b1e9007bc0e..cb682695a1ffd0827c9753c8a94e0bb0e24bc32c 100644 (file)
@@ -116,7 +116,7 @@ class TwitapiusersAction extends TwitterapiAction {
                        $this->end_document('xml');
                } elseif ($apidata['content-type'] == 'json') {
                        $this->init_document('json');
-                       $this->show_twitter_json_users($twitter_user);
+                       $this->show_json_objects($twitter_user);
                        $this->end_document('json');
                } else {
                        common_user_error(_('API method not found!'), $code = 404);
index 98d094cfec5f23d17ed07428fb190e33f6456c88..d6ec1e9a09e6ffcf73ec09c8e560dee103aaccca 100644 (file)
@@ -185,16 +185,8 @@ class TwitterapiAction extends Action {
                common_element_end('entry');
        }
 
-       function show_twitter_json_statuses($twitter_statuses) {
-               print(json_encode($twitter_statuses));
-       }
-
-       function show_twitter_json_users($twitter_users) {
-               print(json_encode($twitter_users));
-       }
-
-       function show_twitter_json_dmsgs($twitter_dms) {
-               print(json_encode($twitter_dms));
+       function show_json_objects($objects) {
+               print(json_encode($objects));
        }
 
        function show_single_xml_status($notice) {
@@ -208,7 +200,7 @@ class TwitterapiAction extends Action {
        function show_single_json_status($notice) {
                $this->init_document('json');
                $status = $this->twitter_status_array($notice);
-               $this->show_twitter_json_statuses($status);
+               $this->show_json_objects($status);
                $this->end_document('json');
                exit();
        }
@@ -331,7 +323,7 @@ class TwitterapiAction extends Action {
                        }
                }
 
-               $this->show_twitter_json_statuses($statuses);
+               $this->show_json_objects($statuses);
 
                $this->end_document('json');
        }
@@ -507,7 +499,7 @@ class TwitterapiAction extends Action {
                        $this->show_twitter_xml_user($profile_array);
                        break;
                 case 'json':
-                       $this->show_twitter_json_users($profile_array);
+                       $this->show_json_objects($profile_array);
                        break;
                 default:
                        $this->client_error(_('Not a supported data format.'));