MailChimp for WordPress - Version 4.8.3

Version Description

Download this release

Release Info

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

Code changes from version 4.8.2 to 4.8.3

CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
  Changelog
2
  =========
3
 
 
 
 
 
 
 
4
  #### 4.8.2 - Jan 20, 2021
5
 
6
  - Allow short-circuiting `mc4wp_subscriber_data` filter by returning `null` or `false`.
1
  Changelog
2
  =========
3
 
4
+ #### 4.8.3 - Jan 21, 2021
5
+
6
+ - Fix fatal error on older PHP versions when submitting form without any subscriber tags set in the form settings.
7
+ - Minor performance improvement in bootstrap method of the plugin.
8
+
9
+
10
  #### 4.8.2 - Jan 20, 2021
11
 
12
  - Allow short-circuiting `mc4wp_subscriber_data` filter by returning `null` or `false`.
assets/js/third-party/placeholders.js CHANGED
@@ -1,6 +1,8 @@
1
  (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
  "use strict";
3
 
 
 
4
  /*!
5
  * The MIT License
6
  *
1
  (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
  "use strict";
3
 
4
+ /* eslint-disable */
5
+
6
  /*!
7
  * The MIT License
8
  *
assets/js/third-party/placeholders.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["third-party/placeholders.js"],"names":["r","e","n","t","o","i","f","c","require","u","a","Error","code","p","exports","call","length","1","module","global","nativeSupport","document","createElement","placeholder","Placeholders","disable","noop","disablePlaceholders","enable","node","handleElem","showPlaceholder","keydownVal","validTypes","badKeys","placeholderClassName","classNameRegExp","RegExp","ATTR_CURRENT_VAL","ATTR_ACTIVE","ATTR_INPUT_TYPE","ATTR_FORM_HANDLED","ATTR_EVENTS_BOUND","ATTR_MAXLENGTH","head","getElementsByTagName","root","documentElement","inputs","textareas","hideOnInput","getAttribute","liveUpdates","styleElem","type","elem","styleRules","createTextNode","styleSheet","cssText","nodeValue","appendChild","insertBefore","firstChild","len","attributes","inArray","newElement","timer","setInterval","changeType","setAttribute","value","hidePlaceholder","removeAttribute","clearInterval","addEventListener","safeActiveElement","activeElement","err","arr","item","event","fn","attachEvent","moveCaret","index","range","createTextRange","move","select","selectionStart","focus","setSelectionRange","callback","handleInputs","handleTextareas","handleInputsLength","keydownValue","valueChanged","isPlaceholderValue","replace","className","maxLength","parseInt","val","form","getElementById","makeSubmitHandler","makeFocusHandler","makeBlurHandler","keyCode","preventDefault","makeKeydownHandler","blur","makeKeyupHandler","makeClickHandler"],"mappings":"CAAY,SAASA,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,EAAE,mBAAmBC,SAASA,QAAQ,IAAIF,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGI,EAAE,OAAOA,EAAEJ,GAAE,GAAI,IAAIK,EAAE,IAAIC,MAAM,uBAAuBN,EAAE,KAAK,MAAMK,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEX,EAAEG,GAAG,CAACS,QAAQ,IAAIb,EA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AuEauD,CAAgBvD,IAG3CL,IACF0B,EAAiBrB,EAAM,UA3D3B,SAA4BA,GAC1B,OAAO,SAAUtD,GAIf,GAHA+B,EAAauB,EAAKiB,MAGqB,SAAnCjB,EAAKJ,aAAaZ,IAA2BP,IAAeuB,EAAKJ,aAAab,IAAqB4B,EAAQhC,EAASjC,EAAE8G,SAKxH,OAJI9G,EAAE+G,gBACJ/G,EAAE+G,kBAGG,GAiDyBC,CAAmB1D,IACrDqB,EAAiBrB,EAAM,QA7C3B,SAA0BA,GACxB,OAAO,WACLkB,EAAgBlB,EAAMvB,GAEH,KAAfuB,EAAKiB,QACPjB,EAAK2D,OACL7B,EAAU9B,EAAM,KAuCc4D,CAAiB5D,IACjDqB,EAAiBrB,EAAM,QAnC3B,SAA0BA,GACxB,OAAO,WACDA,IAASsB,KAAuBtB,EAAKiB,QAAUjB,EAAKJ,aAAab,IAAwD,SAAnCiB,EAAKJ,aAAaZ,IAC1G8C,EAAU9B,EAAM,IAgCc6D,CAAiB7D,KAInDA,EAAKgB,aAAa7B,EAAmB,QACrCa,EAAKgB,aAAajC,EAAkBf,IAGhC2B,GAAeK,IAASsB,KAC1B9C,EAAgBwB,IAzbtB,MA4bG,IAED,KAAK,GAAG,CAAC","file":"placeholders.min.js","sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n\"use strict\";\n\n/*!\n * The MIT License\n *\n * Copyright (c) 2012 James Allardice\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\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell 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\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n(function (global) {\n 'use strict'; //\n // Test for support. We do this as early as possible to optimise for browsers\n // that have native support for the attribute.\n //\n\n var test = document.createElement('input');\n var nativeSupport = test.placeholder !== void 0;\n global.Placeholders = {\n nativeSupport: nativeSupport,\n disable: nativeSupport ? noop : disablePlaceholders,\n enable: nativeSupport ? noop : enablePlaceholders\n };\n\n if (nativeSupport) {\n return;\n } //\n // If we reach this point then the browser does not have native support for\n // the attribute.\n //\n // The list of input element types that support the placeholder attribute.\n\n\n var validTypes = ['text', 'search', 'url', 'tel', 'email', 'password', 'number', 'textarea']; // The list of keycodes that are not allowed when the polyfill is configured\n // to hide-on-input.\n\n var badKeys = [// The following keys all cause the caret to jump to the end of the input\n // value.\n 27, // Escape\n 33, // Page up\n 34, // Page down\n 35, // End\n 36, // Home\n // Arrow keys allow you to move the caret manually, which should be\n // prevented when the placeholder is visible.\n 37, // Left\n 38, // Up\n 39, // Right\n 40, // Down\n // The following keys allow you to modify the placeholder text by removing\n // characters, which should be prevented when the placeholder is visible.\n 8, // Backspace\n 46 // Delete\n ]; // Styling variables.\n\n var placeholderStyleColor = '#ccc';\n var placeholderClassName = 'placeholdersjs';\n var classNameRegExp = new RegExp('(?:^|\\\\s)' + placeholderClassName + '(?!\\\\S)'); // The various data-* attributes used by the polyfill.\n\n var ATTR_CURRENT_VAL = 'data-placeholder-value';\n var ATTR_ACTIVE = 'data-placeholder-active';\n var ATTR_INPUT_TYPE = 'data-placeholder-type';\n var ATTR_FORM_HANDLED = 'data-placeholder-submit';\n var ATTR_EVENTS_BOUND = 'data-placeholder-bound';\n var ATTR_OPTION_FOCUS = 'data-placeholder-focus';\n var ATTR_OPTION_LIVE = 'data-placeholder-live';\n var ATTR_MAXLENGTH = 'data-placeholder-maxlength'; // Various other variables used throughout the rest of the script.\n\n var UPDATE_INTERVAL = 100;\n var head = document.getElementsByTagName('head')[0];\n var root = document.documentElement;\n var Placeholders = global.Placeholders;\n var keydownVal; // Get references to all the input and textarea elements currently in the DOM\n // (live NodeList objects to we only need to do this once).\n\n var inputs = document.getElementsByTagName('input');\n var textareas = document.getElementsByTagName('textarea'); // Get any settings declared as data-* attributes on the root element.\n // Currently the only options are whether to hide the placeholder on focus\n // or input and whether to auto-update.\n\n var hideOnInput = root.getAttribute(ATTR_OPTION_FOCUS) === 'false';\n var liveUpdates = root.getAttribute(ATTR_OPTION_LIVE) !== 'false'; // Create style element for placeholder styles (instead of directly setting\n // style properties on elements - allows for better flexibility alongside\n // user-defined styles).\n\n var styleElem = document.createElement('style');\n styleElem.type = 'text/css'; // Create style rules as text node.\n\n var styleRules = document.createTextNode('.' + placeholderClassName + ' {' + 'color:' + placeholderStyleColor + ';' + '}'); // Append style rules to newly created stylesheet.\n\n if (styleElem.styleSheet) {\n styleElem.styleSheet.cssText = styleRules.nodeValue;\n } else {\n styleElem.appendChild(styleRules);\n } // Prepend new style element to the head (before any existing stylesheets,\n // so user-defined rules take precedence).\n\n\n head.insertBefore(styleElem, head.firstChild); // Set up the placeholders.\n\n var placeholder;\n var elem;\n\n for (var i = 0, len = inputs.length + textareas.length; i < len; i++) {\n // Find the next element. If we've already done all the inputs we move on\n // to the textareas.\n elem = i < inputs.length ? inputs[i] : textareas[i - inputs.length]; // Get the value of the placeholder attribute, if any. IE10 emulating IE7\n // fails with getAttribute, hence the use of the attributes node.\n\n placeholder = elem.attributes.placeholder; // If the element has a placeholder attribute we need to modify it.\n\n if (placeholder) {\n // IE returns an empty object instead of undefined if the attribute is\n // not present.\n placeholder = placeholder.nodeValue; // Only apply the polyfill if this element is of a type that supports\n // placeholders and has a placeholder attribute with a non-empty value.\n\n if (placeholder && inArray(validTypes, elem.type)) {\n newElement(elem);\n }\n }\n } // If enabled, the polyfill will repeatedly check for changed/added elements\n // and apply to those as well.\n\n\n var timer = setInterval(function () {\n for (var i = 0, len = inputs.length + textareas.length; i < len; i++) {\n elem = i < inputs.length ? inputs[i] : textareas[i - inputs.length]; // Only apply the polyfill if this element is of a type that supports\n // placeholders, and has a placeholder attribute with a non-empty value.\n\n placeholder = elem.attributes.placeholder;\n\n if (placeholder) {\n placeholder = placeholder.nodeValue;\n\n if (placeholder && inArray(validTypes, elem.type)) {\n // If the element hasn't had event handlers bound to it then add\n // them.\n if (!elem.getAttribute(ATTR_EVENTS_BOUND)) {\n newElement(elem);\n } // If the placeholder value has changed or not been initialised yet\n // we need to update the display.\n\n\n if (placeholder !== elem.getAttribute(ATTR_CURRENT_VAL) || elem.type === 'password' && !elem.getAttribute(ATTR_INPUT_TYPE)) {\n // Attempt to change the type of password inputs (fails in IE < 9).\n if (elem.type === 'password' && !elem.getAttribute(ATTR_INPUT_TYPE) && changeType(elem, 'text')) {\n elem.setAttribute(ATTR_INPUT_TYPE, 'password');\n } // If the placeholder value has changed and the placeholder is\n // currently on display we need to change it.\n\n\n if (elem.value === elem.getAttribute(ATTR_CURRENT_VAL)) {\n elem.value = placeholder;\n } // Keep a reference to the current placeholder value in case it\n // changes via another script.\n\n\n elem.setAttribute(ATTR_CURRENT_VAL, placeholder);\n }\n }\n } else if (elem.getAttribute(ATTR_ACTIVE)) {\n hidePlaceholder(elem);\n elem.removeAttribute(ATTR_CURRENT_VAL);\n }\n } // If live updates are not enabled cancel the timer.\n\n\n if (!liveUpdates) {\n clearInterval(timer);\n }\n }, UPDATE_INTERVAL); // Disabling placeholders before unloading the page prevents flash of\n // unstyled placeholders on load if the page was refreshed.\n\n addEventListener(global, 'beforeunload', function () {\n Placeholders.disable();\n }); //\n // Utility functions\n //\n // No-op (used in place of public methods when native support is detected).\n\n function noop() {} // Avoid IE9 activeElement of death when an iframe is used.\n //\n // More info:\n // - http://bugs.jquery.com/ticket/13393\n // - https://github.com/jquery/jquery/commit/85fc5878b3c6af73f42d61eedf73013e7faae408\n\n\n function safeActiveElement() {\n try {\n return document.activeElement;\n } catch (err) {}\n } // Check whether an item is in an array. We don't use Array.prototype.indexOf\n // so we don't clobber any existing polyfills. This is a really simple\n // alternative.\n\n\n function inArray(arr, item) {\n for (var i = 0, len = arr.length; i < len; i++) {\n if (arr[i] === item) {\n return true;\n }\n }\n\n return false;\n } // Cross-browser DOM event binding\n\n\n function addEventListener(elem, event, fn) {\n if (elem.addEventListener) {\n return elem.addEventListener(event, fn, false);\n }\n\n if (elem.attachEvent) {\n return elem.attachEvent('on' + event, fn);\n }\n } // Move the caret to the index position specified. Assumes that the element\n // has focus.\n\n\n function moveCaret(elem, index) {\n var range;\n\n if (elem.createTextRange) {\n range = elem.createTextRange();\n range.move('character', index);\n range.select();\n } else if (elem.selectionStart) {\n elem.focus();\n elem.setSelectionRange(index, index);\n }\n } // Attempt to change the type property of an input element.\n\n\n function changeType(elem, type) {\n try {\n elem.type = type;\n return true;\n } catch (e) {\n // You can't change input type in IE8 and below.\n return false;\n }\n }\n\n function handleElem(node, callback) {\n // Check if the passed in node is an input/textarea (in which case it can't\n // have any affected descendants).\n if (node && node.getAttribute(ATTR_CURRENT_VAL)) {\n callback(node);\n } else {\n // If an element was passed in, get all affected descendants. Otherwise,\n // get all affected elements in document.\n var handleInputs = node ? node.getElementsByTagName('input') : inputs;\n var handleTextareas = node ? node.getElementsByTagName('textarea') : textareas;\n var handleInputsLength = handleInputs ? handleInputs.length : 0;\n var handleTextareasLength = handleTextareas ? handleTextareas.length : 0; // Run the callback for each element.\n\n var len = handleInputsLength + handleTextareasLength;\n var elem;\n\n for (var i = 0; i < len; i++) {\n elem = i < handleInputsLength ? handleInputs[i] : handleTextareas[i - handleInputsLength];\n callback(elem);\n }\n }\n } // Return all affected elements to their normal state (remove placeholder\n // value if present).\n\n\n function disablePlaceholders(node) {\n handleElem(node, hidePlaceholder);\n } // Show the placeholder value on all appropriate elements.\n\n\n function enablePlaceholders(node) {\n handleElem(node, showPlaceholder);\n } // Hide the placeholder value on a single element. Returns true if the\n // placeholder was hidden and false if it was not (because it wasn't visible\n // in the first place).\n\n\n function hidePlaceholder(elem, keydownValue) {\n var valueChanged = !!keydownValue && elem.value !== keydownValue;\n var isPlaceholderValue = elem.value === elem.getAttribute(ATTR_CURRENT_VAL);\n\n if ((valueChanged || isPlaceholderValue) && elem.getAttribute(ATTR_ACTIVE) === 'true') {\n elem.removeAttribute(ATTR_ACTIVE);\n elem.value = elem.value.replace(elem.getAttribute(ATTR_CURRENT_VAL), '');\n elem.className = elem.className.replace(classNameRegExp, ''); // Restore the maxlength value. Old FF returns -1 if attribute not set.\n // See GH-56.\n\n var maxLength = elem.getAttribute(ATTR_MAXLENGTH);\n\n if (parseInt(maxLength, 10) >= 0) {\n elem.setAttribute('maxLength', maxLength);\n elem.removeAttribute(ATTR_MAXLENGTH);\n } // If the polyfill has changed the type of the element we need to change\n // it back.\n\n\n var type = elem.getAttribute(ATTR_INPUT_TYPE);\n\n if (type) {\n elem.type = type;\n }\n\n return true;\n }\n\n return false;\n } // Show the placeholder value on a single element. Returns true if the\n // placeholder was shown and false if it was not (because it was already\n // visible).\n\n\n function showPlaceholder(elem) {\n var val = elem.getAttribute(ATTR_CURRENT_VAL);\n\n if (elem.value === '' && val) {\n elem.setAttribute(ATTR_ACTIVE, 'true');\n elem.value = val;\n elem.className += ' ' + placeholderClassName; // Store and remove the maxlength value.\n\n var maxLength = elem.getAttribute(ATTR_MAXLENGTH);\n\n if (!maxLength) {\n elem.setAttribute(ATTR_MAXLENGTH, elem.maxLength);\n elem.removeAttribute('maxLength');\n } // If the type of element needs to change, change it (e.g. password\n // inputs).\n\n\n var type = elem.getAttribute(ATTR_INPUT_TYPE);\n\n if (type) {\n elem.type = 'text';\n } else if (elem.type === 'password' && changeType(elem, 'text')) {\n elem.setAttribute(ATTR_INPUT_TYPE, 'password');\n }\n\n return true;\n }\n\n return false;\n } // Returns a function that is used as a focus event handler.\n\n\n function makeFocusHandler(elem) {\n return function () {\n // Only hide the placeholder value if the (default) hide-on-focus\n // behaviour is enabled.\n if (hideOnInput && elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === 'true') {\n // Move the caret to the start of the input (this mimics the behaviour\n // of all browsers that do not hide the placeholder on focus).\n moveCaret(elem, 0);\n } else {\n // Remove the placeholder.\n hidePlaceholder(elem);\n }\n };\n } // Returns a function that is used as a blur event handler.\n\n\n function makeBlurHandler(elem) {\n return function () {\n showPlaceholder(elem);\n };\n } // Returns a function that is used as a submit event handler on form elements\n // that have children affected by this polyfill.\n\n\n function makeSubmitHandler(form) {\n return function () {\n // Turn off placeholders on all appropriate descendant elements.\n disablePlaceholders(form);\n };\n } // Functions that are used as a event handlers when the hide-on-input\n // behaviour has been activated - very basic implementation of the 'input'\n // event.\n\n\n function makeKeydownHandler(elem) {\n return function (e) {\n keydownVal = elem.value; // Prevent the use of the arrow keys (try to keep the cursor before the\n // placeholder).\n\n if (elem.getAttribute(ATTR_ACTIVE) === 'true' && keydownVal === elem.getAttribute(ATTR_CURRENT_VAL) && inArray(badKeys, e.keyCode)) {\n if (e.preventDefault) {\n e.preventDefault();\n }\n\n return false;\n }\n };\n }\n\n function makeKeyupHandler(elem) {\n return function () {\n hidePlaceholder(elem, keydownVal); // If the element is now empty we need to show the placeholder\n\n if (elem.value === '') {\n elem.blur();\n moveCaret(elem, 0);\n }\n };\n }\n\n function makeClickHandler(elem) {\n return function () {\n if (elem === safeActiveElement() && elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === 'true') {\n moveCaret(elem, 0);\n }\n };\n } // Bind event handlers to an element that we need to affect with the\n // polyfill.\n\n\n function newElement(elem) {\n // If the element is part of a form, make sure the placeholder string is\n // not submitted as a value.\n var form = elem.form;\n\n if (form && typeof form === 'string') {\n // Get the real form.\n form = document.getElementById(form); // Set a flag on the form so we know it's been handled (forms can contain\n // multiple inputs).\n\n if (!form.getAttribute(ATTR_FORM_HANDLED)) {\n addEventListener(form, 'submit', makeSubmitHandler(form));\n form.setAttribute(ATTR_FORM_HANDLED, 'true');\n }\n } // Bind event handlers to the element so we can hide/show the placeholder\n // as appropriate.\n\n\n addEventListener(elem, 'focus', makeFocusHandler(elem));\n addEventListener(elem, 'blur', makeBlurHandler(elem)); // If the placeholder should hide on input rather than on focus we need\n // additional event handlers\n\n if (hideOnInput) {\n addEventListener(elem, 'keydown', makeKeydownHandler(elem));\n addEventListener(elem, 'keyup', makeKeyupHandler(elem));\n addEventListener(elem, 'click', makeClickHandler(elem));\n } // Remember that we've bound event handlers to this element.\n\n\n elem.setAttribute(ATTR_EVENTS_BOUND, 'true');\n elem.setAttribute(ATTR_CURRENT_VAL, placeholder); // If the element doesn't have a value and is not focussed, set it to the\n // placeholder string.\n\n if (hideOnInput || elem !== safeActiveElement()) {\n showPlaceholder(elem);\n }\n }\n})(void 0);\n\n},{}]},{},[1]);\n"]}
1
+ {"version":3,"sources":["third-party/placeholders.js"],"names":["r","e","n","t","o","i","f","c","require","u","a","Error","code","p","exports","call","length","1","module","global","nativeSupport","document","createElement","placeholder","Placeholders","disable","noop","disablePlaceholders","enable","node","handleElem","showPlaceholder","keydownVal","validTypes","badKeys","placeholderClassName","classNameRegExp","RegExp","ATTR_CURRENT_VAL","ATTR_ACTIVE","ATTR_INPUT_TYPE","ATTR_FORM_HANDLED","ATTR_EVENTS_BOUND","ATTR_MAXLENGTH","head","getElementsByTagName","root","documentElement","inputs","textareas","hideOnInput","getAttribute","liveUpdates","styleElem","type","elem","styleRules","createTextNode","styleSheet","cssText","nodeValue","appendChild","insertBefore","firstChild","len","attributes","inArray","newElement","timer","setInterval","changeType","setAttribute","value","hidePlaceholder","removeAttribute","clearInterval","addEventListener","safeActiveElement","activeElement","err","arr","item","event","fn","attachEvent","moveCaret","index","range","createTextRange","move","select","selectionStart","focus","setSelectionRange","callback","handleInputs","handleTextareas","handleInputsLength","keydownValue","valueChanged","isPlaceholderValue","replace","className","maxLength","parseInt","val","form","getElementById","makeSubmitHandler","makeFocusHandler","makeBlurHandler","keyCode","preventDefault","makeKeydownHandler","blur","makeKeyupHandler","makeClickHandler"],"mappings":"CAAY,SAASA,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,EAAE,mBAAmBC,SAASA,QAAQ,IAAIF,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGI,EAAE,OAAOA,EAAEJ,GAAE,GAAI,IAAIK,EAAE,IAAIC,MAAM,uBAAuBN,EAAE,KAAK,MAAMK,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEX,EAAEG,GAAG,CAACS,QAAQ,IAAIb,EAAEI,GAAG,GAAGU,KAAKF,EAAEC,QAAQ,SAASd,GAAoB,OAAOI,EAAlBH,EAAEI,GAAG,GAAGL,IAAeA,IAAIa,EAAEA,EAAEC,QAAQd,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGS,QAAQ,IAAI,IAAIL,EAAE,mBAAmBD,SAASA,QAAQH,EAAE,EAAEA,EAAEF,EAAEa,OAAOX,IAAID,EAAED,EAAEE,IAAI,OAAOD,EAA7b,CAA4c,CAACa,EAAE,CAAC,SAAST,EAAQU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,WACLkB,EAAgBlB,EAAMvB,GAEH,KAAfuB,EAAKiB,QACPjB,EAAK2D,OACL7B,EAAU9B,EAAM,KAuCc4D,CAAiB5D,IACjDqB,EAAiBrB,EAAM,QAnC3B,SAA0BA,GACxB,OAAO,WACDA,IAASsB,KAAuBtB,EAAKiB,QAAUjB,EAAKJ,aAAab,IAAwD,SAAnCiB,EAAKJ,aAAaZ,IAC1G8C,EAAU9B,EAAM,IAgCc6D,CAAiB7D,KAInDA,EAAKgB,aAAa7B,EAAmB,QACrCa,EAAKgB,aAAajC,EAAkBf,IAGhC2B,GAAeK,IAASsB,KAC1B9C,EAAgBwB,IAzbtB,MA4bG,IAED,KAAK,GAAG,CAAC","file":"placeholders.min.js","sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n\"use strict\";\n\n/* eslint-disable */\n\n/*!\n * The MIT License\n *\n * Copyright (c) 2012 James Allardice\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\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell 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\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n(function (global) {\n 'use strict'; //\n // Test for support. We do this as early as possible to optimise for browsers\n // that have native support for the attribute.\n //\n\n var test = document.createElement('input');\n var nativeSupport = test.placeholder !== void 0;\n global.Placeholders = {\n nativeSupport: nativeSupport,\n disable: nativeSupport ? noop : disablePlaceholders,\n enable: nativeSupport ? noop : enablePlaceholders\n };\n\n if (nativeSupport) {\n return;\n } //\n // If we reach this point then the browser does not have native support for\n // the attribute.\n //\n // The list of input element types that support the placeholder attribute.\n\n\n var validTypes = ['text', 'search', 'url', 'tel', 'email', 'password', 'number', 'textarea']; // The list of keycodes that are not allowed when the polyfill is configured\n // to hide-on-input.\n\n var badKeys = [// The following keys all cause the caret to jump to the end of the input\n // value.\n 27, // Escape\n 33, // Page up\n 34, // Page down\n 35, // End\n 36, // Home\n // Arrow keys allow you to move the caret manually, which should be\n // prevented when the placeholder is visible.\n 37, // Left\n 38, // Up\n 39, // Right\n 40, // Down\n // The following keys allow you to modify the placeholder text by removing\n // characters, which should be prevented when the placeholder is visible.\n 8, // Backspace\n 46 // Delete\n ]; // Styling variables.\n\n var placeholderStyleColor = '#ccc';\n var placeholderClassName = 'placeholdersjs';\n var classNameRegExp = new RegExp('(?:^|\\\\s)' + placeholderClassName + '(?!\\\\S)'); // The various data-* attributes used by the polyfill.\n\n var ATTR_CURRENT_VAL = 'data-placeholder-value';\n var ATTR_ACTIVE = 'data-placeholder-active';\n var ATTR_INPUT_TYPE = 'data-placeholder-type';\n var ATTR_FORM_HANDLED = 'data-placeholder-submit';\n var ATTR_EVENTS_BOUND = 'data-placeholder-bound';\n var ATTR_OPTION_FOCUS = 'data-placeholder-focus';\n var ATTR_OPTION_LIVE = 'data-placeholder-live';\n var ATTR_MAXLENGTH = 'data-placeholder-maxlength'; // Various other variables used throughout the rest of the script.\n\n var UPDATE_INTERVAL = 100;\n var head = document.getElementsByTagName('head')[0];\n var root = document.documentElement;\n var Placeholders = global.Placeholders;\n var keydownVal; // Get references to all the input and textarea elements currently in the DOM\n // (live NodeList objects to we only need to do this once).\n\n var inputs = document.getElementsByTagName('input');\n var textareas = document.getElementsByTagName('textarea'); // Get any settings declared as data-* attributes on the root element.\n // Currently the only options are whether to hide the placeholder on focus\n // or input and whether to auto-update.\n\n var hideOnInput = root.getAttribute(ATTR_OPTION_FOCUS) === 'false';\n var liveUpdates = root.getAttribute(ATTR_OPTION_LIVE) !== 'false'; // Create style element for placeholder styles (instead of directly setting\n // style properties on elements - allows for better flexibility alongside\n // user-defined styles).\n\n var styleElem = document.createElement('style');\n styleElem.type = 'text/css'; // Create style rules as text node.\n\n var styleRules = document.createTextNode('.' + placeholderClassName + ' {' + 'color:' + placeholderStyleColor + ';' + '}'); // Append style rules to newly created stylesheet.\n\n if (styleElem.styleSheet) {\n styleElem.styleSheet.cssText = styleRules.nodeValue;\n } else {\n styleElem.appendChild(styleRules);\n } // Prepend new style element to the head (before any existing stylesheets,\n // so user-defined rules take precedence).\n\n\n head.insertBefore(styleElem, head.firstChild); // Set up the placeholders.\n\n var placeholder;\n var elem;\n\n for (var i = 0, len = inputs.length + textareas.length; i < len; i++) {\n // Find the next element. If we've already done all the inputs we move on\n // to the textareas.\n elem = i < inputs.length ? inputs[i] : textareas[i - inputs.length]; // Get the value of the placeholder attribute, if any. IE10 emulating IE7\n // fails with getAttribute, hence the use of the attributes node.\n\n placeholder = elem.attributes.placeholder; // If the element has a placeholder attribute we need to modify it.\n\n if (placeholder) {\n // IE returns an empty object instead of undefined if the attribute is\n // not present.\n placeholder = placeholder.nodeValue; // Only apply the polyfill if this element is of a type that supports\n // placeholders and has a placeholder attribute with a non-empty value.\n\n if (placeholder && inArray(validTypes, elem.type)) {\n newElement(elem);\n }\n }\n } // If enabled, the polyfill will repeatedly check for changed/added elements\n // and apply to those as well.\n\n\n var timer = setInterval(function () {\n for (var i = 0, len = inputs.length + textareas.length; i < len; i++) {\n elem = i < inputs.length ? inputs[i] : textareas[i - inputs.length]; // Only apply the polyfill if this element is of a type that supports\n // placeholders, and has a placeholder attribute with a non-empty value.\n\n placeholder = elem.attributes.placeholder;\n\n if (placeholder) {\n placeholder = placeholder.nodeValue;\n\n if (placeholder && inArray(validTypes, elem.type)) {\n // If the element hasn't had event handlers bound to it then add\n // them.\n if (!elem.getAttribute(ATTR_EVENTS_BOUND)) {\n newElement(elem);\n } // If the placeholder value has changed or not been initialised yet\n // we need to update the display.\n\n\n if (placeholder !== elem.getAttribute(ATTR_CURRENT_VAL) || elem.type === 'password' && !elem.getAttribute(ATTR_INPUT_TYPE)) {\n // Attempt to change the type of password inputs (fails in IE < 9).\n if (elem.type === 'password' && !elem.getAttribute(ATTR_INPUT_TYPE) && changeType(elem, 'text')) {\n elem.setAttribute(ATTR_INPUT_TYPE, 'password');\n } // If the placeholder value has changed and the placeholder is\n // currently on display we need to change it.\n\n\n if (elem.value === elem.getAttribute(ATTR_CURRENT_VAL)) {\n elem.value = placeholder;\n } // Keep a reference to the current placeholder value in case it\n // changes via another script.\n\n\n elem.setAttribute(ATTR_CURRENT_VAL, placeholder);\n }\n }\n } else if (elem.getAttribute(ATTR_ACTIVE)) {\n hidePlaceholder(elem);\n elem.removeAttribute(ATTR_CURRENT_VAL);\n }\n } // If live updates are not enabled cancel the timer.\n\n\n if (!liveUpdates) {\n clearInterval(timer);\n }\n }, UPDATE_INTERVAL); // Disabling placeholders before unloading the page prevents flash of\n // unstyled placeholders on load if the page was refreshed.\n\n addEventListener(global, 'beforeunload', function () {\n Placeholders.disable();\n }); //\n // Utility functions\n //\n // No-op (used in place of public methods when native support is detected).\n\n function noop() {} // Avoid IE9 activeElement of death when an iframe is used.\n //\n // More info:\n // - http://bugs.jquery.com/ticket/13393\n // - https://github.com/jquery/jquery/commit/85fc5878b3c6af73f42d61eedf73013e7faae408\n\n\n function safeActiveElement() {\n try {\n return document.activeElement;\n } catch (err) {}\n } // Check whether an item is in an array. We don't use Array.prototype.indexOf\n // so we don't clobber any existing polyfills. This is a really simple\n // alternative.\n\n\n function inArray(arr, item) {\n for (var i = 0, len = arr.length; i < len; i++) {\n if (arr[i] === item) {\n return true;\n }\n }\n\n return false;\n } // Cross-browser DOM event binding\n\n\n function addEventListener(elem, event, fn) {\n if (elem.addEventListener) {\n return elem.addEventListener(event, fn, false);\n }\n\n if (elem.attachEvent) {\n return elem.attachEvent('on' + event, fn);\n }\n } // Move the caret to the index position specified. Assumes that the element\n // has focus.\n\n\n function moveCaret(elem, index) {\n var range;\n\n if (elem.createTextRange) {\n range = elem.createTextRange();\n range.move('character', index);\n range.select();\n } else if (elem.selectionStart) {\n elem.focus();\n elem.setSelectionRange(index, index);\n }\n } // Attempt to change the type property of an input element.\n\n\n function changeType(elem, type) {\n try {\n elem.type = type;\n return true;\n } catch (e) {\n // You can't change input type in IE8 and below.\n return false;\n }\n }\n\n function handleElem(node, callback) {\n // Check if the passed in node is an input/textarea (in which case it can't\n // have any affected descendants).\n if (node && node.getAttribute(ATTR_CURRENT_VAL)) {\n callback(node);\n } else {\n // If an element was passed in, get all affected descendants. Otherwise,\n // get all affected elements in document.\n var handleInputs = node ? node.getElementsByTagName('input') : inputs;\n var handleTextareas = node ? node.getElementsByTagName('textarea') : textareas;\n var handleInputsLength = handleInputs ? handleInputs.length : 0;\n var handleTextareasLength = handleTextareas ? handleTextareas.length : 0; // Run the callback for each element.\n\n var len = handleInputsLength + handleTextareasLength;\n var elem;\n\n for (var i = 0; i < len; i++) {\n elem = i < handleInputsLength ? handleInputs[i] : handleTextareas[i - handleInputsLength];\n callback(elem);\n }\n }\n } // Return all affected elements to their normal state (remove placeholder\n // value if present).\n\n\n function disablePlaceholders(node) {\n handleElem(node, hidePlaceholder);\n } // Show the placeholder value on all appropriate elements.\n\n\n function enablePlaceholders(node) {\n handleElem(node, showPlaceholder);\n } // Hide the placeholder value on a single element. Returns true if the\n // placeholder was hidden and false if it was not (because it wasn't visible\n // in the first place).\n\n\n function hidePlaceholder(elem, keydownValue) {\n var valueChanged = !!keydownValue && elem.value !== keydownValue;\n var isPlaceholderValue = elem.value === elem.getAttribute(ATTR_CURRENT_VAL);\n\n if ((valueChanged || isPlaceholderValue) && elem.getAttribute(ATTR_ACTIVE) === 'true') {\n elem.removeAttribute(ATTR_ACTIVE);\n elem.value = elem.value.replace(elem.getAttribute(ATTR_CURRENT_VAL), '');\n elem.className = elem.className.replace(classNameRegExp, ''); // Restore the maxlength value. Old FF returns -1 if attribute not set.\n // See GH-56.\n\n var maxLength = elem.getAttribute(ATTR_MAXLENGTH);\n\n if (parseInt(maxLength, 10) >= 0) {\n elem.setAttribute('maxLength', maxLength);\n elem.removeAttribute(ATTR_MAXLENGTH);\n } // If the polyfill has changed the type of the element we need to change\n // it back.\n\n\n var type = elem.getAttribute(ATTR_INPUT_TYPE);\n\n if (type) {\n elem.type = type;\n }\n\n return true;\n }\n\n return false;\n } // Show the placeholder value on a single element. Returns true if the\n // placeholder was shown and false if it was not (because it was already\n // visible).\n\n\n function showPlaceholder(elem) {\n var val = elem.getAttribute(ATTR_CURRENT_VAL);\n\n if (elem.value === '' && val) {\n elem.setAttribute(ATTR_ACTIVE, 'true');\n elem.value = val;\n elem.className += ' ' + placeholderClassName; // Store and remove the maxlength value.\n\n var maxLength = elem.getAttribute(ATTR_MAXLENGTH);\n\n if (!maxLength) {\n elem.setAttribute(ATTR_MAXLENGTH, elem.maxLength);\n elem.removeAttribute('maxLength');\n } // If the type of element needs to change, change it (e.g. password\n // inputs).\n\n\n var type = elem.getAttribute(ATTR_INPUT_TYPE);\n\n if (type) {\n elem.type = 'text';\n } else if (elem.type === 'password' && changeType(elem, 'text')) {\n elem.setAttribute(ATTR_INPUT_TYPE, 'password');\n }\n\n return true;\n }\n\n return false;\n } // Returns a function that is used as a focus event handler.\n\n\n function makeFocusHandler(elem) {\n return function () {\n // Only hide the placeholder value if the (default) hide-on-focus\n // behaviour is enabled.\n if (hideOnInput && elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === 'true') {\n // Move the caret to the start of the input (this mimics the behaviour\n // of all browsers that do not hide the placeholder on focus).\n moveCaret(elem, 0);\n } else {\n // Remove the placeholder.\n hidePlaceholder(elem);\n }\n };\n } // Returns a function that is used as a blur event handler.\n\n\n function makeBlurHandler(elem) {\n return function () {\n showPlaceholder(elem);\n };\n } // Returns a function that is used as a submit event handler on form elements\n // that have children affected by this polyfill.\n\n\n function makeSubmitHandler(form) {\n return function () {\n // Turn off placeholders on all appropriate descendant elements.\n disablePlaceholders(form);\n };\n } // Functions that are used as a event handlers when the hide-on-input\n // behaviour has been activated - very basic implementation of the 'input'\n // event.\n\n\n function makeKeydownHandler(elem) {\n return function (e) {\n keydownVal = elem.value; // Prevent the use of the arrow keys (try to keep the cursor before the\n // placeholder).\n\n if (elem.getAttribute(ATTR_ACTIVE) === 'true' && keydownVal === elem.getAttribute(ATTR_CURRENT_VAL) && inArray(badKeys, e.keyCode)) {\n if (e.preventDefault) {\n e.preventDefault();\n }\n\n return false;\n }\n };\n }\n\n function makeKeyupHandler(elem) {\n return function () {\n hidePlaceholder(elem, keydownVal); // If the element is now empty we need to show the placeholder\n\n if (elem.value === '') {\n elem.blur();\n moveCaret(elem, 0);\n }\n };\n }\n\n function makeClickHandler(elem) {\n return function () {\n if (elem === safeActiveElement() && elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === 'true') {\n moveCaret(elem, 0);\n }\n };\n } // Bind event handlers to an element that we need to affect with the\n // polyfill.\n\n\n function newElement(elem) {\n // If the element is part of a form, make sure the placeholder string is\n // not submitted as a value.\n var form = elem.form;\n\n if (form && typeof form === 'string') {\n // Get the real form.\n form = document.getElementById(form); // Set a flag on the form so we know it's been handled (forms can contain\n // multiple inputs).\n\n if (!form.getAttribute(ATTR_FORM_HANDLED)) {\n addEventListener(form, 'submit', makeSubmitHandler(form));\n form.setAttribute(ATTR_FORM_HANDLED, 'true');\n }\n } // Bind event handlers to the element so we can hide/show the placeholder\n // as appropriate.\n\n\n addEventListener(elem, 'focus', makeFocusHandler(elem));\n addEventListener(elem, 'blur', makeBlurHandler(elem)); // If the placeholder should hide on input rather than on focus we need\n // additional event handlers\n\n if (hideOnInput) {\n addEventListener(elem, 'keydown', makeKeydownHandler(elem));\n addEventListener(elem, 'keyup', makeKeyupHandler(elem));\n addEventListener(elem, 'click', makeClickHandler(elem));\n } // Remember that we've bound event handlers to this element.\n\n\n elem.setAttribute(ATTR_EVENTS_BOUND, 'true');\n elem.setAttribute(ATTR_CURRENT_VAL, placeholder); // If the element doesn't have a value and is not focussed, set it to the\n // placeholder string.\n\n if (hideOnInput || elem !== safeActiveElement()) {\n showPlaceholder(elem);\n }\n }\n})(void 0);\n\n},{}]},{},[1]);\n"]}
includes/admin/class-admin.php CHANGED
@@ -279,11 +279,11 @@ class MC4WP_Admin {
279
  $mailchimp = new MC4WP_MailChimp();
280
 
281
  // css
282
- wp_register_style( 'mc4wp-admin', MC4WP_PLUGIN_URL . 'assets/css/admin-styles' . $suffix . '.css', array(), MC4WP_VERSION );
283
  wp_enqueue_style( 'mc4wp-admin' );
284
 
285
  // js
286
- wp_register_script( 'mc4wp-admin', MC4WP_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array(), MC4WP_VERSION, true );
287
  wp_enqueue_script( 'mc4wp-admin' );
288
  $connected = ! empty( $opts['api_key'] );
289
  $mailchimp_lists = $connected ? $mailchimp->get_lists() : array();
279
  $mailchimp = new MC4WP_MailChimp();
280
 
281
  // css
282
+ wp_register_style( 'mc4wp-admin', mc4wp_plugin_url( 'assets/css/admin-styles' . $suffix . '.css' ), array(), MC4WP_VERSION );
283
  wp_enqueue_style( 'mc4wp-admin' );
284
 
285
  // js
286
+ wp_register_script( 'mc4wp-admin', mc4wp_plugin_url( 'assets/js/admin' . $suffix . '.js' ), array(), MC4WP_VERSION, true );
287
  wp_enqueue_script( 'mc4wp-admin' );
288
  $connected = ! empty( $opts['api_key'] );
289
  $mailchimp_lists = $connected ? $mailchimp->get_lists() : array();
includes/api/class-api-v3.php CHANGED
@@ -225,9 +225,7 @@ class MC4WP_API_V3 {
225
  $args['interests'] = (object) $args['interests'];
226
  }
227
 
228
- // "put" updates the member if it's already on the list... take notice
229
- $data = $this->client->post( $resource, $args );
230
- return $data;
231
  }
232
 
233
  /**
@@ -260,8 +258,7 @@ class MC4WP_API_V3 {
260
  }
261
 
262
  // "put" updates the member if it's already on the list... take notice
263
- $data = $this->client->put( $resource, $args );
264
- return $data;
265
  }
266
 
267
  /**
@@ -287,8 +284,7 @@ class MC4WP_API_V3 {
287
  $args['interests'] = (object) $args['interests'];
288
  }
289
 
290
- $data = $this->client->patch( $resource, $args );
291
- return $data;
292
  }
293
 
294
  /**
225
  $args['interests'] = (object) $args['interests'];
226
  }
227
 
228
+ return $this->client->post( $resource, $args );
 
 
229
  }
230
 
231
  /**
258
  }
259
 
260
  // "put" updates the member if it's already on the list... take notice
261
+ return $this->client->put( $resource, $args );
 
262
  }
263
 
264
  /**
284
  $args['interests'] = (object) $args['interests'];
285
  }
286
 
287
+ return $this->client->patch( $resource, $args );
 
288
  }
289
 
290
  /**
includes/class-mailchimp-subscriber.php CHANGED
@@ -63,8 +63,13 @@ class MC4WP_MailChimp_Subscriber {
63
  $array = array();
64
 
65
  foreach ( $all as $key => $value ) {
66
- // skip null values and empty arrays
67
- if ( $value === null || $value === array() ) {
 
 
 
 
 
68
  continue;
69
  }
70
 
63
  $array = array();
64
 
65
  foreach ( $all as $key => $value ) {
66
+ // skip null values
67
+ if ( $value === null ) {
68
+ continue;
69
+ }
70
+
71
+ // skip empty marketing_permissions property
72
+ if ( $key === 'marketing_permissions' && empty( $value ) ) {
73
  continue;
74
  }
75
 
includes/class-mailchimp.php CHANGED
@@ -94,7 +94,10 @@ class MC4WP_MailChimp {
94
  if ( $existing_member_data ) {
95
  $data = $api->update_list_member( $list_id, $email_address, $args );
96
  $data->was_already_on_list = $existing_member_data->status === 'subscribed';
97
- $this->list_add_tags_to_subscriber( $list_id, $data, $args['tags'] );
 
 
 
98
  } else {
99
  $data = $api->add_new_list_member( $list_id, $args );
100
  $data->was_already_on_list = false;
94
  if ( $existing_member_data ) {
95
  $data = $api->update_list_member( $list_id, $email_address, $args );
96
  $data->was_already_on_list = $existing_member_data->status === 'subscribed';
97
+
98
+ if ( isset( $args['tags'] ) && is_array( $args['tags'] ) ) {
99
+ $this->list_add_tags_to_subscriber( $list_id, $data, $args['tags'] );
100
+ }
101
  } else {
102
  $data = $api->add_new_list_member( $list_id, $args );
103
  $data->was_already_on_list = false;
includes/forms/class-admin.php CHANGED
@@ -39,7 +39,7 @@ class MC4WP_Forms_Admin {
39
 
40
 
41
  public function enqueue_gutenberg_assets() {
42
- wp_enqueue_script( 'mc4wp-form-block', MC4WP_PLUGIN_URL . 'assets/js/forms-block.js', array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components' ) );
43
 
44
  $forms = mc4wp_get_forms();
45
  $data = array();
@@ -61,7 +61,7 @@ class MC4WP_Forms_Admin {
61
  return;
62
  }
63
 
64
- wp_register_script( 'mc4wp-forms-admin', MC4WP_PLUGIN_URL . 'assets/js/forms-admin' . $suffix . '.js', array( 'mc4wp-admin' ), MC4WP_VERSION, true );
65
  wp_enqueue_script( 'mc4wp-forms-admin' );
66
  wp_localize_script(
67
  'mc4wp-forms-admin',
39
 
40
 
41
  public function enqueue_gutenberg_assets() {
42
+ wp_enqueue_script( 'mc4wp-form-block', mc4wp_plugin_url( 'assets/js/forms-block.js' ), array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components' ) );
43
 
44
  $forms = mc4wp_get_forms();
45
  $data = array();
61
  return;
62
  }
63
 
64
+ wp_register_script( 'mc4wp-forms-admin', mc4wp_plugin_url( 'assets/js/forms-admin' . $suffix . '.js' ), array( 'mc4wp-admin' ), MC4WP_VERSION, true );
65
  wp_enqueue_script( 'mc4wp-forms-admin' );
66
  wp_localize_script(
67
  'mc4wp-forms-admin',
includes/forms/class-asset-manager.php CHANGED
@@ -28,7 +28,7 @@ class MC4WP_Form_Asset_Manager {
28
  */
29
  public function register_scripts() {
30
  $filename_suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
31
- wp_register_script( 'mc4wp-forms-api', MC4WP_PLUGIN_URL . 'assets/js/forms' . $filename_suffix . '.js', array(), MC4WP_VERSION, true );
32
  }
33
 
34
  /**
@@ -61,7 +61,7 @@ class MC4WP_Form_Asset_Manager {
61
  return '';
62
  }
63
 
64
- return MC4WP_PLUGIN_URL . 'assets/css/form-' . $stylesheet . '.min.css';
65
  }
66
 
67
  /**
@@ -184,7 +184,7 @@ class MC4WP_Form_Asset_Manager {
184
  $submitted_form_data = $this->get_submitted_form_data();
185
  if ( $submitted_form_data !== null ) {
186
  $filename_suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
187
- wp_enqueue_script( 'mc4wp-forms-submitted', MC4WP_PLUGIN_URL . 'assets/js/forms-submitted' . $filename_suffix . '.js', array( 'mc4wp-forms-api' ), MC4WP_VERSION, true );
188
  wp_localize_script( 'mc4wp-forms-submitted', 'mc4wp_submitted_form', $submitted_form_data );
189
  }
190
 
28
  */
29
  public function register_scripts() {
30
  $filename_suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
31
+ wp_register_script( 'mc4wp-forms-api', mc4wp_plugin_url( 'assets/js/forms' . $filename_suffix . '.js' ), array(), MC4WP_VERSION, true );
32
  }
33
 
34
  /**
61
  return '';
62
  }
63
 
64
+ return mc4wp_plugin_url( 'assets/css/form-' . $stylesheet . '.min.css' );
65
  }
66
 
67
  /**
184
  $submitted_form_data = $this->get_submitted_form_data();
185
  if ( $submitted_form_data !== null ) {
186
  $filename_suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
187
+ wp_enqueue_script( 'mc4wp-forms-submitted', mc4wp_plugin_url( 'assets/js/forms-submitted' . $filename_suffix . '.js' ), array( 'mc4wp-forms-api' ), MC4WP_VERSION, true );
188
  wp_localize_script( 'mc4wp-forms-submitted', 'mc4wp_submitted_form', $submitted_form_data );
189
  }
190
 
includes/functions.php CHANGED
@@ -164,6 +164,22 @@ function mc4wp_get_debug_log() {
164
  return new MC4WP_Debug_Log( $file, $level );
165
  }
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
 
168
  /**
169
  * Get current URL (full)
164
  return new MC4WP_Debug_Log( $file, $level );
165
  }
166
 
167
+ /**
168
+ * Get URL to a file inside the plugin directory
169
+ *
170
+ * @since 4.8.3
171
+ * @param string $path
172
+ * @return string
173
+ */
174
+ function mc4wp_plugin_url( $path ) {
175
+ static $base = null;
176
+ if ( $base === null ) {
177
+ $base = plugins_url( '/', MC4WP_PLUGIN_FILE );
178
+ }
179
+
180
+ return $base . $path;
181
+ }
182
+
183
 
184
  /**
185
  * Get current URL (full)
includes/integrations/class-admin.php CHANGED
@@ -59,7 +59,7 @@ class MC4WP_Integration_Admin {
59
  return;
60
  }
61
 
62
- wp_register_script( 'mc4wp-integrations-admin', MC4WP_PLUGIN_URL . 'assets/js/integrations-admin' . $suffix . '.js', array( 'mc4wp-admin' ), MC4WP_VERSION, true );
63
  wp_enqueue_script( 'mc4wp-integrations-admin' );
64
  }
65
 
59
  return;
60
  }
61
 
62
+ wp_register_script( 'mc4wp-integrations-admin', mc4wp_plugin_url( 'assets/js/integrations-admin' . $suffix . '.js' ), array( 'mc4wp-admin' ), MC4WP_VERSION, true );
63
  wp_enqueue_script( 'mc4wp-integrations-admin' );
64
  }
65
 
languages/mailchimp-for-wp.pot CHANGED
@@ -53,7 +53,7 @@ msgstr ""
53
  msgid "Property of the current page or post."
54
  msgstr ""
55
 
56
- #: includes/class-mailchimp.php:248, includes/forms/class-admin.php:82
57
  msgid "Email address"
58
  msgstr ""
59
 
53
  msgid "Property of the current page or post."
54
  msgstr ""
55
 
56
+ #: includes/class-mailchimp.php:251, includes/forms/class-admin.php:82
57
  msgid "Email address"
58
  msgstr ""
59
 
mailchimp-for-wp.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: MC4WP: Mailchimp for WordPress
4
  Plugin URI: https://www.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: 4.8.2
7
  Author: ibericode
8
  Author URI: https://ibericode.com/
9
  Text Domain: mailchimp-for-wp
@@ -45,9 +45,8 @@ function _mc4wp_load_plugin() {
45
  }
46
 
47
  // bootstrap the core plugin
48
- define( 'MC4WP_VERSION', '4.8.2' );
49
  define( 'MC4WP_PLUGIN_DIR', __DIR__ . '/' );
50
- define( 'MC4WP_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
51
  define( 'MC4WP_PLUGIN_FILE', __FILE__ );
52
 
53
  // load autoloader if function not yet exists (for compat with sitewide autoloader)
@@ -104,8 +103,6 @@ function _mc4wp_load_plugin() {
104
  $integrations_admin->add_hooks();
105
  }
106
  }
107
-
108
- return;
109
  }
110
 
111
  // bootstrap custom integrations
3
  Plugin Name: MC4WP: Mailchimp for WordPress
4
  Plugin URI: https://www.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: 4.8.3
7
  Author: ibericode
8
  Author URI: https://ibericode.com/
9
  Text Domain: mailchimp-for-wp
45
  }
46
 
47
  // bootstrap the core plugin
48
+ define( 'MC4WP_VERSION', '4.8.3' );
49
  define( 'MC4WP_PLUGIN_DIR', __DIR__ . '/' );
 
50
  define( 'MC4WP_PLUGIN_FILE', __FILE__ );
51
 
52
  // load autoloader if function not yet exists (for compat with sitewide autoloader)
103
  $integrations_admin->add_hooks();
104
  }
105
  }
 
 
106
  }
107
 
108
  // bootstrap custom integrations
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Ibericode, DvanKooten, hchouhan, lapzor
3
  Donate link: https://www.mc4wp.com/#utm_source=wp-plugin-repo&utm_medium=mailchimp-for-wp&utm_campaign=donate-link
4
  Tags: mailchimp, mc4wp, email, marketing, newsletter, subscribe, widget, mc4wp, contact form 7, woocommerce, buddypress, ibericode, mailchimp form
5
  Requires at least: 4.6
6
- Tested up to: 5.6
7
- Stable tag: 4.8.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Requires PHP: 5.3
@@ -197,6 +197,12 @@ The plugin provides various filter & action hooks that allow you to modify or ex
197
  == Changelog ==
198
 
199
 
 
 
 
 
 
 
200
  #### 4.8.2 - Jan 20, 2021
201
 
202
  - Allow short-circuiting `mc4wp_subscriber_data` filter by returning `null` or `false`.
3
  Donate link: https://www.mc4wp.com/#utm_source=wp-plugin-repo&utm_medium=mailchimp-for-wp&utm_campaign=donate-link
4
  Tags: mailchimp, mc4wp, email, marketing, newsletter, subscribe, widget, mc4wp, contact form 7, woocommerce, buddypress, ibericode, mailchimp form
5
  Requires at least: 4.6
6
+ Tested up to: 5.7
7
+ Stable tag: 4.8.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Requires PHP: 5.3
197
  == Changelog ==
198
 
199
 
200
+ #### 4.8.3 - Jan 21, 2021
201
+
202
+ - Fix fatal error on older PHP versions when submitting form without any subscriber tags set in the form settings.
203
+ - Minor performance improvement in bootstrap method of the plugin.
204
+
205
+
206
  #### 4.8.2 - Jan 20, 2021
207
 
208
  - Allow short-circuiting `mc4wp_subscriber_data` filter by returning `null` or `false`.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInita7bfb7a5e96ac797c6517d5437b66b29::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit855bf574869f9221186f94087fb3b7d3::getLoader();
vendor/composer/InstalledVersions.php CHANGED
@@ -29,7 +29,7 @@ private static $installed = array (
29
  'aliases' =>
30
  array (
31
  ),
32
- 'reference' => '2f6c990da7eadd65e34b9329c460007784b9648b',
33
  'name' => 'ibericode/mailchimp-for-wordpress',
34
  ),
35
  'versions' =>
@@ -41,7 +41,7 @@ private static $installed = array (
41
  'aliases' =>
42
  array (
43
  ),
44
- 'reference' => '2f6c990da7eadd65e34b9329c460007784b9648b',
45
  ),
46
  ),
47
  );
29
  'aliases' =>
30
  array (
31
  ),
32
+ 'reference' => '64f936eb6a27ec15812ea8175b24bcfafec7907b',
33
  'name' => 'ibericode/mailchimp-for-wordpress',
34
  ),
35
  'versions' =>
41
  'aliases' =>
42
  array (
43
  ),
44
+ 'reference' => '64f936eb6a27ec15812ea8175b24bcfafec7907b',
45
  ),
46
  ),
47
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInita7bfb7a5e96ac797c6517d5437b66b29
6
  {
7
  private static $loader;
8
 
@@ -24,15 +24,15 @@ class ComposerAutoloaderInita7bfb7a5e96ac797c6517d5437b66b29
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
- spl_autoload_register(array('ComposerAutoloaderInita7bfb7a5e96ac797c6517d5437b66b29', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
29
- spl_autoload_unregister(array('ComposerAutoloaderInita7bfb7a5e96ac797c6517d5437b66b29', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
  require __DIR__ . '/autoload_static.php';
34
 
35
- call_user_func(\Composer\Autoload\ComposerStaticInita7bfb7a5e96ac797c6517d5437b66b29::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
@@ -53,19 +53,19 @@ class ComposerAutoloaderInita7bfb7a5e96ac797c6517d5437b66b29
53
  $loader->register(true);
54
 
55
  if ($useStaticLoader) {
56
- $includeFiles = Composer\Autoload\ComposerStaticInita7bfb7a5e96ac797c6517d5437b66b29::$files;
57
  } else {
58
  $includeFiles = require __DIR__ . '/autoload_files.php';
59
  }
60
  foreach ($includeFiles as $fileIdentifier => $file) {
61
- composerRequirea7bfb7a5e96ac797c6517d5437b66b29($fileIdentifier, $file);
62
  }
63
 
64
  return $loader;
65
  }
66
  }
67
 
68
- function composerRequirea7bfb7a5e96ac797c6517d5437b66b29($fileIdentifier, $file)
69
  {
70
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
71
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit855bf574869f9221186f94087fb3b7d3
6
  {
7
  private static $loader;
8
 
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
+ spl_autoload_register(array('ComposerAutoloaderInit855bf574869f9221186f94087fb3b7d3', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
29
+ spl_autoload_unregister(array('ComposerAutoloaderInit855bf574869f9221186f94087fb3b7d3', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
  require __DIR__ . '/autoload_static.php';
34
 
35
+ call_user_func(\Composer\Autoload\ComposerStaticInit855bf574869f9221186f94087fb3b7d3::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
53
  $loader->register(true);
54
 
55
  if ($useStaticLoader) {
56
+ $includeFiles = Composer\Autoload\ComposerStaticInit855bf574869f9221186f94087fb3b7d3::$files;
57
  } else {
58
  $includeFiles = require __DIR__ . '/autoload_files.php';
59
  }
60
  foreach ($includeFiles as $fileIdentifier => $file) {
61
+ composerRequire855bf574869f9221186f94087fb3b7d3($fileIdentifier, $file);
62
  }
63
 
64
  return $loader;
65
  }
66
  }
67
 
68
+ function composerRequire855bf574869f9221186f94087fb3b7d3($fileIdentifier, $file)
69
  {
70
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
71
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInita7bfb7a5e96ac797c6517d5437b66b29
8
  {
9
  public static $files = array (
10
  'fca581ae5268210490253d58378748c5' => __DIR__ . '/../..' . '/includes/functions.php',
@@ -88,7 +88,7 @@ class ComposerStaticInita7bfb7a5e96ac797c6517d5437b66b29
88
  public static function getInitializer(ClassLoader $loader)
89
  {
90
  return \Closure::bind(function () use ($loader) {
91
- $loader->classMap = ComposerStaticInita7bfb7a5e96ac797c6517d5437b66b29::$classMap;
92
 
93
  }, null, ClassLoader::class);
94
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit855bf574869f9221186f94087fb3b7d3
8
  {
9
  public static $files = array (
10
  'fca581ae5268210490253d58378748c5' => __DIR__ . '/../..' . '/includes/functions.php',
88
  public static function getInitializer(ClassLoader $loader)
89
  {
90
  return \Closure::bind(function () use ($loader) {
91
+ $loader->classMap = ComposerStaticInit855bf574869f9221186f94087fb3b7d3::$classMap;
92
 
93
  }, null, ClassLoader::class);
94
  }
vendor/composer/installed.php CHANGED
@@ -6,7 +6,7 @@
6
  'aliases' =>
7
  array (
8
  ),
9
- 'reference' => '2f6c990da7eadd65e34b9329c460007784b9648b',
10
  'name' => 'ibericode/mailchimp-for-wordpress',
11
  ),
12
  'versions' =>
@@ -18,7 +18,7 @@
18
  'aliases' =>
19
  array (
20
  ),
21
- 'reference' => '2f6c990da7eadd65e34b9329c460007784b9648b',
22
  ),
23
  ),
24
  );
6
  'aliases' =>
7
  array (
8
  ),
9
+ 'reference' => '64f936eb6a27ec15812ea8175b24bcfafec7907b',
10
  'name' => 'ibericode/mailchimp-for-wordpress',
11
  ),
12
  'versions' =>
18
  'aliases' =>
19
  array (
20
  ),
21
+ 'reference' => '64f936eb6a27ec15812ea8175b24bcfafec7907b',
22
  ),
23
  ),
24
  );