当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Emails::instance方法代码示例

本文整理汇总了PHP中WC_Emails::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Emails::instance方法的具体用法?PHP WC_Emails::instance怎么用?PHP WC_Emails::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Emails的用法示例。


在下文中一共展示了WC_Emails::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: output

 /**
  * Render the settings for the current section
  *
  * @since 2.0.0
  */
 public function output()
 {
     $settings = $this->get_settings();
     // inject the actual setting value before outputting the fields
     // ::output_fields() uses get_option() but customizations are stored
     // in a single option so this dynamically returns the correct value
     if (isset($_GET['section']) && $_GET['section'] == 'email_options') {
         // email options
         $wc_emails = (array) WC_Emails::instance()->emails;
         foreach (self::$wc_emails_enabled as $filed => $id) {
             $email_enabled = (array) $wc_emails[$filed];
             if ($email_enabled['enabled'] == 'no') {
                 add_filter("pre_option_{$filed}", function () {
                     return 'no';
                 });
             } else {
                 add_filter("pre_option_{$filed}", function () {
                     return 'yes';
                 });
             }
         }
     }
     if (isset($_GET['section']) && $_GET['section'] == 'sms_options') {
     }
     foreach ($this->customizations as $filter => $value) {
         add_filter("pre_option_{$filter}", array($this, 'get_customization'));
     }
     WC_Admin_Settings::output_fields($settings);
 }
开发者ID:GaunYun,项目名称:woocommerce-sendinblue-newsletter-subscription,代码行数:34,代码来源:wc-sendinblue-settings.php

示例2: send_email

 /**
  * Prepares and send the review request mail
  *
  * @since   1.0.0
  * @param   $order_id int the order id
  * @param   $days
  * @param   $items_to_review
  * @param   $stored_items
  * @return  void
  * @author  Alberto Ruggiero
  */
 static function send_email($order_id, $days, $items_to_review = array(), $stored_items = array())
 {
     $list = YWRR_Emails::get_review_list($order_id);
     $wc_email = WC_Emails::instance();
     $email = $wc_email->emails['YWRR_Request_Mail'];
     $email->trigger($order_id, $list, $days);
 }
开发者ID:allyeastman,项目名称:studio-sapphire,代码行数:18,代码来源:class-ywrr-emails.php

示例3: send_test_mail

 /**
  * Send a test mail from option panel
  *
  * @since   1.0.0
  * @return  void
  * @author  Alberto Ruggiero
  */
 public function send_test_mail()
 {
     ob_start();
     $total_products = wp_count_posts('product');
     if (!$total_products->publish) {
         wp_send_json(array('error' => __('In order to send the test email, at least one product has to be published', 'yith-woocommerce-review-reminder')));
     } else {
         $args = array('posts_per_page' => 2, 'orderby' => 'rand', 'post_type' => 'product');
         $random_products = get_posts($args);
         $test_items = array();
         foreach ($random_products as $item) {
             $test_items[$item->ID]['id'] = $item->ID;
             $test_items[$item->ID]['name'] = $item->post_title;
         }
         $days = get_option('ywrr_mail_schedule_day');
         $test_email = $_POST['email'];
         $template = $_POST['template'];
         try {
             $wc_email = WC_Emails::instance();
             $email = $wc_email->emails['YWRR_Request_Mail'];
             $email_result = $email->trigger(0, $test_items, $days, $test_email, $template);
             if (!$email_result) {
                 wp_send_json(array('error' => __('There was an error while sending the email', 'yith-woocommerce-review-reminder')));
             } else {
                 wp_send_json(true);
             }
         } catch (Exception $e) {
             wp_send_json(array('error' => $e->getMessage()));
         }
     }
 }
开发者ID:VitaliyProdan,项目名称:wp_shop,代码行数:38,代码来源:class-ywrr-ajax.php

示例4: load

 public function load()
 {
     if (class_exists('WC_Emails')) {
         $wc_emails = WC_Emails::instance();
         $emails = $wc_emails->get_emails();
         if (!empty($emails)) {
             $this->emails = $emails;
         }
     }
 }
开发者ID:BurlesonBrad,项目名称:woocommerce-preview-emails,代码行数:10,代码来源:class-woocommerce-preview-emails.php

