コード例 #1
0
ファイル: Purchase.php プロジェクト: borkweb/shopp
 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;
 }
コード例 #2
0
 /**
  * Send new customer notification emails
  *
  * @author Jonathan Davis
  * @since 1.2
  *
  * @return void
  **/
 public function notification()
 {
     // The blogname option is escaped with esc_html on the way into the database in sanitize_option
     // we want to reverse this for the plain text arena of emails.
     $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $business = shopp_setting('business_name');
     $merchant = shopp_setting('merchant_email');
     $_ = array();
     $_[] = 'From: ' . Shopp::email_from($merchant, $business);
     $_[] = 'To: ' . Shopp::email_to($merchant);
     $_[] = 'Subject: ' . Shopp::__('[%s] New Customer Registration', $blogname);
     $_[] = '';
     $_[] = Shopp::__('New customer registration on your "%s" store:', $blogname);
     $_[] = Shopp::__('E-mail: %s', stripslashes($this->email));
     $_ = apply_filters('shopp_merchant_new_customer_notification', $_);
     if (!Shopp::email(join("\n", $_))) {
         shopp_add_error('The new account notification e-mail could not be sent.', SHOPP_ADMIN_ERR);
     } else {
         shopp_debug('A new account notification e-mail was sent to the merchant.');
     }
     if (empty($this->password)) {
         return;
     }
     $_ = array();
     $_[] = 'From: ' . Shopp::email_from($merchant, $business);
     $_[] = 'To: ' . $this->email;
     $_[] = 'Subject: ' . Shopp::__('[%s] New Customer Registration', $blogname);
     $_[] = '';
     $_[] = Shopp::__('New customer registration on your "%s" store:', $blogname);
     $_[] = Shopp::__('E-mail: %s', stripslashes($this->email));
     $_[] = Shopp::__('Password: %s', $this->password);
     $_[] = '';
     $_[] = Shopp::url(false, 'account', ShoppOrder()->security());
     $_ = apply_filters('shopp_new_customer_notification', $_);
     if (!Shopp::email(join("\n", $_))) {
         shopp_add_error('The customer's account notification e-mail could not be sent.', SHOPP_ADMIN_ERR);
     } else {
         shopp_debug('A new account notification e-mail was sent to the customer.');
     }
 }