1. /**
  2.  * Posts an update on Ping.fm.
  3.  *
  4.  * @param $post_method
  5.  *   Posting method.  Either "default", "blog", "microblog" or "status."
  6.  * @param $body
  7.  *   Message body.
  8.  * @param $title
  9.  *   Title of the posted message.  This will only appear if the specified
  10.  *   service supports a title field.  Otherwise, it will be discarded.
  11.  * @param $account
  12.  *   The user object that is posting the message. If nothing is passed,
  13.  *   then it is assumed to be the currently logged in user.
  14.  */
  15. function pingfm_post($body, $post_method = 'default', $title = NULL, $account = NULL) {
  16.   if (!isset($account)) {
  17.     global $user;
  18.     $account = $user;
  19.   }
  20.   if ($dev_key = variable_get('pingfm_dev_key', NULL) && isset($account->pingfm_app_key)) {
  21.     module_load_include('php', 'pingfm', 'phpingfm/PHPingFM');
  22.     $phpingfm = new PHPingFM($dev_key, $account->pingfm_app_key, variable_get('pingfm_debug', FALSE));
  23.     return $phpingfm->post($post_method, $body, $title);
  24.   }
  25. }