function id_REST_save_comment()
{
    $rawComment = stripslashes(id_param('id_comment_data'));
    id_debug_log("Receive Comment: {$rawComment}");
    $comment = new id_comment();
    $comment->loadFromRemoteJson($rawComment);
    $result = array('success' => $comment->save(), 'comment' => $comment->export());
    if ('delete' == $comment->comment_status) {
        remove_action('wp_set_comment_status', 'id_comment_status', 10, 2);
        wp_delete_comment($comment->comment_ID);
        add_action('wp_set_comment_status', 'id_comment_status', 10, 2);
    }
    return $result;
}
示例#2
0
function id_REST_save_comment()
{
    $rawComment = stripslashes(id_param('id_comment_data'));
    id_debug_log("Receive Comment: {$rawComment}");
    $comment = new id_comment();
    $comment->loadFromRemoteJson($rawComment);
    return array('success' => $comment->save(), 'comment' => $comment->export());
}