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");
                    }
                }
            }
        }
    }
}
 /**
  * 添加收藏接口
  * 参数:post_id
  */
 public function add_favorite($post_id)
 {
     if (empty($post_id)) {
         json_error(BigAppErr::$favorite['code'], BigAppErr::$favorite['msg'], __lan("post id is empty"));
     }
     if ($this->favroite_enabled == true) {
         wpfp_add_favorite($post_id);
     } else {
         if (!is_user_logged_in() && get_option(BigAppConf::$option_favorite_switch, 0) == 0) {
             //默认,只要登录,就可以添加
             json_error(BigAppErr::$login['code'], BigAppErr::$login['msg'], __lan("need login"));
         }
         if ($this->do_add_to_list($post_id)) {
             // added, now?
             do_action('wpfp_after_add', $post_id);
             #if (wpfp_get_option('statistics')) wpfp_update_post_meta($post_id, 1);
         } else {
             json_error(BigAppErr::$favorite['code'], BigAppErr::$favorite['msg'], __lan("dup favorite"));
         }
     }
     $response = new WP_JSON_Response();
     $response->set_data(true);
     return $response;
 }