Falcon_Reply::insert PHP Method

insert() public method

public insert ( )
    public function insert()
    {
        if (is_multisite()) {
            switch_to_blog($this->site);
        }
        $result = apply_filters('falcon.reply.insert', null, $this);
        if (is_multisite()) {
            restore_current_blog();
        }
        return $result;
    }

Usage Example

Esempio n. 1
0
 /**
  * Handles Mandrill inbound web hook
  *
  * @return void
  */
 public function handle_post()
 {
     if (isset($_POST['mandrill_events'])) {
         $parsed = reset(json_decode(wp_unslash($_POST['mandrill_events'])));
         if (!$parsed) {
             return;
         }
         $reply = new Falcon_Reply();
         $reply->subject = $parsed->msg->subject;
         $reply->body = $parsed->msg->text;
         list($reply->post, $reply->site, $reply->user, $reply->nonce) = Falcon_Reply::parse_to($parsed->msg->email);
         $reply_id = $reply->insert();
         if ($reply_id === false) {
             header('X-Fail: No reply ID', true, 400);
             echo 'Reply could not be added?';
             // intentionally not translated
             // Log this?
         }
     }
 }
All Usage Examples Of Falcon_Reply::insert