MW WP Form - Version 1.2.8

Version Description

  • Added : {}
Download this release

Release Info

Developer inc2734
Plugin Icon wp plugin MW WP Form
Version 1.2.8
Comparing to
See all releases

Code changes from version 1.2.7 to 1.2.8

Files changed (2) hide show
  1. mw-wp-form.php +51 -35
  2. readme.txt +4 -1
mw-wp-form.php CHANGED
@@ -3,11 +3,11 @@
3
  * Plugin Name: MW WP Form
4
  * Plugin URI: http://2inc.org/manual-mw-wp-form/
5
  * Description: MW WP Form can create mail form with a confirmation screen.
6
- * Version: 1.2.7
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : September 25, 2012
10
- * Modified: January 7, 2014
11
  * Text Domain: mw-wp-form
12
  * Domain Path: /languages/
13
  * License: GPL2
@@ -552,23 +552,25 @@ class mw_wp_form {
552
  if ( $mailto = $this->options_by_formkey['mail_to'] )
553
  $Mail->to = $mailto;
554
  // 送信元を指定
555
- $from = get_bloginfo( 'admin_email' );
556
- if ( !empty( $this->options_by_formkey['admin_mail_from'] ) )
557
- $from = $this->options_by_formkey['admin_mail_from'];
 
 
 
558
  $Mail->from = $from;
559
  // 送信者を指定
560
- $sender = get_bloginfo( 'name' );
561
- if ( !empty( $this->options_by_formkey['admin_mail_sender'] ) )
562
- $sender = $this->options_by_formkey['admin_mail_sender'];
 
 
 
563
  $Mail->sender = $sender;
564
  // タイトルを指定
565
- $Mail->subject = $admin_mail_subject;
566
  // 本文を指定
567
- $Mail->body = preg_replace_callback(
568
- '/{(.+?)}/',
569
- array( $this, 'create_mail_body' ),
570
- $admin_mail_content
571
- );
572
  }
573
 
574
  $filter_name = 'mwform_mail_' . $this->key;
