Contact Form 7 - Version 2.4.6

Version Description

  • Fixed the bug that didn't accept '0' as valid value of drop-down menu.
  • Fixed the incorrect shortcode regexp blocking use of multiline content of textarea.
  • Updated jquery.form.js to 2.83.
  • Translations for Vietnamese (Khang Minh), Brazilian Portuguese (Caciano Gabriel Batista), Traditional Chinese (James Wu), Bahasa Indonesia (Belajar Seo Indonesia), German (Ivan Graf) and Hungarian (Farkas Gyz) have been updated.
Download this release

Release Info

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

Code changes from version 2.4.5 to 2.4.6

includes/classes.php CHANGED
@@ -37,11 +37,11 @@ class WPCF7_ContactForm {
37
  $fes = $this->form_scan_shortcode();
38
 
39
  foreach ( $fes as $fe ) {
40
- $name = $fe['name'];
41
-
42
- if ( empty( $name ) )
43
  continue;
44
 
 
 
45
  if ( isset( $_POST[$name] ) )
46
  unset( $_POST[$name] );
47
  }
@@ -238,7 +238,8 @@ class WPCF7_ContactForm {
238
  $fes = $this->form_scan_shortcode();
239
 
240
  foreach ( $fes as $fe ) {
241
- if ( ! is_array( $fe['options'] ) ) continue;
 
242
 
243
  if ( preg_grep( '%^akismet:author$%', $fe['options'] ) && '' == $author ) {
244
  $author = $_POST[$fe['name']];
37
  $fes = $this->form_scan_shortcode();
38
 
39
  foreach ( $fes as $fe ) {
40
+ if ( ! isset( $fe['name'] ) || empty( $fe['name'] ) )
 
 
41
  continue;
42
 
43
+ $name = $fe['name'];
44
+
45
  if ( isset( $_POST[$name] ) )
46
  unset( $_POST[$name] );
47
  }
238
  $fes = $this->form_scan_shortcode();
239
 
240
  foreach ( $fes as $fe ) {
241
+ if ( ! isset( $fe['name'] ) || ! is_array( $fe['options'] ) )
242
+ continue;
243
 
244
  if ( preg_grep( '%^akismet:author$%', $fe['options'] ) && '' == $author ) {
245
  $author = $_POST[$fe['name']];
includes/shortcodes.php CHANGED
@@ -72,7 +72,7 @@ class WPCF7_ShortcodeManager {
72
 
73
  return '(\[?)'
74
  . '\[(' . $tagregexp . ')(?:\s(.*?))?(?:\s(\/))?\]'
75
- . '(?:((?!.*?\[(?:' . $tagregexp . ')\s).+?)\[\/\2\])?'
76
  . '(\]?)';
77
  }
78
 
72
 
73
  return '(\[?)'
74
  . '\[(' . $tagregexp . ')(?:\s(.*?))?(?:\s(\/))?\]'
75
+ . '(?:([^[]*?)\[\/\2\])?'
76
  . '(\]?)';
77
  }
78
 
jquery.form.js CHANGED
@@ -1,6 +1,6 @@
1
  /*!
2
  * jQuery Form Plugin
3
- * version: 2.72 (28-APR-2011)
4
  * @requires jQuery v1.3.2 or later
5
  *
6
  * Examples and documentation at: http://malsup.com/jquery/form/
@@ -49,23 +49,26 @@ $.fn.ajaxSubmit = function(options) {
49
  log('ajaxSubmit: skipping submit process - no element selected');
50
  return this;
51
  }
 
 
52
 
53
  if (typeof options == 'function') {
54
  options = { success: options };
55
  }
56
 
57
- var action = this.attr('action');
58
- var url = (typeof action === 'string') ? $.trim(action) : '';
 
 
59
  if (url) {
60
  // clean url (don't include hash vaue)
61
  url = (url.match(/^([^#]+)/)||[])[1];
62
  }
63
- url = url || window.location.href || '';
64
 
65
  options = $.extend(true, {
66
  url: url,
67
  success: $.ajaxSettings.success,
68
- type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
69
  iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
70
  }, options);
71
 
@@ -124,7 +127,7 @@ $.fn.ajaxSubmit = function(options) {
124
  options.data = q; // data is the query string for 'post'
125
  }
126
 
127
- var $form = this, callbacks = [];
128
  if (options.resetForm) {
129
  callbacks.push(function() { $form.resetForm(); });
130
  }
@@ -162,13 +165,19 @@ $.fn.ajaxSubmit = function(options) {
162
  // hack to fix Safari hang (thanks to Tim Molendijk for this)
163
  // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
164
  if (options.closeKeepAlive) {
165
- $.get(options.closeKeepAlive, fileUpload);
166
  }
167
  else {
168
- fileUpload();
169
  }
170
  }
171
  else {
 
 
 
 
 
 
172
  $.ajax(options);
173
  }
174
 
@@ -178,8 +187,17 @@ $.fn.ajaxSubmit = function(options) {
178
 
179
 
180
  // private function for handling file uploads (hat tip to YAHOO!)
181
- function fileUpload() {
182
- var form = $form[0];
 
 
 
 
 
 
 
 
 
183
 
184
  if ($(':input[name=submit],:input[id=submit]', form).length) {
185
  // if there is an input with a name or id of 'submit' then we won't be
@@ -188,15 +206,25 @@ $.fn.ajaxSubmit = function(options) {
188
  return;
189
  }
190
 
191
- var s = $.extend(true, {}, $.ajaxSettings, options);
192
  s.context = s.context || s;
193
- var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
194
- var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" />');
195
- var io = $io[0];
 
 
 
 
 
 
 
 
 
 
 
196
 
197
- $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
198
 
199
- var xhr = { // mock object
200
  aborted: 0,
201
  responseText: null,
202
  responseXML: null,
@@ -211,13 +239,13 @@ $.fn.ajaxSubmit = function(options) {
211
  this.aborted = 1;
212
  $io.attr('src', s.iframeSrc); // abort op in progress
213
  xhr.error = e;
214
- s.error && s.error.call(s.context, xhr, e, e);
215
  g && $.event.trigger("ajaxError", [xhr, s, e]);
216
  s.complete && s.complete.call(s.context, xhr, e);
217
  }
218
  };
219
 
220
- var g = s.global;
221
  // trigger ajax global events so that activity/block indicators work like normal
222
  if (g && ! $.active++) {
223
  $.event.trigger("ajaxStart");
@@ -227,7 +255,7 @@ $.fn.ajaxSubmit = function(options) {
227
  }
228
 
229
  if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
230
- if (s.global) {
231
  $.active--;
232
  }
233
  return;
@@ -236,12 +264,10 @@ $.fn.ajaxSubmit = function(options) {
236
  return;
237
  }
238
 
239
- var timedOut = 0, timeoutHandle;
240
-
241
  // add submitting element to data if we know it
242
- var sub = form.clk;
243
  if (sub) {
244
- var n = sub.name;
245
  if (n && !sub.disabled) {
246
  s.extraData = s.extraData || {};
247
  s.extraData[n] = sub.value;
@@ -251,7 +277,15 @@ $.fn.ajaxSubmit = function(options) {
251
  }
252
  }
253
  }
 
 
 
254
 
 
 
 
 
 
255
  // take a breath so that pending repaints get some cpu time before the upload starts
256
  function doSubmit() {
257
  // make sure form attrs are set
@@ -259,15 +293,15 @@ $.fn.ajaxSubmit = function(options) {
259
 
260
  // update form attrs in IE friendly way
261
  form.setAttribute('target',id);
262
- if (form.getAttribute('method') != 'POST') {
263
  form.setAttribute('method', 'POST');
264
  }
265
- if (form.getAttribute('action') != s.url) {
266
  form.setAttribute('action', s.url);
267
  }
268
 
269
  // ie borks in some cases when setting encoding
270
- if (! s.skipEncodingOverride) {
271
  $form.attr({
272
  encoding: 'multipart/form-data',
273
  enctype: 'multipart/form-data'
@@ -276,7 +310,23 @@ $.fn.ajaxSubmit = function(options) {
276
 
277
  // support timout
278
  if (s.timeout) {
279
- timeoutHandle = setTimeout(function() { timedOut = true; cb(true); }, s.timeout);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  }
281
 
282
  // add "extra" data to form if provided in options
@@ -285,14 +335,17 @@ $.fn.ajaxSubmit = function(options) {
285
  if (s.extraData) {
286
  for (var n in s.extraData) {
287
  extraInputs.push(
288
- $('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
289
  .appendTo(form)[0]);
290
  }
291
  }
292
 
293
- // add iframe to doc and submit the form
294
- $io.appendTo('body');
295
- io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
 
 
 
296
  form.submit();
297
  }
298
  finally {
@@ -313,19 +366,29 @@ $.fn.ajaxSubmit = function(options) {
313
  else {
314
  setTimeout(doSubmit, 10); // this lets dom updates render
315
  }
316
-
317
  var data, doc, domCheckCount = 50, callbackProcessed;
318
 
319
  function cb(e) {
320
  if (xhr.aborted || callbackProcessed) {
321
  return;
322
  }
323
- if (e === true && xhr) {
 
 
 
 
 
 
 
324
  xhr.abort('timeout');
325
  return;
326
  }
327
-
328
- var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
 
 
 
329
  if (!doc || doc.location.href == s.iframeSrc) {
330
  // response not received yet
331
  if (!timedOut)
@@ -333,7 +396,7 @@ $.fn.ajaxSubmit = function(options) {
333
  }
334
  io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
335
 
336
- var ok = true;
337
  try {
338
  if (timedOut) {
339
  throw 'timeout';
@@ -355,66 +418,90 @@ $.fn.ajaxSubmit = function(options) {
355
  }
356
 
357
  //log('response detected');
358
- xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
 
359
  xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
360
- if (!xhr.responseText && xhr.responseXML && !s.dataType)
361
  s.dataType = 'xml';
362
  xhr.getResponseHeader = function(header){
363
  var headers = {'content-type': s.dataType};
364
  return headers[header];
365
  };
366
-
367
- var scr = /(json|script|text)/.test(s.dataType);
 
 
 
 
 
 
368
  if (scr || s.textarea) {
369
  // see if user embedded response in textarea
370
  var ta = doc.getElementsByTagName('textarea')[0];
371
  if (ta) {
372
  xhr.responseText = ta.value;
 
 
 
373
  }
374
  else if (scr) {
375
  // account for browsers injecting pre around json response
376
  var pre = doc.getElementsByTagName('pre')[0];
377
  var b = doc.getElementsByTagName('body')[0];
378
  if (pre) {
379
- xhr.responseText = pre.textContent;
380
  }
381
  else if (b) {
382
  xhr.responseText = b.innerHTML;
383
  }
384
- }
385
  }
386
  else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
387
  xhr.responseXML = toXml(xhr.responseText);
388
  }
389
-
390
- data = httpData(xhr, s.dataType, s);
 
 
 
 
 
 
391
  }
392
- catch(e){
393
- log('error caught:',e);
394
- ok = false;
395
- xhr.error = e;
396
- s.error && s.error.call(s.context, xhr, 'error', e);
397
- g && $.event.trigger("ajaxError", [xhr, s, e]);
398
  }
399
-
400
  if (xhr.aborted) {
401
  log('upload aborted');
402
- ok = false;
403
  }
404
 
 
 
 
 
405
  // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
406
- if (ok) {
407
  s.success && s.success.call(s.context, data, 'success', xhr);
408
  g && $.event.trigger("ajaxSuccess", [xhr, s]);
409
  }
410
-
 
 
 
 
 
 
411
  g && $.event.trigger("ajaxComplete", [xhr, s]);
412
 
413
  if (g && ! --$.active) {
414
  $.event.trigger("ajaxStop");
415
  }
416
-
417
- s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');
418
 
419
  callbackProcessed = true;
420
  if (s.timeout)
@@ -422,8 +509,8 @@ $.fn.ajaxSubmit = function(options) {
422
 
423
  // clean up
424
  setTimeout(function() {
425
- $io.removeData('form-plugin-onload');
426
- $io.remove();
427
  xhr.responseXML = null;
428
  }, 100);
429
  }
@@ -442,8 +529,9 @@ $.fn.ajaxSubmit = function(options) {
442
  var parseJSON = $.parseJSON || function(s) {
443
  return window['eval']('(' + s + ')');
444
  };
445
-
446
  var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
 
447
  var ct = xhr.getResponseHeader('content-type') || '',
448
  xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
449
  data = xml ? xhr.responseXML : xhr.responseText;
@@ -496,7 +584,7 @@ $.fn.ajaxForm = function(options) {
496
  log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
497
  return this;
498
  }
499
-
500
  return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
501
  if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
502
  e.preventDefault();
@@ -560,7 +648,7 @@ $.fn.formToArray = function(semantic) {
560
  if (!els) {
561
  return a;
562
  }
563
-
564
  var i,j,n,v,el,max,jmax;
565
  for(i=0, max=els.length; i < max; i++) {
566
  el = els[i];
@@ -745,9 +833,10 @@ $.fn.clearForm = function() {
745
  * Clears the selected form elements.
746
  */
747
  $.fn.clearFields = $.fn.clearInputs = function() {
 
748
  return this.each(function() {
749
  var t = this.type, tag = this.tagName.toLowerCase();
750
- if (t == 'text' || t == 'password' || tag == 'textarea') {
751
  this.value = '';
752
  }
753
  else if (t == 'checkbox' || t == 'radio') {
@@ -809,16 +898,13 @@ $.fn.selected = function(select) {
809
  };
810
 
811
  // helper fn for console logging
812
- // set $.fn.ajaxSubmit.debug to true to enable debug logging
813
  function log() {
814
- if ($.fn.ajaxSubmit.debug) {
815
- var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
816
- if (window.console && window.console.log) {
817
- window.console.log(msg);
818
- }
819
- else if (window.opera && window.opera.postError) {
820
- window.opera.postError(msg);
821
- }
822
  }
823
  };
824
 
1
  /*!
2
  * jQuery Form Plugin
3
+ * version: 2.83 (11-JUL-2011)
4
  * @requires jQuery v1.3.2 or later
5
  *
6
  * Examples and documentation at: http://malsup.com/jquery/form/
49
  log('ajaxSubmit: skipping submit process - no element selected');
50
  return this;
51
  }
52
+
53
+ var method, action, url, $form = this;
54
 
55
  if (typeof options == 'function') {
56
  options = { success: options };
57
  }
58
 
59
+ method = this.attr('method');
60
+ action = this.attr('action');
61
+ url = (typeof action === 'string') ? $.trim(action) : '';
62
+ url = url || window.location.href || '';
63
  if (url) {
64
  // clean url (don't include hash vaue)
65
  url = (url.match(/^([^#]+)/)||[])[1];
66
  }
 
67
 
68
  options = $.extend(true, {
69
  url: url,
70
  success: $.ajaxSettings.success,
71
+ type: method || 'GET',
72
  iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
73
  }, options);
74
 
127
  options.data = q; // data is the query string for 'post'
128
  }
129
 
130
+ var callbacks = [];
131
  if (options.resetForm) {
132
  callbacks.push(function() { $form.resetForm(); });
133
  }
165
  // hack to fix Safari hang (thanks to Tim Molendijk for this)
166
  // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
167
  if (options.closeKeepAlive) {
168
+ $.get(options.closeKeepAlive, function() { fileUpload(a); });
169
  }
170
  else {
171
+ fileUpload(a);
172
  }
173
  }
174
  else {
175
+ // IE7 massage (see issue 57)
176
+ if ($.browser.msie && method == 'get') {
177
+ var ieMeth = $form[0].getAttribute('method');
178
+ if (typeof ieMeth === 'string')
179
+ options.type = ieMeth;
180
+ }
181
  $.ajax(options);
182
  }
183
 
187
 
188
 
189
  // private function for handling file uploads (hat tip to YAHOO!)
190
+ function fileUpload(a) {
191
+ var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
192
+ var useProp = !!$.fn.prop;
193
+
194
+ if (a) {
195
+ // ensure that every serialized input is still enabled
196
+ for (i=0; i < a.length; i++) {
197
+ el = $(form[a[i].name]);
198
+ el[ useProp ? 'prop' : 'attr' ]('disabled', false);
199
+ }
200
+ }
201
 
202
  if ($(':input[name=submit],:input[id=submit]', form).length) {
203
  // if there is an input with a name or id of 'submit' then we won't be
206
  return;
207
  }
208
 
209
+ s = $.extend(true, {}, $.ajaxSettings, options);
210
  s.context = s.context || s;
211
+ id = 'jqFormIO' + (new Date().getTime());
212
+ if (s.iframeTarget) {
213
+ $io = $(s.iframeTarget);
214
+ n = $io.attr('name');
215
+ if (n == null)
216
+ $io.attr('name', id);
217
+ else
218
+ id = n;
219
+ }
220
+ else {
221
+ $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
222
+ $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
223
+ }
224
+ io = $io[0];
225
 
 
226
 
227
+ xhr = { // mock object
228
  aborted: 0,
229
  responseText: null,
230
  responseXML: null,
239
  this.aborted = 1;
240
  $io.attr('src', s.iframeSrc); // abort op in progress
241
  xhr.error = e;
242
+ s.error && s.error.call(s.context, xhr, e, status);
243
  g && $.event.trigger("ajaxError", [xhr, s, e]);
244
  s.complete && s.complete.call(s.context, xhr, e);
245
  }
246
  };
247
 
248
+ g = s.global;
249
  // trigger ajax global events so that activity/block indicators work like normal
250
  if (g && ! $.active++) {
251
  $.event.trigger("ajaxStart");
255
  }
256
 
257
  if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
258
+ if (s.global) {
259
  $.active--;
260
  }
261
  return;
264
  return;
265
  }
266
 
 
 
267
  // add submitting element to data if we know it
268
+ sub = form.clk;
269
  if (sub) {
270
+ n = sub.name;
271
  if (n && !sub.disabled) {
272
  s.extraData = s.extraData || {};
273
  s.extraData[n] = sub.value;
277
  }
278
  }
279
  }
280
+
281
+ var CLIENT_TIMEOUT_ABORT = 1;
282
+ var SERVER_ABORT = 2;
283
 
284
+ function getDoc(frame) {
285
+ var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document;
286
+ return doc;
287
+ }
288
+
289
  // take a breath so that pending repaints get some cpu time before the upload starts
290
  function doSubmit() {
291
  // make sure form attrs are set
293
 
294
  // update form attrs in IE friendly way
295
  form.setAttribute('target',id);
296
+ if (!method) {
297
  form.setAttribute('method', 'POST');
298
  }
299
+ if (a != s.url) {
300
  form.setAttribute('action', s.url);
301
  }
302
 
303
  // ie borks in some cases when setting encoding
304
+ if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
305
  $form.attr({
306
  encoding: 'multipart/form-data',
307
  enctype: 'multipart/form-data'
310
 
311
  // support timout
312
  if (s.timeout) {
313
+ timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
314
+ }
315
+
316
+ // look for server aborts
317
+ function checkState() {
318
+ try {
319
+ var state = getDoc(io).readyState;
320
+ log('state = ' + state);
321
+ if (state.toLowerCase() == 'uninitialized')
322
+ setTimeout(checkState,50);
323
+ }
324
+ catch(e) {
325
+ log('Server abort: ' , e, ' (', e.name, ')');
326
+ cb(SERVER_ABORT);
327
+ timeoutHandle && clearTimeout(timeoutHandle);
328
+ timeoutHandle = undefined;
329
+ }
330
  }
331
 
332
  // add "extra" data to form if provided in options
335
  if (s.extraData) {
336
  for (var n in s.extraData) {
337
  extraInputs.push(
338
+ $('<input type="hidden" name="'+n+'" />').attr('value',s.extraData[n])
339
  .appendTo(form)[0]);
340
  }
341
  }
342
 
343
+ if (!s.iframeTarget) {
344
+ // add iframe to doc and submit the form
345
+ $io.appendTo('body');
346
+ io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
347
+ }
348
+ setTimeout(checkState,15);
349
  form.submit();
350
  }
351
  finally {
366
  else {
367
  setTimeout(doSubmit, 10); // this lets dom updates render
368
  }
369
+
370
  var data, doc, domCheckCount = 50, callbackProcessed;
371
 
372
  function cb(e) {
373
  if (xhr.aborted || callbackProcessed) {
374
  return;
375
  }
376
+ try {
377
+ doc = getDoc(io);
378
+ }
379
+ catch(ex) {
380
+ log('cannot access response document: ', ex);
381
+ e = SERVER_ABORT;
382
+ }
383
+ if (e === CLIENT_TIMEOUT_ABORT && xhr) {
384
  xhr.abort('timeout');
385
  return;
386
  }
387
+ else if (e == SERVER_ABORT && xhr) {
388
+ xhr.abort('server abort');
389
+ return;
390
+ }
391
+
392
  if (!doc || doc.location.href == s.iframeSrc) {
393
  // response not received yet
394
  if (!timedOut)
396
  }
397
  io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
398
 
399
+ var status = 'success', errMsg;
400
  try {
401
  if (timedOut) {
402
  throw 'timeout';
418
  }
419
 
420
  //log('response detected');
421
+ var docRoot = doc.body ? doc.body : doc.documentElement;
422
+ xhr.responseText = docRoot ? docRoot.innerHTML : null;
423
  xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
424
+ if (isXml)
425
  s.dataType = 'xml';
426
  xhr.getResponseHeader = function(header){
427
  var headers = {'content-type': s.dataType};
428
  return headers[header];
429
  };
430
+ // support for XHR 'status' & 'statusText' emulation :
431
+ if (docRoot) {
432
+ xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
433
+ xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
434
+ }
435
+
436
+ var dt = s.dataType || '';
437
+ var scr = /(json|script|text)/.test(dt.toLowerCase());
438
  if (scr || s.textarea) {
439
  // see if user embedded response in textarea
440
  var ta = doc.getElementsByTagName('textarea')[0];
441
  if (ta) {
442
  xhr.responseText = ta.value;
443
+ // support for XHR 'status' & 'statusText' emulation :
444
+ xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
445
+ xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
446
  }
447
  else if (scr) {
448
  // account for browsers injecting pre around json response
449
  var pre = doc.getElementsByTagName('pre')[0];
450
  var b = doc.getElementsByTagName('body')[0];
451
  if (pre) {
452
+ xhr.responseText = pre.textContent ? pre.textContent : pre.innerHTML;
453
  }
454
  else if (b) {
455
  xhr.responseText = b.innerHTML;
456
  }
457
+ }
458
  }
459
  else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
460
  xhr.responseXML = toXml(xhr.responseText);
461
  }
462
+
463
+ try {
464
+ data = httpData(xhr, s.dataType, s);
465
+ }
466
+ catch (e) {
467
+ status = 'parsererror';
468
+ xhr.error = errMsg = (e || status);
469
+ }
470
  }
471
+ catch (e) {
472
+ log('error caught: ',e);
473
+ status = 'error';
474
+ xhr.error = errMsg = (e || status);
 
 
475
  }
476
+
477
  if (xhr.aborted) {
478
  log('upload aborted');
479
+ status = null;
480
  }
481
 
482
+ if (xhr.status) { // we've set xhr.status
483
+ status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
484
+ }
485
+
486
  // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
487
+ if (status === 'success') {
488
  s.success && s.success.call(s.context, data, 'success', xhr);
489
  g && $.event.trigger("ajaxSuccess", [xhr, s]);
490
  }
491
+ else if (status) {
492
+ if (errMsg == undefined)
493
+ errMsg = xhr.statusText;
494
+ s.error && s.error.call(s.context, xhr, status, errMsg);
495
+ g && $.event.trigger("ajaxError", [xhr, s, errMsg]);
496
+ }
497
+
498
  g && $.event.trigger("ajaxComplete", [xhr, s]);
499
 
500
  if (g && ! --$.active) {
501
  $.event.trigger("ajaxStop");
502
  }
503
+
504
+ s.complete && s.complete.call(s.context, xhr, status);
505
 
506
  callbackProcessed = true;
507
  if (s.timeout)
509
 
510
  // clean up
511
  setTimeout(function() {
512
+ if (!s.iframeTarget)
513
+ $io.remove();
514
  xhr.responseXML = null;
515
  }, 100);
516
  }
529
  var parseJSON = $.parseJSON || function(s) {
530
  return window['eval']('(' + s + ')');
531
  };
532
+
533
  var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
534
+
535
  var ct = xhr.getResponseHeader('content-type') || '',
536
  xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
537
  data = xml ? xhr.responseXML : xhr.responseText;
584
  log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
585
  return this;
586
  }
587
+
588
  return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
589
  if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
590
  e.preventDefault();
648
  if (!els) {
649
  return a;
650
  }
651
+
652
  var i,j,n,v,el,max,jmax;
653
  for(i=0, max=els.length; i < max; i++) {
654
  el = els[i];
833
  * Clears the selected form elements.
834
  */
835
  $.fn.clearFields = $.fn.clearInputs = function() {
836
+ var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
837
  return this.each(function() {
838
  var t = this.type, tag = this.tagName.toLowerCase();
839
+ if (re.test(t) || tag == 'textarea') {
840
  this.value = '';
841
  }
842
  else if (t == 'checkbox' || t == 'radio') {
898
  };
899
 
900
  // helper fn for console logging
 
901
  function log() {
902
+ var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
903
+ if (window.console && window.console.log) {
904
+ window.console.log(msg);
905
+ }
906
+ else if (window.opera && window.opera.postError) {
907
+ window.opera.postError(msg);
 
 
908
  }
909
  };
910
 
languages/wpcf7-de_DE.mo CHANGED
Binary file
languages/wpcf7-hu_HU.mo CHANGED
Binary file
languages/wpcf7-id_ID.mo CHANGED
Binary file
languages/wpcf7-ja.mo CHANGED
Binary file
languages/wpcf7-pt_BR.mo CHANGED
Binary file
languages/wpcf7-vi.mo CHANGED
Binary file
languages/wpcf7-zh_TW.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-01-06 09:35+0900\n"
6
- "PO-Revision-Date: 2011-01-06 09:35+0900\n"
7
  "Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
@@ -235,7 +235,7 @@ msgstr ""
235
  msgid "(select language)"
236
  msgstr ""
237
 
238
- #: contact-form-7/includes/classes.php:596
239
  msgid "Untitled"
240
  msgstr ""
241
 
@@ -506,38 +506,42 @@ msgid "Serbian"
506
  msgstr ""
507
 
508
  #: contact-form-7/includes/functions.php:211
509
- msgid "Slovak"
510
  msgstr ""
511
 
512
  #: contact-form-7/includes/functions.php:212
513
- msgid "Slovene"
514
  msgstr ""
515
 
516
  #: contact-form-7/includes/functions.php:213
517
- msgid "Spanish"
518
  msgstr ""
519
 
520
  #: contact-form-7/includes/functions.php:214
521
- msgid "Swedish"
522
  msgstr ""
523
 
524
  #: contact-form-7/includes/functions.php:215
525
- msgid "Tamil"
526
  msgstr ""
527
 
528
  #: contact-form-7/includes/functions.php:216
529
- msgid "Thai"
530
  msgstr ""
531
 
532
  #: contact-form-7/includes/functions.php:217
533
- msgid "Turkish"
534
  msgstr ""
535
 
536
  #: contact-form-7/includes/functions.php:218
537
- msgid "Ukrainian"
538
  msgstr ""
539
 
540
  #: contact-form-7/includes/functions.php:219
 
 
 
 
541
  msgid "Vietnamese"
542
  msgstr ""
543
 
@@ -547,7 +551,7 @@ msgstr ""
547
 
548
  #: contact-form-7/modules/acceptance.php:159
549
  #: contact-form-7/modules/captcha.php:202
550
- #: contact-form-7/modules/checkbox.php:208
551
  #: contact-form-7/modules/file.php:244
552
  msgid "Name"
553
  msgstr ""
@@ -563,8 +567,8 @@ msgstr ""
563
  #: contact-form-7/modules/captcha.php:238
564
  #: contact-form-7/modules/captcha.php:243
565
  #: contact-form-7/modules/captcha.php:246
566
- #: contact-form-7/modules/checkbox.php:213
567
- #: contact-form-7/modules/checkbox.php:216
568
  #: contact-form-7/modules/file.php:249
569
  #: contact-form-7/modules/file.php:252
570
  #: contact-form-7/modules/file.php:257
@@ -586,7 +590,7 @@ msgstr ""
586
 
587
  #: contact-form-7/modules/acceptance.php:180
588
  #: contact-form-7/modules/captcha.php:251
589
- #: contact-form-7/modules/checkbox.php:236
590
  #: contact-form-7/modules/file.php:265
591
  msgid "Copy this code and paste it into the form left."
592
  msgstr ""
@@ -660,40 +664,40 @@ msgstr ""
660
  msgid "This contact form contains CAPTCHA fields, but the necessary libraries (GD and FreeType) are not available on your server."
661
  msgstr ""
662
 
663
- #: contact-form-7/modules/checkbox.php:181
664
  msgid "Checkboxes"
665
  msgstr ""
666
 
667
- #: contact-form-7/modules/checkbox.php:184
668
  msgid "Radio buttons"
669
  msgstr ""
670
 
671
- #: contact-form-7/modules/checkbox.php:205
672
  #: contact-form-7/modules/file.php:243
673
  msgid "Required field?"
674
  msgstr ""
675
 
676
- #: contact-form-7/modules/checkbox.php:221
677
  msgid "Choices"
678
  msgstr ""
679
 
680
- #: contact-form-7/modules/checkbox.php:223
681
  msgid "* One choice per line."
682
  msgstr ""
683
 
684
- #: contact-form-7/modules/checkbox.php:227
685
  msgid "Put a label first, a checkbox last?"
686
  msgstr ""
687
 
688
- #: contact-form-7/modules/checkbox.php:228
689
  msgid "Wrap each item with <label> tag?"
690
  msgstr ""
691
 
692
- #: contact-form-7/modules/checkbox.php:230
693
  msgid "Make checkboxes exclusive?"
694
  msgstr ""
695
 
696
- #: contact-form-7/modules/checkbox.php:238
697
  msgid "And, put this code into the Mail fields below."
698
  msgstr ""
699
 
2
  msgstr ""
3
  "Project-Id-Version: Contact Form 7\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-07-12 22:07+0900\n"
6
+ "PO-Revision-Date: 2011-07-12 22:08+0900\n"
7
  "Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
235
  msgid "(select language)"
236
  msgstr ""
237
 
238
+ #: contact-form-7/includes/classes.php:597
239
  msgid "Untitled"
240
  msgstr ""
241
 
506
  msgstr ""
507
 
508
  #: contact-form-7/includes/functions.php:211
509
+ msgid "Sinhala"
510
  msgstr ""
511
 
512
  #: contact-form-7/includes/functions.php:212
513
+ msgid "Slovak"
514
  msgstr ""
515
 
516
  #: contact-form-7/includes/functions.php:213
517
+ msgid "Slovene"
518
  msgstr ""
519
 
520
  #: contact-form-7/includes/functions.php:214
521
+ msgid "Spanish"
522
  msgstr ""
523
 
524
  #: contact-form-7/includes/functions.php:215
525
+ msgid "Swedish"
526
  msgstr ""
527
 
528
  #: contact-form-7/includes/functions.php:216
529
+ msgid "Tamil"
530
  msgstr ""
531
 
532
  #: contact-form-7/includes/functions.php:217
533
+ msgid "Thai"
534
  msgstr ""
535
 
536
  #: contact-form-7/includes/functions.php:218
537
+ msgid "Turkish"
538
  msgstr ""
539
 
540
  #: contact-form-7/includes/functions.php:219
541
+ msgid "Ukrainian"
542
+ msgstr ""
543
+
544
+ #: contact-form-7/includes/functions.php:220
545
  msgid "Vietnamese"
546
  msgstr ""
547
 
551
 
552
  #: contact-form-7/modules/acceptance.php:159
553
  #: contact-form-7/modules/captcha.php:202
554
+ #: contact-form-7/modules/checkbox.php:210
555
  #: contact-form-7/modules/file.php:244
556
  msgid "Name"
557
  msgstr ""
567
  #: contact-form-7/modules/captcha.php:238
568
  #: contact-form-7/modules/captcha.php:243
569
  #: contact-form-7/modules/captcha.php:246
570
+ #: contact-form-7/modules/checkbox.php:215
571
+ #: contact-form-7/modules/checkbox.php:218
572
  #: contact-form-7/modules/file.php:249
573
  #: contact-form-7/modules/file.php:252
574
  #: contact-form-7/modules/file.php:257
590
 
591
  #: contact-form-7/modules/acceptance.php:180
592
  #: contact-form-7/modules/captcha.php:251
593
+ #: contact-form-7/modules/checkbox.php:238
594
  #: contact-form-7/modules/file.php:265
595
  msgid "Copy this code and paste it into the form left."
596
  msgstr ""
664
  msgid "This contact form contains CAPTCHA fields, but the necessary libraries (GD and FreeType) are not available on your server."
665
  msgstr ""
666
 
667
+ #: contact-form-7/modules/checkbox.php:183
668
  msgid "Checkboxes"
669
  msgstr ""
670
 
671
+ #: contact-form-7/modules/checkbox.php:186
672
  msgid "Radio buttons"
673
  msgstr ""
674
 
675
+ #: contact-form-7/modules/checkbox.php:207
676
  #: contact-form-7/modules/file.php:243
677
  msgid "Required field?"
678
  msgstr ""
679
 
680
+ #: contact-form-7/modules/checkbox.php:223
681
  msgid "Choices"
682
  msgstr ""
683
 
684
+ #: contact-form-7/modules/checkbox.php:225
685
  msgid "* One choice per line."
686
  msgstr ""
687
 
688
+ #: contact-form-7/modules/checkbox.php:229
689
  msgid "Put a label first, a checkbox last?"
690
  msgstr ""
691
 
692
+ #: contact-form-7/modules/checkbox.php:230
693
  msgid "Wrap each item with <label> tag?"
694
  msgstr ""
695
 
696
+ #: contact-form-7/modules/checkbox.php:232
697
  msgid "Make checkboxes exclusive?"
698
  msgstr ""
699
 
700
+ #: contact-form-7/modules/checkbox.php:240
701
  msgid "And, put this code into the Mail fields below."
702
  msgstr ""
703
 
modules/select.php CHANGED
@@ -132,9 +132,7 @@ function wpcf7_select_validation_filter( $result, $tag ) {
132
  }
133
 
134
  if ( 'select*' == $type ) {
135
- if ( empty( $_POST[$name] ) ||
136
- ! is_array( $_POST[$name] ) && '---' == $_POST[$name] ||
137
- is_array( $_POST[$name] ) && 1 == count( $_POST[$name] ) && '---' == $_POST[$name][0] ) {
138
  $result['valid'] = false;
139
  $result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
140
  }
132
  }
133
 
134
  if ( 'select*' == $type ) {
135
+ if ( empty( $_POST[$name] ) && '0' !== $_POST[$name] ) {
 
 
136
  $result['valid'] = false;
137
  $result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
138
  }
modules/text.php CHANGED
@@ -63,7 +63,7 @@ function wpcf7_text_shortcode_handler( $tag ) {
63
  $value = '';
64
  }
65
 
66
- if ( wpcf7_is_posted() )
67
  $value = stripslashes_deep( $_POST[$name] );
68
 
69
  if ( $id_att )
63
  $value = '';
64
  }
65
 
66
+ if ( wpcf7_is_posted() && isset( $_POST[$name] ) )
67
  $value = stripslashes_deep( $_POST[$name] );
68
 
69
  if ( $id_att )
modules/textarea.php CHANGED
@@ -60,7 +60,7 @@ function wpcf7_textarea_shortcode_handler( $tag ) {
60
  $value = '';
61
  }
62
 
63
- if ( wpcf7_is_posted() )
64
  $value = stripslashes_deep( $_POST[$name] );
65
 
66
  if ( $id_att )
60
  $value = '';
61
  }
62
 
63
+ if ( wpcf7_is_posted() && isset( $_POST[$name] ) )
64
  $value = stripslashes_deep( $_POST[$name] );
65
 
66
  if ( $id_att )
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: takayukister
3
  Donate link: http://contactform7.com/donate/
4
  Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
5
  Requires at least: 2.9
6
- Tested up to: 3.1.2
7
- Stable tag: 2.4.4
8
 
9
  Just another contact form plugin. Simple but flexible.
10
 
@@ -49,7 +49,7 @@ It is hard to continue development and support for this plugin without contribut
49
  * Hebrew (he_IL) - [Yaron Ofer](http://www.gadgetguru.co.il/)
50
  * Hindi (hi_IN) - [Tarun Joshi](http://www.readers-cafe.net/), [Ashish](http://outshinesolutions.com/)
51
  * Hungarian (hu_HU) - [Andras Hirschler](http://hia.itblog.hu/), [János Csárdi-Braunstein](http://blogocska.org/), [Farkas Győző](http://www.sakraft.hu/)
52
- * Indonesian (id_ID) - [Hendry Lee](http://blogbuildingu.com/)
53
  * Italian (it_IT) - [Bruno](http://www.brunosalzano.com), [Gianni Diurno](http://gidibao.net/)
54
  * Japanese (ja) - [Takayuki Miyoshi](http://ideasilo.wordpress.com)
55
  * Korean (ko_KR) - Seong Eun Lee, [Jong-In Kim](http://incommunity.codex.kr/wordpress/)
@@ -74,9 +74,9 @@ It is hard to continue development and support for this plugin without contribut
74
  * Thai (th) - [kazama](http://blog.wordthai.com/)
75
  * Turkish (tr_TR) - [Roman Neumuller](http://katpatuka.wordpress.com), [Hasan Yılmaz](http://hedefturkce.com/), [Emin Buğra Saral](http://www.rahmetli.info/)
76
  * Ukrainian (uk) - [Andrey Kovba](http://myserver.com.ua/), [Ukrainian WordPress localization team](http://wordpress.co.ua/plugins/contact-form-7.html)
77
- * Vietnamese (vi) - Thanh Hải,
78
 
79
- If you have created your own language pack, or have an update of an existing one, you can send [gettext PO and MO files](http://codex.wordpress.org/Translating_WordPress) to [me](http://ideasilo.wordpress.com/about/) so that I can bundle it into Contact Form 7. You can [download the latest POT file from here](http://plugins.svn.wordpress.org/contact-form-7/trunk/languages/wpcf7.pot).
80
 
81
  == Installation ==
82
 
@@ -94,7 +94,7 @@ Do you have questions or issues with Contact Form 7? Use these support channels
94
  1. [Docs](http://contactform7.com/docs/)
95
  1. [FAQ](http://contactform7.com/faq/)
96
  1. [Support Forum](http://wordpress.org/tags/contact-form-7?forum_id=10)
97
- 1. [WordPress HelpCenter](http://wphelpcenter.com/)
98
 
99
  [Support](http://contactform7.com/support/)
100
 
@@ -104,6 +104,13 @@ Do you have questions or issues with Contact Form 7? Use these support channels
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
 
107
  = 2.4.5 =
108
 
109
  * Fixed the bug that makes it not accept "0" value as watermark.
3
  Donate link: http://contactform7.com/donate/
4
  Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
5
  Requires at least: 2.9
6
+ Tested up to: 3.2
7
+ Stable tag: 2.4.6
8
 
9
  Just another contact form plugin. Simple but flexible.
10
 
49
  * Hebrew (he_IL) - [Yaron Ofer](http://www.gadgetguru.co.il/)
50
  * Hindi (hi_IN) - [Tarun Joshi](http://www.readers-cafe.net/), [Ashish](http://outshinesolutions.com/)
51
  * Hungarian (hu_HU) - [Andras Hirschler](http://hia.itblog.hu/), [János Csárdi-Braunstein](http://blogocska.org/), [Farkas Győző](http://www.sakraft.hu/)
52
+ * Indonesian (Bahasa Indonesia; id_ID) - [Hendry Lee](http://blogbuildingu.com/), [Belajar Seo Indonesia](http://dhany.web.id/panduan-seo)
53
  * Italian (it_IT) - [Bruno](http://www.brunosalzano.com), [Gianni Diurno](http://gidibao.net/)
54
  * Japanese (ja) - [Takayuki Miyoshi](http://ideasilo.wordpress.com)
55
  * Korean (ko_KR) - Seong Eun Lee, [Jong-In Kim](http://incommunity.codex.kr/wordpress/)
74
  * Thai (th) - [kazama](http://blog.wordthai.com/)
75
  * Turkish (tr_TR) - [Roman Neumuller](http://katpatuka.wordpress.com), [Hasan Yılmaz](http://hedefturkce.com/), [Emin Buğra Saral](http://www.rahmetli.info/)
76
  * Ukrainian (uk) - [Andrey Kovba](http://myserver.com.ua/), [Ukrainian WordPress localization team](http://wordpress.co.ua/plugins/contact-form-7.html)
77
+ * Vietnamese (vi) - Thanh Hải, Hà, [Khang Minh](http://betterwp.net/)
78
 
79
+ If you have created your own language pack, or have an update of an existing one, you can send [gettext PO and MO files](http://codex.wordpress.org/Translating_WordPress) to [me](http://ideasilo.wordpress.com/about/) so that I can bundle it into Contact Form 7. You can download the latest [POT file](http://plugins.svn.wordpress.org/contact-form-7/trunk/languages/wpcf7.pot), and [PO files in each language](http://plugins.svn.wordpress.org/contact-form-7/branches/languages/).
80
 
81
  == Installation ==
82
 
94
  1. [Docs](http://contactform7.com/docs/)
95
  1. [FAQ](http://contactform7.com/faq/)
96
  1. [Support Forum](http://wordpress.org/tags/contact-form-7?forum_id=10)
97
+ 1. [WordPress HelpCenter](http://wphelpcenter.com/plugins/contact-form-7/)
98
 
99
  [Support](http://contactform7.com/support/)
100
 
104
 
105
  == Changelog ==
106
 
107
+ = 2.4.6 =
108
+
109
+ * Fixed the bug that didn't accept '0' as valid value of drop-down menu.
110
+ * Fixed the incorrect shortcode regexp blocking use of multiline content of textarea.
111
+ * Updated jquery.form.js to 2.83.
112
+ * Translations for Vietnamese (Khang Minh), Brazilian Portuguese (Caciano Gabriel Batista), Traditional Chinese (James Wu), Bahasa Indonesia (Belajar Seo Indonesia), German (Ivan Graf) and Hungarian (Farkas Győző) have been updated.
113
+
114
  = 2.4.5 =
115
 
116
  * Fixed the bug that makes it not accept "0" value as watermark.
wp-contact-form-7.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://contactform7.com/
5
  Description: Just another contact form plugin. Simple but flexible.
6
  Author: Takayuki Miyoshi
7
  Author URI: http://ideasilo.wordpress.com/
8
- Version: 2.4.5
9
  */
10
 
11
  /* Copyright 2007-2011 Takayuki Miyoshi (email: takayukister at gmail.com)
@@ -25,7 +25,7 @@ Version: 2.4.5
25
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
  */
27
 
28
- define( 'WPCF7_VERSION', '2.4.5' );
29
 
30
  if ( ! defined( 'WPCF7_PLUGIN_BASENAME' ) )
31
  define( 'WPCF7_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
5
  Description: Just another contact form plugin. Simple but flexible.
6
  Author: Takayuki Miyoshi
7
  Author URI: http://ideasilo.wordpress.com/
8
+ Version: 2.4.6
9
  */
10
 
11
  /* Copyright 2007-2011 Takayuki Miyoshi (email: takayukister at gmail.com)
25
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
  */
27
 
28
+ define( 'WPCF7_VERSION', '2.4.6' );
29
 
30
  if ( ! defined( 'WPCF7_PLUGIN_BASENAME' ) )
31
  define( 'WPCF7_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );