/**
* HighPoint functions and definitions
*
* @package HighPoint
*/
if (!function_exists('highpoint_setup')) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function highpoint_setup()
{
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on HighPoint, use a find and replace
* to change 'highpoint' to the name of your theme in all the template files
*/
load_theme_textdomain('highpoint', get_template_directory() . '/languages');
// Add default posts and comments RSS feed links to head.
add_theme_support('automatic-feed-links');
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support('title-tag');
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support('post-thumbnails');
add_image_size('column-thumb', 600, 450, true); // (cropped)
add_image_size('unit-thumb', 960, 425, true); // (cropped)
add_image_size('button-thumb', 350, 350, true); // (cropped)
// This theme uses wp_nav_menu() in one location.
register_nav_menus(array(
'primary' => esc_html__('Primary Menu', 'highpoint'),
));
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support('html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption',
));
/*
* Enable support for Post Formats.
* See http://codex.wordpress.org/Post_Formats
*/
// add_theme_support( 'post-formats', array(
// 'aside', 'image', 'video', 'quote', 'link',
// ) );
// Set up the WordPress core custom background feature.
// add_theme_support( 'custom-background', apply_filters( 'highpoint_custom_background_args', array(
// 'default-color' => 'ffffff',
// 'default-image' => '',
// ) ) );
}
endif; // highpoint_setup
add_action('after_setup_theme', 'highpoint_setup');
// add image sizes to image uploader
function lqm_show_image_sizes($sizes)
{
$sizes['column-thumb'] = __('Column Thumb', 'highpoint');
$sizes['button-thumb'] = __('Button Thumb', 'highpoint');
return $sizes;
}
add_filter('image_size_names_choose', 'lqm_show_image_sizes');
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function highpoint_content_width()
{
$GLOBALS['content_width'] = apply_filters('highpoint_content_width', 960);
}
add_action('after_setup_theme', 'highpoint_content_width', 0);
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
//function highpoint_widgets_init() {
// register_sidebar( array(
// 'name' => esc_html__( 'Sidebar', 'highpoint' ),
// 'id' => 'sidebar-1',
// 'description' => '',
// 'before_widget' => '',
// 'before_title' => '',
// ) );
//}
//add_action( 'widgets_init', 'highpoint_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function highpoint_scripts()
{
wp_enqueue_style('highpoint-style', get_stylesheet_uri());
// wp_enqueue_style( 'highpoint-google-fonts', 'http://fonts.googleapis.com/css?family=Jockey+One|Open+Sans:400,700' );
// wp_enqueue_style( 'highpoint-google-fonts', 'http://fonts.googleapis.com/css?family=Oswald:400,300,700' );
wp_enqueue_style('highpoint-google-fonts', 'https://fonts.googleapis.com/css?family=Montserrat:400,700');
// wp_enqueue_style( 'highpoint-google-fonts', 'http://fonts.googleapis.com/css?family=Karla:400,700' );
wp_enqueue_style('highpoint-fontawesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
wp_enqueue_script('highpoint-navigation', get_template_directory_uri() . '/js/navigation.js', array('jquery'), '20120206', true);
wp_enqueue_script('highpoint-superfish', get_template_directory_uri() . '/js/superfish.min.js', array('jquery'), '20120206', true);
wp_enqueue_script('highpoint-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true);
wp_enqueue_script('jquery-masonry', array('jquery'));
//if(is_singular( 'property') ) {
wp_enqueue_script('highpoint-slides', get_template_directory_uri() . '/js/jquery.slides.js', array(), '20130115', true);
//}
wp_enqueue_script('highpoint-custom-js', get_template_directory_uri() . '/js/custom.js', array('jquery'), '20130115', true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
add_action('wp_enqueue_scripts', 'highpoint_scripts');
add_action('wp_print_styles', 'slider_init_css');
function slider_init_css()
{
if (is_singular('property')) {
echo '';
}
}
// Start sessio to store city
add_action('init', 'myStartSession', 1);
function myStartSession()
{
if (!session_id()) {
session_start();
}
}
add_action('init', 'start_session', 1);
function start_session()
{
if (!session_id()) {
session_start();
}
}
// [moneris_payment_declined foo="foo-value"]
function moneris_paymentdeclined_func($atts)
{
global $wpdb;
$orderId = trim($_POST['response_order_id']);
$date_stamp = trim($_POST['date_stamp']);
$time_stamp = trim($_POST['time_stamp']);
$bank_transaction_id = trim($_POST['bank_transaction_id']);
$charge_total = trim($_POST['charge_total']);
$bank_approval_code = trim($_POST['bank_approval_code']);
$response_code = trim($_POST['response_code']);
$message = trim($_POST['message']);
$trans_name = trim($_POST['trans_name']);
$cardholder = trim($_POST['cardholder']);
$f4l4 = trim($_POST['f4l4']);
$card = trim($_POST['card']);
$entryId = $_SESSION['entryId'];
if (isset($_POST['ISSCONF'])) {
$issconf = trim($_POST['ISSCONF']);
} else {
$issconf = " ";
}
if (isset($_POST['ISSNAME'])) {
$issname = trim($_POST['ISSNAME']);
} else {
$issname = " ";
}
$monerisDeclinedOutput;
if ($card == "P") {
$monerisDeclinedOutput .= "";
$monerisDeclinedOutput .= "";
$monerisDeclinedOutput .= "Status : ";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= " Payment was unsuccessful";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "";
$monerisDeclinedOutput .= "Confirmation Number : ";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "$issconf";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "";
$monerisDeclinedOutput .= "Financial Institution : ";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "$issname";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "";
$monerisDeclinedOutput .= "Message : ";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "$message";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "
";
return $monerisDeclinedOutput;
} else {
$monerisDeclinedOutput .= "";
$monerisDeclinedOutput .= "";
$monerisDeclinedOutput .= "Card Holder : ";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "$cardholder";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "";
$monerisDeclinedOutput .= "Amount : ";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "$ $charge_total CAD";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "";
$monerisDeclinedOutput .= "Card Number : ";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "$f4l4";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "";
$monerisDeclinedOutput .= "Status : ";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "$message";
$monerisDeclinedOutput .= " ";
$monerisDeclinedOutput .= "
";
$wpdb->update(
'wp_rg_lead',
array(
'payment_date' => $date_stamp . " " . $time_stamp, // integer (number)
'payment_amount' => $charge_total,
'payment_method' => $card
),
array('id' => $entryId),
array(
'%s', // value1
'%s', // value2
'%s',
'%s'
),
array('%d')
);
return $monerisDeclinedOutput;
}
}
add_shortcode('moneris_payment_declined', 'moneris_paymentdeclined_func');
// [moneris_payment_success foo="foo-value"]
function moneris_paymentsuccess_func($atts)
{
global $wpdb;
$orderId = trim($_POST['response_order_id']);
$date_stamp = trim($_POST['date_stamp']);
$time_stamp = trim($_POST['time_stamp']);
$bank_transaction_id = trim($_POST['bank_transaction_id']);
$charge_total = trim($_POST['charge_total']);
$bank_approval_code = trim($_POST['bank_approval_code']);
$response_code = trim($_POST['response_code']);
$message = trim($_POST['message']);
$trans_name = trim($_POST['trans_name']);
if (isset($_POST['ISSCONF'])) {
$issconf = trim($_POST['ISSCONF']);
} else {
$issconf = " ";
}
if (isset($_POST['ISSNAME'])) {
$issname = trim($_POST['ISSNAME']);
} else {
$issname = " ";
}
$cardholder = trim($_POST['cardholder']);
$f4l4 = trim($_POST['f4l4']);
$card = trim($_POST['card']);
if (!isset($_POST['bank_transaction_id'])) {
wp_redirect(home_url());
exit;
}
if ($card == "M") {
$pay_m = "MasterCard";
$confDiv = "
Transaction is Successful ";
} elseif ($card == "V") {
$pay_m = "Visa";
$confDiv = "
Transaction is Successful ";
} elseif ($card == "P") {
$pay_m = "INTERAC® Online Service";
$confDiv = "Payment Method
$pay_m Bank: $issname
Confirmation Number: $issconf
Transaction is Successful ";
} else {
$pay_m = " ";
$confDiv = " ";
}
$expiry_date = trim($_POST['expiry_date']);
$entryId = $_SESSION['entryId'];
$query = "SELECT
lead_meta.value AS fname,
lead_meta1.value AS lname,
lead_meta3.value AS address,
lead_meta8.value AS email,
lead_meta9.value AS phone,
lead_meta2.value AS unit,
lead_meta4.value AS city,
lead_meta5.value AS province,
lead_meta6.value AS zip
FROM wp_rg_lead lead
LEFT JOIN wp_rg_lead_detail AS lead_meta
ON (lead.id=lead_meta.lead_id AND cast(lead_meta.field_number as decimal(5,1)) = 1.3)
LEFT JOIN wp_rg_lead_detail AS lead_meta1
ON (lead_meta.lead_id=lead_meta1.lead_id AND cast(lead_meta1.field_number as decimal(5,1)) = 1.6)
LEFT JOIN wp_rg_lead_detail AS lead_meta3
ON (lead_meta1.lead_id=lead_meta3.lead_id AND cast(lead_meta3.field_number as decimal(5,1)) = 17)
LEFT JOIN wp_rg_lead_detail AS lead_meta2
ON (lead_meta3.lead_id=lead_meta2.lead_id AND cast(lead_meta2.field_number as decimal(5,1)) = 20)
LEFT JOIN wp_rg_lead_detail AS lead_meta4
ON (lead_meta2.lead_id=lead_meta4.lead_id AND cast(lead_meta4.field_number as decimal(5,1)) = 19.3)
LEFT JOIN wp_rg_lead_detail AS lead_meta5
ON (lead_meta4.lead_id=lead_meta5.lead_id AND cast(lead_meta5.field_number as decimal(5,1)) = 19.4)
LEFT JOIN wp_rg_lead_detail AS lead_meta6
ON (lead_meta5.lead_id=lead_meta6.lead_id AND cast(lead_meta6.field_number as decimal(5,1)) = 19.5)
LEFT JOIN wp_rg_lead_detail AS lead_meta8
ON (lead_meta6.lead_id=lead_meta8.lead_id AND cast(lead_meta8.field_number as decimal(5,1)) = 3)
LEFT JOIN wp_rg_lead_detail AS lead_meta9
ON (lead_meta8.lead_id=lead_meta9.lead_id AND cast(lead_meta9.field_number as decimal(5,1)) = 4)
WHERE lead.id='$entryId'";
$result = $wpdb->get_row($query);
$wpdb->update(
'wp_rg_lead',
array(
'payment_status' => 'completed', // string
'payment_date' => $date_stamp . " " . $time_stamp, // integer (number)
'payment_amount' => $charge_total,
'payment_method' => $card,
'transaction_id' => $bank_transaction_id
),
array('id' => $entryId),
array(
'%s', // value1
'%s', // value2
'%s',
'%s'
),
array('%d')
);
$addressF = $result->unit . ", " . $result->address . ", " . $result->city . ", " . $result->province . ", " . $result->zip;
$paymentReceipt = "
$confDiv
INVOICE TO:
$result->fname $result->lname
$addressF
INVOICE $entryId
Date of Invoice: $date_stamp
#
DESCRIPTION
TOTAL
01
Payment $addressF
$ $charge_total CAD
GRAND TOTAL $ $charge_total CAD
";
$subject = "Highpoint Payments";
$messageUser = generateUserEmail($orderId, $date_stamp, $time_stamp, $bank_transaction_id, $charge_total, $bank_approval_code, $response_code, $message, $trans_name, $cardholder, $f4l4, $card, $expiry_date, $entryId, $result->fname, $result->lname, $addressF, $result->email, $result->phone);
$messageAdmin = generateAdminEmail($orderId, $date_stamp, $time_stamp, $bank_transaction_id, $charge_total, $bank_approval_code, $response_code, $message, $trans_name, $cardholder, $f4l4, $card, $expiry_date, $entryId, $result->fname, $result->lname, $addressF, $result->email, $result->phone);
$attachments = "";
$separator = md5(time());
$eol = PHP_EOL;
$from = "Highpoint Properties ";
$headers = "From: " . $from . $eol;
$headers .= "MIME-Version: 1.0" . $eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"";
$bodyUser .= "--" . $separator . $eol;
$bodyUser .= "Content-Type: text/html; charset=\"iso-8859-1\"" . $eol;
$bodyUser .= "Content-Transfer-Encoding: 8bit" . $eol . $eol;
$bodyUser .= $messageUser . $eol;
$bodyAdmin .= "--" . $separator . $eol;
$bodyAdmin .= "Content-Type: text/html; charset=\"iso-8859-1\"" . $eol;
$bodyAdmin .= "Content-Transfer-Encoding: 8bit" . $eol . $eol;
$bodyAdmin .= $messageAdmin . $eol;
$userEmail = $result->email;
$adminEmail = "info@highpointproperties.ca";
// $adminEmail = "dlakshan09@gmail.com";
// $adminEmail = "portia.mdosl@gmail.com";
mail($userEmail, $subject, $bodyUser, $headers);
mail($adminEmail, $subject, $bodyAdmin, $headers);
return $paymentReceipt;
//return print_r($_POST);
}
add_shortcode('moneris_payment_success', 'moneris_paymentsuccess_func');
//Gravity form submition: define redirect page
add_action("gform_after_submission", "after_submission", 10, 2);
function after_submission($entry, $form){
$form_id = $form['id'];
if(intval($form_id) == 19){
$post_id = $entry['id'];
// echo $post_id;
// $confirmation = array( 'redirect' => site_url().'/payment-confirmation' .'?entryId='.$post_id );
wp_redirect( site_url().'/payment-confirmation' .'?entryId='.$post_id );
exit;
}
// return $confirmation;
}
//Note: this will allow for the labels to be used during the submission process in case values are enabled
add_filter('gform_pre_submission_filter', 'populate_choices');
function populate_choices($form)
{
//only populating drop down for form id 5
if ($form['id'] != 19) {
return $form;
}
//Reading posts for "Business" category;
//$posts = get_posts( 'category=' . get_cat_ID( 'Business' ) );
global $wpdb;
$tempDir = get_template_directory_uri();
$query = "SELECT * FROM wp_hp_tt_address";
$result = $wpdb->get_results($query);
//Creating item array.
$items = array();
//Add a placeholder to field id 8, is not used with multi-select or radio, will overwrite placeholder set in form editor.
//Replace 8 with your actual field id.
$fields = $form['fields'];
foreach ($form['fields'] as &$field) {
if ($field->id == 17) {
$field->placeholder = 'Select the address';
}
}
//Adding post titles to the items array
foreach ($result as $post) {
$items[] = array('value' => $post->hp_tt_ad_address, 'text' => $post->hp_tt_ad_address);
}
//Adding items to field id 8. Replace 8 with your actual field id. You can get the field id by looking at the input name in the markup.
foreach ($form['fields'] as &$field) {
if ($field->id == 17) {
$field->choices = $items;
}
}
return $form;
}
function generateUserEmail($orderId, $date_stamp, $time_stamp, $bank_transaction_id, $charge_total, $bank_approval_code, $response_code, $message, $trans_name, $cardholder, $f4l4, $card, $expiry_date, $entryId, $fname, $lname, $address, $email, $phone)
{
$body = <<Payment Details Name: {$fname} {$lname}Email: {$email}Phone: {$phone}Cardholer: {$cardholder}Time: {$date_stamp} {$time_stamp}Amount: $ {$charge_total} CADProperty Details Address: {$address}Thanks Highpoint 613-547-3030 Copyright © 2018 highpointproperties.ca -All Rights Reserved.
EOD;
return $body;
}
function generateAdminEmail($orderId, $date_stamp, $time_stamp, $bank_transaction_id, $charge_total, $bank_approval_code, $response_code, $message, $trans_name, $cardholder, $f4l4, $card, $expiry_date, $entryId, $fname, $lname, $address, $email, $phone)
{
$body = <<Payer Details Name: {$fname} {$lname}Email: {$email}Phone: {$phone}Cardholer: {$cardholder}Time: {$date_stamp} {$time_stamp}Amount: $ {$charge_total} CADProperty Details Address: {$address}Thanks Highpoint 613-547-3030 Copyright © 2018 highpointproperties.ca -All Rights Reserved.
EOD;
return $body;
}
// [monerisform foo="foo-value"]
function monerisform_func($atts)
{
global $wpdb;
// $entry = trim($_GET['entryId']);
$entryId = trim($_GET['entryId']);
$url = site_url().'/payment-confirmation' .'?entryId='.$entryId;
// echo $url;
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response']))
{
// echo "Success";
$secret = '6LfZVrcUAAAAABlZzvyU1mtUQP1hHEn9TUjIh4Tj';
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
$responseData = json_decode($verifyResponse);
if($responseData->success)
{
$Msg = 'Your contact request have submitted successfully.';
// echo ($Msg);
session_start();
// echo $entry;
// $entryId = decrypt($entry, '2342423');
// echo $entryId;
$query = "SELECT
lead_meta.value AS fname,
lead_meta1.value AS lname,
lead_meta3.value AS address,
lead_meta8.value AS email,
lead_meta9.value AS phone,
lead_meta2.value AS unit,
lead_meta4.value AS city,
lead_meta5.value AS province,
lead_meta6.value AS zip,
lead_meta10.value AS amount,
lead_meta11.value AS pay_type,
lead_meta12.value AS pay_month,
lead_meta13.value AS pp_type
FROM wp_rg_lead lead
LEFT JOIN wp_rg_lead_detail AS lead_meta
ON (lead.id=lead_meta.lead_id AND cast(lead_meta.field_number as decimal(5,1)) = 1.3)
LEFT JOIN wp_rg_lead_detail AS lead_meta1
ON (lead_meta.lead_id=lead_meta1.lead_id AND cast(lead_meta1.field_number as decimal(5,1)) = 1.6)
LEFT JOIN wp_rg_lead_detail AS lead_meta3
ON (lead_meta1.lead_id=lead_meta3.lead_id AND cast(lead_meta3.field_number as decimal(5,1)) = 17)
LEFT JOIN wp_rg_lead_detail AS lead_meta2
ON (lead_meta3.lead_id=lead_meta2.lead_id AND cast(lead_meta2.field_number as decimal(5,1)) = 20)
LEFT JOIN wp_rg_lead_detail AS lead_meta4
ON (lead_meta2.lead_id=lead_meta4.lead_id AND cast(lead_meta4.field_number as decimal(5,1)) = 19.3)
LEFT JOIN wp_rg_lead_detail AS lead_meta5
ON (lead_meta4.lead_id=lead_meta5.lead_id AND cast(lead_meta5.field_number as decimal(5,1)) = 19.4)
LEFT JOIN wp_rg_lead_detail AS lead_meta6
ON (lead_meta5.lead_id=lead_meta6.lead_id AND cast(lead_meta6.field_number as decimal(5,1)) = 19.5)
LEFT JOIN wp_rg_lead_detail AS lead_meta8
ON (lead_meta6.lead_id=lead_meta8.lead_id AND cast(lead_meta8.field_number as decimal(5,1)) = 3)
LEFT JOIN wp_rg_lead_detail AS lead_meta9
ON (lead_meta8.lead_id=lead_meta9.lead_id AND cast(lead_meta9.field_number as decimal(5,1)) = 4)
LEFT JOIN wp_rg_lead_detail AS lead_meta10
ON (lead_meta9.lead_id=lead_meta10.lead_id AND cast(lead_meta10.field_number as decimal(5,1)) = 7)
LEFT JOIN wp_rg_lead_detail AS lead_meta11
ON (lead_meta10.lead_id=lead_meta11.lead_id AND cast(lead_meta11.field_number as decimal(5,1)) = 14)
LEFT JOIN wp_rg_lead_detail AS lead_meta12
ON (lead_meta11.lead_id=lead_meta12.lead_id AND cast(lead_meta12.field_number as decimal(5,1)) = 6)
LEFT JOIN wp_rg_lead_detail AS lead_meta13
ON (lead_meta12.lead_id=lead_meta13.lead_id AND cast(lead_meta13.field_number as decimal(5,1)) = 5)
WHERE lead.id='$entryId'";
// $query = "SELECT * FROM `wp_rg_lead_detail` WHERE `lead_id` = '$entryId'";
$result = $wpdb->get_row($query);
// echo json_encode($result);
$fname = $result->fname;
$lname = $result->lname;
$unit = $result->unit;
$city = $result->city;
$province = $result->province;
$zip = $result->zip;
$address1 = $result->address;
$email = $result->email;
$payment_type = $result->pp_type;
$a_month = $result->pay_month;
$amount = $result->amount;
$pmnt_type = $result->pay_type;
if ($pmnt_type == 'Interac') {
$p_type = 'INTERAC® Online Service';
} else {
$p_type = $pmnt_type;
}
$monerisConOutput;
// $fname = trim($_GET['fname']);
// $lname = trim($_GET['lname']);
// $unit = trim($_GET['unitNum']);
// $city = trim($_GET['city']);
// $province = trim($_GET['province']);
// $zip = trim($_GET['zip']);
// $address1 = trim($_GET['hp_address']);
// $email = trim($_GET['email']);
// $payment_type = trim($_GET['payment_type']);
// $a_month = trim($_GET['a_month']);
// $amount = trim($_GET['amount']);
// $pmnt_type = trim($_GET['p_type']);
// if($pmnt_type == 'Interac'){$p_type='INTERAC® Online Service';}else{$p_type=$pmnt_type;}
// $entryId = trim($_GET['entryId']);
// $formId = trim($_GET['formId']);
$_SESSION['entryId'] = $entryId;
$_SESSION['formId'] = $formId;
// echo "Entry ID ".$entryId;
$monerisConOutput .="
";
// $paymentAmount = explode(" ","$amount");
// $payArr = explode(",",$paymentAmount[1]);
// $payArr = $amount;
// echo $amount;
$pay = $amount;
// for($i=0;$i ";
if ($p_type === 'Credit Card') {
// $monerisConOutput .="";
// $monerisConOutput .="";
// $monerisConOutput .="";
// $monerisConOutput .="";
// $monerisConOutput .="";
// $monerisConOutput .="";
$monerisConOutput .= preloadPayment('UP8MC06492', 'hpN255QQ2EUZ', $price);
// $monerisConOutput .= preloadPayment('M76MMtore3', 'hpY86KYNSJHI', $price);
} else {
// $monerisConOutput .="";
//$monerisConOutput .="";
// $monerisConOutput .="";
// $monerisConOutput .="";
// $monerisConOutput .="";
$monerisConOutput .= preloadPayment('BH4U306492', 'hpRRLI4DHFT9', $price);
// $monerisConOutput .= preloadPayment('MARP4tore3', 'hpZYYH2J9K2I', $price);
}
}
else
{
$Msg = 'Robot verification failed, please try again.';
echo ($Msg);
// $siteURL = site_url().'/p_3545';
// wp_redirect( $siteURL .'?entryId='.$post_id );
// header('Location:'.$siteURL);
exit();
}
}else{
$monerisConOutput.= "";
$monerisConOutput.= "";
$monerisConOutput .= "";
}
return $monerisConOutput;
}
add_shortcode('monerisform', 'monerisform_func');
/*
* payment page preload
*/
function preloadPayment($store_id, $hpp_key, $charge_total)
{
$charge_total = number_format($charge_total,2,".","");
// $url = "https://esqa.moneris.com/HPPDP/index.php"; //Test Url
$url = "https://www3.moneris.com/HPPDP/index.php"; //Production
$gArray = array(
'API_VERSION' => "curl/7.62.0",
'CLIENT_TIMEOUT' => '60'
);
$dataToSend = "ps_store_id=$store_id&hpp_key=$hpp_key&charge_total=$charge_total&hpp_preload=";
// echo $dataToSend;
//send transaction to Moneris via an HTTPS Post using php Curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataToSend);
curl_setopt($ch, CURLOPT_TIMEOUT, $gArray['CLIENT_TIMEOUT']);
curl_setopt($ch, CURLOPT_USERAGENT, $gArray['API_VERSION']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
// echo $ch;
$response = curl_exec($ch);
curl_close($ch);
// echo json_encode($response);
// echo "Raw Response : " . $response . " ";
if (!$response) {
$response = "Error preloading page";
} else {
$xmlString = new SimpleXMLElement($response);
$ticket = $xmlString->ticket;
$order_id = $xmlString->order_id;
$response_code = $xmlString->response_code;
$hpp_id = $xmlString->hpp_id;
// echo "Data recieved : ";
// echo "Ticket : " . $ticket . " ";
// echo "Order ID : " . $order_id . " ";
// echo "Response Code : " . $response_code . " ";
if ($response_code < 50) {
// echo "OK: Data successfully loaded ";
// echo '';
return "";
} else {
return "Error: Data was not successfully loaded ";
}
}
}
/**
* Implement the Custom Header feature.
*/
//require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* Custom Shortcodes
*/
require get_template_directory() . '/lqm/inc/shortcodes.php';
/**
* Common Functions
*/
require get_template_directory() . '/lqm/inc/include-common.php';
/**
* Load custom CSS metabox
*/
require get_template_directory() . '/lqm/inc/custom-css.php';
/**
* Load custom MCS Editor
*/
//require get_template_directory() . '/lqm/inc/custom-editor.php';
/**
* ACF Theme Options
*/
require get_template_directory() . '/lqm/inc/acf-options.php';
/**
* Custom Post Types
*/
require get_template_directory() . '/lqm/inc/custom-post-types.php';
/**
* Custom Login
*/
require get_template_directory() . '/lqm/inc/custom-login.php';
/**
* Custom Gravity forms
*/
require get_template_directory() . '/lqm/inc/include-gravity.php';
/**
* Include highpoint theme functions
*/
require get_template_directory() . '/lqm/inc/include-highpoint.php';