@@ -584,16 +586,12 @@ class mw_wp_form {
584
 
585
  // $this->insert_id を設定 ( save_mail_body で 使用 )
586
  $this->insert_id = wp_insert_post( array(
587
- 'post_title' => $admin_mail_subject,
588
  'post_status' => 'publish',
589
  'post_type' => MWF_Config::DBDATA . $this->options_by_formkey['post_id'],
590
  ) );
591
  // 保存
592
- preg_replace_callback(
593
- '/{(.+?)}/',
594
- array( $this, 'save_mail_body' ),
595
- $admin_mail_content
596
- );
597
 
598
  // 添付ファイルをメディアに保存
599
  if ( !empty( $this->insert_id ) ) {
@@ -625,23 +623,25 @@ class mw_wp_form {
625
  // 送信先を指定
626
  $Mail->to = $this->Data->getValue( $this->options_by_formkey['automatic_reply_email'] );
627
  // 送信元を指定
628
- $from = get_bloginfo( 'admin_email' );
629
- if ( !empty( $this->options_by_formkey['mail_from'] ) )
630
- $from = $this->options_by_formkey['mail_from'];
 
 
 
631
  $Mail->from = $from;
632
  // 送信者を指定
633
- $sender = get_bloginfo( 'name' );
634
- if ( !empty( $this->options_by_formkey['mail_sender'] ) )
635
- $sender = $this->options_by_formkey['mail_sender'];
 
 
 
636
  $Mail->sender = $sender;
637
  // タイトルを指定
638
- $Mail->subject = $this->options_by_formkey['mail_subject'];
639
  // 本文を指定
640
- $Mail->body = preg_replace_callback(
641
- '/{(.+?)}/',
642
- array( $this, 'create_mail_body' ),
643
- $this->options_by_formkey['mail_content']
644
- );
645
  // 自動返信メールからは添付ファイルを削除
646
  $Mail->attachments = array();
647
 
@@ -656,10 +656,19 @@ class mw_wp_form {
656
  }
657
 
658
  /**
659
- * create_mail_body
660
  * メール本文用に {name属性} を置換
 
 
661
  */
662
- public function create_mail_body( $matches ) {
 
 
 
 
 
 
 
663
  return $this->parse_mail_body( $matches, false );
664
  }
665
 
@@ -667,7 +676,14 @@ class mw_wp_form {
667
  * save_mail_body
668
  * DB保存用に {name属性} を置換、保存
669
  */
670
- public function save_mail_body( $matches ) {
 
 
 
 
 
 
 
671
  return $this->parse_mail_body( $matches, true );
672
  }
673
 
3
  * Plugin Name: MW WP Form
4
  * Plugin URI: http://2inc.org/manual-mw-wp-form/
5
  * Description: MW WP Form can create mail form with a confirmation screen.
6
+ * Version: 1.2.8
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : September 25, 2012
10
+ * Modified: January 15, 2014
11
  * Text Domain: mw-wp-form
12
  * Domain Path: /languages/
13
  * License: GPL2
552
  if ( $mailto = $this->options_by_formkey['mail_to'] )
553
  $Mail->to = $mailto;
554
  // 送信元を指定
555
+ if ( !empty( $this->options_by_formkey['admin_mail_from'] ) ) {
556
+ $from = $this->parse_mail_content( $this->options_by_formkey['admin_mail_from'] );
557
+ }
558
+ if ( empty( $from ) ) {
559
+ $from = get_bloginfo( 'admin_email' );
560
+ }
561
  $Mail->from = $from;
562
  // 送信者を指定
563
+ if ( !empty( $this->options_by_formkey['admin_mail_sender'] ) ) {
564
+ $sender = $this->parse_mail_content( $this->options_by_formkey['admin_mail_sender'] );
565
+ }
566
+ if ( empty( $sender ) ) {
567
+ $sender = get_bloginfo( 'name' );
568
+ }
569
  $Mail->sender = $sender;
570
  // タイトルを指定
571
+ $Mail->subject = $this->parse_mail_content( $admin_mail_subject );
572
  // 本文を指定
573
+ $Mail->body = $this->parse_mail_content( $admin_mail_content );
 
 
 
 
574
  }
575
 
576
  $filter_name = 'mwform_mail_' . $this->key;
586
 
587
  // $this->insert_id を設定 ( save_mail_body で 使用 )
588
  $this->insert_id = wp_insert_post( array(
589
+ 'post_title' => $Mail->subject,
590
  'post_status' => 'publish',
591
  'post_type' => MWF_Config::DBDATA . $this->options_by_formkey['post_id'],
592
  ) );
593
  // 保存
594
+ $this->save_mail_body( $admin_mail_content );
 
 
 
 
595
 
596
  // 添付ファイルをメディアに保存
597
  if ( !empty( $this->insert_id ) ) {
623
  // 送信先を指定
624
  $Mail->to = $this->Data->getValue( $this->options_by_formkey['automatic_reply_email'] );
625
  // 送信元を指定
626
+ if ( !empty( $this->options_by_formkey['mail_from'] ) ) {
627
+ $from = $this->parse_mail_content( $this->options_by_formkey['mail_from'] );
628
+ }
629
+ if ( empty( $from ) ) {
630
+ $from = get_bloginfo( 'admin_email' );
631
+ }
632
  $Mail->from = $from;
633
  // 送信者を指定
634
+ if ( !empty( $this->options_by_formkey['mail_sender'] ) ) {
635
+ $sender = $this->parse_mail_content( $this->options_by_formkey['mail_sender'] );
636
+ }
637
+ if ( empty( $sender ) ) {
638
+ $sender = get_bloginfo( 'name' );
639
+ }
640
  $Mail->sender = $sender;
641
  // タイトルを指定
642
+ $Mail->subject = $this->parse_mail_content( $this->options_by_formkey['mail_subject'] );
643
  // 本文を指定
644
+ $Mail->body = $this->parse_mail_content( $this->options_by_formkey['mail_content'] );
 
 
 
 
645
  // 自動返信メールからは添付ファイルを削除
646
  $Mail->attachments = array();
647
 
656
  }
657
 
658
  /**
659
+ * parse_mail_content
660
  * メール本文用に {name属性} を置換
661
+ * @param string $value
662
+ * @return string
663
  */
664
+ public function parse_mail_content( $value ) {
665
+ return preg_replace_callback(
666
+ '/{(.+?)}/',
667
+ array( $this, '_parse_mail_content' ),
668
+ $value
669
+ );
670
+ }
671
+ public function _parse_mail_content( $matches ) {
672
  return $this->parse_mail_body( $matches, false );
673
  }
674
 
676
  * save_mail_body
677
  * DB保存用に {name属性} を置換、保存
678
  */
679
+ public function save_mail_body( $value ) {
680
+ return preg_replace_callback(
681
+ '/{(.+?)}/',
682
+ array( $this, '_save_mail_body' ),
683
+ $value
684
+ );
685
+ }
686
+ public function _save_mail_body( $matches ) {
687
  return $this->parse_mail_body( $matches, true );
688
  }
689
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.amazon.co.jp/registry/wishlist/39ANKRNSTNW40
4
  Tags: plugin, form, confirm, preview, shortcode
5
  Requires at least: 3.4
6
  Tested up to: 3.8.0
7
- Stable tag: 1.2.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -47,6 +47,9 @@ Do you have questions or issues with MW WP Form? Use these support channels appr
47
 
48
  == Changelog ==
49
 
 
 
 
50
  = 1.2.7 =
51
  * Added : Support docx, xlsx, pptx upload.
52
  * Change : Change main process hook from get_header to template_include.
4
  Tags: plugin, form, confirm, preview, shortcode
5
  Requires at least: 3.4
6
  Tested up to: 3.8.0
7
+ Stable tag: 1.2.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
47
 
48
  == Changelog ==
49
 
50
+ = 1.2.8 =
51
+ * Added : 自動返信メール設定、管理者宛メール設定で本文の以外の項目にも{キー}を使用可能に
52
+
53
  = 1.2.7 =
54
  * Added : Support docx, xlsx, pptx upload.
55
  * Change : Change main process hook from get_header to template_include.