ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/facebook/trunk/facebookapi_php5_restlib.php
(Generate patch)

Comparing facebook/trunk/facebookapi_php5_restlib.php (file contents):
Revision 991 by douglas, 2008-01-20T22:16:32-08:00 vs.
Revision 1015 by douglas, 2008-05-25T05:56:55-07:00

# Line 10 | Line 10
10   // +---------------------------------------------------------------------------+
11   // | Facebook Platform PHP5 client                                             |
12   // +---------------------------------------------------------------------------+
13 < // | Copyright (c) 2007 Facebook, Inc.                                         |
13 > // | Copyright (c) 2007-2008 Facebook, Inc.                                    |
14   // | All rights reserved.                                                      |
15   // |                                                                           |
16   // | Redistribution and use in source and binary forms, with or without        |
# Line 45 | Line 45 | class FacebookRestClient {
45    public $friends_list; // to save making the friends.get api call, this will get prepopulated on canvas pages
46    public $added;        // to save making the users.isAppAdded api call, this will get prepopulated on canvas pages
47    public $json;
48 +  public $batch_mode;
49 +  private $batch_queue;
50 +  private $call_as_apikey;
51 +
52 +  const BATCH_MODE_DEFAULT = 0;
53 +  const BATCH_MODE_SERVER_PARALLEL = 0;
54 +  const BATCH_MODE_SERIAL_ONLY = 2;
55  
56    /**
57     * Create the client.
# Line 57 | Line 64 | class FacebookRestClient {
64      $this->secret       = $secret;
65      $this->session_key  = $session_key;
66      $this->api_key      = $api_key;
67 +    $this->batch_mode = FacebookRestClient::BATCH_MODE_DEFAULT;
68      $this->last_call_id = 0;
69 +    $this->call_as_apikey = '';
70      $this->server_addr  = Facebook::get_facebook_url('api') . '/restserver.php';
71 <    if ($GLOBALS['facebook_config']['debug']) {
71 >    if (!empty($GLOBALS['facebook_config']['debug'])) {
72        $this->cur_id = 0;
73        ?>
74   <script type="text/javascript">
75   var types = ['params', 'xml', 'php', 'sxml'];
76 + function getStyle(elem, style) {
77 +  if (elem.getStyle) {
78 +    return elem.getStyle(style);
79 +  } else {
80 +    return elem.style[style];
81 +  }
82 + }
83 + function setStyle(elem, style, value) {
84 +  if (elem.setStyle) {
85 +    elem.setStyle(style, value);
86 +  } else {
87 +    elem.style[style] = value;
88 +  }
89 + }
90   function toggleDisplay(id, type) {
91 <  for each (var t in types) {
92 <    if (t != type || document.getElementById(t + id).style.display == 'block') {
93 <      document.getElementById(t + id).style.display = 'none';
94 <    } else {
95 <      document.getElementById(t + id).style.display = 'block';
91 >  for (var i = 0; i < types.length; i++) {
92 >    var t = types[i];
93 >    var pre = document.getElementById(t + id);
94 >    if (pre) {
95 >      if (t != type || getStyle(pre, 'display') == 'block') {
96 >        setStyle(pre, 'display', 'none');
97 >      } else {
98 >        setStyle(pre, 'display', 'block');
99 >      }
100      }
101    }
102    return false;
# Line 79 | Line 106 | function toggleDisplay(id, type) {
106      }
107    }
108  
109 +
110 +  /**
111 +   * Start a batch operation.
112 +   */
113 +  public function begin_batch() {
114 +    if($this->batch_queue !== null)
115 +    {
116 +      throw new FacebookRestClientException(FacebookAPIErrorCodes::API_EC_BATCH_ALREADY_STARTED,
117 +      FacebookAPIErrorCodes::$api_error_descriptions[FacebookAPIErrorCodes::API_EC_BATCH_ALREADY_STARTED]);
118 +    }
119 +
120 +    $this->batch_queue = array();
121 +  }
122 +
123 +  /*
124 +   * End current batch operation
125 +   */
126 +  public function end_batch() {
127 +    if($this->batch_queue === null) {
128 +      throw new FacebookRestClientException(FacebookAPIErrorCodes::API_EC_BATCH_NOT_STARTED,
129 +      FacebookAPIErrorCodes::$api_error_descriptions[FacebookAPIErrorCodes::API_EC_BATCH_NOT_STARTED]);
130 +    }
131 +
132 +    $this->execute_server_side_batch();
133 +
134 +    $this->batch_queue = null;
135 +  }
136 +
137 +
138 +  private function execute_server_side_batch() {
139 +
140 +
141 +    $item_count = count($this->batch_queue);
142 +    $method_feed = array();
143 +    foreach($this->batch_queue as $batch_item) {
144 +      $method_feed[] = $this->create_post_string($batch_item['m'], $batch_item['p']);
145 +    }
146 +
147 +    $method_feed_json = json_encode($method_feed);
148 +
149 +    $serial_only = $this->batch_mode == FacebookRestClient::BATCH_MODE_SERIAL_ONLY ;
150 +    $params = array('method_feed' => $method_feed_json, 'serial_only' => $serial_only);
151 +    if ($this->call_as_apikey) {
152 +      $params['call_as_apikey'] = $this->call_as_apikey;
153 +    }
154 +
155 +    $xml = $this->post_request('batch.run', $params);
156 +
157 +    $result = $this->convert_xml_to_result($xml, 'batch.run', $params);
158 +
159 +
160 +    if (is_array($result) && isset($result['error_code'])) {
161 +      throw new FacebookRestClientException($result['error_msg'], $result['error_code']);
162 +    }
163 +
164 +    for($i = 0; $i < $item_count; $i++) {
165 +      $batch_item = $this->batch_queue[$i];
166 +      $batch_item_result_xml = $result[$i];
167 +      $batch_item_result = $this->convert_xml_to_result($batch_item_result_xml, $batch_item['m'], $batch_item['p']);
168 +
169 +      if (is_array($batch_item_result) && isset($batch_item_result['error_code'])) {
170 +        throw new FacebookRestClientException($batch_item_result['error_msg'], $batch_item_result['error_code']);
171 +      }
172 +      $batch_item['r'] = $batch_item_result;
173 +    }
174 +  }
175 +
176 +  public function begin_permissions_mode($permissions_apikey) {
177 +    $this->call_as_apikey = $permissions_apikey;
178 +  }
179 +
180 +  public function end_permissions_mode() {
181 +    $this->call_as_apikey = '';
182 +  }
183 +
184    /**
185     * Returns the session information available after current user logs in.
186     * @param string $auth_token the token returned by auth_createToken or
187     *  passed back to your callback_url.
188 +   * @param bool   $generate_session_secret  whether the session returned should include a session secret
189 +   *
190     * @return assoc array containing session_key, uid
191     */
192 <  public function auth_getSession($auth_token) {
193 <    $result = $this->call_method('facebook.auth.getSession', array('auth_token'=>$auth_token));
194 <    $this->session_key = $result['session_key'];
195 <    if (isset($result['secret']) && $result['secret']) {
192 >  public function auth_getSession($auth_token, $generate_session_secret=false) {
193 >    //Check if we are in batch mode
194 >    if($this->batch_queue === null) {
195 >      $result = $this->call_method('facebook.auth.getSession',
196 >          array('auth_token' => $auth_token, 'generate_session_secret' => $generate_session_secret));
197 >      $this->session_key = $result['session_key'];
198 >
199 >    if (!empty($result['secret']) && !$generate_session_secret) {
200        // desktop apps have a special secret
201        $this->secret = $result['secret'];
202      }
203 <    return $result;
203 >      return $result;
204 >    }
205 >  }
206 >
207 >  /**
208 >   * Generates a session specific secret. This is for integration with client-side API calls, such as the
209 >   * JS library.
210 >   * @error API_EC_PARAM_SESSION_KEY
211 >   *        API_EC_PARAM_UNKNOWN
212 >   * @return session secret for the current promoted session
213 >   */
214 >  public function auth_promoteSession() {
215 >      return $this->call_method('facebook.auth.promoteSession', array());
216 >  }
217 >
218 >  /**
219 >   * Expires the session that is currently being used.  If this call is successful, no further calls to the
220 >   * API (which require a session) can be made until a valid session is created.
221 >   *
222 >   * @return bool  true if session expiration was successful, false otherwise
223 >   */
224 >  public function auth_expireSession() {
225 >      return $this->call_method('facebook.auth.expireSession', array());
226    }
227  
228    /**
# Line 111 | Line 241 | function toggleDisplay(id, type) {
241     *   rsvp status when filtering.
242     * @return array of events
243     */
244 <  public function events_get($uid, $eids, $start_time, $end_time, $rsvp_status) {
244 >  public function &events_get($uid, $eids, $start_time, $end_time, $rsvp_status) {
245      return $this->call_method('facebook.events.get',
246          array(
247          'uid' => $uid,
# Line 127 | Line 257 | function toggleDisplay(id, type) {
257     * @return assoc array of four membership lists, with keys 'attending',
258     *  'unsure', 'declined', and 'not_replied'
259     */
260 <  public function events_getMembers($eid) {
260 >  public function &events_getMembers($eid) {
261      return $this->call_method('facebook.events.getMembers',
262        array('eid' => $eid));
263    }
# Line 139 | Line 269 | function toggleDisplay(id, type) {
269     * @param string $query the query to evaluate
270     * @return generalized array representing the results
271     */
272 <  public function fql_query($query) {
272 >  public function &fql_query($query) {
273      return $this->call_method('facebook.fql.query',
274        array('query' => $query));
275    }
276  
277 <  public function feed_publishStoryToUser($title, $body,
277 >  public function &feed_publishStoryToUser($title, $body,
278                                            $image_1=null, $image_1_link=null,
279                                            $image_2=null, $image_2_link=null,
280                                            $image_3=null, $image_3_link=null,
# Line 162 | Line 292 | function toggleDisplay(id, type) {
292              'image_4_link' => $image_4_link));
293    }
294  
295 <  public function feed_publishActionOfUser($title, $body,
295 >  public function &feed_publishActionOfUser($title, $body,
296                                             $image_1=null, $image_1_link=null,
297                                             $image_2=null, $image_2_link=null,
298                                             $image_3=null, $image_3_link=null,
# Line 180 | Line 310 | function toggleDisplay(id, type) {
310              'image_4_link' => $image_4_link));
311    }
312  
313 <  public function feed_publishTemplatizedAction($title_template, $title_data,
313 >  public function &feed_publishTemplatizedAction($title_template, $title_data,
314                                                  $body_template, $body_data, $body_general,
315                                                  $image_1=null, $image_1_link=null,
316                                                  $image_2=null, $image_2_link=null,
# Line 215 | Line 345 | function toggleDisplay(id, type) {
345     *          1 => array('uid1' => id_2, 'uid2' => id_B, 'are_friends' => 0)
346     *         ...)
347     */
348 <  public function friends_areFriends($uids1, $uids2) {
348 >  public function &friends_areFriends($uids1, $uids2) {
349      return $this->call_method('facebook.friends.areFriends',
350          array('uids1'=>$uids1, 'uids2'=>$uids2));
351    }
# Line 224 | Line 354 | function toggleDisplay(id, type) {
354     * Returns the friends of the current session user.
355     * @return array of friends
356     */
357 <  public function friends_get() {
357 >  public function &friends_get() {
358      if (isset($this->friends_list)) {
359        return $this->friends_list;
360      }
# Line 236 | Line 366 | function toggleDisplay(id, type) {
366     * of the calling application.
367     * @return array of friends
368     */
369 <  public function friends_getAppUsers() {
369 >  public function &friends_getAppUsers() {
370      return $this->call_method('facebook.friends.getAppUsers', array());
371    }
372  
# Line 248 | Line 378 | function toggleDisplay(id, type) {
378     *   A null parameter will get all groups for the user.
379     * @return array of groups
380     */
381 <  public function groups_get($uid, $gids) {
381 >  public function &groups_get($uid, $gids) {
382      return $this->call_method('facebook.groups.get',
383          array(
384          'uid' => $uid,
# Line 261 | Line 391 | function toggleDisplay(id, type) {
391     * @return assoc array of four membership lists, with keys
392     *  'members', 'admins', 'officers', and 'not_replied'
393     */
394 <  public function groups_getMembers($gid) {
394 >  public function &groups_getMembers($gid) {
395      return $this->call_method('facebook.groups.getMembers',
396        array('gid' => $gid));
397    }
# Line 301 | Line 431 | function toggleDisplay(id, type) {
431    }
432  
433    /**
434 +   * Permissions API
435 +   */
436 +
437 +  /**
438 +   * Checks API-access granted by self to the specified application
439 +   * @param string $permissions_apikey: Required
440 +   *
441 +   * @return array: API methods/namespaces which are allowed access
442 +   */
443 +  public function permissions_checkGrantedApiAccess($permissions_apikey) {
444 +    return $this->call_method('facebook.permissions.checkGrantedApiAccess',
445 +        array(
446 +        'permissions_apikey' => $permissions_apikey));
447 +  }
448 +
449 +  /**
450 +   * Checks API-access granted to self by the specified application
451 +   * @param string $permissions_apikey: Required
452 +   *
453 +   * @return array: API methods/namespaces which are allowed access
454 +   */
455 +  public function permissions_checkAvailableApiAccess($permissions_apikey) {
456 +    return $this->call_method('facebook.permissions.checkAvailableApiAccess',
457 +        array(
458 +        'permissions_apikey' => $permissions_apikey));
459 +  }
460 +
461 +  /**
462 +   * Grant API-access to the specified methods/namespaces to the specified application
463 +   * @param string $permissions_apikey: Required
464 +   * @param array(string) : Optional: API methods/namespaces to be allowed
465 +   *
466 +   * @return array: API methods/namespaces which are allowed access
467 +   */
468 +  public function permissions_grantApiAccess($permissions_apikey, $method_arr) {
469 +    return $this->call_method('facebook.permissions.grantApiAccess',
470 +        array(
471 +        'permissions_apikey' => $permissions_apikey,
472 +        'method_arr' => $method_arr));
473 +  }
474 +
475 +  /**
476 +   * Revoke API-access granted to the specified application
477 +   * @param string $permissions_apikey: Required
478 +   *
479 +   * @return bool
480 +   */
481 +  public function permissions_revokeApiAccess($permissions_apikey) {
482 +    return $this->call_method('facebook.permissions.revokeApiAccess',
483 +        array(
484 +        'permissions_apikey' => $permissions_apikey));
485 +  }
486 +
487 +  /**
488     * Returns the outstanding notifications for the session user.
489     * @return assoc array of
490     *  notification count objects for 'messages', 'pokes' and 'shares',
491     *  a uid list of 'friend_requests', a gid list of 'group_invites',
492     *  and an eid list of 'event_invites'
493     */
494 <  public function notifications_get() {
494 >  public function &notifications_get() {
495      return $this->call_method('facebook.notifications.get', array());
496    }
497  
# Line 315 | Line 499 | function toggleDisplay(id, type) {
499     * Sends a notification to the specified users.
500     * @return (nothing)
501     */
502 <  public function notifications_send($to_ids, $notification) {
502 >  public function &notifications_send($to_ids, $notification) {
503      return $this->call_method('facebook.notifications.send',
504                                array('to_ids' => $to_ids, 'notification' => $notification));
505    }
# Line 328 | Line 512 | function toggleDisplay(id, type) {
512     * @param string $fbml : fbml markup if you want an html version of the email
513     * @return comma separated list of successful recipients
514     */
515 <  public function notifications_sendEmail($recipients, $subject, $text, $fbml) {
515 >  public function &notifications_sendEmail($recipients, $subject, $text, $fbml) {
516      return $this->call_method('facebook.notifications.sendEmail',
517                                array('recipients' => $recipients,
518                                      'subject' => $subject,
# Line 344 | Line 528 | function toggleDisplay(id, type) {
528     * @param string type  limits results to a particular type of page.
529     * @return array of pages
530     */
531 <  public function pages_getInfo($page_ids, $fields, $uid, $type) {
531 >  public function &pages_getInfo($page_ids, $fields, $uid, $type) {
532      return $this->call_method('facebook.pages.getInfo', array('page_ids' => $page_ids, 'fields' => $fields, 'uid' => $uid, 'type' => $type));
533    }
534  
# Line 353 | Line 537 | function toggleDisplay(id, type) {
537     * @param int $page_id target page id
538     * @return boolean
539     */
540 <  public function pages_isAdmin($page_id) {
540 >  public function &pages_isAdmin($page_id) {
541      return $this->call_method('facebook.pages.isAdmin', array('page_id' => $page_id));
542    }
543  
# Line 361 | Line 545 | function toggleDisplay(id, type) {
545     * Returns whether or not the page corresponding to the current session object has the app installed
546     * @return boolean
547     */
548 <  public function pages_isAppAdded() {
548 >  public function &pages_isAppAdded() {
549      if (isset($this->added)) {
550        return $this->added;
551      }
# Line 374 | Line 558 | function toggleDisplay(id, type) {
558     * @param int $uid user to compare.  If empty, the logged in user.
559     * @return bool
560     */
561 <  public function pages_isFan($page_id, $uid) {
561 >  public function &pages_isFan($page_id, $uid) {
562      return $this->call_method('facebook.pages.isFan', array('page_id' => $page_id, 'uid' => $uid));
563    }
564  
# Line 388 | Line 572 | function toggleDisplay(id, type) {
572     * error is returned.
573     * @return array of photo objects.
574     */
575 <  public function photos_get($subj_id, $aid, $pids) {
575 >  public function &photos_get($subj_id, $aid, $pids) {
576      return $this->call_method('facebook.photos.get',
577        array('subj_id' => $subj_id, 'aid' => $aid, 'pids' => $pids));
578    }
# Line 401 | Line 585 | function toggleDisplay(id, type) {
585     * Note that at least one of the (uid, aids) parameters must be specified.
586     * @returns an array of album objects.
587     */
588 <  public function photos_getAlbums($uid, $aids) {
588 >  public function &photos_getAlbums($uid, $aids) {
589      return $this->call_method('facebook.photos.getAlbums',
590        array('uid' => $uid,
591              'aids' => $aids));
# Line 413 | Line 597 | function toggleDisplay(id, type) {
597     * @return array of photo tag objects, with include pid, subject uid,
598     *  and two floating-point numbers (xcoord, ycoord) for tag pixel location
599     */
600 <  public function photos_getTags($pids) {
600 >  public function &photos_getTags($pids) {
601      return $this->call_method('facebook.photos.getTags',
602        array('pids' => $pids));
603    }
604  
605 +
606    /**
607     * Returns the requested info fields for the requested set of users
608     * @param array $uids an array of user ids
609     * @param array $fields an array of strings describing the info fields desired
610     * @return array of users
611     */
612 <  public function users_getInfo($uids, $fields) {
612 >  public function &users_getInfo($uids, $fields) {
613      return $this->call_method('facebook.users.getInfo', array('uids' => $uids, 'fields' => $fields));
614    }
615  
# Line 432 | Line 617 | function toggleDisplay(id, type) {
617     * Returns the user corresponding to the current session object.
618     * @return integer uid
619     */
620 <  public function users_getLoggedInUser() {
620 >  public function &users_getLoggedInUser() {
621      return $this->call_method('facebook.users.getLoggedInUser', array());
622    }
623  
439
624    /**
625     * Returns whether or not the user corresponding to the current session object has the app installed
626     * @return boolean
627     */
628 <  public function users_isAppAdded() {
628 >  public function &users_isAppAdded($uid=null) {
629      if (isset($this->added)) {
630        return $this->added;
631      }
632 <    return $this->call_method('facebook.users.isAppAdded', array());
632 >    return $this->call_method('facebook.users.isAppAdded', array('uid' => $uid));
633    }
634  
635    /**
# Line 465 | Line 649 | function toggleDisplay(id, type) {
649                                                                  'mobile_profile' => $mobile_profile));
650    }
651  
652 <  public function profile_getFBML($uid) {
652 >  public function &profile_getFBML($uid) {
653      return $this->call_method('facebook.profile.getFBML', array('uid' => $uid));
654    }
655  
656 <  public function fbml_refreshImgSrc($url) {
656 >  public function &fbml_refreshImgSrc($url) {
657      return $this->call_method('facebook.fbml.refreshImgSrc', array('url' => $url));
658    }
659  
660 <  public function fbml_refreshRefUrl($url) {
660 >  public function &fbml_refreshRefUrl($url) {
661      return $this->call_method('facebook.fbml.refreshRefUrl', array('url' => $url));
662    }
663  
664 <  public function fbml_setRefHandle($handle, $fbml) {
664 >  public function &fbml_setRefHandle($handle, $fbml) {
665      return $this->call_method('facebook.fbml.setRefHandle', array('handle' => $handle, 'fbml' => $fbml));
666    }
667  
# Line 531 | Line 715 | function toggleDisplay(id, type) {
715     * @param status      'SUCCESS', 'NOT_SUCCESS', or 'DEFAULT'
716     * @return bool       True on success
717     */
718 <  function marketplace_removeListing($listing_id, $status='DEFAULT') {
718 >  function marketplace_removeListing($listing_id, $status='DEFAULT', $uid=null) {
719      return $this->call_method('facebook.marketplace.removeListing',
720                                array('listing_id'=>$listing_id,
721 <                                    'status'=>$status));
721 >                                    'status'=>$status,
722 >                                    'uid' => $uid));
723    }
724  
725    /**
# Line 545 | Line 730 | function toggleDisplay(id, type) {
730     * @param listing_attrs    array        An array of the listing data
731     * @return                 int          The listing_id (unchanged if modifying an existing listing)
732     */
733 <  function marketplace_createListing($listing_id, $show_on_profile, $attrs) {
733 >  function marketplace_createListing($listing_id, $show_on_profile, $attrs, $uid=null) {
734      return $this->call_method('facebook.marketplace.createListing',
735                                array('listing_id'=>$listing_id,
736                                      'show_on_profile'=>$show_on_profile,
737 <                                    'listing_attrs'=>json_encode($attrs)));
737 >                                    'listing_attrs'=>json_encode($attrs),
738 >                                    'uid' => $uid));
739    }
740  
741  
# Line 567 | Line 753 | function toggleDisplay(id, type) {
753     *    API_EC_DATA_QUOTA_EXCEEDED
754     *    API_EC_DATA_UNKNOWN_ERROR
755     */
756 <  public function data_setUserPreference($pref_id, $value) {
756 >  public function &data_setUserPreference($pref_id, $value) {
757      return $this->call_method
758        ('facebook.data.setUserPreference',
759         array('pref_id' => $pref_id,
# Line 586 | Line 772 | function toggleDisplay(id, type) {
772     *    API_EC_DATA_QUOTA_EXCEEDED
773     *    API_EC_DATA_UNKNOWN_ERROR
774     */
775 <  public function data_setUserPreferences($values, $replace = false) {
775 >  public function &data_setUserPreferences($values, $replace = false) {
776      return $this->call_method
777        ('facebook.data.setUserPreferences',
778         array('values' => json_encode($values),
# Line 604 | Line 790 | function toggleDisplay(id, type) {
790     *    API_EC_DATA_QUOTA_EXCEEDED
791     *    API_EC_DATA_UNKNOWN_ERROR
792     */
793 <  public function data_getUserPreference($pref_id) {
793 >  public function &data_getUserPreference($pref_id) {
794      return $this->call_method
795        ('facebook.data.getUserPreference',
796         array('pref_id' => $pref_id));
# Line 619 | Line 805 | function toggleDisplay(id, type) {
805     *    API_EC_DATA_QUOTA_EXCEEDED
806     *    API_EC_DATA_UNKNOWN_ERROR
807     */
808 <  public function data_getUserPreferences() {
808 >  public function &data_getUserPreferences() {
809      return $this->call_method
810        ('facebook.data.getUserPreferences',
811         array());
# Line 638 | Line 824 | function toggleDisplay(id, type) {
824     *    API_EC_DATA_QUOTA_EXCEEDED
825     *    API_EC_DATA_UNKNOWN_ERROR
826     */
827 <  public function data_createObjectType($name) {
827 >  public function &data_createObjectType($name) {
828      return $this->call_method
829        ('facebook.data.createObjectType',
830         array('name' => $name));
# Line 657 | Line 843 | function toggleDisplay(id, type) {
843     *    API_EC_DATA_QUOTA_EXCEEDED
844     *    API_EC_DATA_UNKNOWN_ERROR
845     */
846 <  public function data_dropObjectType($obj_type) {
846 >  public function &data_dropObjectType($obj_type) {
847      return $this->call_method
848        ('facebook.data.dropObjectType',
849         array('obj_type' => $obj_type));
# Line 678 | Line 864 | function toggleDisplay(id, type) {
864     *    API_EC_DATA_QUOTA_EXCEEDED
865     *    API_EC_DATA_UNKNOWN_ERROR
866     */
867 <  public function data_renameObjectType($obj_type, $new_name) {
867 >  public function &data_renameObjectType($obj_type, $new_name) {
868      return $this->call_method
869        ('facebook.data.renameObjectType',
870         array('obj_type' => $obj_type,
# Line 700 | Line 886 | function toggleDisplay(id, type) {
886     *    API_EC_DATA_QUOTA_EXCEEDED
887     *    API_EC_DATA_UNKNOWN_ERROR
888     */
889 <  public function data_defineObjectProperty($obj_type, $prop_name, $prop_type) {
889 >  public function &data_defineObjectProperty($obj_type, $prop_name, $prop_type) {
890      return $this->call_method
891        ('facebook.data.defineObjectProperty',
892         array('obj_type' => $obj_type,
# Line 722 | Line 908 | function toggleDisplay(id, type) {
908     *    API_EC_DATA_QUOTA_EXCEEDED
909     *    API_EC_DATA_UNKNOWN_ERROR
910     */
911 <  public function data_undefineObjectProperty($obj_type, $prop_name) {
911 >  public function &data_undefineObjectProperty($obj_type, $prop_name) {
912      return $this->call_method
913        ('facebook.data.undefineObjectProperty',
914         array('obj_type' => $obj_type,
# Line 745 | Line 931 | function toggleDisplay(id, type) {
931     *    API_EC_DATA_QUOTA_EXCEEDED
932     *    API_EC_DATA_UNKNOWN_ERROR
933     */
934 <  public function data_renameObjectProperty($obj_type, $prop_name,
934 >  public function &data_renameObjectProperty($obj_type, $prop_name,
935                                              $new_name) {
936      return $this->call_method
937        ('facebook.data.renameObjectProperty',
# Line 764 | Line 950 | function toggleDisplay(id, type) {
950     *    API_EC_DATA_QUOTA_EXCEEDED
951     *    API_EC_DATA_UNKNOWN_ERROR
952     */
953 <  public function data_getObjectTypes() {
953 >  public function &data_getObjectTypes() {
954      return $this->call_method
955        ('facebook.data.getObjectTypes',
956         array());
# Line 783 | Line 969 | function toggleDisplay(id, type) {
969     *    API_EC_DATA_QUOTA_EXCEEDED
970     *    API_EC_DATA_UNKNOWN_ERROR
971     */
972 <  public function data_getObjectType($obj_type) {
972 >  public function &data_getObjectType($obj_type) {
973      return $this->call_method
974        ('facebook.data.getObjectType',
975         array('obj_type' => $obj_type));
# Line 803 | Line 989 | function toggleDisplay(id, type) {
989     *    API_EC_DATA_QUOTA_EXCEEDED
990     *    API_EC_DATA_UNKNOWN_ERROR
991     */
992 <  public function data_createObject($obj_type, $properties = null) {
992 >  public function &data_createObject($obj_type, $properties = null) {
993      return $this->call_method
994        ('facebook.data.createObject',
995         array('obj_type' => $obj_type,
# Line 825 | Line 1011 | function toggleDisplay(id, type) {
1011     *    API_EC_DATA_QUOTA_EXCEEDED
1012     *    API_EC_DATA_UNKNOWN_ERROR
1013     */
1014 <  public function data_updateObject($obj_id, $properties, $replace = false) {
1014 >  public function &data_updateObject($obj_id, $properties, $replace = false) {
1015      return $this->call_method
1016        ('facebook.data.updateObject',
1017         array('obj_id' => $obj_id,
# Line 846 | Line 1032 | function toggleDisplay(id, type) {
1032     *    API_EC_DATA_QUOTA_EXCEEDED
1033     *    API_EC_DATA_UNKNOWN_ERROR
1034     */
1035 <  public function data_deleteObject($obj_id) {
1035 >  public function &data_deleteObject($obj_id) {
1036      return $this->call_method
1037        ('facebook.data.deleteObject',
1038         array('obj_id' => $obj_id));
# Line 864 | Line 1050 | function toggleDisplay(id, type) {
1050     *    API_EC_DATA_QUOTA_EXCEEDED
1051     *    API_EC_DATA_UNKNOWN_ERROR
1052     */
1053 <  public function data_deleteObjects($obj_ids) {
1053 >  public function &data_deleteObjects($obj_ids) {
1054      return $this->call_method
1055        ('facebook.data.deleteObjects',
1056         array('obj_ids' => json_encode($obj_ids)));
# Line 885 | Line 1071 | function toggleDisplay(id, type) {
1071     *    API_EC_DATA_QUOTA_EXCEEDED
1072     *    API_EC_DATA_UNKNOWN_ERROR
1073     */
1074 <  public function data_getObjectProperty($obj_id, $prop_name) {
1074 >  public function &data_getObjectProperty($obj_id, $prop_name) {
1075      return $this->call_method
1076        ('facebook.data.getObjectProperty',
1077         array('obj_id' => $obj_id,
# Line 907 | Line 1093 | function toggleDisplay(id, type) {
1093     *    API_EC_DATA_QUOTA_EXCEEDED
1094     *    API_EC_DATA_UNKNOWN_ERROR
1095     */
1096 <  public function data_getObject($obj_id, $prop_names = null) {
1096 >  public function &data_getObject($obj_id, $prop_names = null) {
1097      return $this->call_method
1098        ('facebook.data.getObject',
1099         array('obj_id' => $obj_id,
# Line 929 | Line 1115 | function toggleDisplay(id, type) {
1115     *    API_EC_DATA_QUOTA_EXCEEDED
1116     *    API_EC_DATA_UNKNOWN_ERROR
1117     */
1118 <  public function data_getObjects($obj_ids, $prop_names = null) {
1118 >  public function &data_getObjects($obj_ids, $prop_names = null) {
1119      return $this->call_method
1120        ('facebook.data.getObjects',
1121         array('obj_ids' => json_encode($obj_ids),
# Line 951 | Line 1137 | function toggleDisplay(id, type) {
1137     *    API_EC_DATA_QUOTA_EXCEEDED
1138     *    API_EC_DATA_UNKNOWN_ERROR
1139     */
1140 <  public function data_setObjectProperty($obj_id, $prop_name,
1140 >  public function &data_setObjectProperty($obj_id, $prop_name,
1141                                           $prop_value) {
1142      return $this->call_method
1143        ('facebook.data.setObjectProperty',
# Line 975 | Line 1161 | function toggleDisplay(id, type) {
1161     *    API_EC_DATA_QUOTA_EXCEEDED
1162     *    API_EC_DATA_UNKNOWN_ERROR
1163     */
1164 <  public function data_getHashValue($obj_type, $key, $prop_name = null) {
1164 >  public function &data_getHashValue($obj_type, $key, $prop_name = null) {
1165      return $this->call_method
1166        ('facebook.data.getHashValue',
1167         array('obj_type' => $obj_type,
# Line 998 | Line 1184 | function toggleDisplay(id, type) {
1184     *    API_EC_DATA_QUOTA_EXCEEDED
1185     *    API_EC_DATA_UNKNOWN_ERROR
1186     */
1187 <  public function data_setHashValue($obj_type, $key, $value, $prop_name = null) {
1187 >  public function &data_setHashValue($obj_type, $key, $value, $prop_name = null) {
1188      return $this->call_method
1189        ('facebook.data.setHashValue',
1190         array('obj_type' => $obj_type,
# Line 1023 | Line 1209 | function toggleDisplay(id, type) {
1209     *    API_EC_DATA_QUOTA_EXCEEDED
1210     *    API_EC_DATA_UNKNOWN_ERROR
1211     */
1212 <  public function data_incHashValue($obj_type, $key, $prop_name, $increment = 1) {
1212 >  public function &data_incHashValue($obj_type, $key, $prop_name, $increment = 1) {
1213      return $this->call_method
1214        ('facebook.data.incHashValue',
1215         array('obj_type' => $obj_type,
# Line 1045 | Line 1231 | function toggleDisplay(id, type) {
1231     *    API_EC_DATA_QUOTA_EXCEEDED
1232     *    API_EC_DATA_UNKNOWN_ERROR
1233     */
1234 <  public function data_removeHashKey($obj_type, $key) {
1234 >  public function &data_removeHashKey($obj_type, $key) {
1235      return $this->call_method
1236        ('facebook.data.removeHashKey',
1237         array('obj_type' => $obj_type,
# Line 1065 | Line 1251 | function toggleDisplay(id, type) {
1251     *    API_EC_DATA_QUOTA_EXCEEDED
1252     *    API_EC_DATA_UNKNOWN_ERROR
1253     */
1254 <  public function data_removeHashKeys($obj_type, $keys) {
1254 >  public function &data_removeHashKeys($obj_type, $keys) {
1255      return $this->call_method
1256        ('facebook.data.removeHashKeys',
1257         array('obj_type' => $obj_type,
# Line 1090 | Line 1276 | function toggleDisplay(id, type) {
1276     *    API_EC_DATA_QUOTA_EXCEEDED
1277     *    API_EC_DATA_UNKNOWN_ERROR
1278     */
1279 <  public function data_defineAssociation($name, $assoc_type, $assoc_info1,
1279 >  public function &data_defineAssociation($name, $assoc_type, $assoc_info1,
1280                                           $assoc_info2, $inverse = null) {
1281      return $this->call_method
1282        ('facebook.data.defineAssociation',
# Line 1114 | Line 1300 | function toggleDisplay(id, type) {
1300     *    API_EC_DATA_QUOTA_EXCEEDED
1301     *    API_EC_DATA_UNKNOWN_ERROR
1302     */
1303 <  public function data_undefineAssociation($name) {
1303 >  public function &data_undefineAssociation($name) {
1304      return $this->call_method
1305        ('facebook.data.undefineAssociation',
1306         array('name' => $name));
# Line 1137 | Line 1323 | function toggleDisplay(id, type) {
1323     *    API_EC_DATA_QUOTA_EXCEEDED
1324     *    API_EC_DATA_UNKNOWN_ERROR
1325     */
1326 <  public function data_renameAssociation($name, $new_name, $new_alias1 = null,
1326 >  public function &data_renameAssociation($name, $new_name, $new_alias1 = null,
1327                                           $new_alias2 = null) {
1328      return $this->call_method
1329        ('facebook.data.renameAssociation',
# Line 1160 | Line 1346 | function toggleDisplay(id, type) {
1346     *    API_EC_DATA_QUOTA_EXCEEDED
1347     *    API_EC_DATA_UNKNOWN_ERROR
1348     */
1349 <  public function data_getAssociationDefinition($name) {
1349 >  public function &data_getAssociationDefinition($name) {
1350      return $this->call_method
1351        ('facebook.data.getAssociationDefinition',
1352         array('name' => $name));
# Line 1176 | Line 1362 | function toggleDisplay(id, type) {
1362     *    API_EC_DATA_QUOTA_EXCEEDED
1363     *    API_EC_DATA_UNKNOWN_ERROR
1364     */
1365 <  public function data_getAssociationDefinitions() {
1365 >  public function &data_getAssociationDefinitions() {
1366      return $this->call_method
1367        ('facebook.data.getAssociationDefinitions',
1368         array());
# Line 1198 | Line 1384 | function toggleDisplay(id, type) {
1384     *    API_EC_DATA_QUOTA_EXCEEDED
1385     *    API_EC_DATA_UNKNOWN_ERROR
1386     */
1387 <  public function data_setAssociation($name, $obj_id1, $obj_id2, $data = null,
1387 >  public function &data_setAssociation($name, $obj_id1, $obj_id2, $data = null,
1388                                        $assoc_time = null) {
1389      return $this->call_method
1390        ('facebook.data.setAssociation',
# Line 1222 | Line 1408 | function toggleDisplay(id, type) {
1408     *    API_EC_DATA_QUOTA_EXCEEDED
1409     *    API_EC_DATA_UNKNOWN_ERROR
1410     */
1411 <  public function data_setAssociations($assocs, $name = null) {
1411 >  public function &data_setAssociations($assocs, $name = null) {
1412      return $this->call_method
1413        ('facebook.data.setAssociations',
1414         array('assocs' => json_encode($assocs),
# Line 1243 | Line 1429 | function toggleDisplay(id, type) {
1429     *    API_EC_DATA_QUOTA_EXCEEDED
1430     *    API_EC_DATA_UNKNOWN_ERROR
1431     */
1432 <  public function data_removeAssociation($name, $obj_id1, $obj_id2) {
1432 >  public function &data_removeAssociation($name, $obj_id1, $obj_id2) {
1433      return $this->call_method
1434        ('facebook.data.removeAssociation',
1435         array('name' => $name,
# Line 1264 | Line 1450 | function toggleDisplay(id, type) {
1450     *    API_EC_DATA_QUOTA_EXCEEDED
1451     *    API_EC_DATA_UNKNOWN_ERROR
1452     */
1453 <  public function data_removeAssociations($assocs, $name = null) {
1453 >  public function &data_removeAssociations($assocs, $name = null) {
1454      return $this->call_method
1455        ('facebook.data.removeAssociations',
1456         array('assocs' => json_encode($assocs),
# Line 1285 | Line 1471 | function toggleDisplay(id, type) {
1471     *    API_EC_DATA_QUOTA_EXCEEDED
1472     *    API_EC_DATA_UNKNOWN_ERROR
1473     */
1474 <  public function data_removeAssociatedObjects($name, $obj_id) {
1474 >  public function &data_removeAssociatedObjects($name, $obj_id) {
1475      return $this->call_method
1476        ('facebook.data.removeAssociatedObjects',
1477         array('name' => $name,
# Line 1308 | Line 1494 | function toggleDisplay(id, type) {
1494     *    API_EC_DATA_QUOTA_EXCEEDED
1495     *    API_EC_DATA_UNKNOWN_ERROR
1496     */
1497 <  public function data_getAssociatedObjects($name, $obj_id, $no_data = true) {
1497 >  public function &data_getAssociatedObjects($name, $obj_id, $no_data = true) {
1498      return $this->call_method
1499        ('facebook.data.getAssociatedObjects',
1500         array('name' => $name,
# Line 1331 | Line 1517 | function toggleDisplay(id, type) {
1517     *    API_EC_DATA_QUOTA_EXCEEDED
1518     *    API_EC_DATA_UNKNOWN_ERROR
1519     */
1520 <  public function data_getAssociatedObjectCount($name, $obj_id) {
1520 >  public function &data_getAssociatedObjectCount($name, $obj_id) {
1521      return $this->call_method
1522        ('facebook.data.getAssociatedObjectCount',
1523         array('name' => $name,
# Line 1353 | Line 1539 | function toggleDisplay(id, type) {
1539     *    API_EC_DATA_QUOTA_EXCEEDED
1540     *    API_EC_DATA_UNKNOWN_ERROR
1541     */
1542 <  public function data_getAssociatedObjectCounts($name, $obj_ids) {
1542 >  public function &data_getAssociatedObjectCounts($name, $obj_ids) {
1543      return $this->call_method
1544        ('facebook.data.getAssociatedObjectCounts',
1545         array('name' => $name,
# Line 1374 | Line 1560 | function toggleDisplay(id, type) {
1560     *    API_EC_DATA_QUOTA_EXCEEDED
1561     *    API_EC_DATA_UNKNOWN_ERROR
1562     */
1563 <  public function data_getAssociations($obj_id1, $obj_id2, $no_data = true) {
1563 >  public function &data_getAssociations($obj_id1, $obj_id2, $no_data = true) {
1564      return $this->call_method
1565        ('facebook.data.getAssociations',
1566         array('obj_id1' => $obj_id1,
# Line 1406 | Line 1592 | function toggleDisplay(id, type) {
1592         array('properties' => json_encode($properties)));
1593    }
1594  
1595 +  /**
1596 +   * Returns the allocation limit value for a specified integration point name
1597 +   * Integration point names are defined in lib/api/karma/constants.php in the limit_map
1598 +   * @param string $integration_point_name
1599 +   * @return integration point allocation value
1600 +   */
1601 +  public function &admin_getAllocation($integration_point_name) {
1602 +    return $this->call_method('facebook.admin.getAllocation', array('integration_point_name' => $integration_point_name));
1603 +  }
1604 +
1605 +  /**
1606 +   * Returns values for the specified daily metrics for the current
1607 +   * application, in the given date range (inclusive).
1608 +   *
1609 +   * @param start_date  unix time for the start of the date range
1610 +   * @param end_date    unix time for the end of the date range
1611 +   * @param metrics     list of daily metrics to look up
1612 +   * @return            a list of the values for those metrics
1613 +   */
1614 +  public function &admin_getDailyMetrics($start_date, $end_date, $metrics) {
1615 +    return $this->call_method('admin.getDailyMetrics',
1616 +                              array('start_date' => $start_date,
1617 +                                    'end_date' => $end_date,
1618 +                                    'metrics' => json_encode($metrics)));
1619 +  }
1620 +
1621 +
1622  
1623  
1624    /* UTILITY FUNCTIONS */
1625  
1626 <  public function call_method($method, $params) {
1627 <    if ($this->json) {
1628 <      $json = $this->post_request($method, $params);
1629 <      # XXX: silly facebook with its invalid JSON
1630 <      $valid = preg_match('/^[\[{].*[\]}]$/', $json);
1631 <      $array = json_decode($valid ? $json : "[$json]", true);
1632 <      $result = $valid ? $array : $array[0];
1633 <    } else {
1634 <      $xml = $this->post_request($method, $params);
1635 <      $sxml = simplexml_load_string($xml);
1636 <      $result = self::convert_simplexml_to_array($sxml);
1637 <      if ($GLOBALS['facebook_config']['debug']) {
1638 <        // output the raw xml and its corresponding php object, for debugging:
1639 <        print '<div style="margin: 10px 30px; padding: 5px; border: 2px solid black; background: gray; color: white; font-size: 12px; font-weight: bold;">';
1640 <        $this->cur_id++;
1641 <        print $this->cur_id . ': Called ' . $method . ', show ' .
1642 <              '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'params\');">Params</a> | '.
1643 <              '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'xml\');">XML</a> | '.
1644 <              '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'sxml\');">SXML</a> | '.
1645 <              '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'php\');">PHP</a>';
1433 <        print '<pre id="params'.$this->cur_id.'" style="display: none; overflow: auto;">'.print_r($params, true).'</pre>';
1434 <        print '<pre id="xml'.$this->cur_id.'" style="display: none; overflow: auto;">'.htmlspecialchars($xml).'</pre>';
1435 <        print '<pre id="php'.$this->cur_id.'" style="display: none; overflow: auto;">'.print_r($result, true).'</pre>';
1436 <        print '<pre id="sxml'.$this->cur_id.'" style="display: none; overflow: auto;">'.print_r($sxml, true).'</pre>';
1437 <        print '</div>';
1626 >  public function & call_method($method, $params) {
1627 >
1628 >    //Check if we are in batch mode
1629 >    if($this->batch_queue === null) {
1630 >      if ($this->call_as_apikey) {
1631 >        $params['call_as_apikey'] = $this->call_as_apikey;
1632 >      }
1633 >      if ($this->json)
1634 >      {
1635 >        $json = $this->post_request($method, $params);
1636 >        # XXX: silly facebook with its invalid JSON
1637 >        $valid = preg_match('/^[\[{].*[\]}]$/', $json);
1638 >        $array = json_decode($valid ? $json : "[$json]", true);
1639 >        $result = $valid ? $array : $array[0];
1640 >      } else {
1641 >        $xml = $this->post_request($method, $params);
1642 >        $result = $this->convert_xml_to_result($xml, $method, $params);
1643 >      }
1644 >      if (is_array($result) && isset($result['error_code'])) {
1645 >        throw new FacebookRestClientException($result['error_msg'], $result['error_code']);
1646        }
1647      }
1648 <    if (is_array($result) && isset($result['error_code'])) {
1649 <      throw new FacebookRestClientException($result['error_msg'], $result['error_code']);
1648 >    else {
1649 >      $result = null;
1650 >      $batch_item = array('m' => $method, 'p' => $params, 'r' => & $result);
1651 >      $this->batch_queue[] = $batch_item;
1652 >    }
1653 >
1654 >    return $result;
1655 >  }
1656 >
1657 >  private function convert_xml_to_result($xml, $method, $params) {
1658 >    $sxml = simplexml_load_string($xml);
1659 >    $result = self::convert_simplexml_to_array($sxml);
1660 >
1661 >
1662 >    if (!empty($GLOBALS['facebook_config']['debug'])) {
1663 >      // output the raw xml and its corresponding php object, for debugging:
1664 >      print '<div style="margin: 10px 30px; padding: 5px; border: 2px solid black; background: gray; color: white; font-size: 12px; font-weight: bold;">';
1665 >      $this->cur_id++;
1666 >      print $this->cur_id . ': Called ' . $method . ', show ' .
1667 >            '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'params\');">Params</a> | '.
1668 >            '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'xml\');">XML</a> | '.
1669 >            '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'sxml\');">SXML</a> | '.
1670 >            '<a href=# onclick="return toggleDisplay(' . $this->cur_id . ', \'php\');">PHP</a>';
1671 >      print '<pre id="params'.$this->cur_id.'" style="display: none; overflow: auto;">'.print_r($params, true).'</pre>';
1672 >      print '<pre id="xml'.$this->cur_id.'" style="display: none; overflow: auto;">'.htmlspecialchars($xml).'</pre>';
1673 >      print '<pre id="php'.$this->cur_id.'" style="display: none; overflow: auto;">'.print_r($result, true).'</pre>';
1674 >      print '<pre id="sxml'.$this->cur_id.'" style="display: none; overflow: auto;">'.print_r($sxml, true).'</pre>';
1675 >      print '</div>';
1676      }
1677      return $result;
1678    }
1679  
1680 <  public function post_request($method, $params) {
1680 >
1681 >
1682 >  private function create_post_string($method, $params) {
1683      $params['method'] = $method;
1684      $params['session_key'] = $this->session_key;
1685      $params['api_key'] = $this->api_key;
# Line 1463 | Line 1699 | function toggleDisplay(id, type) {
1699        $post_params[] = $key.'='.urlencode($val);
1700      }
1701      $post_params[] = 'sig='.Facebook::generate_sig($params, $this->secret);
1702 <    $post_string = implode('&', $post_params);
1702 >    return implode('&', $post_params);
1703 >  }
1704  
1705 <    if ($this->json) {
1706 <      $result = file_get_contents($this->server_addr, false, stream_context_create(
1707 <        array('http' =>
1708 <              array('method' => 'POST',
1709 <                    'header' => 'Content-type: application/x-www-form-urlencoded'."\r\n".
1710 <                                'User-Agent: Facebook API PHP5 Client 1.1 (non-curl) '.phpversion()."\r\n".
1474 <                                'Content-length: ' . strlen($post_string),
1475 <                    'content' => $post_string))));
1476 <    } elseif (function_exists('curl_init')) {
1705 >  public function post_request($method, $params) {
1706 >
1707 >    $post_string = $this->create_post_string($method, $params);
1708 >
1709 >
1710 >    if (function_exists('curl_init')) {
1711        // Use CURL if installed...
1712        $ch = curl_init();
1713        curl_setopt($ch, CURLOPT_URL, $this->server_addr);
# Line 1521 | Line 1755 | function toggleDisplay(id, type) {
1755        return (string)$sxml;
1756      }
1757    }
1758 +
1759   }
1760  
1761 +
1762   class FacebookRestClientException extends Exception {
1763   }
1764  
# Line 1581 | Line 1817 | class FacebookAPIErrorCodes {
1817    const API_EC_DATA_OBJECT_ALREADY_EXISTS = 804;
1818    const API_EC_DATA_DATABASE_ERROR = 805;
1819  
1820 +
1821 +  /*
1822 +   * Batch ERROR
1823 +   */
1824 +  const API_EC_BATCH_ALREADY_STARTED = 900;
1825 +  const API_EC_BATCH_NOT_STARTED = 901;
1826 +  const API_EC_BATCH_METHOD_NOT_ALLOWED_IN_BATCH_MODE = 902;
1827 +
1828    public static $api_error_descriptions = array(
1829        API_EC_SUCCESS           => 'Success',
1830        API_EC_UNKNOWN           => 'An unknown error occurred',
# Line 1613 | Line 1857 | class FacebookAPIErrorCodes {
1857        API_EC_DATA_OBJECT_NOT_FOUND => 'Specified object cannot be found',
1858        API_EC_DATA_OBJECT_ALREADY_EXISTS => 'Specified object already exists',
1859        API_EC_DATA_DATABASE_ERROR => 'A database error occurred. Please try again',
1860 +      API_EC_BATCH_ALREADY_STARTED => 'begin_batch already called, please make sure to call end_batch first',
1861 +      API_EC_BATCH_NOT_STARTED => 'end_batch called before start_batch',
1862 +      API_EC_BATCH_METHOD_NOT_ALLOWED_IN_BATCH_MODE => 'this method is not allowed in batch mode',
1863    );
1864   }
1618
1619 $profile_field_array = array(
1620    "about_me",
1621    "activities",
1622    "affiliations",
1623    "birthday",
1624    "books",
1625    "current_location",
1626    "education_history",
1627    "first_name",
1628    "hometown_location",
1629    "hs_info",
1630    "interests",
1631    "is_app_user",
1632    "last_name",
1633    "meeting_for",
1634    "meeting_sex",
1635    "movies",
1636    "music",
1637    "name",
1638    "notes_count",
1639    "pic",
1640    "pic_big",
1641    "pic_small",
1642    "political",
1643    "profile_update_time",
1644    "quotes",
1645    "relationship_status",
1646    "religion",
1647    "sex",
1648    "significant_other_id",
1649    "status",
1650    "timezone",
1651    "tv",
1652    "wall_count",
1653    "work_history");
1654 ?>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines