本文整理汇总了PHP中WC_Email类的典型用法代码示例。如果您正苦于以下问题:PHP WC_Email类的具体用法?PHP WC_Email怎么用?PHP WC_Email使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WC_Email类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*/
function __construct()
{
$this->id = 'new_switch_order';
$this->title = __('Subscription Switched', 'woocommerce-subscriptions');
$this->description = __('Subscription switched emails are sent when a customer switches a subscription.', 'woocommerce-subscriptions');
$this->heading = __('Subscription Switched', 'woocommerce-subscriptions');
$this->subject = __('[{blogname}] Subscription Switched ({order_number}) - {order_date}', 'woocommerce-subscriptions');
$this->template_html = 'emails/admin-new-switch-order.php';
$this->template_plain = 'emails/plain/admin-new-switch-order.php';
$this->template_base = plugin_dir_path(WC_Subscriptions::$plugin_file) . 'templates/';
// Triggers for this email
add_action('woocommerce_order_status_pending_to_processing_switch_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_pending_to_completed_switch_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_pending_to_on-hold_switch_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_processing_switch_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_completed_switch_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_on-hold_switch_notification', array($this, 'trigger'));
// We want all the parent's methods, with none of its properties, so call its parent's constructor, rather than my parent constructor
WC_Email::__construct();
// Other settings
$this->recipient = $this->get_option('recipient');
if (!$this->recipient) {
$this->recipient = get_option('admin_email');
}
}
示例2: email_template
public static function email_template($subject, $message)
{
global $woocommerce, $woocommerce_settings;
// load the mailer class
$mailer = WC()->mailer();
$email_heading = $subject;
$message;
$abstractClass = new ReflectionClass('WC_Email');
if (!$abstractClass->isAbstract()) {
$email = new WC_Email();
// wrap the content with the email template and then add styles
$fetch_data = $email->style_inline($mailer->wrap_message($email_heading, $message));
} else {
$fetch_data = $mailer->wrap_message($email_heading, $message);
}
return $fetch_data;
}
示例3: __construct
/**
* Set email defaults
*
* @since 0.1
*/
public function __construct()
{
// set ID, this simply needs to be a unique name
$this->id = 'wc_ticket_order';
// this is the title in WooCommerce Email settings
$this->title = 'Tickets Order';
//home/dancenergyjail/home/dancenergy/public_html/sandbox/wp-content/plugins/woocommerce/templates//home/dancenergyjail/home/dancenergy/public_html/sandbox/wp-content/plugins/ticket_plugin/includes/templates/emails/customer-completed-order.php
// this is the description in WooCommerce email settings
$this->description = 'Tickets Order Notification emails are sent when a customer places an order with a ticket.';
// these are the default heading and subject lines that can be overridden using the settings
$this->heading = 'Your Tickets';
$this->subject = 'Your Tickets';
// these define the locations of the templates that this email should use, we'll just use the new order template since this email is similar
$this->template_base = plugin_dir_path(__FILE__);
$this->template_html = 'templates/emails/customer-completed-order-ticket.php';
$this->template_plain = 'templates/emails/plain/customer-completed-order-ticket.php';
// Trigger on new paid orders
//backend order page hook
add_action('woocommerce_after_resend_order_email', array($this, 'trigger'), 1);
//Frontend hook after the order status changes to completed
add_action('woocommerce_order_status_completed_notification', array($this, 'trigger'), 1);
// For WooCommerce 2.0
// Call parent constructor to load any other defaults not explicity defined here
parent::__construct();
// this sets the recipient to the settings defined below in init_form_fields()
$this->recipient = $this->get_option('recipient');
// if none was entered, just use the WP admin email as a fallback
if (!$this->recipient) {
$this->recipient = get_option('admin_email');
}
}
示例4: __construct
/**
* Set email defaults
*
* @since 0.1
*/
public function __construct()
{
// set ID, this simply needs to be a unique name
$this->id = 'wc_expedited_order';
// this is the title in WooCommerce Email settings
$this->title = 'Expedited Order';
// this is the description in WooCommerce email settings
$this->description = 'Expedited Order Notification emails are sent when a customer places an order with 3-day or next day shipping';
// these are the default heading and subject lines that can be overridden using the settings
$this->heading = 'Expedited Shipping Order';
$this->subject = 'Expedited Shipping Order';
// these define the locations of the templates that this email should use, we'll just use the new order template since this email is similar
$this->template_html = 'emails/admin-new-order.php';
$this->template_plain = 'emails/plain/admin-new-order.php';
// Trigger on new paid orders
add_action('woocommerce_order_status_pending_to_processing_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_processing_notification', array($this, 'trigger'));
// Call parent constructor to load any other defaults not explicity defined here
parent::__construct();
// this sets the recipient to the settings defined below in init_form_fields()
$this->recipient = $this->get_option('recipient');
// if none was entered, just use the WP admin email as a fallback
if (!$this->recipient) {
$this->recipient = get_option('admin_email');
}
}
开发者ID:jvcanote,项目名称:woocommerce-expedited-order-email,代码行数:31,代码来源:class-wc-expedited-order-email.php
示例5: __construct
/**
* Constructor
*
* Initialize email type and set templates paths
*
* @since 1.0.0
* @author Alberto Ruggiero
*/
public function __construct()
{
$this->title = __('Review reminder', 'ywrr');
$this->template_html = 'emails/review-request.php';
$this->template_plain = 'emails/plain/review-request.php';
parent::__construct();
}
示例6: __construct
/**
* Set Email Defaults
*
* @since 0.1
*/
public function __construct()
{
// set ID
$this->id = 'wc_customer_note_order';
// this is the title in WooCommerce Email Settings
$this->title = 'Customer Note Order';
// this is the description in WooCommerce email settings
$this->description = 'Customer Note Emails are sent to admin email when a customer adds a note to an order';
// these are the default heading and subject lines, can be overridden using settings
$this->heading = 'Customer Order Note';
$this->subject = 'Customer Note on Order:';
// template for email, using existing emails as stand-in
$this->template_html = 'emails/admin-customer-note.php';
$this->template_plain = 'email/plain/admin-new-order.php';
// Trigger on completed orders
#add_action( 'woocommerce_order_status_pending_to_completed_notification', array( $this, 'trigger' ) );
add_action('woocommerce_order_status_pending_to_completed', array($this, 'trigger'));
// Call parent constructor, just in case any defaults were missed
parent::__construct();
// this sets the recipient to the settings defined below in init_form_fields()
$this->recipient = $this->get_option('recipient');
// if none was entered, just use the WP admin email as a fallback
if (!$this->recipient) {
$this->recipient = get_option('admin_email');
}
}
示例7: order
/**
* Constructor
*/
function __construct()
{
$this->id = 'vendor_new_order';
$this->title = __('Notify vendors', 'wcvendors');
$this->description = __('New order emails are sent when an order is received/paid by a customer.', 'wcvendors');
$this->heading = __('New customer order', 'wcvendors');
$this->subject = __('[{blogname}] New customer order ({order_number}) - {order_date}', 'wcvendors');
$this->template_html = 'vendor-new-order.php';
$this->template_plain = 'vendor-new-order.php';
$this->template_base = dirname(dirname(dirname(dirname(__FILE__)))) . '/templates/emails/';
// #216 is broken. Code below is from that. The filter is probably the culprit.
//$completed_statuses = apply_filters( 'wcvendors_completed_statuses', array( 'completed', 'processing' ) ); // #216
//foreach ( $completed_statuses as $status ) {
//add_action( 'woocommerce_order_status_pending_to_{$status}_notification', array( $this, 'trigger' ) );
//add_action( 'woocommerce_order_status_failed_to_{$status}_notification', array( $this, 'trigger' ) );
//add_action( 'woocommerce_order_status_on-hold_to_{$status}_notification', array( $this, 'trigger' ) );
//}
// end #216
// Triggers for this email
add_action('woocommerce_order_status_pending_to_processing_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_pending_to_completed_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_processing_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_completed_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_on-hold_to_processing_notification', array($this, 'trigger'));
// Added in 1.8.4
add_action('woocommerce_order_status_on-hold_to_completed_notification', array($this, 'trigger'));
// Added in 1.8.4
$this->recipient = get_option('admin_email');
// Call parent constuctor
parent::__construct();
}
示例8: Order
/**
* Constructor
*
* @version 2.4.0
*/
function __construct($id = 1)
{
$this->id = 'wcj_custom' . '_' . $id;
$this->customer_email = '%customer%' === $this->get_option('recipient') ? true : false;
$this->title = __('Custom', 'woocommerce-jetpack') . ' #' . $id;
$this->description = __('Custom emails are sent to the recipient list when selected triggers are called.', 'woocommerce-jetpack');
$this->heading = __('Custom Heading', 'woocommerce');
$this->subject = __('[{site_title}] Custom Subject - Order ({order_number}) - {order_date}', 'woocommerce-jetpack');
/* $this->template_html = 'emails/admin-new-order.php';
$this->template_plain = 'emails/plain/admin-new-order.php'; */
// Triggers for this email
$trigger_hooks = $this->get_option('trigger');
if (!empty($trigger_hooks) && is_array($trigger_hooks)) {
foreach ($trigger_hooks as $trigger_hook) {
add_action($trigger_hook, array($this, 'trigger'));
}
}
// Call parent constructor
parent::__construct();
// Other settings
if (!$this->customer_email) {
$this->recipient = $this->get_option('recipient');
if (!$this->recipient) {
$this->recipient = get_option('admin_email');
}
}
}
示例9: Order
/**
* Constructor
*
* @version 2.5.5
*/
function __construct($id = 1)
{
$this->id = 'wcj_custom' . '_' . $id;
$this->customer_email = '%customer%' === $this->get_option('recipient') ? true : false;
$this->title = get_option('wcj_emails_custom_emails_admin_title_' . $id, __('Custom', 'woocommerce-jetpack') . ' #' . $id);
$this->description = __('Custom emails are sent to the recipient list when selected triggers are called.', 'woocommerce-jetpack');
$this->heading = __('Custom Heading', 'woocommerce');
$this->subject = __('[{site_title}] Custom Subject - Order ({order_number}) - {order_date}', 'woocommerce-jetpack');
/* $this->template_html = 'emails/admin-new-order.php';
$this->template_plain = 'emails/plain/admin-new-order.php'; */
// Triggers for this email
$trigger_hooks = $this->get_option('trigger');
if (!empty($trigger_hooks) && is_array($trigger_hooks)) {
$is_woocommerce_checkout_order_processed_notification_added = false;
foreach ($trigger_hooks as $trigger_hook) {
if (false !== strpos($trigger_hook, 'woocommerce_new_order_notification') && false === $is_woocommerce_checkout_order_processed_notification_added) {
add_action('woocommerce_checkout_order_processed_notification', array($this, 'trigger'), PHP_INT_MAX);
$is_woocommerce_checkout_order_processed_notification_added = true;
} else {
add_action($trigger_hook, array($this, 'trigger'), PHP_INT_MAX);
}
}
}
// Call parent constructor
parent::__construct();
// Other settings
if (!$this->customer_email) {
$this->recipient = $this->get_option('recipient');
if (!$this->recipient) {
$this->recipient = get_option('admin_email');
}
}
}
示例10: __construct
/**
* Set email defaults
*
* @since 1.0.1
*/
public function __construct()
{
/**
* Set plugin slug
* @since 1.1.2
*/
$this->plugin_slug = 'angelleye-offers-for-woocommerce';
// set ID, this simply needs to be a unique name
$this->id = 'wc_offer_on_hold';
// this is the title in WooCommerce Email settings
$this->title = __('Offer On Hold', $this->plugin_slug);
// this is the description in WooCommerce email settings
$this->description = __('Offer On Hold Notification emails are sent when a customer offer is placed on hold by the store admin', $this->plugin_slug);
// these are the default heading and subject lines that can be overridden using the settings
$this->heading = __('Offer On Hold', $this->plugin_slug);
$this->subject = __('[{site_title}] Offer On Hold ({offer_number}) - {offer_date}', $this->plugin_slug);
// Set email template paths
$this->template_html = 'woocommerce-offer-on-hold.php';
$this->template_plain = 'plain/woocommerce-offer-on-hold.php';
// Call parent constructor to load any other defaults not explicitly defined here
parent::__construct();
// Set the recipient
$this->recipient = $this->get_option('recipient');
// Other settings
$this->template_base = OFWC_EMAIL_TEMPLATE_PATH;
}
示例11: __construct
/**
* Set email defaults
*
* @since 0.1
*/
public function __construct()
{
// set ID, this simply needs to be a unique name
$this->id = 'wc_processing_order';
// this is the title in WooCommerce Email settings
$this->title = 'Processing order (Customer)';
// this is the description in WooCommerce email settings
$this->description = 'On Hold to Processing Notification emails are sent when a customer order change from On Hold to Processing';
// these are the default heading and subject lines that can be overridden using the settings
$this->heading = 'Processing Order';
$this->subject = 'Processing Order';
// these define the locations of the templates that this email should use
$this->template_html = 'emails/customer-processing-order.php';
$this->template_plain = 'emails/plain/customer-processing-order.php';
$path = explode(DIRECTORY_SEPARATOR, untrailingslashit(plugin_dir_path(__FILE__)));
array_pop($path);
$path = implode(DIRECTORY_SEPARATOR, $path);
$this->template_base = $path . '/templates/';
// Trigger on On Hold to Processing Notification
add_action('woocommerce_order_status_on-hold_to_processing_notification', array($this, 'trigger'));
// Call parent constructor to load any other defaults not explicity defined here
parent::__construct();
// this sets the recipient to the settings defined below in init_form_fields()
// $this->recipient = $this->get_option( 'recipient' );
// if none was entered, just use the WP admin email as a fallback
// if ( ! $this->recipient )
// $this->recipient = get_option( 'admin_email' );
}
示例12: array
/**
* Constructor
*/
function __construct()
{
$this->id = 'new_booking';
$this->title = __('New Booking', 'woocommerce-bookings');
$this->description = __('New booking emails are sent to the admin when a new booking is created and paid. This email is also received when a Pending confirmation booking is created.', 'woocommerce-bookings');
$this->heading = __('New booking', 'woocommerce-bookings');
$this->heading_confirmation = __('Confirm booking', 'woocommerce-bookings');
$this->subject = __('[{blogname}] New booking for {product_title} (Order {order_number}) - {order_date}', 'woocommerce-bookings');
$this->subject_confirmation = __('[{blogname}] A new booking for {product_title} (Order {order_number}) is awaiting your approval - {order_date}', 'woocommerce-bookings');
$this->template_html = 'emails/admin-new-booking.php';
$this->template_plain = 'emails/plain/admin-new-booking.php';
// Triggers for this email
add_action('woocommerce_booking_in-cart_to_paid_notification', array($this, 'queue_notification'));
add_action('woocommerce_booking_in-cart_to_pending-confirmation_notification', array($this, 'queue_notification'));
add_action('woocommerce_booking_unpaid_to_paid_notification', array($this, 'queue_notification'));
add_action('woocommerce_booking_unpaid_to_pending-confirmation_notification', array($this, 'queue_notification'));
add_action('woocommerce_booking_confirmed_to_paid_notification', array($this, 'queue_notification'));
add_action('woocommerce_new_booking_notification', array($this, 'trigger'));
add_action('woocommerce_admin_new_booking_notification', array($this, 'trigger'));
// Call parent constructor
parent::__construct();
// Other settings
$this->template_base = WC_BOOKINGS_TEMPLATE_PATH;
$this->recipient = $this->get_option('recipient', get_option('admin_email'));
}
示例13: __construct
/**
* Set email defaults
*
* @since 0.1.0
*/
public function __construct()
{
/**
* Set plugin slug
* @since 1.1.2
*/
$this->plugin_slug = 'angelleye-offers-for-woocommerce';
// set ID, this simply needs to be a unique name
$this->id = 'wc_new_offer';
// this is the title in WooCommerce Email settings
$this->title = __('New offer', $this->plugin_slug);
// this is the description in WooCommerce email settings
$this->description = __('New Offer Notification emails are sent to the admin when customer submits offer', $this->plugin_slug);
// these are the default heading and subject lines that can be overridden using the settings
$this->heading = __('New Offer', $this->plugin_slug);
$this->subject = __('New Offer', $this->plugin_slug);
// Set email template paths
$this->template_html = 'woocommerce-new-offer.php';
$this->template_plain = 'plain/woocommerce-new-offer.php';
// Call parent constructor to load any other defaults not explicitly defined here
parent::__construct();
// Set the recipient
$this->recipient = $this->get_option('recipient');
// Other settings
$this->template_base = OFWC_PUBLIC_EMAIL_TEMPLATE_PATH;
}
示例14: __construct
/**
* Hooks up the functions for Waitlist Mailout
*
* @access public
*/
public function __construct()
{
// Init
$this->wcwl_setup_mailout();
// Triggers for this email
add_action('woocommerce_waitlist_mailout_send_email', array($this, 'trigger'), 10, 2);
// Call parent constructor
parent::__construct();
}
示例15: array
/**
* Constructor
*/
function __construct()
{
$this->set_email_strings();
// Triggers for this email
add_action('woocommerce_order_status_refunded_notification', array($this, 'trigger'), null, 3);
add_action('woocommerce_order_partially_refunded_notification', array($this, 'trigger'), null, 3);
// Call parent constuctor
parent::__construct();
}