/**
 * Get page rewrites for it_exchange_register_page
 *
 * @internal
 *
 * @since 1.0
 *
 * @param string $page
 *
 * @return array
 */
function page_rewrites($page)
{
    $slug = it_exchange_get_page_slug($page);
    $account_slug = it_exchange_get_page_slug('account');
    // If we're using WP as acount page type, add the WP slug to rewrites and return.
    if ('wordpress' == it_exchange_get_page_type('account')) {
        $account = get_post(it_exchange_get_page_wpid('account'));
        $account_slug = $account->post_name;
    }
    $rewrites = array($account_slug . '/([0-9]+)/' . $slug . '$' => 'index.php?' . $account_slug . '=$matches[1]&' . $slug . '=1', $account_slug . '/' . $slug . '$' => 'index.php?' . $account_slug . '=1&' . $slug . '=1');
    return $rewrites;
}
Example #2
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;
}