function luna_send_json_error($data = null) { $response = array('success' => false); if (isset($data)) { $response['data'] = $data; } luna_send_json($response); }
function luna_ajax_trash_notification() { if (empty($_POST['_nonce'])) { luna_send_json_error(-1); } $response = array(); if (false === LunaNonces::verify($_POST['_nonce'], 'trash-notification-nonce')) { $response['nonces_expired'] = true; luna_send_json($response); } $id = isset($_POST['id']) && !empty($_POST['id']) ? intval($_POST['id']) : 0; if (!$id) { luna_send_json_error(); } global $luna_user; delete_notification($id, $luna_user['id']); luna_send_json_success(); }