jfb_api_process

The WP-FB-AutoConnect jfb api process function.

Description

jfb_api_process( $result ); 

Parameters (1)

0. $result
The result.

Usage

  1. if ( !function_exists( 'jfb_api_process' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'wp-fb-autoconnect/__inc_opts.php'; 
  3.  
  4. // The result. 
  5. $result = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = jfb_api_process($result); 
  9.  

Defined (1)

The function is defined in the following location(s).

/__inc_opts.php  
  1. function jfb_api_process($result) 
  2. {  
  3. //In some situations, Wordpress may unexpectedly return WP_Error. If so, I'll create a Facebook-styleerrorarray 
  4. //so my Facebook-styleerrorhandling will pick it up without special cases everywhere. 
  5. if(is_wp_error($result)) 
  6. $errResult = array(); 
  7. $errResult[error]['message'] = "wp_remote_get() failed!"; 
  8. if( method_exists($result, 'get_error_message')) $errResult[error]['message'] .= " Message: " . $result->get_error_message(); 
  9. return $errResult; 
  10.  
  11. //Otherwise, decode the JSON text provided by Facebook into a PHP object. 
  12. return json_decode($result['body'], true);