static function InlineStyles($message) { if (false === strpos($message, '<html')) { return $message; } $cssfile = Shopp::locate_template(array('email.css')); $stylesheet = file_get_contents($cssfile); if (!empty($stylesheet)) { $Emogrifier = new Emogrifier($message, $stylesheet); $message = $Emogrifier->emogrify(); } return $message; }
/** * Loads the theme templates `shopp/functions.php` if present * * If theme content templates are enabled, checks for and includes a functions.php file (if present). * This allows developers to add Shopp-specific presentation logic with the added convenience of knowing * that shopp_init has run. * * @author Barry Hughes * @since 1.3 * * @return void **/ public static function functions() { if (!Shopp::str_true(shopp_setting('theme_templates'))) { return; } Shopp::locate_template(array('functions.php'), true); }
public function email($addressee, $address, $subject, array $templates = array()) { global $is_IIS; shopp_debug("ShoppPurchase::email(): {$addressee},{$address},{$subject}," . _object_r($templates)); // Build the e-mail message data $email['from'] = Shopp::email_from(shopp_setting('merchant_email'), shopp_setting('business_name')); if ($is_IIS) { $email['to'] = Shopp::email_to($address); } else { $email['to'] = Shopp::email_to($address, $addressee); } $email['subject'] = $subject; $email['receipt'] = $this->receipt(); $email['url'] = get_bloginfo('url'); $email['sitename'] = get_bloginfo('name'); $email['orderid'] = $this->id; $email = apply_filters('shopp_email_receipt_data', $email); $email = apply_filters('shopp_purchase_email_message', $email); $this->message = array_merge($this->message, $email); // Load and process the template file $defaults = array('email.php', 'order.php', 'order.html'); $emails = array_merge((array) $templates, $defaults); $template = Shopp::locate_template($emails); if (!file_exists($template)) { shopp_add_error(Shopp::__('A purchase notification could not be sent because the template for it does not exist.'), SHOPP_ADMIN_ERR); return false; } // Send the email if (Shopp::email($template, $this->message)) { shopp_debug('A purchase notification was sent to: ' . $this->message['to']); return true; } shopp_debug('A purchase notification FAILED to be sent to: ' . $this->message['to']); return false; }
public function content($content, $request = false) { if (!$request) { global $wp_query; // Test that this is the main query and it is the account page if (!$wp_query->is_main_query() || !is_shopp_page('account')) { return $content; } } $widget = 'widget' === $request; if ($widget) { $request = 'menu'; } // Modify widget request to render the account menu $orderlookup = ''; if ('none' == shopp_setting('account_system')) { $orderlookup = shopp('customer', 'get-order-lookup'); } // $download_request = get_query_var('s_dl'); if (!$request) { $request = ShoppStorefront()->account['request']; } $templates = array('account-' . $request . '.php', 'account.php'); $context = ShoppStorefront::intemplate(); // Set account page context $Errors = ShoppErrorStorefrontNotices(); ob_start(); if (apply_filters('shopp_show_account_errors', true) && $Errors->exist()) { echo ShoppStorefront::errors(array("errors-{$context}", 'account-errors.php', 'errors.php')); } if (!empty($orderlookup)) { echo $orderlookup; } else { if ('login' == $request || !ShoppCustomer()->loggedin()) { $templates = array('login-' . $request . '.php', 'login.php'); } Shopp::locate_template($templates, true); } $content = ob_get_clean(); // Suppress the #shopp div for sidebar widgets if ($widget) { $content = '<!-- id="shopp" -->' . $content; } return apply_filters('shopp_account_template', $content, $request); }
/** * @deprecated Use Shopp::locate_shopp_template() **/ function locate_shopp_template($template_names, $load = false, $require_once = false) { return Shopp::locate_template($template_names, $load, $require_once); }