Contact Form 7 - Version 3.0

Version Description

Download this release

Release Info

Developer takayukister
Plugin Icon 128x128 Contact Form 7
Version 3.0
Comparing to
See all releases

Code changes from version 3.0-beta to 3.0

includes/classes.php CHANGED
@@ -253,7 +253,8 @@ class WPCF7_ContactForm {
253
  if ( $this->mail_2['active'] )
254
  $additional_mail[] = $this->mail_2;
255
 
256
- $additional_mail = apply_filters( 'wpcf7_additional_mail', $additional_mail, $this );
 
257
 
258
  foreach ( $additional_mail as $mail )
259
  $this->compose_and_send_mail( $mail );
@@ -294,8 +295,9 @@ class WPCF7_ContactForm {
294
  $attachments[] = $path;
295
  }
296
 
297
- extract( apply_filters( 'wpcf7_mail_components', compact(
298
- 'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments' ) ) );
 
299
 
300
  $headers = "From: $sender\n";
301
 
@@ -408,14 +410,11 @@ class WPCF7_ContactForm {
408
  $post_id = wp_insert_post( $postarr );
409
 
410
  if ( $post_id ) {
411
- $props = apply_filters( 'wpcf7_contact_form_properties',
412
- array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ),
413
- 'save' );
414
-
415
- foreach ( (array) $props as $prop ) {
416
- if ( isset( $this->{$prop} ) )
417
- update_post_meta( $post_id, $prop, $this->{$prop} );
418
- }
419
 
420
  if ( $this->initial ) {
421
  $this->initial = false;
@@ -436,12 +435,13 @@ class WPCF7_ContactForm {
436
  $new->initial = true;
437
  $new->title = $this->title . '_copy';
438
 
439
- $props = apply_filters( 'wpcf7_contact_form_properties',
440
- array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ),
441
- 'copy' );
 
 
442
 
443
- foreach ( (array) $props as $prop )
444
- $new->{$prop} = $this->{$prop};
445
 
446
  return $new;
447
  }
@@ -467,15 +467,16 @@ function wpcf7_contact_form( $id ) {
467
  $contact_form->id = $post->ID;
468
  $contact_form->title = $post->post_title;
469
 
470
- $props = apply_filters( 'wpcf7_contact_form_properties',
471
- array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ),
472
- 'new' );
473
-
474
- foreach ( (array) $props as $prop )
475
- $contact_form->{$prop} = get_post_meta( $post->ID, $prop, true );
476
 
477
  $contact_form->upgrade();
478
 
 
 
479
  return $contact_form;
480
  }
481
 
@@ -522,16 +523,18 @@ function wpcf7_get_contact_form_default_pack( $args = '' ) {
522
 
523
  $contact_form->title = ( $title ? $title : __( 'Untitled', 'wpcf7' ) );
524
 
525
- $props = apply_filters( 'wpcf7_contact_form_properties',
526
- array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ),
527
- 'default' );
528
-
529
- foreach ( (array) $props as $prop )
530
- $contact_form->{$prop} = wpcf7_get_default_template( $prop );
531
 
532
  if ( isset( $mo_orig ) )
533
  $l10n['wpcf7'] = $mo_orig;
534
 
 
 
 
535
  return $contact_form;
536
  }
537
 
253
  if ( $this->mail_2['active'] )
254
  $additional_mail[] = $this->mail_2;
255
 
256
+ $additional_mail = apply_filters_ref_array( 'wpcf7_additional_mail',
257
+ array( $additional_mail, &$this ) );
258
 
259
  foreach ( $additional_mail as $mail )
260
  $this->compose_and_send_mail( $mail );
295
  $attachments[] = $path;
296
  }
297
 
298
+ extract( apply_filters_ref_array( 'wpcf7_mail_components', array(
299
+ compact( 'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments' ),
300
+ &$this ) ) );
301
 
302
  $headers = "From: $sender\n";
303
 
410
  $post_id = wp_insert_post( $postarr );
411
 
