function cp_transactions() { global $wpdb, $wp_version; include_once TEMPLATEPATH . '/includes/forms/step-functions.php'; if (isset($_GET['p'])) { $page = (int) $_GET['p']; } else { $page = 1; } $per_page = 10; $start = $per_page * $page - $per_page; // check to prevent php "notice: undefined index" msg when php strict warnings is on if (isset($_GET['action'])) { $theswitch = $_GET['action']; } else { $theswitch = ''; } switch ($theswitch) { // mark transaction as paid case 'setPaid': $wpdb->update($wpdb->cp_order_info, array('payment_status' => 'Completed'), array('id' => $_GET['id'])); ?> <p style="text-align:center;padding-top:50px;font-size:22px;"><?php _e('Updating transaction entry.....', APP_TD); ?> <br /><br /><img src="<?php bloginfo('template_directory'); ?> /images/loader.gif" alt="" /></p> <meta http-equiv="refresh" content="0; URL=?page=transactions"> <?php break; // mark transaction as unpaid // mark transaction as unpaid case 'unsetPaid': $wpdb->update($wpdb->cp_order_info, array('payment_status' => 'Pending'), array('id' => $_GET['id'])); ?> <p style="text-align:center;padding-top:50px;font-size:22px;"><?php _e('Updating transaction entry.....', APP_TD); ?> <br /><br /><img src="<?php bloginfo('template_directory'); ?> /images/loader.gif" alt="" /></p> <meta http-equiv="refresh" content="0; URL=?page=transactions"> <?php break; // delete transaction entry // delete transaction entry case 'delete': if (version_compare($wp_version, '3.4', '>=')) { $wpdb->delete($wpdb->cp_order_info, array('id' => $_GET['id'])); } else { $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->cp_order_info} WHERE id = %d", $_GET['id'])); } ?> <p style="text-align:center;padding-top:50px;font-size:22px;"><?php _e('Deleting transaction entry.....', APP_TD); ?> <br /><br /><img src="<?php bloginfo('template_directory'); ?> /images/loader.gif" alt="" /></p> <meta http-equiv="refresh" content="0; URL=?page=transactions"> <?php break; // activate membership, update transaction entry // activate membership, update transaction entry case 'activateMembership': $orders = get_user_orders('', $_GET['oid']); if (!empty($orders)) { $order_id = get_order_id($orders); $storedOrder = get_option($orders); $user_id = get_order_userid($orders); $the_user = get_userdata($user_id); //activate membership $order_processed = appthemes_process_membership_order($the_user, $storedOrder); //send email to user if ($order_processed) { cp_owner_activated_membership_email($the_user, $order_processed); } //update transaction entry $wpdb->update($wpdb->cp_order_info, array('payment_status' => 'Completed'), array('custom' => $_GET['oid'])); } ?> <p style="text-align:center;padding-top:50px;font-size:22px;"><?php _e('Activating membership plan.....', APP_TD); ?> <br /><br /><img src="<?php bloginfo('template_directory'); ?> /images/loader.gif" alt="" /></p> <meta http-equiv="refresh" content="0; URL=?page=transactions"> <?php break; // show the table of all transactions // show the table of all transactions default: ?> <div class="wrap"> <div class="icon32" id="icon-themes"><br /></div> <h2><?php _e('Order Transactions', APP_TD); ?> </h2> <?php cp_admin_info_box(); ?> <table id="tblspacer" class="widefat fixed"> <thead> <tr> <th scope="col" style="width:35px;"> </th> <th scope="col"><?php _e('Payer Name', APP_TD); ?> </th> <th scope="col" style="text-align: center;"><?php _e('Payer Status', APP_TD); ?> </th> <th scope="col"><?php _e('Ad Title', APP_TD); ?> </th> <th scope="col"><?php _e('Item Description', APP_TD); ?> </th> <th scope="col" style="width:125px;"><?php _e('Transaction ID', APP_TD); ?> </th> <th scope="col"><?php _e('Payment Type', APP_TD); ?> </th> <th scope="col"><?php _e('Payment Status', APP_TD); ?> </th> <th scope="col"><?php _e('Total Amount', APP_TD); ?> </th> <th scope="col" style="width:150px;"><?php _e('Date Paid', APP_TD); ?> </th> <th scope="col" style="text-align:center;width:100px;"><?php _e('Actions', APP_TD); ?> </th> </tr> </thead> <?php // must be higher than personal edition so let's query the db $sql = "SELECT SQL_CALC_FOUND_ROWS o.*, p.post_title " . "FROM {$wpdb->cp_order_info} o, {$wpdb->posts} p " . "WHERE o.ad_id = p.id " . "ORDER BY o.id DESC LIMIT {$start},{$per_page}"; $results = $wpdb->get_results($sql); $total_pages = $wpdb->get_var("SELECT FOUND_ROWS()"); $total_pages = ceil($total_pages / $per_page); if ($results) { $rowclass = ''; $i = 1; ?> <tbody id="list"> <?php foreach ($results as $result) { $rowclass = 'even' == $rowclass ? 'alt' : 'even'; if ($result->user_id > 0) { $user = get_user_by('id', $result->user_id); $user_link = $user ? '( <a href="user-edit.php?user_id=' . $user->ID . '" title="' . __('Edit user', APP_TD) . '">' . $user->user_login . '</a> )<br />' : ''; } else { $user_link = ''; } ?> <tr class="<?php echo $rowclass; ?> "> <td style="padding-left:10px;"><?php echo $i; ?> .</td> <td><strong><?php echo $result->first_name; ?> <?php echo $result->last_name; ?> </strong><br /><?php echo $user_link; ?> <a href="mailto:<?php echo $result->payer_email; ?> "><?php echo $result->payer_email; ?> </a></td> <td style="text-align: center;"> <?php if ($result->payer_status == 'verified') { ?> <img src="<?php bloginfo('template_directory'); ?> /images/paypal_verified.gif" alt="" title="" /><br /><?php } ?> <?php echo cp_get_status_i18n($result->payer_status); ?> </td> <td><a href="post.php?action=edit&post=<?php echo $result->ad_id; ?> "><?php echo $result->post_title; ?> </a></td> <td><?php echo $result->item_name; ?> </td> <td><?php echo $result->txn_id; ?> </td> <td><?php echo ucfirst($result->payment_type); ?> </td> <td><?php echo cp_get_status_i18n($result->payment_status); ?> </td> <td><?php cp_display_price($result->mc_gross, $result->mc_currency); ?> </td> <td><?php echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $result->payment_date); ?> </td> <td style="text-align:center"> <?php echo '<a onclick="return confirmBeforeDelete();" href="?page=transactions&action=delete&id=' . $result->id . '" title="' . __('Delete', APP_TD) . '"><img src="' . get_bloginfo('template_directory') . '/images/cross.png" alt="' . __('Delete', APP_TD) . '" /></a> '; if (strtolower($result->payment_status) == 'completed') { echo '<br /><a href="?page=transactions&action=unsetPaid&id=' . $result->id . '" title="' . __('Mark as Unpaid', APP_TD) . '">' . __('Unmark Paid', APP_TD) . '</a>'; } else { echo '<br /><a href="?page=transactions&action=setPaid&id=' . $result->id . '" title="' . __('Mark as Paid', APP_TD) . '">' . __('Mark Paid', APP_TD) . '</a>'; } ?> </td> </tr> <?php $i++; } // end for each ?> </tbody> <?php } else { ?> <tr> <td> </td><td colspan="10"><?php _e('No transactions found.', APP_TD); ?> </td> </tr> <?php } // end $results ?> </table> <!-- this is ok --> <div class="tablenav"> <div class="tablenav-pages alignright"> <?php if ($total_pages > 1) { echo paginate_links(array('base' => 'admin.php?page=transactions%_%', 'format' => '&p=%#%', 'prev_text' => __('« Previous', APP_TD), 'next_text' => __('Next »', APP_TD), 'total' => $total_pages, 'current' => $page, 'end_size' => 1, 'mid_size' => 5)); } ?> </div> </div> <div class="clear"></div> <div class="icon32" id="icon-themes"><br /></div> <h2><?php _e('Membership Orders', APP_TD); ?> </h2> <table id="tblspacer" class="widefat fixed"> <thead> <tr> <th scope="col" style="width:35px;"> </th> <th scope="col"><?php _e('Payer Name', APP_TD); ?> </th> <th scope="col" style="text-align: center;"><?php _e('Payer Status', APP_TD); ?> </th> <th scope="col"><?php _e('Item Description', APP_TD); ?> </th> <th scope="col" style="width:125px;"><?php _e('Transaction ID', APP_TD); ?> </th> <th scope="col"><?php _e('Payment Type', APP_TD); ?> </th> <th scope="col"><?php _e('Payment Status', APP_TD); ?> </th> <th scope="col"><?php _e('Total Amount', APP_TD); ?> </th> <th scope="col" style="width:150px;"><?php _e('Date Paid', APP_TD); ?> </th> <th scope="col" style="text-align:center;width:100px;"><?php _e('Actions', APP_TD); ?> </th> </tr> </thead> <?php // seperate table for membership orders $sql = "SELECT SQL_CALC_FOUND_ROWS * " . "FROM {$wpdb->cp_order_info} " . "WHERE ad_id = 0 " . "ORDER BY id DESC LIMIT {$start},{$per_page}"; $results = $wpdb->get_results($sql); $total_pages = $wpdb->get_var("SELECT FOUND_ROWS()"); $total_pages = ceil($total_pages / $per_page); if ($results) { $rowclass = ''; $i = 1; ?> <tbody id="list"> <?php foreach ($results as $result) { $rowclass = 'even' == $rowclass ? 'alt' : 'even'; if ($result->user_id > 0) { $user = get_user_by('id', $result->user_id); $user_link = $user ? '( <a href="user-edit.php?user_id=' . $user->ID . '" title="' . __('Edit user', APP_TD) . '">' . $user->user_login . '</a> )<br />' : ''; } else { $user_link = ''; } ?> <tr class="<?php echo $rowclass; ?> "> <td style="padding-left:10px;"><?php echo $i; ?> .</td> <?php $payer = get_user_by('email', $result->payer_email); ?> <?php //TODO - LOOKUP CUSTOMER BY PAYPAL EMAIL CUSTOM PROFILE FIELD ?> <td><strong><?php echo $result->first_name; ?> <?php echo $result->last_name; ?> </strong><br /><?php echo $user_link; ?> <a href="<?php if (isset($payer->ID) && $payer) { echo get_bloginfo('url') . '/wp-admin/user-edit.php?user_id=' . $payer->ID; } else { echo 'mailto:' . $result->payer_email; } ?> "><?php echo $result->payer_email; ?> </a></td> <td style="text-align: center;"> <?php if ($result->payer_status == 'verified') { ?> <img src="<?php bloginfo('template_directory'); ?> /images/paypal_verified.gif" alt="" title="" /><br /><?php } ?> <?php echo cp_get_status_i18n($result->payer_status); ?> </td> <td><?php echo $result->item_name; ?> </td> <td><?php echo $result->txn_id; ?> </td> <td><?php echo ucfirst($result->payment_type); ?> </td> <td><?php echo cp_get_status_i18n($result->payment_status); ?> </td> <td><?php cp_display_price($result->mc_gross, $result->mc_currency); ?> </td> <td><?php echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $result->payment_date); ?> </td> <td style="text-align:center"> <?php echo '<a onclick="return confirmBeforeDelete();" href="?page=transactions&action=delete&id=' . $result->id . '" title="' . __('Delete', APP_TD) . '"><img src="' . get_bloginfo('template_directory') . '/images/cross.png" alt="' . __('Delete', APP_TD) . '" /></a> '; if (strtolower($result->payment_status) == 'completed') { echo '<br /><a href="?page=transactions&action=unsetPaid&id=' . $result->id . '" title="' . __('Mark as Unpaid', APP_TD) . '">' . __('Unmark Paid', APP_TD) . '</a>'; } else { echo '<br /><a href="?page=transactions&action=setPaid&id=' . $result->id . '" title="' . __('Mark as Paid', APP_TD) . '">' . __('Mark Paid', APP_TD) . '</a>'; if (!empty($result->custom)) { $orders = get_user_orders('', $result->custom); } else { $orders = ''; } if (!empty($orders)) { echo '<br /><a href="?page=transactions&action=activateMembership&oid=' . $result->custom . '" title="' . __('Activate membership', APP_TD) . '">' . __('Activate membership', APP_TD) . '</a>'; } } ?> </td> </tr> <?php $i++; } // end for each ?> </tbody> <?php } else { ?> <tr> <td> </td><td colspan="9"><?php _e('No transactions found.', APP_TD); ?> </td> </tr> <?php } // end $results ?> </table> <!-- this is ok --> <div class="tablenav"> <div class="tablenav-pages alignright"> <?php if ($total_pages > 1) { echo paginate_links(array('base' => 'admin.php?page=transactions%_%', 'format' => '&p=%#%', 'prev_text' => __('« Previous', APP_TD), 'next_text' => __('Next »', APP_TD), 'total' => $total_pages, 'current' => $page, 'end_size' => 1, 'mid_size' => 5)); } ?> </div> </div> <div class="clear"></div> </div><!-- end wrap --> <?php } // endswitch ?> <script type="text/javascript"> /* <![CDATA[ */ function confirmBeforeDelete() { return confirm("<?php _e('WARNING: Are you sure you want to delete this transaction entry?? (This cannot be undone)', APP_TD); ?> "); } /* ]]> */ </script> <?php }
function start_el(&$output, $category, $depth, $args) { global $app_abbr; $pad = str_repeat(' ', $depth * 3); $cat_name = apply_filters('list_cats', $category->name, $category); $output .= "\t<option class=\"level-{$depth}\" value=\"" . $category->term_id . "\">"; $output .= $pad . $cat_name; $output .= ' - ' . cp_display_price(get_option('cp_cat_price_' . $category->cat_ID), '', false) . '</option>' . "\n"; }
function cp_show_review($postvals) { global $wpdb; // if there's no form id it must mean the default form is being used so let's go grab those fields if (!$postvals['fid']) { // use this if there's no custom form being used and give us the default form $sql = "SELECT field_label, field_name, field_type, field_values, field_req FROM {$wpdb->cp_ad_fields} WHERE field_core = '1' ORDER BY field_id asc"; } else { // now we should have the formid so show the form layout based on the category selected $sql = $wpdb->prepare("SELECT f.field_label,f.field_name,f.field_type,f.field_values,f.field_perm,m.meta_id,m.field_pos,m.field_req,m.form_id " . "FROM {$wpdb->cp_ad_fields} f " . "INNER JOIN {$wpdb->cp_ad_meta} m " . "ON f.field_id = m.field_id " . "WHERE m.form_id = %s " . "ORDER BY m.field_pos asc", $postvals['fid']); } $results = $wpdb->get_results($sql); if ($results) { // loop through the custom form fields and display them echo cp_formbuilder_review($results); } else { echo sprintf(__('ERROR: The form template for form ID %s does not exist or the session variable is empty.', APP_TD), $postvals['fid'] . "\n\n"); } ?> <hr class="bevel" /> <div class="clr"></div> <?php if (isset($_POST['cp_payment_method']) && $postvals['cp_sys_total_ad_cost'] != 0) { // if a payment method has been posted AND the total is not equal to zero ?> <li> <div class="labelwrapper"> <label><?php _e('Payment Method:', APP_TD); ?> </label> </div> <div id="review"><?php echo ucfirst($_POST['cp_payment_method']); ?> </div> <div class="clr"></div> </li> <?php } ?> <li> <div class="labelwrapper"> <label><?php _e('Ad Listing Fee:', APP_TD); ?> </label> </div> <div id="review"><?php if (get_option('cp_charge_ads') == 'yes') { cp_display_price($postvals['cp_sys_ad_listing_fee']); } else { _e('FREE', APP_TD); } ?> </div> <div class="clr"></div> </li> <?php if (isset($_POST['featured_ad'])) { ?> <li> <div class="labelwrapper"> <label><?php _e('Featured Listing Fee:', APP_TD); ?> </label> </div> <div id="review"><?php cp_display_price($postvals['cp_sys_feat_price']); ?> </div> <div class="clr"></div> </li> <?php } ?> <?php if (isset($postvals['cp_coupon_type'])) { ?> <li> <div class="labelwrapper"> <label><?php _e('Coupon:', APP_TD); ?> </label> </div> <?php if ($postvals['cp_coupon_type'] != '%') { ?> <div id="review"><?php cp_display_price($postvals['cp_coupon']); ?> </div> <?php } else { ?> <div id="review"><?php echo str_replace('.00', '', $postvals['cp_coupon']) . $postvals['cp_coupon_type']; ?> </div> <?php } ?> <div class="clr"></div> </li> <?php } ?> <?php if (isset($postvals['cp_membership_pack'])) { ?> <li> <div class="labelwrapper"> <label><?php _e('Membership:', APP_TD); ?> </label> </div> <div id="review"><?php echo get_pack_benefit($postvals['cp_membership_pack']); ?> </div> <div class="clr"></div> </li> <?php } ?> <hr class="bevel-double" /> <div class="clr"></div> <li> <div class="labelwrapper"> <label><?php _e('Total Amount Due:', APP_TD); ?> </label> </div> <div id="review"><strong> <?php // if it costs to post an ad OR its free and someone selected a featured ad price if (get_option('cp_charge_ads') == 'yes' || isset($postvals['featured_ad'])) { cp_display_price($postvals['cp_sys_total_ad_cost']); } else { _e('--', APP_TD); } ?> </strong></div> <div class="clr"></div> </li> <?php }
function cp_handle_ipn_response() { global $wpdb; //step functions required to process orders include_once "wp-load.php"; include_once TEMPLATEPATH . '/includes/forms/step-functions.php'; // make sure the ad unique trans id (stored in invoice var) is included if (!empty($_POST['txn_id']) && !empty($_REQUEST['invoice'])) { $request_data = stripslashes_deep($_REQUEST); // process the ad based on the paypal response switch (strtolower($_POST['payment_status'])) { // payment was made so we can approve the ad case 'completed': $pid = trim($_REQUEST['invoice']); //attempt to process membership order first $orders = get_user_orders('', $pid); if (!empty($orders)) { $order_id = get_order_id($orders); $storedOrder = get_option($orders); $user_id = get_order_userid($orders); $the_user = get_userdata($user_id); if (get_option('cp_paypal_ipn_debug') == 'true' && !empty($orders)) { wp_mail(get_option('admin_email'), __('PayPal IPN Attempting to Activate Membership', APP_TD), print_r($orders, true) . PHP_EOL . print_r($order, true) . PHP_EOL . print_r($request_data, true)); } $order_processed = appthemes_process_membership_order($the_user, $storedOrder); } if ($order_processed) { //send email to user cp_owner_activated_membership_email($the_user, $order_processed); //admin email confirmation //TODO - move into wordpress options panel and allow customization wp_mail(get_option('admin_email'), __('PayPal IPN Activated Membership', APP_TD), __('A membership order has been completed. Check to make sure this is a valid order by comparing this messages Paypal Transaction ID to the respective ID in the Paypal payment receipt email.', APP_TD) . PHP_EOL . __('Order ID: ', APP_TD) . print_r($orders, true) . PHP_EOL . __('User ID: ', APP_TD) . print_r($user_id, true) . PHP_EOL . __('User Login: '******'Pack Name: ', APP_TD) . print_r(stripslashes($storedOrder['pack_name']), true) . PHP_EOL . __('Total Cost: ', APP_TD) . print_r($storedOrder['total_cost'], true) . PHP_EOL . __('Paypal Transaction ID: ', APP_TD) . print_r($_POST['txn_id'], true) . PHP_EOL); break; } $sql = $wpdb->prepare("SELECT p.ID, p.post_status\n\t\t\t\t\tFROM {$wpdb->posts} p, {$wpdb->postmeta} m\n\t\t\t\t\tWHERE p.ID = m.post_id\n\t\t\t\t\tAND p.post_status <> 'publish'\n\t\t\t\t\tAND m.meta_key = 'cp_sys_ad_conf_id'\n\t\t\t\t\tAND m.meta_value = %s\n\t\t\t\t\t", $pid); $newadid = $wpdb->get_row($sql); // if the ad is found, then publish it if ($newadid) { $the_ad = array(); $the_ad['ID'] = $newadid->ID; $the_ad['post_status'] = 'publish'; $ad_id = wp_update_post($the_ad); // now we need to update the ad expiration date so they get the full length of time // sometimes they didn't pay for the ad right away or they are renewing // first get the ad duration and first see if ad packs are being used // if so, get the length of time in days otherwise use the default // prune period defined on the CP settings page $ad_length = get_post_meta($ad_id, 'cp_sys_ad_duration', true); if (isset($ad_length)) { $ad_length = $ad_length; } else { $ad_length = get_option('cp_prun_period'); } // set the ad listing expiration date $ad_expire_date = date_i18n('m/d/Y H:i:s', strtotime('+' . $ad_length . ' days')); // don't localize the word 'days' //now update the expiration date on the ad update_post_meta($ad_id, 'cp_sys_expire_date', $ad_expire_date); } break; case 'pending': // send an email if payment is pending $mailto = get_option('admin_email'); $subject = __('PayPal IPN - payment pending', APP_TD); $headers = 'From: ' . __('ClassiPress Admin', APP_TD) . ' <' . get_option('admin_email') . '>' . "\r\n"; $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = __('Dear Admin,', APP_TD) . "\r\n\r\n"; $message .= sprintf(__('The following payment is pending on your %s website.', APP_TD), $blogname) . "\r\n\r\n"; $message .= __('Payment Details', APP_TD) . "\r\n"; $message .= __('-----------------', APP_TD) . "\r\n"; $message .= __('Payer PayPal address: ', APP_TD) . $_POST['payer_email'] . "\r\n"; $message .= __('Transaction ID: ', APP_TD) . $_POST['txn_id'] . "\r\n"; $message .= __('Payer first name: ', APP_TD) . $_POST['first_name'] . "\r\n"; $message .= __('Payer last name: ', APP_TD) . $_POST['last_name'] . "\r\n"; $message .= __('Payment type: ', APP_TD) . $_POST['payment_type'] . "\r\n"; $message .= __('Amount: ', APP_TD) . html_entity_decode(cp_display_price($_POST['mc_gross'], $_POST['mc_currency'], false), ENT_QUOTES, 'UTF-8') . "\r\n\r\n"; $message .= __('Full Details', APP_TD) . "\r\n"; $message .= __('-----------------', APP_TD) . "\r\n"; $message .= print_r($request_data, true) . "\r\n"; wp_mail($mailto, $subject, $message, $headers); break; // payment failed so don't approve the ad // payment failed so don't approve the ad case 'denied': case 'expired': case 'failed': case 'voided': // send an email if payment didn't work $mailto = get_option('admin_email'); $subject = __('PayPal IPN - payment failed', APP_TD); $headers = 'From: ' . __('ClassiPress Admin', APP_TD) . ' <' . get_option('admin_email') . '>' . "\r\n"; $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = __('Dear Admin,', APP_TD) . "\r\n\r\n"; $message .= sprintf(__('The following payment has failed on your %s website.', APP_TD), $blogname) . "\r\n\r\n"; $message .= __('Payment Details', APP_TD) . "\r\n"; $message .= __('-----------------', APP_TD) . "\r\n"; $message .= __('Payer PayPal address: ', APP_TD) . $_POST['payer_email'] . "\r\n"; $message .= __('Transaction ID: ', APP_TD) . $_POST['txn_id'] . "\r\n"; $message .= __('Payer first name: ', APP_TD) . $_POST['first_name'] . "\r\n"; $message .= __('Payer last name: ', APP_TD) . $_POST['last_name'] . "\r\n"; $message .= __('Payment type: ', APP_TD) . $_POST['payment_type'] . "\r\n"; $message .= __('Amount: ', APP_TD) . html_entity_decode(cp_display_price($_POST['mc_gross'], $_POST['mc_currency'], false), ENT_QUOTES, 'UTF-8') . "\r\n\r\n"; $message .= __('Full Details', APP_TD) . "\r\n"; $message .= __('-----------------', APP_TD) . "\r\n"; $message .= print_r($request_data, true) . "\r\n"; wp_mail($mailto, $subject, $message, $headers); break; case 'refunded': case 'reversed': case 'chargeback': // send an email if payment was refunded $mailto = get_option('admin_email'); $subject = __('PayPal IPN - payment refunded/reversed', APP_TD); $headers = 'From: ' . __('ClassiPress Admin', APP_TD) . ' <' . get_option('admin_email') . '>' . "\r\n"; $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = __('Dear Admin,', APP_TD) . "\r\n\r\n"; $message .= sprintf(__('The following payment has been marked as refunded on your %s website.', APP_TD), $blogname) . "\r\n\r\n"; $message .= __('Payment Details', APP_TD) . "\r\n"; $message .= __('-----------------', APP_TD) . "\r\n"; $message .= __('Payer PayPal address: ', APP_TD) . $_POST['payer_email'] . "\r\n"; $message .= __('Transaction ID: ', APP_TD) . $_POST['txn_id'] . "\r\n"; $message .= __('Payer first name: ', APP_TD) . $_POST['first_name'] . "\r\n"; $message .= __('Payer last name: ', APP_TD) . $_POST['last_name'] . "\r\n"; $message .= __('Payment type: ', APP_TD) . $_POST['payment_type'] . "\r\n"; $message .= __('Reason code: ', APP_TD) . $_POST['reason_code'] . "\r\n"; $message .= __('Amount: ', APP_TD) . html_entity_decode(cp_display_price($_POST['mc_gross'], $_POST['mc_currency'], false), ENT_QUOTES, 'UTF-8') . "\r\n\r\n"; $message .= __('Full Details', APP_TD) . "\r\n"; $message .= __('-----------------', APP_TD) . "\r\n"; $message .= print_r($request_data, true) . "\r\n"; wp_mail($mailto, $subject, $message, $headers); break; } // regardless of what happens, log the transaction if (file_exists(TEMPLATEPATH . '/includes/gateways/process.php')) { include_once TEMPLATEPATH . '/includes/gateways/process.php'; } } }
echo $rowclass . ' ' . $requiredClass; ?> "> <td><strong><?php echo stripslashes($result->pack_name); ?> </strong><a class="tip" tip="<?php echo $result->pack_desc; ?> " tabindex="99"><div class="helpico"></div></a></td> <td><?php echo $benefit; ?> </td> <td><?php printf(__('%s / %s days', APP_TD), cp_display_price($result->pack_membership_price, '', false), $result->pack_duration); ?> </td> <td><input type="submit" name="step1" id="step1" class="btn_orange" onclick="document.getElementById('pack').value=<?php echo $result->pack_id; ?> ;" value="<?php _e('Buy Now ››', APP_TD); ?> " style="margin-left: 5px; margin-bottom: 5px;" /></td> </tr> <?php } // end for each ?>
<div id="ad-categories-footer" class="button-container"> <input type="submit" name="getcat" id="getcat" class="btn_orange" value="<?php _e('Go ››', APP_TD); ?> " /> <div id="chosenCategory"><input id="cat" name="cat" type="input" value="-1" /></div> <div style="clear:both;"></div> </div> <div style="clear:both;"></div> </li> <?php } else { if (get_option('cp_price_scheme') == 'category' && get_option('cp_charge_ads') == 'yes') { $cat_fee = get_option('cp_cat_price_' . $category->term_id); $cat_fee = ' - ' . cp_display_price($cat_fee, '', false); } else { $cat_fee = ''; } ?> <li> <div class="labelwrapper"><label><?php _e('Category:', APP_TD); ?> </label></div> <strong><?php echo $category->name; ?> </strong><?php echo $cat_fee;
</li> <?php } ?> <hr class="bevel-double" /> <div class="clr"></div> <li> <div class="labelwrapper"><label><?php _e('Total Amount Due:', APP_TD); ?> </label></div> <div id="review"><strong><?php if ($total_cost > 0) { cp_display_price($total_cost); } else { _e('--', APP_TD); } ?> </strong></div> <div class="clr"></div> </li> <li> <?php if ($total_cost > 0) { ?> <div class="labelwrapper"><label><?php _e('Payment Method:', APP_TD); ?>
function cp_bank_owner_new_membership_email($oid) { $orders = get_user_orders('', $oid); if (!empty($orders)) { $order_id = get_order_id($orders); $storedOrder = get_option($orders); $user_id = get_order_userid($orders); $the_user = get_userdata($user_id); $membership_order_id = stripslashes($order_id); $membership_pack_id = stripslashes($storedOrder['pack_id']); $membership_pack_name = stripslashes($storedOrder['pack_name']); $membership_user_email = stripslashes($the_user->user_email); $membership_user_login = stripslashes(cp_get_user_name($user_id)); $membership_total_cost = stripslashes($storedOrder['total_cost']); $siteurl = trailingslashit(get_option('home')); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $mailto = $membership_user_email; $subject = sprintf(__('Your Membership Purchase on %s', APP_TD), $blogname); $headers = 'From: ' . sprintf(__('%s Admin', APP_TD), $blogname) . ' <' . get_option('admin_email') . '>' . "\r\n"; $message = sprintf(__('Hi %s,', APP_TD), $membership_user_login) . "\r\n\r\n"; $message .= __('Thank you for your membership order! Your membership has been submitted and will not be valid on our site until you pay for it.', APP_TD) . "\r\n\r\n"; $message .= __('Please include the following details when sending the bank transfer. Once your transfer has been verified, we will then activate your membership.', APP_TD) . "\r\n\r\n"; $message .= __('Details for Payment', APP_TD) . "\r\n"; $message .= __('-----------------', APP_TD) . "\r\n"; $message .= __('Pack Name: ', APP_TD) . $membership_pack_name . "\r\n"; $message .= __('Transaction ID: ', APP_TD) . $oid . "\r\n"; $message .= __('Total Amount: ', APP_TD) . html_entity_decode(cp_display_price($membership_total_cost, get_option('cp_curr_pay_type'), false), ENT_QUOTES, 'UTF-8') . "\r\n"; $message .= __('-----------------', APP_TD) . "\r\n\r\n"; $message .= __('Bank Transfer Instructions', APP_TD) . "\r\n"; $message .= __('-----------------', APP_TD) . "\r\n"; $message .= strip_tags(appthemes_br2nl(stripslashes(get_option('cp_bank_instructions')))) . "\r\n"; $message .= __('-----------------', APP_TD) . "\r\n\r\n"; $message .= __('For questions or problems, please contact us directly at', APP_TD) . " " . get_option('admin_email') . "\r\n\r\n\r\n\r\n"; $message .= __('Regards,', APP_TD) . "\r\n\r\n"; $message .= sprintf(__('Your %s Team', APP_TD), $blogname) . "\r\n"; $message .= $siteurl . "\r\n\r\n\r\n\r\n"; // ok let's send the email wp_mail($mailto, $subject, $message, $headers); } }
/** * payment processing script that is used on the new ad confirmation page * * @since 3.0.4 */ function banktransfer_gateway_process($order_vals) { global $gateway_name, $app_abbr, $ref_val; // if gateway wasn't selected then exit if ($order_vals['cp_payment_method'] != 'banktransfer') { return; } $ad_listing = !empty($order_vals['post_id']) ? true : false; // ad listing or membership if ($ad_listing) { $ref_val = $order_vals['post_id']; $info_message = __('Please include the following details when sending the bank transfer. Once your transfer has been verified, we will then approve your ad listing.', APP_TD); cp_bank_owner_new_ad_email($ref_val); } else { $ref_val = $order_vals['oid']; $info_message = __('Please include the following details when sending the bank transfer. Once your transfer has been verified, we will then activate your membership.', APP_TD); cp_new_membership_email($ref_val); cp_bank_owner_new_membership_email($ref_val); } // regardless of what happens, log the transaction if (file_exists(TEMPLATEPATH . '/includes/gateways/process.php')) { include_once TEMPLATEPATH . '/includes/gateways/process.php'; $trdata = cp_prepare_transaction_entry($order_vals); if ($trdata) { $tr_id = cp_add_transaction_entry($trdata); } } ?> <h2><?php _e('Your Unique Ad Details', APP_TD); ?> </h2> <p><?php echo $info_message; ?> </p> <p> <strong><?php if ($ad_listing) { _e('Transaction ID:', APP_TD); } else { _e('Pack Name:', APP_TD); } ?> </strong> <?php echo esc_html($order_vals['item_number']); ?> <br /> <strong><?php if ($ad_listing) { _e('Reference #:', APP_TD); } else { _e('Transaction ID:', APP_TD); } ?> </strong> <?php echo esc_attr($ref_val); ?> <br /> <strong><?php _e('Total Amount:', APP_TD); ?> </strong> <?php cp_display_price($order_vals['item_amount'], get_option('cp_curr_pay_type')); ?> <br /> </p> <br /><br /> <h2><?php _e('Bank Transfer Instructions', APP_TD); ?> </h2> <p><?php echo stripslashes(appthemes_nl2br(get_option('cp_bank_instructions'))); ?> </p> <p><?php _e('For questions or problems, please contact us directly at', APP_TD); ?> <?php echo get_option('admin_email'); ?> </p> <?php }