function wp_favorite_posts()
{
    if (isset($_REQUEST['wpfpaction'])) {
        global $ajax_mode;
        $ajax_mode = isset($_REQUEST['ajax']) ? $_REQUEST['ajax'] : false;
        if ($_REQUEST['wpfpaction'] == 'add') {
            wpfp_add_favorite();
        } else {
            if ($_REQUEST['wpfpaction'] == 'remove') {
                wpfp_remove_favorite();
            } else {
                if ($_REQUEST['wpfpaction'] == 'clear') {
                    if (wpfp_clear_favorites()) {
                        wpfp_die_or_go(wpfp_get_option('cleared'));
                    } else {
                        wpfp_die_or_go("ERROR");
                    }
                }
            }
        }
    }
}
 /**
  * 删除之前收藏的帖子
  */
 public function remove_favorite($post_id)
 {
     $status = true;
     if (empty($post_id)) {
         json_error(BigAppErr::$favorite['code'], BigAppErr::$favorite['msg'], __lan("post id is empty"));
     }
     if ($this->favroite_enabled == true) {
         wpfp_remove_favorite($post_id);
     } else {
         if ($this->_do_remove_favorite($post_id)) {
             // removed, now?
             do_action('wpfp_after_remove', $post_id);
             #if (wpfp_get_option('statistics')) wpfp_update_post_meta($post_id, -1);
         }
     }
     $response = new WP_JSON_Response();
     $response->set_data($status);
     return $response;
 }