Ejemplo n.º 1
0
add_action('wp_ajax_wprsrv_add_note', function () {
    if (!isset($_POST) || !isset($_POST['note_content'])) {
        echo 1;
        exit;
    }
    $post = $_POST;
    $reservationId = (int) $post['post_id'];
    $noteContent = $post['note_content'];
    $noteUserId = $post['user_id'];
    if (empty($reservationId) || empty($noteContent) || empty($noteUserId)) {
        echo 1;
        exit;
    }
    $reservation = new Reservation($reservationId);
    $noteContent = strip_tags($noteContent, 'a,b,i,strong,em,p');
    $reservation->addNote($noteContent, $noteUserId);
    echo 0;
    exit;
});
/**
 * AJAX
 * Accept a reservation in the wp-admin.
 *
 * @since 0.1.0
 * @return void
 */
add_action('wp_ajax_wprsrv_accept_reservation', function () {
    if (!isset($_POST) || !isset($_POST['post_id'])) {
        echo 1;
        exit;
    }
Ejemplo n.º 2
0
 /**
  * Handle failed email sends.
  *
  * @since 0.1.0
  *
  * @param String $emailType Type of email that failed.
  * @param ReservationObj $reservation Reservation for which the email failed.
  *
  * @return void
  */
 public function emailSendFailed($emailType, $reservation)
 {
     $reservation->addNote(sprintf(_x('Reservation email notification failed. Attempted to send a `%s` email.', 'note content for new declined reservation', 'wprsrv'), $emailType));
 }