示例5: save

 /**
  * Save settings.
  */
 public function save()
 {
     global $current_section;
     if (!$current_section) {
         WC_Admin_Settings::save_fields($this->get_settings());
     } else {
         $wc_emails = WC_Emails::instance();
         if (in_array($current_section, array_map('sanitize_title', array_keys($wc_emails->get_emails())))) {
             foreach ($wc_emails->get_emails() as $email_id => $email) {
                 if ($current_section === sanitize_title($email_id)) {
                     do_action('woocommerce_update_options_' . $this->id . '_' . $email->id);
                 }
             }
         } else {
             do_action('woocommerce_update_options_' . $this->id . '_' . $current_section);
         }
     }
 }
开发者ID:tlovett1,项目名称:woocommerce,代码行数:21,代码来源:class-wc-settings-emails.php

示例6: send_email

 /**
  * Prepares and send the review request mail
  *
  * @since   1.0.0
  *
  * @param   $order_id int the order id
  * @param   $days
  * @param   $items_to_review
  * @param   $stored_items
  *
  * @return  void
  * @author  Alberto Ruggiero
  */
 public function send_email($order_id, $days, $items_to_review = array(), $stored_items = array())
 {
     if (defined('YWRR_PREMIUM')) {
         if (empty($stored_items)) {
             if (empty($items_to_review)) {
                 $list = YWRR_Emails_Premium()->get_review_list($order_id);
             } else {
                 $list = YWRR_Emails_Premium()->get_review_list_forced($items_to_review, $order_id);
             }
         } else {
             $list = $stored_items;
         }
     } else {
         $list = $this->get_review_list($order_id);
     }
     $wc_email = WC_Emails::instance();
     $email = $wc_email->emails['YWRR_Request_Mail'];
     $email->trigger($order_id, $list, $days);
 }
开发者ID:yarwalker,项目名称:ecobyt,代码行数:32,代码来源:class-ywrr-emails.php

示例7: unsubscribe_review_request

 /**
  * Handles the unsubscribe form
  *
  * @since   1.0.0
  * @return  void
  * @author  Alberto Ruggiero
  */
 public function unsubscribe_review_request()
 {
     if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
         return;
     }
     if (empty($_POST['action']) || 'unsubscribe_review_request' !== $_POST['action'] || empty($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'unsubscribe_review_request')) {
         return;
     }
     $customer_email = !empty($_POST['account_email']) ? sanitize_email($_POST['account_email']) : '';
     if (empty($customer_email) || !is_email($customer_email)) {
         wc_add_notice(__('Please provide a valid email address.', 'yith-woocommerce-review-reminder'), 'error');
     } elseif ($customer_email !== urldecode(base64_decode($_GET['email']))) {
         wc_add_notice(__('Please retype the email address as provided.', 'yith-woocommerce-review-reminder'), 'error');
     }
     if (wc_notice_count('error') === 0) {
         $wc_email = WC_Emails::instance();
         $email = $wc_email->emails['YWRR_Unsubscribe_Mail'];
         $email->trigger($customer_email);
         wc_add_notice(__('An email has been sent with your request', 'yith-woocommerce-review-reminder'));
         wp_safe_redirect(get_permalink(get_option('ywrr_unsubscribe_page_id')));
         exit;
     }
 }
开发者ID:yarwalker,项目名称:ecobyt,代码行数:30,代码来源:class-ywrr-form-handler.php

示例8: mailer

 /**
  * Email Class.
  * @return WC_Emails
  */
 public function mailer()
 {
     return WC_Emails::instance();
 }
开发者ID:nghieptovan,项目名称:newproject,代码行数:8,代码来源:woocommerce.php

示例9: register_wp_admin_settings

 /**
  * Register WC settings from WP-API to the REST API.
  * @since  2.7.0
  */
 public function register_wp_admin_settings()
 {
     $pages = WC_Admin_Settings::get_settings_pages();
     foreach ($pages as $page) {
         new WC_Register_WP_Admin_Settings($page, 'page');
     }
     $emails = WC_Emails::instance();
     foreach ($emails->get_emails() as $email) {
         new WC_Register_WP_Admin_Settings($email, 'email');
     }
 }
开发者ID:tlovett1,项目名称:woocommerce,代码行数:15,代码来源:class-wc-api.php

