Example #1
0
/**
 * Get cart & checkout path with their translations to automatically exclude them to the cache.
 *
 * @since 2.4
 *
 * @return array $urls
 */
function get_rocket_ecommerce_exclude_pages()
{
    $urls = array();
    // WooCommerce
    if (function_exists('WC') && function_exists('wc_get_page_id')) {
        if (wc_get_page_id('checkout') && wc_get_page_id('checkout') != '-1') {
            $checkout_urls = get_rocket_i18n_translated_post_urls(wc_get_page_id('checkout'), 'page', '(.*)');
            $urls = array_merge($urls, $checkout_urls);
        }
        if (wc_get_page_id('cart') && wc_get_page_id('cart') != '-1') {
            $cart_urls = get_rocket_i18n_translated_post_urls(wc_get_page_id('cart'));
            $urls = array_merge($urls, $cart_urls);
        }
    }
    // Easy Digital Downloads
    $edd_settings = get_option('edd_settings');
    if (function_exists('EDD') && isset($edd_settings['purchase_page'])) {
        $checkout_urls = get_rocket_i18n_translated_post_urls($edd_settings['purchase_page'], 'page', '(.*)');
        $urls = array_merge($urls, $checkout_urls);
    }
    // iThemes Exchange
    if (function_exists('it_exchange_get_page_type') && function_exists('it_exchange_get_page_url')) {
        $pages = array('purchases', 'confirmation');
        foreach ($pages as $page) {
            if (it_exchange_get_page_type($page) == 'wordpress') {
                $exchange_urls = get_rocket_i18n_translated_post_urls(it_exchange_get_page_wpid($page));
            } else {
                $exchange_urls = array(parse_url(it_exchange_get_page_url($page), PHP_URL_PATH));
            }
            $urls = array_merge($urls, $exchange_urls);
        }
    }
    // Jigoshop
    if (defined('JIGOSHOP_VERSION') && function_exists('jigoshop_get_page_id')) {
        if (jigoshop_get_page_id('checkout') && jigoshop_get_page_id('checkout') != '-1') {
            $checkout_urls = get_rocket_i18n_translated_post_urls(jigoshop_get_page_id('checkout'), 'page', '(.*)');
            $urls = array_merge($urls, $checkout_urls);
        }
        if (jigoshop_get_page_id('cart') && jigoshop_get_page_id('cart') != '-1') {
            $cart_urls = get_rocket_i18n_translated_post_urls(jigoshop_get_page_id('cart'));
            $urls = array_merge($urls, $cart_urls);
        }
    }
    // WP Shop
    if (defined('WPSHOP_VERSION') && class_exists('wpshop_tools') && method_exists('wpshop_tools', 'get_page_id')) {
        $pages = array('wpshop_cart_page_id', 'wpshop_checkout_page_id', 'wpshop_payment_return_page_id', 'wpshop_payment_return_nok_page_id');
        foreach ($pages as $page) {
            if ($page_id = wpshop_tools::get_page_id(get_option($page))) {
                $urls = array_merge($urls, get_rocket_i18n_translated_post_urls($page_id));
            }
        }
    }
    return $urls;
}
Example #2
0
 /**
  * Build the iDEAL payment form.
  */
 public static function make_payment_button()
 {
     // Return early if cart total is <= 0
     // @see https://github.com/wp-plugins/ithemes-exchange/blob/1.11.8/core-addons/transaction-methods/paypal-standard/init.php#L359-L362
     // @see https://github.com/wp-plugins/ithemes-exchange/blob/1.11.8/api/cart.php#L781-L809
     $cart_total = it_exchange_get_cart_total(false);
     if ($cart_total <= 0) {
         return;
     }
     // Cart total > 0
     $payment_form = '';
     $gateway = Pronamic_WP_Pay_Plugin::get_gateway(self::get_gateway_configuration_id());
     if ($gateway) {
         $payment_form .= '<form action="' . it_exchange_get_page_url('transaction') . '" method="post">';
         $payment_form .= '<input type="hidden" name="it-exchange-transaction-method" value="' . self::$slug . '" />';
         $payment_form .= $gateway->get_input_html();
         $payment_form .= wp_nonce_field('pronamic-ideal-checkout', '_pronamic_ideal_nonce', true, false);
         $payment_form .= '<input type="submit" name="pronamic_ideal_process_payment" value="' . self::get_gateway_button_title() . '" />';
         $payment_form .= '</form>';
     }
     return $payment_form;
 }
<?php

if (it_exchange_get_next_purchase_requirement_property('slug') != 'itelic-renew-product') {
    return;
}
$session = it_exchange_get_session_data('purchase_req_itelic-renew-product');
?>

<form method="POST" action="<?php 
echo esc_attr(it_exchange_get_page_url('checkout'));
?>
" class="itelic-renew-keys-checkout">

	<h3><?php 
echo _n("Renew your license key", "Renew your license keys", count($session), ITELIC\Plugin::SLUG);
?>
</h3>

	<ul>
		<?php 
foreach ($session as $product => $license) {
    ?>
			<?php 
    $product = str_replace('p', '', $product);
    ?>
			<?php 
    if ($license !== null) {
        ?>
				<?php 
        continue;
        ?>