412
  if ( $post_id ) {
413
+ update_post_meta( $post_id, 'form', $this->form );
414
+ update_post_meta( $post_id, 'mail', $this->mail );
415
+ update_post_meta( $post_id, 'mail_2', $this->mail_2 );
416
+ update_post_meta( $post_id, 'messages', $this->messages );
417
+ update_post_meta( $post_id, 'additional_settings', $this->additional_settings );
 
 
 
418
 
419
  if ( $this->initial ) {
420
  $this->initial = false;
435
  $new->initial = true;
436
  $new->title = $this->title . '_copy';
437
 
438
+ $new->form = $this->form;
439
+ $new->mail = $this->mail;
440
+ $new->mail_2 = $this->mail_2;
441
+ $new->messages = $this->messages;
442
+ $new->additional_settings = $this->additional_settings;
443
 
444
+ $new = apply_filters_ref_array( 'wpcf7_copy', array( &$new, &$this ) );
 
445
 
446
  return $new;
447
  }
467
  $contact_form->id = $post->ID;
468
  $contact_form->title = $post->post_title;
469
 
470
+ $contact_form->form = get_post_meta( $post->ID, 'form', true );
471
+ $contact_form->mail = get_post_meta( $post->ID, 'mail', true );
472
+ $contact_form->mail_2 = get_post_meta( $post->ID, 'mail_2', true );
473
+ $contact_form->messages = get_post_meta( $post->ID, 'messages', true );
474
+ $contact_form->additional_settings = get_post_meta( $post->ID, 'additional_settings', true );
 
475
 
476
  $contact_form->upgrade();
477
 
478
+ $contact_form = apply_filters_ref_array( 'wpcf7_contact_form', array( &$contact_form ) );
479
+
480
  return $contact_form;
481
  }
482
 
523
 
524
  $contact_form->title = ( $title ? $title : __( 'Untitled', 'wpcf7' ) );
525
 
526
+ $contact_form->form = wpcf7_get_default_template( 'form' );
527
+ $contact_form->mail = wpcf7_get_default_template( 'mail' );
528
+ $contact_form->mail_2 = wpcf7_get_default_template( 'mail_2' );
529
+ $contact_form->messages = wpcf7_get_default_template( 'messages' );
530
+ $contact_form->additional_settings = wpcf7_get_default_template( 'additional_settings' );
 
531
 
532
  if ( isset( $mo_orig ) )
533
  $l10n['wpcf7'] = $mo_orig;
534
 
535
+ $contact_form = apply_filters_ref_array( 'wpcf7_contact_form_default_pack',
536
+ array( &$contact_form, $args ) );
537
+
538
  return $contact_form;
539
  }
540
 
includes/formatting.php CHANGED
@@ -76,62 +76,6 @@ function wpcf7_canonicalize( $text ) {
76
  return $text;
77
  }
78
 