示例10: payment_complete_handler

 /**
  * Sends an email when a partial payment is made
  */
 public function payment_complete_handler($order_id)
 {
     $order = wc_get_order($order_id);
     if ('wc-partial-payment' !== $order->post_status) {
         return;
     }
     $wc_emails = WC_Emails::instance();
     $customer_email = $wc_emails->emails['WC_Email_Customer_Processing_Order'];
     $admin_email = $wc_emails->emails['WC_Email_New_Order'];
     $customer_email->trigger($order);
     $admin_email->trigger($order);
 }
开发者ID:Veraxus,项目名称:wc-deposits-with-variations,代码行数:15,代码来源:class-wc-deposits-order-manager.php

示例11: _enable_emails

 protected static function _enable_emails()
 {
     self::_disable_emails();
     $emails = WC_Emails::instance();
     add_action('woocommerce_order_status_pending_to_processing_notification', array($emails->emails['WC_Email_Customer_Processing_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_pending_to_on-hold_notification', array($emails->emails['WC_Email_Customer_Processing_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_completed_notification', array($emails->emails['WC_Email_Customer_Completed_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_pending_to_processing_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_pending_to_completed_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_pending_to_on-hold_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_failed_to_processing_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_failed_to_completed_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
     add_action('woocommerce_order_status_failed_to_on-hold_notification', array($emails->emails['WC_Email_New_Order'], 'trigger'), 10);
 }
开发者ID:galapas,项目名称:opentickets-community,代码行数:14,代码来源:admin.class.php

示例12: invoice_scheduled_orders

 /**
  * Send an invoice for a scheduled order when the post date passes the current date
  */
 public static function invoice_scheduled_orders()
 {
     global $wpdb;
     $mailer = WC_Emails::instance();
     $date = date("Y-m-d H:i:s", current_time('timestamp'));
     $due_orders = $wpdb->get_col($wpdb->prepare("\n\t\t\tSELECT \tposts.ID\n\t\t\tFROM \t{$wpdb->posts} AS posts\n\t\t\tWHERE \tposts.post_type = 'shop_order'\n\t\t\tAND \tposts.post_status = 'wc-scheduled-payment'\n\t\t\tAND \tposts.post_date < %s\n\t\t", $date));
     if ($due_orders) {
         foreach ($due_orders as $due_order) {
             $order = wc_get_order($due_order);
             $order->update_status('pending', __('Scheduled order ready for payment.', 'woocommerce-deposits'));
             $mailer->customer_invoice($order);
         }
     }
 }
开发者ID:Veraxus,项目名称:wc-deposits-with-variations,代码行数:17,代码来源:class-wc-deposits-scheduled-order-manager.php

示例13: new_order

 /**
  * Send proforma invoice when order is created with status pending
  * 
  * @access public
  * @param int $order_id
  * @param array $posted
  * @return void
  */
 public function new_order($order_id, $posted)
 {
     if ($this->opt['woo_pdf_send_customer_invoice'] && class_exists('WC_Emails')) {
         $order = new WC_Order($order_id);
         $wc_emails = WC_Emails::instance();
         if (is_object($order) && is_object($wc_emails) && method_exists($wc_emails, 'customer_invoice')) {
             $wc_emails->customer_invoice($order);
         }
     }
 }
开发者ID:ardiqghenatya,项目名称:web4,代码行数:18,代码来源:woocommerce-pdf-invoice.php

示例14: handler_wc_init

	/**
	 * Needed to load email classes in admin to adjust optionsv and add additional hook
	 */
	public function handler_wc_init()
	{
		if( is_admin() ) 
		{
				//	fires wc_email_classes -> handler_wc_email_classes
			$wc_emails = WC_Emails::instance();
			unset( $wc_emails );
		}
	}
开发者ID:qhuit,项目名称:dcosta,代码行数:12,代码来源:class-wc-email-att.php

示例15: send

 /**
  * Send an email
  *
  * @param Email $email
  * @param string $recipient
  *
  * @return bool
  */
 public function send(Email $email, $recipient)
 {
     $wc_emails = \WC_Emails::instance();
     return $wc_emails->send($recipient, $email->get_subject(), $email->get_content());
 }
开发者ID:yehudah,项目名称:license-wp,代码行数:13,代码来源:Manager.php


注:本文中的WC_Emails::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。