MailChimp for WordPress - Version 3.1.6

Version Description

Download this release

Release Info

Developer DvanKooten
Plugin Icon 128x128 MailChimp for WordPress
Version 3.1.6
Comparing to
See all releases

Code changes from version 3.1.5 to 3.1.6

CHANGELOG.md CHANGED
@@ -1,6 +1,23 @@
1
  Changelog
2
  =========
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  #### 3.1.5 - March 22, 2016
5
 
6
  **Fixes**
1
  Changelog
2
  =========
3
 
4
+ #### 3.1.6 - April 12, 2016
5
+
6
+ **Fixes**
7
+
8
+ - Form event for starting a form was named `start` where it should have been `started`.
9
+
10
+ **Improvements**
11
+
12
+ - Some preparations for the upcoming migration to the new MailChimp API (version 3).
13
+ - Consistent hook parameters for `mc4wp_form_subscribed` action.
14
+ - Improved logic for rendering form response.
15
+
16
+ **Additions**
17
+
18
+ - New checkbox position for WooCommerce checkout integration.
19
+
20
+
21
  #### 3.1.5 - March 22, 2016
22
 
23
  **Fixes**
assets/js/forms-api.js CHANGED
@@ -64,8 +64,10 @@ Gator(document.body).on('submit', '.mc4wp-form', function(event) {
64
  Gator(document.body).on('focus', '.mc4wp-form', function(event) {
65
  event = event || window.event;
66
  var form = forms.getByElement(event.target || event.srcElement);
 
67
  if( ! form.started ) {
68
- forms.trigger('start', [form, event]);
 
69
  }
70
  });
71
 
@@ -105,7 +107,11 @@ var Form = function(id, element) {
105
  this.started = false;
106
 
107
  this.setData = function(data) {
108
- populate(form.element, data);
 
 
 
 
109
  };
110
 
111
  this.getData = function() {
@@ -154,19 +160,20 @@ function get(formId) {
154
  // get form by <form> element (or any input in form)
155
  function getByElement(element) {
156
  var formElement = element.form || element;
157
- for(var i=0; i<forms.length;i++) {
 
158
  if(forms[i].element == formElement) {
159
  return forms[i];
160
  }
161
  }
162
 
163
- return createFromElement(element);
164
  }
165
 
166
  // create form object from <form> element
167
- function createFromElement(formElement,id) {
168
  id = id || parseInt( formElement.getAttribute('data-id') ) || 0;
169
- var form = new Form(id,formElement);
170
  forms.push(form);
171
  return form;
172
  }
64
  Gator(document.body).on('focus', '.mc4wp-form', function(event) {
65
  event = event || window.event;
66
  var form = forms.getByElement(event.target || event.srcElement);
67
+
68
  if( ! form.started ) {
69
+ forms.trigger('started', [form, event]);
70
+ form.started = true;
71
  }
72
  });
73
 
107
  this.started = false;
108
 
109
  this.setData = function(data) {
110
+ try {
111
+ populate(form.element, data);
112
+ } catch(e) {
113
+ console.error(e);
114
+ }
115
  };
116
 
117
  this.getData = function() {
160
  // get form by <form> element (or any input in form)
161
  function getByElement(element) {
162
  var formElement = element.form || element;
163
+
164
+ for(var i=0; i < forms.length; i++) {
165
  if(forms[i].element == formElement) {
166
  return forms[i];
167
  }
168
  }
169
 
170
+ return createFromElement(formElement);
171
  }
172
 
173
  // create form object from <form> element
174
+ function createFromElement(formElement, id) {
175
  id = id || parseInt( formElement.getAttribute('data-id') ) || 0;
176
+ var form = new Form(id, formElement);
177
  forms.push(form);
178
  return form;
179
  }
assets/js/forms-api.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){var e=void 0,t=void 0;!function n(t,r,i){function o(a,u){if(!r[a]){if(!t[a]){var c="function"==typeof e&&e;if(!u&&c)return c(a,!0);if(s)return s(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return o(n?n:e)},l,l.exports,n,t,r,i)}return r[a].exports}for(var s="function"==typeof e&&e,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(e,t,n){"use strict";function r(e,t,n,r){a.trigger("submitted",[e]),n?a.trigger("error",[e,n]):(a.trigger("success",[e,r]),a.trigger(t+"d",[e,r]))}function i(e,t,n,i){if(n&&e.setData(i),c.auto_scroll){var o="animated"===c.auto_scroll,s=o?{behavior:"smooth"}:!1;e.element.scrollIntoView(s)}window.addEventListener("load",function(){r(e,t,n,i)})}var o=window.mc4wp||{};if(window.addEventListener){for(var s=e("gator"),a=e("./forms/forms.js"),u=window.mc4wp&&window.mc4wp.listeners?window.mc4wp.listeners:[],c=window.mc4wp_forms_config||{},f=0;f<u.length;f++)a.on(u[f].event,u[f].callback);if(s(document.body).on("submit",".mc4wp-form",function(e){e=e||window.event;var t=a.getByElement(e.target||e.srcElement);a.trigger("submit",[t,e])}),s(document.body).on("focus",".mc4wp-form",function(e){e=e||window.event;var t=a.getByElement(e.target||e.srcElement);t.started||a.trigger("start",[t,e])}),s(document.body).on("change",".mc4wp-form",function(e){e=e||window.event;var t=a.getByElement(e.target||e.srcElement);a.trigger("change",[t,e])}),c.submitted_form){var l=c.submitted_form,h=document.getElementById(l.element_id),d=a.getByElement(h);i(d,l.action,l.errors,l.data)}o.forms=a,window.mc4wp=o}},{"./forms/forms.js":3,gator:6}],2:[function(e,t,n){"use strict";var r=e("../third-party/serialize.js"),i=e("populate.js"),o=e("../third-party/form2js.js"),s=function(e,t){var n=this;this.id=e,this.element=t||document.createElement("form"),this.name=this.element.getAttribute("data-name")||"Form #"+this.id,this.errors=[],this.started=!1,this.setData=function(e){i(n.element,e)},this.getData=function(){return o(n.element)},this.getSerializedData=function(){return r(n.element)},this.setResponse=function(e){n.element.querySelector(".mc4wp-response").innerHTML=e}};t.exports=s},{"../third-party/form2js.js":4,"../third-party/serialize.js":5,"populate.js":7}],3:[function(e,t,n){"use strict";function r(e){for(var t=0;t<d.length;t++)if(d[t].id==e)return d[t];var n=document.querySelector(".mc4wp-form-"+e);return o(n,e)}function i(e){for(var t=e.form||e,n=0;n<d.length;n++)if(d[n].element==t)return d[n];return o(e)}function o(e,t){t=t||parseInt(e.getAttribute("data-id"))||0;var n=new l(t,e);return d.push(n),n}function s(){return d}function a(e,t){return h.on(e,t)}function u(e,t){return h.trigger(e,t)}function c(e,t){return h.off(e,t)}var f=e("wolfy87-eventemitter"),l=e("./form.js"),h=new f,d=[];t.exports={all:s,get:r,getByElement:i,on:a,trigger:u,off:c}},{"./form.js":2,"wolfy87-eventemitter":8}],4:[function(e,n,r){!function(e,i){"undefined"!=typeof r&&"undefined"!=typeof n&&n.exports?n.exports=i():"function"==typeof t&&t.amd?t(i):e.form2js=i()}(this,function(){"use strict";function e(e,r,i,o,s,a){a=!!a,"undefined"!=typeof i&&null!=i||(i=!0),"undefined"!=typeof r&&null!=r||(r="."),arguments.length<5&&(s=!1),e="string"==typeof e?document.getElementById(e):e;var u,c=[],f=0;if(e.constructor==Array||"undefined"!=typeof NodeList&&e.constructor==NodeList)for(;u=e[f++];)c=c.concat(n(u,o,s,a));else c=n(e,o,s,a);return t(c,i,r)}function t(e,t,n){var r,i,o,s,a,u,c,f,l,h,d,m,p,v={},g={};for(r=0;r<e.length;r++)if(a=e[r].value,!t||""!==a&&null!==a){for(m=e[r].name,p=m.split(n),u=[],c=v,f="",i=0;i<p.length;i++)if(d=p[i].split("]["),d.length>1)for(o=0;o<d.length;o++)if(0==o?d[o]=d[o]+"]":o==d.length-1?d[o]="["+d[o]:d[o]="["+d[o]+"]",h=d[o].match(/([a-z_]+)?\[([a-z_][a-z0-9_]+?)\]/i))for(s=1;s<h.length;s++)h[s]&&u.push(h[s]);else u.push(d[o]);else u=u.concat(d);for(i=0;i<u.length;i++)d=u[i],d.indexOf("[]")>-1&&i==u.length-1?(l=d.substr(0,d.indexOf("[")),f+=l,c[l]||(c[l]=[]),c[l].push(a)):d.indexOf("[")>-1?(l=d.substr(0,d.indexOf("[")),h=d.replace(/(^([a-z_]+)?\[)|(\]$)/gi,""),f+="_"+l+"_"+h,g[f]||(g[f]={}),""==l||c[l]||(c[l]=[]),i==u.length-1?""==l?(c.push(a),g[f][h]=c[c.length-1]):(c[l].push(a),g[f][h]=c[l][c[l].length-1]):g[f][h]||(/^[0-9a-z_]+\[?/i.test(u[i+1])?c[l].push({}):c[l].push([]),g[f][h]=c[l][c[l].length-1]),c=g[f][h]):(f+=d,i<u.length-1?(c[d]||(c[d]={}),c=c[d]):c[d]=a)}return v}function n(e,t,n,o){var s=i(e,t,n,o);return s.length>0?s:r(e,t,n,o)}function r(e,t,n,r){for(var o=[],s=e.firstChild;s;)o=o.concat(i(s,t,n,r)),s=s.nextSibling;return o}function i(e,t,n,i){if(e.disabled&&!i)return[];var a,u,c,f=o(e,n);return a=t&&t(e),a&&a.name?c=[a]:""!=f&&e.nodeName.match(/INPUT|TEXTAREA/i)?(u=s(e,i),c=null===u?[]:[{name:f,value:u}]):""!=f&&e.nodeName.match(/SELECT/i)?(u=s(e,i),c=[{name:f.replace(/\[\]$/,""),value:u}]):c=r(e,t,n,i),c}function o(e,t){return e.name&&""!=e.name?e.name:t&&e.id&&""!=e.id?e.id:""}function s(e,t){if(e.disabled&&!t)return null;switch(e.nodeName){case"INPUT":case"TEXTAREA":switch(e.type.toLowerCase()){case"radio":if(e.checked&&"false"===e.value)return!1;case"checkbox":if(e.checked&&"true"===e.value)return!0;if(!e.checked&&"true"===e.value)return!1;if(e.checked)return e.value;break;case"button":case"reset":case"submit":case"image":return"";default:return e.value}break;case"SELECT":return a(e)}return null}function a(e){var t,n,r,i=e.multiple,o=[];if(!i)return e.value;for(t=e.getElementsByTagName("option"),n=0,r=t.length;r>n;n++)t[n].selected&&o.push(t[n].value);return o}return e})},{}],5:[function(e,t,n){function r(e,t){"object"!=typeof t?t={hash:!!t}:void 0===t.hash&&(t.hash=!0);for(var n=t.hash?{}:"",r=t.serializer||(t.hash?s:a),i=e&&e.elements?e.elements:[],o=Object.create(null),f=0;f<i.length;++f){var l=i[f];if((t.disabled||!l.disabled)&&l.name&&c.test(l.nodeName)&&!u.test(l.type)){var h=l.name,d=l.value;if("checkbox"!==l.type&&"radio"!==l.type||l.checked||(d=void 0),t.empty){if("checkbox"!==l.type||l.checked||(d=""),"radio"===l.type&&(o[l.name]||l.checked?l.checked&&(o[l.name]=!0):o[l.name]=!1),!d&&"radio"==l.type)continue}else if(!d)continue;if("select-multiple"!==l.type)n=r(n,h,d);else{d=[];for(var m=l.options,p=!1,v=0;v<m.length;++v){var g=m[v],y=t.empty&&!g.value,w=g.value||y;g.selected&&w&&(p=!0,n=t.hash&&"[]"!==h.slice(h.length-2)?r(n,h+"[]",g.value):r(n,h,g.value))}!p&&t.empty&&(n=r(n,h,""))}}}if(t.empty)for(var h in o)o[h]||(n=r(n,h,""));return n}function i(e){var t=[],n=/^([^\[\]]*)/,r=new RegExp(f),i=n.exec(e);for(i[1]&&t.push(i[1]);null!==(i=r.exec(e));)t.push(i[1]);return t}function o(e,t,n){if(0===t.length)return e=n;var r=t.shift(),i=r.match(/^\[(.+?)\]$/);if("[]"===r)return e=e||[],Array.isArray(e)?e.push(o(null,t,n)):(e._values=e._values||[],e._values.push(o(null,t,n))),e;if(i){var s=i[1],a=parseInt(s,10);isNaN(a)?(e=e||{},e[s]=o(e[s],t,n)):(e=e||[],e[a]=o(e[a],t,n))}else e[r]=o(e[r],t,n);return e}function s(e,t,n){var r=t.match(f);if(r){var s=i(t);o(e,s,n)}else{var a=e[t];a?(Array.isArray(a)||(e[t]=[a]),e[t].push(n)):e[t]=n}return e}function a(e,t,n){return n=n.replace(/(\r)?\n/g,"\r\n"),n=encodeURIComponent(n),n=n.replace(/%20/g,"+"),e+(e?"&":"")+encodeURIComponent(t)+"="+n}var u=/^(?:submit|button|image|reset|file)$/i,c=/^(?:input|select|textarea|keygen)/i,f=/(\[[^\[\]]*\])/g;t.exports=r},{}],6:[function(e,t,n){!function(){function e(e,t,n){var r="blur"==t||"focus"==t;e.element.addEventListener(t,n,r)}function n(e){e.preventDefault(),e.stopPropagation()}function r(e){return f?f:f=e.matches?e.matches:e.webkitMatchesSelector?e.webkitMatchesSelector:e.mozMatchesSelector?e.mozMatchesSelector:e.msMatchesSelector?e.msMatchesSelector:e.oMatchesSelector?e.oMatchesSelector:c.matchesSelector}function i(e,t,n){if("_root"==t)return n;if(e!==n)return r(e).call(e,t)?e:e.parentNode?(l++,i(e.parentNode,t,n)):void 0}function o(e,t,n,r){d[e.id]||(d[e.id]={}),d[e.id][t]||(d[e.id][t]={}),d[e.id][t][n]||(d[e.id][t][n]=[]),d[e.id][t][n].push(r)}function s(e,t,n,r){if(d[e.id])if(t){if(!r&&!n)return void(d[e.id][t]={});if(!r)return void delete d[e.id][t][n];if(d[e.id][t][n])for(var i=0;i<d[e.id][t][n].length;i++)if(d[e.id][t][n][i]===r){d[e.id][t][n].splice(i,1);break}}else for(var o in d[e.id])d[e.id].hasOwnProperty(o)&&(d[e.id][o]={})}function a(e,t,n){if(d[e][n]){var r,o,s=t.target||t.srcElement,a={},u=0,f=0;l=0;for(r in d[e][n])d[e][n].hasOwnProperty(r)&&(o=i(s,r,m[e].element),o&&c.matchesEvent(n,m[e].element,o,"_root"==r,t)&&(l++,d[e][n][r].match=o,a[l]=d[e][n][r]));for(t.stopPropagation=function(){t.cancelBubble=!0},u=0;l>=u;u++)if(a[u])for(f=0;f<a[u].length;f++){if(a[u][f].call(a[u].match,t)===!1)return void c.cancel(t);if(t.cancelBubble)return}}}function u(e,t,n,r){function i(e){return function(t){a(f,t,e)}}if(this.element){e instanceof Array||(e=[e]),n||"function"!=typeof t||(n=t,t="_root");var u,f=this.id;for(u=0;u<e.length;u++)r?s(this,e[u],t,n):(d[f]&&d[f][e[u]]||c.addEvent(this,e[u],i(e[u])),o(this,e[u],t,n));return this}}function c(e,t){if(!(this instanceof c)){for(var n in m)if(m[n].element===e)return m[n];return h++,m[h]=new c(e,h),m[h]}this.element=e,this.id=t}var f,l=0,h=0,d={},m={};c.prototype.on=function(e,t,n){return u.call(this,e,t,n)},c.prototype.off=function(e,t,n){return u.call(this,e,t,n,!0)},c.matchesSelector=function(){},c.cancel=n,c.addEvent=e,c.matchesEvent=function(){return!0},"undefined"!=typeof t&&t.exports&&(t.exports=c),window.Gator=c}()},{}],7:[function(e,n,r){!function(e){var r=function(e,t,n){for(var i in t)if(t.hasOwnProperty(i)){var o=i,s=t[i];if("undefined"!=typeof n&&(o=n+"["+i+"]"),s.constructor===Array)o+="[]";else if("object"==typeof s){r(e,s,o);continue}var a=e.elements.namedItem(o);if(a){var u=a.type||a[0].type;switch(u){default:a.value=s;break;case"radio":case"checkbox":for(var c=0;c<a.length;c++)a[c].checked=s.indexOf(a[c].value)>-1;break;case"select-multiple":for(var f=s.constructor==Array?s:[s],l=0;l<a.options.length;l++)a.options[l].selected|=f.indexOf(a.options[l].value)>-1;break;case"select":case"select-one":a.value=s.toString()||s}}}};"function"==typeof t&&"object"==typeof t.amd&&t.amd?t(function(){return r}):"undefined"!=typeof n&&n.exports?n.exports=r:e.populate=r}(this)},{}],8:[function(e,n,r){(function(){"use strict";function e(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function i(e){return function(){return this[e].apply(this,arguments)}}var o=e.prototype,s=this,a=s.EventEmitter;o.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},o.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},o.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},o.addListener=function(e,t){var n,i=this.getListenersAsObject(e),o="object"==typeof t;for(n in i)i.hasOwnProperty(n)&&-1===r(i[n],t)&&i[n].push(o?t:{listener:t,once:!1});return this},o.on=i("addListener"),o.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},o.once=i("addOnceListener"),o.defineEvent=function(e){return this.getListeners(e),this},o.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},o.removeListener=function(e,t){var n,i,o=this.getListenersAsObject(e);for(i in o)o.hasOwnProperty(i)&&(n=r(o[i],t),-1!==n&&o[i].splice(n,1));return this},o.off=i("removeListener"),o.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},o.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},o.manipulateListeners=function(e,t,n){var r,i,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)o.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(i=t[r])&&("function"==typeof i?o.call(this,r,i):s.call(this,r,i));return this},o.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},o.removeAllListeners=i("removeEvent"),o.emitEvent=function(e,t){var n,r,i,o,s,a=this.getListenersAsObject(e);for(o in a)if(a.hasOwnProperty(o))for(n=a[o].slice(0),i=n.length;i--;)r=n[i],r.once===!0&&this.removeListener(e,r.listener),s=r.listener.apply(this,t||[]),s===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},o.trigger=i("emitEvent"),o.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},o.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},o._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},o._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return s.EventEmitter=a,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof n&&n.exports?n.exports=e:s.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=forms-api.min.js.map
1
+ !function(){var e=void 0,t=void 0;!function n(t,r,i){function o(a,c){if(!r[a]){if(!t[a]){var u="function"==typeof e&&e;if(!c&&u)return u(a,!0);if(s)return s(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return o(n?n:e)},l,l.exports,n,t,r,i)}return r[a].exports}for(var s="function"==typeof e&&e,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(e,t,n){"use strict";function r(e,t,n,r){a.trigger("submitted",[e]),n?a.trigger("error",[e,n]):(a.trigger("success",[e,r]),a.trigger(t+"d",[e,r]))}function i(e,t,n,i){if(n&&e.setData(i),u.auto_scroll){var o="animated"===u.auto_scroll,s=o?{behavior:"smooth"}:!1;e.element.scrollIntoView(s)}window.addEventListener("load",function(){r(e,t,n,i)})}var o=window.mc4wp||{};if(window.addEventListener){for(var s=e("gator"),a=e("./forms/forms.js"),c=window.mc4wp&&window.mc4wp.listeners?window.mc4wp.listeners:[],u=window.mc4wp_forms_config||{},f=0;f<c.length;f++)a.on(c[f].event,c[f].callback);if(s(document.body).on("submit",".mc4wp-form",function(e){e=e||window.event;var t=a.getByElement(e.target||e.srcElement);a.trigger("submit",[t,e])}),s(document.body).on("focus",".mc4wp-form",function(e){e=e||window.event;var t=a.getByElement(e.target||e.srcElement);t.started||(a.trigger("started",[t,e]),t.started=!0)}),s(document.body).on("change",".mc4wp-form",function(e){e=e||window.event;var t=a.getByElement(e.target||e.srcElement);a.trigger("change",[t,e])}),u.submitted_form){var l=u.submitted_form,h=document.getElementById(l.element_id),d=a.getByElement(h);i(d,l.action,l.errors,l.data)}o.forms=a,window.mc4wp=o}},{"./forms/forms.js":3,gator:6}],2:[function(e,t,n){"use strict";var r=e("../third-party/serialize.js"),i=e("populate.js"),o=e("../third-party/form2js.js"),s=function(e,t){var n=this;this.id=e,this.element=t||document.createElement("form"),this.name=this.element.getAttribute("data-name")||"Form #"+this.id,this.errors=[],this.started=!1,this.setData=function(e){try{i(n.element,e)}catch(t){console.error(t)}},this.getData=function(){return o(n.element)},this.getSerializedData=function(){return r(n.element)},this.setResponse=function(e){n.element.querySelector(".mc4wp-response").innerHTML=e}};t.exports=s},{"../third-party/form2js.js":4,"../third-party/serialize.js":5,"populate.js":7}],3:[function(e,t,n){"use strict";function r(e){for(var t=0;t<d.length;t++)if(d[t].id==e)return d[t];var n=document.querySelector(".mc4wp-form-"+e);return o(n,e)}function i(e){for(var t=e.form||e,n=0;n<d.length;n++)if(d[n].element==t)return d[n];return o(t)}function o(e,t){t=t||parseInt(e.getAttribute("data-id"))||0;var n=new l(t,e);return d.push(n),n}function s(){return d}function a(e,t){return h.on(e,t)}function c(e,t){return h.trigger(e,t)}function u(e,t){return h.off(e,t)}var f=e("wolfy87-eventemitter"),l=e("./form.js"),h=new f,d=[];t.exports={all:s,get:r,getByElement:i,on:a,trigger:c,off:u}},{"./form.js":2,"wolfy87-eventemitter":8}],4:[function(e,n,r){!function(e,i){"undefined"!=typeof r&&"undefined"!=typeof n&&n.exports?n.exports=i():"function"==typeof t&&t.amd?t(i):e.form2js=i()}(this,function(){"use strict";function e(e,r,i,o,s,a){a=!!a,"undefined"!=typeof i&&null!=i||(i=!0),"undefined"!=typeof r&&null!=r||(r="."),arguments.length<5&&(s=!1),e="string"==typeof e?document.getElementById(e):e;var c,u=[],f=0;if(e.constructor==Array||"undefined"!=typeof NodeList&&e.constructor==NodeList)for(;c=e[f++];)u=u.concat(n(c,o,s,a));else u=n(e,o,s,a);return t(u,i,r)}function t(e,t,n){var r,i,o,s,a,c,u,f,l,h,d,m,p,v={},g={};for(r=0;r<e.length;r++)if(a=e[r].value,!t||""!==a&&null!==a){for(m=e[r].name,p=m.split(n),c=[],u=v,f="",i=0;i<p.length;i++)if(d=p[i].split("]["),d.length>1)for(o=0;o<d.length;o++)if(0==o?d[o]=d[o]+"]":o==d.length-1?d[o]="["+d[o]:d[o]="["+d[o]+"]",h=d[o].match(/([a-z_]+)?\[([a-z_][a-z0-9_]+?)\]/i))for(s=1;s<h.length;s++)h[s]&&c.push(h[s]);else c.push(d[o]);else c=c.concat(d);for(i=0;i<c.length;i++)d=c[i],d.indexOf("[]")>-1&&i==c.length-1?(l=d.substr(0,d.indexOf("[")),f+=l,u[l]||(u[l]=[]),u[l].push(a)):d.indexOf("[")>-1?(l=d.substr(0,d.indexOf("[")),h=d.replace(/(^([a-z_]+)?\[)|(\]$)/gi,""),f+="_"+l+"_"+h,g[f]||(g[f]={}),""==l||u[l]||(u[l]=[]),i==c.length-1?""==l?(u.push(a),g[f][h]=u[u.length-1]):(u[l].push(a),g[f][h]=u[l][u[l].length-1]):g[f][h]||(/^[0-9a-z_]+\[?/i.test(c[i+1])?u[l].push({}):u[l].push([]),g[f][h]=u[l][u[l].length-1]),u=g[f][h]):(f+=d,i<c.length-1?(u[d]||(u[d]={}),u=u[d]):u[d]=a)}return v}function n(e,t,n,o){var s=i(e,t,n,o);return s.length>0?s:r(e,t,n,o)}function r(e,t,n,r){for(var o=[],s=e.firstChild;s;)o=o.concat(i(s,t,n,r)),s=s.nextSibling;return o}function i(e,t,n,i){if(e.disabled&&!i)return[];var a,c,u,f=o(e,n);return a=t&&t(e),a&&a.name?u=[a]:""!=f&&e.nodeName.match(/INPUT|TEXTAREA/i)?(c=s(e,i),u=null===c?[]:[{name:f,value:c}]):""!=f&&e.nodeName.match(/SELECT/i)?(c=s(e,i),u=[{name:f.replace(/\[\]$/,""),value:c}]):u=r(e,t,n,i),u}function o(e,t){return e.name&&""!=e.name?e.name:t&&e.id&&""!=e.id?e.id:""}function s(e,t){if(e.disabled&&!t)return null;switch(e.nodeName){case"INPUT":case"TEXTAREA":switch(e.type.toLowerCase()){case"radio":if(e.checked&&"false"===e.value)return!1;case"checkbox":if(e.checked&&"true"===e.value)return!0;if(!e.checked&&"true"===e.value)return!1;if(e.checked)return e.value;break;case"button":case"reset":case"submit":case"image":return"";default:return e.value}break;case"SELECT":return a(e)}return null}function a(e){var t,n,r,i=e.multiple,o=[];if(!i)return e.value;for(t=e.getElementsByTagName("option"),n=0,r=t.length;r>n;n++)t[n].selected&&o.push(t[n].value);return o}return e})},{}],5:[function(e,t,n){function r(e,t){"object"!=typeof t?t={hash:!!t}:void 0===t.hash&&(t.hash=!0);for(var n=t.hash?{}:"",r=t.serializer||(t.hash?s:a),i=e&&e.elements?e.elements:[],o=Object.create(null),f=0;f<i.length;++f){var l=i[f];if((t.disabled||!l.disabled)&&l.name&&u.test(l.nodeName)&&!c.test(l.type)){var h=l.name,d=l.value;if("checkbox"!==l.type&&"radio"!==l.type||l.checked||(d=void 0),t.empty){if("checkbox"!==l.type||l.checked||(d=""),"radio"===l.type&&(o[l.name]||l.checked?l.checked&&(o[l.name]=!0):o[l.name]=!1),!d&&"radio"==l.type)continue}else if(!d)continue;if("select-multiple"!==l.type)n=r(n,h,d);else{d=[];for(var m=l.options,p=!1,v=0;v<m.length;++v){var g=m[v],y=t.empty&&!g.value,w=g.value||y;g.selected&&w&&(p=!0,n=t.hash&&"[]"!==h.slice(h.length-2)?r(n,h+"[]",g.value):r(n,h,g.value))}!p&&t.empty&&(n=r(n,h,""))}}}if(t.empty)for(var h in o)o[h]||(n=r(n,h,""));return n}function i(e){var t=[],n=/^([^\[\]]*)/,r=new RegExp(f),i=n.exec(e);for(i[1]&&t.push(i[1]);null!==(i=r.exec(e));)t.push(i[1]);return t}function o(e,t,n){if(0===t.length)return e=n;var r=t.shift(),i=r.match(/^\[(.+?)\]$/);if("[]"===r)return e=e||[],Array.isArray(e)?e.push(o(null,t,n)):(e._values=e._values||[],e._values.push(o(null,t,n))),e;if(i){var s=i[1],a=parseInt(s,10);isNaN(a)?(e=e||{},e[s]=o(e[s],t,n)):(e=e||[],e[a]=o(e[a],t,n))}else e[r]=o(e[r],t,n);return e}function s(e,t,n){var r=t.match(f);if(r){var s=i(t);o(e,s,n)}else{var a=e[t];a?(Array.isArray(a)||(e[t]=[a]),e[t].push(n)):e[t]=n}return e}function a(e,t,n){return n=n.replace(/(\r)?\n/g,"\r\n"),n=encodeURIComponent(n),n=n.replace(/%20/g,"+"),e+(e?"&":"")+encodeURIComponent(t)+"="+n}var c=/^(?:submit|button|image|reset|file)$/i,u=/^(?:input|select|textarea|keygen)/i,f=/(\[[^\[\]]*\])/g;t.exports=r},{}],6:[function(e,t,n){!function(){function e(e,t,n){var r="blur"==t||"focus"==t;e.element.addEventListener(t,n,r)}function n(e){e.preventDefault(),e.stopPropagation()}function r(e){return f?f:f=e.matches?e.matches:e.webkitMatchesSelector?e.webkitMatchesSelector:e.mozMatchesSelector?e.mozMatchesSelector:e.msMatchesSelector?e.msMatchesSelector:e.oMatchesSelector?e.oMatchesSelector:u.matchesSelector}function i(e,t,n){if("_root"==t)return n;if(e!==n)return r(e).call(e,t)?e:e.parentNode?(l++,i(e.parentNode,t,n)):void 0}function o(e,t,n,r){d[e.id]||(d[e.id]={}),d[e.id][t]||(d[e.id][t]={}),d[e.id][t][n]||(d[e.id][t][n]=[]),d[e.id][t][n].push(r)}function s(e,t,n,r){if(d[e.id])if(t){if(!r&&!n)return void(d[e.id][t]={});if(!r)return void delete d[e.id][t][n];if(d[e.id][t][n])for(var i=0;i<d[e.id][t][n].length;i++)if(d[e.id][t][n][i]===r){d[e.id][t][n].splice(i,1);break}}else for(var o in d[e.id])d[e.id].hasOwnProperty(o)&&(d[e.id][o]={})}function a(e,t,n){if(d[e][n]){var r,o,s=t.target||t.srcElement,a={},c=0,f=0;l=0;for(r in d[e][n])d[e][n].hasOwnProperty(r)&&(o=i(s,r,m[e].element),o&&u.matchesEvent(n,m[e].element,o,"_root"==r,t)&&(l++,d[e][n][r].match=o,a[l]=d[e][n][r]));for(t.stopPropagation=function(){t.cancelBubble=!0},c=0;l>=c;c++)if(a[c])for(f=0;f<a[c].length;f++){if(a[c][f].call(a[c].match,t)===!1)return void u.cancel(t);if(t.cancelBubble)return}}}function c(e,t,n,r){function i(e){return function(t){a(f,t,e)}}if(this.element){e instanceof Array||(e=[e]),n||"function"!=typeof t||(n=t,t="_root");var c,f=this.id;for(c=0;c<e.length;c++)r?s(this,e[c],t,n):(d[f]&&d[f][e[c]]||u.addEvent(this,e[c],i(e[c])),o(this,e[c],t,n));return this}}function u(e,t){if(!(this instanceof u)){for(var n in m)if(m[n].element===e)return m[n];return h++,m[h]=new u(e,h),m[h]}this.element=e,this.id=t}var f,l=0,h=0,d={},m={};u.prototype.on=function(e,t,n){return c.call(this,e,t,n)},u.prototype.off=function(e,t,n){return c.call(this,e,t,n,!0)},u.matchesSelector=function(){},u.cancel=n,u.addEvent=e,u.matchesEvent=function(){return!0},"undefined"!=typeof t&&t.exports&&(t.exports=u),window.Gator=u}()},{}],7:[function(e,n,r){!function(e){var r=function(e,t,n){for(var i in t)if(t.hasOwnProperty(i)){var o=i,s=t[i];if("undefined"!=typeof n&&(o=n+"["+i+"]"),s.constructor===Array)o+="[]";else if("object"==typeof s){r(e,s,o);continue}var a=e.elements.namedItem(o);if(a){var c=a.type||a[0].type;switch(c){default:a.value=s;break;case"radio":case"checkbox":for(var u=0;u<a.length;u++)a[u].checked=s.indexOf(a[u].value)>-1;break;case"select-multiple":for(var f=s.constructor==Array?s:[s],l=0;l<a.options.length;l++)a.options[l].selected|=f.indexOf(a.options[l].value)>-1;break;case"select":case"select-one":a.value=s.toString()||s}}}};"function"==typeof t&&"object"==typeof t.amd&&t.amd?t(function(){return r}):"undefined"!=typeof n&&n.exports?n.exports=r:e.populate=r}(this)},{}],8:[function(e,n,r){(function(){"use strict";function e(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function i(e){return function(){return this[e].apply(this,arguments)}}var o=e.prototype,s=this,a=s.EventEmitter;o.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},o.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},o.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},o.addListener=function(e,t){var n,i=this.getListenersAsObject(e),o="object"==typeof t;for(n in i)i.hasOwnProperty(n)&&-1===r(i[n],t)&&i[n].push(o?t:{listener:t,once:!1});return this},o.on=i("addListener"),o.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},o.once=i("addOnceListener"),o.defineEvent=function(e){return this.getListeners(e),this},o.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},o.removeListener=function(e,t){var n,i,o=this.getListenersAsObject(e);for(i in o)o.hasOwnProperty(i)&&(n=r(o[i],t),-1!==n&&o[i].splice(n,1));return this},o.off=i("removeListener"),o.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},o.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},o.manipulateListeners=function(e,t,n){var r,i,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)o.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(i=t[r])&&("function"==typeof i?o.call(this,r,i):s.call(this,r,i));return this},o.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},o.removeAllListeners=i("removeEvent"),o.emitEvent=function(e,t){var n,r,i,o,s,a=this.getListenersAsObject(e);for(o in a)if(a.hasOwnProperty(o))for(n=a[o].slice(0),i=n.length;i--;)r=n[i],r.once===!0&&this.removeListener(e,r.listener),s=r.listener.apply(this,t||[]),s===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},o.trigger=i("emitEvent"),o.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},o.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},o._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},o._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return s.EventEmitter=a,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof n&&n.exports?n.exports=e:s.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=forms-api.min.js.map
assets/js/forms-api.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["forms-api.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length",1,"module","triggerFormEvents","form","action","errors","data","forms","trigger","handleFormRequest","setData","config","auto_scroll","animate","arg","behavior","element","scrollIntoView","window","addEventListener","mc4wp","Gator","listeners","mc4wp_forms_config","on","event","callback","document","body","getByElement","target","srcElement","started","submitted_form","formConfig","getElementById","element_id","./forms/forms.js","gator",2,"serialize","populate","formToJson","Form","id","this","createElement","name","getAttribute","getData","getSerializedData","setResponse","msg","querySelector","innerHTML","../third-party/form2js.js","../third-party/serialize.js","populate.js",3,"get","formId","formElement","createFromElement","parseInt","push","all","events","args","off","EventEmitter","./form.js","wolfy87-eventemitter",4,"root","factory","amd","form2js","rootNode","delimiter","skipEmpty","nodeCallback","useIdIfEmptyName","getDisabled","arguments","currNode","formValues","constructor","Array","NodeList","concat","getFormValues","processNameValues","nameValues","j","k","value","nameParts","currResult","arrNameFull","arrName","arrIdx","namePart","_nameParts","result","arrays","split","match","indexOf","substr","replace","test","extractNodeValues","getSubFormValues","currentNode","firstChild","nextSibling","node","disabled","callbackResult","fieldValue","fieldName","getFieldName","nodeName","getFieldValue","fieldNode","type","toLowerCase","checked","getSelectedOptionValue","selectNode","options","multiple","getElementsByTagName","selected",5,"hash","serializer","hash_serializer","str_serialize","elements","radio_store","Object","create","k_r_success_contrls","k_r_submitter","key","val","empty","selectOptions","isSelectedOptions","option","allowedEmpty","hasValue","slice","parse_keys","string","keys","prefix","children","RegExp","brackets","exec","hash_assign","shift","between","isArray","_values","index","isNaN","matches","existing","encodeURIComponent",6,"_addEvent","useCapture","_cancel","preventDefault","stopPropagation","_getMatcher","_matcher","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","matchesSelector","_matchesSelector","selector","boundElement","parentNode","_level","_addHandler","_handlers","_removeHandler","splice","hasOwnProperty","_handleEvent","_gatorInstances","matchesEvent","cancelBubble","cancel","_bind","remove","_getGlobalCallback","addEvent","_id","prototype",7,"basename","namedItem","values","toString",8,"indexOfListener","listener","alias","apply","proto","originalGlobalValue","getListeners","evt","response","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","addListeners","manipulateListeners","removeListeners","single","removeEvent","_events","removeAllListeners","emitEvent","listenersMap","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict"],"mappings":"CAAA,WAAe,GAAIA,GAAUC,OAAeC,EAASD,QAAW,QAAUE,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATV,IAAqBA,CAAQ,KAAIS,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGG,EAAE,MAAOA,GAAEH,GAAE,EAAI,IAAII,GAAE,GAAIC,OAAM,uBAAuBL,EAAE,IAAK,MAAMI,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEV,EAAEG,IAAIQ,WAAYZ,GAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,EAAEA,EAAEF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGQ,QAAkD,IAAI,GAA1CL,GAAkB,kBAATX,IAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,GAAI,OAAOD,KAAKY,GAAG,SAASnB,EAAQoB,EAAOJ,GACvhB,YAiBA,SAASK,GAAkBC,EAAMC,EAAQC,EAAQC,GAGhDC,EAAMC,QAAS,aAAcL,IAEzBE,EACHE,EAAMC,QAAQ,SAAUL,EAAME,KAG9BE,EAAMC,QAAQ,WAAYL,EAAMG,IAChCC,EAAMC,QAAQJ,EAAS,KAAMD,EAAMG,KAIrC,QAASG,GAAkBN,EAAMC,EAAQC,EAAQC,GAOhD,GAJID,GACHF,EAAKO,QAAQJ,GAGVK,EAAOC,YAAc,CACxB,GAAIC,GAAmC,aAAvBF,EAAOC,YACnBE,EAAMD,GAAYE,SAAU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,EAGjBxE,EAAQwE,aAAeA,IAE7BvE,KAAK+C,gBAEI","file":"forms-api.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\nvar mc4wp = window.mc4wp || {};\n\n// bail early if we're on IE8..\n// TODO: just don't load in IE8\nif( ! window.addEventListener ) {\n\treturn;\n}\n\n// deps & vars\nvar Gator = require('gator');\nvar forms = require('./forms/forms.js');\nvar listeners = window.mc4wp && window.mc4wp.listeners ? window.mc4wp.listeners : [];\nvar config = window.mc4wp_forms_config || {};\n\n// funcs\nfunction triggerFormEvents(form, action, errors, data) {\n\n\t// trigger events\n\tforms.trigger( 'submitted', [form]);\n\n\tif( errors ) {\n\t\tforms.trigger('error', [form, errors]);\n\t} else {\n\t\t// form was successfully submitted\n\t\tforms.trigger('success', [form, data]);\n\t\tforms.trigger(action + \"d\", [form, data]);\n\t}\n}\n\nfunction handleFormRequest(form, action, errors, data){\n\n\t// re-populate form\n\tif( errors ) {\n\t\tform.setData(data);\n\t}\n\n\tif( config.auto_scroll ) {\n\t\tvar animate = ( config.auto_scroll === 'animated' );\n\t\tvar arg = animate ? { behavior: 'smooth' } : false;\n\t\tform.element.scrollIntoView(arg);\n\t}\n\n\t// trigger events on window.load so all other scripts have loaded\n\twindow.addEventListener('load', function(){\n\t\ttriggerFormEvents(form, action, errors, data);\n\t});\n}\n\n// register early listeners\nfor(var i=0; i<listeners.length;i++) {\n\tforms.on(listeners[i].event, listeners[i].callback);\n}\n\n// Bind browser events to form events (using delegation to work with AJAX loaded forms as well)\nGator(document.body).on('submit', '.mc4wp-form', function(event) {\n\tevent = event || window.event;\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('submit', [form, event]);\n});\n\nGator(document.body).on('focus', '.mc4wp-form', function(event) {\n\tevent = event || window.event;\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tif( ! form.started ) {\n\t\tforms.trigger('start', [form, event]);\n\t}\n});\n\nGator(document.body).on('change', '.mc4wp-form', function(event) {\n\tevent = event || window.event;\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('change', [form,event]);\n});\n\nif( config.submitted_form ) {\n\tvar formConfig = config.submitted_form,\n\t\telement = document.getElementById(formConfig.element_id),\n\t\tform = forms.getByElement(element);\n\n\thandleFormRequest(form, formConfig.action, formConfig.errors, formConfig.data);\n}\n\n// expose forms object\nmc4wp.forms = forms;\nwindow.mc4wp = mc4wp;\n\n},{\"./forms/forms.js\":3,\"gator\":6}],2:[function(require,module,exports){\n'use strict';\n\nvar serialize = require('../third-party/serialize.js');\nvar populate = require('populate.js');\nvar formToJson = require('../third-party/form2js.js');\n\nvar Form = function(id, element) {\n\n\tvar form = this;\n\n\tthis.id = id;\n\tthis.element = element || document.createElement('form');\n\tthis.name = this.element.getAttribute('data-name') || \"Form #\" + this.id;\n\tthis.errors = [];\n\tthis.started = false;\n\n\tthis.setData = function(data) {\n\t\tpopulate(form.element, data);\n\t};\n\n\tthis.getData = function() {\n\t\treturn formToJson(form.element);\n\t};\n\n\tthis.getSerializedData = function() {\n\t\treturn serialize(form.element);\n\t};\n\n\tthis.setResponse = function( msg ) {\n\t\tform.element.querySelector('.mc4wp-response').innerHTML = msg;\n\t};\n\n};\n\nmodule.exports = Form;\n\n},{\"../third-party/form2js.js\":4,\"../third-party/serialize.js\":5,\"populate.js\":7}],3:[function(require,module,exports){\n'use strict';\n\n// deps\nvar EventEmitter = require('wolfy87-eventemitter');\nvar Form = require('./form.js');\n\n// variables\nvar events = new EventEmitter();\nvar forms = [];\n\n// get form by its id\n// please note that this will get the FIRST occurence of the form with that ID on the page\nfunction get(formId) {\n\n\t// do we have form for this one already?\n\tfor(var i=0; i<forms.length;i++) {\n\t\tif(forms[i].id == formId) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\t// try to create from first occurence of this element\n\tvar formElement = document.querySelector('.mc4wp-form-' + formId);\n\treturn createFromElement(formElement,formId);\n}\n\n// get form by <form> element (or any input in form)\nfunction getByElement(element) {\n\tvar formElement = element.form || element;\n\tfor(var i=0; i<forms.length;i++) {\n\t\tif(forms[i].element == formElement) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\treturn createFromElement(element);\n}\n\n// create form object from <form> element\nfunction createFromElement(formElement,id) {\n\tid = id || parseInt( formElement.getAttribute('data-id') ) || 0;\n\tvar form = new Form(id,formElement);\n\tforms.push(form);\n\treturn form;\n}\n\nfunction all() {\n\treturn forms;\n}\n\nfunction on(event,callback) {\n\treturn events.on(event,callback);\n}\n\nfunction trigger(event,args) {\n\treturn events.trigger(event,args);\n}\n\nfunction off(event,callback) {\n\treturn events.off(event,callback);\n}\n\nmodule.exports = {\n\t\"all\": all,\n\t\"get\": get,\n\t\"getByElement\": getByElement,\n\t\"on\": on,\n\t\"trigger\": trigger,\n\t\"off\": off\n};\n\n\n},{\"./form.js\":2,\"wolfy87-eventemitter\":8}],4:[function(require,module,exports){\n/**\n * Copyright (c) 2010 Maxim Vasiliev\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * @author Maxim Vasiliev\n * Date: 09.09.2010\n * Time: 19:02:33\n */\n\n\n(function (root, factory)\n{\n\tif (typeof exports !== 'undefined' && typeof module !== 'undefined' && module.exports) {\n\t\t// NodeJS\n\t\tmodule.exports = factory();\n\t}\n\telse if (typeof define === 'function' && define.amd)\n\t{\n\t\t// AMD. Register as an anonymous module.\n\t\tdefine(factory);\n\t}\n\telse\n\t{\n\t\t// Browser globals\n\t\troot.form2js = factory();\n\t}\n}(this, function ()\n{\n\t\"use strict\";\n\n\t/**\n\t * Returns form values represented as Javascript object\n\t * \"name\" attribute defines structure of resulting object\n\t *\n\t * @param rootNode {Element|String} root form element (or it's id) or array of root elements\n\t * @param delimiter {String} structure parts delimiter defaults to '.'\n\t * @param skipEmpty {Boolean} should skip empty text values, defaults to true\n\t * @param nodeCallback {Function} custom function to get node value\n\t * @param useIdIfEmptyName {Boolean} if true value of id attribute of field will be used if name of field is empty\n\t */\n\tfunction form2js(rootNode, delimiter, skipEmpty, nodeCallback, useIdIfEmptyName, getDisabled)\n\t{\n\t\tgetDisabled = getDisabled ? true : false;\n\t\tif (typeof skipEmpty == 'undefined' || skipEmpty == null) skipEmpty = true;\n\t\tif (typeof delimiter == 'undefined' || delimiter == null) delimiter = '.';\n\t\tif (arguments.length < 5) useIdIfEmptyName = false;\n\n\t\trootNode = typeof rootNode == 'string' ? document.getElementById(rootNode) : rootNode;\n\n\t\tvar formValues = [],\n\t\t\tcurrNode,\n\t\t\ti = 0;\n\n\t\t/* If rootNode is array - combine values */\n\t\tif (rootNode.constructor == Array || (typeof NodeList != \"undefined\" && rootNode.constructor == NodeList))\n\t\t{\n\t\t\twhile(currNode = rootNode[i++])\n\t\t\t{\n\t\t\t\tformValues = formValues.concat(getFormValues(currNode, nodeCallback, useIdIfEmptyName, getDisabled));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tformValues = getFormValues(rootNode, nodeCallback, useIdIfEmptyName, getDisabled);\n\t\t}\n\n\t\treturn processNameValues(formValues, skipEmpty, delimiter);\n\t}\n\n\t/**\n\t * Processes collection of { name: 'name', value: 'value' } objects.\n\t * @param nameValues\n\t * @param skipEmpty if true skips elements with value == '' or value == null\n\t * @param delimiter\n\t */\n\tfunction processNameValues(nameValues, skipEmpty, delimiter)\n\t{\n\t\tvar result = {},\n\t\t\tarrays = {},\n\t\t\ti, j, k, l,\n\t\t\tvalue,\n\t\t\tnameParts,\n\t\t\tcurrResult,\n\t\t\tarrNameFull,\n\t\t\tarrName,\n\t\t\tarrIdx,\n\t\t\tnamePart,\n\t\t\tname,\n\t\t\t_nameParts;\n\n\t\tfor (i = 0; i < nameValues.length; i++)\n\t\t{\n\t\t\tvalue = nameValues[i].value;\n\n\t\t\tif (skipEmpty && (value === '' || value === null)) continue;\n\n\t\t\tname = nameValues[i].name;\n\t\t\t_nameParts = name.split(delimiter);\n\t\t\tnameParts = [];\n\t\t\tcurrResult = result;\n\t\t\tarrNameFull = '';\n\n\t\t\tfor(j = 0; j < _nameParts.length; j++)\n\t\t\t{\n\t\t\t\tnamePart = _nameParts[j].split('][');\n\t\t\t\tif (namePart.length > 1)\n\t\t\t\t{\n\t\t\t\t\tfor(k = 0; k < namePart.length; k++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (k == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnamePart[k] = namePart[k] + ']';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (k == namePart.length - 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnamePart[k] = '[' + namePart[k];\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnamePart[k] = '[' + namePart[k] + ']';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tarrIdx = namePart[k].match(/([a-z_]+)?\\[([a-z_][a-z0-9_]+?)\\]/i);\n\t\t\t\t\t\tif (arrIdx)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(l = 1; l < arrIdx.length; l++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (arrIdx[l]) nameParts.push(arrIdx[l]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tnameParts.push(namePart[k]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tnameParts = nameParts.concat(namePart);\n\t\t\t}\n\n\t\t\tfor (j = 0; j < nameParts.length; j++)\n\t\t\t{\n\t\t\t\tnamePart = nameParts[j];\n\n\t\t\t\tif (namePart.indexOf('[]') > -1 && j == nameParts.length - 1)\n\t\t\t\t{\n\t\t\t\t\tarrName = namePart.substr(0, namePart.indexOf('['));\n\t\t\t\t\tarrNameFull += arrName;\n\n\t\t\t\t\tif (!currResult[arrName]) currResult[arrName] = [];\n\t\t\t\t\tcurrResult[arrName].push(value);\n\t\t\t\t}\n\t\t\t\telse if (namePart.indexOf('[') > -1)\n\t\t\t\t{\n\t\t\t\t\tarrName = namePart.substr(0, namePart.indexOf('['));\n\t\t\t\t\tarrIdx = namePart.replace(/(^([a-z_]+)?\\[)|(\\]$)/gi, '');\n\n\t\t\t\t\t/* Unique array name */\n\t\t\t\t\tarrNameFull += '_' + arrName + '_' + arrIdx;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * Because arrIdx in field name can be not zero-based and step can be\n\t\t\t\t\t * other than 1, we can't use them in target array directly.\n\t\t\t\t\t * Instead we're making a hash where key is arrIdx and value is a reference to\n\t\t\t\t\t * added array element\n\t\t\t\t\t */\n\n\t\t\t\t\tif (!arrays[arrNameFull]) arrays[arrNameFull] = {};\n\t\t\t\t\tif (arrName != '' && !currResult[arrName]) currResult[arrName] = [];\n\n\t\t\t\t\tif (j == nameParts.length - 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (arrName == '')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcurrResult.push(value);\n\t\t\t\t\t\t\tarrays[arrNameFull][arrIdx] = currResult[currResult.length - 1];\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcurrResult[arrName].push(value);\n\t\t\t\t\t\t\tarrays[arrNameFull][arrIdx] = currResult[arrName][currResult[arrName].length - 1];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!arrays[arrNameFull][arrIdx])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ((/^[0-9a-z_]+\\[?/i).test(nameParts[j+1])) currResult[arrName].push({});\n\t\t\t\t\t\t\telse currResult[arrName].push([]);\n\n\t\t\t\t\t\t\tarrays[arrNameFull][arrIdx] = currResult[arrName][currResult[arrName].length - 1];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrResult = arrays[arrNameFull][arrIdx];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tarrNameFull += namePart;\n\n\t\t\t\t\tif (j < nameParts.length - 1) /* Not the last part of name - means object */\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!currResult[namePart]) currResult[namePart] = {};\n\t\t\t\t\t\tcurrResult = currResult[namePart];\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcurrResult[namePart] = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tfunction getFormValues(rootNode, nodeCallback, useIdIfEmptyName, getDisabled)\n\t{\n\t\tvar result = extractNodeValues(rootNode, nodeCallback, useIdIfEmptyName, getDisabled);\n\t\treturn result.length > 0 ? result : getSubFormValues(rootNode, nodeCallback, useIdIfEmptyName, getDisabled);\n\t}\n\n\tfunction getSubFormValues(rootNode, nodeCallback, useIdIfEmptyName, getDisabled)\n\t{\n\t\tvar result = [],\n\t\t\tcurrentNode = rootNode.firstChild;\n\n\t\twhile (currentNode)\n\t\t{\n\t\t\tresult = result.concat(extractNodeValues(currentNode, nodeCallback, useIdIfEmptyName, getDisabled));\n\t\t\tcurrentNode = currentNode.nextSibling;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tfunction extractNodeValues(node, nodeCallback, useIdIfEmptyName, getDisabled) {\n\t\tif (node.disabled && !getDisabled) return [];\n\n\t\tvar callbackResult, fieldValue, result, fieldName = getFieldName(node, useIdIfEmptyName);\n\n\t\tcallbackResult = nodeCallback && nodeCallback(node);\n\n\t\tif (callbackResult && callbackResult.name) {\n\t\t\tresult = [callbackResult];\n\t\t}\n\t\telse if (fieldName != '' && node.nodeName.match(/INPUT|TEXTAREA/i)) {\n\t\t\tfieldValue = getFieldValue(node, getDisabled);\n\t\t\tif (null === fieldValue) {\n\t\t\t\tresult = [];\n\t\t\t} else {\n\t\t\t\tresult = [ { name: fieldName, value: fieldValue} ];\n\t\t\t}\n\t\t}\n\t\telse if (fieldName != '' && node.nodeName.match(/SELECT/i)) {\n\t\t\tfieldValue = getFieldValue(node, getDisabled);\n\t\t\tresult = [ { name: fieldName.replace(/\\[\\]$/, ''), value: fieldValue } ];\n\t\t}\n\t\telse {\n\t\t\tresult = getSubFormValues(node, nodeCallback, useIdIfEmptyName, getDisabled);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tfunction getFieldName(node, useIdIfEmptyName)\n\t{\n\t\tif (node.name && node.name != '') return node.name;\n\t\telse if (useIdIfEmptyName && node.id && node.id != '') return node.id;\n\t\telse return '';\n\t}\n\n\n\tfunction getFieldValue(fieldNode, getDisabled)\n\t{\n\t\tif (fieldNode.disabled && !getDisabled) return null;\n\n\t\tswitch (fieldNode.nodeName) {\n\t\t\tcase 'INPUT':\n\t\t\tcase 'TEXTAREA':\n\t\t\t\tswitch (fieldNode.type.toLowerCase()) {\n\t\t\t\t\tcase 'radio':\n\t\t\t\t\t\tif (fieldNode.checked && fieldNode.value === \"false\") return false;\n\t\t\t\t\tcase 'checkbox':\n\t\t\t\t\t\tif (fieldNode.checked && fieldNode.value === \"true\") return true;\n\t\t\t\t\t\tif (!fieldNode.checked && fieldNode.value === \"true\") return false;\n\t\t\t\t\t\tif (fieldNode.checked) return fieldNode.value;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'button':\n\t\t\t\t\tcase 'reset':\n\t\t\t\t\tcase 'submit':\n\t\t\t\t\tcase 'image':\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn fieldNode.value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'SELECT':\n\t\t\t\treturn getSelectedOptionValue(fieldNode);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tfunction getSelectedOptionValue(selectNode)\n\t{\n\t\tvar multiple = selectNode.multiple,\n\t\t\tresult = [],\n\t\t\toptions,\n\t\t\ti, l;\n\n\t\tif (!multiple) return selectNode.value;\n\n\t\tfor (options = selectNode.getElementsByTagName(\"option\"), i = 0, l = options.length; i < l; i++)\n\t\t{\n\t\t\tif (options[i].selected) result.push(options[i].value);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\treturn form2js;\n\n}));\n},{}],5:[function(require,module,exports){\n// get successful control from form and assemble into object\n// http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2\n\n// types which indicate a submit action and are not successful controls\n// these will be ignored\nvar k_r_submitter = /^(?:submit|button|image|reset|file)$/i;\n\n// node names which could be successful controls\nvar k_r_success_contrls = /^(?:input|select|textarea|keygen)/i;\n\n// Matches bracket notation.\nvar brackets = /(\\[[^\\[\\]]*\\])/g;\n\n// serializes form fields\n// @param form MUST be an HTMLForm element\n// @param options is an optional argument to configure the serialization. Default output\n// with no options specified is a url encoded string\n// - hash: [true | false] Configure the output type. If true, the output will\n// be a js object.\n// - serializer: [function] Optional serializer function to override the default one.\n// The function takes 3 arguments (result, key, value) and should return new result\n// hash and url encoded str serializers are provided with this module\n// - disabled: [true | false]. If true serialize disabled fields.\n// - empty: [true | false]. If true serialize empty fields\nfunction serialize(form, options) {\n\tif (typeof options != 'object') {\n\t\toptions = { hash: !!options };\n\t}\n\telse if (options.hash === undefined) {\n\t\toptions.hash = true;\n\t}\n\n\tvar result = (options.hash) ? {} : '';\n\tvar serializer = options.serializer || ((options.hash) ? hash_serializer : str_serialize);\n\n\tvar elements = form && form.elements ? form.elements : [];\n\n\t//Object store each radio and set if it's empty or not\n\tvar radio_store = Object.create(null);\n\n\tfor (var i=0 ; i<elements.length ; ++i) {\n\t\tvar element = elements[i];\n\n\t\t// ingore disabled fields\n\t\tif ((!options.disabled && element.disabled) || !element.name) {\n\t\t\tcontinue;\n\t\t}\n\t\t// ignore anyhting that is not considered a success field\n\t\tif (!k_r_success_contrls.test(element.nodeName) ||\n\t\t\tk_r_submitter.test(element.type)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar key = element.name;\n\t\tvar val = element.value;\n\n\t\t// we can't just use element.value for checkboxes cause some browsers lie to us\n\t\t// they say \"on\" for value when the box isn't checked\n\t\tif ((element.type === 'checkbox' || element.type === 'radio') && !element.checked) {\n\t\t\tval = undefined;\n\t\t}\n\n\t\t// If we want empty elements\n\t\tif (options.empty) {\n\t\t\t// for checkbox\n\t\t\tif (element.type === 'checkbox' && !element.checked) {\n\t\t\t\tval = '';\n\t\t\t}\n\n\t\t\t// for radio\n\t\t\tif (element.type === 'radio') {\n\t\t\t\tif (!radio_store[element.name] && !element.checked) {\n\t\t\t\t\tradio_store[element.name] = false;\n\t\t\t\t}\n\t\t\t\telse if (element.checked) {\n\t\t\t\t\tradio_store[element.name] = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// if options empty is true, continue only if its radio\n\t\t\tif (!val && element.type == 'radio') {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// value-less fields are ignored unless options.empty is true\n\t\t\tif (!val) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t// multi select boxes\n\t\tif (element.type === 'select-multiple') {\n\t\t\tval = [];\n\n\t\t\tvar selectOptions = element.options;\n\t\t\tvar isSelectedOptions = false;\n\t\t\tfor (var j=0 ; j<selectOptions.length ; ++j) {\n\t\t\t\tvar option = selectOptions[j];\n\t\t\t\tvar allowedEmpty = options.empty && !option.value;\n\t\t\t\tvar hasValue = (option.value || allowedEmpty);\n\t\t\t\tif (option.selected && hasValue) {\n\t\t\t\t\tisSelectedOptions = true;\n\n\t\t\t\t\t// If using a hash serializer be sure to add the\n\t\t\t\t\t// correct notation for an array in the multi-select\n\t\t\t\t\t// context. Here the name attribute on the select element\n\t\t\t\t\t// might be missing the trailing bracket pair. Both names\n\t\t\t\t\t// \"foo\" and \"foo[]\" should be arrays.\n\t\t\t\t\tif (options.hash && key.slice(key.length - 2) !== '[]') {\n\t\t\t\t\t\tresult = serializer(result, key + '[]', option.value);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresult = serializer(result, key, option.value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Serialize if no selected options and options.empty is true\n\t\t\tif (!isSelectedOptions && options.empty) {\n\t\t\t\tresult = serializer(result, key, '');\n\t\t\t}\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult = serializer(result, key, val);\n\t}\n\n\t// Check for all empty radio buttons and serialize them with key=\"\"\n\tif (options.empty) {\n\t\tfor (var key in radio_store) {\n\t\t\tif (!radio_store[key]) {\n\t\t\t\tresult = serializer(result, key, '');\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction parse_keys(string) {\n\tvar keys = [];\n\tvar prefix = /^([^\\[\\]]*)/;\n\tvar children = new RegExp(brackets);\n\tvar match = prefix.exec(string);\n\n\tif (match[1]) {\n\t\tkeys.push(match[1]);\n\t}\n\n\twhile ((match = children.exec(string)) !== null) {\n\t\tkeys.push(match[1]);\n\t}\n\n\treturn keys;\n}\n\nfunction hash_assign(result, keys, value) {\n\tif (keys.length === 0) {\n\t\tresult = value;\n\t\treturn result;\n\t}\n\n\tvar key = keys.shift();\n\tvar between = key.match(/^\\[(.+?)\\]$/);\n\n\tif (key === '[]') {\n\t\tresult = result || [];\n\n\t\tif (Array.isArray(result)) {\n\t\t\tresult.push(hash_assign(null, keys, value));\n\t\t}\n\t\telse {\n\t\t\t// This might be the result of bad name attributes like \"[][foo]\",\n\t\t\t// in this case the original `result` object will already be\n\t\t\t// assigned to an object literal. Rather than coerce the object to\n\t\t\t// an array, or cause an exception the attribute \"_values\" is\n\t\t\t// assigned as an array.\n\t\t\tresult._values = result._values || [];\n\t\t\tresult._values.push(hash_assign(null, keys, value));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Key is an attribute name and can be assigned directly.\n\tif (!between) {\n\t\tresult[key] = hash_assign(result[key], keys, value);\n\t}\n\telse {\n\t\tvar string = between[1];\n\t\tvar index = parseInt(string, 10);\n\n\t\t// If the characters between the brackets is not a number it is an\n\t\t// attribute name and can be assigned directly.\n\t\tif (isNaN(index)) {\n\t\t\tresult = result || {};\n\t\t\tresult[string] = hash_assign(result[string], keys, value);\n\t\t}\n\t\telse {\n\t\t\tresult = result || [];\n\t\t\tresult[index] = hash_assign(result[index], keys, value);\n\t\t}\n\t}\n\n\treturn result;\n}\n\n// Object/hash encoding serializer.\nfunction hash_serializer(result, key, value) {\n\tvar matches = key.match(brackets);\n\n\t// Has brackets? Use the recursive assignment function to walk the keys,\n\t// construct any missing objects in the result tree and make the assignment\n\t// at the end of the chain.\n\tif (matches) {\n\t\tvar keys = parse_keys(key);\n\t\thash_assign(result, keys, value);\n\t}\n\telse {\n\t\t// Non bracket notation can make assignments directly.\n\t\tvar existing = result[key];\n\n\t\t// If the value has been assigned already (for instance when a radio and\n\t\t// a checkbox have the same name attribute) convert the previous value\n\t\t// into an array before pushing into it.\n\t\t//\n\t\t// NOTE: If this requirement were removed all hash creation and\n\t\t// assignment could go through `hash_assign`.\n\t\tif (existing) {\n\t\t\tif (!Array.isArray(existing)) {\n\t\t\t\tresult[key] = [ existing ];\n\t\t\t}\n\n\t\t\tresult[key].push(value);\n\t\t}\n\t\telse {\n\t\t\tresult[key] = value;\n\t\t}\n\t}\n\n\treturn result;\n}\n\n// urlform encoding serializer\nfunction str_serialize(result, key, value) {\n\t// encode newlines as \\r\\n cause the html spec says so\n\tvalue = value.replace(/(\\r)?\\n/g, '\\r\\n');\n\tvalue = encodeURIComponent(value);\n\n\t// spaces should be '+' rather than '%20'.\n\tvalue = value.replace(/%20/g, '+');\n\treturn result + (result ? '&' : '') + encodeURIComponent(key) + '=' + value;\n}\n\nmodule.exports = serialize;\n},{}],6:[function(require,module,exports){\n/**\n * Copyright 2014 Craig Campbell\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * GATOR.JS\n * Simple Event Delegation\n *\n * @version 1.2.4\n *\n * Compatible with IE 9+, FF 3.6+, Safari 5+, Chrome\n *\n * Include legacy.js for compatibility with older browsers\n *\n * .-._ _ _ _ _ _ _ _ _\n * .-''-.__.-'00 '-' ' ' ' ' ' ' ' '-.\n * '.___ ' . .--_'-' '-' '-' _'-' '._\n * V: V 'vv-' '_ '. .' _..' '.'.\n * '=.____.=_.--' :_.__.__:_ '. : :\n * (((____.-' '-. / : :\n * (((-'\\ .' /\n * _____..' .'\n * '-._____.-'\n */\n(function() {\n var _matcher,\n _level = 0,\n _id = 0,\n _handlers = {},\n _gatorInstances = {};\n\n function _addEvent(gator, type, callback) {\n\n // blur and focus do not bubble up but if you use event capturing\n // then you will get them\n var useCapture = type == 'blur' || type == 'focus';\n gator.element.addEventListener(type, callback, useCapture);\n }\n\n function _cancel(e) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n /**\n * returns function to use for determining if an element\n * matches a query selector\n *\n * @returns {Function}\n */\n function _getMatcher(element) {\n if (_matcher) {\n return _matcher;\n }\n\n if (element.matches) {\n _matcher = element.matches;\n return _matcher;\n }\n\n if (element.webkitMatchesSelector) {\n _matcher = element.webkitMatchesSelector;\n return _matcher;\n }\n\n if (element.mozMatchesSelector) {\n _matcher = element.mozMatchesSelector;\n return _matcher;\n }\n\n if (element.msMatchesSelector) {\n _matcher = element.msMatchesSelector;\n return _matcher;\n }\n\n if (element.oMatchesSelector) {\n _matcher = element.oMatchesSelector;\n return _matcher;\n }\n\n // if it doesn't match a native browser method\n // fall back to the gator function\n _matcher = Gator.matchesSelector;\n return _matcher;\n }\n\n /**\n * determines if the specified element matches a given selector\n *\n * @param {Node} element - the element to compare against the selector\n * @param {string} selector\n * @param {Node} boundElement - the element the listener was attached to\n * @returns {void|Node}\n */\n function _matchesSelector(element, selector, boundElement) {\n\n // no selector means this event was bound directly to this element\n if (selector == '_root') {\n return boundElement;\n }\n\n // if we have moved up to the element you bound the event to\n // then we have come too far\n if (element === boundElement) {\n return;\n }\n\n // if this is a match then we are done!\n if (_getMatcher(element).call(element, selector)) {\n return element;\n }\n\n // if this element did not match but has a parent we should try\n // going up the tree to see if any of the parent elements match\n // for example if you are looking for a click on an <a> tag but there\n // is a <span> inside of the a tag that it is the target,\n // it should still work\n if (element.parentNode) {\n _level++;\n return _matchesSelector(element.parentNode, selector, boundElement);\n }\n }\n\n function _addHandler(gator, event, selector, callback) {\n if (!_handlers[gator.id]) {\n _handlers[gator.id] = {};\n }\n\n if (!_handlers[gator.id][event]) {\n _handlers[gator.id][event] = {};\n }\n\n if (!_handlers[gator.id][event][selector]) {\n _handlers[gator.id][event][selector] = [];\n }\n\n _handlers[gator.id][event][selector].push(callback);\n }\n\n function _removeHandler(gator, event, selector, callback) {\n\n // if there are no events tied to this element at all\n // then don't do anything\n if (!_handlers[gator.id]) {\n return;\n }\n\n // if there is no event type specified then remove all events\n // example: Gator(element).off()\n if (!event) {\n for (var type in _handlers[gator.id]) {\n if (_handlers[gator.id].hasOwnProperty(type)) {\n _handlers[gator.id][type] = {};\n }\n }\n return;\n }\n\n // if no callback or selector is specified remove all events of this type\n // example: Gator(element).off('click')\n if (!callback && !selector) {\n _handlers[gator.id][event] = {};\n return;\n }\n\n // if a selector is specified but no callback remove all events\n // for this selector\n // example: Gator(element).off('click', '.sub-element')\n if (!callback) {\n delete _handlers[gator.id][event][selector];\n return;\n }\n\n // if we have specified an event type, selector, and callback then we\n // need to make sure there are callbacks tied to this selector to\n // begin with. if there aren't then we can stop here\n if (!_handlers[gator.id][event][selector]) {\n return;\n }\n\n // if there are then loop through all the callbacks and if we find\n // one that matches remove it from the array\n for (var i = 0; i < _handlers[gator.id][event][selector].length; i++) {\n if (_handlers[gator.id][event][selector][i] === callback) {\n _handlers[gator.id][event][selector].splice(i, 1);\n break;\n }\n }\n }\n\n function _handleEvent(id, e, type) {\n if (!_handlers[id][type]) {\n return;\n }\n\n var target = e.target || e.srcElement,\n selector,\n match,\n matches = {},\n i = 0,\n j = 0;\n\n // find all events that match\n _level = 0;\n for (selector in _handlers[id][type]) {\n if (_handlers[id][type].hasOwnProperty(selector)) {\n match = _matchesSelector(target, selector, _gatorInstances[id].element);\n\n if (match && Gator.matchesEvent(type, _gatorInstances[id].element, match, selector == '_root', e)) {\n _level++;\n _handlers[id][type][selector].match = match;\n matches[_level] = _handlers[id][type][selector];\n }\n }\n }\n\n // stopPropagation() fails to set cancelBubble to true in Webkit\n // @see http://code.google.com/p/chromium/issues/detail?id=162270\n e.stopPropagation = function() {\n e.cancelBubble = true;\n };\n\n for (i = 0; i <= _level; i++) {\n if (matches[i]) {\n for (j = 0; j < matches[i].length; j++) {\n if (matches[i][j].call(matches[i].match, e) === false) {\n Gator.cancel(e);\n return;\n }\n\n if (e.cancelBubble) {\n return;\n }\n }\n }\n }\n }\n\n /**\n * binds the specified events to the element\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @param {boolean=} remove\n * @returns {Object}\n */\n function _bind(events, selector, callback, remove) {\n\n // fail silently if you pass null or undefined as an alement\n // in the Gator constructor\n if (!this.element) {\n return;\n }\n\n if (!(events instanceof Array)) {\n events = [events];\n }\n\n if (!callback && typeof(selector) == 'function') {\n callback = selector;\n selector = '_root';\n }\n\n var id = this.id,\n i;\n\n function _getGlobalCallback(type) {\n return function(e) {\n _handleEvent(id, e, type);\n };\n }\n\n for (i = 0; i < events.length; i++) {\n if (remove) {\n _removeHandler(this, events[i], selector, callback);\n continue;\n }\n\n if (!_handlers[id] || !_handlers[id][events[i]]) {\n Gator.addEvent(this, events[i], _getGlobalCallback(events[i]));\n }\n\n _addHandler(this, events[i], selector, callback);\n }\n\n return this;\n }\n\n /**\n * Gator object constructor\n *\n * @param {Node} element\n */\n function Gator(element, id) {\n\n // called as function\n if (!(this instanceof Gator)) {\n // only keep one Gator instance per node to make sure that\n // we don't create a ton of new objects if you want to delegate\n // multiple events from the same node\n //\n // for example: Gator(document).on(...\n for (var key in _gatorInstances) {\n if (_gatorInstances[key].element === element) {\n return _gatorInstances[key];\n }\n }\n\n _id++;\n _gatorInstances[_id] = new Gator(element, _id);\n\n return _gatorInstances[_id];\n }\n\n this.element = element;\n this.id = id;\n }\n\n /**\n * adds an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.on = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback);\n };\n\n /**\n * removes an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.off = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback, true);\n };\n\n Gator.matchesSelector = function() {};\n Gator.cancel = _cancel;\n Gator.addEvent = _addEvent;\n Gator.matchesEvent = function() {\n return true;\n };\n\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = Gator;\n }\n\n window.Gator = Gator;\n}) ();\n\n},{}],7:[function(require,module,exports){\n/*! populate.js v1.0.2 by @dannyvankooten | MIT license */\n;(function(root) {\n\n\t/**\n\t * Populate form fields from a JSON object.\n\t *\n\t * @param form object The form element containing your input fields.\n\t * @param data array JSON data to populate the fields with.\n\t * @param basename string Optional basename which is added to `name` attributes\n\t */\n\tvar populate = function( form, data, basename) {\n\n\t\tfor(var key in data) {\n\n\t\t\tif( ! data.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar name = key;\n\t\t\tvar value = data[key];\n\n\t\t\t// handle array name attributes\n\t\t\tif(typeof(basename) !== \"undefined\") {\n\t\t\t\tname = basename + \"[\" + key + \"]\";\n\t\t\t}\n\n\t\t\tif(value.constructor === Array) {\n\t\t\t\tname += '[]';\n\t\t\t} else if(typeof value == \"object\") {\n\t\t\t\tpopulate( form, value, name);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// only proceed if element is set\n\t\t\tvar element = form.elements.namedItem( name );\n\t\t\tif( ! element ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar type = element.type || element[0].type;\n\n\t\t\tswitch(type ) {\n\t\t\t\tdefault:\n\t\t\t\t\telement.value = value;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'radio':\n\t\t\t\tcase 'checkbox':\n\t\t\t\t\tfor( var j=0; j < element.length; j++ ) {\n\t\t\t\t\t\telement[j].checked = ( value.indexOf(element[j].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select-multiple':\n\t\t\t\t\tvar values = value.constructor == Array ? value : [value];\n\n\t\t\t\t\tfor(var k = 0; k < element.options.length; k++) {\n\t\t\t\t\t\telement.options[k].selected |= (values.indexOf(element.options[k].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select':\n\t\t\t\tcase 'select-one':\n\t\t\t\t\telement.value = value.toString() || value;\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n\t// Play nice with AMD, CommonJS or a plain global object.\n\tif ( typeof define == 'function' && typeof define.amd == 'object' && define.amd ) {\n\t\tdefine(function() {\n\t\t\treturn populate;\n\t\t});\n\t}\telse if ( typeof module !== 'undefined' && module.exports ) {\n\t\tmodule.exports = populate;\n\t} else {\n\t\troot.populate = populate;\n\t}\n\n}(this));\n},{}],8:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}]},{},[1]);\n })();"],"sourceRoot":"/source/"}
1
+ {"version":3,"sources":["forms-api.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length",1,"module","triggerFormEvents","form","action","errors","data","forms","trigger","handleFormRequest","setData","config","auto_scroll","animate","arg","behavior","element","scrollIntoView","window","addEventListener","mc4wp","Gator","listeners","mc4wp_forms_config","on","event","callback","document","body","getByElement","target","srcElement","started","submitted_form","formConfig","getElementById","element_id","./forms/forms.js","gator",2,"serialize","populate","formToJson","Form","id","this","createElement","name","getAttribute","console","error","getData","getSerializedData","setResponse","msg","querySelector","innerHTML","../third-party/form2js.js","../third-party/serialize.js","populate.js",3,"get","formId","formElement","createFromElement","parseInt","push","all","events","args","off","EventEmitter","./form.js","wolfy87-eventemitter",4,"root","factory","amd","form2js","rootNode","delimiter","skipEmpty","nodeCallback","useIdIfEmptyName","getDisabled","arguments","currNode","formValues","constructor","Array","NodeList","concat","getFormValues","processNameValues","nameValues","j","k","value","nameParts","currResult","arrNameFull","arrName","arrIdx","namePart","_nameParts","result","arrays","split","match","indexOf","substr","replace","test","extractNodeValues","getSubFormValues","currentNode","firstChild","nextSibling","node","disabled","callbackResult","fieldValue","fieldName","getFieldName","nodeName","getFieldValue","fieldNode","type","toLowerCase","checked","getSelectedOptionValue","selectNode","options","multiple","getElementsByTagName","selected",5,"hash","serializer","hash_serializer","str_serialize","elements","radio_store","Object","create","k_r_success_contrls","k_r_submitter","key","val","empty","selectOptions","isSelectedOptions","option","allowedEmpty","hasValue","slice","parse_keys","string","keys","prefix","children","RegExp","brackets","exec","hash_assign","shift","between","isArray","_values","index","isNaN","matches","existing","encodeURIComponent",6,"_addEvent","useCapture","_cancel","preventDefault","stopPropagation","_getMatcher","_matcher","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","matchesSelector","_matchesSelector","selector","boundElement","parentNode","_level","_addHandler","_handlers","_removeHandler","splice","hasOwnProperty","_handleEvent","_gatorInstances","matchesEvent","cancelBubble","cancel","_bind","remove","_getGlobalCallback","addEvent","_id","prototype",7,"basename","namedItem","values","toString",8,"indexOfListener","listener","alias","apply","proto","originalGlobalValue","getListeners","evt","response","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","addListeners","manipulateListeners","removeListeners","single","removeEvent","_events","removeAllListeners","emitEvent","listenersMap","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict"],"mappings":"CAAA,WAAe,GAAIA,GAAUC,OAAeC,EAASD,QAAW,QAAUE,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATV,IAAqBA,CAAQ,KAAIS,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGG,EAAE,MAAOA,GAAEH,GAAE,EAAI,IAAII,GAAE,GAAIC,OAAM,uBAAuBL,EAAE,IAAK,MAAMI,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEV,EAAEG,IAAIQ,WAAYZ,GAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG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,MAAM5K,KAAMwB,OAErCyJ,IAAajL,KAAKuM,uBAClBvM,KAAK6L,eAAeb,EAAKN,EAASA,SAMlD,OAAO1K,OAMX6K,EAAMlN,QAAUgN,EAAM,aAUtBE,EAAM2B,KAAO,SAAcxB,GACvB,GAAIxJ,GAAOoB,MAAMsH,UAAUpD,MAAM7J,KAAKuF,UAAW,EACjD,OAAOxC,MAAKqM,UAAUrB,EAAKxJ,IAW/BqJ,EAAM4B,mBAAqB,SAA4BrJ,GAEnD,MADApD,MAAK0M,iBAAmBtJ,EACjBpD,MAWX6K,EAAM0B,oBAAsB,WACxB,MAAIvM,MAAKuJ,eAAe,oBACbvJ,KAAK0M,kBAGL,GAUf7B,EAAMK,WAAa,WACf,MAAOlL,MAAKmM,UAAYnM,KAAKmM,aAQjCzK,EAAaiL,WAAa,WAEtB,MADA3P,GAAQ0E,aAAeoJ,EAChBpJ,GAIW,kBAAXxF,IAAyBA,EAAO8F,IACvC9F,EAAO,WACH,MAAOwF,KAGY,gBAAXtE,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAU0E,EAGjB1E,EAAQ0E,aAAeA,IAE7BzE,KAAK+C,gBAEI","file":"forms-api.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\nvar mc4wp = window.mc4wp || {};\n\n// bail early if we're on IE8..\n// TODO: just don't load in IE8\nif( ! window.addEventListener ) {\n\treturn;\n}\n\n// deps & vars\nvar Gator = require('gator');\nvar forms = require('./forms/forms.js');\nvar listeners = window.mc4wp && window.mc4wp.listeners ? window.mc4wp.listeners : [];\nvar config = window.mc4wp_forms_config || {};\n\n// funcs\nfunction triggerFormEvents(form, action, errors, data) {\n\n\t// trigger events\n\tforms.trigger( 'submitted', [form]);\n\n\tif( errors ) {\n\t\tforms.trigger('error', [form, errors]);\n\t} else {\n\t\t// form was successfully submitted\n\t\tforms.trigger('success', [form, data]);\n\t\tforms.trigger(action + \"d\", [form, data]);\n\t}\n}\n\nfunction handleFormRequest(form, action, errors, data){\n\n\t// re-populate form\n\tif( errors ) {\n\t\tform.setData(data);\n\t}\n\n\tif( config.auto_scroll ) {\n\t\tvar animate = ( config.auto_scroll === 'animated' );\n\t\tvar arg = animate ? { behavior: 'smooth' } : false;\n\t\tform.element.scrollIntoView(arg);\n\t}\n\n\t// trigger events on window.load so all other scripts have loaded\n\twindow.addEventListener('load', function(){\n\t\ttriggerFormEvents(form, action, errors, data);\n\t});\n}\n\n// register early listeners\nfor(var i=0; i<listeners.length;i++) {\n\tforms.on(listeners[i].event, listeners[i].callback);\n}\n\n// Bind browser events to form events (using delegation to work with AJAX loaded forms as well)\nGator(document.body).on('submit', '.mc4wp-form', function(event) {\n\tevent = event || window.event;\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('submit', [form, event]);\n});\n\nGator(document.body).on('focus', '.mc4wp-form', function(event) {\n\tevent = event || window.event;\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\n\tif( ! form.started ) {\n\t\tforms.trigger('started', [form, event]);\n\t\tform.started = true;\n\t}\n});\n\nGator(document.body).on('change', '.mc4wp-form', function(event) {\n\tevent = event || window.event;\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('change', [form,event]);\n});\n\nif( config.submitted_form ) {\n\tvar formConfig = config.submitted_form,\n\t\telement = document.getElementById(formConfig.element_id),\n\t\tform = forms.getByElement(element);\n\n\thandleFormRequest(form, formConfig.action, formConfig.errors, formConfig.data);\n}\n\n// expose forms object\nmc4wp.forms = forms;\nwindow.mc4wp = mc4wp;\n\n},{\"./forms/forms.js\":3,\"gator\":6}],2:[function(require,module,exports){\n'use strict';\n\nvar serialize = require('../third-party/serialize.js');\nvar populate = require('populate.js');\nvar formToJson = require('../third-party/form2js.js');\n\nvar Form = function(id, element) {\n\n\tvar form = this;\n\n\tthis.id = id;\n\tthis.element = element || document.createElement('form');\n\tthis.name = this.element.getAttribute('data-name') || \"Form #\" + this.id;\n\tthis.errors = [];\n\tthis.started = false;\n\n\tthis.setData = function(data) {\n\t\ttry {\n\t\t\tpopulate(form.element, data);\n\t\t} catch(e) {\n\t\t\tconsole.error(e);\n\t\t}\n\t};\n\n\tthis.getData = function() {\n\t\treturn formToJson(form.element);\n\t};\n\n\tthis.getSerializedData = function() {\n\t\treturn serialize(form.element);\n\t};\n\n\tthis.setResponse = function( msg ) {\n\t\tform.element.querySelector('.mc4wp-response').innerHTML = msg;\n\t};\n\n};\n\nmodule.exports = Form;\n\n},{\"../third-party/form2js.js\":4,\"../third-party/serialize.js\":5,\"populate.js\":7}],3:[function(require,module,exports){\n'use strict';\n\n// deps\nvar EventEmitter = require('wolfy87-eventemitter');\nvar Form = require('./form.js');\n\n// variables\nvar events = new EventEmitter();\nvar forms = [];\n\n// get form by its id\n// please note that this will get the FIRST occurence of the form with that ID on the page\nfunction get(formId) {\n\n\t// do we have form for this one already?\n\tfor(var i=0; i<forms.length;i++) {\n\t\tif(forms[i].id == formId) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\t// try to create from first occurence of this element\n\tvar formElement = document.querySelector('.mc4wp-form-' + formId);\n\treturn createFromElement(formElement,formId);\n}\n\n// get form by <form> element (or any input in form)\nfunction getByElement(element) {\n\tvar formElement = element.form || element;\n\n\tfor(var i=0; i < forms.length; i++) {\n\t\tif(forms[i].element == formElement) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\treturn createFromElement(formElement);\n}\n\n// create form object from <form> element\nfunction createFromElement(formElement, id) {\n\tid = id || parseInt( formElement.getAttribute('data-id') ) || 0;\n\tvar form = new Form(id, formElement);\n\tforms.push(form);\n\treturn form;\n}\n\nfunction all() {\n\treturn forms;\n}\n\nfunction on(event,callback) {\n\treturn events.on(event,callback);\n}\n\nfunction trigger(event,args) {\n\treturn events.trigger(event,args);\n}\n\nfunction off(event,callback) {\n\treturn events.off(event,callback);\n}\n\nmodule.exports = {\n\t\"all\": all,\n\t\"get\": get,\n\t\"getByElement\": getByElement,\n\t\"on\": on,\n\t\"trigger\": trigger,\n\t\"off\": off\n};\n\n\n},{\"./form.js\":2,\"wolfy87-eventemitter\":8}],4:[function(require,module,exports){\n/**\n * Copyright (c) 2010 Maxim Vasiliev\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * @author Maxim Vasiliev\n * Date: 09.09.2010\n * Time: 19:02:33\n */\n\n\n(function (root, factory)\n{\n\tif (typeof exports !== 'undefined' && typeof module !== 'undefined' && module.exports) {\n\t\t// NodeJS\n\t\tmodule.exports = factory();\n\t}\n\telse if (typeof define === 'function' && define.amd)\n\t{\n\t\t// AMD. Register as an anonymous module.\n\t\tdefine(factory);\n\t}\n\telse\n\t{\n\t\t// Browser globals\n\t\troot.form2js = factory();\n\t}\n}(this, function ()\n{\n\t\"use strict\";\n\n\t/**\n\t * Returns form values represented as Javascript object\n\t * \"name\" attribute defines structure of resulting object\n\t *\n\t * @param rootNode {Element|String} root form element (or it's id) or array of root elements\n\t * @param delimiter {String} structure parts delimiter defaults to '.'\n\t * @param skipEmpty {Boolean} should skip empty text values, defaults to true\n\t * @param nodeCallback {Function} custom function to get node value\n\t * @param useIdIfEmptyName {Boolean} if true value of id attribute of field will be used if name of field is empty\n\t */\n\tfunction form2js(rootNode, delimiter, skipEmpty, nodeCallback, useIdIfEmptyName, getDisabled)\n\t{\n\t\tgetDisabled = getDisabled ? true : false;\n\t\tif (typeof skipEmpty == 'undefined' || skipEmpty == null) skipEmpty = true;\n\t\tif (typeof delimiter == 'undefined' || delimiter == null) delimiter = '.';\n\t\tif (arguments.length < 5) useIdIfEmptyName = false;\n\n\t\trootNode = typeof rootNode == 'string' ? document.getElementById(rootNode) : rootNode;\n\n\t\tvar formValues = [],\n\t\t\tcurrNode,\n\t\t\ti = 0;\n\n\t\t/* If rootNode is array - combine values */\n\t\tif (rootNode.constructor == Array || (typeof NodeList != \"undefined\" && rootNode.constructor == NodeList))\n\t\t{\n\t\t\twhile(currNode = rootNode[i++])\n\t\t\t{\n\t\t\t\tformValues = formValues.concat(getFormValues(currNode, nodeCallback, useIdIfEmptyName, getDisabled));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tformValues = getFormValues(rootNode, nodeCallback, useIdIfEmptyName, getDisabled);\n\t\t}\n\n\t\treturn processNameValues(formValues, skipEmpty, delimiter);\n\t}\n\n\t/**\n\t * Processes collection of { name: 'name', value: 'value' } objects.\n\t * @param nameValues\n\t * @param skipEmpty if true skips elements with value == '' or value == null\n\t * @param delimiter\n\t */\n\tfunction processNameValues(nameValues, skipEmpty, delimiter)\n\t{\n\t\tvar result = {},\n\t\t\tarrays = {},\n\t\t\ti, j, k, l,\n\t\t\tvalue,\n\t\t\tnameParts,\n\t\t\tcurrResult,\n\t\t\tarrNameFull,\n\t\t\tarrName,\n\t\t\tarrIdx,\n\t\t\tnamePart,\n\t\t\tname,\n\t\t\t_nameParts;\n\n\t\tfor (i = 0; i < nameValues.length; i++)\n\t\t{\n\t\t\tvalue = nameValues[i].value;\n\n\t\t\tif (skipEmpty && (value === '' || value === null)) continue;\n\n\t\t\tname = nameValues[i].name;\n\t\t\t_nameParts = name.split(delimiter);\n\t\t\tnameParts = [];\n\t\t\tcurrResult = result;\n\t\t\tarrNameFull = '';\n\n\t\t\tfor(j = 0; j < _nameParts.length; j++)\n\t\t\t{\n\t\t\t\tnamePart = _nameParts[j].split('][');\n\t\t\t\tif (namePart.length > 1)\n\t\t\t\t{\n\t\t\t\t\tfor(k = 0; k < namePart.length; k++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (k == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnamePart[k] = namePart[k] + ']';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (k == namePart.length - 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnamePart[k] = '[' + namePart[k];\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnamePart[k] = '[' + namePart[k] + ']';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tarrIdx = namePart[k].match(/([a-z_]+)?\\[([a-z_][a-z0-9_]+?)\\]/i);\n\t\t\t\t\t\tif (arrIdx)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(l = 1; l < arrIdx.length; l++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (arrIdx[l]) nameParts.push(arrIdx[l]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tnameParts.push(namePart[k]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tnameParts = nameParts.concat(namePart);\n\t\t\t}\n\n\t\t\tfor (j = 0; j < nameParts.length; j++)\n\t\t\t{\n\t\t\t\tnamePart = nameParts[j];\n\n\t\t\t\tif (namePart.indexOf('[]') > -1 && j == nameParts.length - 1)\n\t\t\t\t{\n\t\t\t\t\tarrName = namePart.substr(0, namePart.indexOf('['));\n\t\t\t\t\tarrNameFull += arrName;\n\n\t\t\t\t\tif (!currResult[arrName]) currResult[arrName] = [];\n\t\t\t\t\tcurrResult[arrName].push(value);\n\t\t\t\t}\n\t\t\t\telse if (namePart.indexOf('[') > -1)\n\t\t\t\t{\n\t\t\t\t\tarrName = namePart.substr(0, namePart.indexOf('['));\n\t\t\t\t\tarrIdx = namePart.replace(/(^([a-z_]+)?\\[)|(\\]$)/gi, '');\n\n\t\t\t\t\t/* Unique array name */\n\t\t\t\t\tarrNameFull += '_' + arrName + '_' + arrIdx;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * Because arrIdx in field name can be not zero-based and step can be\n\t\t\t\t\t * other than 1, we can't use them in target array directly.\n\t\t\t\t\t * Instead we're making a hash where key is arrIdx and value is a reference to\n\t\t\t\t\t * added array element\n\t\t\t\t\t */\n\n\t\t\t\t\tif (!arrays[arrNameFull]) arrays[arrNameFull] = {};\n\t\t\t\t\tif (arrName != '' && !currResult[arrName]) currResult[arrName] = [];\n\n\t\t\t\t\tif (j == nameParts.length - 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (arrName == '')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcurrResult.push(value);\n\t\t\t\t\t\t\tarrays[arrNameFull][arrIdx] = currResult[currResult.length - 1];\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcurrResult[arrName].push(value);\n\t\t\t\t\t\t\tarrays[arrNameFull][arrIdx] = currResult[arrName][currResult[arrName].length - 1];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!arrays[arrNameFull][arrIdx])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ((/^[0-9a-z_]+\\[?/i).test(nameParts[j+1])) currResult[arrName].push({});\n\t\t\t\t\t\t\telse currResult[arrName].push([]);\n\n\t\t\t\t\t\t\tarrays[arrNameFull][arrIdx] = currResult[arrName][currResult[arrName].length - 1];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrResult = arrays[arrNameFull][arrIdx];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tarrNameFull += namePart;\n\n\t\t\t\t\tif (j < nameParts.length - 1) /* Not the last part of name - means object */\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!currResult[namePart]) currResult[namePart] = {};\n\t\t\t\t\t\tcurrResult = currResult[namePart];\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcurrResult[namePart] = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tfunction getFormValues(rootNode, nodeCallback, useIdIfEmptyName, getDisabled)\n\t{\n\t\tvar result = extractNodeValues(rootNode, nodeCallback, useIdIfEmptyName, getDisabled);\n\t\treturn result.length > 0 ? result : getSubFormValues(rootNode, nodeCallback, useIdIfEmptyName, getDisabled);\n\t}\n\n\tfunction getSubFormValues(rootNode, nodeCallback, useIdIfEmptyName, getDisabled)\n\t{\n\t\tvar result = [],\n\t\t\tcurrentNode = rootNode.firstChild;\n\n\t\twhile (currentNode)\n\t\t{\n\t\t\tresult = result.concat(extractNodeValues(currentNode, nodeCallback, useIdIfEmptyName, getDisabled));\n\t\t\tcurrentNode = currentNode.nextSibling;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tfunction extractNodeValues(node, nodeCallback, useIdIfEmptyName, getDisabled) {\n\t\tif (node.disabled && !getDisabled) return [];\n\n\t\tvar callbackResult, fieldValue, result, fieldName = getFieldName(node, useIdIfEmptyName);\n\n\t\tcallbackResult = nodeCallback && nodeCallback(node);\n\n\t\tif (callbackResult && callbackResult.name) {\n\t\t\tresult = [callbackResult];\n\t\t}\n\t\telse if (fieldName != '' && node.nodeName.match(/INPUT|TEXTAREA/i)) {\n\t\t\tfieldValue = getFieldValue(node, getDisabled);\n\t\t\tif (null === fieldValue) {\n\t\t\t\tresult = [];\n\t\t\t} else {\n\t\t\t\tresult = [ { name: fieldName, value: fieldValue} ];\n\t\t\t}\n\t\t}\n\t\telse if (fieldName != '' && node.nodeName.match(/SELECT/i)) {\n\t\t\tfieldValue = getFieldValue(node, getDisabled);\n\t\t\tresult = [ { name: fieldName.replace(/\\[\\]$/, ''), value: fieldValue } ];\n\t\t}\n\t\telse {\n\t\t\tresult = getSubFormValues(node, nodeCallback, useIdIfEmptyName, getDisabled);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tfunction getFieldName(node, useIdIfEmptyName)\n\t{\n\t\tif (node.name && node.name != '') return node.name;\n\t\telse if (useIdIfEmptyName && node.id && node.id != '') return node.id;\n\t\telse return '';\n\t}\n\n\n\tfunction getFieldValue(fieldNode, getDisabled)\n\t{\n\t\tif (fieldNode.disabled && !getDisabled) return null;\n\n\t\tswitch (fieldNode.nodeName) {\n\t\t\tcase 'INPUT':\n\t\t\tcase 'TEXTAREA':\n\t\t\t\tswitch (fieldNode.type.toLowerCase()) {\n\t\t\t\t\tcase 'radio':\n\t\t\t\t\t\tif (fieldNode.checked && fieldNode.value === \"false\") return false;\n\t\t\t\t\tcase 'checkbox':\n\t\t\t\t\t\tif (fieldNode.checked && fieldNode.value === \"true\") return true;\n\t\t\t\t\t\tif (!fieldNode.checked && fieldNode.value === \"true\") return false;\n\t\t\t\t\t\tif (fieldNode.checked) return fieldNode.value;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'button':\n\t\t\t\t\tcase 'reset':\n\t\t\t\t\tcase 'submit':\n\t\t\t\t\tcase 'image':\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn fieldNode.value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'SELECT':\n\t\t\t\treturn getSelectedOptionValue(fieldNode);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tfunction getSelectedOptionValue(selectNode)\n\t{\n\t\tvar multiple = selectNode.multiple,\n\t\t\tresult = [],\n\t\t\toptions,\n\t\t\ti, l;\n\n\t\tif (!multiple) return selectNode.value;\n\n\t\tfor (options = selectNode.getElementsByTagName(\"option\"), i = 0, l = options.length; i < l; i++)\n\t\t{\n\t\t\tif (options[i].selected) result.push(options[i].value);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\treturn form2js;\n\n}));\n},{}],5:[function(require,module,exports){\n// get successful control from form and assemble into object\n// http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2\n\n// types which indicate a submit action and are not successful controls\n// these will be ignored\nvar k_r_submitter = /^(?:submit|button|image|reset|file)$/i;\n\n// node names which could be successful controls\nvar k_r_success_contrls = /^(?:input|select|textarea|keygen)/i;\n\n// Matches bracket notation.\nvar brackets = /(\\[[^\\[\\]]*\\])/g;\n\n// serializes form fields\n// @param form MUST be an HTMLForm element\n// @param options is an optional argument to configure the serialization. Default output\n// with no options specified is a url encoded string\n// - hash: [true | false] Configure the output type. If true, the output will\n// be a js object.\n// - serializer: [function] Optional serializer function to override the default one.\n// The function takes 3 arguments (result, key, value) and should return new result\n// hash and url encoded str serializers are provided with this module\n// - disabled: [true | false]. If true serialize disabled fields.\n// - empty: [true | false]. If true serialize empty fields\nfunction serialize(form, options) {\n\tif (typeof options != 'object') {\n\t\toptions = { hash: !!options };\n\t}\n\telse if (options.hash === undefined) {\n\t\toptions.hash = true;\n\t}\n\n\tvar result = (options.hash) ? {} : '';\n\tvar serializer = options.serializer || ((options.hash) ? hash_serializer : str_serialize);\n\n\tvar elements = form && form.elements ? form.elements : [];\n\n\t//Object store each radio and set if it's empty or not\n\tvar radio_store = Object.create(null);\n\n\tfor (var i=0 ; i<elements.length ; ++i) {\n\t\tvar element = elements[i];\n\n\t\t// ingore disabled fields\n\t\tif ((!options.disabled && element.disabled) || !element.name) {\n\t\t\tcontinue;\n\t\t}\n\t\t// ignore anyhting that is not considered a success field\n\t\tif (!k_r_success_contrls.test(element.nodeName) ||\n\t\t\tk_r_submitter.test(element.type)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar key = element.name;\n\t\tvar val = element.value;\n\n\t\t// we can't just use element.value for checkboxes cause some browsers lie to us\n\t\t// they say \"on\" for value when the box isn't checked\n\t\tif ((element.type === 'checkbox' || element.type === 'radio') && !element.checked) {\n\t\t\tval = undefined;\n\t\t}\n\n\t\t// If we want empty elements\n\t\tif (options.empty) {\n\t\t\t// for checkbox\n\t\t\tif (element.type === 'checkbox' && !element.checked) {\n\t\t\t\tval = '';\n\t\t\t}\n\n\t\t\t// for radio\n\t\t\tif (element.type === 'radio') {\n\t\t\t\tif (!radio_store[element.name] && !element.checked) {\n\t\t\t\t\tradio_store[element.name] = false;\n\t\t\t\t}\n\t\t\t\telse if (element.checked) {\n\t\t\t\t\tradio_store[element.name] = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// if options empty is true, continue only if its radio\n\t\t\tif (!val && element.type == 'radio') {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// value-less fields are ignored unless options.empty is true\n\t\t\tif (!val) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t// multi select boxes\n\t\tif (element.type === 'select-multiple') {\n\t\t\tval = [];\n\n\t\t\tvar selectOptions = element.options;\n\t\t\tvar isSelectedOptions = false;\n\t\t\tfor (var j=0 ; j<selectOptions.length ; ++j) {\n\t\t\t\tvar option = selectOptions[j];\n\t\t\t\tvar allowedEmpty = options.empty && !option.value;\n\t\t\t\tvar hasValue = (option.value || allowedEmpty);\n\t\t\t\tif (option.selected && hasValue) {\n\t\t\t\t\tisSelectedOptions = true;\n\n\t\t\t\t\t// If using a hash serializer be sure to add the\n\t\t\t\t\t// correct notation for an array in the multi-select\n\t\t\t\t\t// context. Here the name attribute on the select element\n\t\t\t\t\t// might be missing the trailing bracket pair. Both names\n\t\t\t\t\t// \"foo\" and \"foo[]\" should be arrays.\n\t\t\t\t\tif (options.hash && key.slice(key.length - 2) !== '[]') {\n\t\t\t\t\t\tresult = serializer(result, key + '[]', option.value);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresult = serializer(result, key, option.value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Serialize if no selected options and options.empty is true\n\t\t\tif (!isSelectedOptions && options.empty) {\n\t\t\t\tresult = serializer(result, key, '');\n\t\t\t}\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult = serializer(result, key, val);\n\t}\n\n\t// Check for all empty radio buttons and serialize them with key=\"\"\n\tif (options.empty) {\n\t\tfor (var key in radio_store) {\n\t\t\tif (!radio_store[key]) {\n\t\t\t\tresult = serializer(result, key, '');\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction parse_keys(string) {\n\tvar keys = [];\n\tvar prefix = /^([^\\[\\]]*)/;\n\tvar children = new RegExp(brackets);\n\tvar match = prefix.exec(string);\n\n\tif (match[1]) {\n\t\tkeys.push(match[1]);\n\t}\n\n\twhile ((match = children.exec(string)) !== null) {\n\t\tkeys.push(match[1]);\n\t}\n\n\treturn keys;\n}\n\nfunction hash_assign(result, keys, value) {\n\tif (keys.length === 0) {\n\t\tresult = value;\n\t\treturn result;\n\t}\n\n\tvar key = keys.shift();\n\tvar between = key.match(/^\\[(.+?)\\]$/);\n\n\tif (key === '[]') {\n\t\tresult = result || [];\n\n\t\tif (Array.isArray(result)) {\n\t\t\tresult.push(hash_assign(null, keys, value));\n\t\t}\n\t\telse {\n\t\t\t// This might be the result of bad name attributes like \"[][foo]\",\n\t\t\t// in this case the original `result` object will already be\n\t\t\t// assigned to an object literal. Rather than coerce the object to\n\t\t\t// an array, or cause an exception the attribute \"_values\" is\n\t\t\t// assigned as an array.\n\t\t\tresult._values = result._values || [];\n\t\t\tresult._values.push(hash_assign(null, keys, value));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Key is an attribute name and can be assigned directly.\n\tif (!between) {\n\t\tresult[key] = hash_assign(result[key], keys, value);\n\t}\n\telse {\n\t\tvar string = between[1];\n\t\tvar index = parseInt(string, 10);\n\n\t\t// If the characters between the brackets is not a number it is an\n\t\t// attribute name and can be assigned directly.\n\t\tif (isNaN(index)) {\n\t\t\tresult = result || {};\n\t\t\tresult[string] = hash_assign(result[string], keys, value);\n\t\t}\n\t\telse {\n\t\t\tresult = result || [];\n\t\t\tresult[index] = hash_assign(result[index], keys, value);\n\t\t}\n\t}\n\n\treturn result;\n}\n\n// Object/hash encoding serializer.\nfunction hash_serializer(result, key, value) {\n\tvar matches = key.match(brackets);\n\n\t// Has brackets? Use the recursive assignment function to walk the keys,\n\t// construct any missing objects in the result tree and make the assignment\n\t// at the end of the chain.\n\tif (matches) {\n\t\tvar keys = parse_keys(key);\n\t\thash_assign(result, keys, value);\n\t}\n\telse {\n\t\t// Non bracket notation can make assignments directly.\n\t\tvar existing = result[key];\n\n\t\t// If the value has been assigned already (for instance when a radio and\n\t\t// a checkbox have the same name attribute) convert the previous value\n\t\t// into an array before pushing into it.\n\t\t//\n\t\t// NOTE: If this requirement were removed all hash creation and\n\t\t// assignment could go through `hash_assign`.\n\t\tif (existing) {\n\t\t\tif (!Array.isArray(existing)) {\n\t\t\t\tresult[key] = [ existing ];\n\t\t\t}\n\n\t\t\tresult[key].push(value);\n\t\t}\n\t\telse {\n\t\t\tresult[key] = value;\n\t\t}\n\t}\n\n\treturn result;\n}\n\n// urlform encoding serializer\nfunction str_serialize(result, key, value) {\n\t// encode newlines as \\r\\n cause the html spec says so\n\tvalue = value.replace(/(\\r)?\\n/g, '\\r\\n');\n\tvalue = encodeURIComponent(value);\n\n\t// spaces should be '+' rather than '%20'.\n\tvalue = value.replace(/%20/g, '+');\n\treturn result + (result ? '&' : '') + encodeURIComponent(key) + '=' + value;\n}\n\nmodule.exports = serialize;\n},{}],6:[function(require,module,exports){\n/**\n * Copyright 2014 Craig Campbell\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * GATOR.JS\n * Simple Event Delegation\n *\n * @version 1.2.4\n *\n * Compatible with IE 9+, FF 3.6+, Safari 5+, Chrome\n *\n * Include legacy.js for compatibility with older browsers\n *\n * .-._ _ _ _ _ _ _ _ _\n * .-''-.__.-'00 '-' ' ' ' ' ' ' ' '-.\n * '.___ ' . .--_'-' '-' '-' _'-' '._\n * V: V 'vv-' '_ '. .' _..' '.'.\n * '=.____.=_.--' :_.__.__:_ '. : :\n * (((____.-' '-. / : :\n * (((-'\\ .' /\n * _____..' .'\n * '-._____.-'\n */\n(function() {\n var _matcher,\n _level = 0,\n _id = 0,\n _handlers = {},\n _gatorInstances = {};\n\n function _addEvent(gator, type, callback) {\n\n // blur and focus do not bubble up but if you use event capturing\n // then you will get them\n var useCapture = type == 'blur' || type == 'focus';\n gator.element.addEventListener(type, callback, useCapture);\n }\n\n function _cancel(e) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n /**\n * returns function to use for determining if an element\n * matches a query selector\n *\n * @returns {Function}\n */\n function _getMatcher(element) {\n if (_matcher) {\n return _matcher;\n }\n\n if (element.matches) {\n _matcher = element.matches;\n return _matcher;\n }\n\n if (element.webkitMatchesSelector) {\n _matcher = element.webkitMatchesSelector;\n return _matcher;\n }\n\n if (element.mozMatchesSelector) {\n _matcher = element.mozMatchesSelector;\n return _matcher;\n }\n\n if (element.msMatchesSelector) {\n _matcher = element.msMatchesSelector;\n return _matcher;\n }\n\n if (element.oMatchesSelector) {\n _matcher = element.oMatchesSelector;\n return _matcher;\n }\n\n // if it doesn't match a native browser method\n // fall back to the gator function\n _matcher = Gator.matchesSelector;\n return _matcher;\n }\n\n /**\n * determines if the specified element matches a given selector\n *\n * @param {Node} element - the element to compare against the selector\n * @param {string} selector\n * @param {Node} boundElement - the element the listener was attached to\n * @returns {void|Node}\n */\n function _matchesSelector(element, selector, boundElement) {\n\n // no selector means this event was bound directly to this element\n if (selector == '_root') {\n return boundElement;\n }\n\n // if we have moved up to the element you bound the event to\n // then we have come too far\n if (element === boundElement) {\n return;\n }\n\n // if this is a match then we are done!\n if (_getMatcher(element).call(element, selector)) {\n return element;\n }\n\n // if this element did not match but has a parent we should try\n // going up the tree to see if any of the parent elements match\n // for example if you are looking for a click on an <a> tag but there\n // is a <span> inside of the a tag that it is the target,\n // it should still work\n if (element.parentNode) {\n _level++;\n return _matchesSelector(element.parentNode, selector, boundElement);\n }\n }\n\n function _addHandler(gator, event, selector, callback) {\n if (!_handlers[gator.id]) {\n _handlers[gator.id] = {};\n }\n\n if (!_handlers[gator.id][event]) {\n _handlers[gator.id][event] = {};\n }\n\n if (!_handlers[gator.id][event][selector]) {\n _handlers[gator.id][event][selector] = [];\n }\n\n _handlers[gator.id][event][selector].push(callback);\n }\n\n function _removeHandler(gator, event, selector, callback) {\n\n // if there are no events tied to this element at all\n // then don't do anything\n if (!_handlers[gator.id]) {\n return;\n }\n\n // if there is no event type specified then remove all events\n // example: Gator(element).off()\n if (!event) {\n for (var type in _handlers[gator.id]) {\n if (_handlers[gator.id].hasOwnProperty(type)) {\n _handlers[gator.id][type] = {};\n }\n }\n return;\n }\n\n // if no callback or selector is specified remove all events of this type\n // example: Gator(element).off('click')\n if (!callback && !selector) {\n _handlers[gator.id][event] = {};\n return;\n }\n\n // if a selector is specified but no callback remove all events\n // for this selector\n // example: Gator(element).off('click', '.sub-element')\n if (!callback) {\n delete _handlers[gator.id][event][selector];\n return;\n }\n\n // if we have specified an event type, selector, and callback then we\n // need to make sure there are callbacks tied to this selector to\n // begin with. if there aren't then we can stop here\n if (!_handlers[gator.id][event][selector]) {\n return;\n }\n\n // if there are then loop through all the callbacks and if we find\n // one that matches remove it from the array\n for (var i = 0; i < _handlers[gator.id][event][selector].length; i++) {\n if (_handlers[gator.id][event][selector][i] === callback) {\n _handlers[gator.id][event][selector].splice(i, 1);\n break;\n }\n }\n }\n\n function _handleEvent(id, e, type) {\n if (!_handlers[id][type]) {\n return;\n }\n\n var target = e.target || e.srcElement,\n selector,\n match,\n matches = {},\n i = 0,\n j = 0;\n\n // find all events that match\n _level = 0;\n for (selector in _handlers[id][type]) {\n if (_handlers[id][type].hasOwnProperty(selector)) {\n match = _matchesSelector(target, selector, _gatorInstances[id].element);\n\n if (match && Gator.matchesEvent(type, _gatorInstances[id].element, match, selector == '_root', e)) {\n _level++;\n _handlers[id][type][selector].match = match;\n matches[_level] = _handlers[id][type][selector];\n }\n }\n }\n\n // stopPropagation() fails to set cancelBubble to true in Webkit\n // @see http://code.google.com/p/chromium/issues/detail?id=162270\n e.stopPropagation = function() {\n e.cancelBubble = true;\n };\n\n for (i = 0; i <= _level; i++) {\n if (matches[i]) {\n for (j = 0; j < matches[i].length; j++) {\n if (matches[i][j].call(matches[i].match, e) === false) {\n Gator.cancel(e);\n return;\n }\n\n if (e.cancelBubble) {\n return;\n }\n }\n }\n }\n }\n\n /**\n * binds the specified events to the element\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @param {boolean=} remove\n * @returns {Object}\n */\n function _bind(events, selector, callback, remove) {\n\n // fail silently if you pass null or undefined as an alement\n // in the Gator constructor\n if (!this.element) {\n return;\n }\n\n if (!(events instanceof Array)) {\n events = [events];\n }\n\n if (!callback && typeof(selector) == 'function') {\n callback = selector;\n selector = '_root';\n }\n\n var id = this.id,\n i;\n\n function _getGlobalCallback(type) {\n return function(e) {\n _handleEvent(id, e, type);\n };\n }\n\n for (i = 0; i < events.length; i++) {\n if (remove) {\n _removeHandler(this, events[i], selector, callback);\n continue;\n }\n\n if (!_handlers[id] || !_handlers[id][events[i]]) {\n Gator.addEvent(this, events[i], _getGlobalCallback(events[i]));\n }\n\n _addHandler(this, events[i], selector, callback);\n }\n\n return this;\n }\n\n /**\n * Gator object constructor\n *\n * @param {Node} element\n */\n function Gator(element, id) {\n\n // called as function\n if (!(this instanceof Gator)) {\n // only keep one Gator instance per node to make sure that\n // we don't create a ton of new objects if you want to delegate\n // multiple events from the same node\n //\n // for example: Gator(document).on(...\n for (var key in _gatorInstances) {\n if (_gatorInstances[key].element === element) {\n return _gatorInstances[key];\n }\n }\n\n _id++;\n _gatorInstances[_id] = new Gator(element, _id);\n\n return _gatorInstances[_id];\n }\n\n this.element = element;\n this.id = id;\n }\n\n /**\n * adds an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.on = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback);\n };\n\n /**\n * removes an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.off = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback, true);\n };\n\n Gator.matchesSelector = function() {};\n Gator.cancel = _cancel;\n Gator.addEvent = _addEvent;\n Gator.matchesEvent = function() {\n return true;\n };\n\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = Gator;\n }\n\n window.Gator = Gator;\n}) ();\n\n},{}],7:[function(require,module,exports){\n/*! populate.js v1.0.2 by @dannyvankooten | MIT license */\n;(function(root) {\n\n\t/**\n\t * Populate form fields from a JSON object.\n\t *\n\t * @param form object The form element containing your input fields.\n\t * @param data array JSON data to populate the fields with.\n\t * @param basename string Optional basename which is added to `name` attributes\n\t */\n\tvar populate = function( form, data, basename) {\n\n\t\tfor(var key in data) {\n\n\t\t\tif( ! data.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar name = key;\n\t\t\tvar value = data[key];\n\n\t\t\t// handle array name attributes\n\t\t\tif(typeof(basename) !== \"undefined\") {\n\t\t\t\tname = basename + \"[\" + key + \"]\";\n\t\t\t}\n\n\t\t\tif(value.constructor === Array) {\n\t\t\t\tname += '[]';\n\t\t\t} else if(typeof value == \"object\") {\n\t\t\t\tpopulate( form, value, name);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// only proceed if element is set\n\t\t\tvar element = form.elements.namedItem( name );\n\t\t\tif( ! element ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar type = element.type || element[0].type;\n\n\t\t\tswitch(type ) {\n\t\t\t\tdefault:\n\t\t\t\t\telement.value = value;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'radio':\n\t\t\t\tcase 'checkbox':\n\t\t\t\t\tfor( var j=0; j < element.length; j++ ) {\n\t\t\t\t\t\telement[j].checked = ( value.indexOf(element[j].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select-multiple':\n\t\t\t\t\tvar values = value.constructor == Array ? value : [value];\n\n\t\t\t\t\tfor(var k = 0; k < element.options.length; k++) {\n\t\t\t\t\t\telement.options[k].selected |= (values.indexOf(element.options[k].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select':\n\t\t\t\tcase 'select-one':\n\t\t\t\t\telement.value = value.toString() || value;\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n\t// Play nice with AMD, CommonJS or a plain global object.\n\tif ( typeof define == 'function' && typeof define.amd == 'object' && define.amd ) {\n\t\tdefine(function() {\n\t\t\treturn populate;\n\t\t});\n\t}\telse if ( typeof module !== 'undefined' && module.exports ) {\n\t\tmodule.exports = populate;\n\t} else {\n\t\troot.populate = populate;\n\t}\n\n}(this));\n},{}],8:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}]},{},[1]);\n })();"],"sourceRoot":"/source/"}
includes/admin/class-admin.php CHANGED
@@ -28,6 +28,11 @@ class MC4WP_Admin {
28
  */
29
  protected $ads;
30
 
 
 
 
 
 
31
  /**
32
  * Constructor
33
  *
@@ -40,6 +45,9 @@ class MC4WP_Admin {
40
  $this->plugin_file = plugin_basename( MC4WP_PLUGIN_FILE );
41
  $this->ads = new MC4WP_Admin_Ads();
42
  $this->load_translations();
 
 
 
43
  }
44
 
45
  /**
@@ -58,6 +66,7 @@ class MC4WP_Admin {
58
 
59
  $this->ads->add_hooks();
60
  $this->messages->add_hooks();
 
61
  }
62
 
63
  /**
28
  */
29
  protected $ads;
30
 
31
+ /**
32
+ * @var MC4WP_Update_Optin
33
+ */
34
+ protected $update_optin;
35
+
36
  /**
37
  * Constructor
38
  *
45
  $this->plugin_file = plugin_basename( MC4WP_PLUGIN_FILE );
46
  $this->ads = new MC4WP_Admin_Ads();
47
  $this->load_translations();
48
+
49
+ // update opt-in
50
+ $this->update_optin = new MC4WP_Update_Optin( '4.0.0', $this->plugin_file, MC4WP_PLUGIN_DIR . 'includes/views/parts/update-4.x-notice.php' );
51
  }
52
 
53
  /**
66
 
67
  $this->ads->add_hooks();
68
  $this->messages->add_hooks();
69
+ $this->update_optin->add_hooks();
70
  }
71
 
72
  /**
includes/admin/class-update-optin.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MC4WP_Update_Optin {
4
+
5
+ /**
6
+ * @const string
7
+ */
8
+ const CAPABILITY = 'install_plugins';
9
+
10
+ /**
11
+ * @var string
12
+ */
13
+ protected $plugin_file = '';
14
+
15
+ /**
16
+ * @var string
17
+ */
18
+ protected $to_version;
19
+
20
+ /**
21
+ * @var string
22
+ */
23
+ protected $view_file;
24
+
25
+ /**
26
+ * @var string
27
+ */
28
+ protected $option_enable;
29
+
30
+ /**
31
+ * @var string
32
+ */
33
+ protected $option_notice;
34
+
35
+ /**
36
+ * @var bool
37
+ */
38
+ protected $active = false;
39
+
40
+ /**
41
+ * @param string $to_version
42
+ * @param string $plugin_file
43
+ * @param string $view_file
44
+ */
45
+ public function __construct( $to_version, $plugin_file, $view_file ) {
46
+ $this->to_version = $to_version;
47
+ $this->plugin_file = $plugin_file;
48
+ $this->view_file = $view_file;
49
+
50
+ $this->option_enable = 'mc4wp_enable_' . sanitize_key( $this->to_version );
51
+ $this->option_notice = 'mc4wp_notice_' . sanitize_key( $this->to_version );
52
+ }
53
+
54
+ /**
55
+ * Add hooks
56
+ */
57
+ public function add_hooks() {
58
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'maybe_hide_update' ) );
59
+ add_action( 'init', array( $this, 'listen' ) );
60
+
61
+ global $pagenow;
62
+ $on_settings_page = isset( $_GET['page'] ) && stristr( $_GET['page'], dirname( $this->plugin_file ) ) !== false;
63
+ if( $pagenow === 'plugins.php' || $pagenow === 'update-core.php' || $on_settings_page ) {
64
+ add_action( 'admin_notices', array( $this, 'show_update_optin' ) );
65
+ }
66
+ }
67
+ /**
68
+ * Listen for actions
69
+ */
70
+ public function listen() {
71
+
72
+ // only show to users with required capability
73
+ if( ! current_user_can( self::CAPABILITY ) ) {
74
+ return;
75
+ }
76
+
77
+ if( isset( $_GET[ $this->option_enable ] ) ) {
78
+ $this->enable_major_updates();
79
+ }
80
+ }
81
+ /**
82
+ * Prevents updates from showing
83
+ *
84
+ * @param array $data
85
+ * @return array
86
+ */
87
+ public function maybe_hide_update( $data ) {
88
+
89
+ if( empty( $data->response ) ) {
90
+ return $data;
91
+ }
92
+
93
+ // do nothing if the specified version is not out there yet..
94
+ if( empty( $data->response[ $this->plugin_file ]->new_version )
95
+ || version_compare( $data->response[ $this->plugin_file ]->new_version, $this->to_version, '<' ) ) {
96
+
97
+ // reset flags here in case we revert the update
98
+ if( ! $this->active ) {
99
+ delete_option( $this->option_notice );
100
+ delete_option( $this->option_enable );
101
+ }
102
+
103
+ return $data;
104
+ }
105
+
106
+ // return unmodified data if already opted-in
107
+ $opted_in = get_option( $this->option_enable, false );
108
+ if( $opted_in ) {
109
+ return $data;
110
+ }
111
+
112
+ // set a flag to start showing "update to x.x" notice
113
+ update_option( $this->option_notice, 1 );
114
+
115
+ // unset update data
116
+ unset( $data->response[ $this->plugin_file ] );
117
+
118
+ // set flag because this filter runs multiple times..
119
+ $this->active = true;
120
+
121
+ return $data;
122
+ }
123
+
124
+ /**
125
+ * Enables major updates (opts-in to 3.x update)
126
+ */
127
+ public function enable_major_updates() {
128
+
129
+ // update option
130
+ update_option( $this->option_enable, 1 );
131
+
132
+ // delete site transient so wp core will fetch latest version
133
+ delete_site_transient( 'update_plugins' );
134
+
135
+ // redirect to updates page
136
+ wp_safe_redirect( admin_url( 'update-core.php' ) );
137
+ exit;
138
+ }
139
+
140
+ /**
141
+ * Shows update opt-in
142
+ */
143
+ public function show_update_optin() {
144
+
145
+ if( ! $this->should_show_update_optin() ) {
146
+ return;
147
+ }
148
+
149
+ // prepare link URL
150
+ $update_link = add_query_arg( array( $this->option_enable => 1 ) );
151
+
152
+ // show!
153
+ include $this->view_file;
154
+ }
155
+
156
+ /**
157
+ * @return bool
158
+ */
159
+ public function should_show_update_optin() {
160
+
161
+ // don't show if flag is not set
162
+ if( ! get_option( $this->option_notice, false ) ) {
163
+ return false;
164
+ }
165
+
166
+ // stop showing if opted-in already
167
+ if( get_option( $this->option_enable, false ) ) {
168
+ return false;
169
+ }
170
+
171
+ // only show to users with required capability
172
+ if( ! current_user_can( self::CAPABILITY ) ) {
173
+ return false;
174
+ }
175
+
176
+ return true;
177
+ }
178
+ }
includes/admin/migrations/3.1.6-woocommerce-position-prefix.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or exit;
4
+
5
+ $options = get_option( 'mc4wp_integrations', array() );
6
+
7
+ if( ! empty( $options['woocommerce'] ) && ! empty( $options['woocommerce']['position'] ) ) {
8
+ $options['woocommerce']['position'] = sprintf( 'checkout_%s', $options['woocommerce']['position'] );
9
+ }
10
+
11
+ update_option( 'mc4wp_integrations', $options );
includes/forms/class-form-element.php.php CHANGED
@@ -52,11 +52,11 @@ class MC4WP_Form_Element {
52
  /**
53
  * @return string
54
  */
55
- public function get_visible_fields() {
56
 
57
  $content = $this->form->content;
58
  $form = $this->form;
59
- $is_submitted = $this->is_submitted;
60
 
61
  /**
62
  * Filters the HTML for the form fields.
@@ -65,10 +65,10 @@ class MC4WP_Form_Element {
65
  *
66
  * @param string $content
67
  * @param MC4WP_Form $form
68
- * @param boolean $is_submitted
69
  * @since 2.0
70
  */
71
- $visible_fields = (string) apply_filters( 'mc4wp_form_content', $content, $form, $is_submitted );
72
 
73
  return $visible_fields;
74
  }
@@ -76,7 +76,7 @@ class MC4WP_Form_Element {
76
  /**
77
  * @return string
78
  */
79
- public function get_hidden_fields() {
80
 
81
  // hidden fields
82
  $hidden_fields = '<div style="display: none;"><input type="text" name="_mc4wp_honeypot" value="" tabindex="-1" autocomplete="off" /></div>';
@@ -93,6 +93,60 @@ class MC4WP_Form_Element {
93
  return (string) $hidden_fields;
94
  }
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  /**
97
  * @return string
98
  */
@@ -139,7 +193,7 @@ class MC4WP_Form_Element {
139
  $html = (string) apply_filters( 'mc4wp_form_before_fields', $html, $form );
140
 
141
  if( $this->get_response_position() === 'before' ) {
142
- $html = $html . $this->form->get_response_html( $this->is_submitted );
143
  }
144
 
145
  return $html;
@@ -164,7 +218,7 @@ class MC4WP_Form_Element {
164
  $html = (string) apply_filters( 'mc4wp_form_after_fields', $html, $form );
165
 
166
  if( $this->get_response_position() === 'after' ) {
167
- $html = $this->form->get_response_html( $this->is_submitted ) . $html;
168
  }
169
 
170
  return $html;
@@ -264,7 +318,7 @@ class MC4WP_Form_Element {
264
  *
265
  * @return string
266
  */
267
- public function get_css_classes() {
268
 
269
  $classes = array();
270
  $form = $this->form;
52
  /**
53
  * @return string
54
  */
55
+ protected function get_visible_fields() {
56
 
57
  $content = $this->form->content;
58
  $form = $this->form;
59
+ $element = $this;
60
 
61
  /**
62
  * Filters the HTML for the form fields.
65
  *
66
  * @param string $content
67
  * @param MC4WP_Form $form
68
+ * @param MC4WP_Form_Element $element
69
  * @since 2.0
70
  */
71
+ $visible_fields = (string) apply_filters( 'mc4wp_form_content', $content, $form, $element );
72
 
73
  return $visible_fields;
74
  }
76
  /**
77
  * @return string
78
  */
79
+ protected function get_hidden_fields() {
80
 
81
  // hidden fields
82
  $hidden_fields = '<div style="display: none;"><input type="text" name="_mc4wp_honeypot" value="" tabindex="-1" autocomplete="off" /></div>';
93
  return (string) $hidden_fields;
94
  }
95
 
96
+ /**
97
+ * Get HTML string for a message, including wrapper element.
98
+ *
99
+ * @param string $key
100
+ *
101
+ * @return string
102
+ */
103
+ protected function get_message_html( $key ) {
104
+ $message = $this->form->get_message( $key );
105
+ $html = sprintf( '<div class="mc4wp-alert mc4wp-%s"><p>%s</p></div>', esc_attr( $message->type ), $message->text );
106
+ return $html;
107
+ }
108
+
109
+ /**
110
+ * Gets the form response string
111
+ *
112
+ * @param boolean $force_show
113
+ * @return string
114
+ */
115
+ public function get_response_html( $force_show = false ) {
116
+
117
+ $html = '';
118
+ $form = $this->form;
119
+
120
+ if( $this->is_submitted || $force_show ) {
121
+ if( $form->has_errors() ) {
122
+
123
+ // create html string of all errors
124
+ foreach( $form->errors as $key ) {
125
+ $html .= $this->get_message_html( $key );
126
+ }
127
+
128
+ } else {
129
+ $html = $this->get_message_html( $form->get_action() . 'd' );
130
+ }
131
+ }
132
+
133
+ /**
134
+ * Filter the form response HTML
135
+ *
136
+ * Use this to add your own HTML to the form response. The form instance is passed to the callback function.
137
+ *
138
+ * @since 3.0
139
+ *
140
+ * @param string $html The complete HTML string of the response, excluding the wrapper element.
141
+ * @param MC4WP_Form $form The form object
142
+ */
143
+ $html = (string) apply_filters( 'mc4wp_form_response_html', $html, $form );
144
+
145
+ // wrap entire response in div, regardless of a form was submitted
146
+ $html = '<div class="mc4wp-response">' . $html . '</div>';
147
+ return $html;
148
+ }
149
+
150
  /**
151
  * @return string
152
  */
193
  $html = (string) apply_filters( 'mc4wp_form_before_fields', $html, $form );
194
 
195
  if( $this->get_response_position() === 'before' ) {
196
+ $html = $html . $this->get_response_html();
197
  }
198
 
199
  return $html;
218
  $html = (string) apply_filters( 'mc4wp_form_after_fields', $html, $form );
219
 
220
  if( $this->get_response_position() === 'after' ) {
221
+ $html = $this->get_response_html() . $html;
222
  }
223
 
224
  return $html;
318
  *
319
  * @return string
320
  */
321
+ protected function get_css_classes() {
322
 
323
  $classes = array();
324
  $form = $this->form;
includes/forms/class-form-listener.php CHANGED
@@ -67,6 +67,7 @@ class MC4WP_Form_Listener {
67
  public function process_subscribe_form( MC4WP_Form $form ) {
68
  $api = $this->get_api();
69
  $result = false;
 
70
  $email_type = $form->get_email_type();
71
  $merge_vars = $form->data;
72
 
@@ -84,7 +85,7 @@ class MC4WP_Form_Listener {
84
  // loop through lists
85
  foreach( $map->list_fields as $list_id => $merge_vars ) {
86
  // send a subscribe request to MailChimp for each list
87
- $result = $api->subscribe( $list_id, $form->data['EMAIL'], $merge_vars, $email_type, $form->settings['double_optin'], $form->settings['update_existing'], $form->settings['replace_interests'], $form->settings['send_welcome'] );
88
  }
89
 
90
  // do stuff on failure
@@ -93,7 +94,7 @@ class MC4WP_Form_Listener {
93
  if( $api->get_error_code() == 214 ) {
94
  // handle "already_subscribed" as a soft-error
95
  $form->errors[] = 'already_subscribed';
96
- $this->get_log()->warning( sprintf( "Form %d > %s is already subscribed to the selected list(s)", $form->ID, $form->data['EMAIL'] ) );
97
  } else {
98
  // log error
99
  $this->get_log()->error( sprintf( 'Form %d > MailChimp API error: %s', $form->ID, $api->get_error_message() ) );
@@ -114,8 +115,11 @@ class MC4WP_Form_Listener {
114
  * @since 3.0
115
  *
116
  * @param MC4WP_Form $form Instance of the submitted form
 
 
 
117
  */
118
- do_action( 'mc4wp_form_subscribed', $form, $map->formatted_data, $map->pretty_data );
119
  }
120
 
121
  /**
67
  public function process_subscribe_form( MC4WP_Form $form ) {
68
  $api = $this->get_api();
69
  $result = false;
70
+ $email = $form->data['EMAIL'];
71
  $email_type = $form->get_email_type();
72
  $merge_vars = $form->data;
73
 
85
  // loop through lists
86
  foreach( $map->list_fields as $list_id => $merge_vars ) {
87
  // send a subscribe request to MailChimp for each list
88
+ $result = $api->subscribe( $list_id, $email, $merge_vars, $email_type, $form->settings['double_optin'], $form->settings['update_existing'], $form->settings['replace_interests'], $form->settings['send_welcome'] );
89
  }
90
 
91
  // do stuff on failure
94
  if( $api->get_error_code() == 214 ) {
95
  // handle "already_subscribed" as a soft-error
96
  $form->errors[] = 'already_subscribed';
97
+ $this->get_log()->warning( sprintf( "Form %d > %s is already subscribed to the selected list(s)", $form->ID, mc4wp_obfuscate_string( $form->data['EMAIL'] ) ) );
98
  } else {
99
  // log error
100
  $this->get_log()->error( sprintf( 'Form %d > MailChimp API error: %s', $form->ID, $api->get_error_message() ) );
115
  * @since 3.0
116
  *
117
  * @param MC4WP_Form $form Instance of the submitted form
118
+ * @param string $email
119
+ * @param array $merge_vars
120
+ * @param array $pretty_data
121
  */
122
+ do_action( 'mc4wp_form_subscribed', $form, $email, $merge_vars, $map->pretty_data );
123
  }
124
 
125
  /**
includes/forms/class-form-tags.php CHANGED
@@ -19,9 +19,9 @@ class MC4WP_Form_Tags {
19
  protected $form;
20
 
21
  /**
22
- * @var bool
23
  */
24
- protected $form_is_submitted = false;
25
 
26
  /**
27
  * Constructor
@@ -130,12 +130,13 @@ class MC4WP_Form_Tags {
130
  *
131
  * @param string $string
132
  * @param MC4WP_Form $form
 
133
  *
134
  * @return string
135
  */
136
- public function replace( $string, MC4WP_Form $form, $is_submitted = false ) {
137
  $this->form = $form;
138
- $this->form_is_submitted = $is_submitted;
139
  $string = $this->tags->replace( $string );
140
  return $string;
141
  }
@@ -170,7 +171,12 @@ class MC4WP_Form_Tags {
170
  * @return string
171
  */
172
  public function get_form_response() {
173
- return $this->form_is_submitted ? $this->form->get_response_html() : '';
 
 
 
 
 
174
  }
175
 
176
  /**
19
  protected $form;
20
 
21
  /**
22
+ * @var MC4WP_Form_Element
23
  */
24
+ protected $form_element;
25
 
26
  /**
27
  * Constructor
130
  *
131
  * @param string $string
132
  * @param MC4WP_Form $form
133
+ * @param MC4WP_Form_Element $element
134
  *
135
  * @return string
136
  */
137
+ public function replace( $string, MC4WP_Form $form, MC4WP_Form_Element $element = null ) {
138
  $this->form = $form;
139
+ $this->form_element = $element;
140
  $string = $this->tags->replace( $string );
141
  return $string;
142
  }
171
  * @return string
172
  */
173
  public function get_form_response() {
174
+
175
+ if( $this->form_element instanceof MC4WP_Form_Element ) {
176
+ return $this->form_element->get_response_html();
177
+ }
178
+
179
+ return '';
180
  }
181
 
182
  /**
includes/forms/class-form.php CHANGED
@@ -141,48 +141,38 @@ class MC4WP_Form {
141
 
142
  /**
143
  * Gets the form response string
144
- * // TODO: Move to `Form_Element`
145
  *
146
- * @param bool $submitted
 
 
 
147
  * @return string
148
  */
149
- public function get_response_html( $submitted = null ) {
150
-
151
- if( is_null( $submitted ) ) {
152
- $submitted = $this->is_submitted;
153
- }
154
-
155
- $html = '';
156
- $form = $this;
157
-
158
- if( $submitted ) {
159
- if( $this->has_errors() ) {
160
-
161
- // create html string of all errors
162
- foreach( $this->errors as $key ) {
163
- $html .= $this->get_message_html( $key );
164
- }
165
-
166
- } else {
167
- $html = $this->get_message_html( $this->get_action() . 'd' );
168
- }
169
- }
170
 
171
- /**
172
- * Filter the form response HTML
173
- *
174
- * Use this to add your own HTML to the form response. The form instance is passed to the callback function.
175
- *
176
- * @since 3.0
177
- *
178
- * @param string $html The complete HTML string of the response, excluding the wrapper element.
179
- * @param MC4WP_Form $form The form object
180
- */
181
- $html = (string) apply_filters( 'mc4wp_form_response_html', $html, $form );
 
 
182
 
183
- // wrap entire response in div, regardless of a form was submitted
184
- $html = '<div class="mc4wp-response">' . $html . '</div>';
185
- return $html;
 
 
 
 
186
  }
187
 
188
  /**
@@ -196,7 +186,7 @@ class MC4WP_Form {
196
  * @return string
197
  */
198
  public function get_html( $element_id = 'mc4wp-form', array $config = array() ) {
199
- $element = new MC4WP_Form_Element( $this, $element_id, $config );
200
  $html = $element->generate_html();
201
  return $html;
202
  }
@@ -312,21 +302,6 @@ class MC4WP_Form {
312
  return $field_types;
313
  }
314
 
315
- /**
316
- * Get HTML string for a message, including wrapper element.
317
- *
318
- * @param string $key
319
- *
320
- * @return string
321
- */
322
- public function get_message_html( $key ) {
323
- $message = $this->get_message( $key );
324
-
325
- $html = sprintf( '<div class="mc4wp-alert mc4wp-%s"><p>%s</p></div>', esc_attr( $message->type ), $message->text );
326
-
327
- return $html;
328
- }
329
-
330
  /**
331
  * Get message object
332
  *
141
 
142
  /**
143
  * Gets the form response string
 
144
  *
145
+ * This does not take the submitted form element into account.
146
+ *
147
+ * @see MC4WP_Form_Element::get_response_html()
148
+ *
149
  * @return string
150
  */
151
+ public function get_response_html() {
152
+ return $this->get_element()->get_response_html( true );
153
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
+ /**
156
+ * Get HTML string for a message, including wrapper element.
157
+ *
158
+ * @deprecated 3.2
159
+ *
160
+ * @param string $key
161
+ *
162
+ * @return string
163
+ */
164
+ public function get_message_html( $key ) {
165
+ _deprecated_function( __METHOD__, '3.2' );
166
+ return '';
167
+ }
168
 
169
+ /**
170
+ * @param string $element_id
171
+ * @param array $config
172
+ * @return MC4WP_Form_element
173
+ */
174
+ public function get_element( $element_id = 'mc4wp-form', $config = array() ) {
175
+ return new MC4WP_Form_Element( $this, $element_id, $config );
176
  }
177
 
178
  /**
186
  * @return string
187
  */
188
  public function get_html( $element_id = 'mc4wp-form', array $config = array() ) {
189
+ $element = $this->get_element( $element_id, $config );
190
  $html = $element->generate_html();
191
  return $html;
192
  }
302
  return $field_types;
303
  }
304
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  /**
306
  * Get message object
307
  *
includes/forms/functions.php CHANGED
@@ -47,10 +47,11 @@ function mc4wp_get_forms( array $args = array() ) {
47
  * @return string
48
  */
49
  function mc4wp_show_form( $form_id = 0, $config = array(), $echo = true ) {
50
- return mc4wp('forms')->output_form( $form_id, $config, $echo );
 
 
51
  }
52
 
53
-
54
  /**
55
  * Check whether a form was submitted
56
  *
47
  * @return string
48
  */
49
  function mc4wp_show_form( $form_id = 0, $config = array(), $echo = true ) {
50
+ /** @var MC4WP_Form_Manager $forms */
51
+ $forms = mc4wp('forms');
52
+ return $forms->output_form( $form_id, $config, $echo );
53
  }
54
 
 
55
  /**
56
  * Check whether a form was submitted
57
  *
includes/integrations/class-integration.php CHANGED
@@ -370,7 +370,7 @@ abstract class MC4WP_Integration {
370
 
371
  // log error
372
  if( $api->get_error_code() === 214 ) {
373
- $this->get_log()->warning( sprintf( "%s > %s is already subscribed to the selected list(s)", $this->name, $email ) );
374
  } else {
375
  $this->get_log()->error( sprintf( '%s > MailChimp API Error: %s', $this->name, $api->get_error_message() ) );
376
  }
370
 
371
  // log error
372
  if( $api->get_error_code() === 214 ) {
373
+ $this->get_log()->warning( sprintf( "%s > %s is already subscribed to the selected list(s)", $this->name, mc4wp_obfuscate_string( $email ) ) );
374
  } else {
375
  $this->get_log()->error( sprintf( '%s > MailChimp API Error: %s', $this->name, $api->get_error_message() ) );
376
  }
includes/mailchimp/class-grouping.php CHANGED
@@ -42,6 +42,19 @@ class MC4WP_MailChimp_Grouping {
42
  $this->groups = $groups;
43
  }
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  /**
46
  * @param object $data
47
  *
42
  $this->groups = $groups;
43
  }
44
 
45
+ /**
46
+ * @param int $id
47
+ *
48
+ * @return string
49
+ */
50
+ public function get_group_name_by_id( $id ) {
51
+ if( isset( $this->groups[ $id ] ) ) {
52
+ return $this->groups[ $id ];
53
+ }
54
+
55
+ return $id;
56
+ }
57
+
58
  /**
59
  * @param object $data
60
  *
includes/mailchimp/class-list.php CHANGED
@@ -99,7 +99,7 @@ class MC4WP_MailChimp_List {
99
 
100
  foreach( $this->groupings as $grouping ) {
101
 
102
- if( $grouping->id !== $grouping_id ) {
103
  continue;
104
  }
105
 
99
 
100
  foreach( $this->groupings as $grouping ) {
101
 
102
+ if( $grouping->id != $grouping_id ) {
103
  continue;
104
  }
105
 
includes/views/parts/update-4.x-notice.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php defined( 'ABSPATH') or exit;
2
+
3
+ echo '<div class="notice is-dismissible updated">';
4
+ echo '<h4>' . __( 'Version 4.0 of MailChimp for WordPress is available for you', 'mailchimp-for-wp' ) . '</h4>';
5
+
6
+
7
+ echo '<p>' . __( 'This version updates the plugin to use the new MailChimp API (a server the plugin "talks" to).', 'mailchimp-for-wp' ) . '</p>';
8
+
9
+ echo '<p>';
10
+ echo __( 'However, MailChimp changed a few things on their end which forced us to do the same.', 'mailchimp-for-wp' );
11
+ echo ' ' . sprintf( __( 'Please <a href="%s">read through our upgrade guide carefully</a> so you are aware of the changes before updating the plugin.', 'mailchimp-for-wp' ), 'https://mc4wp.com/kb/upgrading-to-4-0/ " style="font-weight: bold;' );
12
+ echo '<br /><br />';
13
+ echo sprintf( '<a class="button button-primary" href="%s">' . __( 'I am ready to update', 'mailchimp-for-wp' ) . '</a>', $update_link );
14
+ echo '</p>';
15
+ echo '</div>';
integrations/contact-form-7/class-contact-form-7.php CHANGED
@@ -147,6 +147,11 @@ class MC4WP_Contact_Form_7_Integration extends MC4WP_Integration {
147
  return '';
148
  }
149
 
 
 
 
 
 
150
  $form = wpcf7_contact_form( $object_id );
151
  if( ! is_object( $form ) ) {
152
  return '';
147
  return '';
148
  }
149
 
150
+ // Return empty string if CF7 is no longer activated.
151
+ if( ! function_exists( 'wpcf7_contact_form' ) ) {
152
+ return '';
153
+ }
154
+
155
  $form = wpcf7_contact_form( $object_id );
156
  if( ! is_object( $form ) ) {
157
  return '';
integrations/woocommerce/admin-after.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
2
 
3
  $position_options = array(
4
- 'billing' => __( "After billing details", 'mailchimp-for-wp' ),
5
- 'shipping' => __( 'After shipping details', 'mailchimp-for-wp' ),
6
- 'after_customer_details' => __( 'After customer details', 'mailchimp-for-wp' ),
 
7
  );
8
 
9
  ?>
1
  <?php
2
 
3
  $position_options = array(
4
+ 'checkout_billing' => __( "After billing details", 'mailchimp-for-wp' ),
5
+ 'checkout_shipping' => __( 'After shipping details', 'mailchimp-for-wp' ),
6
+ 'checkout_after_customer_details' => __( 'After customer details', 'mailchimp-for-wp' ),
7
+ 'review_order_before_submit' => __( 'Before submit button', 'mailchimp-for-wp' ),
8
  );
9
 
10
  ?>
integrations/woocommerce/class-woocommerce.php CHANGED
@@ -26,7 +26,7 @@ class MC4WP_WooCommerce_Integration extends MC4WP_Integration {
26
 
27
  if( ! $this->options['implicit'] ) {
28
  // create hook name based on position setting
29
- $hook = sprintf( 'woocommerce_checkout_%s', $this->options['position'] );
30
  add_action( $hook, array( $this, 'output_checkbox' ), 20 );
31
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'save_woocommerce_checkout_checkbox_value' ) );
32
  }
26
 
27
  if( ! $this->options['implicit'] ) {
28
  // create hook name based on position setting
29
+ $hook = sprintf( 'woocommerce_%s', $this->options['position'] );
30
  add_action( $hook, array( $this, 'output_checkbox' ), 20 );
31
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'save_woocommerce_checkout_checkbox_value' ) );
32
  }
languages/mailchimp-for-wp-fr_FR.mo CHANGED
Binary file
languages/mailchimp-for-wp-fr_FR.po CHANGED
@@ -1,6 +1,7 @@
1
  # Copyright (C) 2015 MailChimp for WordPress
2
  # This file is distributed under the same license as the MailChimp for WordPress package.
3
  # Translators:
 
4
  # ChrisFromLafare <carnaud@free.fr>, 2014
5
  # Cedric R <thorin31@gmail.com>, 2014
6
  # dlpscoop <charliebairdjersey@gmail.com>, 2015
@@ -16,8 +17,8 @@ msgstr ""
16
  "Project-Id-Version: MailChimp for WordPress\n"
17
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mailchimp-for-wp\n"
18
  "POT-Creation-Date: 2015-11-30 10:15:18+00:00\n"
19
- "PO-Revision-Date: 2015-12-09 10:12+0000\n"
20
- "Last-Translator: Juliette Mouquod <juliette@lapinblanc.co.uk>\n"
21
  "Language-Team: French (France) (http://www.transifex.com/ibericode/mailchimp-for-wordpress/language/fr_FR/)\n"
22
  "MIME-Version: 1.0\n"
23
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -27,7 +28,7 @@ msgstr ""
27
 
28
  #: config/default-form-content.php:3
29
  msgid "Email address"
30
- msgstr "Adresse email : "
31
 
32
  #: config/default-form-content.php:4
33
  msgid "Your email address"
1
  # Copyright (C) 2015 MailChimp for WordPress
2
  # This file is distributed under the same license as the MailChimp for WordPress package.
3
  # Translators:
4
+ # baron vanessa <littlebirdyworld@gmail.com>, 2016
5
  # ChrisFromLafare <carnaud@free.fr>, 2014
6
  # Cedric R <thorin31@gmail.com>, 2014
7
  # dlpscoop <charliebairdjersey@gmail.com>, 2015
17
  "Project-Id-Version: MailChimp for WordPress\n"
18
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mailchimp-for-wp\n"
19
  "POT-Creation-Date: 2015-11-30 10:15:18+00:00\n"
20
+ "PO-Revision-Date: 2016-04-11 19:47+0000\n"
21
+ "Last-Translator: baron vanessa <littlebirdyworld@gmail.com>\n"
22
  "Language-Team: French (France) (http://www.transifex.com/ibericode/mailchimp-for-wordpress/language/fr_FR/)\n"
23
  "MIME-Version: 1.0\n"
24
  "Content-Type: text/plain; charset=UTF-8\n"
28
 
29
  #: config/default-form-content.php:3
30
  msgid "Email address"
31
+ msgstr "Email address"
32
 
33
  #: config/default-form-content.php:4
34
  msgid "Your email address"
languages/mailchimp-for-wp-pt_BR.mo CHANGED
Binary file
languages/mailchimp-for-wp-pt_BR.po CHANGED
@@ -3,20 +3,22 @@
3
  # Translators:
4
  # Arlei Santos <contato@attas.com.br>, 2016
5
  # Douglas de Araujo <douglas@ludicaeventos.com.br>, 2015
6
- # fabricio corrêa <fabricionthweb@gmail.com>, 2016
 
7
  # Felipe Porto <felipe@appdigital.com.br>, 2015
8
  # Leandro de Santi <leandro.santi@gmail.com>, 2014-2015
9
  # Liane Bez <liane@lianebez.com.br>, 2016
10
  # Lucas Vilaboim de Figueiredo <luvilaboim@gmail.com>, 2015
11
  # Luiz Sobral <lctsobral@gmail.com>, 2015
12
  # Ronne Clay Santos <roneclay@gmail.com>, 2015
 
13
  msgid ""
14
  msgstr ""
15
  "Project-Id-Version: MailChimp for WordPress\n"
16
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mailchimp-for-wp\n"
17
  "POT-Creation-Date: 2015-11-30 10:15:18+00:00\n"
18
- "PO-Revision-Date: 2016-03-05 20:20+0000\n"
19
- "Last-Translator: Arlei Santos <contato@attas.com.br>\n"
20
  "Language-Team: Portuguese (Brazil) (http://www.transifex.com/ibericode/mailchimp-for-wordpress/language/pt_BR/)\n"
21
  "MIME-Version: 1.0\n"
22
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -111,7 +113,7 @@ msgstr "Atualize para MailChimp para WordPress Pro"
111
  msgid ""
112
  "Enjoying this plugin? <a href=\"%s\">Purchase our bundle of premium "
113
  "features</a> for an even better plugin."
114
- msgstr ""
115
 
116
  #: includes/admin/class-ads.php:62
117
  msgid "More subscribers, better newsletters."
@@ -121,7 +123,7 @@ msgstr "Mais inscritos, melhores newsletters."
121
  msgid ""
122
  "Learn how to best grow your lists & write better emails by subscribing to "
123
  "our monthly tips."
124
- msgstr ""
125
 
126
  #: includes/admin/class-ads.php:66
127
  msgid "Email Address"
@@ -145,7 +147,7 @@ msgstr "Formulário de inscrição padrão"
145
 
146
  #: includes/class-api.php:83
147
  msgid "Read more about common connectivity issues."
148
- msgstr ""
149
 
150
  #: includes/forms/class-admin.php:71 includes/forms/class-admin.php:72
151
  #: includes/forms/views/edit-form.php:17
@@ -154,7 +156,7 @@ msgstr "Formulários"
154
 
155
  #: includes/forms/class-admin.php:101 includes/forms/class-admin.php:176
156
  msgid "<strong>Success!</strong> Form successfully saved."
157
- msgstr ""
158
 
159
  #: includes/forms/class-admin.php:176
160
  msgid "Preview form"
@@ -178,7 +180,7 @@ msgstr "Substituído pela resposta do formulário (mensagens de erro ou de suces
178
 
179
  #: includes/forms/class-form-tags.php:56
180
  msgid "Data from the URL or a submitted form."
181
- msgstr ""
182
 
183
  #: includes/forms/class-form-tags.php:62
184
  #: includes/integrations/class-integration-tags.php:45
@@ -187,7 +189,7 @@ msgstr "Substituido com o número de inscritos na(s) lista(s) selecionada(s)"
187
 
188
  #: includes/forms/class-form-tags.php:67
189
  msgid "The email address of the current visitor (if known)."
190
- msgstr ""
191
 
192
  #: includes/forms/class-form-tags.php:72
193
  msgid "The URL of the page."
@@ -215,11 +217,11 @@ msgstr "O IP do visitante. Exemplo %s."
215
 
216
  #: includes/forms/class-form-tags.php:102
217
  msgid "The property of the currently logged-in user."
218
- msgstr ""
219
 
220
  #: includes/forms/class-form.php:128
221
  msgid "There is no form with ID %d, perhaps it was deleted?"
222
- msgstr ""
223
 
224
  #: includes/forms/class-widget.php:26
225
  msgid "Newsletter"
@@ -257,11 +259,11 @@ msgstr "Digite o título do formulário.."
257
 
258
  #: includes/forms/views/add-form.php:37
259
  msgid "To which MailChimp lists should this form subscribe?"
260
- msgstr ""
261
 
262
  #: includes/forms/views/add-form.php:54
263
  msgid "No lists found. Did you <a href=\"%s\">connect with MailChimp</a>?"
264
- msgstr ""
265
 
266
  #: includes/forms/views/edit-form.php:4
267
  msgid "Fields"
@@ -311,7 +313,7 @@ msgstr "Adicionar mais campos"
311
  msgid ""
312
  "To add more fields to your form, you will need to create those fields in "
313
  "MailChimp first."
314
- msgstr ""
315
 
316
  #: includes/forms/views/parts/add-fields-help.php:12
317
  msgid "Here's how:"
@@ -323,11 +325,11 @@ msgstr "Entrar na sua conta MailChimp."
323
 
324
  #: includes/forms/views/parts/add-fields-help.php:22
325
  msgid "Add list fields to any of your selected lists."
326
- msgstr ""
327
 
328
  #: includes/forms/views/parts/add-fields-help.php:23
329
  msgid "Clicking the following links will take you to the right screen."
330
- msgstr ""
331
 
332
  #: includes/forms/views/parts/add-fields-help.php:29
333
  msgid "Edit list fields for"
@@ -337,7 +339,7 @@ msgstr "Editar campos para"
337
  msgid ""
338
  "Click the following button to have MailChimp for WordPress pick up on your "
339
  "changes."
340
- msgstr ""
341
 
342
  #: includes/forms/views/parts/add-fields-help.php:43
343
  #: includes/views/parts/lists-overview.php:8
@@ -346,7 +348,7 @@ msgstr "Renovar listas MailChimp"
346
 
347
  #: includes/forms/views/parts/dynamic-content-tags.php:6
348
  msgid "Add dynamic form variable"
349
- msgstr ""
350
 
351
  #: includes/forms/views/parts/dynamic-content-tags.php:8
352
  msgid ""
@@ -360,7 +362,7 @@ msgstr "Permite personalizar o formulário ou as mensagens de resposta."
360
 
361
  #: includes/forms/views/tabs/form-appearance.php:5
362
  msgid "Inherit from %s theme"
363
- msgstr ""
364
 
365
  #: includes/forms/views/tabs/form-appearance.php:6
366
  msgid "Basic"
@@ -428,7 +430,7 @@ msgstr "Use o shortcode %s para exibir este formulário dentro de um post, pági
428
 
429
  #: includes/forms/views/tabs/form-messages.php:3
430
  msgid "Form Messages"
431
- msgstr ""
432
 
433
  #: includes/forms/views/tabs/form-messages.php:10
434
  msgid "Successfully subscribed"
@@ -525,7 +527,7 @@ msgstr "Selecione a lista(s) que as pessoas que se enviarem o formulá serão in
525
 
526
  #: includes/forms/views/tabs/form-settings.php:35
527
  msgid "Use double opt-in?"
528
- msgstr ""
529
 
530
  #: includes/forms/views/tabs/form-settings.php:39
531
  #: includes/forms/views/tabs/form-settings.php:54
@@ -601,7 +603,7 @@ msgstr "Substituir grupos de interesse?"
601
  msgid ""
602
  "Select \"no\" if you want to add the selected groupings to any previously "
603
  "selected groupings when updating a subscriber."
604
- msgstr ""
605
 
606
  #: includes/forms/views/tabs/form-settings.php:93
607
  #: includes/integrations/views/integration-settings.php:207
@@ -653,17 +655,17 @@ msgstr "Ativado?"
653
  #: includes/integrations/views/integration-settings.php:55
654
  msgid ""
655
  "Enable the %s integration? This will add a sign-up checkbox to the form."
656
- msgstr ""
657
 
658
  #: includes/integrations/views/integration-settings.php:64
659
  msgid "Implicit?"
660
- msgstr ""
661
 
662
  #: includes/integrations/views/integration-settings.php:68
663
  msgid ""
664
  "Select \"no\" if you want to ask your visitors before they are subscribed "
665
  "(recommended)."
666
- msgstr ""
667
 
668
  #: includes/integrations/views/integration-settings.php:78
669
  msgid "MailChimp Lists"
@@ -811,7 +813,7 @@ msgid ""
811
  "The table below shows your MailChimp lists and their details. If you just "
812
  "applied changes to your MailChimp lists, please use the following button to "
813
  "renew the cached lists configuration."
814
- msgstr ""
815
 
816
  #: includes/views/parts/lists-overview.php:14
817
  msgid "No lists were found in your MailChimp account"
@@ -843,7 +845,7 @@ msgstr "%s (%s) com tipo de campo %s."
843
 
844
  #: includes/views/parts/lists-overview.php:83
845
  msgid "%s (ID: %s) with type %s."
846
- msgstr ""
847
 
848
  #: integrations/contact-form-7/admin-before.php:2
849
  msgid ""
@@ -855,7 +857,7 @@ msgstr "Para integração com o Contact Form 7, configure abaixo e adicione %s a
855
  msgid ""
856
  "To get a custom integration to work, include the following HTML in the form "
857
  "you are trying to integrate with."
858
- msgstr ""
859
 
860
  #: integrations/woocommerce/class-woocommerce.php:102
861
  msgid "Order #%d"
@@ -869,13 +871,13 @@ msgstr "MailChimp for WordPress"
869
  msgid ""
870
  "https://mc4wp.com/#utm_source=wp-plugin&utm_medium=mailchimp-for-"
871
  "wp&utm_campaign=plugins-page"
872
- msgstr ""
873
 
874
  #. Description of the plugin/theme
875
  msgid ""
876
  "MailChimp for WordPress by ibericode. Adds various highly effective sign-up "
877
  "methods to your site."
878
- msgstr ""
879
 
880
  #. Author of the plugin/theme
881
  msgid "ibericode"
3
  # Translators:
4
  # Arlei Santos <contato@attas.com.br>, 2016
5
  # Douglas de Araujo <douglas@ludicaeventos.com.br>, 2015
6
+ # Fabricio Corrêa <fabricionthweb@gmail.com>, 2016
7
+ # Fabricio Corrêa <fabricionthweb@gmail.com>, 2016
8
  # Felipe Porto <felipe@appdigital.com.br>, 2015
9
  # Leandro de Santi <leandro.santi@gmail.com>, 2014-2015
10
  # Liane Bez <liane@lianebez.com.br>, 2016
11
  # Lucas Vilaboim de Figueiredo <luvilaboim@gmail.com>, 2015
12
  # Luiz Sobral <lctsobral@gmail.com>, 2015
13
  # Ronne Clay Santos <roneclay@gmail.com>, 2015
14
+ # Sergio Nauffal <sergio.xcom@gmail.com>, 2016
15
  msgid ""
16
  msgstr ""
17
  "Project-Id-Version: MailChimp for WordPress\n"
18
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mailchimp-for-wp\n"
19
  "POT-Creation-Date: 2015-11-30 10:15:18+00:00\n"
20
+ "PO-Revision-Date: 2016-04-11 17:47+0000\n"
21
+ "Last-Translator: Fabricio Corrêa <fabricionthweb@gmail.com>\n"
22
  "Language-Team: Portuguese (Brazil) (http://www.transifex.com/ibericode/mailchimp-for-wordpress/language/pt_BR/)\n"
23
  "MIME-Version: 1.0\n"
24
  "Content-Type: text/plain; charset=UTF-8\n"
113
  msgid ""
114
  "Enjoying this plugin? <a href=\"%s\">Purchase our bundle of premium "
115
  "features</a> for an even better plugin."
116
+ msgstr "Gostou deste plugin? <a href=\"%s\"> Compre nosso pacote de recursos Premium </a> para um plug-in ainda melhor."
117
 
118
  #: includes/admin/class-ads.php:62
119
  msgid "More subscribers, better newsletters."
123
  msgid ""
124
  "Learn how to best grow your lists & write better emails by subscribing to "
125
  "our monthly tips."
126
+ msgstr "Aprenda a melhor forma de aumentar suas listas e escrever melhor seus e-mails, assinando nossas dicas mensais."
127
 
128
  #: includes/admin/class-ads.php:66
129
  msgid "Email Address"
147
 
148
  #: includes/class-api.php:83
149
  msgid "Read more about common connectivity issues."
150
+ msgstr "Leia mais sobre problemas mais comuns de conectividade."
151
 
152
  #: includes/forms/class-admin.php:71 includes/forms/class-admin.php:72
153
  #: includes/forms/views/edit-form.php:17
156
 
157
  #: includes/forms/class-admin.php:101 includes/forms/class-admin.php:176
158
  msgid "<strong>Success!</strong> Form successfully saved."
159
+ msgstr "<strong>Sucesso!</strong> Seu formulário foi salvo. "
160
 
161
  #: includes/forms/class-admin.php:176
162
  msgid "Preview form"
180
 
181
  #: includes/forms/class-form-tags.php:56
182
  msgid "Data from the URL or a submitted form."
183
+ msgstr "Dados da URL ou de um formulário enviado."
184
 
185
  #: includes/forms/class-form-tags.php:62
186
  #: includes/integrations/class-integration-tags.php:45
189
 
190
  #: includes/forms/class-form-tags.php:67
191
  msgid "The email address of the current visitor (if known)."
192
+ msgstr "O endereço de e-mail do visitante atual (se conhecido)."
193
 
194
  #: includes/forms/class-form-tags.php:72
195
  msgid "The URL of the page."
217
 
218
  #: includes/forms/class-form-tags.php:102
219
  msgid "The property of the currently logged-in user."
220
+ msgstr "A propriedade do usuário conectado no momento."
221
 
222
  #: includes/forms/class-form.php:128
223
  msgid "There is no form with ID %d, perhaps it was deleted?"
224
+ msgstr "Não existe um formulário com ID %d, talvez ele tenha sido excluído?"
225
 
226
  #: includes/forms/class-widget.php:26
227
  msgid "Newsletter"
259
 
260
  #: includes/forms/views/add-form.php:37
261
  msgid "To which MailChimp lists should this form subscribe?"
262
+ msgstr "Para quais listas do Mailchimp este formulário deve subscrever?"
263
 
264
  #: includes/forms/views/add-form.php:54
265
  msgid "No lists found. Did you <a href=\"%s\">connect with MailChimp</a>?"
266
+ msgstr "Nenhuma lista encontrada. Você quer <a href=\"%s\"> conectar com o MailChimp </a>?"
267
 
268
  #: includes/forms/views/edit-form.php:4
269
  msgid "Fields"
313
  msgid ""
314
  "To add more fields to your form, you will need to create those fields in "
315
  "MailChimp first."
316
+ msgstr "Para adicionar mais campos a este formulário, você precisará criar esses campos no MailChimp antes."
317
 
318
  #: includes/forms/views/parts/add-fields-help.php:12
319
  msgid "Here's how:"
325
 
326
  #: includes/forms/views/parts/add-fields-help.php:22
327
  msgid "Add list fields to any of your selected lists."
328
+ msgstr "Adicionar campos de lista para qualquer uma das suas listas selecionadas."
329
 
330
  #: includes/forms/views/parts/add-fields-help.php:23
331
  msgid "Clicking the following links will take you to the right screen."
332
+ msgstr "Ao clicar no link a seguir você irá para tela correta."
333
 
334
  #: includes/forms/views/parts/add-fields-help.php:29
335
  msgid "Edit list fields for"
339
  msgid ""
340
  "Click the following button to have MailChimp for WordPress pick up on your "
341
  "changes."
342
+ msgstr "Clique no botão a seguir para que o MailChimp para WordPress possa registrar suas alterações."
343
 
344
  #: includes/forms/views/parts/add-fields-help.php:43
345
  #: includes/views/parts/lists-overview.php:8
348
 
349
  #: includes/forms/views/parts/dynamic-content-tags.php:6
350
  msgid "Add dynamic form variable"
351
+ msgstr "Adicionar variável dinâmica de formulário"
352
 
353
  #: includes/forms/views/parts/dynamic-content-tags.php:8
354
  msgid ""
362
 
363
  #: includes/forms/views/tabs/form-appearance.php:5
364
  msgid "Inherit from %s theme"
365
+ msgstr "Herdar do %s do tema"
366
 
367
  #: includes/forms/views/tabs/form-appearance.php:6
368
  msgid "Basic"
430
 
431
  #: includes/forms/views/tabs/form-messages.php:3
432
  msgid "Form Messages"
433
+ msgstr "Mensagens de formulário"
434
 
435
  #: includes/forms/views/tabs/form-messages.php:10
436
  msgid "Successfully subscribed"
527
 
528
  #: includes/forms/views/tabs/form-settings.php:35
529
  msgid "Use double opt-in?"
530
+ msgstr "Usar verificação dupla?"
531
 
532
  #: includes/forms/views/tabs/form-settings.php:39
533
  #: includes/forms/views/tabs/form-settings.php:54
603
  msgid ""
604
  "Select \"no\" if you want to add the selected groupings to any previously "
605
  "selected groupings when updating a subscriber."
606
+ msgstr "Selecione \"não\" se você deseja adicionar os grupos selecionados para quaisquer grupos previamente selecionados ao atualizar um assinante."
607
 
608
  #: includes/forms/views/tabs/form-settings.php:93
609
  #: includes/integrations/views/integration-settings.php:207
655
  #: includes/integrations/views/integration-settings.php:55
656
  msgid ""
657
  "Enable the %s integration? This will add a sign-up checkbox to the form."
658
+ msgstr "Habilitar integração com %s? Isto irá adicionar uma caixa de seleção de inscrição no formulário."
659
 
660
  #: includes/integrations/views/integration-settings.php:64
661
  msgid "Implicit?"
662
+ msgstr "Implícito?"
663
 
664
  #: includes/integrations/views/integration-settings.php:68
665
  msgid ""
666
  "Select \"no\" if you want to ask your visitors before they are subscribed "
667
  "(recommended)."
668
+ msgstr "Escolha \"não\" se você quiser perguntar a seus visitantes antes de serem inscritos (recomendado)."
669
 
670
  #: includes/integrations/views/integration-settings.php:78
671
  msgid "MailChimp Lists"
813
  "The table below shows your MailChimp lists and their details. If you just "
814
  "applied changes to your MailChimp lists, please use the following button to "
815
  "renew the cached lists configuration."
816
+ msgstr "A tabela abaixo mostra as suas listas de MailChimp e seus detalhes. Se você acaba de aplicar as alterações às suas listas de MailChimp, por favor use o botão seguinte para renovar a configuração do cache das listas."
817
 
818
  #: includes/views/parts/lists-overview.php:14
819
  msgid "No lists were found in your MailChimp account"
845
 
846
  #: includes/views/parts/lists-overview.php:83
847
  msgid "%s (ID: %s) with type %s."
848
+ msgstr "%s (ID: %s) do tipo %s."
849
 
850
  #: integrations/contact-form-7/admin-before.php:2
851
  msgid ""
857
  msgid ""
858
  "To get a custom integration to work, include the following HTML in the form "
859
  "you are trying to integrate with."
860
+ msgstr "Para obter uma integração personalizada, inclua o seguinte HTML no formulário que você está tentando integrar."
861
 
862
  #: integrations/woocommerce/class-woocommerce.php:102
863
  msgid "Order #%d"
871
  msgid ""
872
  "https://mc4wp.com/#utm_source=wp-plugin&utm_medium=mailchimp-for-"
873
  "wp&utm_campaign=plugins-page"
874
+ msgstr "https://mc4wp.com/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=plugins-page"
875
 
876
  #. Description of the plugin/theme
877
  msgid ""
878
  "MailChimp for WordPress by ibericode. Adds various highly effective sign-up "
879
  "methods to your site."
880
+ msgstr "MailChimp para WordPress por ibericode. Adiciona vários métodos altamente eficazes de inscrição para o seu site."
881
 
882
  #. Author of the plugin/theme
883
  msgid "ibericode"
mailchimp-for-wp.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: MailChimp for WordPress
4
  Plugin URI: https://mc4wp.com/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=plugins-page
5
  Description: MailChimp for WordPress by ibericode. Adds various highly effective sign-up methods to your site.
6
- Version: 3.1.5
7
  Author: ibericode
8
  Author URI: https://ibericode.com/
9
  Text Domain: mailchimp-for-wp
@@ -11,7 +11,7 @@ Domain Path: /languages
11
  License: GPL v3
12
 
13
  MailChimp for WordPress
14
- Copyright (C) 2012-2015, Danny van Kooten, hi@dannyvankooten.com
15
 
16
  This program is free software: you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ function __mc4wp_load_plugin() {
47
  }
48
 
49
  // bootstrap the core plugin
50
- define( 'MC4WP_VERSION', '3.1.5' );
51
  define( 'MC4WP_PLUGIN_DIR', dirname( __FILE__ ) . '/' );
52
  define( 'MC4WP_PLUGIN_URL', plugins_url( '/' , __FILE__ ) );
53
  define( 'MC4WP_PLUGIN_FILE', __FILE__ );
3
  Plugin Name: MailChimp for WordPress
4
  Plugin URI: https://mc4wp.com/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=plugins-page
5
  Description: MailChimp for WordPress by ibericode. Adds various highly effective sign-up methods to your site.
6
+ Version: 3.1.6
7
  Author: ibericode
8
  Author URI: https://ibericode.com/
9
  Text Domain: mailchimp-for-wp
11
  License: GPL v3
12
 
13
  MailChimp for WordPress
14
+ Copyright (C) 2012-2016, Danny van Kooten, hi@dannyvankooten.com
15
 
16
  This program is free software: you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
47
  }
48
 
49
  // bootstrap the core plugin
50
+ define( 'MC4WP_VERSION', '3.1.6' );
51
  define( 'MC4WP_PLUGIN_DIR', dirname( __FILE__ ) . '/' );
52
  define( 'MC4WP_PLUGIN_URL', plugins_url( '/' , __FILE__ ) );
53
  define( 'MC4WP_PLUGIN_FILE', __FILE__ );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://mc4wp.com/#utm_source=wp-plugin-repo&utm_medium=mailchimp-f
4
  Tags: mailchimp, mc4wp, email, marketing, newsletter, subscribe, widget, mc4wp, contact form 7, woocommerce, buddypress, ibericode, mailchimp forms, mailchimp integrations
5
  Requires at least: 3.8
6
  Tested up to: 4.4.2
7
- Stable tag: 3.1.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -43,6 +43,8 @@ MailChimp for WordPress helps you add more subscribers to your MailChimp lists u
43
  - [MailChimp User Sync](https://wordpress.org/plugins/mailchimp-sync/)
44
  - [Scroll Triggered Boxes](https://wordpress.org/plugins/scroll-triggered-boxes/)
45
  - [Captcha](https://wordpress.org/plugins/mc4wp-captcha/)
 
 
46
 
47
  - Well documented. Our [knowledge base](https://mc4wp.com/kb/) is updated daily.
48
 
@@ -182,6 +184,23 @@ MailChimp for WordPress is being developed on GitHub. If you want to collaborate
182
  == Changelog ==
183
 
184
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  #### 3.1.5 - March 22, 2016
186
 
187
  **Fixes**
4
  Tags: mailchimp, mc4wp, email, marketing, newsletter, subscribe, widget, mc4wp, contact form 7, woocommerce, buddypress, ibericode, mailchimp forms, mailchimp integrations
5
  Requires at least: 3.8
6
  Tested up to: 4.4.2
7
+ Stable tag: 3.1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
43
  - [MailChimp User Sync](https://wordpress.org/plugins/mailchimp-sync/)
44
  - [Scroll Triggered Boxes](https://wordpress.org/plugins/scroll-triggered-boxes/)
45
  - [Captcha](https://wordpress.org/plugins/mc4wp-captcha/)
46
+ - Third Party:
47
+ - [WPBruiser](https://wordpress.org/plugins/goodbye-captcha/)
48
 
49
  - Well documented. Our [knowledge base](https://mc4wp.com/kb/) is updated daily.
50
 
184
  == Changelog ==
185
 
186
 
187
+ #### 3.1.6 - April 12, 2016
188
+
189
+ **Fixes**
190
+
191
+ - Form event for starting a form was named `start` where it should have been `started`.
192
+
193
+ **Improvements**
194
+
195
+ - Some preparations for the upcoming migration to the new MailChimp API (version 3).
196
+ - Consistent hook parameters for `mc4wp_form_subscribed` action.
197
+ - Improved logic for rendering form response.
198
+
199
+ **Additions**
200
+
201
+ - New checkbox position for WooCommerce checkout integration.
202
+
203
+
204
  #### 3.1.5 - March 22, 2016
205
 
206
  **Fixes**
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInit388038098dac69bf47d375b96ef58d98::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInitaaffd90ed6ce7e97945be0edb7546469::getLoader();
vendor/composer/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
 
2
- Copyright (c) 2015 Nils Adermann, Jordi Boggiano
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
1
 
2
+ Copyright (c) 2016 Nils Adermann, Jordi Boggiano
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
vendor/composer/autoload_classmap.php CHANGED
@@ -53,10 +53,13 @@ return array(
53
  'MC4WP_Remote_Content_Block' => $baseDir . '/includes/admin/class-remote-content-block.php',
54
  'MC4WP_Request' => $baseDir . '/includes/class-request.php',
55
  'MC4WP_Tools' => $baseDir . '/includes/class-tools.php',
 
56
  'MC4WP_Upgrade_Routines' => $baseDir . '/includes/admin/class-upgrade-routines.php',
57
  'MC4WP_Usage_Tracking' => $baseDir . '/includes/admin/class-usage-tracking.php',
58
  'MC4WP_User_Integration' => $baseDir . '/includes/integrations/class-user-integration.php',
59
  'MC4WP_Validator' => $baseDir . '/includes/class-validator.php',
60
  'MC4WP_Visitor_Tracking' => $baseDir . '/includes/class-visitor-tracking.php',
61
  'MC4WP_WooCommerce_Integration' => $baseDir . '/integrations/woocommerce/class-woocommerce.php',
 
 
62
  );
53
  'MC4WP_Remote_Content_Block' => $baseDir . '/includes/admin/class-remote-content-block.php',
54
  'MC4WP_Request' => $baseDir . '/includes/class-request.php',
55
  'MC4WP_Tools' => $baseDir . '/includes/class-tools.php',
56
+ 'MC4WP_Update_Optin' => $baseDir . '/includes/admin/class-update-optin.php',
57
  'MC4WP_Upgrade_Routines' => $baseDir . '/includes/admin/class-upgrade-routines.php',
58
  'MC4WP_Usage_Tracking' => $baseDir . '/includes/admin/class-usage-tracking.php',
59
  'MC4WP_User_Integration' => $baseDir . '/includes/integrations/class-user-integration.php',
60
  'MC4WP_Validator' => $baseDir . '/includes/class-validator.php',
61
  'MC4WP_Visitor_Tracking' => $baseDir . '/includes/class-visitor-tracking.php',
62
  'MC4WP_WooCommerce_Integration' => $baseDir . '/integrations/woocommerce/class-woocommerce.php',
63
+ 'xrstf\\Composer52\\AutoloadGenerator' => $vendorDir . '/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php',
64
+ 'xrstf\\Composer52\\Generator' => $vendorDir . '/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php',
65
  );
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInit388038098dac69bf47d375b96ef58d98 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit388038098dac69bf47d375b96ef58d98 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit388038098dac69bf47d375b96ef58d98', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit388038098dac69bf47d375b96ef58d98', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInitaaffd90ed6ce7e97945be0edb7546469 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitaaffd90ed6ce7e97945be0edb7546469', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitaaffd90ed6ce7e97945be0edb7546469', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);