function replace_shortcodes($message, $data) { global $wpdb, $org_options; $payment_data = espresso_get_total_cost(array('attendee_session' => $data->attendee->attendee_session)); $event_cost = $payment_data['total_cost']; do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); $SearchValues = array("[event_id]", "[event_identifier]", "[registration_id]", "[fname]", "[lname]", "[phone]", "[event]", "[event_name]", "[description]", "[event_link]", "[event_url]", "[virtual_url]", "[virtual_phone]", "[venue_title]", "[venue_url]", "[venue_image]", "[venue_phone]", "[venue_address]", "[txn_id]", "[cost]", "[event_price]", "[ticket_qty]", "[ticket_type]", "[ticket_link]", "[certificate_link]", "[contact]", "[company]", "[co_add1]", "[co_add2]", "[co_city]", "[co_state]", "[co_zip]", "[payment_url]", "[invoice_link]", "[start_date]", "[start_time]", "[end_date]", "[end_time]", "[location]", "[location_phone]", "[google_map_link]", "[attendee_event_list]", "[custom_questions]", "[qr_code]", "[seating_tag]", "[edit_attendee_link]", "[add_to_calendar]"); $ReplaceValues = array($data->attendee->event_id, $data->event->event_identifier, $data->attendee->registration_id, $data->attendee->fname, $data->attendee->lname, $data->event->venue_phone, $data->event->event_name, $data->event->event_name, $data->event->event_desc, $data->event_link, $data->event_url, $data->event->virtual_url, $data->event->virtual_phone, $data->event->venue_name, $data->event->venue_url, $data->event->venue_image, $data->event->venue_phone, $data->location, $data->attendee->txn_id, $org_options['currency_symbol'] . $event_cost, $org_options['currency_symbol'] . $event_cost, $data->attendee->quantity, $data->attendee->price_option, $data->ticket_link, empty($data->certificate_link) ? '' : $data->certificate_link, empty($data->event->alt_email) ? $org_options['contact_email'] : $data->event->alt_email, $org_options['organization'], $org_options['organization_street1'], $org_options['organization_street2'], $org_options['organization_city'], $org_options['organization_state'], $org_options['organization_zip'], $data->payment_link, $data->invoice_link, event_date_display($data->attendee->start_date), event_date_display($data->attendee->event_time, get_option('time_format')), event_date_display($data->attendee->end_date), event_date_display($data->attendee->end_time, get_option('time_format')), $data->location, $data->event->venue_phone, $data->google_map_link, $data->table_open . $data->table_heading . $data->event_table . $data->table_close, isset($data->email_questions) && !empty($data->email_questions) ? $data->email_questions : '', $data->qr_code, $data->seatingchart_tag, $data->edit_attendee, apply_filters('filter_hook_espresso_display_ical', array('event_id' => $data->attendee->event_id, 'registration_id' => $data->attendee->registration_id, 'event_name' => $data->event->event_name, 'event_desc' => wp_kses($data->event->event_desc, array()), 'contact_email' => empty($data->event->alt_email) ? $org_options['contact_email'] : $data->event->alt_email, 'start_time' => empty($event->start_time) ? '' : $event->start_time, 'start_date' => event_date_display($data->attendee->start_date, get_option('date_format')), 'end_date' => event_date_display($data->attendee->end_date, get_option('date_format')), 'start_time' => empty($data->attendee->event_time) ? '' : $data->attendee->event_time, 'end_time' => empty($data->attendee->end_time) ? '' : $data->attendee->end_time, 'location' => $data->location), '', '', TRUE)); //Get the questions and answers $questions = $wpdb->get_results("select qst.question as question, ans.answer as answer from " . EVENTS_ANSWER_TABLE . " ans inner join " . EVENTS_QUESTION_TABLE . " qst on ans.question_id = qst.id where ans.attendee_id = " . $data->attendee->id, ARRAY_A); //echo '<p>'.print_r($questions).'</p>'; if ($wpdb->num_rows > 0 && $wpdb->last_result[0]->question != NULL) { foreach ($questions as $q) { $k = stripslashes($q['question']); $v = stripslashes($q['answer']); //Output the question array_push($SearchValues, "[" . 'question_' . $k . "]"); array_push($ReplaceValues, $k); //Output the answer array_push($SearchValues, "[" . 'answer_' . $k . "]"); array_push($ReplaceValues, rtrim($v, ",")); } } //Get the event meta //echo '<p>'.print_r($data->event->event_meta).'</p>'; if (!empty($data->event->event_meta)) { foreach ($data->event->event_meta as $k => $v) { if (!empty($k) && !is_array($v)) { array_push($SearchValues, "[" . $k . "]"); array_push($ReplaceValues, stripslashes_deep($v)); } } } //Perform the replacement return str_replace($SearchValues, $ReplaceValues, $message); }
/** * Calculates the MAC security string to verify that this request has not been altered * @param array $payment_data * @return string */ function generate_mac_string($payment_data) { $luottokunta_settings = get_option('event_espresso_luottokunta_settings'); $mac_parts['mac_key'] = $luottokunta_settings['luottokunta_mac_key']; // 'KTLDJ546GDS'; $mac_parts['transaction_type'] = "0"; //constant $mac_parts['currency_code'] = "978"; //constant $payment_data = espresso_get_total_cost($payment_data); //var_dump($payment_data); $mac_parts['amount'] = $payment_data['total_cost'] * 100; //12345;//get from using the $payment_data, and passing it to espresso_get_total_cost(), and then multiplying $paymnet_data['total_cost'] by 100 $mac_parts['order_id'] = $_GET['order_id']; //'987654321'; $mac_parts['merchant_number'] = $luottokunta_settings['luottokunta_id']; //'7778883'; //the instructions said to use these parameters from the get string, but they aren't being provided, //so I made a guess to just remove them, and it worked! yipee! //$mac_parts['country_code'] = $_GET['LKBINCOUNTRY'];//'FI';// //$mac_parts['ip_country_code'] = $_GET['LKIPCOUNTRY'];//'SE';// //$mac_parts['lkeci'] = $_GET['LKECI'];// '05';//$_GET, no idea what this is. the 'html ofrm interface v1.3 just says to add it) $mac_string = implode("&", $mac_parts); //echo "mac string :<br>$mac_string"; $hashed_mac_string = hash('sha256', $mac_string); return $hashed_mac_string; }