/** * 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' => '<aside id="%1$s" class="widget %2$s">', // 'after_widget' => '</aside>', // 'before_title' => '<h1 class="widget-title">', // 'after_title' => '</h1>', // ) ); //} //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 '<style> /* Prevents slides from flashing */ #slides { display:none; } </style>'; } } // 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 .= "<style> table{ margin: 0 0 1.5em; width: 100%; border: 2px dashed #8e8d8d; } table tr td{ padding: 10px; border: 2px dashed #8e8d8d; } </style>"; $monerisDeclinedOutput .= "<table><tr><td style='width:20%;'>"; $monerisDeclinedOutput .= "Status : "; $monerisDeclinedOutput .= "</td>"; $monerisDeclinedOutput .= "<td> Payment was unsuccessful"; $monerisDeclinedOutput .= "</td></tr>"; $monerisDeclinedOutput .= "<tr><td>"; $monerisDeclinedOutput .= "Confirmation Number : "; $monerisDeclinedOutput .= "</td>"; $monerisDeclinedOutput .= "<td>$issconf"; $monerisDeclinedOutput .= "</td></tr>"; $monerisDeclinedOutput .= "<tr><td>"; $monerisDeclinedOutput .= "Financial Institution : "; $monerisDeclinedOutput .= "</td>"; $monerisDeclinedOutput .= "<td>$issname"; $monerisDeclinedOutput .= "</td></tr>"; $monerisDeclinedOutput .= "<tr><td>"; $monerisDeclinedOutput .= "Message : "; $monerisDeclinedOutput .= "</td>"; $monerisDeclinedOutput .= "<td style='color:red;'>$message"; $monerisDeclinedOutput .= "</td></tr>"; $monerisDeclinedOutput .= "</table>"; return $monerisDeclinedOutput; } else { $monerisDeclinedOutput .= "<style> table{ margin: 0 0 1.5em; width: 100%; border: 2px dashed #8e8d8d; } table tr td{ padding: 10px; border: 2px dashed #8e8d8d; } </style>"; $monerisDeclinedOutput .= "<table><tr><td style='width:20%;'>"; $monerisDeclinedOutput .= "Card Holder : "; $monerisDeclinedOutput .= "</td>"; $monerisDeclinedOutput .= "<td>$cardholder"; $monerisDeclinedOutput .= "</td></tr>"; $monerisDeclinedOutput .= "<tr><td>"; $monerisDeclinedOutput .= "Amount : "; $monerisDeclinedOutput .= "</td>"; $monerisDeclinedOutput .= "<td>$ $charge_total CAD"; $monerisDeclinedOutput .= "</td></tr>"; $monerisDeclinedOutput .= "<tr><td>"; $monerisDeclinedOutput .= "Card Number : "; $monerisDeclinedOutput .= "</td>"; $monerisDeclinedOutput .= "<td>$f4l4"; $monerisDeclinedOutput .= "</td></tr>"; $monerisDeclinedOutput .= "<tr><td>"; $monerisDeclinedOutput .= "Status : "; $monerisDeclinedOutput .= "</td>"; $monerisDeclinedOutput .= "<td style='color:red;'>$message"; $monerisDeclinedOutput .= "</td></tr>"; $monerisDeclinedOutput .= "</table>"; $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 = "<div class='status clearfix'><div class='trans_stat'><div class='to'>Payment Method</div><h2 class='name'>$pay_m</h2></div><div class='financial_ins'><h1>Transaction is Successful</h1></div></div>"; } elseif ($card == "V") { $pay_m = "Visa"; $confDiv = "<div class='status clearfix'><div class='trans_stat'><div class='to'>Payment Method</div><h2 class='name'>$pay_m</h2></div><div class='financial_ins'><h1>Transaction is Successful</h1></div></div>"; } elseif ($card == "P") { $pay_m = "INTERAC® Online Service"; $confDiv = "<div class='status clearfix'><div class='trans_stat'><div class='to'>Payment Method</div><h2 class='name'>$pay_m</h2><div class='name'>Bank: $issname</div><div class='name'>Confirmation Number: $issconf</div></div><div class='financial_ins'><h1>Transaction is Successful</h1></div></div>"; } 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 = " <style> @media print { body * { visibility: hidden; } #logo img { height: 50px; } .invoiceContainer, .invoiceContainer * { visibility: visible; } .invoiceContainer { position: absolute; left: 0; top: 0; } table .total { text-align: right; background-color: #57B223 !important; -webkit-print-color-adjust: exact; color: #FFFFFF; } table .no{ background-color: #57B223 !important; -webkit-print-color-adjust: exact; } table th, table td { background-color: #EEEEEE !important; -webkit-print-color-adjust: exact; } table tfoot td{ background-color: #FFFFFF !important; -webkit-print-color-adjust: exact; } } @font-face { font-family: SourceSansPro; src: url(SourceSansPro-Regular.ttf); } .clearfix:after { content: ''; display: table; clear: both; } a { color: #0087C3; text-decoration: none; } div.invoiceHeader { padding: 10px 0; margin-bottom: 20px; border-bottom: 1px solid #AAAAAA; } #logo { float: left; margin-top: 8px; } #logo img { height: 40px; } #company { float: right; text-align: right; } #details { margin-bottom: 50px; } #client { padding-left: 6px; border-left: 6px solid #0087C3; float: left; } #client .to { color: #777777; } h2.name { font-size: 1em; font-weight: normal; margin: 0; } #invoice { float: right; text-align: right; } #invoice h1 { color: #0087C3; font-size: 2.4em; line-height: 1em; font-weight: normal; margin: 0 0 10px 0; } #invoice .date { font-size: 1.1em; color: #777777; } table { width: 100%; border-collapse: collapse; border-spacing: 0; margin-bottom: 20px; } table th, table td { padding: 20px; background: #EEEEEE; text-align: center; border-bottom: 1px solid #FFFFFF; } table th { white-space: nowrap; font-weight: normal; } table td { text-align: right; } table td h3{ color: #57B223; font-size: 1.2em; font-weight: normal; margin: 0 0 0.2em 0; } table .no { color: #FFFFFF; font-size: 1.6em; background: #57B223; } table .desc { text-align: left; } table .unit { background: #DDDDDD; } table .qty { } table .total { text-align: right; background: #57B223; color: #FFFFFF; } table td.unit, table td.qty, table td.total { font-size: 1.2em; } table tbody tr:last-child td { border: none; } table tfoot td { padding: 10px 20px; background: #FFFFFF; border-bottom: none; font-size: 1.2em; white-space: nowrap; border-top: 1px solid #AAAAAA; } table tfoot tr:first-child td { border-top: none; } table tfoot tr:last-child td { color: #57B223; font-size: 1.4em; /*border-top: 1px solid #57B223;*/ } table tfoot tr td:first-child { border: none; } #thanks{ font-size: 2em; margin-bottom: 50px; } #notices{ padding-left: 6px; border-left: 6px solid #0087C3; } #notices .notice { font-size: 1.2em; } div.invoiceFooter { color: #777777; width: 100%; height: 30px; bottom: 0; border-top: 1px solid #AAAAAA; padding: 8px 0; text-align: center; } .invoiceContainer{box-shadow: 0px 0px 24px #848484; padding: 20px;} div.printBtn{margin-top:30px;} .printBtn button{ width: 20%; border-style: none; border: none; background-color: #57b223; box-shadow: none; color: #ffffff; text-shadow: none; height: 45px;} .status { margin-bottom: 7px; } .financial_ins { float: right; text-align: right; } .financial_ins h1 { color: #57b223; font-size: 1.5em; line-height: 1em; font-weight: normal; margin: 0 0 10px 0; } .financial_ins .date { font-size: 1.1em; color: #777777; } .trans_stat{ padding-left: 6px; border-left: 6px solid #57b223; float: left; } </style> <div class='invoiceContainer'> <div class='clearfix invoiceHeader'> <div id='logo'> <img src='http://nibaya.ca/hp/wp-content/themes/highpoint/images/logo.png'> </div> <div id='company'> <h2 class='name'>Highpoint Properties</h2> <div>177 Division Street, Kingston, ON, K7K 3Y9</div> <div>613-547-3030</div> <div><a href='mailto:info@highpointproperties.ca'>info@highpointproperties.ca</a></div> </div> </div> <main> $confDiv <div id='details' class='clearfix'> <div id='client'> <div class='to'>INVOICE TO:</div> <h2 class='name'>$result->fname $result->lname</h2> <div class='address'>$addressF</div> <div class='email'><a href='mailto:john@example.com'>$result->email</a></div> </div> <div id='invoice'> <h1>INVOICE $entryId</h1> <div class='date'>Date of Invoice: $date_stamp</div> </div> </div> <table border='0' cellspacing='0' cellpadding='0'> <thead> <tr> <th class='no'>#</th> <th class='desc'>DESCRIPTION</th> <th class='unit'></th> <th class='qty'></th> <th class='total'>TOTAL</th> </tr> </thead> <tbody> <tr> <td class='no'>01</td> <td class='desc'><h3>Payment</h3>$addressF</td> <td class='unit'></td> <td class='qty'></td> <td class='total'>$ $charge_total CAD</td> </tr> </tbody> <tfoot> <tr> <td colspan='2'></td> <td colspan='2'></td> <td colspan='2'>GRAND TOTAL $ $charge_total CAD</td> </tr> </tfoot> </table> </main> <div class='invoiceFooter'> Invoice was created on a computer and is valid without the signature and seal. </div></div><div class='printBtn'><button onclick='window.print()'><i class='fa fa-print'></i> Print Receipt</button><a href='http://highpointproperties.ca'><button style='float: right;'><i class='fa fa-home' aria-hidden='true'></i> Back to Home Page</button></a></div>"; $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 <info@highpointproperties.ca>"; $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 = <<<EOD <table id="corpo_do_email" width="650" border="0" cellpadding="0" cellspacing="0" style="border-radius: 5px;border: 10px #b1b1b1 solid;font-size:14px; font-weight:normal; color:#333333; font-family: Verdana, Arial, Tahoma;"><tr><td valign="top" width="580" height="30" colspan="29" bgcolor="#d4d3d3"><a href="#" style="font-size: 29px; line-height: 30px; color: #FFFFFF; text-decoration: none; margin: 0;"><img src="http://highpointproperties.ca/wp-content/themes/highpoint/images/logo.png" alt="Highpoint" width="50%" height="auto"></a></td></tr><tr><td valign="top" width="600" height="10" colspan="30" bgcolor="#f7f7f7"></td></tr><tr><td valign="top" width="100%" height="1" style="padding: 20px; line-height: 25px; text-align: left;"><h3>Payment Details</h3><b>Name:</b> {$fname} {$lname}<br><b>Email:</b> {$email}<br><b>Phone:</b> {$phone}<br><b>Cardholer:</b> {$cardholder}<br><b>Time:</b> {$date_stamp} {$time_stamp}<br><b>Amount:</b>$ {$charge_total} CAD<hr><h3>Property Details</h3><b>Address:</b> {$address}</td></td></tr><tr><td style="padding-left:20px; padding-bottom:20px">Thanks<br>Highpoint<br>613-547-3030</td></tr><tr></tr><tr><td valign="top" width="580" height="30" colspan="30" bgcolor="#0093ca" style="text-align: center;"><a href="#" style="font-size: 10px; line-height: 40px; color: #FFFFFF; text-decoration: none; margin: 0;">Copyright © 2018 highpointproperties.ca -All Rights Reserved.</a></td></tr><tr><td valign="top" width="600" height="10" colspan="30" bgcolor="#f7f7f7"></td></tr></table> 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 = <<<EOD <table id="corpo_do_email" width="650" border="0" cellpadding="0" cellspacing="0" style="border-radius: 5px;border: 10px #b1b1b1 solid;font-size:14px; font-weight:normal; color:#333333; font-family: Verdana, Arial, Tahoma;"><tr><td valign="top" width="580" height="30" colspan="29" bgcolor="#d4d3d3"><a href="#" style="font-size: 29px; line-height: 30px; color: #FFFFFF; text-decoration: none; margin: 0;"><img src="http://highpointproperties.ca/wp-content/themes/highpoint/images/logo.png" alt="Highpoint" width="50%" height="auto"></a></td></tr><tr><td valign="top" width="600" height="10" colspan="30" bgcolor="#f7f7f7"></td></tr><tr><td valign="top" width="100%" height="1" style="padding: 20px; line-height: 25px; text-align: left;"><h3>Payer Details</h3><b>Name:</b> {$fname} {$lname}<br><b>Email:</b> {$email}<br><b>Phone:</b> {$phone}<br><b>Cardholer:</b> {$cardholder}<br><b>Time:</b> {$date_stamp} {$time_stamp}<br><b>Amount:</b>$ {$charge_total} CAD<hr><h3>Property Details</h3><b>Address:</b> {$address}</td></td></tr><tr><td style="padding-left:20px; padding-bottom:20px">Thanks<br>Highpoint<br>613-547-3030</td></tr><tr></tr><tr><td valign="top" width="580" height="30" colspan="30" bgcolor="#0093ca" style="text-align: center;"><a href="#" style="font-size: 10px; line-height: 40px; color: #FFFFFF; text-decoration: none; margin: 0;">Copyright © 2018 highpointproperties.ca -All Rights Reserved.</a></td></tr><tr><td valign="top" width="600" height="10" colspan="30" bgcolor="#f7f7f7"></td></tr></table> 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 .=" <style> table{ margin: 0 0 1.5em; width: 100%; border: 2px dashed #8e8d8d; } table tr td{ padding: 10px; border: 2px dashed #8e8d8d; text-align: left; } </style>"; // $paymentAmount = explode(" ","$amount"); // $payArr = explode(",",$paymentAmount[1]); // $payArr = $amount; // echo $amount; $pay = $amount; // for($i=0;$i<sizeof($payArr);$i++){ // $pay.=$payArr[$i]; // } if($p_type == 'Credit Card'){ $price = $pay+(($pay*3)/100); $pay_final_text = "$ ".$price." CAD ( 3% admin fee added )"; }else{ $price = $pay; $pay_final_text = "$ ".$price." CAD"; } $monerisConOutput .= "<table><tr><td>"; $monerisConOutput .= "First Name : $fname"; $monerisConOutput .= "</td><td>"; $monerisConOutput .= "Last Name : $lname"; $monerisConOutput .= "</td></tr><tr><td colspan='2'>"; $monerisConOutput .= "Address : $unit, $address1, $city, $province, $zip"; $monerisConOutput .= "</td></tr>"; $monerisConOutput .= "<tr><td>"; $monerisConOutput .= "Email : $email"; $monerisConOutput .= "</td><td>"; $monerisConOutput .= "Payment Type : $payment_type"; $monerisConOutput .= "</td></tr><tr><td>"; $monerisConOutput .= "Apply to Month : $a_month"; $monerisConOutput .= "</td><td>"; $monerisConOutput .= "Payment Method : $p_type"; $monerisConOutput .= "</td></tr><tr>"; $monerisConOutput .= "<td colspan='2'>"; $monerisConOutput .= "Amount : $pay_final_text"; $monerisConOutput .= "</td></tr></table>"; //$monerisConOutput .="<FORM METHOD='POST' ACTION= https://esqa.moneris.com/HPPDP/index.php ><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='THXXCtore3'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hpSH4EB9O43J'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='SUBMIT' NAME='SUBMIT' VALUE='Click to proceed to Secure Page'></FORM>"; if ($p_type === 'Credit Card') { // $monerisConOutput .="<FORM METHOD='POST' ACTION= https://www3.moneris.com/HPPDP/index.php ><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='UP8MC06492'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hpMI6MT3P8GH'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='SUBMIT' NAME='SUBMIT' VALUE='Click to proceed to Secure Page'></FORM>"; // $monerisConOutput .="<FORM METHOD='POST' ACTION= https://www3.moneris.com/HPPDP/index.php ><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='UP8MC06492'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hpMCPHSNVMP3'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='SUBMIT' NAME='SUBMIT' ID='SUBMITBTN' ONCLICK='return checkVal();' VALUE='Click to proceed to Secure Page'></FORM>"; // $monerisConOutput .="<FORM METHOD='POST' ACTION= https://www3.moneris.com/HPPDP/index.php ><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='UP8MC06492'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hp9HKSA7LKCM'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='SUBMIT' NAME='SUBMIT' ID='SUBMITBTN' ONCLICK='return checkVal();' VALUE='Click to proceed to Secure Page'></FORM>"; // $monerisConOutput .="<FORM METHOD='POST' ACTION= https://www3.moneris.com/HPPDP/index.php ><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='UP8MC06492'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hpPNLOUGRY1F'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='SUBMIT' NAME='SUBMIT' ID='SUBMITBTN' ONCLICK='return checkVal();' VALUE='Click to proceed to Secure Page'></FORM>"; // $monerisConOutput .="<FORM METHOD='POST' ACTION= https://esqa.moneris.com/HPPDP/index.php ><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='M76MMtore3'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hpY86KYNSJHI'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='hidden' NAME='hpp_preload' ><INPUT TYPE='SUBMIT' NAME='SUBMIT' VALUE='Click to proceed to Secure Page'></FORM>"; // $monerisConOutput .="<FORM METHOD='POST' ACTION= https://www3.moneris.com/HPPDP/index.php ><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='UP8MC06492'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hpN255QQ2EUZ'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='SUBMIT' NAME='SUBMIT' ID='SUBMITBTN' ONCLICK='return checkVal();' VALUE='Click to proceed to Secure Page'></FORM>"; $monerisConOutput .= preloadPayment('UP8MC06492', 'hpN255QQ2EUZ', $price); // $monerisConOutput .= preloadPayment('M76MMtore3', 'hpY86KYNSJHI', $price); } else { // $monerisConOutput .="<FORM METHOD='POST' ACTION= https://esqa.moneris.com/HPPDP/index.php><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='MARP4tore3'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hpZYYH2J9K2I'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='hidden' NAME='hpp_preload' ><INPUT TYPE='SUBMIT' NAME='SUBMIT' VALUE='Click to proceed to Secure Page'></FORM>"; //$monerisConOutput .="<FORM METHOD='POST' ACTION= https://www3.moneris.com/HPPDP/index.php ><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='BH4U306492'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hpVFQG6MBLEI'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='SUBMIT' NAME='SUBMIT' VALUE='Click to proceed to Secure Page'></FORM>"; // $monerisConOutput .="<FORM METHOD='POST' ACTION= https://www3.moneris.com/HPPDP/index.php ><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='BH4U306492'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hpRRLI4DHFT9'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='SUBMIT' NAME='SUBMIT' ID='SUBMITBTN' ONCLICK='return checkVal();' VALUE='Click to proceed to Secure Page'></FORM>"; // $monerisConOutput .="<FORM METHOD='POST' ACTION= https://www3.moneris.com/HPPDP/index.php ><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='BH4U306492'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hpXII8BLDD8U'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='SUBMIT' NAME='SUBMIT' ID='SUBMITBTN' ONCLICK='return checkVal();' VALUE='Click to proceed to Secure Page'></FORM>"; // $monerisConOutput .="<FORM METHOD='POST' ACTION= https://www3.moneris.com/HPPDP/index.php ><INPUT TYPE='HIDDEN' NAME='ps_store_id' VALUE='BH4U306492'><INPUT TYPE='HIDDEN' NAME='hpp_key' VALUE='hpRRLI4DHFT9'><INPUT TYPE='HIDDEN' NAME='charge_total' VALUE='".$price."'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --><INPUT TYPE='SUBMIT' NAME='SUBMIT' ID='SUBMITBTN' ONCLICK='return checkVal();' VALUE='Click to proceed to Secure Page'></FORM>"; $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.= "<script src='https://www.google.com/recaptcha/api.js'></script>"; $monerisConOutput.= "<script> var captcha = ''; function recaptchaCallback() { captcha = true; document.getElementById('recapForm').submit(); }; </script>"; $monerisConOutput .= "<FORM METHOD='POST' ID='recapForm' ACTION= $url >"; $monerisConOutput.= "<div class='g-recaptcha' data-callback='recaptchaCallback' style='margin-bottom:10px;' data-sitekey='6LfZVrcUAAAAADmV3GTNU_vOZNZSg7KaKoe6d318'></div>"; $monerisConOutput .= "<div id='errorMsg' style='color:red; display:none; margin-top:0px; margin-bottom:10px; text-align:left;'>The reCAPTCHA was invalid. Go back and try it again.</div>"; $monerisConOutput .= "</FORM>"; } 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 . "<br/>"; 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 : <BR/>"; // echo "Ticket : " . $ticket . "<br/>"; // echo "Order ID : " . $order_id . "<br/>"; // echo "Response Code : " . $response_code . "<br/>"; if ($response_code < 50) { // echo "OK: Data successfully loaded <BR/> <br/>"; // echo '<FORM METHOD="POST" ACTION="esqa.moneris.com/.../index.php">'; // echo '<INPUT TYPE="HIDDEN" NAME="hpp_id" VALUE="' . $store_id . '">'; // echo '<INPUT TYPE="hidden" NAME="hpp_preload" >'; // echo '<INPUT TYPE="hidden" NAME="ticket" VALUE="' . $ticket . '">'; // echo '<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Click to proceed to Secure Page">'; // echo '</FORM>'; return "<FORM METHOD='POST' ACTION= https://www3.moneris.com/HPPDP/index.php > <INPUT TYPE='HIDDEN' NAME='hpp_id' VALUE='" . $hpp_id . "'><INPUT TYPE='hidden' NAME='hpp_preload'> <INPUT TYPE='hidden' NAME='ticket' VALUE='" . $ticket . "'><!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE --> <INPUT TYPE='SUBMIT' NAME='SUBMIT' ID='SUBMITBTN' VALUE='Click to proceed to Secure Page'></FORM>"; } else { return "Error: Data was not successfully loaded <br>"; } } } /** * 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';