Ejemplo n.º 1
0
 /**
  * Create tweet when Social does a broadcast
  *
  * @param Social_Response $response 
  * @param string $key
  * @param stdClass $post
  * @return void
  */
 static function social_broadcast_response($response, $key, $post)
 {
     // get tweet
     $data = $response->body();
     $tweet = $data->response;
     // check if it's one of our enabled accounts
     self::get_social_accounts();
     foreach (self::$accounts as $account) {
         if ($account->option('enabled') && $account->social_acct->id() == $tweet->user->id) {
             // populate AKTT_Tweet object, save
             $t = new AKTT_Tweet($tweet);
             $t->add();
             break;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Sets the raw data for the broadcasted post.
  *
  * @wp-filter social_broadcast_response
  * @static
  * @param  array                   $data
  * @param  Social_Service_Account  $account
  * @param  string                  $service_key
  * @param  int                     $post_id
  * @param  Social_Response         $response
  * @return array
  */
 public static function social_save_broadcasted_ids_data(array $data, Social_Service_Account $account, $service_key, $post_id, Social_Response $response = null)
 {
     if ($service_key == 'twitter') {
         if (!empty($response)) {
             $data['message'] = base64_encode(json_encode($response->body()->response));
         }
         $data['account'] = (object) array('user' => $account->as_object()->user);
     }
     return $data;
 }