<label for="accesspress-checkout-payment-method-<?php echo $key; ?> "><?php echo $gateway->checkout_label; ?> </label> </div> <?php } ?> </div> <?php } if (is_active_payment_method('authorize.net')) { add_action('premise_checkout_form', 'accesspress_checkout_form_payment_cc', 12); } function accesspress_checkout_form_payment_cc($args = array()) { $args = wp_parse_args($args, array('cc_box_heading' => __('3. Enter Credit Card Information', 'premise'), 'product_id' => (int) $_GET['product_id'], 'card-name' => '', 'card-month' => '', 'card-year' => '', 'card-country' => '', 'card-postal' => '')); ?> <div class="accesspress-checkout-form-cc"> <?php if ($args['cc_box_heading']) { ?> <div class="accesspress-checkout-heading"><?php echo esc_html($args['cc_box_heading']); ?> </div>
/** * Check to see if a particular product requires a payment. * * It first validates that there is an active payment method available. * Then, it checks the product to see if the user chose to require payment for that product. * * @since 0.1.0 * * @param string $product_id. * @return boolean */ function accesspress_product_requires_payment($product_id = '') { if (!$product_id) { return false; } /** If no active payment methods, we can't require payment */ if (!is_active_payment_method('paypal') && !is_active_payment_method('authorize.net')) { return false; } /** If this is a 'paid' product, payment is required */ if ('paid' == get_post_meta($product_id, '_acp_access_method', true)) { return true; } return false; }
function accesspress_checkout_form_payment_cc($args = array()) { $args = wp_parse_args($args, array('heading_text' => __('3. Enter Credit Card Information', 'premise'), 'product_id' => (int) $_GET['product_id'], 'card-name' => '', 'card-month' => '', 'card-year' => '', 'card-country' => '', 'card-postal' => '')); /** Bail if this isn't a valid payment method */ if (!is_active_payment_method('authorize.net')) { return; } ?> <div class="accesspress-checkout-form-cc"> <?php if ($args['heading_text']) { ?> <div class="accesspress-checkout-heading"><?php echo esc_html($args['heading_text']); ?> </div> <?php } ?> <div class="accesspress-checkout-form-row"> <label for="accesspress-checkout-card-name" class="checkout-text-label"><?php _e('Name on Card', 'premise'); ?> :</label> <input type="text" name="accesspress-checkout[card-name]" id="accesspress-checkout-card-name" class="input-text" value="<?php echo esc_attr($args['card-name']); ?> " /> </div> <div class="accesspress-checkout-form-row"> <label for="accesspress-checkout-card-number" class="checkout-text-label"><?php _e('Card Number', 'premise'); ?> :</label> <input type="text" name="accesspress-checkout[card-number]" id="accesspress-checkout-card-number" class="input-text" value="" /> </div> <div class="accesspress-checkout-form-row"> <label for="accesspress-checkout-card-month" class="checkout-text-label"><?php _e('Expiration Date', 'premise'); ?> </label> <select name="accesspress-checkout[card-month]" id="accesspress-checkout-card-month"> <?php foreach (range(1, 12) as $month) { printf('<option value="%d" %s>%d</option>', $month, selected($month, $args['card-month'], false), $month); } ?> </select> <select name="accesspress-checkout[card-year]" id="accesspress-checkout-card-year"> <?php $thisyear = (int) date('Y'); foreach (range($thisyear, $thisyear + 10) as $year) { printf('<option value="%d" %s>%d</option>', $year, selected($year, $args['card-year'], false), $year); } ?> </select> </div> <div class="accesspress-checkout-form-row"> <label for="accesspress-checkout-card-security" class="checkout-text-label"><?php _e('Security Code', 'premise'); ?> :</label> <input type="password" name="accesspress-checkout[card-security]" id="accesspress-checkout-card-security" class="input-text input-text-short" size="3" value="" /> <p><span class="description"><?php _e('The security code should be located on the back of your card.', 'premise'); ?> </span></p> </div> <div class="accesspress-checkout-form-row"> <label for="accesspress-checkout-card-country" class="checkout-text-label"><?php _e('Country', 'premise'); ?> :</label> <select name="accesspress-checkout[card-country]" id="accesspress-checkout-card-country"> <?php foreach ((array) accesspress_get_countries() as $code => $label) { printf('<option value="%s" %s>%s</option>', esc_attr($code), selected($code, $args['card-country'], false), esc_html($label)); } ?> </select> </div> <div class="accesspress-checkout-form-row"> <label for="accesspress-checkout-card-postal" class="checkout-text-label"><?php _e('ZIP/Postal Code', 'premise'); ?> :</label> <input type="text" name="accesspress-checkout[card-postal]" id="accesspress-checkout-card-postal" class="input-text input-text-short" size="12" value="<?php echo esc_attr($args['card-postal']); ?> " /> </div> </div> <?php }