Пример #1
0
/**
 * Get Checkout Form
 *
 * @access      private
 * @since       1.0
 * @return      string
*/
function edd_checkout_form()
{
    global $edd_options, $user_ID, $post;
    ob_start();
    ?>

		<?php 
    if (edd_get_cart_contents()) {
        ?>

			<?php 
        edd_checkout_cart();
        ?>

			<div id="edd_checkout_form_wrap" class="edd_clearfix">

				<?php 
        do_action('edd_checkout_form_top');
        if (edd_show_gateways()) {
            do_action('edd_payment_payment_mode_select');
        } else {
            do_action('edd_purchase_form');
        }
        do_action('edd_checkout_form_bottom');
        ?>
			</div><!--end #edd_checkout_form_wrap-->
		<?php 
    } else {
        do_action('edd_empty_cart');
    }
    return ob_get_clean();
}
/**
 * Show Payment Icons by getting all the accepted icons from the EDD Settings
 * then outputting the icons.
 *
 * @since 1.0
 * @return void
*/
function edd_show_payment_icons()
{
    if (edd_show_gateways() && did_action('edd_payment_mode_top')) {
        return;
    }
    $payment_methods = edd_get_option('accepted_cards', array());
    if (empty($payment_methods)) {
        return;
    }
    echo '<div class="edd-payment-icons">';
    foreach ($payment_methods as $key => $card) {
        if (edd_string_is_image_url($key)) {
            echo '<img class="payment-icon" src="' . esc_url($key) . '"/>';
        } else {
            $card = strtolower(str_replace(' ', '', $card));
            if (has_filter('edd_accepted_payment_' . $card . '_image')) {
                $image = apply_filters('edd_accepted_payment_' . $card . '_image', '');
            } else {
                $image = edd_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false);
                $content_dir = WP_CONTENT_DIR;
                if (function_exists('wp_normalize_path')) {
                    // Replaces backslashes with forward slashes for Windows systems
                    $image = wp_normalize_path($image);
                    $content_dir = wp_normalize_path($content_dir);
                }
                $image = str_replace($content_dir, WP_CONTENT_URL, $image);
            }
            if (edd_is_ssl_enforced() || is_ssl()) {
                $image = edd_enforced_ssl_asset_filter($image);
            }
            echo '<img class="payment-icon" src="' . esc_url($image) . '"/>';
        }
    }
    echo '</div>';
}