79
- function wpcf7_sanitize_file_name( $filename ) {
80
- /* Memo:
81
- // This function does sanitization introduced in http://core.trac.wordpress.org/ticket/11122
82
- // WordPress 2.8.6 will implement it in sanitize_file_name().
83
- // While Contact Form 7's file uploading function uses wp_unique_filename(), and
84
- // it in turn calls sanitize_file_name(). Therefore this wpcf7_sanitize_file_name() will be
85
- // redundant and unnecessary when you use Contact Form 7 on WordPress 2.8.6 or higher.
86
- // This function is provided just for the sake of protecting who uses older WordPress.
87
- */
88
-
89
- // Split the filename into a base and extension[s]
90
- $parts = explode( '.', $filename );
91
-
92
- // Return if only one extension
93
- if ( count( $parts ) <= 2 )
94
- return $filename;
95
-
96
- // Process multiple extensions
97
- $filename = array_shift( $parts );
98
- $extension = array_pop( $parts );
99
-
100
- $mimes = array( 'jpg|jpeg|jpe', 'gif', 'png', 'bmp',
101
- 'tif|tiff', 'ico', 'asf|asx|wax|wmv|wmx', 'avi',
102
- 'divx', 'mov|qt', 'mpeg|mpg|mpe', 'txt|c|cc|h',
103
- 'rtx', 'css', 'htm|html', 'mp3|m4a', 'mp4|m4v',
104
- 'ra|ram', 'wav', 'ogg', 'mid|midi', 'wma', 'rtf',
105
- 'js', 'pdf', 'doc|docx', 'pot|pps|ppt|pptx', 'wri',
106
- 'xla|xls|xlsx|xlt|xlw', 'mdb', 'mpp', 'swf', 'class',
107
- 'tar', 'zip', 'gz|gzip', 'exe',
108
- // openoffice formats
109
- 'odt', 'odp', 'ods', 'odg', 'odc', 'odb', 'odf' );
110
-
111
- // Loop over any intermediate extensions.
112
- // Munge them with a trailing underscore if they are a 2 - 5 character
113
- // long alpha string not in the extension whitelist.
114
- foreach ( (array) $parts as $part) {
115
- $filename .= '.' . $part;
116
-
117
- if ( preg_match( '/^[a-zA-Z]{2,5}\d?$/', $part ) ) {
118
- $allowed = false;
119
- foreach ( $mimes as $ext_preg ) {
120
- $ext_preg = '!(^' . $ext_preg . ')$!i';
121
- if ( preg_match( $ext_preg, $part ) ) {
122
- $allowed = true;
123
- break;
124
- }
125
- }
126
- if ( ! $allowed )
127
- $filename .= '_';
128
- }
129
- }
130
- $filename .= '.' . $extension;
131
-
132
- return $filename;
133
- }
134
-
135
  function wpcf7_is_name( $string ) {
136
  // See http://www.w3.org/TR/html401/types.html#h-6.2
137
  // ID and NAME tokens must begin with a letter ([A-Za-z])
76
  return $text;
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  function wpcf7_is_name( $string ) {
80
  // See http://www.w3.org/TR/html401/types.html#h-6.2
81
  // ID and NAME tokens must begin with a letter ([A-Za-z])
includes/functions.php CHANGED
@@ -9,7 +9,7 @@ function wpcf7_messages() {
9
 
10
  'mail_sent_ng' => array(
11
  'description' => __( "Sender's message was failed to send", 'wpcf7' ),
12
- 'default' => __( 'Failed to send your message. Please try later or contact administrator by other way.', 'wpcf7' )
13
  ),
14
 
15
  'validation_error' => array(
9
 
10
  'mail_sent_ng' => array(
11
  'description' => __( "Sender's message was failed to send", 'wpcf7' ),
12
+ 'default' => __( 'Failed to send your message. Please try later or contact the administrator by another method.', 'wpcf7' )
13
  ),
14
 
15
  'validation_error' => array(
languages/wpcf7-es_ES.mo CHANGED
Binary file
languages/wpcf7-ja.mo CHANGED
Binary file
languages/wpcf7.pot CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Contact Form 7\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2011-08-20 16:08+0900\n"
6
- "PO-Revision-Date: 2011-08-20 16:09+0900\n"
7
  "Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
@@ -19,15 +19,15 @@ msgstr ""
19
  msgid "Just another contact form plugin. Simple but flexible."
20
  msgstr ""
21
 
22
- #: contact-form-7/settings.php:127
23
  msgid "Contact Forms"
24
  msgstr ""
25
 
26
- #: contact-form-7/settings.php:128
27
  msgid "Contact Form"
28
  msgstr ""
29
 
30
- #: contact-form-7/settings.php:197
31
  #, php-format
32
  msgid "Contact form %d"
33
  msgstr ""
@@ -215,7 +215,7 @@ msgstr ""
215
  msgid "Message body:"
216
  msgstr ""
217
 
218
- #: contact-form-7/includes/classes.php:523
219
  msgid "Untitled"
220
  msgstr ""
221
 
@@ -233,7 +233,7 @@ msgstr ""
233
 
234
  #: contact-form-7/includes/functions.php:12
235
  #: contact-form-7/modules/akismet.php:101
236
- msgid "Failed to send your message. Please try later or contact administrator by other way."
237
  msgstr ""
238
 
239
  #: contact-form-7/includes/functions.php:16
@@ -643,7 +643,7 @@ msgid "Radio buttons"
643
  msgstr ""
644
 
645
  #: contact-form-7/modules/checkbox.php:207
646
- #: contact-form-7/modules/file.php:243
647
  #: contact-form-7/modules/select.php:159
648
  #: contact-form-7/modules/text.php:161
649
  #: contact-form-7/modules/textarea.php:134
@@ -679,59 +679,59 @@ msgstr ""
679
  msgid "And, put this code into the Mail fields below."
680
  msgstr ""
681
 
682
- #: contact-form-7/modules/file.php:207
683
  msgid "Uploading a file fails for any reason"
684
  msgstr ""
685
 
686
- #: contact-form-7/modules/file.php:208
687
  msgid "Failed to upload file."
688
  msgstr ""
689
 
690
- #: contact-form-7/modules/file.php:212
691
  msgid "Uploaded file is not allowed file type"
692
  msgstr ""
693
 
694
- #: contact-form-7/modules/file.php:213
695
  msgid "This file type is not allowed."
696
  msgstr ""
697
 
698
- #: contact-form-7/modules/file.php:217
699
  msgid "Uploaded file is too large"
700
  msgstr ""
701
 
702
- #: contact-form-7/modules/file.php:218
703
  msgid "This file is too large."
704
  msgstr ""
705
 
706
- #: contact-form-7/modules/file.php:222
707
  msgid "Uploading a file fails for PHP error"
708
  msgstr ""
709
 
710
- #: contact-form-7/modules/file.php:223
711
  msgid "Failed to upload file. Error occurred."
712
  msgstr ""
713
 
714
- #: contact-form-7/modules/file.php:234
715
  msgid "File upload"
716
  msgstr ""
717
 
718
- #: contact-form-7/modules/file.php:257
719
  msgid "File size limit"
720
  msgstr ""
721
 
722
- #: contact-form-7/modules/file.php:257
723
  msgid "bytes"
724
  msgstr ""
725
 
726
- #: contact-form-7/modules/file.php:260
727
  msgid "Acceptable file types"
728
  msgstr ""
729
 
730
- #: contact-form-7/modules/file.php:267
731
  msgid "And, put this code into the File Attachments field below."
732
  msgstr ""
733
 
734
- #: contact-form-7/modules/file.php:292
735
  #, php-format
736
  msgid "This contact form contains file uploading fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually."
737
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: Contact Form 7\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-09-17 22:01+0900\n"
6
+ "PO-Revision-Date: 2011-09-17 22:01+0900\n"
7
  "Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
19
  msgid "Just another contact form plugin. Simple but flexible."
20
  msgstr ""
21
 
22
+ #: contact-form-7/settings.php:99
23
  msgid "Contact Forms"
24
  msgstr ""
25
 
26
+ #: contact-form-7/settings.php:100
27
  msgid "Contact Form"
28
  msgstr ""
29
 
30
+ #: contact-form-7/settings.php:191
31
  #, php-format
32
  msgid "Contact form %d"
33
  msgstr ""
215
  msgid "Message body:"
216
  msgstr ""
217
 
218
+ #: contact-form-7/includes/classes.php:524
219
  msgid "Untitled"
220
  msgstr ""
221
 
233
 
234
  #: contact-form-7/includes/functions.php:12
235
  #: contact-form-7/modules/akismet.php:101
236
+ msgid "Failed to send your message. Please try later or contact the administrator by another method."
237
  msgstr ""
238
 
239
  #: contact-form-7/includes/functions.php:16
643
  msgstr ""
644
 
645
  #: contact-form-7/modules/checkbox.php:207
646
+ #: contact-form-7/modules/file.php:240
647
  #: contact-form-7/modules/select.php:159
648
  #: contact-form-7/modules/text.php:161
649
  #: contact-form-7/modules/textarea.php:134
679
  msgid "And, put this code into the Mail fields below."
680
  msgstr ""
681
 
682
+ #: contact-form-7/modules/file.php:204
683
  msgid "Uploading a file fails for any reason"
684
  msgstr ""
685
 
686
+ #: contact-form-7/modules/file.php:205
687
  msgid "Failed to upload file."
688
  msgstr ""
689
 
690
+ #: contact-form-7/modules/file.php:209
691
  msgid "Uploaded file is not allowed file type"
692
  msgstr ""
693
 
694
+ #: contact-form-7/modules/file.php:210
695
  msgid "This file type is not allowed."
696
  msgstr ""
697
 
698
+ #: contact-form-7/modules/file.php:214
699
  msgid "Uploaded file is too large"
700
  msgstr ""
701
 
702
+ #: contact-form-7/modules/file.php:215
703
  msgid "This file is too large."
704
  msgstr ""
705
 
706
+ #: contact-form-7/modules/file.php:219
707
  msgid "Uploading a file fails for PHP error"
708
  msgstr ""
709
 
710
+ #: contact-form-7/modules/file.php:220
711
  msgid "Failed to upload file. Error occurred."
712
  msgstr ""
713
 
714
+ #: contact-form-7/modules/file.php:231
715
  msgid "File upload"
716
  msgstr ""
717
 
718
+ #: contact-form-7/modules/file.php:254
719
  msgid "File size limit"
720
  msgstr ""
721
 
722
+ #: contact-form-7/modules/file.php:254
723
  msgid "bytes"
724
  msgstr ""
725
 
726
+ #: contact-form-7/modules/file.php:257
727
  msgid "Acceptable file types"
728
  msgstr ""
729
 
730
+ #: contact-form-7/modules/file.php:264
731
  msgid "And, put this code into the File Attachments field below."
732
  msgstr ""
733
 
734
+ #: contact-form-7/modules/file.php:289
735
  #, php-format
736
  msgid "This contact form contains file uploading fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually."
737
  msgstr ""
modules/akismet.php CHANGED
@@ -98,7 +98,7 @@ add_filter( 'wpcf7_messages', 'wpcf7_akismet_messages' );
98
  function wpcf7_akismet_messages( $messages ) {
99
  return array_merge( $messages, array( 'akismet_says_spam' => array(
100
  'description' => __( "Akismet judged the sending activity as spamming", 'wpcf7' ),
101
- 'default' => __( 'Failed to send your message. Please try later or contact administrator by other way.', 'wpcf7' )
102
  ) ) );
103
  }
104
 
98
  function wpcf7_akismet_messages( $messages ) {
99
  return array_merge( $messages, array( 'akismet_says_spam' => array(
100
  'description' => __( "Akismet judged the sending activity as spamming", 'wpcf7' ),
101
+ 'default' => __( 'Failed to send your message. Please try later or contact the administrator by another method.', 'wpcf7' )
102
  ) ) );
103
  }
104
 
modules/file.php CHANGED
@@ -171,9 +171,6 @@ function wpcf7_file_validation_filter( $result, $tag ) {
171
  if ( preg_match( '/\.(php|pl|py|rb|cgi)\d?$/', $filename ) )
172
  $filename .= '.txt';
173
 
174
- // foo.php.jpg => foo.php_.jpg
175
- $filename = wpcf7_sanitize_file_name( $filename );
176
-
177
  $filename = wp_unique_filename( $uploads_dir, $filename );
178
 
179
  $new_file = trailingslashit( $uploads_dir ) . $filename;
171
  if ( preg_match( '/\.(php|pl|py|rb|cgi)\d?$/', $filename ) )
172
  $filename .= '.txt';
173
 
 
 
 
174
  $filename = wp_unique_filename( $uploads_dir, $filename );
175
 
176
  $new_file = trailingslashit( $uploads_dir ) . $filename;
readme.txt CHANGED
@@ -68,7 +68,7 @@ It is hard to continue development and support for this plugin without contribut
68
  * Sinhala (si_LK) - [Nitin Aggarwal](http://offshoreally.com/)
69
  * Slovak (sk) - [Patrik Bóna](http://www.mrhead.sk/)
70
  * Slovene (sl_SI) - [Mihael Simonič](http://smihael.bplaced.net)
71
- * Spanish (es_ES) - [Jordi Sancho](http://www.qasolutions.net/blog), [Vladimir Prieto](http://vladimir.prie.to/), [Federico Mikaelian](http://www.fedemika.com.ar/), [Matias Baldanza](http://matiasbaldanza.com/)
72
  * Swedish (sv_SE) - [Fredrik Jonsson](http://www.fredda-o-ac.se/), [the Swedish community](http://wp-support.se/)
73
  * Tamil (ta) - [Nitin Aggarwal](http://offshoreally.com/)
74
  * Thai (th) - [kazama](http://blog.wordthai.com/)
@@ -97,3 +97,18 @@ Do you have questions or issues with Contact Form 7? Use these support channels
97
  1. [WordPress HelpCenter](http://wphelpcenter.com/)
98
 
99
  [Support](http://contactform7.com/support/)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  * Sinhala (si_LK) - [Nitin Aggarwal](http://offshoreally.com/)
69
  * Slovak (sk) - [Patrik Bóna](http://www.mrhead.sk/)
70
  * Slovene (sl_SI) - [Mihael Simonič](http://smihael.bplaced.net)
71
+ * Spanish (es_ES) - [Jordi Sancho](http://www.qasolutions.net/blog), [Vladimir Prieto](http://vladimir.prie.to/), [Federico Mikaelian](http://www.fedemika.com.ar/), [Matias Baldanza](http://matiasbaldanza.com/), [Carlos Agnese](http://albumdecarlitos.com.ar/)
72
  * Swedish (sv_SE) - [Fredrik Jonsson](http://www.fredda-o-ac.se/), [the Swedish community](http://wp-support.se/)
73
  * Tamil (ta) - [Nitin Aggarwal](http://offshoreally.com/)
74
  * Thai (th) - [kazama](http://blog.wordthai.com/)
97
  1. [WordPress HelpCenter](http://wphelpcenter.com/)
98
 
99
  [Support](http://contactform7.com/support/)
100
+
101
+ == Screenshots ==
102
+
103
+ 1. screenshot-1.png
104
+
105
+ == Changelog ==
106
+
107
+ = 3.0 =
108
+
109
+ * Contact Form 7 3.0 utilizes Custom Post Types feature to save contact forms. It does not create its own table (contact_form_7) anymore.
110
+ * New shortcode format has been introduced. New format is like this: [contact-form-7 id="1234" title="Contact form 1"]. Note that new one starts with contact-form-7 instead of contact-form.
111
+ * Contact Form 7 3.0 works with WordPress version 3.2 or higher. This also means that you need PHP version 5.2.4 or higher and MySQL version 5.0 or higher (these are minimum requirements for WordPress 3.2).
112
+ * Translations for Japanese, German, Georgian, Italian and Spanish have been updated.
113
+ * Admin panel has been enhanced. Now it uses meta boxes.
114
+ * Bundled jquery.form.js has been updated to 2.84.
settings.php CHANGED
@@ -81,9 +81,31 @@ function wpcf7_load_modules() {
81
  }
82
  }
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  /* Upgrading */
85
 
86
- add_action( 'plugins_loaded', 'wpcf7_upgrade', 5 );
87
 
88
  function wpcf7_upgrade() {
89
  $opt = get_option( 'wpcf7' );
@@ -109,28 +131,6 @@ function wpcf7_upgrade() {
109
  }
110
  }
111
 
112
- /* L10N */
113
-
114
- add_action( 'init', 'wpcf7_load_plugin_textdomain' );
115
-
116
- function wpcf7_load_plugin_textdomain() {
117
- load_plugin_textdomain( 'wpcf7', false, 'contact-form-7/languages' );
118
- }
119
-
120
- /* Custom Post Type: Contact Form */
121
-
122
- add_action( 'init', 'wpcf7_register_post_types' );
123
-
124
- function wpcf7_register_post_types() {
125
- $args = array(
126
- 'labels' => array(
127
- 'name' => __( 'Contact Forms', 'wpcf7' ),
128
- 'singular_name' => __( 'Contact Form', 'wpcf7' ) )
129
- );
130
-
131
- register_post_type( 'wpcf7_contact_form', $args );
132
- }
133
-
134
  add_action( 'wpcf7_upgrade', 'wpcf7_convert_to_cpt', 10, 2 );
135
 
136
  function wpcf7_convert_to_cpt( $new_ver, $old_ver ) {
@@ -177,30 +177,20 @@ function wpcf7_convert_to_cpt( $new_ver, $old_ver ) {
177
  add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install' );
178
 
179
  function wpcf7_install() {
180
- $opt = get_option( 'wpcf7' );
181
-
182
- if ( ! is_array( $opt ) )
183
- $opt = array();
184
-
185
- $contact_forms = get_posts( array(
186
- 'numberposts' => -1,
187
- 'orderby' => 'ID',
188
- 'order' => 'ASC',
189
- 'post_type' => 'wpcf7_contact_form' ) );
190
-
191
- if ( $opt || $contact_forms )
192
  return;
193
 
194
  wpcf7_load_plugin_textdomain();
 
 
 
 
 
195
 
196
  $contact_form = wpcf7_get_contact_form_default_pack(
197
  array( 'title' => sprintf( __( 'Contact form %d', 'wpcf7' ), 1 ) ) );
198
 
199
  $contact_form->save();
200
-
201
- $opt['version'] = WPCF7_VERSION;
202
-
203
- update_option( 'wpcf7', $opt );
204
  }
205
 
206
  ?>
81
  }
82
  }
83
 
84
+ /* L10N */
85
+
86
+ add_action( 'init', 'wpcf7_load_plugin_textdomain' );
87
+
88
+ function wpcf7_load_plugin_textdomain() {
89
+ load_plugin_textdomain( 'wpcf7', false, 'contact-form-7/languages' );
90
+ }
91
+
92
+ /* Custom Post Type: Contact Form */
93
+
94
+ add_action( 'init', 'wpcf7_register_post_types' );
95
+
96
+ function wpcf7_register_post_types() {
97
+ $args = array(
98
+ 'labels' => array(
99
+ 'name' => __( 'Contact Forms', 'wpcf7' ),
100
+ 'singular_name' => __( 'Contact Form', 'wpcf7' ) )
101
+ );
102
+
103
+ register_post_type( 'wpcf7_contact_form', $args );
104
+ }
105
+
106
  /* Upgrading */
107
 
108
+ add_action( 'init', 'wpcf7_upgrade' );
109
 
110
  function wpcf7_upgrade() {
111
  $opt = get_option( 'wpcf7' );
131
  }
132
  }
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  add_action( 'wpcf7_upgrade', 'wpcf7_convert_to_cpt', 10, 2 );
135
 
136
  function wpcf7_convert_to_cpt( $new_ver, $old_ver ) {
177
  add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install' );
178
 
179
  function wpcf7_install() {
180
+ if ( $opt = get_option( 'wpcf7' ) )
 
 
 
 
 
 
 
 
 
 
 
181
  return;
182
 
183
  wpcf7_load_plugin_textdomain();
184
+ wpcf7_register_post_types();
185
+ wpcf7_upgrade();
186
+
187
+ if ( get_posts( array( 'post_type' => 'wpcf7_contact_form' ) ) )
188
+ return;
189
 
190
  $contact_form = wpcf7_get_contact_form_default_pack(
191
  array( 'title' => sprintf( __( 'Contact form %d', 'wpcf7' ), 1 ) ) );
192
 
193
  $contact_form->save();
 
 
 
 
194
  }
195
 
196
  ?>
uninstall.php CHANGED
@@ -8,6 +8,14 @@ function wpcf7_delete_plugin() {
8
 
9
  delete_option( 'wpcf7' );
10
 
 
 
 
 
 
 
 
 
11
  $table_name = $wpdb->prefix . "contact_form_7";
12
 
13
  $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
8
 
9
  delete_option( 'wpcf7' );
10
 
11
+ $posts = get_posts( array(
12
+ 'numberposts' => -1,
13
+ 'post_type' => 'wpcf7_contact_form',
14
+ 'post_status' => 'any' ) );
15
+
16
+ foreach ( $posts as $post )
17
+ wp_delete_post( $post->ID, true );
18
+
19
  $table_name = $wpdb->prefix . "contact_form_7";
20
 
21
  $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
wp-contact-form-7.php CHANGED
@@ -7,7 +7,7 @@ Author: Takayuki Miyoshi
7
  Author URI: http://ideasilo.wordpress.com/
8
  Text Domain: wpcf7
9
  Domain Path: /languages/
10
- Version: 3.0-beta
11
  */
12
 
13
  /* Copyright 2007-2011 Takayuki Miyoshi (email: takayukister at gmail.com)
@@ -27,7 +27,7 @@ Version: 3.0-beta
27
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
  */
29
 
30
- define( 'WPCF7_VERSION', '3.0-beta' );
31
 
32
  if ( ! defined( 'WPCF7_PLUGIN_BASENAME' ) )
33
  define( 'WPCF7_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
7
  Author URI: http://ideasilo.wordpress.com/
8
  Text Domain: wpcf7
9
  Domain Path: /languages/
10
+ Version: 3.0
11
  */
12
 
13
  /* Copyright 2007-2011 Takayuki Miyoshi (email: takayukister at gmail.com)
27
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
  */
29
 
30
+ define( 'WPCF7_VERSION', '3.0' );
31
 
32
  if ( ! defined( 'WPCF7_PLUGIN_BASENAME' ) )
33
  define( 'WPCF7_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );