public function renderShortCode($attributes) { $this->form_id = uniqid(); $userData = new AB_UserBookingData($this->form_id); $userData->load(); $this->attributes = json_encode(is_array($attributes) ? $attributes : array()); $this->booking_finished = $userData->getBookingFinished(); $this->booking_cancelled = $userData->getBookingCancelled(); if ($this->booking_finished) { $userData->clean(); } elseif (isset($_COOKIE['first_step'])) { $cookie_data = json_decode(stripslashes($_COOKIE['first_step'])); $form_id = $cookie_data->form_id; if (isset($_SESSION['appointment_booking'][$form_id], $_SESSION['appointment_booking'][$form_id]['finished']) && $_SESSION['appointment_booking'][$form_id]['finished'] === true) { $userData->clean(); $this->booking_finished = true; } } if ($this->booking_cancelled) { $userData->clean(); } elseif (isset($_COOKIE['first_step'])) { $cookie_data = json_decode(stripslashes($_COOKIE['first_step'])); $form_id = $cookie_data->form_id; if (isset($_SESSION['appointment_booking'][$form_id], $_SESSION['appointment_booking'][$form_id]['cancelled']) && $_SESSION['appointment_booking'][$form_id]['cancelled'] === true) { $userData->clean(); $this->booking_cancelled = true; } } return $this->render('short_code', array(), false); }