public static function get_instance() { if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
public function send_lostmail($uri){ $res = false; if( isset($_REQUEST['loginmail']) && !empty($_REQUEST['loginmail']) ){ $phrase_options = wc2_get_option('phrase'); $general = wc2_get_option('general'); $lostmail = $_REQUEST['loginmail']; $subject = apply_filters( 'wc2_filter_lostmail_subject', __('パスワード変更','wc2') ); $message = __('下記のURLをクリックしてパスワードの変更を行ってください。','wc2') . "\n\r\n\r\n\r" . $uri . "\n\r\n\r\n\r" . __('このメールにお心当たりがない場合は破棄していただきますようお願いいたします。','wc2') . "\n\r"; $message = apply_filters( 'wc2_filter_lostmail_message', $message, $uri ); $message .= apply_filters( 'wc2_filter_lostmail_footer', $phrase_options['footer']['othermail'] ); $wc2_mail = WC2_Mail::get_instance(); $wc2_mail->clear_column(); $wc2_mail->set_customer_para_value( 'to_name', __('パスワード変更手続き', 'wc2') ); $wc2_mail->set_customer_para_value( 'to_address', $lostmail ); $wc2_mail->set_customer_para_value( 'from_name', get_option('blogname') ); $wc2_mail->set_customer_para_value( 'from_address', $general['sender_mail'] ); $wc2_mail->set_customer_para_value( 'return_path', $general['sender_mail'] ); $wc2_mail->set_customer_para_value( 'subject', $subject ); $wc2_mail->set_customer_para_value( 'message', do_shortcode($message) ); do_action('wc2_action_send_lostmail_customer_para'); $res = $wc2_mail->send_customer_mail(); } if($res === false) { $this->error_message = __('メールを送信できませんでした。','wc2'); } return $res; }
function wc2_send_ordermail_admin() { $_POST = wc2_stripslashes_deep_post($_POST); $general_options = wc2_get_option('general'); $name = sprintf(__('Mr/Mrs %s', 'wc2'), trim(urldecode($_POST['name']))); $message = trim(urldecode($_POST['message'])); $wc2_mail = WC2_Mail::get_instance(); $wc2_mail->clear_column(); $wc2_mail->set_customer_para_value('to_name', $name); $wc2_mail->set_customer_para_value('to_address', trim(urldecode($_POST['mailaddress']))); $wc2_mail->set_customer_para_value('from_name', get_option('blogname')); $wc2_mail->set_customer_para_value('from_address', $general_options['sender_mail']); $wc2_mail->set_customer_para_value('return_path', $general_options['sender_mail']); $wc2_mail->set_customer_para_value('subject', trim(urldecode($_POST['subject']))); $wc2_mail->set_customer_para_value('message', $message); do_action('wc2_action_send_ordermail_admin_parameter_to_customer', $_POST['checked']); $res = $wc2_mail->send_customer_mail(); if ($res) { wc2_update_order_check($_POST['order_id'], $_POST['checked']); $wc2_mail->set_admin_para_value('to_name', 'Shop Admin'); $wc2_mail->set_admin_para_value('to_address', $general_options['order_mail']); $wc2_mail->set_admin_para_value('from_name', 'Welcart Auto BCC'); $wc2_mail->set_admin_para_value('from_address', $general_options['sender_mail']); $wc2_mail->set_admin_para_value('return_path', $general_options['sender_mail']); $wc2_mail->set_admin_para_value('subject', trim(urldecode($_POST['subject'])) . ' to ' . $name); $wc2_mail->set_admin_para_value('message', $message); do_action('wc2_action_send_ordermail_admin_parameter_to_manager', $_POST['checked']); $res = $wc2_mail->send_admin_mail(); return 'OK'; } else { return 'NG'; } }