/** * Queues Shopp storefront javascript and styles as needed * * @author Jonathan Davis * @since 1.1 * * @return void **/ public function behaviors() { $Shopp = Shopp::object(); if (is_ssl()) { $urls = array('option_siteurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src'); foreach ($urls as $filter) { add_filter($filter, 'force_ssl'); } } // Replace the WordPress canonical link remove_action('wp_head', 'rel_canonical'); add_action('wp_head', array($this, 'header')); add_action('wp_footer', array($this, 'footer')); wp_enqueue_style('shopp.catalog', SHOPP_ADMIN_URI . '/styles/catalog.css', array(), 20110511, 'screen'); wp_enqueue_style('shopp.icons', SHOPP_ADMIN_URI . '/styles/icons.css', array(), 20110511, 'screen'); wp_enqueue_style('shopp', Shopp::template_url('shopp.css'), array(), 20110511, 'screen'); wp_enqueue_style('shopp.colorbox', SHOPP_ADMIN_URI . '/styles/colorbox.css', array(), 20110511, 'screen'); $orderhistory = is_account_page() && isset($_GET['id']) && !empty($_GET['id']); if (is_thanks_page() || $orderhistory) { wp_enqueue_style('shopp.printable', SHOPP_ADMIN_URI . '/styles/printable.css', array(), 20110511, 'print'); } $loading = shopp_setting('script_loading'); if (!$loading || 'global' == $loading || !empty($page)) { shopp_enqueue_script('colorbox'); shopp_enqueue_script('shopp'); shopp_enqueue_script('catalog'); shopp_enqueue_script('cart'); if (is_catalog_page()) { shopp_custom_script('catalog', "var pricetags = {};\n"); } } if (is_checkout_page()) { shopp_enqueue_script('address'); shopp_enqueue_script('checkout'); } if (is_confirm_page()) { shopp_enqueue_script('checkout'); } if (is_account_page()) { shopp_enqueue_script('address'); $regions = Lookup::country_zones(); $js = 'var regions=' . json_encode($regions); add_storefrontjs($js, true); } }
/** * Checks if the current page is the catalog landing page * * @api `shopp('storefront.is-catalog')` * @since 1.1 * * @param string $result The output * @param array $options The options * @param ShoppStorefront $O The working object * @return bool True if it is the catalog page, false otherwise **/ public static function is_catalog($result, $options, $O) { return is_catalog_page(); }