Boxzilla - Version 3.1.7

Version Description

Download this release

Release Info

Developer DvanKooten
Plugin Icon 128x128 Boxzilla
Version 3.1.7
Comparing to
See all releases

Code changes from version 3.1.6 to 3.1.7

Files changed (97) hide show
  1. assets/browserify/script.js +4 -2
  2. assets/css/admin-styles.css +4 -0
  3. assets/css/admin-styles.min.css +1 -1
  4. assets/js/admin-script.min.js +1 -1
  5. assets/js/admin-script.min.js.map +1 -1
  6. assets/js/script.js +7 -3
  7. assets/js/script.min.js +1 -1
  8. assets/js/script.min.js.map +1 -1
  9. assets/scss/admin-styles.scss +4 -0
  10. bootstrap.php +2 -0
  11. boxzilla.php +2 -2
  12. languages/boxzilla.pot +27 -14
  13. readme.txt +13 -5
  14. src/admin/class-admin.php +32 -0
  15. src/admin/class-migrations.php +11 -2
  16. src/admin/class-review-notice.php +96 -0
  17. src/admin/migrations/{4.0.0-cookie-option.php → 3.1-cookie-option.php} +0 -0
  18. trunk/LICENSE +339 -0
  19. trunk/assets/browserify/admin-script.js +1 -0
  20. trunk/assets/browserify/admin/_admin.js +123 -0
  21. trunk/assets/browserify/admin/_designer.js +109 -0
  22. trunk/assets/browserify/admin/_option.js +56 -0
  23. trunk/assets/browserify/script.js +93 -0
  24. trunk/assets/css/admin-styles.css +127 -0
  25. trunk/assets/css/admin-styles.min.css +1 -0
  26. trunk/assets/css/index.php +7 -0
  27. trunk/assets/img/index.php +6 -0
  28. trunk/assets/img/menu-icon.jpg +0 -0
  29. trunk/assets/img/menu-icon.png +0 -0
  30. trunk/assets/index.php +6 -0
  31. trunk/assets/js/admin-script.js +785 -0
  32. trunk/assets/js/admin-script.min.js +2 -0
  33. trunk/assets/js/admin-script.min.js.map +1 -0
  34. trunk/assets/js/index.php +6 -0
  35. trunk/assets/js/script.js +1458 -0
  36. trunk/assets/js/script.min.js +2 -0
  37. trunk/assets/js/script.min.js.map +1 -0
  38. trunk/assets/scss/admin-styles.scss +173 -0
  39. trunk/bootstrap.php +51 -0
  40. trunk/boxzilla.php +68 -0
  41. trunk/languages/boxzilla-es_ES.mo +0 -0
  42. trunk/languages/boxzilla-es_ES.po +212 -0
  43. trunk/languages/boxzilla-fr_FR.mo +0 -0
  44. trunk/languages/boxzilla-fr_FR.po +211 -0
  45. trunk/languages/boxzilla-nl_NL.mo +0 -0
  46. trunk/languages/boxzilla-nl_NL.po +209 -0
  47. trunk/languages/boxzilla.pot +407 -0
  48. trunk/readme.txt +286 -0
  49. trunk/src/admin/class-admin.php +764 -0
  50. trunk/src/admin/class-autocomplete.php +95 -0
  51. trunk/src/admin/class-installer.php +93 -0
  52. trunk/src/admin/class-migrations.php +96 -0
  53. trunk/src/admin/class-notices.php +42 -0
  54. trunk/src/admin/class-review-notice.php +96 -0
  55. trunk/src/admin/migrations/3.1-cookie-option.php +24 -0
  56. trunk/src/admin/views/extensions.php +60 -0
  57. trunk/src/admin/views/metaboxes/box-appearance-controls.php +46 -0
  58. trunk/src/admin/views/metaboxes/box-option-controls.php +218 -0
  59. trunk/src/admin/views/metaboxes/email-optin.php +23 -0
  60. trunk/src/admin/views/metaboxes/need-help.php +8 -0
  61. trunk/src/admin/views/settings.php +56 -0
  62. trunk/src/class-bootstrapper.php +103 -0
  63. trunk/src/class-box.php +231 -0
  64. trunk/src/class-boxzilla-service-provider.php +69 -0
  65. trunk/src/class-boxzilla.php +20 -0
  66. trunk/src/class-collection.php +154 -0
  67. trunk/src/class-loader.php +299 -0
  68. trunk/src/class-php-fallback.php +62 -0
  69. trunk/src/class-plugin.php +109 -0
  70. trunk/src/default-actions.php +33 -0
  71. trunk/src/default-filters.php +10 -0
  72. trunk/src/di/class-container-with-property-access.php +54 -0
  73. trunk/src/di/class-container.php +281 -0
  74. trunk/src/di/interface-service-provider.php +46 -0
  75. trunk/src/functions.php +17 -0
  76. trunk/src/licensing/class-api-exception.php +33 -0
  77. trunk/src/licensing/class-api.php +174 -0
  78. trunk/src/licensing/class-license-manager.php +166 -0
  79. trunk/src/licensing/class-license-service-provider.php +39 -0
  80. trunk/src/licensing/class-license.php +114 -0
  81. trunk/src/licensing/class-poller.php +67 -0
  82. trunk/src/licensing/class-update-manager.php +226 -0
  83. trunk/src/licensing/views/license-form.php +57 -0
  84. trunk/vendor/autoload.php +7 -0
  85. trunk/vendor/composer/ClassLoader.php +415 -0
  86. trunk/vendor/composer/LICENSE +21 -0
  87. trunk/vendor/composer/autoload_classmap.php +33 -0
  88. trunk/vendor/composer/autoload_files.php +10 -0
  89. trunk/vendor/composer/autoload_namespaces.php +9 -0
  90. trunk/vendor/composer/autoload_psr4.php +9 -0
  91. trunk/vendor/composer/autoload_real.php +70 -0
  92. trunk/vendor/composer/autoload_static.php +47 -0
  93. trunk/vendor/composer/installed.json +1 -0
  94. vendor/composer/ClassLoader.php +7 -5
  95. vendor/composer/autoload_classmap.php +1 -0
  96. vendor/composer/autoload_real.php +23 -12
  97. vendor/composer/autoload_static.php +47 -0
assets/browserify/script.js CHANGED
@@ -19,8 +19,10 @@ for( var i=0; i < options.boxes.length; i++ ) {
19
  boxOpts.testMode = isLoggedIn && options.testMode;
20
 
21
  // fix http:// links in box content....
22
- if( window.location.origin.substring(0, 5) === "https" ) {
23
- boxOpts.content = boxOpts.content.replace(window.location.origin.replace("https", "http"), window.location.origin);
 
 
24
  }
25
 
26
  // create box
19
  boxOpts.testMode = isLoggedIn && options.testMode;
20
 
21
  // fix http:// links in box content....
22
+ if( window.location.protocol === "https:" && window.location.host ) {
23
+ var o = "http://" + window.location.host;
24
+ var n = old.replace('http://', 'https://');
25
+ boxOpts.content = boxOpts.content.replace(o, n);
26
  }
27
 
28
  // create box
assets/css/admin-styles.css CHANGED
@@ -68,6 +68,10 @@
68
  #boxzilla-admin .status.negative {
69
  background: #c3c3c3; }
70
 
 
 
 
 
71
  /* Radio Switches */
72
  .radio-label {
73
  font-weight: normal; }
68
  #boxzilla-admin .status.negative {
69
  background: #c3c3c3; }
70
 
71
+ .boxzilla-is-dismissible {
72
+ padding-right: 38px;
73
+ position: relative; }
74
+
75
  /* Radio Switches */
76
  .radio-label {
77
  font-weight: normal; }
assets/css/admin-styles.min.css CHANGED
@@ -1 +1 @@
1
- .boxzilla-rule-row-0 .boxzilla-close{visibility:hidden}.column-box_id{width:80px}.boxzilla-sm{width:150px}.boxzilla-xsm{width:15px}.boxzilla-title{margin-top:2em!important}.boxzilla-label{display:block;font-weight:700;margin-bottom:6px}.boxzilla-close{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none;font-size:21px;font-weight:700;line-height:26px;text-shadow:0 1px 0 #fff;opacity:.3;filter:alpha(opacity=30)}.boxzilla-close:focus,.boxzilla-close:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.6;filter:alpha(opacity=60)}.post-type-boxzilla-box .form-table{table-layout:fixed}.post-type-boxzilla-box .window-positions{border:1px solid #EEE}.post-type-boxzilla-box .window-positions td{padding:3px;margin-bottom:0}.post-type-boxzilla-box .wp-picker-container{white-space:nowrap}.post-type-boxzilla-box .wp-picker-clear,.post-type-boxzilla-box .wp-picker-holder,.post-type-boxzilla-box .wp-picker-input-wrap{background:#fff;z-index:999!important;position:absolute!important}#boxzilla-admin .status{display:inline-block;padding:3px 6px;color:#fff;text-transform:uppercase;font-weight:700}#boxzilla-admin .status.positive{background-color:#32cd32}#boxzilla-admin .status.negative{background:#c3c3c3}.radio-label{font-weight:400}.radio-label>input{margin-top:0!important}.boxzilla-row{margin:0 -20px}.boxzilla-col-one-third,.boxzilla-col-two-third{float:left;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 20px}.boxzilla-col-two-third{width:66.66%}.boxzilla-col-one-third{width:33.33%}.boxzilla-sidebar{margin-top:10px}.boxzilla-box{background:#fff;padding:20px;margin-bottom:20px;border:1px solid #ccc}.boxzilla-box :first-child,.boxzilla-box h3{margin-top:0}.boxzilla-box :last-child{margin-bottom:0}.boxzilla-sidebar form label{display:block;font-weight:700;margin-bottom:6px}@media (max-width:920px){.boxzilla-row{margin:0}.boxzilla-col-one-third,.boxzilla-col-two-third{float:none;padding:0;width:auto}.boxzilla-sidebar{margin-top:40px}}
1
+ .boxzilla-rule-row-0 .boxzilla-close{visibility:hidden}.column-box_id{width:80px}.boxzilla-sm{width:150px}.boxzilla-xsm{width:15px}.boxzilla-title{margin-top:2em!important}.boxzilla-label{display:block;font-weight:700;margin-bottom:6px}.boxzilla-close{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none;font-size:21px;font-weight:700;line-height:26px;text-shadow:0 1px 0 #fff;opacity:.3;filter:alpha(opacity=30)}.boxzilla-close:focus,.boxzilla-close:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.6;filter:alpha(opacity=60)}.post-type-boxzilla-box .form-table{table-layout:fixed}.post-type-boxzilla-box .window-positions{border:1px solid #EEE}.post-type-boxzilla-box .window-positions td{padding:3px;margin-bottom:0}.post-type-boxzilla-box .wp-picker-container{white-space:nowrap}.post-type-boxzilla-box .wp-picker-clear,.post-type-boxzilla-box .wp-picker-holder,.post-type-boxzilla-box .wp-picker-input-wrap{background:#fff;z-index:999!important;position:absolute!important}#boxzilla-admin .status{display:inline-block;padding:3px 6px;color:#fff;text-transform:uppercase;font-weight:700}#boxzilla-admin .status.positive{background-color:#32cd32}#boxzilla-admin .status.negative{background:#c3c3c3}.boxzilla-is-dismissible{padding-right:38px;position:relative}.radio-label{font-weight:400}.radio-label>input{margin-top:0!important}.boxzilla-row{margin:0 -20px}.boxzilla-col-one-third,.boxzilla-col-two-third{float:left;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 20px}.boxzilla-col-two-third{width:66.66%}.boxzilla-col-one-third{width:33.33%}.boxzilla-sidebar{margin-top:10px}.boxzilla-box{background:#fff;padding:20px;margin-bottom:20px;border:1px solid #ccc}.boxzilla-box :first-child,.boxzilla-box h3{margin-top:0}.boxzilla-box :last-child{margin-bottom:0}.boxzilla-sidebar form label{display:block;font-weight:700;margin-bottom:6px}@media (max-width:920px){.boxzilla-row{margin:0}.boxzilla-col-one-third,.boxzilla-col-two-third{float:none;padding:0;width:auto}.boxzilla-sidebar{margin-top:40px}}
assets/js/admin-script.min.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};!function(){var e=void 0,t=void 0;!function n(t,o,r){function i(s,a){if(!o[s]){if(!t[s]){var u="function"==typeof e&&e;if(!a&&u)return u(s,!0);if(l)return l(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var p=o[s]={exports:{}};t[s][0].call(p.exports,function(e){var n=t[s][1][e];return i(n?n:e)},p,p.exports,n,t,o,r)}return o[s].exports}for(var l="function"==typeof e&&e,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){window.Boxzilla_Admin=e("./admin/_admin.js")},{"./admin/_admin.js":2}],2:[function(e,t,n){function o(){c.find(".boxzilla-trigger-options").toggle(""!==this.value)}function r(){s(this).parents("tr").remove()}function i(){var e="tr"===this.tagName.toLowerCase()?this:s(this).parents("tr").get(0),t=e.querySelector(".boxzilla-rule-condition").value,n=e.querySelector(".boxzilla-rule-value"),o=e.querySelector(".boxzilla-rule-qualifier"),r=n.cloneNode(!0),i=s(r);switch(s(e.querySelectorAll(".boxzilla-helper")).remove(),r.removeAttribute("name"),r.className=r.className+" boxzilla-helper",n.parentNode.insertBefore(r,n.nextSibling),i.change(function(){n.value=this.value}),r.style.display="",n.style.display="none",o.style.display="",t){default:r.placeholder=m.enterCommaSeparatedValues;break;case"":case"everywhere":o.value="1",n.value="",r.style.display="none",o.style.display="none";break;case"is_single":case"is_post":r.placeholder=m.enterCommaSeparatedPosts,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post",{multiple:!0,multipleSep:","});break;case"is_page":r.placeholder=m.enterCommaSeparatedPages,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=page",{multiple:!0,multipleSep:","});break;case"is_post_type":r.placeholder=m.enterCommaSeparatedPostTypes,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_type",{multiple:!0,multipleSep:","});break;case"is_url":r.placeholder=m.enterCommaSeparatedRelativeUrls;break;case"is_post_in_category":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=category",{multiple:!0,multipleSep:","});break;case"is_post_with_tag":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_tag",{multiple:!0,multipleSep:","})}}function l(){var e={key:u.querySelectorAll(".boxzilla-rule-row").length},t=h(e);return s(document.getElementById("boxzilla-box-rules")).after(t),!1}var s=window.jQuery,a=e("./_option.js"),u=document.getElementById("boxzilla-box-options-controls"),c=s(u);if(0!==c.length){var p=e("wolfy87-eventemitter"),d=new p,f=e("./_designer.js")(s,a,d),h=wp.template("rule-row-template"),m=boxzilla_i18n;c.on("click",".boxzilla-add-rule",l),c.on("click",".boxzilla-remove-rule",r),c.on("change",".boxzilla-rule-condition",i),c.find(".boxzilla-auto-show-trigger").on("change",o),s(window).load(function(){"undefined"==typeof window.tinyMCE&&(document.getElementById("notice-notinymce").style.display="")}),s(".boxzilla-rule-row").each(i),t.exports={Designer:f,Option:a,events:d}}},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(e,t,n){var o=function(e,t,n){function o(){"object"===_typeof(window.tinyMCE)&&null!==tinyMCE.get("content")&&(s=e("#content_ifr"),l=s.contents().find("html"),l.css({background:"white"}),a=l.find("#tinymce"),a.addClass("boxzilla boxzilla-"+u),a.css({margin:0,background:"white",display:"inline-block",width:"auto","min-width":"240px",position:"relative"}),a.get(0).style.cssText+=";padding: 25px !important;",p=!0,n.trigger("editor.init"))}function r(){return!!p&&(a.css({"border-color":c.borderColor.getColorValue(),"border-width":c.borderWidth.getPxValue(),"border-style":c.borderStyle.getValue(),"background-color":c.backgroundColor.getColorValue(),width:c.width.getPxValue(),color:c.color.getColorValue()}),n.trigger("editor.styles.apply"),!0)}function i(){for(var e in c)"theme"!==e.substring(0,5)&&c[e].clear();r(),n.trigger("editor.styles.reset")}var l,s,a,u=document.getElementById("post_ID").value||0,c={},p=!1,d=e("#boxzilla-box-appearance-controls");return c.borderColor=new t("border-color"),c.borderWidth=new t("border-width"),c.borderStyle=new t("border-style"),c.backgroundColor=new t("background-color"),c.width=new t("width"),c.color=new t("color"),d.find("input.boxzilla-color-field").wpColorPicker({change:r,clear:r}),d.find(":input").not(".boxzilla-color-field").change(r),n.on("editor.init",r),{init:o,resetStyles:i,options:c}};t.exports=o},{}],4:[function(e,t,n){var o=window.jQuery,r=function(e){"string"==typeof e&&(e=document.getElementById("boxzilla-"+e)),e||console.error("Unable to find option element."),this.element=e};r.prototype.getColorValue=function(){return this.element.value.length>0?o(this.element).hasClass("wp-color-field")?o(this.element).wpColorPicker("color"):this.element.value:""},r.prototype.getPxValue=function(e){return this.element.value.length>0?parseInt(this.element.value)+"px":e||""},r.prototype.getValue=function(e){return this.element.value.length>0?this.element.value:e||""},r.prototype.clear=function(){this.element.value=""},r.prototype.setValue=function(e){this.element.value=e},t.exports=r},{}],5:[function(e,n,o){(function(){function e(){}function o(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function r(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,l=this,s=l.EventEmitter;i.getListeners=function(e){var t,n,o=this._getEvents();if(e instanceof RegExp){t={};for(n in o)o.hasOwnProperty(n)&&e.test(n)&&(t[n]=o[n])}else t=o[e]||(o[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,t){var n,r=this.getListenersAsObject(e),i="object"===("undefined"==typeof t?"undefined":_typeof(t));for(n in r)r.hasOwnProperty(n)&&o(r[n],t)===-1&&r[n].push(i?t:{listener:t,once:!1});return this},i.on=r("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=r("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,t){var n,r,i=this.getListenersAsObject(e);for(r in i)i.hasOwnProperty(r)&&(n=o(i[r],t),n!==-1&&i[r].splice(n,1));return this},i.off=r("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var o,r,i=e?this.removeListener:this.addListener,l=e?this.removeListeners:this.addListeners;if("object"!==("undefined"==typeof t?"undefined":_typeof(t))||t instanceof RegExp)for(o=n.length;o--;)i.call(this,t,n[o]);else for(o in t)t.hasOwnProperty(o)&&(r=t[o])&&("function"==typeof r?i.call(this,o,r):l.call(this,o,r));return this},i.removeEvent=function(e){var t,n="undefined"==typeof e?"undefined":_typeof(e),o=this._getEvents();if("string"===n)delete o[e];else if(e instanceof RegExp)for(t in o)o.hasOwnProperty(t)&&e.test(t)&&delete o[t];else delete this._events;return this},i.removeAllListeners=r("removeEvent"),i.emitEvent=function(e,t){var n,o,r,i,l,s=this.getListenersAsObject(e);for(i in s)if(s.hasOwnProperty(i))for(n=s[i].slice(0),r=n.length;r--;)o=n[r],o.once===!0&&this.removeListener(e,o.listener),l=o.listener.apply(this,t||[]),l===this._getOnceReturnValue()&&this.removeListener(e,o.listener);return this},i.trigger=r("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return l.EventEmitter=s,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"===("undefined"==typeof n?"undefined":_typeof(n))&&n.exports?n.exports=e:l.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=admin-script.min.js.map
1
+ "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(){var e=void 0,t=void 0;!function n(t,o,r){function i(s,a){if(!o[s]){if(!t[s]){var u="function"==typeof e&&e;if(!a&&u)return u(s,!0);if(l)return l(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var p=o[s]={exports:{}};t[s][0].call(p.exports,function(e){var n=t[s][1][e];return i(n?n:e)},p,p.exports,n,t,o,r)}return o[s].exports}for(var l="function"==typeof e&&e,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){window.Boxzilla_Admin=e("./admin/_admin.js")},{"./admin/_admin.js":2}],2:[function(e,t,n){function o(){c.find(".boxzilla-trigger-options").toggle(""!==this.value)}function r(){s(this).parents("tr").remove()}function i(){var e="tr"===this.tagName.toLowerCase()?this:s(this).parents("tr").get(0),t=e.querySelector(".boxzilla-rule-condition").value,n=e.querySelector(".boxzilla-rule-value"),o=e.querySelector(".boxzilla-rule-qualifier"),r=n.cloneNode(!0),i=s(r);switch(s(e.querySelectorAll(".boxzilla-helper")).remove(),r.removeAttribute("name"),r.className=r.className+" boxzilla-helper",n.parentNode.insertBefore(r,n.nextSibling),i.change(function(){n.value=this.value}),r.style.display="",n.style.display="none",o.style.display="",t){default:r.placeholder=m.enterCommaSeparatedValues;break;case"":case"everywhere":o.value="1",n.value="",r.style.display="none",o.style.display="none";break;case"is_single":case"is_post":r.placeholder=m.enterCommaSeparatedPosts,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post",{multiple:!0,multipleSep:","});break;case"is_page":r.placeholder=m.enterCommaSeparatedPages,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=page",{multiple:!0,multipleSep:","});break;case"is_post_type":r.placeholder=m.enterCommaSeparatedPostTypes,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_type",{multiple:!0,multipleSep:","});break;case"is_url":r.placeholder=m.enterCommaSeparatedRelativeUrls;break;case"is_post_in_category":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=category",{multiple:!0,multipleSep:","});break;case"is_post_with_tag":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_tag",{multiple:!0,multipleSep:","})}}function l(){var e={key:u.querySelectorAll(".boxzilla-rule-row").length},t=h(e);return s(document.getElementById("boxzilla-box-rules")).after(t),!1}var s=window.jQuery,a=e("./_option.js"),u=document.getElementById("boxzilla-box-options-controls"),c=s(u);if(0!==c.length){var p=e("wolfy87-eventemitter"),d=new p,f=e("./_designer.js")(s,a,d),h=wp.template("rule-row-template"),m=boxzilla_i18n;c.on("click",".boxzilla-add-rule",l),c.on("click",".boxzilla-remove-rule",r),c.on("change",".boxzilla-rule-condition",i),c.find(".boxzilla-auto-show-trigger").on("change",o),s(window).load(function(){"undefined"==typeof window.tinyMCE&&(document.getElementById("notice-notinymce").style.display="")}),s(".boxzilla-rule-row").each(i),t.exports={Designer:f,Option:a,events:d}}},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(e,t,n){var o=function(e,t,n){function o(){"object"===_typeof(window.tinyMCE)&&null!==tinyMCE.get("content")&&(s=e("#content_ifr"),l=s.contents().find("html"),l.css({background:"white"}),a=l.find("#tinymce"),a.addClass("boxzilla boxzilla-"+u),a.css({margin:0,background:"white",display:"inline-block",width:"auto","min-width":"240px",position:"relative"}),a.get(0).style.cssText+=";padding: 25px !important;",p=!0,n.trigger("editor.init"))}function r(){return!!p&&(a.css({"border-color":c.borderColor.getColorValue(),"border-width":c.borderWidth.getPxValue(),"border-style":c.borderStyle.getValue(),"background-color":c.backgroundColor.getColorValue(),width:c.width.getPxValue(),color:c.color.getColorValue()}),n.trigger("editor.styles.apply"),!0)}function i(){for(var e in c)"theme"!==e.substring(0,5)&&c[e].clear();r(),n.trigger("editor.styles.reset")}var l,s,a,u=document.getElementById("post_ID").value||0,c={},p=!1,d=e("#boxzilla-box-appearance-controls");return c.borderColor=new t("border-color"),c.borderWidth=new t("border-width"),c.borderStyle=new t("border-style"),c.backgroundColor=new t("background-color"),c.width=new t("width"),c.color=new t("color"),d.find("input.boxzilla-color-field").wpColorPicker({change:r,clear:r}),d.find(":input").not(".boxzilla-color-field").change(r),n.on("editor.init",r),{init:o,resetStyles:i,options:c}};t.exports=o},{}],4:[function(e,t,n){var o=window.jQuery,r=function(e){"string"==typeof e&&(e=document.getElementById("boxzilla-"+e)),e||console.error("Unable to find option element."),this.element=e};r.prototype.getColorValue=function(){return this.element.value.length>0?o(this.element).hasClass("wp-color-field")?o(this.element).wpColorPicker("color"):this.element.value:""},r.prototype.getPxValue=function(e){return this.element.value.length>0?parseInt(this.element.value)+"px":e||""},r.prototype.getValue=function(e){return this.element.value.length>0?this.element.value:e||""},r.prototype.clear=function(){this.element.value=""},r.prototype.setValue=function(e){this.element.value=e},t.exports=r},{}],5:[function(e,n,o){(function(){function e(){}function o(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function r(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,l=this,s=l.EventEmitter;i.getListeners=function(e){var t,n,o=this._getEvents();if(e instanceof RegExp){t={};for(n in o)o.hasOwnProperty(n)&&e.test(n)&&(t[n]=o[n])}else t=o[e]||(o[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,t){var n,r=this.getListenersAsObject(e),i="object"===("undefined"==typeof t?"undefined":_typeof(t));for(n in r)r.hasOwnProperty(n)&&o(r[n],t)===-1&&r[n].push(i?t:{listener:t,once:!1});return this},i.on=r("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=r("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,t){var n,r,i=this.getListenersAsObject(e);for(r in i)i.hasOwnProperty(r)&&(n=o(i[r],t),n!==-1&&i[r].splice(n,1));return this},i.off=r("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var o,r,i=e?this.removeListener:this.addListener,l=e?this.removeListeners:this.addListeners;if("object"!==("undefined"==typeof t?"undefined":_typeof(t))||t instanceof RegExp)for(o=n.length;o--;)i.call(this,t,n[o]);else for(o in t)t.hasOwnProperty(o)&&(r=t[o])&&("function"==typeof r?i.call(this,o,r):l.call(this,o,r));return this},i.removeEvent=function(e){var t,n="undefined"==typeof e?"undefined":_typeof(e),o=this._getEvents();if("string"===n)delete o[e];else if(e instanceof RegExp)for(t in o)o.hasOwnProperty(t)&&e.test(t)&&delete o[t];else delete this._events;return this},i.removeAllListeners=r("removeEvent"),i.emitEvent=function(e,t){var n,o,r,i,l,s=this.getListenersAsObject(e);for(i in s)if(s.hasOwnProperty(i))for(n=s[i].slice(0),r=n.length;r--;)o=n[r],o.once===!0&&this.removeListener(e,o.listener),l=o.listener.apply(this,t||[]),l===this._getOnceReturnValue()&&this.removeListener(e,o.listener);return this},i.trigger=r("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return l.EventEmitter=s,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"===("undefined"==typeof n?"undefined":_typeof(n))&&n.exports?n.exports=e:l.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=admin-script.min.js.map
assets/js/admin-script.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["admin-script.js"],"names":["_typeof","Symbol","iterator","obj","constructor","require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","window","Boxzilla_Admin","./admin/_admin.js","2","toggleTriggerOptions","$optionControls","find","toggle","this","value","removeRule","$","parents","remove","setContextualHelpers","context","tagName","toLowerCase","get","condition","querySelector","valueInput","qualifierInput","betterInput","cloneNode","$betterInput","querySelectorAll","removeAttribute","className","parentNode","insertBefore","nextSibling","change","style","display","placeholder","i18n","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","addRuleFields","data","key","optionControls","html","rowTemplate","document","getElementById","after","jQuery","Option","EventEmitter","events","Designer","wp","template","boxzilla_i18n","on","load","tinyMCE","each","./_designer.js","./_option.js","wolfy87-eventemitter","3","init","$editorFrame","$editor","contents","css","background","$innerEditor","addClass","boxId","margin","width","min-width","position","cssText","visualEditorInitialised","trigger","applyStyles","border-color","options","borderColor","getColorValue","border-width","borderWidth","getPxValue","border-style","borderStyle","getValue","background-color","backgroundColor","color","resetStyles","substring","clear","$appearanceControls","wpColorPicker","not","4","element","console","error","prototype","hasClass","fallbackValue","parseInt","setValue","5","indexOfListener","listeners","listener","alias","name","apply","arguments","proto","originalGlobalValue","getListeners","evt","response","_getEvents","RegExp","hasOwnProperty","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","single","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"AAAA,YAEA,IAAIA,SAA4B,kBAAXC,SAAoD,gBAApBA,QAAOC,SAAwB,SAAUC,GAAO,aAAcA,IAAS,SAAUA,GAAO,MAAOA,IAAyB,kBAAX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WT,EAASA,SAASG,MAAMlH,KAAMsJ,OAErC9B,IAAaxH,KAAKyJ,uBACpBzJ,KAAKyI,eAAelB,EAAKR,EAASA,SAM1C,OAAO/G,OAMToH,EAAMtC,QAAUkC,EAAM,aAUtBI,EAAMsC,KAAO,SAAcnC,GACzB,GAAI+B,GAAOrB,MAAM1B,UAAUiD,MAAMpK,KAAK+H,UAAW,EACjD,OAAOnH,MAAKqJ,UAAU9B,EAAK+B,IAW7BlC,EAAMuC,mBAAqB,SAA4B1J,GAErD,MADAD,MAAK4J,iBAAmB3J,EACjBD,MAWToH,EAAMqC,oBAAsB,WAC1B,OAAIzJ,KAAK2H,eAAe,qBACf3H,KAAK4J,kBAYhBxC,EAAMK,WAAa,WACjB,MAAOzH,MAAKmJ,UAAYnJ,KAAKmJ,aAQ/BlG,EAAa4G,WAAa,WAExB,MADA1K,GAAQ8D,aAAeoE,EAChBpE,GAIa,kBAAX5E,IAAyBA,EAAOyL,IACzCzL,EAAO,WACL,MAAO4E,KAEoE,YAAjD,mBAAX1D,GAAyB,YAAczB,QAAQyB,KAAyBA,EAAOJ,QAChGI,EAAOJ,QAAU8D,EAEjB9D,EAAQ8D,aAAeA,IAExB7D,KAAKY,gBACK","file":"admin-script.min.js","sourcesContent":["\"use strict\";\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\n(function () {\n var require = undefined;var module = undefined;var exports = undefined;var define = undefined;(function e(t, n, r) {\n function s(o, u) {\n if (!n[o]) {\n if (!t[o]) {\n 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;\n }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {\n var n = t[o][1][e];return s(n ? n : e);\n }, l, l.exports, e, t, n, r);\n }return n[o].exports;\n }var i = typeof require == \"function\" && require;for (var o = 0; o < r.length; o++) {\n s(r[o]);\n }return s;\n })({ 1: [function (require, module, exports) {\n window.Boxzilla_Admin = require('./admin/_admin.js');\n }, { \"./admin/_admin.js\": 2 }], 2: [function (require, module, exports) {\n 'use strict';\n\n var $ = window.jQuery;\n var Option = require('./_option.js');\n var optionControls = document.getElementById('boxzilla-box-options-controls');\n var $optionControls = $(optionControls);\n\n // sanity check, are we on the correct page?\n if ($optionControls.length === 0) {\n return;\n }\n\n var EventEmitter = require('wolfy87-eventemitter');\n var events = new EventEmitter();\n var Designer = require('./_designer.js')($, Option, events);\n var rowTemplate = wp.template('rule-row-template');\n var i18n = boxzilla_i18n;\n\n // events\n $optionControls.on('click', \".boxzilla-add-rule\", addRuleFields);\n $optionControls.on('click', \".boxzilla-remove-rule\", removeRule);\n $optionControls.on('change', \".boxzilla-rule-condition\", setContextualHelpers);\n $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);\n\n $(window).load(function () {\n if (typeof window.tinyMCE === \"undefined\") {\n document.getElementById('notice-notinymce').style.display = '';\n }\n });\n\n // call contextual helper method for each row\n $('.boxzilla-rule-row').each(setContextualHelpers);\n\n function toggleTriggerOptions() {\n $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');\n }\n\n function removeRule() {\n $(this).parents('tr').remove();\n }\n\n function setContextualHelpers() {\n\n var context = this.tagName.toLowerCase() === \"tr\" ? this : $(this).parents('tr').get(0);\n var condition = context.querySelector('.boxzilla-rule-condition').value;\n var valueInput = context.querySelector('.boxzilla-rule-value');\n var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n var betterInput = valueInput.cloneNode(true);\n var $betterInput = $(betterInput);\n\n // remove previously added helpers\n $(context.querySelectorAll('.boxzilla-helper')).remove();\n\n // prepare better input\n betterInput.removeAttribute('name');\n betterInput.className = betterInput.className + ' boxzilla-helper';\n valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n $betterInput.change(function () {\n valueInput.value = this.value;\n });\n\n betterInput.style.display = '';\n valueInput.style.display = 'none';\n qualifierInput.style.display = '';\n\n // change placeholder for textual help\n switch (condition) {\n default:\n betterInput.placeholder = i18n.enterCommaSeparatedValues;\n break;\n\n case '':\n case 'everywhere':\n qualifierInput.value = '1';\n valueInput.value = '';\n betterInput.style.display = 'none';\n qualifierInput.style.display = 'none';\n break;\n\n case 'is_single':\n case 'is_post':\n betterInput.placeholder = i18n.enterCommaSeparatedPosts;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_page':\n betterInput.placeholder = i18n.enterCommaSeparatedPages;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_post_type':\n betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_url':\n betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n break;\n\n case 'is_post_in_category':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_post_with_tag':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", { multiple: true, multipleSep: \",\" });\n break;\n }\n }\n\n function addRuleFields() {\n var data = {\n 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length\n };\n var html = rowTemplate(data);\n $(document.getElementById('boxzilla-box-rules')).after(html);\n return false;\n }\n\n module.exports = {\n 'Designer': Designer,\n 'Option': Option,\n 'events': events\n };\n }, { \"./_designer.js\": 3, \"./_option.js\": 4, \"wolfy87-eventemitter\": 5 }], 3: [function (require, module, exports) {\n var Designer = function Designer($, Option, events) {\n\n // vars\n var boxId = document.getElementById('post_ID').value || 0,\n $editor,\n $editorFrame,\n $innerEditor,\n options = {},\n visualEditorInitialised = false;\n\n var $appearanceControls = $(\"#boxzilla-box-appearance-controls\");\n\n // create Option objects\n options.borderColor = new Option('border-color');\n options.borderWidth = new Option('border-width');\n options.borderStyle = new Option('border-style');\n options.backgroundColor = new Option('background-color');\n options.width = new Option('width');\n options.color = new Option('color');\n\n // functions\n function init() {\n\n // Only run if TinyMCE has actually inited\n if (_typeof(window.tinyMCE) !== \"object\" || tinyMCE.get('content') === null) {\n return;\n }\n\n // add classes to TinyMCE <html>\n $editorFrame = $(\"#content_ifr\");\n $editor = $editorFrame.contents().find('html');\n $editor.css({\n 'background': 'white'\n });\n\n // add content class and padding to TinyMCE <body>\n $innerEditor = $editor.find('#tinymce');\n $innerEditor.addClass('boxzilla boxzilla-' + boxId);\n $innerEditor.css({\n 'margin': 0,\n 'background': 'white',\n 'display': 'inline-block',\n 'width': 'auto',\n 'min-width': '240px',\n 'position': 'relative'\n });\n $innerEditor.get(0).style.cssText += ';padding: 25px !important;';\n\n visualEditorInitialised = true;\n\n /* @since 2.0.3 */\n events.trigger('editor.init');\n }\n\n /**\n * Applies the styles from the options to the TinyMCE Editor\n *\n * @return bool\n */\n function applyStyles() {\n\n if (!visualEditorInitialised) {\n return false;\n }\n\n // apply styles from CSS editor\n $innerEditor.css({\n 'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),\n 'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),\n 'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),\n 'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),\n 'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),\n 'color': options.color.getColorValue() // getColorValue( 'color', '' )\n });\n\n /* @since 2.0.3 */\n events.trigger('editor.styles.apply');\n\n return true;\n }\n\n function resetStyles() {\n for (var key in options) {\n if (key.substring(0, 5) === 'theme') {\n continue;\n }\n\n options[key].clear();\n }\n applyStyles();\n\n /* @since 2.0.3 */\n events.trigger('editor.styles.reset');\n }\n\n // event binders\n $appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });\n $appearanceControls.find(\":input\").not(\".boxzilla-color-field\").change(applyStyles);\n events.on('editor.init', applyStyles);\n\n // public methods\n return {\n 'init': init,\n 'resetStyles': resetStyles,\n 'options': options\n };\n };\n\n module.exports = Designer;\n }, {}], 4: [function (require, module, exports) {\n 'use strict';\n\n var $ = window.jQuery;\n\n var Option = function Option(element) {\n\n // find corresponding element\n if (typeof element == \"string\") {\n element = document.getElementById('boxzilla-' + element);\n }\n\n if (!element) {\n console.error(\"Unable to find option element.\");\n }\n\n this.element = element;\n };\n\n Option.prototype.getColorValue = function () {\n if (this.element.value.length > 0) {\n if ($(this.element).hasClass('wp-color-field')) {\n return $(this.element).wpColorPicker('color');\n } else {\n return this.element.value;\n }\n }\n\n return '';\n };\n\n Option.prototype.getPxValue = function (fallbackValue) {\n if (this.element.value.length > 0) {\n return parseInt(this.element.value) + \"px\";\n }\n\n return fallbackValue || '';\n };\n\n Option.prototype.getValue = function (fallbackValue) {\n\n if (this.element.value.length > 0) {\n return this.element.value;\n }\n\n return fallbackValue || '';\n };\n\n Option.prototype.clear = function () {\n this.element.value = '';\n };\n\n Option.prototype.setValue = function (value) {\n this.element.value = value;\n };\n\n module.exports = Option;\n }, {}], 5: [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\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 } 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 === \"undefined\" ? \"undefined\" : _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 === \"undefined\" ? \"undefined\" : _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 } else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\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 === \"undefined\" ? \"undefined\" : _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 } 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 } 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 } 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 } else if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) === 'object' && module.exports) {\n module.exports = EventEmitter;\n } else {\n exports.EventEmitter = EventEmitter;\n }\n }).call(this);\n }, {}] }, {}, [1]);\n ;\n})();"],"sourceRoot":"/source/"}
1
+ {"version":3,"sources":["admin-script.js"],"names":["_typeof","Symbol","iterator","obj","constructor","prototype","require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","window","Boxzilla_Admin","./admin/_admin.js","2","toggleTriggerOptions","$optionControls","find","toggle","this","value","removeRule","$","parents","remove","setContextualHelpers","context","tagName","toLowerCase","get","condition","querySelector","valueInput","qualifierInput","betterInput","cloneNode","$betterInput","querySelectorAll","removeAttribute","className","parentNode","insertBefore","nextSibling","change","style","display","placeholder","i18n","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","addRuleFields","data","key","optionControls","html","rowTemplate","document","getElementById","after","jQuery","Option","EventEmitter","events","Designer","wp","template","boxzilla_i18n","on","load","tinyMCE","each","./_designer.js","./_option.js","wolfy87-eventemitter","3","init","$editorFrame","$editor","contents","css","background","$innerEditor","addClass","boxId","margin","width","min-width","position","cssText","visualEditorInitialised","trigger","applyStyles","border-color","options","borderColor","getColorValue","border-width","borderWidth","getPxValue","border-style","borderStyle","getValue","background-color","backgroundColor","color","resetStyles","substring","clear","$appearanceControls","wpColorPicker","not","4","element","console","error","hasClass","fallbackValue","parseInt","setValue","5","indexOfListener","listeners","listener","alias","name","apply","arguments","proto","originalGlobalValue","getListeners","evt","response","_getEvents","RegExp","hasOwnProperty","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","single","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"AAAA,YAEA,IAAIA,SAA4B,kBAAXC,SAAoD,gBAApBA,QAAOC,SAAwB,SAAUC,GAAO,aAAcA,IAAS,SAAUA,GAAO,MAAOA,IAAyB,kBAAXF,SAAyBE,EAAIC,cAAgBH,QAAUE,IAAQF,OAAOI,UAAY,eAAkBF,KAEtQ,WACE,GAAIG,GAAUC,OAA6DC,EAASD,QAAU,QAAUE,GAAEC,EAAGC,EAAGC,GAC9G,QAASC,GAAEC,EAAGC,GACZ,IAAKJ,EAAEG,GAAI,CACT,IAAKJ,EAAEI,GAAI,CACT,GAAIE,GAAsB,kBAAXV,IAAyBA,CAAQ,KAAKS,GAAKC,EAAG,MAAOA,GAAEF,GAAG,EAAI,IAAIG,EAAG,MAAOA,GAAEH,GAAG,EAAI,IAAII,GAAI,GAAIC,OAAM,uBAAyBL,EAAI,IAAK,MAAMI,GAAEE,KAAO,mBAAoBF,EAC5L,GAAIG,GA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qBACf1H,KAAK2J,kBAYhBxC,EAAMK,WAAa,WACjB,MAAOxH,MAAKkJ,UAAYlJ,KAAKkJ,aAQ/BjG,EAAa2G,WAAa,WAExB,MADAzK,GAAQ8D,aAAemE,EAChBnE,GAIa,kBAAX5E,IAAyBA,EAAOwL,IACzCxL,EAAO,WACL,MAAO4E,KAEoE,YAAjD,mBAAX1D,GAAyB,YAAc1B,QAAQ0B,KAAyBA,EAAOJ,QAChGI,EAAOJ,QAAU8D,EAEjB9D,EAAQ8D,aAAeA,IAExB7D,KAAKY,gBACK","file":"admin-script.min.js","sourcesContent":["\"use strict\";\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n(function () {\n var require = undefined;var module = undefined;var exports = undefined;var define = undefined;(function e(t, n, r) {\n function s(o, u) {\n if (!n[o]) {\n if (!t[o]) {\n 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;\n }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {\n var n = t[o][1][e];return s(n ? n : e);\n }, l, l.exports, e, t, n, r);\n }return n[o].exports;\n }var i = typeof require == \"function\" && require;for (var o = 0; o < r.length; o++) {\n s(r[o]);\n }return s;\n })({ 1: [function (require, module, exports) {\n window.Boxzilla_Admin = require('./admin/_admin.js');\n }, { \"./admin/_admin.js\": 2 }], 2: [function (require, module, exports) {\n 'use strict';\n\n var $ = window.jQuery;\n var Option = require('./_option.js');\n var optionControls = document.getElementById('boxzilla-box-options-controls');\n var $optionControls = $(optionControls);\n\n // sanity check, are we on the correct page?\n if ($optionControls.length === 0) {\n return;\n }\n\n var EventEmitter = require('wolfy87-eventemitter');\n var events = new EventEmitter();\n var Designer = require('./_designer.js')($, Option, events);\n var rowTemplate = wp.template('rule-row-template');\n var i18n = boxzilla_i18n;\n\n // events\n $optionControls.on('click', \".boxzilla-add-rule\", addRuleFields);\n $optionControls.on('click', \".boxzilla-remove-rule\", removeRule);\n $optionControls.on('change', \".boxzilla-rule-condition\", setContextualHelpers);\n $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);\n\n $(window).load(function () {\n if (typeof window.tinyMCE === \"undefined\") {\n document.getElementById('notice-notinymce').style.display = '';\n }\n });\n\n // call contextual helper method for each row\n $('.boxzilla-rule-row').each(setContextualHelpers);\n\n function toggleTriggerOptions() {\n $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');\n }\n\n function removeRule() {\n $(this).parents('tr').remove();\n }\n\n function setContextualHelpers() {\n\n var context = this.tagName.toLowerCase() === \"tr\" ? this : $(this).parents('tr').get(0);\n var condition = context.querySelector('.boxzilla-rule-condition').value;\n var valueInput = context.querySelector('.boxzilla-rule-value');\n var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n var betterInput = valueInput.cloneNode(true);\n var $betterInput = $(betterInput);\n\n // remove previously added helpers\n $(context.querySelectorAll('.boxzilla-helper')).remove();\n\n // prepare better input\n betterInput.removeAttribute('name');\n betterInput.className = betterInput.className + ' boxzilla-helper';\n valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n $betterInput.change(function () {\n valueInput.value = this.value;\n });\n\n betterInput.style.display = '';\n valueInput.style.display = 'none';\n qualifierInput.style.display = '';\n\n // change placeholder for textual help\n switch (condition) {\n default:\n betterInput.placeholder = i18n.enterCommaSeparatedValues;\n break;\n\n case '':\n case 'everywhere':\n qualifierInput.value = '1';\n valueInput.value = '';\n betterInput.style.display = 'none';\n qualifierInput.style.display = 'none';\n break;\n\n case 'is_single':\n case 'is_post':\n betterInput.placeholder = i18n.enterCommaSeparatedPosts;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_page':\n betterInput.placeholder = i18n.enterCommaSeparatedPages;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_post_type':\n betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_url':\n betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n break;\n\n case 'is_post_in_category':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_post_with_tag':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", { multiple: true, multipleSep: \",\" });\n break;\n }\n }\n\n function addRuleFields() {\n var data = {\n 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length\n };\n var html = rowTemplate(data);\n $(document.getElementById('boxzilla-box-rules')).after(html);\n return false;\n }\n\n module.exports = {\n 'Designer': Designer,\n 'Option': Option,\n 'events': events\n };\n }, { \"./_designer.js\": 3, \"./_option.js\": 4, \"wolfy87-eventemitter\": 5 }], 3: [function (require, module, exports) {\n var Designer = function Designer($, Option, events) {\n\n // vars\n var boxId = document.getElementById('post_ID').value || 0,\n $editor,\n $editorFrame,\n $innerEditor,\n options = {},\n visualEditorInitialised = false;\n\n var $appearanceControls = $(\"#boxzilla-box-appearance-controls\");\n\n // create Option objects\n options.borderColor = new Option('border-color');\n options.borderWidth = new Option('border-width');\n options.borderStyle = new Option('border-style');\n options.backgroundColor = new Option('background-color');\n options.width = new Option('width');\n options.color = new Option('color');\n\n // functions\n function init() {\n\n // Only run if TinyMCE has actually inited\n if (_typeof(window.tinyMCE) !== \"object\" || tinyMCE.get('content') === null) {\n return;\n }\n\n // add classes to TinyMCE <html>\n $editorFrame = $(\"#content_ifr\");\n $editor = $editorFrame.contents().find('html');\n $editor.css({\n 'background': 'white'\n });\n\n // add content class and padding to TinyMCE <body>\n $innerEditor = $editor.find('#tinymce');\n $innerEditor.addClass('boxzilla boxzilla-' + boxId);\n $innerEditor.css({\n 'margin': 0,\n 'background': 'white',\n 'display': 'inline-block',\n 'width': 'auto',\n 'min-width': '240px',\n 'position': 'relative'\n });\n $innerEditor.get(0).style.cssText += ';padding: 25px !important;';\n\n visualEditorInitialised = true;\n\n /* @since 2.0.3 */\n events.trigger('editor.init');\n }\n\n /**\n * Applies the styles from the options to the TinyMCE Editor\n *\n * @return bool\n */\n function applyStyles() {\n\n if (!visualEditorInitialised) {\n return false;\n }\n\n // apply styles from CSS editor\n $innerEditor.css({\n 'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),\n 'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),\n 'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),\n 'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),\n 'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),\n 'color': options.color.getColorValue() // getColorValue( 'color', '' )\n });\n\n /* @since 2.0.3 */\n events.trigger('editor.styles.apply');\n\n return true;\n }\n\n function resetStyles() {\n for (var key in options) {\n if (key.substring(0, 5) === 'theme') {\n continue;\n }\n\n options[key].clear();\n }\n applyStyles();\n\n /* @since 2.0.3 */\n events.trigger('editor.styles.reset');\n }\n\n // event binders\n $appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });\n $appearanceControls.find(\":input\").not(\".boxzilla-color-field\").change(applyStyles);\n events.on('editor.init', applyStyles);\n\n // public methods\n return {\n 'init': init,\n 'resetStyles': resetStyles,\n 'options': options\n };\n };\n\n module.exports = Designer;\n }, {}], 4: [function (require, module, exports) {\n 'use strict';\n\n var $ = window.jQuery;\n\n var Option = function Option(element) {\n\n // find corresponding element\n if (typeof element == \"string\") {\n element = document.getElementById('boxzilla-' + element);\n }\n\n if (!element) {\n console.error(\"Unable to find option element.\");\n }\n\n this.element = element;\n };\n\n Option.prototype.getColorValue = function () {\n if (this.element.value.length > 0) {\n if ($(this.element).hasClass('wp-color-field')) {\n return $(this.element).wpColorPicker('color');\n } else {\n return this.element.value;\n }\n }\n\n return '';\n };\n\n Option.prototype.getPxValue = function (fallbackValue) {\n if (this.element.value.length > 0) {\n return parseInt(this.element.value) + \"px\";\n }\n\n return fallbackValue || '';\n };\n\n Option.prototype.getValue = function (fallbackValue) {\n\n if (this.element.value.length > 0) {\n return this.element.value;\n }\n\n return fallbackValue || '';\n };\n\n Option.prototype.clear = function () {\n this.element.value = '';\n };\n\n Option.prototype.setValue = function (value) {\n this.element.value = value;\n };\n\n module.exports = Option;\n }, {}], 5: [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\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 } 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 === \"undefined\" ? \"undefined\" : _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 === \"undefined\" ? \"undefined\" : _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 } else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\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 === \"undefined\" ? \"undefined\" : _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 } 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 } 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 } 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 } else if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) === 'object' && module.exports) {\n module.exports = EventEmitter;\n } else {\n exports.EventEmitter = EventEmitter;\n }\n }).call(this);\n }, {}] }, {}, [1]);\n ;\n})();"]}
assets/js/script.js CHANGED
@@ -20,8 +20,10 @@ for( var i=0; i < options.boxes.length; i++ ) {
20
  boxOpts.testMode = isLoggedIn && options.testMode;
21
 
22
  // fix http:// links in box content....
23
- if( window.location.origin.substring(0, 5) === "https" ) {
24
- boxOpts.content = boxOpts.content.replace(window.location.origin.replace("https", "http"), window.location.origin);
 
 
25
  }
26
 
27
  // create box
@@ -453,6 +455,7 @@ Box.prototype.toggle = function(show) {
453
 
454
  // show or hide box using selected animation
455
  if( this.config.position === 'center' ) {
 
456
  Animator.toggle(this.overlay, "fade");
457
  }
458
 
@@ -825,6 +828,7 @@ Boxzilla.init = function() {
825
  document.body.appendChild(overlay);
826
 
827
  // event binds
 
828
  window.addEventListener('scroll', throttle(checkHeightCriteria));
829
  window.addEventListener('resize', throttle(recalculateHeights));
830
  window.addEventListener('load', recalculateHeights );
@@ -914,7 +918,7 @@ if ( typeof module !== 'undefined' && module.exports ) {
914
  module.exports = Boxzilla;
915
  }
916
  },{"./box.js":3,"./styles.js":5,"./timer.js":6,"wolfy87-eventemitter":7}],5:[function(require,module,exports){
917
- const styles = `body{-webkit-overflow-scrolling:touch!important}#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}`;
918
  module.exports = styles;
919
  },{}],6:[function(require,module,exports){
920
  'use strict';
20
  boxOpts.testMode = isLoggedIn && options.testMode;
21
 
22
  // fix http:// links in box content....
23
+ if( window.location.protocol === "https:" && window.location.host ) {
24
+ var o = "http://" + window.location.host;
25
+ var n = old.replace('http://', 'https://');
26
+ boxOpts.content = boxOpts.content.replace(o, n);
27
  }
28
 
29
  // create box
455
 
456
  // show or hide box using selected animation
457
  if( this.config.position === 'center' ) {
458
+ this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');
459
  Animator.toggle(this.overlay, "fade");
460
  }
461
 
828
  document.body.appendChild(overlay);
829
 
830
  // event binds
831
+ window.addEventListener('touchmove', throttle(checkHeightCriteria));
832
  window.addEventListener('scroll', throttle(checkHeightCriteria));
833
  window.addEventListener('resize', throttle(recalculateHeights));
834
  window.addEventListener('load', recalculateHeights );
918
  module.exports = Boxzilla;
919
  }
920
  },{"./box.js":3,"./styles.js":5,"./timer.js":6,"wolfy87-eventemitter":7}],5:[function(require,module,exports){
921
+ const styles = `#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}`;
922
  module.exports = styles;
923
  },{}],6:[function(require,module,exports){
924
  'use strict';
assets/js/script.min.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};!function(){var e=void 0,t=void 0;!function i(t,n,o){function r(a,l){if(!n[a]){if(!t[a]){var c="function"==typeof e&&e;if(!l&&c)return c(a,!0);if(s)return s(a,!0);var d=new Error("Cannot find module '"+a+"'");throw d.code="MODULE_NOT_FOUND",d}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var i=t[a][1][e];return r(i?i:e)},f,f.exports,i,t,n,o)}return n[a].exports}for(var s="function"==typeof e&&e,a=0;a<o.length;a++)r(o[a]);return r}({1:[function(e,t,i){function n(e,t){t.background_color&&(e.style.background=t.background_color),t.color&&(e.style.color=t.color),t.border_color&&(e.style.borderColor=t.border_color),t.border_width&&(e.style.borderWidth=parseInt(t.border_width)+"px"),t.border_style&&(e.style.borderStyle=t.border_style),t.width&&(e.style.maxWidth=parseInt(t.width)+"px")}var o=e("boxzilla"),r=window.boxzilla_options,s=document.body.className.indexOf("logged-in")>-1;s&&r.testMode&&console.log("Boxzilla: Test mode is enabled. Please disable test mode if you're done testing."),o.init();for(var a=0;a<r.boxes.length;a++){var l=r.boxes[a];l.testMode=s&&r.testMode,"https"===window.location.origin.substring(0,5)&&(l.content=l.content.replace(window.location.origin.replace("https","http"),window.location.origin));var c=o.create(l.id,l);n(c.element,l.css),c.element.firstChild.firstChild.className+=" first-child",c.element.firstChild.lastChild.className+=" last-child"}window.addEventListener("load",function(){if("object"===_typeof(window.mc4wp_forms_config)&&window.mc4wp_forms_config.submitted_form){var e="#"+window.mc4wp_forms_config.submitted_form.element_id,t=o.boxes;for(var i in t)if(t.hasOwnProperty(i)){var n=t[i];if(n.element.querySelector(e))return void n.show()}}}),window.Boxzilla=o},{boxzilla:4}],2:[function(e,t,i){function n(e,t){for(var i in t)e.style[i]=t[i]}function o(e,t){for(var i={},n=0;n<e.length;n++)i[e[n]]=t;return i}function r(e,t){for(var i={},n=0;n<e.length;n++)i[e[n]]=t[e[n]];return i}function s(e){return!!e.getAttribute("data-animated")}function a(e,t){var i="none"!=e.style.display||e.offsetLeft>0,s=e.cloneNode(!0),a=function(){e.removeAttribute("data-animated"),e.setAttribute("style",s.getAttribute("style")),e.style.display=i?"none":""};e.setAttribute("data-animated","true"),i||(e.style.display="");var c,d;if("slide"===t){if(c=o(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],0),d={},!i){var f=window.getComputedStyle(e);d=r(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],f),n(e,c)}e.style.overflowY="hidden",l(e,i?c:d,a)}else c={opacity:0},d={opacity:1},i||n(e,c),l(e,i?c:d,a)}function l(e,t,i){var n=+new Date,o=window.getComputedStyle(e),r={},s={};for(var a in t){t[a]=parseFloat(t[a]);var l=t[a],d=parseFloat(o[a]);d!=l?(s[a]=(l-d)/c,r[a]=d):delete t[a]}var f=function h(){var o,a,l,c,d=+new Date,f=d-n,u=!0;for(var g in t){o=s[g],a=t[g],l=o*f,c=r[g]+l,o>0&&c>=a||o<0&&c<=a?c=a:u=!1,r[g]=c;var p="opacity"!==g?"px":"";e.style[g]=c+p}n=+new Date,u?i&&i():window.requestAnimationFrame&&requestAnimationFrame(h)||setTimeout(h,32)};f()}var c=320;t.exports={toggle:a,animate:l,animated:s}},{}],3:[function(e,t,i){function n(e,t){var i={};for(var n in e)i[n]=e[n];for(var n in t)i[n]=t[n];return i}function o(){var e=document.body,t=document.documentElement,i=Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight);return i}var r,s={animation:"fade",rehide:!1,content:"",cookie:null,icon:"&times",minimumScreenWidth:0,position:"center",testMode:!1,trigger:!1,closable:!0},a=e("./animator.js"),l=function(e,t){this.id=e,this.config=n(s,t),this.overlay=document.getElementById("boxzilla-overlay"),this.visible=!1,this.dismissed=!1,this.triggered=!1,this.triggerHeight=0,this.cookieSet=!1,this.element=null,this.closeIcon=null,this.config.trigger&&("percentage"!==this.config.trigger.method&&"element"!==this.config.trigger.method||(this.triggerHeight=this.calculateTriggerHeight()),this.cookieSet=this.isCookieSet()),this.dom(),this.events()};l.prototype.events=function(){var e=this;this.closeIcon&&this.closeIcon.addEventListener("click",e.dismiss.bind(this)),this.element.addEventListener("click",function(t){"A"===t.target.tagName&&r.trigger("box.interactions.link",[e,t.target])},!1),this.element.addEventListener("submit",function(t){e.setCookie(),r.trigger("box.interactions.form",[e,t.target])},!1),window.addEventListener("hashchange",function(){var t="#boxzilla-"+e.id;location.hash===t&&e.toggle()}),this.fits()&&this.locationHashRefersBox()&&window.addEventListener("load",this.show.bind(this))},l.prototype.dom=function(){var e=document.createElement("div");e.className="boxzilla-container boxzilla-"+this.config.position+"-container";var t=document.createElement("div");t.setAttribute("id","boxzilla-"+this.id),t.className="boxzilla boxzilla-"+this.id+" boxzilla-"+this.config.position,t.style.display="none",e.appendChild(t);var i=document.createElement("div");i.className="boxzilla-content",i.innerHTML=this.config.content,t.appendChild(i);var n=i.querySelectorAll("script");if(n.length){for(var o=document.createElement("script"),r=0;r<n.length;r++)o.appendChild(document.createTextNode(n[r].text)),n[r].parentNode.removeChild(n[r]);document.body.appendChild(o)}if(this.config.closable&&this.config.icon){var s=document.createElement("span");s.className="boxzilla-close-icon",s.innerHTML=this.config.icon,t.appendChild(s),this.closeIcon=s}document.body.appendChild(e),this.element=t},l.prototype.setCustomBoxStyling=function(){var e=this.element.style.display;this.element.style.display="",this.element.style.overflowY="auto",this.element.style.maxHeight="none";var t=window.innerHeight,i=this.element.clientHeight;if(i>t&&(this.element.style.maxHeight=t+"px",this.element.style.overflowY="scroll"),"center"===this.config.position){var n=(t-i)/2;n=n>=0?n:0,this.element.style.marginTop=n+"px"}this.element.style.display=e},l.prototype.toggle=function(e){if("undefined"==typeof e&&(e=!this.visible),e===this.visible)return!1;if(a.animated(this.element))return!1;if(!e&&!this.config.closable)return!1;this.visible=e,this.setCustomBoxStyling(),r.trigger("box."+(e?"show":"hide"),[this]),"center"===this.config.position&&a.toggle(this.overlay,"fade"),a.toggle(this.element,this.config.animation);var t=this.element.querySelector("input, textarea");return t&&t.focus(),!0},l.prototype.show=function(){return this.toggle(!0)},l.prototype.hide=function(){return this.toggle(!1)},l.prototype.calculateTriggerHeight=function(){var e=0;if("element"===this.config.trigger.method){var t=document.body.querySelector(this.config.trigger.value);if(t){var i=t.getBoundingClientRect();e=i.top}}else"percentage"===this.config.trigger.method&&(e=this.config.trigger.value/100*o());return e},l.prototype.locationHashRefersBox=function(){if(!window.location.hash||0===window.location.hash.length)return!1;var e=window.location.hash.substring(1);return e===this.element.id||!!this.element.querySelector("#"+e)},l.prototype.fits=function(){return this.config.minimumScreenWidth<=0||window.innerWidth>this.config.minimumScreenWidth},l.prototype.mayAutoShow=function(){return!this.dismissed&&(!!this.fits()&&(!!this.config.trigger&&!this.cookieSet))},l.prototype.mayRehide=function(){return this.config.rehide&&this.triggered},l.prototype.isCookieSet=function(){if(this.config.testMode)return!1;if(!this.config.cookie||!this.config.cookie.triggered&&!this.config.cookie.dismissed)return!1;var e="true"===document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*boxzilla_box_"+this.id+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1");return e},l.prototype.setCookie=function(e){var t=new Date;t.setHours(t.getHours()+e),document.cookie="boxzilla_box_"+this.id+"=true; expires="+t.toUTCString()+"; path=/"},l.prototype.trigger=function(){var e=this.show();e&&(this.triggered=!0,this.config.cookie&&this.config.cookie.triggered&&this.setCookie(this.config.cookie.triggered))},l.prototype.dismiss=function(e){return e&&e.preventDefault(),!!this.visible&&(this.hide(),this.config.cookie&&this.config.cookie.dismissed&&this.setCookie(this.config.cookie.dismissed),this.dismissed=!0,r.trigger("box.dismiss",[this]),!0)},t.exports=function(e){return r=e,l}},{"./animator.js":2}],4:[function(e,t,i){function n(e,t,i){t||(t=250);var n,o;return function(){var r=i||this,s=+new Date,a=arguments;n&&s<n+t?(clearTimeout(o),o=setTimeout(function(){n=s,e.apply(r,a)},t)):(n=s,e.apply(r,a))}}function o(e){27==e.keyCode&&x.dismiss()}function r(){h()||_.forEach(function(e){e.mayAutoShow()&&"pageviews"===e.config.trigger.method&&b>=e.config.trigger.value&&e.trigger()})}function s(){h()||_.forEach(function(e){e.mayAutoShow()&&("time_on_site"===e.config.trigger.method&&v.time>=e.config.trigger.value&&e.trigger(),"time_on_page"===e.config.trigger.method&&y.time>=e.config.trigger.value&&e.trigger())})}function a(){var e=(window.scrollY||window.pageYOffset)+.75*window.innerHeight;_.forEach(function(t){if(t.mayAutoShow()&&!(t.triggerHeight<=0))if(e>t.triggerHeight){if(h())return;t.trigger()}else t.mayRehide()&&t.hide()})}function l(){_.forEach(function(e){e.setCustomBoxStyling()})}function c(e){var t=e.offsetX,i=e.offsetY;_.forEach(function(e){var n=e.element.getBoundingClientRect(),o=100+.05*window.innerWidth;(t<n.left-o||t>n.right+o||i<n.top-o||i>n.bottom+o)&&e.dismiss()})}function d(){m||h()||(_.forEach(function(e){e.mayAutoShow()&&"exit_intent"===e.config.trigger.method&&e.trigger()}),m=!0)}function f(e){var t=400;e.clientY<=0&&(p=window.setTimeout(d,t))}function h(){for(var e=0;e<_.length;e++){var t=_[e];if(t.visible)return!0}return!1}function u(){p&&(window.clearInterval(p),p=null)}if(!window.Boxzilla){var g,p,m,v,y,b,w=e("wolfy87-eventemitter"),x=Object.create(w.prototype),E=e("./box.js")(x),z=e("./timer.js"),_=[],L={start:function(){var e=sessionStorage.getItem("boxzilla_timer");e&&(v.time=e),v.start(),y.start()},stop:function(){sessionStorage.setItem("boxzilla_timer",v.time),v.stop(),y.stop()}};x.init=function(){v=new z(sessionStorage.getItem("boxzilla_timer")||0),y=new z(0),b=sessionStorage.getItem("boxzilla_pageviews")||0;var t=e("./styles.js"),i=document.createElement("style");i.setAttribute("type","text/css"),i.innerHTML=t,document.head.appendChild(i),g=document.createElement("div"),g.style.display="none",g.id="boxzilla-overlay",document.body.appendChild(g),window.addEventListener("scroll",n(a)),window.addEventListener("resize",n(l)),window.addEventListener("load",l),g.addEventListener("click",c),window.setInterval(s,1e3),window.setTimeout(r,1e3),document.documentElement.addEventListener("mouseleave",f),document.documentElement.addEventListener("mouseenter",u),document.addEventListener("keyup",o),L.start(),window.addEventListener("focus",L.start),window.addEventListener("beforeunload",function(){L.stop(),sessionStorage.setItem("boxzilla_pageviews",++b)}),window.addEventListener("blur",L.stop),x.trigger("ready")},x.create=function(e,t){var i=new E(e,t);return _.push(i),i},x.get=function(e){for(var t=0;t<_.length;t++){var i=_[t];if(i.id==e)return i}throw new Error("No box exists with ID "+e)},x.dismiss=function(e){"undefined"==typeof e?_.forEach(function(e){e.dismiss()}):"object"===_typeof(_[e])&&x.get(e).dismiss()},x.hide=function(e){"undefined"==typeof e?_.forEach(function(e){e.hide()}):x.get(e).hide()},x.show=function(e){"undefined"==typeof e?_.forEach(function(e){e.show()}):x.get(e).show()},x.toggle=function(e){"undefined"==typeof e?_.forEach(function(e){e.toggle()}):x.get(e).toggle()},x.boxes=_,window.Boxzilla=x,"undefined"!=typeof t&&t.exports&&(t.exports=x)}},{"./box.js":3,"./styles.js":5,"./timer.js":6,"wolfy87-eventemitter":7}],5:[function(e,t,i){var n="body{-webkit-overflow-scrolling:touch!important}#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}";t.exports=n},{}],6:[function(e,t,i){var n=function(e){this.time=e,this.interval=0};n.prototype.tick=function(){this.time++},n.prototype.start=function(){this.interval||(this.interval=window.setInterval(this.tick.bind(this),1e3))},n.prototype.stop=function(){this.interval&&(window.clearInterval(this.interval),this.interval=0)},t.exports=n},{}],7:[function(e,i,n){(function(){function e(){}function n(e,t){for(var i=e.length;i--;)if(e[i].listener===t)return i;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}var r=e.prototype,s=this,a=s.EventEmitter;r.getListeners=function(e){var t,i,n=this._getEvents();if(e instanceof RegExp){t={};for(i in n)n.hasOwnProperty(i)&&e.test(i)&&(t[i]=n[i])}else t=n[e]||(n[e]=[]);return t},r.flattenListeners=function(e){var t,i=[];for(t=0;t<e.length;t+=1)i.push(e[t].listener);return i},r.getListenersAsObject=function(e){var t,i=this.getListeners(e);return i instanceof Array&&(t={},t[e]=i),t||i},r.addListener=function(e,t){var i,o=this.getListenersAsObject(e),r="object"===("undefined"==typeof t?"undefined":_typeof(t));for(i in o)o.hasOwnProperty(i)&&n(o[i],t)===-1&&o[i].push(r?t:{listener:t,once:!1});return this},r.on=o("addListener"),r.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},r.once=o("addOnceListener"),r.defineEvent=function(e){return this.getListeners(e),this},r.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},r.removeListener=function(e,t){var i,o,r=this.getListenersAsObject(e);for(o in r)r.hasOwnProperty(o)&&(i=n(r[o],t),i!==-1&&r[o].splice(i,1));return this},r.off=o("removeListener"),r.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},r.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},r.manipulateListeners=function(e,t,i){var n,o,r=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!==("undefined"==typeof t?"undefined":_typeof(t))||t instanceof RegExp)for(n=i.length;n--;)r.call(this,t,i[n]);else for(n in t)t.hasOwnProperty(n)&&(o=t[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},r.removeEvent=function(e){var t,i="undefined"==typeof e?"undefined":_typeof(e),n=this._getEvents();if("string"===i)delete n[e];else if(e instanceof RegExp)for(t in n)n.hasOwnProperty(t)&&e.test(t)&&delete n[t];else delete this._events;return this},r.removeAllListeners=o("removeEvent"),r.emitEvent=function(e,t){var i,n,o,r,s,a=this.getListenersAsObject(e);for(r in a)if(a.hasOwnProperty(r))for(i=a[r].slice(0),o=i.length;o--;)n=i[o],n.once===!0&&this.removeListener(e,n.listener),s=n.listener.apply(this,t||[]),s===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},r.trigger=o("emitEvent"),r.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},r.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},r._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},r._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"===("undefined"==typeof i?"undefined":_typeof(i))&&i.exports?i.exports=e:s.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=script.min.js.map
1
+ "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(){var t=void 0,e=void 0;!function i(e,n,o){function r(a,l){if(!n[a]){if(!e[a]){var c="function"==typeof t&&t;if(!l&&c)return c(a,!0);if(s)return s(a,!0);var d=new Error("Cannot find module '"+a+"'");throw d.code="MODULE_NOT_FOUND",d}var f=n[a]={exports:{}};e[a][0].call(f.exports,function(t){var i=e[a][1][t];return r(i?i:t)},f,f.exports,i,e,n,o)}return n[a].exports}for(var s="function"==typeof t&&t,a=0;a<o.length;a++)r(o[a]);return r}({1:[function(t,e,i){function n(t,e){e.background_color&&(t.style.background=e.background_color),e.color&&(t.style.color=e.color),e.border_color&&(t.style.borderColor=e.border_color),e.border_width&&(t.style.borderWidth=parseInt(e.border_width)+"px"),e.border_style&&(t.style.borderStyle=e.border_style),e.width&&(t.style.maxWidth=parseInt(e.width)+"px")}var o=t("boxzilla"),r=window.boxzilla_options,s=document.body.className.indexOf("logged-in")>-1;s&&r.testMode&&console.log("Boxzilla: Test mode is enabled. Please disable test mode if you're done testing."),o.init();for(var a=0;a<r.boxes.length;a++){var l=r.boxes[a];if(l.testMode=s&&r.testMode,"https:"===window.location.protocol&&window.location.host){var c="http://"+window.location.host,d=old.replace("http://","https://");l.content=l.content.replace(c,d)}var f=o.create(l.id,l);n(f.element,l.css),f.element.firstChild.firstChild.className+=" first-child",f.element.firstChild.lastChild.className+=" last-child"}window.addEventListener("load",function(){if("object"===_typeof(window.mc4wp_forms_config)&&window.mc4wp_forms_config.submitted_form){var t="#"+window.mc4wp_forms_config.submitted_form.element_id,e=o.boxes;for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(n.element.querySelector(t))return void n.show()}}}),window.Boxzilla=o},{boxzilla:4}],2:[function(t,e,i){function n(t,e){for(var i in e)t.style[i]=e[i]}function o(t,e){for(var i={},n=0;n<t.length;n++)i[t[n]]=e;return i}function r(t,e){for(var i={},n=0;n<t.length;n++)i[t[n]]=e[t[n]];return i}function s(t){return!!t.getAttribute("data-animated")}function a(t,e){var i="none"!=t.style.display||t.offsetLeft>0,s=t.cloneNode(!0),a=function(){t.removeAttribute("data-animated"),t.setAttribute("style",s.getAttribute("style")),t.style.display=i?"none":""};t.setAttribute("data-animated","true"),i||(t.style.display="");var c,d;if("slide"===e){if(c=o(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],0),d={},!i){var f=window.getComputedStyle(t);d=r(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],f),n(t,c)}t.style.overflowY="hidden",l(t,i?c:d,a)}else c={opacity:0},d={opacity:1},i||n(t,c),l(t,i?c:d,a)}function l(t,e,i){var n=+new Date,o=window.getComputedStyle(t),r={},s={};for(var a in e){e[a]=parseFloat(e[a]);var l=e[a],d=parseFloat(o[a]);d!=l?(s[a]=(l-d)/c,r[a]=d):delete e[a]}var f=function h(){var o,a,l,c,d=+new Date,f=d-n,u=!0;for(var g in e){o=s[g],a=e[g],l=o*f,c=r[g]+l,o>0&&c>=a||o<0&&c<=a?c=a:u=!1,r[g]=c;var p="opacity"!==g?"px":"";t.style[g]=c+p}n=+new Date,u?i&&i():window.requestAnimationFrame&&requestAnimationFrame(h)||setTimeout(h,32)};f()}var c=320;e.exports={toggle:a,animate:l,animated:s}},{}],3:[function(t,e,i){function n(t,e){var i={};for(var n in t)i[n]=t[n];for(var n in e)i[n]=e[n];return i}function o(){var t=document.body,e=document.documentElement,i=Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight);return i}var r,s={animation:"fade",rehide:!1,content:"",cookie:null,icon:"&times",minimumScreenWidth:0,position:"center",testMode:!1,trigger:!1,closable:!0},a=t("./animator.js"),l=function(t,e){this.id=t,this.config=n(s,e),this.overlay=document.getElementById("boxzilla-overlay"),this.visible=!1,this.dismissed=!1,this.triggered=!1,this.triggerHeight=0,this.cookieSet=!1,this.element=null,this.closeIcon=null,this.config.trigger&&("percentage"!==this.config.trigger.method&&"element"!==this.config.trigger.method||(this.triggerHeight=this.calculateTriggerHeight()),this.cookieSet=this.isCookieSet()),this.dom(),this.events()};l.prototype.events=function(){var t=this;this.closeIcon&&this.closeIcon.addEventListener("click",t.dismiss.bind(this)),this.element.addEventListener("click",function(e){"A"===e.target.tagName&&r.trigger("box.interactions.link",[t,e.target])},!1),this.element.addEventListener("submit",function(e){t.setCookie(),r.trigger("box.interactions.form",[t,e.target])},!1),window.addEventListener("hashchange",function(){var e="#boxzilla-"+t.id;location.hash===e&&t.toggle()}),this.fits()&&this.locationHashRefersBox()&&window.addEventListener("load",this.show.bind(this))},l.prototype.dom=function(){var t=document.createElement("div");t.className="boxzilla-container boxzilla-"+this.config.position+"-container";var e=document.createElement("div");e.setAttribute("id","boxzilla-"+this.id),e.className="boxzilla boxzilla-"+this.id+" boxzilla-"+this.config.position,e.style.display="none",t.appendChild(e);var i=document.createElement("div");i.className="boxzilla-content",i.innerHTML=this.config.content,e.appendChild(i);var n=i.querySelectorAll("script");if(n.length){for(var o=document.createElement("script"),r=0;r<n.length;r++)o.appendChild(document.createTextNode(n[r].text)),n[r].parentNode.removeChild(n[r]);document.body.appendChild(o)}if(this.config.closable&&this.config.icon){var s=document.createElement("span");s.className="boxzilla-close-icon",s.innerHTML=this.config.icon,e.appendChild(s),this.closeIcon=s}document.body.appendChild(t),this.element=e},l.prototype.setCustomBoxStyling=function(){var t=this.element.style.display;this.element.style.display="",this.element.style.overflowY="auto",this.element.style.maxHeight="none";var e=window.innerHeight,i=this.element.clientHeight;if(i>e&&(this.element.style.maxHeight=e+"px",this.element.style.overflowY="scroll"),"center"===this.config.position){var n=(e-i)/2;n=n>=0?n:0,this.element.style.marginTop=n+"px"}this.element.style.display=t},l.prototype.toggle=function(t){if("undefined"==typeof t&&(t=!this.visible),t===this.visible)return!1;if(a.animated(this.element))return!1;if(!t&&!this.config.closable)return!1;this.visible=t,this.setCustomBoxStyling(),r.trigger("box."+(t?"show":"hide"),[this]),"center"===this.config.position&&(this.overlay.classList.toggle("boxzilla-"+this.id+"-overlay"),a.toggle(this.overlay,"fade")),a.toggle(this.element,this.config.animation);var e=this.element.querySelector("input, textarea");return e&&e.focus(),!0},l.prototype.show=function(){return this.toggle(!0)},l.prototype.hide=function(){return this.toggle(!1)},l.prototype.calculateTriggerHeight=function(){var t=0;if("element"===this.config.trigger.method){var e=document.body.querySelector(this.config.trigger.value);if(e){var i=e.getBoundingClientRect();t=i.top}}else"percentage"===this.config.trigger.method&&(t=this.config.trigger.value/100*o());return t},l.prototype.locationHashRefersBox=function(){if(!window.location.hash||0===window.location.hash.length)return!1;var t=window.location.hash.substring(1);return t===this.element.id||!!this.element.querySelector("#"+t)},l.prototype.fits=function(){return this.config.minimumScreenWidth<=0||window.innerWidth>this.config.minimumScreenWidth},l.prototype.mayAutoShow=function(){return!this.dismissed&&(!!this.fits()&&(!!this.config.trigger&&!this.cookieSet))},l.prototype.mayRehide=function(){return this.config.rehide&&this.triggered},l.prototype.isCookieSet=function(){if(this.config.testMode)return!1;if(!this.config.cookie||!this.config.cookie.triggered&&!this.config.cookie.dismissed)return!1;var t="true"===document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*boxzilla_box_"+this.id+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1");return t},l.prototype.setCookie=function(t){var e=new Date;e.setHours(e.getHours()+t),document.cookie="boxzilla_box_"+this.id+"=true; expires="+e.toUTCString()+"; path=/"},l.prototype.trigger=function(){var t=this.show();t&&(this.triggered=!0,this.config.cookie&&this.config.cookie.triggered&&this.setCookie(this.config.cookie.triggered))},l.prototype.dismiss=function(t){return t&&t.preventDefault(),!!this.visible&&(this.hide(),this.config.cookie&&this.config.cookie.dismissed&&this.setCookie(this.config.cookie.dismissed),this.dismissed=!0,r.trigger("box.dismiss",[this]),!0)},e.exports=function(t){return r=t,l}},{"./animator.js":2}],4:[function(t,e,i){function n(t,e,i){e||(e=250);var n,o;return function(){var r=i||this,s=+new Date,a=arguments;n&&s<n+e?(clearTimeout(o),o=setTimeout(function(){n=s,t.apply(r,a)},e)):(n=s,t.apply(r,a))}}function o(t){27==t.keyCode&&x.dismiss()}function r(){h()||_.forEach(function(t){t.mayAutoShow()&&"pageviews"===t.config.trigger.method&&b>=t.config.trigger.value&&t.trigger()})}function s(){h()||_.forEach(function(t){t.mayAutoShow()&&("time_on_site"===t.config.trigger.method&&v.time>=t.config.trigger.value&&t.trigger(),"time_on_page"===t.config.trigger.method&&y.time>=t.config.trigger.value&&t.trigger())})}function a(){var t=(window.scrollY||window.pageYOffset)+.75*window.innerHeight;_.forEach(function(e){if(e.mayAutoShow()&&!(e.triggerHeight<=0))if(t>e.triggerHeight){if(h())return;e.trigger()}else e.mayRehide()&&e.hide()})}function l(){_.forEach(function(t){t.setCustomBoxStyling()})}function c(t){var e=t.offsetX,i=t.offsetY;_.forEach(function(t){var n=t.element.getBoundingClientRect(),o=100+.05*window.innerWidth;(e<n.left-o||e>n.right+o||i<n.top-o||i>n.bottom+o)&&t.dismiss()})}function d(){m||h()||(_.forEach(function(t){t.mayAutoShow()&&"exit_intent"===t.config.trigger.method&&t.trigger()}),m=!0)}function f(t){var e=400;t.clientY<=0&&(p=window.setTimeout(d,e))}function h(){for(var t=0;t<_.length;t++){var e=_[t];if(e.visible)return!0}return!1}function u(){p&&(window.clearInterval(p),p=null)}if(!window.Boxzilla){var g,p,m,v,y,b,w=t("wolfy87-eventemitter"),x=Object.create(w.prototype),E=t("./box.js")(x),z=t("./timer.js"),_=[],L={start:function(){var t=sessionStorage.getItem("boxzilla_timer");t&&(v.time=t),v.start(),y.start()},stop:function(){sessionStorage.setItem("boxzilla_timer",v.time),v.stop(),y.stop()}};x.init=function(){v=new z(sessionStorage.getItem("boxzilla_timer")||0),y=new z(0),b=sessionStorage.getItem("boxzilla_pageviews")||0;var e=t("./styles.js"),i=document.createElement("style");i.setAttribute("type","text/css"),i.innerHTML=e,document.head.appendChild(i),g=document.createElement("div"),g.style.display="none",g.id="boxzilla-overlay",document.body.appendChild(g),window.addEventListener("touchmove",n(a)),window.addEventListener("scroll",n(a)),window.addEventListener("resize",n(l)),window.addEventListener("load",l),g.addEventListener("click",c),window.setInterval(s,1e3),window.setTimeout(r,1e3),document.documentElement.addEventListener("mouseleave",f),document.documentElement.addEventListener("mouseenter",u),document.addEventListener("keyup",o),L.start(),window.addEventListener("focus",L.start),window.addEventListener("beforeunload",function(){L.stop(),sessionStorage.setItem("boxzilla_pageviews",++b)}),window.addEventListener("blur",L.stop),x.trigger("ready")},x.create=function(t,e){var i=new E(t,e);return _.push(i),i},x.get=function(t){for(var e=0;e<_.length;e++){var i=_[e];if(i.id==t)return i}throw new Error("No box exists with ID "+t)},x.dismiss=function(t){"undefined"==typeof t?_.forEach(function(t){t.dismiss()}):"object"===_typeof(_[t])&&x.get(t).dismiss()},x.hide=function(t){"undefined"==typeof t?_.forEach(function(t){t.hide()}):x.get(t).hide()},x.show=function(t){"undefined"==typeof t?_.forEach(function(t){t.show()}):x.get(t).show()},x.toggle=function(t){"undefined"==typeof t?_.forEach(function(t){t.toggle()}):x.get(t).toggle()},x.boxes=_,window.Boxzilla=x,"undefined"!=typeof e&&e.exports&&(e.exports=x)}},{"./box.js":3,"./styles.js":5,"./timer.js":6,"wolfy87-eventemitter":7}],5:[function(t,e,i){var n="#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}";e.exports=n},{}],6:[function(t,e,i){var n=function(t){this.time=t,this.interval=0};n.prototype.tick=function(){this.time++},n.prototype.start=function(){this.interval||(this.interval=window.setInterval(this.tick.bind(this),1e3))},n.prototype.stop=function(){this.interval&&(window.clearInterval(this.interval),this.interval=0)},e.exports=n},{}],7:[function(t,i,n){(function(){function t(){}function n(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function o(t){return function(){return this[t].apply(this,arguments)}}var r=t.prototype,s=this,a=s.EventEmitter;r.getListeners=function(t){var e,i,n=this._getEvents();if(t instanceof RegExp){e={};for(i in n)n.hasOwnProperty(i)&&t.test(i)&&(e[i]=n[i])}else e=n[t]||(n[t]=[]);return e},r.flattenListeners=function(t){var e,i=[];for(e=0;e<t.length;e+=1)i.push(t[e].listener);return i},r.getListenersAsObject=function(t){var e,i=this.getListeners(t);return i instanceof Array&&(e={},e[t]=i),e||i},r.addListener=function(t,e){var i,o=this.getListenersAsObject(t),r="object"===("undefined"==typeof e?"undefined":_typeof(e));for(i in o)o.hasOwnProperty(i)&&n(o[i],e)===-1&&o[i].push(r?e:{listener:e,once:!1});return this},r.on=o("addListener"),r.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},r.once=o("addOnceListener"),r.defineEvent=function(t){return this.getListeners(t),this},r.defineEvents=function(t){for(var e=0;e<t.length;e+=1)this.defineEvent(t[e]);return this},r.removeListener=function(t,e){var i,o,r=this.getListenersAsObject(t);for(o in r)r.hasOwnProperty(o)&&(i=n(r[o],e),i!==-1&&r[o].splice(i,1));return this},r.off=o("removeListener"),r.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},r.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},r.manipulateListeners=function(t,e,i){var n,o,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!==("undefined"==typeof e?"undefined":_typeof(e))||e instanceof RegExp)for(n=i.length;n--;)r.call(this,e,i[n]);else for(n in e)e.hasOwnProperty(n)&&(o=e[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},r.removeEvent=function(t){var e,i="undefined"==typeof t?"undefined":_typeof(t),n=this._getEvents();if("string"===i)delete n[t];else if(t instanceof RegExp)for(e in n)n.hasOwnProperty(e)&&t.test(e)&&delete n[e];else delete this._events;return this},r.removeAllListeners=o("removeEvent"),r.emitEvent=function(t,e){var i,n,o,r,s,a=this.getListenersAsObject(t);for(r in a)if(a.hasOwnProperty(r))for(i=a[r].slice(0),o=i.length;o--;)n=i[o],n.once===!0&&this.removeListener(t,n.listener),s=n.listener.apply(this,e||[]),s===this._getOnceReturnValue()&&this.removeListener(t,n.listener);return this},r.trigger=o("emitEvent"),r.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},r.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},r._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},r._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return s.EventEmitter=a,t},"function"==typeof e&&e.amd?e(function(){return t}):"object"===("undefined"==typeof i?"undefined":_typeof(i))&&i.exports?i.exports=t:s.EventEmitter=t}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=script.min.js.map
assets/js/script.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["script.js"],"names":["_typeof","Symbol","iterator","obj","constructor","require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","css","element","styles","background_color","style","background","color","border_color","borderColor","border_width","borderWidth","parseInt","border_style","borderStyle","width","maxWidth","Boxzilla","options","window","boxzilla_options","isLoggedIn","document","body","className","indexOf","testMode","console","log","init","boxes","boxOpts","location","origin","substring","content","replace","box","create","id","firstChild","lastChild","addEventListener","mc4wp_forms_config","submitted_form","selector","element_id","boxId","hasOwnProperty","querySelector","show","boxzilla","2","property","initObjectProperties","properties","value","newObject","copyObjectProperties","object","animated","getAttribute","toggle","animation","nowVisible","display","offsetLeft","clone","cloneNode","cleanup","removeAttribute","setAttribute","hiddenStyles","visibleStyles","computedStyles","getComputedStyle","overflowY","animate","opacity","targetStyles","fn","last","Date","initialStyles","currentStyles","propSteps","parseFloat","to","current","duration","tick","step","increment","newValue","now","timeSinceLastTick","done","suffix","requestAnimationFrame","setTimeout","3","merge","obj1","obj2","obj3","attrname","getDocumentHeight","html","documentElement","height","Math","max","scrollHeight","offsetHeight","clientHeight","defaults","rehide","cookie","icon","minimumScreenWidth","position","trigger","closable","Animator","Box","config","this","overlay","getElementById","visible","dismissed","triggered","triggerHeight","cookieSet","closeIcon","method","calculateTriggerHeight","isCookieSet","dom","events","prototype","dismiss","bind","target","tagName","setCookie","needle","hash","fits","locationHashRefersBox","wrapper","createElement","appendChild","innerHTML","scripts","querySelectorAll","script","createTextNode","text","parentNode","removeChild","setCustomBoxStyling","origDisplay","maxHeight","windowHeight","innerHeight","boxHeight","newTopMargin","marginTop","firstInput","focus","hide","triggerElement","offset","getBoundingClientRect","top","elementId","innerWidth","mayAutoShow","mayRehide","RegExp","hours","expiryDate","setHours","getHours","toUTCString","shown","preventDefault","_Boxzilla","./animator.js","4","throttle","threshhold","scope","deferTimer","context","args","arguments","clearTimeout","apply","onKeyUp","keyCode","checkPageViewsCriteria","isAnyBoxVisible","forEach","pageViews","checkTimeCriteria","siteTimer","time","pageTimer","checkHeightCriteria","scrollY","pageYOffset","recalculateHeights","onOverlayClick","x","offsetX","y","offsetY","rect","margin","left","right","bottom","triggerExitIntent","exitIntentTriggered","onMouseLeave","delay","clientY","exitIntentDelayTimer","onMouseEnter","clearInterval","EventEmitter","Object","Timer","timers","start","sessionTime","sessionStorage","getItem","stop","setItem","styleElement","head","setInterval","opts","push","get","./box.js","./styles.js","./timer.js","wolfy87-eventemitter","5","6","interval","7","indexOfListener","listeners","listener","alias","name","proto","originalGlobalValue","getListeners","evt","response","key","_getEvents","test","flattenListeners","flatListeners","getListenersAsObject","Array","addListener","listenerIsWrapped","once","on","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","type","_events","removeAllListeners","emitEvent","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"AAAA,YAEA,IAAIA,SAA4B,kBAAXC,SAAoD,gBAApBA,QAAOC,SAAwB,SAAUC,GAAO,aAAcA,IAAS,SAAUA,GAAO,MAAOA,IAAyB,kBAAXF,SAAyBE,EAAIC,cAAgBH,OAAS,eAAkBE,KAE1O,WACI,GAAIE,GAAUC,OAA6DC,EAASD,QAAU,QAAUE,GAAEC,EAAGC,EAAGC,GAC5G,QAASC,GAAEC,EAAGC,GACV,IAAKJ,EAAEG,GAAI,CACP,IAAKJ,EAAEI,GAAI,CACP,GAAIE,GAAsB,kBAAXV,IAAyBA,CAAQ,KAAKS,GAAKC,EAAG,MAAOA,GAAEF,GAAG,EAAI,IAAIG,EAAG,MAAOA,GAAEH,GAAG,EAAI,IAAII,GAAI,GAAIC,OAAM,uBAAyBL,EAAI,IAAK,M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AQ4O,aAAe8B,EAChB9B,GAIW,kBAAX1P,IAAyBA,EAAOiU,IACvCjU,EAAO,WACH,MAAO0P,KAEgE,YAAjD,mBAAXxO,GAAyB,YAAczB,QAAQyB,KAAyBA,EAAOJ,QAC9FI,EAAOJ,QAAU4O,EAEjB5O,EAAQ4O,aAAeA,IAE5B3O,KAAKiI,gBACG","file":"script.min.js","sourcesContent":["\"use strict\";\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\n(function () {\n var require = undefined;var module = undefined;var exports = undefined;var define = undefined;(function e(t, n, r) {\n function s(o, u) {\n if (!n[o]) {\n if (!t[o]) {\n 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;\n }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {\n var n = t[o][1][e];return s(n ? n : e);\n }, l, l.exports, e, t, n, r);\n }return n[o].exports;\n }var i = typeof require == \"function\" && require;for (var o = 0; o < r.length; o++) {\n s(r[o]);\n }return s;\n })({ 1: [function (require, module, exports) {\n 'use strict';\n\n var Boxzilla = require('boxzilla');\n var options = window.boxzilla_options;\n var isLoggedIn = document.body.className.indexOf('logged-in') > -1;\n\n // print message when test mode is enabled\n if (isLoggedIn && options.testMode) {\n console.log('Boxzilla: Test mode is enabled. Please disable test mode if you\\'re done testing.');\n }\n\n // init boxzilla\n Boxzilla.init();\n\n // create boxes from options\n for (var i = 0; i < options.boxes.length; i++) {\n // get opts\n var boxOpts = options.boxes[i];\n boxOpts.testMode = isLoggedIn && options.testMode;\n\n // fix http:// links in box content....\n if (window.location.origin.substring(0, 5) === \"https\") {\n boxOpts.content = boxOpts.content.replace(window.location.origin.replace(\"https\", \"http\"), window.location.origin);\n }\n\n // create box\n var box = Boxzilla.create(boxOpts.id, boxOpts);\n\n // add custom css to box\n css(box.element, boxOpts.css);\n\n box.element.firstChild.firstChild.className += \" first-child\";\n box.element.firstChild.lastChild.className += \" last-child\";\n }\n\n // helper function for setting CSS styles\n function css(element, styles) {\n if (styles.background_color) {\n element.style.background = styles.background_color;\n }\n\n if (styles.color) {\n element.style.color = styles.color;\n }\n\n if (styles.border_color) {\n element.style.borderColor = styles.border_color;\n }\n\n if (styles.border_width) {\n element.style.borderWidth = parseInt(styles.border_width) + \"px\";\n }\n\n if (styles.border_style) {\n element.style.borderStyle = styles.border_style;\n }\n\n if (styles.width) {\n element.style.maxWidth = parseInt(styles.width) + \"px\";\n }\n }\n\n /**\n * If a MailChimp for WordPress form was submitted, open the box containing that form (if any)\n *\n * TODO: Just set location hash from MailChimp for WP?\n */\n window.addEventListener('load', function () {\n if (_typeof(window.mc4wp_forms_config) === \"object\" && window.mc4wp_forms_config.submitted_form) {\n var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;\n var boxes = Boxzilla.boxes;\n for (var boxId in boxes) {\n if (!boxes.hasOwnProperty(boxId)) {\n continue;\n }\n var box = boxes[boxId];\n if (box.element.querySelector(selector)) {\n box.show();\n return;\n }\n }\n }\n });\n\n window.Boxzilla = Boxzilla;\n }, { \"boxzilla\": 4 }], 2: [function (require, module, exports) {\n var duration = 320;\n\n function css(element, styles) {\n for (var property in styles) {\n element.style[property] = styles[property];\n }\n }\n\n function initObjectProperties(properties, value) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = value;\n }\n return newObject;\n }\n\n function copyObjectProperties(properties, object) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = object[properties[i]];\n }\n return newObject;\n }\n\n /**\n * Checks if the given element is currently being animated.\n *\n * @param element\n * @returns {boolean}\n */\n function animated(element) {\n return !!element.getAttribute('data-animated');\n }\n\n /**\n * Toggles the element using the given animation.\n *\n * @param element\n * @param animation Either \"fade\" or \"slide\"\n */\n function toggle(element, animation) {\n var nowVisible = element.style.display != 'none' || element.offsetLeft > 0;\n\n // create clone for reference\n var clone = element.cloneNode(true);\n var cleanup = function cleanup() {\n element.removeAttribute('data-animated');\n element.setAttribute('style', clone.getAttribute('style'));\n element.style.display = nowVisible ? 'none' : '';\n };\n\n // store attribute so everyone knows we're animating this element\n element.setAttribute('data-animated', \"true\");\n\n // toggle element visiblity right away if we're making something visible\n if (!nowVisible) {\n element.style.display = '';\n }\n\n var hiddenStyles, visibleStyles;\n\n // animate properties\n if (animation === 'slide') {\n hiddenStyles = initObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], 0);\n visibleStyles = {};\n\n if (!nowVisible) {\n var computedStyles = window.getComputedStyle(element);\n visibleStyles = copyObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], computedStyles);\n css(element, hiddenStyles);\n }\n\n // don't show a scrollbar during animation\n element.style.overflowY = 'hidden';\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n } else {\n hiddenStyles = { opacity: 0 };\n visibleStyles = { opacity: 1 };\n if (!nowVisible) {\n css(element, hiddenStyles);\n }\n\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n }\n }\n\n function animate(element, targetStyles, fn) {\n var last = +new Date();\n var initialStyles = window.getComputedStyle(element);\n var currentStyles = {};\n var propSteps = {};\n\n for (var property in targetStyles) {\n // make sure we have an object filled with floats\n targetStyles[property] = parseFloat(targetStyles[property]);\n\n // calculate step size & current value\n var to = targetStyles[property];\n var current = parseFloat(initialStyles[property]);\n\n // is there something to do?\n if (current == to) {\n delete targetStyles[property];\n continue;\n }\n\n propSteps[property] = (to - current) / duration; // points per second\n currentStyles[property] = current;\n }\n\n var tick = function tick() {\n var now = +new Date();\n var timeSinceLastTick = now - last;\n var done = true;\n\n var step, to, increment, newValue;\n for (var property in targetStyles) {\n step = propSteps[property];\n to = targetStyles[property];\n increment = step * timeSinceLastTick;\n newValue = currentStyles[property] + increment;\n\n if (step > 0 && newValue >= to || step < 0 && newValue <= to) {\n newValue = to;\n } else {\n done = false;\n }\n\n // store new value\n currentStyles[property] = newValue;\n\n var suffix = property !== \"opacity\" ? \"px\" : \"\";\n element.style[property] = newValue + suffix;\n }\n\n last = +new Date();\n\n // keep going until we're done for all props\n if (!done) {\n window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);\n } else {\n // call callback\n fn && fn();\n }\n };\n\n tick();\n }\n\n module.exports = {\n 'toggle': toggle,\n 'animate': animate,\n 'animated': animated\n };\n }, {}], 3: [function (require, module, exports) {\n 'use strict';\n\n var defaults = {\n 'animation': 'fade',\n 'rehide': false,\n 'content': '',\n 'cookie': null,\n 'icon': '&times',\n 'minimumScreenWidth': 0,\n 'position': 'center',\n 'testMode': false,\n 'trigger': false,\n 'closable': true\n },\n Boxzilla,\n Animator = require('./animator.js');\n\n /**\n * Merge 2 objects, values of the latter overwriting the former.\n *\n * @param obj1\n * @param obj2\n * @returns {*}\n */\n function merge(obj1, obj2) {\n var obj3 = {};\n for (var attrname in obj1) {\n obj3[attrname] = obj1[attrname];\n }\n for (var attrname in obj2) {\n obj3[attrname] = obj2[attrname];\n }\n return obj3;\n }\n\n /**\n * Get the real height of entire document.\n * @returns {number}\n */\n function getDocumentHeight() {\n var body = document.body,\n html = document.documentElement;\n\n var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n\n return height;\n }\n\n // Box Object\n var Box = function Box(id, config) {\n this.id = id;\n\n // store config values\n this.config = merge(defaults, config);\n\n // store ref to overlay\n this.overlay = document.getElementById('boxzilla-overlay');\n\n // state\n this.visible = false;\n this.dismissed = false;\n this.triggered = false;\n this.triggerHeight = 0;\n this.cookieSet = false;\n this.element = null;\n this.closeIcon = null;\n\n // if a trigger was given, calculate values once and store\n if (this.config.trigger) {\n if (this.config.trigger.method === 'percentage' || this.config.trigger.method === 'element') {\n this.triggerHeight = this.calculateTriggerHeight();\n }\n\n this.cookieSet = this.isCookieSet();\n }\n\n // create dom elements for this box\n this.dom();\n\n // further initialise the box\n this.events();\n };\n\n // initialise the box\n Box.prototype.events = function () {\n var box = this;\n\n // attach event to \"close\" icon inside box\n this.closeIcon && this.closeIcon.addEventListener('click', box.dismiss.bind(this));\n\n this.element.addEventListener('click', function (e) {\n if (e.target.tagName === 'A') {\n Boxzilla.trigger('box.interactions.link', [box, e.target]);\n }\n }, false);\n\n this.element.addEventListener('submit', function (e) {\n box.setCookie();\n Boxzilla.trigger('box.interactions.form', [box, e.target]);\n }, false);\n\n window.addEventListener(\"hashchange\", function () {\n var needle = \"#boxzilla-\" + box.id;\n if (location.hash === needle) {\n box.toggle();\n }\n });\n\n // maybe show box right away\n if (this.fits() && this.locationHashRefersBox()) {\n window.addEventListener('load', this.show.bind(this));\n }\n };\n\n // generate dom elements for this box\n Box.prototype.dom = function () {\n var wrapper = document.createElement('div');\n wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';\n\n var box = document.createElement('div');\n box.setAttribute('id', 'boxzilla-' + this.id);\n box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;\n box.style.display = 'none';\n wrapper.appendChild(box);\n\n var content = document.createElement('div');\n content.className = 'boxzilla-content';\n content.innerHTML = this.config.content;\n box.appendChild(content);\n\n // remove <script> from box content and append them to the document body\n var scripts = content.querySelectorAll('script');\n if (scripts.length) {\n var script = document.createElement('script');\n for (var i = 0; i < scripts.length; i++) {\n script.appendChild(document.createTextNode(scripts[i].text));\n scripts[i].parentNode.removeChild(scripts[i]);\n }\n document.body.appendChild(script);\n }\n\n if (this.config.closable && this.config.icon) {\n var closeIcon = document.createElement('span');\n closeIcon.className = \"boxzilla-close-icon\";\n closeIcon.innerHTML = this.config.icon;\n box.appendChild(closeIcon);\n this.closeIcon = closeIcon;\n }\n\n document.body.appendChild(wrapper);\n this.element = box;\n };\n\n // set (calculate) custom box styling depending on box options\n Box.prototype.setCustomBoxStyling = function () {\n\n // reset element to its initial state\n var origDisplay = this.element.style.display;\n this.element.style.display = '';\n this.element.style.overflowY = 'auto';\n this.element.style.maxHeight = 'none';\n\n // get new dimensions\n var windowHeight = window.innerHeight;\n var boxHeight = this.element.clientHeight;\n\n // add scrollbar to box and limit height\n if (boxHeight > windowHeight) {\n this.element.style.maxHeight = windowHeight + \"px\";\n this.element.style.overflowY = 'scroll';\n }\n\n // set new top margin for boxes which are centered\n if (this.config.position === 'center') {\n var newTopMargin = (windowHeight - boxHeight) / 2;\n newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;\n this.element.style.marginTop = newTopMargin + \"px\";\n }\n\n this.element.style.display = origDisplay;\n };\n\n // toggle visibility of the box\n Box.prototype.toggle = function (show) {\n\n // revert visibility if no explicit argument is given\n if (typeof show === \"undefined\") {\n show = !this.visible;\n }\n\n // is box already at desired visibility?\n if (show === this.visible) {\n return false;\n }\n\n // is box being animated?\n if (Animator.animated(this.element)) {\n return false;\n }\n\n // if box should be hidden but is not closable, bail.\n if (!show && !this.config.closable) {\n return false;\n }\n\n // set new visibility status\n this.visible = show;\n\n // calculate new styling rules\n this.setCustomBoxStyling();\n\n // trigger event\n Boxzilla.trigger('box.' + (show ? 'show' : 'hide'), [this]);\n\n // show or hide box using selected animation\n if (this.config.position === 'center') {\n Animator.toggle(this.overlay, \"fade\");\n }\n\n Animator.toggle(this.element, this.config.animation);\n\n // focus on first input field in box\n var firstInput = this.element.querySelector('input, textarea');\n if (firstInput) {\n firstInput.focus();\n }\n\n return true;\n };\n\n // show the box\n Box.prototype.show = function () {\n return this.toggle(true);\n };\n\n // hide the box\n Box.prototype.hide = function () {\n return this.toggle(false);\n };\n\n // calculate trigger height\n Box.prototype.calculateTriggerHeight = function () {\n var triggerHeight = 0;\n\n if (this.config.trigger.method === 'element') {\n var triggerElement = document.body.querySelector(this.config.trigger.value);\n if (triggerElement) {\n var offset = triggerElement.getBoundingClientRect();\n triggerHeight = offset.top;\n }\n } else if (this.config.trigger.method === 'percentage') {\n triggerHeight = this.config.trigger.value / 100 * getDocumentHeight();\n }\n\n return triggerHeight;\n };\n\n // checks whether window.location.hash equals the box element ID or that of any element inside the box\n Box.prototype.locationHashRefersBox = function () {\n\n if (!window.location.hash || 0 === window.location.hash.length) {\n return false;\n }\n\n var elementId = window.location.hash.substring(1);\n if (elementId === this.element.id) {\n return true;\n } else if (this.element.querySelector('#' + elementId)) {\n return true;\n }\n\n return false;\n };\n\n Box.prototype.fits = function () {\n if (this.config.minimumScreenWidth <= 0) {\n return true;\n }\n\n return window.innerWidth > this.config.minimumScreenWidth;\n };\n\n // is this box enabled?\n Box.prototype.mayAutoShow = function () {\n\n if (this.dismissed) {\n return false;\n }\n\n // check if box fits on given minimum screen width\n if (!this.fits()) {\n return false;\n }\n\n // if trigger empty or error in calculating triggerHeight, return false\n if (!this.config.trigger) {\n return false;\n }\n\n // rely on cookie value (show if not set, don't show if set)\n return !this.cookieSet;\n };\n\n Box.prototype.mayRehide = function () {\n return this.config.rehide && this.triggered;\n };\n\n Box.prototype.isCookieSet = function () {\n // always show on test mode\n if (this.config.testMode) {\n return false;\n }\n\n // if either cookie is null or trigger & dismiss are both falsey, don't bother checking.\n if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {\n return false;\n }\n\n var cookieSet = document.cookie.replace(new RegExp(\"(?:(?:^|.*;)\\\\s*\" + 'boxzilla_box_' + this.id + \"\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$\"), \"$1\") === \"true\";\n return cookieSet;\n };\n\n // set cookie that disables automatically showing the box\n Box.prototype.setCookie = function (hours) {\n var expiryDate = new Date();\n expiryDate.setHours(expiryDate.getHours() + hours);\n document.cookie = 'boxzilla_box_' + this.id + '=true; expires=' + expiryDate.toUTCString() + '; path=/';\n };\n\n Box.prototype.trigger = function () {\n var shown = this.show();\n if (!shown) {\n return;\n }\n\n this.triggered = true;\n if (this.config.cookie && this.config.cookie.triggered) {\n this.setCookie(this.config.cookie.triggered);\n }\n };\n\n /**\n * Dismisses the box and optionally sets a cookie.\n *\n * @param e The event that triggered this dismissal.\n * @returns {boolean}\n */\n Box.prototype.dismiss = function (e) {\n // prevent default action\n e && e.preventDefault();\n\n // only dismiss box if it's currently open.\n if (!this.visible) {\n return false;\n }\n\n // hide box element\n this.hide();\n\n // set cookie\n if (this.config.cookie && this.config.cookie.dismissed) {\n this.setCookie(this.config.cookie.dismissed);\n }\n\n this.dismissed = true;\n Boxzilla.trigger('box.dismiss', [this]);\n return true;\n };\n\n module.exports = function (_Boxzilla) {\n Boxzilla = _Boxzilla;\n return Box;\n };\n }, { \"./animator.js\": 2 }], 4: [function (require, module, exports) {\n 'use strict';\n\n // failsafe against loading script twice...\n\n if (window.Boxzilla) {\n return;\n }\n\n var EventEmitter = require('wolfy87-eventemitter'),\n Boxzilla = Object.create(EventEmitter.prototype),\n Box = require('./box.js')(Boxzilla),\n Timer = require('./timer.js'),\n boxes = [],\n overlay,\n exitIntentDelayTimer,\n exitIntentTriggered,\n siteTimer,\n pageTimer,\n pageViews;\n\n function throttle(fn, threshhold, scope) {\n threshhold || (threshhold = 250);\n var last, deferTimer;\n return function () {\n var context = scope || this;\n\n var now = +new Date(),\n args = arguments;\n if (last && now < last + threshhold) {\n // hold on to it\n clearTimeout(deferTimer);\n deferTimer = setTimeout(function () {\n last = now;\n fn.apply(context, args);\n }, threshhold);\n } else {\n last = now;\n fn.apply(context, args);\n }\n };\n }\n\n // \"keyup\" listener\n function onKeyUp(e) {\n if (e.keyCode == 27) {\n Boxzilla.dismiss();\n }\n }\n\n // check \"pageviews\" criteria for each box\n function checkPageViewsCriteria() {\n\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {\n box.trigger();\n }\n });\n }\n\n // check time trigger criteria for each box\n function checkTimeCriteria() {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n // check \"time on site\" trigger\n if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n\n // check \"time on page\" trigger\n if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n });\n }\n\n // check triggerHeight criteria for all boxes\n function checkHeightCriteria() {\n var scrollY = (window.scrollY || window.pageYOffset) + window.innerHeight * 0.75;\n\n boxes.forEach(function (box) {\n\n if (!box.mayAutoShow() || box.triggerHeight <= 0) {\n return;\n }\n\n if (scrollY > box.triggerHeight) {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n // trigger box\n box.trigger();\n } else if (box.mayRehide()) {\n box.hide();\n }\n });\n }\n\n // recalculate heights and variables based on height\n function recalculateHeights() {\n boxes.forEach(function (box) {\n box.setCustomBoxStyling();\n });\n }\n\n function onOverlayClick(e) {\n var x = e.offsetX;\n var y = e.offsetY;\n\n // calculate if click was near a box to avoid closing it (click error margin)\n boxes.forEach(function (box) {\n var rect = box.element.getBoundingClientRect();\n var margin = 100 + window.innerWidth * 0.05;\n\n // if click was not anywhere near box, dismiss it.\n if (x < rect.left - margin || x > rect.right + margin || y < rect.top - margin || y > rect.bottom + margin) {\n box.dismiss();\n }\n });\n }\n\n function triggerExitIntent() {\n // do nothing if already triggered OR another box is visible.\n if (exitIntentTriggered || isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {\n box.trigger();\n }\n });\n\n exitIntentTriggered = true;\n }\n\n function onMouseLeave(e) {\n var delay = 400;\n\n // did mouse leave at top of window?\n if (e.clientY <= 0) {\n exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);\n }\n }\n\n function isAnyBoxVisible() {\n\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n\n if (box.visible) {\n return true;\n }\n }\n\n return false;\n }\n\n function onMouseEnter() {\n if (exitIntentDelayTimer) {\n window.clearInterval(exitIntentDelayTimer);\n exitIntentDelayTimer = null;\n }\n }\n\n var timers = {\n start: function start() {\n var sessionTime = sessionStorage.getItem('boxzilla_timer');\n if (sessionTime) siteTimer.time = sessionTime;\n siteTimer.start();\n pageTimer.start();\n },\n stop: function stop() {\n sessionStorage.setItem('boxzilla_timer', siteTimer.time);\n siteTimer.stop();\n pageTimer.stop();\n }\n };\n\n // initialise & add event listeners\n Boxzilla.init = function () {\n siteTimer = new Timer(sessionStorage.getItem('boxzilla_timer') || 0);\n pageTimer = new Timer(0);\n pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;\n\n // insert styles into DOM\n var styles = require('./styles.js');\n var styleElement = document.createElement('style');\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = styles;\n document.head.appendChild(styleElement);\n\n // add overlay element to dom\n overlay = document.createElement('div');\n overlay.style.display = 'none';\n overlay.id = 'boxzilla-overlay';\n document.body.appendChild(overlay);\n\n // event binds\n window.addEventListener('scroll', throttle(checkHeightCriteria));\n window.addEventListener('resize', throttle(recalculateHeights));\n window.addEventListener('load', recalculateHeights);\n overlay.addEventListener('click', onOverlayClick);\n window.setInterval(checkTimeCriteria, 1000);\n window.setTimeout(checkPageViewsCriteria, 1000);\n document.documentElement.addEventListener('mouseleave', onMouseLeave);\n document.documentElement.addEventListener('mouseenter', onMouseEnter);\n document.addEventListener('keyup', onKeyUp);\n\n timers.start();\n window.addEventListener('focus', timers.start);\n window.addEventListener('beforeunload', function () {\n timers.stop();\n sessionStorage.setItem('boxzilla_pageviews', ++pageViews);\n });\n window.addEventListener('blur', timers.stop);\n\n Boxzilla.trigger('ready');\n };\n\n /**\n * Create a new Box\n *\n * @param string id\n * @param object opts\n *\n * @returns Box\n */\n Boxzilla.create = function (id, opts) {\n var box = new Box(id, opts);\n boxes.push(box);\n return box;\n };\n\n Boxzilla.get = function (id) {\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n if (box.id == id) {\n return box;\n }\n }\n\n throw new Error(\"No box exists with ID \" + id);\n };\n\n // dismiss a single box (or all by omitting id param)\n Boxzilla.dismiss = function (id) {\n // if no id given, dismiss all current open boxes\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.dismiss();\n });\n } else if (_typeof(boxes[id]) === \"object\") {\n Boxzilla.get(id).dismiss();\n }\n };\n\n Boxzilla.hide = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.hide();\n });\n } else {\n Boxzilla.get(id).hide();\n }\n };\n\n Boxzilla.show = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.show();\n });\n } else {\n Boxzilla.get(id).show();\n }\n };\n\n Boxzilla.toggle = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.toggle();\n });\n } else {\n Boxzilla.get(id).toggle();\n }\n };\n\n // expose each individual box.\n Boxzilla.boxes = boxes;\n\n window.Boxzilla = Boxzilla;\n\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = Boxzilla;\n }\n }, { \"./box.js\": 3, \"./styles.js\": 5, \"./timer.js\": 6, \"wolfy87-eventemitter\": 7 }], 5: [function (require, module, exports) {\n var styles = \"body{-webkit-overflow-scrolling:touch!important}#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}\";\n module.exports = styles;\n }, {}], 6: [function (require, module, exports) {\n 'use strict';\n\n var Timer = function Timer(start) {\n this.time = start;\n this.interval = 0;\n };\n\n Timer.prototype.tick = function () {\n this.time++;\n };\n\n Timer.prototype.start = function () {\n if (!this.interval) {\n this.interval = window.setInterval(this.tick.bind(this), 1000);\n }\n };\n\n Timer.prototype.stop = function () {\n if (this.interval) {\n window.clearInterval(this.interval);\n this.interval = 0;\n }\n };\n\n module.exports = Timer;\n }, {}], 7: [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\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 } 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 === \"undefined\" ? \"undefined\" : _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 === \"undefined\" ? \"undefined\" : _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 } else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\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 === \"undefined\" ? \"undefined\" : _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 } 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 } 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 } 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 } else if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) === 'object' && module.exports) {\n module.exports = EventEmitter;\n } else {\n exports.EventEmitter = EventEmitter;\n }\n }).call(this);\n }, {}] }, {}, [1]);\n ;\n})();"],"sourceRoot":"/source/"}
1
+ {"version":3,"sources":["script.js"],"names":["_typeof","Symbol","iterator","obj","constructor","prototype","require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","css","element","styles","background_color","style","background","color","border_color","borderColor","border_width","borderWidth","parseInt","border_style","borderStyle","width","maxWidth","Boxzilla","options","window","boxzilla_options","isLoggedIn","document","body","className","indexOf","testMode","console","log","init","boxes","boxOpts","location","protocol","host","old","replace","content","box","create","id","firstChild","lastChild","addEventListener","mc4wp_forms_config","submitted_form","selector","element_id","boxId","hasOwnProperty","querySelector","show","boxzilla","2","property","initObjectProperties","properties","value","newObject","copyObjectProperties","object","animated","getAttribute","toggle","animation","nowVisible","display","offsetLeft","clone","cloneNode","cleanup","removeAttribute","setAttribute","hiddenStyles","visibleStyles","computedStyles","getComputedStyle","overflowY","animate","opacity","targetStyles","fn","last","Date","initialStyles","currentStyles","propSteps","parseFloat","to","current","duration","tick","step","increment","newValue","now","timeSinceLastTick","done","suffix","requestAnimationFrame","setTimeout","3","merge","obj1","obj2","obj3","attrname","getDocumentHeight","html","documentElement","height","Math","max","scrollHeight","offsetHeight","clientHeight","defaults","rehide","cookie","icon","minimumScreenWidth","position","trigger","closable","Animator","Box","config","this","overlay","getElementById","visible","dismissed","triggered","triggerHeight","cookieSet","closeIcon","method","calculateTriggerHeight","isCookieSet","dom","events","dismiss","bind","target","tagName","setCookie","needle","hash","fits","locationHashRefersBox","wrapper","createElement","appendChild","innerHTML","scripts","querySelectorAll","script","createTextNode","text","parentNode","removeChild","setCustomBoxStyling","origDisplay","maxHeight","windowHeight","innerHeight","boxHeight","newTopMargin","marginTop","classList","firstInput","focus","hide","triggerElement","offset","getBoundingClientRect","top","elementId","substring","innerWidth","mayAutoShow","mayRehide","RegExp","hours","expiryDate","setHours","getHours","toUTCString","shown","preventDefault","_Boxzilla","./animator.js","4","throttle","threshhold","scope","deferTimer","context","args","arguments","clearTimeout","apply","onKeyUp","keyCode","checkPageViewsCriteria","isAnyBoxVisible","forEach","pageViews","checkTimeCriteria","siteTimer","time","pageTimer","checkHeightCriteria","scrollY","pageYOffset","recalculateHeights","onOverlayClick","x","offsetX","y","offsetY","rect","margin","left","right","bottom","triggerExitIntent","exitIntentTriggered","onMouseLeave","delay","clientY","exitIntentDelayTimer","onMouseEnter","clearInterval","EventEmitter","Object","Timer","timers","start","sessionTime","sessionStorage","getItem","stop","setItem","styleElement","head","setInterval","opts","push","get","./box.js","./styles.js","./timer.js","wolfy87-eventemitter","5","6","interval","7","indexOfListener","listeners","listener","alias","name","proto","originalGlobalValue","getListeners","evt","response","key","_getEvents","test","flattenListeners","flatListeners","getListenersAsObject","Array","addListener","listenerIsWrapped","once","on","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","type","_events","removeAllListeners","emitEvent","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"AAAA,YAEA,IAAIA,SAA4B,kBAAXC,SAAoD,gBAApBA,QAAOC,SAAwB,SAAUC,GAAO,aAAcA,IAAS,SAAUA,GAAO,MAAOA,IAAyB,kBAA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tJ,KAAK4J,eAAejB,EAAKN,EAASA,UAGtCO,EAAWP,EAASA,SAAS3D,MAAM1E,KAAMuE,OAErCqE,IAAa5I,KAAK6K,uBAClB7K,KAAK4J,eAAejB,EAAKN,EAASA,SAMlD,OAAOrI,OAMXwI,EAAM7I,QAAU2I,EAAM,aAUtBE,EAAMsC,KAAO,SAAcnC,GACvB,GAAIpE,GAAO4E,MAAMvS,UAAUgU,MAAM9S,KAAK0M,UAAW,EACjD,OAAOxE,MAAK0K,UAAU/B,EAAKpE,IAW/BiE,EAAMuC,mBAAqB,SAA4BrP,GAEnD,MADAsE,MAAKgL,iBAAmBtP,EACjBsE,MAWXwI,EAAMqC,oBAAsB,WACxB,OAAI7K,KAAK9E,eAAe,qBACb8E,KAAKgL,kBAYpBxC,EAAMM,WAAa,WACf,MAAO9I,MAAKwK,UAAYxK,KAAKwK,aAQjC7D,EAAasE,WAAa,WAEtB,MADApT,GAAQ8O,aAAe8B,EAChB9B,GAIW,kBAAX5P,IAAyBA,EAAOmU,IACvCnU,EAAO,WACH,MAAO4P,KAEgE,YAAjD,mBAAX1O,GAAyB,YAAc1B,QAAQ0B,KAAyBA,EAAOJ,QAC9FI,EAAOJ,QAAU8O,EAEjB9O,EAAQ8O,aAAeA,IAE5B7O,KAAKkI,gBACG","file":"script.min.js","sourcesContent":["\"use strict\";\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n(function () {\n var require = undefined;var module = undefined;var exports = undefined;var define = undefined;(function e(t, n, r) {\n function s(o, u) {\n if (!n[o]) {\n if (!t[o]) {\n 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;\n }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {\n var n = t[o][1][e];return s(n ? n : e);\n }, l, l.exports, e, t, n, r);\n }return n[o].exports;\n }var i = typeof require == \"function\" && require;for (var o = 0; o < r.length; o++) {\n s(r[o]);\n }return s;\n })({ 1: [function (require, module, exports) {\n 'use strict';\n\n var Boxzilla = require('boxzilla');\n var options = window.boxzilla_options;\n var isLoggedIn = document.body.className.indexOf('logged-in') > -1;\n\n // print message when test mode is enabled\n if (isLoggedIn && options.testMode) {\n console.log('Boxzilla: Test mode is enabled. Please disable test mode if you\\'re done testing.');\n }\n\n // init boxzilla\n Boxzilla.init();\n\n // create boxes from options\n for (var i = 0; i < options.boxes.length; i++) {\n // get opts\n var boxOpts = options.boxes[i];\n boxOpts.testMode = isLoggedIn && options.testMode;\n\n // fix http:// links in box content....\n if (window.location.protocol === \"https:\" && window.location.host) {\n var o = \"http://\" + window.location.host;\n var n = old.replace('http://', 'https://');\n boxOpts.content = boxOpts.content.replace(o, n);\n }\n\n // create box\n var box = Boxzilla.create(boxOpts.id, boxOpts);\n\n // add custom css to box\n css(box.element, boxOpts.css);\n\n box.element.firstChild.firstChild.className += \" first-child\";\n box.element.firstChild.lastChild.className += \" last-child\";\n }\n\n // helper function for setting CSS styles\n function css(element, styles) {\n if (styles.background_color) {\n element.style.background = styles.background_color;\n }\n\n if (styles.color) {\n element.style.color = styles.color;\n }\n\n if (styles.border_color) {\n element.style.borderColor = styles.border_color;\n }\n\n if (styles.border_width) {\n element.style.borderWidth = parseInt(styles.border_width) + \"px\";\n }\n\n if (styles.border_style) {\n element.style.borderStyle = styles.border_style;\n }\n\n if (styles.width) {\n element.style.maxWidth = parseInt(styles.width) + \"px\";\n }\n }\n\n /**\n * If a MailChimp for WordPress form was submitted, open the box containing that form (if any)\n *\n * TODO: Just set location hash from MailChimp for WP?\n */\n window.addEventListener('load', function () {\n if (_typeof(window.mc4wp_forms_config) === \"object\" && window.mc4wp_forms_config.submitted_form) {\n var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;\n var boxes = Boxzilla.boxes;\n for (var boxId in boxes) {\n if (!boxes.hasOwnProperty(boxId)) {\n continue;\n }\n var box = boxes[boxId];\n if (box.element.querySelector(selector)) {\n box.show();\n return;\n }\n }\n }\n });\n\n window.Boxzilla = Boxzilla;\n }, { \"boxzilla\": 4 }], 2: [function (require, module, exports) {\n var duration = 320;\n\n function css(element, styles) {\n for (var property in styles) {\n element.style[property] = styles[property];\n }\n }\n\n function initObjectProperties(properties, value) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = value;\n }\n return newObject;\n }\n\n function copyObjectProperties(properties, object) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = object[properties[i]];\n }\n return newObject;\n }\n\n /**\n * Checks if the given element is currently being animated.\n *\n * @param element\n * @returns {boolean}\n */\n function animated(element) {\n return !!element.getAttribute('data-animated');\n }\n\n /**\n * Toggles the element using the given animation.\n *\n * @param element\n * @param animation Either \"fade\" or \"slide\"\n */\n function toggle(element, animation) {\n var nowVisible = element.style.display != 'none' || element.offsetLeft > 0;\n\n // create clone for reference\n var clone = element.cloneNode(true);\n var cleanup = function cleanup() {\n element.removeAttribute('data-animated');\n element.setAttribute('style', clone.getAttribute('style'));\n element.style.display = nowVisible ? 'none' : '';\n };\n\n // store attribute so everyone knows we're animating this element\n element.setAttribute('data-animated', \"true\");\n\n // toggle element visiblity right away if we're making something visible\n if (!nowVisible) {\n element.style.display = '';\n }\n\n var hiddenStyles, visibleStyles;\n\n // animate properties\n if (animation === 'slide') {\n hiddenStyles = initObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], 0);\n visibleStyles = {};\n\n if (!nowVisible) {\n var computedStyles = window.getComputedStyle(element);\n visibleStyles = copyObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], computedStyles);\n css(element, hiddenStyles);\n }\n\n // don't show a scrollbar during animation\n element.style.overflowY = 'hidden';\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n } else {\n hiddenStyles = { opacity: 0 };\n visibleStyles = { opacity: 1 };\n if (!nowVisible) {\n css(element, hiddenStyles);\n }\n\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n }\n }\n\n function animate(element, targetStyles, fn) {\n var last = +new Date();\n var initialStyles = window.getComputedStyle(element);\n var currentStyles = {};\n var propSteps = {};\n\n for (var property in targetStyles) {\n // make sure we have an object filled with floats\n targetStyles[property] = parseFloat(targetStyles[property]);\n\n // calculate step size & current value\n var to = targetStyles[property];\n var current = parseFloat(initialStyles[property]);\n\n // is there something to do?\n if (current == to) {\n delete targetStyles[property];\n continue;\n }\n\n propSteps[property] = (to - current) / duration; // points per second\n currentStyles[property] = current;\n }\n\n var tick = function tick() {\n var now = +new Date();\n var timeSinceLastTick = now - last;\n var done = true;\n\n var step, to, increment, newValue;\n for (var property in targetStyles) {\n step = propSteps[property];\n to = targetStyles[property];\n increment = step * timeSinceLastTick;\n newValue = currentStyles[property] + increment;\n\n if (step > 0 && newValue >= to || step < 0 && newValue <= to) {\n newValue = to;\n } else {\n done = false;\n }\n\n // store new value\n currentStyles[property] = newValue;\n\n var suffix = property !== \"opacity\" ? \"px\" : \"\";\n element.style[property] = newValue + suffix;\n }\n\n last = +new Date();\n\n // keep going until we're done for all props\n if (!done) {\n window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);\n } else {\n // call callback\n fn && fn();\n }\n };\n\n tick();\n }\n\n module.exports = {\n 'toggle': toggle,\n 'animate': animate,\n 'animated': animated\n };\n }, {}], 3: [function (require, module, exports) {\n 'use strict';\n\n var defaults = {\n 'animation': 'fade',\n 'rehide': false,\n 'content': '',\n 'cookie': null,\n 'icon': '&times',\n 'minimumScreenWidth': 0,\n 'position': 'center',\n 'testMode': false,\n 'trigger': false,\n 'closable': true\n },\n Boxzilla,\n Animator = require('./animator.js');\n\n /**\n * Merge 2 objects, values of the latter overwriting the former.\n *\n * @param obj1\n * @param obj2\n * @returns {*}\n */\n function merge(obj1, obj2) {\n var obj3 = {};\n for (var attrname in obj1) {\n obj3[attrname] = obj1[attrname];\n }\n for (var attrname in obj2) {\n obj3[attrname] = obj2[attrname];\n }\n return obj3;\n }\n\n /**\n * Get the real height of entire document.\n * @returns {number}\n */\n function getDocumentHeight() {\n var body = document.body,\n html = document.documentElement;\n\n var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n\n return height;\n }\n\n // Box Object\n var Box = function Box(id, config) {\n this.id = id;\n\n // store config values\n this.config = merge(defaults, config);\n\n // store ref to overlay\n this.overlay = document.getElementById('boxzilla-overlay');\n\n // state\n this.visible = false;\n this.dismissed = false;\n this.triggered = false;\n this.triggerHeight = 0;\n this.cookieSet = false;\n this.element = null;\n this.closeIcon = null;\n\n // if a trigger was given, calculate values once and store\n if (this.config.trigger) {\n if (this.config.trigger.method === 'percentage' || this.config.trigger.method === 'element') {\n this.triggerHeight = this.calculateTriggerHeight();\n }\n\n this.cookieSet = this.isCookieSet();\n }\n\n // create dom elements for this box\n this.dom();\n\n // further initialise the box\n this.events();\n };\n\n // initialise the box\n Box.prototype.events = function () {\n var box = this;\n\n // attach event to \"close\" icon inside box\n this.closeIcon && this.closeIcon.addEventListener('click', box.dismiss.bind(this));\n\n this.element.addEventListener('click', function (e) {\n if (e.target.tagName === 'A') {\n Boxzilla.trigger('box.interactions.link', [box, e.target]);\n }\n }, false);\n\n this.element.addEventListener('submit', function (e) {\n box.setCookie();\n Boxzilla.trigger('box.interactions.form', [box, e.target]);\n }, false);\n\n window.addEventListener(\"hashchange\", function () {\n var needle = \"#boxzilla-\" + box.id;\n if (location.hash === needle) {\n box.toggle();\n }\n });\n\n // maybe show box right away\n if (this.fits() && this.locationHashRefersBox()) {\n window.addEventListener('load', this.show.bind(this));\n }\n };\n\n // generate dom elements for this box\n Box.prototype.dom = function () {\n var wrapper = document.createElement('div');\n wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';\n\n var box = document.createElement('div');\n box.setAttribute('id', 'boxzilla-' + this.id);\n box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;\n box.style.display = 'none';\n wrapper.appendChild(box);\n\n var content = document.createElement('div');\n content.className = 'boxzilla-content';\n content.innerHTML = this.config.content;\n box.appendChild(content);\n\n // remove <script> from box content and append them to the document body\n var scripts = content.querySelectorAll('script');\n if (scripts.length) {\n var script = document.createElement('script');\n for (var i = 0; i < scripts.length; i++) {\n script.appendChild(document.createTextNode(scripts[i].text));\n scripts[i].parentNode.removeChild(scripts[i]);\n }\n document.body.appendChild(script);\n }\n\n if (this.config.closable && this.config.icon) {\n var closeIcon = document.createElement('span');\n closeIcon.className = \"boxzilla-close-icon\";\n closeIcon.innerHTML = this.config.icon;\n box.appendChild(closeIcon);\n this.closeIcon = closeIcon;\n }\n\n document.body.appendChild(wrapper);\n this.element = box;\n };\n\n // set (calculate) custom box styling depending on box options\n Box.prototype.setCustomBoxStyling = function () {\n\n // reset element to its initial state\n var origDisplay = this.element.style.display;\n this.element.style.display = '';\n this.element.style.overflowY = 'auto';\n this.element.style.maxHeight = 'none';\n\n // get new dimensions\n var windowHeight = window.innerHeight;\n var boxHeight = this.element.clientHeight;\n\n // add scrollbar to box and limit height\n if (boxHeight > windowHeight) {\n this.element.style.maxHeight = windowHeight + \"px\";\n this.element.style.overflowY = 'scroll';\n }\n\n // set new top margin for boxes which are centered\n if (this.config.position === 'center') {\n var newTopMargin = (windowHeight - boxHeight) / 2;\n newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;\n this.element.style.marginTop = newTopMargin + \"px\";\n }\n\n this.element.style.display = origDisplay;\n };\n\n // toggle visibility of the box\n Box.prototype.toggle = function (show) {\n\n // revert visibility if no explicit argument is given\n if (typeof show === \"undefined\") {\n show = !this.visible;\n }\n\n // is box already at desired visibility?\n if (show === this.visible) {\n return false;\n }\n\n // is box being animated?\n if (Animator.animated(this.element)) {\n return false;\n }\n\n // if box should be hidden but is not closable, bail.\n if (!show && !this.config.closable) {\n return false;\n }\n\n // set new visibility status\n this.visible = show;\n\n // calculate new styling rules\n this.setCustomBoxStyling();\n\n // trigger event\n Boxzilla.trigger('box.' + (show ? 'show' : 'hide'), [this]);\n\n // show or hide box using selected animation\n if (this.config.position === 'center') {\n this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');\n Animator.toggle(this.overlay, \"fade\");\n }\n\n Animator.toggle(this.element, this.config.animation);\n\n // focus on first input field in box\n var firstInput = this.element.querySelector('input, textarea');\n if (firstInput) {\n firstInput.focus();\n }\n\n return true;\n };\n\n // show the box\n Box.prototype.show = function () {\n return this.toggle(true);\n };\n\n // hide the box\n Box.prototype.hide = function () {\n return this.toggle(false);\n };\n\n // calculate trigger height\n Box.prototype.calculateTriggerHeight = function () {\n var triggerHeight = 0;\n\n if (this.config.trigger.method === 'element') {\n var triggerElement = document.body.querySelector(this.config.trigger.value);\n if (triggerElement) {\n var offset = triggerElement.getBoundingClientRect();\n triggerHeight = offset.top;\n }\n } else if (this.config.trigger.method === 'percentage') {\n triggerHeight = this.config.trigger.value / 100 * getDocumentHeight();\n }\n\n return triggerHeight;\n };\n\n // checks whether window.location.hash equals the box element ID or that of any element inside the box\n Box.prototype.locationHashRefersBox = function () {\n\n if (!window.location.hash || 0 === window.location.hash.length) {\n return false;\n }\n\n var elementId = window.location.hash.substring(1);\n if (elementId === this.element.id) {\n return true;\n } else if (this.element.querySelector('#' + elementId)) {\n return true;\n }\n\n return false;\n };\n\n Box.prototype.fits = function () {\n if (this.config.minimumScreenWidth <= 0) {\n return true;\n }\n\n return window.innerWidth > this.config.minimumScreenWidth;\n };\n\n // is this box enabled?\n Box.prototype.mayAutoShow = function () {\n\n if (this.dismissed) {\n return false;\n }\n\n // check if box fits on given minimum screen width\n if (!this.fits()) {\n return false;\n }\n\n // if trigger empty or error in calculating triggerHeight, return false\n if (!this.config.trigger) {\n return false;\n }\n\n // rely on cookie value (show if not set, don't show if set)\n return !this.cookieSet;\n };\n\n Box.prototype.mayRehide = function () {\n return this.config.rehide && this.triggered;\n };\n\n Box.prototype.isCookieSet = function () {\n // always show on test mode\n if (this.config.testMode) {\n return false;\n }\n\n // if either cookie is null or trigger & dismiss are both falsey, don't bother checking.\n if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {\n return false;\n }\n\n var cookieSet = document.cookie.replace(new RegExp(\"(?:(?:^|.*;)\\\\s*\" + 'boxzilla_box_' + this.id + \"\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$\"), \"$1\") === \"true\";\n return cookieSet;\n };\n\n // set cookie that disables automatically showing the box\n Box.prototype.setCookie = function (hours) {\n var expiryDate = new Date();\n expiryDate.setHours(expiryDate.getHours() + hours);\n document.cookie = 'boxzilla_box_' + this.id + '=true; expires=' + expiryDate.toUTCString() + '; path=/';\n };\n\n Box.prototype.trigger = function () {\n var shown = this.show();\n if (!shown) {\n return;\n }\n\n this.triggered = true;\n if (this.config.cookie && this.config.cookie.triggered) {\n this.setCookie(this.config.cookie.triggered);\n }\n };\n\n /**\n * Dismisses the box and optionally sets a cookie.\n *\n * @param e The event that triggered this dismissal.\n * @returns {boolean}\n */\n Box.prototype.dismiss = function (e) {\n // prevent default action\n e && e.preventDefault();\n\n // only dismiss box if it's currently open.\n if (!this.visible) {\n return false;\n }\n\n // hide box element\n this.hide();\n\n // set cookie\n if (this.config.cookie && this.config.cookie.dismissed) {\n this.setCookie(this.config.cookie.dismissed);\n }\n\n this.dismissed = true;\n Boxzilla.trigger('box.dismiss', [this]);\n return true;\n };\n\n module.exports = function (_Boxzilla) {\n Boxzilla = _Boxzilla;\n return Box;\n };\n }, { \"./animator.js\": 2 }], 4: [function (require, module, exports) {\n 'use strict';\n\n // failsafe against loading script twice...\n\n if (window.Boxzilla) {\n return;\n }\n\n var EventEmitter = require('wolfy87-eventemitter'),\n Boxzilla = Object.create(EventEmitter.prototype),\n Box = require('./box.js')(Boxzilla),\n Timer = require('./timer.js'),\n boxes = [],\n overlay,\n exitIntentDelayTimer,\n exitIntentTriggered,\n siteTimer,\n pageTimer,\n pageViews;\n\n function throttle(fn, threshhold, scope) {\n threshhold || (threshhold = 250);\n var last, deferTimer;\n return function () {\n var context = scope || this;\n\n var now = +new Date(),\n args = arguments;\n if (last && now < last + threshhold) {\n // hold on to it\n clearTimeout(deferTimer);\n deferTimer = setTimeout(function () {\n last = now;\n fn.apply(context, args);\n }, threshhold);\n } else {\n last = now;\n fn.apply(context, args);\n }\n };\n }\n\n // \"keyup\" listener\n function onKeyUp(e) {\n if (e.keyCode == 27) {\n Boxzilla.dismiss();\n }\n }\n\n // check \"pageviews\" criteria for each box\n function checkPageViewsCriteria() {\n\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {\n box.trigger();\n }\n });\n }\n\n // check time trigger criteria for each box\n function checkTimeCriteria() {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n // check \"time on site\" trigger\n if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n\n // check \"time on page\" trigger\n if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n });\n }\n\n // check triggerHeight criteria for all boxes\n function checkHeightCriteria() {\n var scrollY = (window.scrollY || window.pageYOffset) + window.innerHeight * 0.75;\n\n boxes.forEach(function (box) {\n\n if (!box.mayAutoShow() || box.triggerHeight <= 0) {\n return;\n }\n\n if (scrollY > box.triggerHeight) {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n // trigger box\n box.trigger();\n } else if (box.mayRehide()) {\n box.hide();\n }\n });\n }\n\n // recalculate heights and variables based on height\n function recalculateHeights() {\n boxes.forEach(function (box) {\n box.setCustomBoxStyling();\n });\n }\n\n function onOverlayClick(e) {\n var x = e.offsetX;\n var y = e.offsetY;\n\n // calculate if click was near a box to avoid closing it (click error margin)\n boxes.forEach(function (box) {\n var rect = box.element.getBoundingClientRect();\n var margin = 100 + window.innerWidth * 0.05;\n\n // if click was not anywhere near box, dismiss it.\n if (x < rect.left - margin || x > rect.right + margin || y < rect.top - margin || y > rect.bottom + margin) {\n box.dismiss();\n }\n });\n }\n\n function triggerExitIntent() {\n // do nothing if already triggered OR another box is visible.\n if (exitIntentTriggered || isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {\n box.trigger();\n }\n });\n\n exitIntentTriggered = true;\n }\n\n function onMouseLeave(e) {\n var delay = 400;\n\n // did mouse leave at top of window?\n if (e.clientY <= 0) {\n exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);\n }\n }\n\n function isAnyBoxVisible() {\n\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n\n if (box.visible) {\n return true;\n }\n }\n\n return false;\n }\n\n function onMouseEnter() {\n if (exitIntentDelayTimer) {\n window.clearInterval(exitIntentDelayTimer);\n exitIntentDelayTimer = null;\n }\n }\n\n var timers = {\n start: function start() {\n var sessionTime = sessionStorage.getItem('boxzilla_timer');\n if (sessionTime) siteTimer.time = sessionTime;\n siteTimer.start();\n pageTimer.start();\n },\n stop: function stop() {\n sessionStorage.setItem('boxzilla_timer', siteTimer.time);\n siteTimer.stop();\n pageTimer.stop();\n }\n };\n\n // initialise & add event listeners\n Boxzilla.init = function () {\n siteTimer = new Timer(sessionStorage.getItem('boxzilla_timer') || 0);\n pageTimer = new Timer(0);\n pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;\n\n // insert styles into DOM\n var styles = require('./styles.js');\n var styleElement = document.createElement('style');\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = styles;\n document.head.appendChild(styleElement);\n\n // add overlay element to dom\n overlay = document.createElement('div');\n overlay.style.display = 'none';\n overlay.id = 'boxzilla-overlay';\n document.body.appendChild(overlay);\n\n // event binds\n window.addEventListener('touchmove', throttle(checkHeightCriteria));\n window.addEventListener('scroll', throttle(checkHeightCriteria));\n window.addEventListener('resize', throttle(recalculateHeights));\n window.addEventListener('load', recalculateHeights);\n overlay.addEventListener('click', onOverlayClick);\n window.setInterval(checkTimeCriteria, 1000);\n window.setTimeout(checkPageViewsCriteria, 1000);\n document.documentElement.addEventListener('mouseleave', onMouseLeave);\n document.documentElement.addEventListener('mouseenter', onMouseEnter);\n document.addEventListener('keyup', onKeyUp);\n\n timers.start();\n window.addEventListener('focus', timers.start);\n window.addEventListener('beforeunload', function () {\n timers.stop();\n sessionStorage.setItem('boxzilla_pageviews', ++pageViews);\n });\n window.addEventListener('blur', timers.stop);\n\n Boxzilla.trigger('ready');\n };\n\n /**\n * Create a new Box\n *\n * @param string id\n * @param object opts\n *\n * @returns Box\n */\n Boxzilla.create = function (id, opts) {\n var box = new Box(id, opts);\n boxes.push(box);\n return box;\n };\n\n Boxzilla.get = function (id) {\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n if (box.id == id) {\n return box;\n }\n }\n\n throw new Error(\"No box exists with ID \" + id);\n };\n\n // dismiss a single box (or all by omitting id param)\n Boxzilla.dismiss = function (id) {\n // if no id given, dismiss all current open boxes\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.dismiss();\n });\n } else if (_typeof(boxes[id]) === \"object\") {\n Boxzilla.get(id).dismiss();\n }\n };\n\n Boxzilla.hide = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.hide();\n });\n } else {\n Boxzilla.get(id).hide();\n }\n };\n\n Boxzilla.show = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.show();\n });\n } else {\n Boxzilla.get(id).show();\n }\n };\n\n Boxzilla.toggle = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.toggle();\n });\n } else {\n Boxzilla.get(id).toggle();\n }\n };\n\n // expose each individual box.\n Boxzilla.boxes = boxes;\n\n window.Boxzilla = Boxzilla;\n\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = Boxzilla;\n }\n }, { \"./box.js\": 3, \"./styles.js\": 5, \"./timer.js\": 6, \"wolfy87-eventemitter\": 7 }], 5: [function (require, module, exports) {\n var styles = \"#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}\";\n module.exports = styles;\n }, {}], 6: [function (require, module, exports) {\n 'use strict';\n\n var Timer = function Timer(start) {\n this.time = start;\n this.interval = 0;\n };\n\n Timer.prototype.tick = function () {\n this.time++;\n };\n\n Timer.prototype.start = function () {\n if (!this.interval) {\n this.interval = window.setInterval(this.tick.bind(this), 1000);\n }\n };\n\n Timer.prototype.stop = function () {\n if (this.interval) {\n window.clearInterval(this.interval);\n this.interval = 0;\n }\n };\n\n module.exports = Timer;\n }, {}], 7: [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\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 } 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 === \"undefined\" ? \"undefined\" : _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 === \"undefined\" ? \"undefined\" : _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 } else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\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 === \"undefined\" ? \"undefined\" : _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 } 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 } 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 } 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 } else if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) === 'object' && module.exports) {\n module.exports = EventEmitter;\n } else {\n exports.EventEmitter = EventEmitter;\n }\n }).call(this);\n }, {}] }, {}, [1]);\n ;\n})();"]}
assets/scss/admin-styles.scss CHANGED
@@ -93,6 +93,10 @@
93
  }
94
  }
95
 
 
 
 
 
96
 
97
  /* Radio Switches */
98
  .radio-label {
93
  }
94
  }
95
 
96
+ .boxzilla-is-dismissible {
97
+ padding-right: 38px;
98
+ position: relative;
99
+ }
100
 
101
  /* Radio Switches */
102
  .radio-label {
bootstrap.php CHANGED
@@ -13,6 +13,8 @@ $provider->register( $boxzilla );
13
  $provider = new Licensing\LicenseServiceProvider();
14
  $provider->register( $boxzilla );
15
 
 
 
16
  // Rest of bootstrapping runs at plugins_loaded:90
17
  add_action( 'plugins_loaded', function() use( $boxzilla ) {
18
 
13
  $provider = new Licensing\LicenseServiceProvider();
14
  $provider->register( $boxzilla );
15
 
16
+
17
+
18
  // Rest of bootstrapping runs at plugins_loaded:90
19
  add_action( 'plugins_loaded', function() use( $boxzilla ) {
20
 
boxzilla.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Boxzilla
4
- Version: 3.1.6
5
  Plugin URI: https://boxzillaplugin.com/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page
6
  Description: Call-To-Action Boxes that display after visitors scroll down far enough. Unobtrusive, but highly conversing!
7
  Author: ibericode
@@ -41,7 +41,7 @@ if ( ! defined( 'ABSPATH' ) ) {
41
  function __load_boxzilla() {
42
 
43
  define( 'BOXZILLA_FILE', __FILE__ );
44
- define( 'BOXZILLA_VERSION', '3.1.6' );
45
 
46
  require __DIR__ . '/bootstrap.php';
47
  }
1
  <?php
2
  /*
3
  Plugin Name: Boxzilla
4
+ Version: 3.1.7
5
  Plugin URI: https://boxzillaplugin.com/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page
6
  Description: Call-To-Action Boxes that display after visitors scroll down far enough. Unobtrusive, but highly conversing!
7
  Author: ibericode
41
  function __load_boxzilla() {
42
 
43
  define( 'BOXZILLA_FILE', __FILE__ );
44
+ define( 'BOXZILLA_VERSION', '3.1.7' );
45
 
46
  require __DIR__ . '/bootstrap.php';
47
  }
languages/boxzilla.pot CHANGED
@@ -13,62 +13,75 @@ msgstr ""
13
  "X-Poedit-SearchPath-0: .\n"
14
  "X-Poedit-SearchPathExcluded-0: *.js\n"
15
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
- #: src/admin/class-admin.php:143
 
17
  msgid "Awesome, you are using Boxzilla! You can now safely <a href=\"%s\">deactivate the Scroll Triggered Boxes plugin</a>."
18
  msgstr ""
19
 
20
- #: src/admin/class-admin.php:277
21
  msgid "Box ID"
22
  msgstr ""
23
 
24
- #: src/admin/class-admin.php:283
25
  msgid "Box Title"
26
  msgstr ""
27
 
28
- #: src/admin/class-admin.php:351, src/admin/class-admin.php:353, src/admin/views/settings.php:7
29
  msgid "Settings"
30
  msgstr ""
31
 
32
- #: src/admin/class-admin.php:363, src/admin/class-admin.php:365
33
  msgid "Extensions"
34
  msgstr ""
35
 
36
- #: src/admin/class-admin.php:551
37
  msgid "Enter a comma-separated list of values."
38
  msgstr ""
39
 
40
- #: src/admin/class-admin.php:553
41
  msgid "Enter a comma-separated list of post slugs or post ID's.."
42
  msgstr ""
43
 
44
- #: src/admin/class-admin.php:555
45
  msgid "Enter a comma-separated list of page slugs or page ID's.."
46
  msgstr ""
47
 
48
- #: src/admin/class-admin.php:557
49
  msgid "Enter a comma-separated list of post types.."
50
  msgstr ""
51
 
52
- #: src/admin/class-admin.php:559
53
  msgid "Enter a comma-separated list of relative URL's, eg /contact/"
54
  msgstr ""
55
 
56
- #: src/admin/class-admin.php:625
57
  msgid "Box Appearance"
58
  msgstr ""
59
 
60
- #: src/admin/class-admin.php:643
61
  msgid "Box Options"
62
  msgstr ""
63
 
64
- #: src/admin/class-admin.php:661
65
  msgid "Looking for help?"
66
  msgstr ""
67
 
68
- #: src/admin/class-admin.php:677
69
  msgid "Subscribe to our newsletter"
70
  msgstr ""
71
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  #: src/admin/views/extensions.php:4
73
  msgid "Available Add-On Plugins"
74
  msgstr ""
13
  "X-Poedit-SearchPath-0: .\n"
14
  "X-Poedit-SearchPathExcluded-0: *.js\n"
15
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+
17
+ #: src/admin/class-admin.php:207
18
  msgid "Awesome, you are using Boxzilla! You can now safely <a href=\"%s\">deactivate the Scroll Triggered Boxes plugin</a>."
19
  msgstr ""
20
 
21
+ #: src/admin/class-admin.php:341
22
  msgid "Box ID"
23
  msgstr ""
24
 
25
+ #: src/admin/class-admin.php:347
26
  msgid "Box Title"
27
  msgstr ""
28
 
29
+ #: src/admin/class-admin.php:415, src/admin/class-admin.php:417, src/admin/views/settings.php:7
30
  msgid "Settings"
31
  msgstr ""
32
 
33
+ #: src/admin/class-admin.php:427, src/admin/class-admin.php:429
34
  msgid "Extensions"
35
  msgstr ""
36
 
37
+ #: src/admin/class-admin.php:615
38
  msgid "Enter a comma-separated list of values."
39
  msgstr ""
40
 
41
+ #: src/admin/class-admin.php:617
42
  msgid "Enter a comma-separated list of post slugs or post ID's.."
43
  msgstr ""
44
 
45
+ #: src/admin/class-admin.php:619
46
  msgid "Enter a comma-separated list of page slugs or page ID's.."
47
  msgstr ""
48
 
49
+ #: src/admin/class-admin.php:621
50
  msgid "Enter a comma-separated list of post types.."
51
  msgstr ""
52
 
53
+ #: src/admin/class-admin.php:623
54
  msgid "Enter a comma-separated list of relative URL's, eg /contact/"
55
  msgstr ""
56
 
57
+ #: src/admin/class-admin.php:689
58
  msgid "Box Appearance"
59
  msgstr ""
60
 
61
+ #: src/admin/class-admin.php:707
62
  msgid "Box Options"
63
  msgstr ""
64
 
65
+ #: src/admin/class-admin.php:725
66
  msgid "Looking for help?"
67
  msgstr ""
68
 
69
+ #: src/admin/class-admin.php:741
70
  msgid "Subscribe to our newsletter"
71
  msgstr ""
72
 
73
+ #: src/admin/class-review-notice.php:74
74
+ msgid "You've been using Boxzilla for some time now; we hope you love it!"
75
+ msgstr ""
76
+
77
+ #: src/admin/class-review-notice.php:75
78
+ msgid "If you do, please <a href=\"%s\">leave us a 5★ rating on WordPress.org</a>. It would be of great help to us."
79
+ msgstr ""
80
+
81
+ #: src/admin/class-review-notice.php:77
82
+ msgid "Dismiss this notice."
83
+ msgstr ""
84
+
85
  #: src/admin/views/extensions.php:4
86
  msgid "Available Add-On Plugins"
87
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=bo
4
  Tags: scroll triggered box, cta, social, pop-up, newsletter, call to action, mailchimp, contact form 7, social media, mc4wp, ibericode
5
  Requires at least: 3.8
6
  Tested up to: 4.6.1
7
- Stable tag: 3.1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -16,8 +16,6 @@ Flexible call to action boxes, popping up or sliding in at just the right time.
16
 
17
  Boxzilla is a *lightweight* plugin for adding flexible call-to-actions to your WordPress site. Boxes can slide or fade in at any point and can contain whatever content you like.
18
 
19
- > This is the successor of the old [Scroll Triggered Boxes](https://wordpress.org/plugins/scroll-triggered-boxes/) plugin.
20
-
21
  #### Some of Boxzilla's features
22
 
23
  - Boxes can contain _any_ content you like.
@@ -37,6 +35,8 @@ Boxzilla is a *lightweight* plugin for adding flexible call-to-actions to your W
37
 
38
  [Read more about Boxzilla](https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description).
39
 
 
 
40
  #### Documentation
41
 
42
  Please have a look at the [Boxzilla KB](https://kb.boxzillaplugin.com/).
@@ -149,15 +149,23 @@ Have a look at the [frequently asked questions](https://wordpress.org/plugins/bo
149
  == Changelog ==
150
 
151
 
152
-
153
- #### 3.1.6 - October 18, 2016
154
 
155
  **Fixes**
156
 
 
157
  - Scroll to bottom when closing box in MobileSafari browsers.
158
 
159
  **Improvements**
160
 
 
 
 
 
 
 
 
 
161
  - Failsafe against including the Boxzilla script twice, to prevent duplicate elements.
162
 
163
 
4
  Tags: scroll triggered box, cta, social, pop-up, newsletter, call to action, mailchimp, contact form 7, social media, mc4wp, ibericode
5
  Requires at least: 3.8
6
  Tested up to: 4.6.1
7
+ Stable tag: 3.1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
16
 
17
  Boxzilla is a *lightweight* plugin for adding flexible call-to-actions to your WordPress site. Boxes can slide or fade in at any point and can contain whatever content you like.
18
 
 
 
19
  #### Some of Boxzilla's features
20
 
21
  - Boxes can contain _any_ content you like.
35
 
36
  [Read more about Boxzilla](https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description).
37
 
38
+ > This is the successor of the old [Scroll Triggered Boxes](https://wordpress.org/plugins/scroll-triggered-boxes/) plugin.
39
+
40
  #### Documentation
41
 
42
  Please have a look at the [Boxzilla KB](https://kb.boxzillaplugin.com/).
149
  == Changelog ==
150
 
151
 
152
+ #### 3.1.7 - November 8, 2016
 
153
 
154
  **Fixes**
155
 
156
+ - Cookie length value was reset on every plugin update.
157
  - Scroll to bottom when closing box in MobileSafari browsers.
158
 
159
  **Improvements**
160
 
161
+ - Add CSS class to overlay when box is toggled.
162
+ - Ask for [plugin review](https://wordpress.org/support/plugin/boxzilla/reviews/#new-post) after 2 weeks of usage.
163
+
164
+
165
+ #### 3.1.6 - October 18, 2016
166
+
167
+ **Improvements**
168
+
169
  - Failsafe against including the Boxzilla script twice, to prevent duplicate elements.
170
 
171
 
src/admin/class-admin.php CHANGED
@@ -20,6 +20,11 @@ class Admin {
20
  */
21
  protected $boxzilla;
22
 
 
 
 
 
 
23
  /**
24
  * @param Plugin $plugin
25
  * @param Boxzilla $boxzilla
@@ -27,6 +32,7 @@ class Admin {
27
  public function __construct( Plugin $plugin, Boxzilla $boxzilla ) {
28
  $this->plugin = $plugin;
29
  $this->boxzilla = $boxzilla;
 
30
  }
31
 
32
  /**
@@ -48,11 +54,37 @@ class Admin {
48
  protected function add_hooks() {
49
  add_action( 'admin_init', array( $this, 'lazy_add_hooks' ) );
50
  add_action( 'admin_init', array( $this, 'register' ) );
 
51
  add_action( 'admin_menu', array( $this, 'menu' ) );
52
  add_action( 'admin_notices', array( $this, 'notices' ) );
53
  add_action( 'save_post_boxzilla-box', array( $this, 'save_box_options' ), 20, 2 );
54
  add_action( 'trashed_post', array( $this, 'flush_rules' ) );
55
  add_action( 'untrashed_post', array( $this, 'flush_rules' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  }
57
 
58
  /**
20
  */
21
  protected $boxzilla;
22
 
23
+ /**
24
+ * @var ReviewNotice
25
+ */
26
+ protected $review_notice;
27
+
28
  /**
29
  * @param Plugin $plugin
30
  * @param Boxzilla $boxzilla
32
  public function __construct( Plugin $plugin, Boxzilla $boxzilla ) {
33
  $this->plugin = $plugin;
34
  $this->boxzilla = $boxzilla;
35
+ $this->review_notice = new ReviewNotice();
36
  }
37
 
38
  /**
54
  protected function add_hooks() {
55
  add_action( 'admin_init', array( $this, 'lazy_add_hooks' ) );
56
  add_action( 'admin_init', array( $this, 'register' ) );
57
+ add_action( 'init', array( $this, 'listen_for_actions' ) );
58
  add_action( 'admin_menu', array( $this, 'menu' ) );
59
  add_action( 'admin_notices', array( $this, 'notices' ) );
60
  add_action( 'save_post_boxzilla-box', array( $this, 'save_box_options' ), 20, 2 );
61
  add_action( 'trashed_post', array( $this, 'flush_rules' ) );
62
  add_action( 'untrashed_post', array( $this, 'flush_rules' ) );
63
+
64
+ $this->review_notice->add_hooks();
65
+ }
66
+
67
+ /**
68
+ * Listen for admin actions.
69
+ */
70
+ public function listen_for_actions() {
71
+
72
+ // triggered?
73
+ $vars = array_merge( $_POST, $_GET );
74
+ if( empty( $vars['_boxzilla_admin_action'] ) ) {
75
+ return false;
76
+ }
77
+
78
+ // authorized?
79
+ if( ! current_user_can( 'edit_posts' ) ) {
80
+ return false;
81
+ }
82
+
83
+ // fire action
84
+ $action = $vars['_boxzilla_admin_action'];
85
+ do_action( 'boxzilla_admin_' . $action );
86
+
87
+ return true;
88
  }
89
 
90
  /**
src/admin/class-migrations.php CHANGED
@@ -61,9 +61,18 @@ class Migrations {
61
  $parts = explode( '-', $migration );
62
  $version = $parts[0];
63
 
64
- if( version_compare( $this->version_from, $version, '<' ) ) {
65
- $migrations[] = $file;
 
66
  }
 
 
 
 
 
 
 
 
67
  }
68
 
69
  return $migrations;
61
  $parts = explode( '-', $migration );
62
  $version = $parts[0];
63
 
64
+ // check if migration file is not for an even higher version
65
+ if( version_compare( $version, $this->version_to, '>' ) ) {
66
+ continue;
67
  }
68
+
69
+ // check if we ran migration file before.
70
+ if( version_compare( $this->version_from, $version, '>=' ) ) {
71
+ continue;
72
+ }
73
+
74
+ // schedule migration file for running
75
+ $migrations[] = $file;
76
  }
77
 
78
  return $migrations;
src/admin/class-review-notice.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Admin;
4
+ use WP_Screen;
5
+
6
+ /**
7
+ * Class ReviewNotice
8
+ *
9
+ * @ignore
10
+ */
11
+ class ReviewNotice {
12
+
13
+ /**
14
+ * @var string
15
+ */
16
+ protected $meta_key_dismissed = '_boxzilla_review_notice_dismissed';
17
+
18
+ /**
19
+ * Constructor.
20
+ */
21
+ public function __construct() {
22
+
23
+ }
24
+
25
+ /**
26
+ * Add action & filter hooks.
27
+ */
28
+ public function add_hooks() {
29
+ add_action( 'admin_notices', array( $this, 'show' ) );
30
+ add_action( 'boxzilla_admin_dismiss_review_notice', array( $this, 'dismiss' ) );
31
+ }
32
+
33
+ /**
34
+ * Set flag in user meta so notice won't be shown.
35
+ */
36
+ public function dismiss() {
37
+ $user = wp_get_current_user();
38
+ update_user_meta( $user->ID, $this->meta_key_dismissed, 1 );
39
+ }
40
+
41
+ /**
42
+ * @return bool
43
+ */
44
+ public function show() {
45
+ $screen = get_current_screen();
46
+ if( ! $screen instanceof WP_Screen ) {
47
+ return false;
48
+ }
49
+
50
+ // on some boxzilla screen?
51
+ if( $screen->post_type !== 'boxzilla-box' ) {
52
+ return false;
53
+ }
54
+
55
+ // authorized?
56
+ if( ! current_user_can( 'edit_posts' ) ) {
57
+ return false;
58
+ }
59
+
60
+ // only show if 2 weeks have passed since first use.
61
+ $two_weeks_in_seconds = ( 60 * 60 * 24 * 14 );
62
+ if( $this->time_since_first_use() <= $two_weeks_in_seconds ) {
63
+ return false;
64
+ }
65
+
66
+ // only show if user did not dismiss before
67
+ $user = wp_get_current_user();
68
+ if( get_user_meta( $user->ID, $this->meta_key_dismissed, true ) ) {
69
+ return false;
70
+ }
71
+
72
+ echo '<div class="notice notice-info boxzilla-is-dismissible">';
73
+ echo '<p>';
74
+ echo __( 'You\'ve been using Boxzilla for some time now; we hope you love it!', 'boxzilla' ) . ' <br />';
75
+ echo sprintf( __( 'If you do, please <a href="%s">leave us a 5★ rating on WordPress.org</a>. It would be of great help to us.', 'boxzilla' ), 'https://wordpress.org/support/view/plugin-reviews/boxzilla?rate=5#new-post' );
76
+ echo '</p>';
77
+ echo '<form method="POST"><button type="submit" class="notice-dismiss"><span class="screen-reader-text">'. __( 'Dismiss this notice.', 'boxzilla' ) .'</span></button><input type="hidden" name="_boxzilla_admin_action" value="dismiss_review_notice"/></form>';
78
+ echo '</div>';
79
+ return true;
80
+ }
81
+
82
+ /**
83
+ * @return int
84
+ */
85
+ private function time_since_first_use() {
86
+ $options = get_option( 'boxzilla_settings' );
87
+
88
+ // option was never added before, do it now.
89
+ if( empty( $options['first_activated_on'] ) ) {
90
+ $options['first_activated_on'] = time();
91
+ update_option( 'boxzilla_settings', $options );
92
+ }
93
+
94
+ return time() - $options['first_activated_on'];
95
+ }
96
+ }
src/admin/migrations/{4.0.0-cookie-option.php → 3.1-cookie-option.php} RENAMED
File without changes
trunk/LICENSE ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ {description}
294
+ Copyright (C) {year} {fullname}
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ {signature of Ty Coon}, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
trunk/assets/browserify/admin-script.js ADDED
@@ -0,0 +1 @@
 
1
+ window.Boxzilla_Admin = require('./admin/_admin.js');
trunk/assets/browserify/admin/_admin.js ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function() {
2
+ 'use strict';
3
+
4
+ var $ = window.jQuery;
5
+ var Option = require('./_option.js');
6
+ var optionControls = document.getElementById('boxzilla-box-options-controls');
7
+ var $optionControls = $(optionControls);
8
+
9
+ // sanity check, are we on the correct page?
10
+ if( $optionControls.length === 0 ) {
11
+ return;
12
+ }
13
+
14
+ var EventEmitter = require('wolfy87-eventemitter');
15
+ var events = new EventEmitter();
16
+ var Designer = require('./_designer.js')($, Option, events);
17
+ var rowTemplate = wp.template('rule-row-template');
18
+ var i18n = boxzilla_i18n;
19
+
20
+ // events
21
+ $optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
22
+ $optionControls.on('click', ".boxzilla-remove-rule", removeRule);
23
+ $optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
24
+ $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions );
25
+
26
+ $(window).load(function() {
27
+ if( typeof(window.tinyMCE) === "undefined" ) {
28
+ document.getElementById('notice-notinymce').style.display = '';
29
+ }
30
+ });
31
+
32
+ // call contextual helper method for each row
33
+ $('.boxzilla-rule-row').each(setContextualHelpers);
34
+
35
+ function toggleTriggerOptions() {
36
+ $optionControls.find('.boxzilla-trigger-options').toggle( this.value !== '' );
37
+ }
38
+
39
+ function removeRule() {
40
+ $(this).parents('tr').remove();
41
+ }
42
+
43
+ function setContextualHelpers() {
44
+
45
+ var context = ( this.tagName.toLowerCase() === "tr" ) ? this : $(this).parents('tr').get(0);
46
+ var condition = context.querySelector('.boxzilla-rule-condition').value;
47
+ var valueInput = context.querySelector('.boxzilla-rule-value');
48
+ var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
49
+ var betterInput = valueInput.cloneNode(true);
50
+ var $betterInput = $(betterInput);
51
+
52
+ // remove previously added helpers
53
+ $(context.querySelectorAll('.boxzilla-helper')).remove();
54
+
55
+ // prepare better input
56
+ betterInput.removeAttribute('name');
57
+ betterInput.className = betterInput.className + ' boxzilla-helper';
58
+ valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
59
+ $betterInput.change(function() { valueInput.value = this.value; });
60
+
61
+ betterInput.style.display = '';
62
+ valueInput.style.display = 'none';
63
+ qualifierInput.style.display = '';
64
+
65
+ // change placeholder for textual help
66
+ switch(condition) {
67
+ default:
68
+ betterInput.placeholder = i18n.enterCommaSeparatedValues;
69
+ break;
70
+
71
+ case '':
72
+ case 'everywhere':
73
+ qualifierInput.value = '1';
74
+ valueInput.value = '';
75
+ betterInput.style.display = 'none';
76
+ qualifierInput.style.display = 'none';
77
+ break;
78
+
79
+ case 'is_single':
80
+ case 'is_post':
81
+ betterInput.placeholder = i18n.enterCommaSeparatedPosts;
82
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", {multiple:true, multipleSep: ","});
83
+ break;
84
+
85
+ case 'is_page':
86
+ betterInput.placeholder = i18n.enterCommaSeparatedPages;
87
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", {multiple:true, multipleSep: ","});
88
+ break;
89
+
90
+ case 'is_post_type':
91
+ betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
92
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", {multiple:true, multipleSep: ","});
93
+ break;
94
+
95
+ case 'is_url':
96
+ betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
97
+ break;
98
+
99
+ case 'is_post_in_category':
100
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {multiple:true, multipleSep: ","});
101
+ break;
102
+
103
+ case 'is_post_with_tag':
104
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {multiple:true, multipleSep: ","});
105
+ break;
106
+ }
107
+ }
108
+
109
+ function addRuleFields() {
110
+ var data = {
111
+ 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length
112
+ };
113
+ var html = rowTemplate(data);
114
+ $(document.getElementById('boxzilla-box-rules')).after(html);
115
+ return false;
116
+ }
117
+
118
+ module.exports = {
119
+ 'Designer': Designer,
120
+ 'Option': Option,
121
+ 'events': events
122
+ };
123
+ })();
trunk/assets/browserify/admin/_designer.js ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var Designer = function($, Option, events) {
2
+
3
+ // vars
4
+ var boxId = document.getElementById('post_ID').value || 0,
5
+ $editor, $editorFrame,
6
+ $innerEditor,
7
+ options = {},
8
+ visualEditorInitialised = false;
9
+
10
+ var $appearanceControls = $("#boxzilla-box-appearance-controls");
11
+
12
+ // create Option objects
13
+ options.borderColor = new Option('border-color');
14
+ options.borderWidth = new Option('border-width');
15
+ options.borderStyle = new Option('border-style');
16
+ options.backgroundColor = new Option('background-color');
17
+ options.width = new Option('width');
18
+ options.color = new Option('color');
19
+
20
+ // functions
21
+ function init() {
22
+
23
+ // Only run if TinyMCE has actually inited
24
+ if( typeof( window.tinyMCE ) !== "object" || tinyMCE.get('content') === null ) {
25
+ return;
26
+ }
27
+
28
+ // add classes to TinyMCE <html>
29
+ $editorFrame = $("#content_ifr");
30
+ $editor = $editorFrame.contents().find('html');
31
+ $editor.css({
32
+ 'background': 'white'
33
+ });
34
+
35
+ // add content class and padding to TinyMCE <body>
36
+ $innerEditor = $editor.find('#tinymce');
37
+ $innerEditor.addClass('boxzilla boxzilla-' + boxId);
38
+ $innerEditor.css({
39
+ 'margin': 0,
40
+ 'background': 'white',
41
+ 'display': 'inline-block',
42
+ 'width': 'auto',
43
+ 'min-width': '240px',
44
+ 'position': 'relative'
45
+ });
46
+ $innerEditor.get(0).style.cssText += ';padding: 25px !important;';
47
+
48
+ visualEditorInitialised = true;
49
+
50
+ /* @since 2.0.3 */
51
+ events.trigger('editor.init');
52
+ }
53
+
54
+ /**
55
+ * Applies the styles from the options to the TinyMCE Editor
56
+ *
57
+ * @return bool
58
+ */
59
+ function applyStyles() {
60
+
61
+ if( ! visualEditorInitialised ) {
62
+ return false;
63
+ }
64
+
65
+ // apply styles from CSS editor
66
+ $innerEditor.css({
67
+ 'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),
68
+ 'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),
69
+ 'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),
70
+ 'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),
71
+ 'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),
72
+ 'color': options.color.getColorValue() // getColorValue( 'color', '' )
73
+ });
74
+
75
+ /* @since 2.0.3 */
76
+ events.trigger('editor.styles.apply');
77
+
78
+ return true;
79
+ }
80
+
81
+ function resetStyles() {
82
+ for( var key in options ) {
83
+ if( key.substring(0,5) === 'theme' ) {
84
+ continue;
85
+ }
86
+
87
+ options[key].clear();
88
+ }
89
+ applyStyles();
90
+
91
+ /* @since 2.0.3 */
92
+ events.trigger('editor.styles.reset');
93
+ }
94
+
95
+ // event binders
96
+ $appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });
97
+ $appearanceControls.find(":input").not(".boxzilla-color-field").change(applyStyles);
98
+ events.on('editor.init', applyStyles);
99
+
100
+ // public methods
101
+ return {
102
+ 'init': init,
103
+ 'resetStyles': resetStyles,
104
+ 'options': options
105
+ };
106
+
107
+ };
108
+
109
+ module.exports = Designer;
trunk/assets/browserify/admin/_option.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ var $ = window.jQuery;
4
+
5
+ var Option = function( element ) {
6
+
7
+ // find corresponding element
8
+ if( typeof(element) == "string" ) {
9
+ element = document.getElementById('boxzilla-' + element);
10
+ }
11
+
12
+ if( ! element ) {
13
+ console.error("Unable to find option element.");
14
+ }
15
+
16
+ this.element = element;
17
+ };
18
+
19
+ Option.prototype.getColorValue = function() {
20
+ if( this.element.value.length > 0 ) {
21
+ if( $(this.element).hasClass('wp-color-field')) {
22
+ return $(this.element).wpColorPicker('color');
23
+ } else {
24
+ return this.element.value;
25
+ }
26
+ }
27
+
28
+ return '';
29
+ };
30
+
31
+ Option.prototype.getPxValue = function( fallbackValue ) {
32
+ if( this.element.value.length > 0 ) {
33
+ return parseInt( this.element.value ) + "px";
34
+ }
35
+
36
+ return fallbackValue || '';
37
+ };
38
+
39
+ Option.prototype.getValue = function( fallbackValue ) {
40
+
41
+ if( this.element.value.length > 0 ) {
42
+ return this.element.value;
43
+ }
44
+
45
+ return fallbackValue || '';
46
+ };
47
+
48
+ Option.prototype.clear = function() {
49
+ this.element.value = '';
50
+ };
51
+
52
+ Option.prototype.setValue = function(value) {
53
+ this.element.value = value;
54
+ };
55
+
56
+ module.exports = Option;
trunk/assets/browserify/script.js ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function() {
2
+ 'use strict';
3
+
4
+ var Boxzilla = require('boxzilla');
5
+ var options = window.boxzilla_options;
6
+ var isLoggedIn = document.body.className.indexOf('logged-in') > -1;
7
+
8
+ // failsafe against including script twice.
9
+ if( options.inited ) {
10
+ return;
11
+ }
12
+
13
+ // print message when test mode is enabled
14
+ if( isLoggedIn && options.testMode ) {
15
+ console.log( 'Boxzilla: Test mode is enabled. Please disable test mode if you\'re done testing.' );
16
+ }
17
+
18
+ // init boxzilla
19
+ Boxzilla.init();
20
+
21
+ // create boxes from options
22
+ for( var i=0; i < options.boxes.length; i++ ) {
23
+ // get opts
24
+ var boxOpts = options.boxes[i];
25
+ boxOpts.testMode = isLoggedIn && options.testMode;
26
+
27
+ // fix http:// links in box content....
28
+ if( window.location.protocol === "https:" && window.location.host ) {
29
+ var o = "http://" + window.location.host;
30
+ var n = old.replace('http://', 'https://');
31
+ boxOpts.content = boxOpts.content.replace(o, n);
32
+ }
33
+
34
+ // create box
35
+ var box = Boxzilla.create( boxOpts.id, boxOpts);
36
+
37
+ // add custom css to box
38
+ css(box.element, boxOpts.css);
39
+
40
+ box.element.firstChild.firstChild.className += " first-child";
41
+ box.element.firstChild.lastChild.className += " last-child";
42
+ }
43
+
44
+ // helper function for setting CSS styles
45
+ function css(element, styles) {
46
+ if( styles.background_color ) {
47
+ element.style.background = styles.background_color;
48
+ }
49
+
50
+ if( styles.color ) {
51
+ element.style.color = styles.color;
52
+ }
53
+
54
+ if( styles.border_color ) {
55
+ element.style.borderColor = styles.border_color;
56
+ }
57
+
58
+ if( styles.border_width ) {
59
+ element.style.borderWidth = parseInt(styles.border_width) + "px";
60
+ }
61
+
62
+ if( styles.border_style ) {
63
+ element.style.borderStyle = styles.border_style;
64
+ }
65
+
66
+ if( styles.width ) {
67
+ element.style.maxWidth = parseInt(styles.width) + "px";
68
+ }
69
+ }
70
+
71
+ /**
72
+ * If a MailChimp for WordPress form was submitted, open the box containing that form (if any)
73
+ *
74
+ * TODO: Just set location hash from MailChimp for WP?
75
+ */
76
+ window.addEventListener('load', function() {
77
+ if( typeof(window.mc4wp_forms_config) === "object" && window.mc4wp_forms_config.submitted_form ) {
78
+ var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;
79
+ var boxes = Boxzilla.boxes;
80
+ for( var boxId in boxes ) {
81
+ if(!boxes.hasOwnProperty(boxId)) { continue; }
82
+ var box = boxes[boxId];
83
+ if( box.element.querySelector(selector)) {
84
+ box.show();
85
+ return;
86
+ }
87
+ }
88
+ }
89
+ });
90
+
91
+ options.inited = true;
92
+ window.Boxzilla = Boxzilla;
93
+ })();
trunk/assets/css/admin-styles.css ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* first row can't be deleted */
2
+ .boxzilla-rule-row-0 .boxzilla-close {
3
+ visibility: hidden; }
4
+
5
+ .column-box_id {
6
+ width: 80px; }
7
+
8
+ .boxzilla-sm {
9
+ width: 150px; }
10
+
11
+ .boxzilla-xsm {
12
+ width: 15px; }
13
+
14
+ .boxzilla-title {
15
+ margin-top: 2em !important; }
16
+
17
+ .boxzilla-label {
18
+ display: block;
19
+ font-weight: bold;
20
+ margin-bottom: 6px; }
21
+
22
+ .boxzilla-close {
23
+ padding: 0;
24
+ cursor: pointer;
25
+ background: transparent;
26
+ border: 0;
27
+ -webkit-appearance: none;
28
+ font-size: 21px;
29
+ font-weight: bold;
30
+ line-height: 26px;
31
+ text-shadow: 0 1px 0 #fff;
32
+ opacity: .3;
33
+ filter: alpha(opacity=30); }
34
+ .boxzilla-close:hover, .boxzilla-close:focus {
35
+ color: #000;
36
+ text-decoration: none;
37
+ cursor: pointer;
38
+ opacity: .6;
39
+ filter: alpha(opacity=60); }
40
+
41
+ .post-type-boxzilla-box .form-table {
42
+ table-layout: fixed; }
43
+
44
+ .post-type-boxzilla-box .window-positions {
45
+ border: 1px solid #EEE; }
46
+ .post-type-boxzilla-box .window-positions td {
47
+ padding: 3px;
48
+ margin-bottom: 0; }
49
+
50
+ .post-type-boxzilla-box .wp-picker-container {
51
+ white-space: nowrap; }
52
+
53
+ .post-type-boxzilla-box .wp-picker-clear,
54
+ .post-type-boxzilla-box .wp-picker-holder,
55
+ .post-type-boxzilla-box .wp-picker-input-wrap {
56
+ background: white;
57
+ z-index: 999 !important;
58
+ position: absolute !important; }
59
+
60
+ #boxzilla-admin .status {
61
+ display: inline-block;
62
+ padding: 3px 6px;
63
+ color: white;
64
+ text-transform: uppercase;
65
+ font-weight: bold; }
66
+ #boxzilla-admin .status.positive {
67
+ background-color: limeGreen; }
68
+ #boxzilla-admin .status.negative {
69
+ background: #c3c3c3; }
70
+
71
+ .boxzilla-is-dismissible {
72
+ padding-right: 38px;
73
+ position: relative; }
74
+
75
+ /* Radio Switches */
76
+ .radio-label {
77
+ font-weight: normal; }
78
+ .radio-label > input {
79
+ margin-top: 0 !important; }
80
+
81
+ /** Grid */
82
+ .boxzilla-row {
83
+ margin: 0 -20px; }
84
+
85
+ .boxzilla-col-one-third,
86
+ .boxzilla-col-two-third {
87
+ float: left;
88
+ -webkit-box-sizing: border-box;
89
+ box-sizing: border-box;
90
+ padding: 0 20px; }
91
+
92
+ .boxzilla-col-two-third {
93
+ width: 66.66%; }
94
+
95
+ .boxzilla-col-one-third {
96
+ width: 33.33%; }
97
+
98
+ /* admin sidebar */
99
+ .boxzilla-sidebar {
100
+ margin-top: 10px; }
101
+
102
+ .boxzilla-box {
103
+ background: white;
104
+ padding: 20px;
105
+ margin-bottom: 20px;
106
+ border: 1px solid #ccc; }
107
+ .boxzilla-box h3,
108
+ .boxzilla-box :first-child {
109
+ margin-top: 0; }
110
+ .boxzilla-box :last-child {
111
+ margin-bottom: 0; }
112
+
113
+ .boxzilla-sidebar form label {
114
+ display: block;
115
+ font-weight: bold;
116
+ margin-bottom: 6px; }
117
+
118
+ @media (max-width: 920px) {
119
+ .boxzilla-row {
120
+ margin: 0; }
121
+ .boxzilla-col-one-third,
122
+ .boxzilla-col-two-third {
123
+ float: none;
124
+ padding: 0;
125
+ width: auto; }
126
+ .boxzilla-sidebar {
127
+ margin-top: 40px; } }
trunk/assets/css/admin-styles.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .boxzilla-rule-row-0 .boxzilla-close{visibility:hidden}.column-box_id{width:80px}.boxzilla-sm{width:150px}.boxzilla-xsm{width:15px}.boxzilla-title{margin-top:2em!important}.boxzilla-label{display:block;font-weight:700;margin-bottom:6px}.boxzilla-close{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none;font-size:21px;font-weight:700;line-height:26px;text-shadow:0 1px 0 #fff;opacity:.3;filter:alpha(opacity=30)}.boxzilla-close:focus,.boxzilla-close:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.6;filter:alpha(opacity=60)}.post-type-boxzilla-box .form-table{table-layout:fixed}.post-type-boxzilla-box .window-positions{border:1px solid #EEE}.post-type-boxzilla-box .window-positions td{padding:3px;margin-bottom:0}.post-type-boxzilla-box .wp-picker-container{white-space:nowrap}.post-type-boxzilla-box .wp-picker-clear,.post-type-boxzilla-box .wp-picker-holder,.post-type-boxzilla-box .wp-picker-input-wrap{background:#fff;z-index:999!important;position:absolute!important}#boxzilla-admin .status{display:inline-block;padding:3px 6px;color:#fff;text-transform:uppercase;font-weight:700}#boxzilla-admin .status.positive{background-color:#32cd32}#boxzilla-admin .status.negative{background:#c3c3c3}.boxzilla-is-dismissible{padding-right:38px;position:relative}.radio-label{font-weight:400}.radio-label>input{margin-top:0!important}.boxzilla-row{margin:0 -20px}.boxzilla-col-one-third,.boxzilla-col-two-third{float:left;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 20px}.boxzilla-col-two-third{width:66.66%}.boxzilla-col-one-third{width:33.33%}.boxzilla-sidebar{margin-top:10px}.boxzilla-box{background:#fff;padding:20px;margin-bottom:20px;border:1px solid #ccc}.boxzilla-box :first-child,.boxzilla-box h3{margin-top:0}.boxzilla-box :last-child{margin-bottom:0}.boxzilla-sidebar form label{display:block;font-weight:700;margin-bottom:6px}@media (max-width:920px){.boxzilla-row{margin:0}.boxzilla-col-one-third,.boxzilla-col-two-third{float:none;padding:0;width:auto}.boxzilla-sidebar{margin-top:40px}}
trunk/assets/css/index.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if( ! defined( 'STB::VERSION' ) ) {
4
+ header( 'Status: 403 Forbidden' );
5
+ header( 'HTTP/1.1 403 Forbidden' );
6
+ exit;
7
+ }
trunk/assets/img/index.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ if( ! defined( 'STB::VERSION' ) ) {
3
+ header( 'Status: 403 Forbidden' );
4
+ header( 'HTTP/1.1 403 Forbidden' );
5
+ exit;
6
+ }
trunk/assets/img/menu-icon.jpg ADDED
Binary file
trunk/assets/img/menu-icon.png ADDED
Binary file
trunk/assets/index.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ if( ! defined( 'STB::VERSION' ) ) {
3
+ header( 'Status: 403 Forbidden' );
4
+ header( 'HTTP/1.1 403 Forbidden' );
5
+ exit;
6
+ }
trunk/assets/js/admin-script.js ADDED
@@ -0,0 +1,785 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function () { var require = undefined; var module = undefined; var exports = 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){
2
+ 'use strict';
3
+
4
+ window.Boxzilla_Admin = require('./admin/_admin.js');
5
+
6
+ },{"./admin/_admin.js":2}],2:[function(require,module,exports){
7
+ 'use strict';
8
+
9
+ (function () {
10
+ 'use strict';
11
+
12
+ var $ = window.jQuery;
13
+ var Option = require('./_option.js');
14
+ var optionControls = document.getElementById('boxzilla-box-options-controls');
15
+ var $optionControls = $(optionControls);
16
+
17
+ // sanity check, are we on the correct page?
18
+ if ($optionControls.length === 0) {
19
+ return;
20
+ }
21
+
22
+ var EventEmitter = require('wolfy87-eventemitter');
23
+ var events = new EventEmitter();
24
+ var Designer = require('./_designer.js')($, Option, events);
25
+ var rowTemplate = wp.template('rule-row-template');
26
+ var i18n = boxzilla_i18n;
27
+
28
+ // events
29
+ $optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
30
+ $optionControls.on('click', ".boxzilla-remove-rule", removeRule);
31
+ $optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
32
+ $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);
33
+
34
+ $(window).load(function () {
35
+ if (typeof window.tinyMCE === "undefined") {
36
+ document.getElementById('notice-notinymce').style.display = '';
37
+ }
38
+ });
39
+
40
+ // call contextual helper method for each row
41
+ $('.boxzilla-rule-row').each(setContextualHelpers);
42
+
43
+ function toggleTriggerOptions() {
44
+ $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');
45
+ }
46
+
47
+ function removeRule() {
48
+ $(this).parents('tr').remove();
49
+ }
50
+
51
+ function setContextualHelpers() {
52
+
53
+ var context = this.tagName.toLowerCase() === "tr" ? this : $(this).parents('tr').get(0);
54
+ var condition = context.querySelector('.boxzilla-rule-condition').value;
55
+ var valueInput = context.querySelector('.boxzilla-rule-value');
56
+ var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
57
+ var betterInput = valueInput.cloneNode(true);
58
+ var $betterInput = $(betterInput);
59
+
60
+ // remove previously added helpers
61
+ $(context.querySelectorAll('.boxzilla-helper')).remove();
62
+
63
+ // prepare better input
64
+ betterInput.removeAttribute('name');
65
+ betterInput.className = betterInput.className + ' boxzilla-helper';
66
+ valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
67
+ $betterInput.change(function () {
68
+ valueInput.value = this.value;
69
+ });
70
+
71
+ betterInput.style.display = '';
72
+ valueInput.style.display = 'none';
73
+ qualifierInput.style.display = '';
74
+
75
+ // change placeholder for textual help
76
+ switch (condition) {
77
+ default:
78
+ betterInput.placeholder = i18n.enterCommaSeparatedValues;
79
+ break;
80
+
81
+ case '':
82
+ case 'everywhere':
83
+ qualifierInput.value = '1';
84
+ valueInput.value = '';
85
+ betterInput.style.display = 'none';
86
+ qualifierInput.style.display = 'none';
87
+ break;
88
+
89
+ case 'is_single':
90
+ case 'is_post':
91
+ betterInput.placeholder = i18n.enterCommaSeparatedPosts;
92
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", { multiple: true, multipleSep: "," });
93
+ break;
94
+
95
+ case 'is_page':
96
+ betterInput.placeholder = i18n.enterCommaSeparatedPages;
97
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", { multiple: true, multipleSep: "," });
98
+ break;
99
+
100
+ case 'is_post_type':
101
+ betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
102
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", { multiple: true, multipleSep: "," });
103
+ break;
104
+
105
+ case 'is_url':
106
+ betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
107
+ break;
108
+
109
+ case 'is_post_in_category':
110
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", { multiple: true, multipleSep: "," });
111
+ break;
112
+
113
+ case 'is_post_with_tag':
114
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", { multiple: true, multipleSep: "," });
115
+ break;
116
+ }
117
+ }
118
+
119
+ function addRuleFields() {
120
+ var data = {
121
+ 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length
122
+ };
123
+ var html = rowTemplate(data);
124
+ $(document.getElementById('boxzilla-box-rules')).after(html);
125
+ return false;
126
+ }
127
+
128
+ module.exports = {
129
+ 'Designer': Designer,
130
+ 'Option': Option,
131
+ 'events': events
132
+ };
133
+ })();
134
+
135
+ },{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(require,module,exports){
136
+ 'use strict';
137
+
138
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
139
+
140
+ var Designer = function Designer($, Option, events) {
141
+
142
+ // vars
143
+ var boxId = document.getElementById('post_ID').value || 0,
144
+ $editor,
145
+ $editorFrame,
146
+ $innerEditor,
147
+ options = {},
148
+ visualEditorInitialised = false;
149
+
150
+ var $appearanceControls = $("#boxzilla-box-appearance-controls");
151
+
152
+ // create Option objects
153
+ options.borderColor = new Option('border-color');
154
+ options.borderWidth = new Option('border-width');
155
+ options.borderStyle = new Option('border-style');
156
+ options.backgroundColor = new Option('background-color');
157
+ options.width = new Option('width');
158
+ options.color = new Option('color');
159
+
160
+ // functions
161
+ function init() {
162
+
163
+ // Only run if TinyMCE has actually inited
164
+ if (_typeof(window.tinyMCE) !== "object" || tinyMCE.get('content') === null) {
165
+ return;
166
+ }
167
+
168
+ // add classes to TinyMCE <html>
169
+ $editorFrame = $("#content_ifr");
170
+ $editor = $editorFrame.contents().find('html');
171
+ $editor.css({
172
+ 'background': 'white'
173
+ });
174
+
175
+ // add content class and padding to TinyMCE <body>
176
+ $innerEditor = $editor.find('#tinymce');
177
+ $innerEditor.addClass('boxzilla boxzilla-' + boxId);
178
+ $innerEditor.css({
179
+ 'margin': 0,
180
+ 'background': 'white',
181
+ 'display': 'inline-block',
182
+ 'width': 'auto',
183
+ 'min-width': '240px',
184
+ 'position': 'relative'
185
+ });
186
+ $innerEditor.get(0).style.cssText += ';padding: 25px !important;';
187
+
188
+ visualEditorInitialised = true;
189
+
190
+ /* @since 2.0.3 */
191
+ events.trigger('editor.init');
192
+ }
193
+
194
+ /**
195
+ * Applies the styles from the options to the TinyMCE Editor
196
+ *
197
+ * @return bool
198
+ */
199
+ function applyStyles() {
200
+
201
+ if (!visualEditorInitialised) {
202
+ return false;
203
+ }
204
+
205
+ // apply styles from CSS editor
206
+ $innerEditor.css({
207
+ 'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),
208
+ 'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),
209
+ 'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),
210
+ 'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),
211
+ 'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),
212
+ 'color': options.color.getColorValue() // getColorValue( 'color', '' )
213
+ });
214
+
215
+ /* @since 2.0.3 */
216
+ events.trigger('editor.styles.apply');
217
+
218
+ return true;
219
+ }
220
+
221
+ function resetStyles() {
222
+ for (var key in options) {
223
+ if (key.substring(0, 5) === 'theme') {
224
+ continue;
225
+ }
226
+
227
+ options[key].clear();
228
+ }
229
+ applyStyles();
230
+
231
+ /* @since 2.0.3 */
232
+ events.trigger('editor.styles.reset');
233
+ }
234
+
235
+ // event binders
236
+ $appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });
237
+ $appearanceControls.find(":input").not(".boxzilla-color-field").change(applyStyles);
238
+ events.on('editor.init', applyStyles);
239
+
240
+ // public methods
241
+ return {
242
+ 'init': init,
243
+ 'resetStyles': resetStyles,
244
+ 'options': options
245
+ };
246
+ };
247
+
248
+ module.exports = Designer;
249
+
250
+ },{}],4:[function(require,module,exports){
251
+ 'use strict';
252
+
253
+ var $ = window.jQuery;
254
+
255
+ var Option = function Option(element) {
256
+
257
+ // find corresponding element
258
+ if (typeof element == "string") {
259
+ element = document.getElementById('boxzilla-' + element);
260
+ }
261
+
262
+ if (!element) {
263
+ console.error("Unable to find option element.");
264
+ }
265
+
266
+ this.element = element;
267
+ };
268
+
269
+ Option.prototype.getColorValue = function () {
270
+ if (this.element.value.length > 0) {
271
+ if ($(this.element).hasClass('wp-color-field')) {
272
+ return $(this.element).wpColorPicker('color');
273
+ } else {
274
+ return this.element.value;
275
+ }
276
+ }
277
+
278
+ return '';
279
+ };
280
+
281
+ Option.prototype.getPxValue = function (fallbackValue) {
282
+ if (this.element.value.length > 0) {
283
+ return parseInt(this.element.value) + "px";
284
+ }
285
+
286
+ return fallbackValue || '';
287
+ };
288
+
289
+ Option.prototype.getValue = function (fallbackValue) {
290
+
291
+ if (this.element.value.length > 0) {
292
+ return this.element.value;
293
+ }
294
+
295
+ return fallbackValue || '';
296
+ };
297
+
298
+ Option.prototype.clear = function () {
299
+ this.element.value = '';
300
+ };
301
+
302
+ Option.prototype.setValue = function (value) {
303
+ this.element.value = value;
304
+ };
305
+
306
+ module.exports = Option;
307
+
308
+ },{}],5:[function(require,module,exports){
309
+ /*!
310
+ * EventEmitter v4.2.11 - git.io/ee
311
+ * Unlicense - http://unlicense.org/
312
+ * Oliver Caldwell - http://oli.me.uk/
313
+ * @preserve
314
+ */
315
+
316
+ ;(function () {
317
+ 'use strict';
318
+
319
+ /**
320
+ * Class for managing events.
321
+ * Can be extended to provide event functionality in other classes.
322
+ *
323
+ * @class EventEmitter Manages event registering and emitting.
324
+ */
325
+ function EventEmitter() {}
326
+
327
+ // Shortcuts to improve speed and size
328
+ var proto = EventEmitter.prototype;
329
+ var exports = this;
330
+ var originalGlobalValue = exports.EventEmitter;
331
+
332
+ /**
333
+ * Finds the index of the listener for the event in its storage array.
334
+ *
335
+ * @param {Function[]} listeners Array of listeners to search through.
336
+ * @param {Function} listener Method to look for.
337
+ * @return {Number} Index of the specified listener, -1 if not found
338
+ * @api private
339
+ */
340
+ function indexOfListener(listeners, listener) {
341
+ var i = listeners.length;
342
+ while (i--) {
343
+ if (listeners[i].listener === listener) {
344
+ return i;
345
+ }
346
+ }
347
+
348
+ return -1;
349
+ }
350
+
351
+ /**
352
+ * Alias a method while keeping the context correct, to allow for overwriting of target method.
353
+ *
354
+ * @param {String} name The name of the target method.
355
+ * @return {Function} The aliased method
356
+ * @api private
357
+ */
358
+ function alias(name) {
359
+ return function aliasClosure() {
360
+ return this[name].apply(this, arguments);
361
+ };
362
+ }
363
+
364
+ /**
365
+ * Returns the listener array for the specified event.
366
+ * Will initialise the event object and listener arrays if required.
367
+ * 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.
368
+ * Each property in the object response is an array of listener functions.
369
+ *
370
+ * @param {String|RegExp} evt Name of the event to return the listeners from.
371
+ * @return {Function[]|Object} All listener functions for the event.
372
+ */
373
+ proto.getListeners = function getListeners(evt) {
374
+ var events = this._getEvents();
375
+ var response;
376
+ var key;
377
+
378
+ // Return a concatenated array of all matching events if
379
+ // the selector is a regular expression.
380
+ if (evt instanceof RegExp) {
381
+ response = {};
382
+ for (key in events) {
383
+ if (events.hasOwnProperty(key) && evt.test(key)) {
384
+ response[key] = events[key];
385
+ }
386
+ }
387
+ }
388
+ else {
389
+ response = events[evt] || (events[evt] = []);
390
+ }
391
+
392
+ return response;
393
+ };
394
+
395
+ /**
396
+ * Takes a list of listener objects and flattens it into a list of listener functions.
397
+ *
398
+ * @param {Object[]} listeners Raw listener objects.
399
+ * @return {Function[]} Just the listener functions.
400
+ */
401
+ proto.flattenListeners = function flattenListeners(listeners) {
402
+ var flatListeners = [];
403
+ var i;
404
+
405
+ for (i = 0; i < listeners.length; i += 1) {
406
+ flatListeners.push(listeners[i].listener);
407
+ }
408
+
409
+ return flatListeners;
410
+ };
411
+
412
+ /**
413
+ * 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.
414
+ *
415
+ * @param {String|RegExp} evt Name of the event to return the listeners from.
416
+ * @return {Object} All listener functions for an event in an object.
417
+ */
418
+ proto.getListenersAsObject = function getListenersAsObject(evt) {
419
+ var listeners = this.getListeners(evt);
420
+ var response;
421
+
422
+ if (listeners instanceof Array) {
423
+ response = {};
424
+ response[evt] = listeners;
425
+ }
426
+
427
+ return response || listeners;
428
+ };
429
+
430
+ /**
431
+ * Adds a listener function to the specified event.
432
+ * The listener will not be added if it is a duplicate.
433
+ * If the listener returns true then it will be removed after it is called.
434
+ * If you pass a regular expression as the event name then the listener will be added to all events that match it.
435
+ *
436
+ * @param {String|RegExp} evt Name of the event to attach the listener to.
437
+ * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
438
+ * @return {Object} Current instance of EventEmitter for chaining.
439
+ */
440
+ proto.addListener = function addListener(evt, listener) {
441
+ var listeners = this.getListenersAsObject(evt);
442
+ var listenerIsWrapped = typeof listener === 'object';
443
+ var key;
444
+
445
+ for (key in listeners) {
446
+ if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
447
+ listeners[key].push(listenerIsWrapped ? listener : {
448
+ listener: listener,
449
+ once: false
450
+ });
451
+ }
452
+ }
453
+
454
+ return this;
455
+ };
456
+
457
+ /**
458
+ * Alias of addListener
459
+ */
460
+ proto.on = alias('addListener');
461
+
462
+ /**
463
+ * Semi-alias of addListener. It will add a listener that will be
464
+ * automatically removed after its first execution.
465
+ *
466
+ * @param {String|RegExp} evt Name of the event to attach the listener to.
467
+ * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
468
+ * @return {Object} Current instance of EventEmitter for chaining.
469
+ */
470
+ proto.addOnceListener = function addOnceListener(evt, listener) {
471
+ return this.addListener(evt, {
472
+ listener: listener,
473
+ once: true
474
+ });
475
+ };
476
+
477
+ /**
478
+ * Alias of addOnceListener.
479
+ */
480
+ proto.once = alias('addOnceListener');
481
+
482
+ /**
483
+ * 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.
484
+ * You need to tell it what event names should be matched by a regex.
485
+ *
486
+ * @param {String} evt Name of the event to create.
487
+ * @return {Object} Current instance of EventEmitter for chaining.
488
+ */
489
+ proto.defineEvent = function defineEvent(evt) {
490
+ this.getListeners(evt);
491
+ return this;
492
+ };
493
+
494
+ /**
495
+ * Uses defineEvent to define multiple events.
496
+ *
497
+ * @param {String[]} evts An array of event names to define.
498
+ * @return {Object} Current instance of EventEmitter for chaining.
499
+ */
500
+ proto.defineEvents = function defineEvents(evts) {
501
+ for (var i = 0; i < evts.length; i += 1) {
502
+ this.defineEvent(evts[i]);
503
+ }
504
+ return this;
505
+ };
506
+
507
+ /**
508
+ * Removes a listener function from the specified event.
509
+ * When passed a regular expression as the event name, it will remove the listener from all events that match it.
510
+ *
511
+ * @param {String|RegExp} evt Name of the event to remove the listener from.
512
+ * @param {Function} listener Method to remove from the event.
513
+ * @return {Object} Current instance of EventEmitter for chaining.
514
+ */
515
+ proto.removeListener = function removeListener(evt, listener) {
516
+ var listeners = this.getListenersAsObject(evt);
517
+ var index;
518
+ var key;
519
+
520
+ for (key in listeners) {
521
+ if (listeners.hasOwnProperty(key)) {
522
+ index = indexOfListener(listeners[key], listener);
523
+
524
+ if (index !== -1) {
525
+ listeners[key].splice(index, 1);
526
+ }
527
+ }
528
+ }
529
+
530
+ return this;
531
+ };
532
+
533
+ /**
534
+ * Alias of removeListener
535
+ */
536
+ proto.off = alias('removeListener');
537
+
538
+ /**
539
+ * Adds listeners in bulk using the manipulateListeners method.
540
+ * 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.
541
+ * You can also pass it a regular expression to add the array of listeners to all events that match it.
542
+ * Yeah, this function does quite a bit. That's probably a bad thing.
543
+ *
544
+ * @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.
545
+ * @param {Function[]} [listeners] An optional array of listener functions to add.
546
+ * @return {Object} Current instance of EventEmitter for chaining.
547
+ */
548
+ proto.addListeners = function addListeners(evt, listeners) {
549
+ // Pass through to manipulateListeners
550
+ return this.manipulateListeners(false, evt, listeners);
551
+ };
552
+
553
+ /**
554
+ * Removes listeners in bulk using the manipulateListeners method.
555
+ * 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.
556
+ * You can also pass it an event name and an array of listeners to be removed.
557
+ * You can also pass it a regular expression to remove the listeners from all events that match it.
558
+ *
559
+ * @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.
560
+ * @param {Function[]} [listeners] An optional array of listener functions to remove.
561
+ * @return {Object} Current instance of EventEmitter for chaining.
562
+ */
563
+ proto.removeListeners = function removeListeners(evt, listeners) {
564
+ // Pass through to manipulateListeners
565
+ return this.manipulateListeners(true, evt, listeners);
566
+ };
567
+
568
+ /**
569
+ * 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.
570
+ * The first argument will determine if the listeners are removed (true) or added (false).
571
+ * 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.
572
+ * You can also pass it an event name and an array of listeners to be added/removed.
573
+ * You can also pass it a regular expression to manipulate the listeners of all events that match it.
574
+ *
575
+ * @param {Boolean} remove True if you want to remove listeners, false if you want to add.
576
+ * @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.
577
+ * @param {Function[]} [listeners] An optional array of listener functions to add/remove.
578
+ * @return {Object} Current instance of EventEmitter for chaining.
579
+ */
580
+ proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
581
+ var i;
582
+ var value;
583
+ var single = remove ? this.removeListener : this.addListener;
584
+ var multiple = remove ? this.removeListeners : this.addListeners;
585
+
586
+ // If evt is an object then pass each of its properties to this method
587
+ if (typeof evt === 'object' && !(evt instanceof RegExp)) {
588
+ for (i in evt) {
589
+ if (evt.hasOwnProperty(i) && (value = evt[i])) {
590
+ // Pass the single listener straight through to the singular method
591
+ if (typeof value === 'function') {
592
+ single.call(this, i, value);
593
+ }
594
+ else {
595
+ // Otherwise pass back to the multiple function
596
+ multiple.call(this, i, value);
597
+ }
598
+ }
599
+ }
600
+ }
601
+ else {
602
+ // So evt must be a string
603
+ // And listeners must be an array of listeners
604
+ // Loop over it and pass each one to the multiple method
605
+ i = listeners.length;
606
+ while (i--) {
607
+ single.call(this, evt, listeners[i]);
608
+ }
609
+ }
610
+
611
+ return this;
612
+ };
613
+
614
+ /**
615
+ * Removes all listeners from a specified event.
616
+ * If you do not specify an event then all listeners will be removed.
617
+ * That means every event will be emptied.
618
+ * You can also pass a regex to remove all events that match it.
619
+ *
620
+ * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
621
+ * @return {Object} Current instance of EventEmitter for chaining.
622
+ */
623
+ proto.removeEvent = function removeEvent(evt) {
624
+ var type = typeof evt;
625
+ var events = this._getEvents();
626
+ var key;
627
+
628
+ // Remove different things depending on the state of evt
629
+ if (type === 'string') {
630
+ // Remove all listeners for the specified event
631
+ delete events[evt];
632
+ }
633
+ else if (evt instanceof RegExp) {
634
+ // Remove all events matching the regex.
635
+ for (key in events) {
636
+ if (events.hasOwnProperty(key) && evt.test(key)) {
637
+ delete events[key];
638
+ }
639
+ }
640
+ }
641
+ else {
642
+ // Remove all listeners in all events
643
+ delete this._events;
644
+ }
645
+
646
+ return this;
647
+ };
648
+
649
+ /**
650
+ * Alias of removeEvent.
651
+ *
652
+ * Added to mirror the node API.
653
+ */
654
+ proto.removeAllListeners = alias('removeEvent');
655
+
656
+ /**
657
+ * Emits an event of your choice.
658
+ * When emitted, every listener attached to that event will be executed.
659
+ * If you pass the optional argument array then those arguments will be passed to every listener upon execution.
660
+ * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
661
+ * So they will not arrive within the array on the other side, they will be separate.
662
+ * You can also pass a regular expression to emit to all events that match it.
663
+ *
664
+ * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
665
+ * @param {Array} [args] Optional array of arguments to be passed to each listener.
666
+ * @return {Object} Current instance of EventEmitter for chaining.
667
+ */
668
+ proto.emitEvent = function emitEvent(evt, args) {
669
+ var listenersMap = this.getListenersAsObject(evt);
670
+ var listeners;
671
+ var listener;
672
+ var i;
673
+ var key;
674
+ var response;
675
+
676
+ for (key in listenersMap) {
677
+ if (listenersMap.hasOwnProperty(key)) {
678
+ listeners = listenersMap[key].slice(0);
679
+ i = listeners.length;
680
+
681
+ while (i--) {
682
+ // If the listener returns true then it shall be removed from the event
683
+ // The function is executed either with a basic call or an apply if there is an args array
684
+ listener = listeners[i];
685
+
686
+ if (listener.once === true) {
687
+ this.removeListener(evt, listener.listener);
688
+ }
689
+
690
+ response = listener.listener.apply(this, args || []);
691
+
692
+ if (response === this._getOnceReturnValue()) {
693
+ this.removeListener(evt, listener.listener);
694
+ }
695
+ }
696
+ }
697
+ }
698
+
699
+ return this;
700
+ };
701
+
702
+ /**
703
+ * Alias of emitEvent
704
+ */
705
+ proto.trigger = alias('emitEvent');
706
+
707
+ /**
708
+ * 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.
709
+ * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
710
+ *
711
+ * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
712
+ * @param {...*} Optional additional arguments to be passed to each listener.
713
+ * @return {Object} Current instance of EventEmitter for chaining.
714
+ */
715
+ proto.emit = function emit(evt) {
716
+ var args = Array.prototype.slice.call(arguments, 1);
717
+ return this.emitEvent(evt, args);
718
+ };
719
+
720
+ /**
721
+ * Sets the current value to check against when executing listeners. If a
722
+ * listeners return value matches the one set here then it will be removed
723
+ * after execution. This value defaults to true.
724
+ *
725
+ * @param {*} value The new value to check for when executing listeners.
726
+ * @return {Object} Current instance of EventEmitter for chaining.
727
+ */
728
+ proto.setOnceReturnValue = function setOnceReturnValue(value) {
729
+ this._onceReturnValue = value;
730
+ return this;
731
+ };
732
+
733
+ /**
734
+ * Fetches the current value to check against when executing listeners. If
735
+ * the listeners return value matches this one then it should be removed
736
+ * automatically. It will return true by default.
737
+ *
738
+ * @return {*|Boolean} The current value to check for or the default, true.
739
+ * @api private
740
+ */
741
+ proto._getOnceReturnValue = function _getOnceReturnValue() {
742
+ if (this.hasOwnProperty('_onceReturnValue')) {
743
+ return this._onceReturnValue;
744
+ }
745
+ else {
746
+ return true;
747
+ }
748
+ };
749
+
750
+ /**
751
+ * Fetches the events object and creates one if required.
752
+ *
753
+ * @return {Object} The events storage object.
754
+ * @api private
755
+ */
756
+ proto._getEvents = function _getEvents() {
757
+ return this._events || (this._events = {});
758
+ };
759
+
760
+ /**
761
+ * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
762
+ *
763
+ * @return {Function} Non conflicting EventEmitter class.
764
+ */
765
+ EventEmitter.noConflict = function noConflict() {
766
+ exports.EventEmitter = originalGlobalValue;
767
+ return EventEmitter;
768
+ };
769
+
770
+ // Expose the class either via AMD, CommonJS or the global object
771
+ if (typeof define === 'function' && define.amd) {
772
+ define(function () {
773
+ return EventEmitter;
774
+ });
775
+ }
776
+ else if (typeof module === 'object' && module.exports){
777
+ module.exports = EventEmitter;
778
+ }
779
+ else {
780
+ exports.EventEmitter = EventEmitter;
781
+ }
782
+ }.call(this));
783
+
784
+ },{}]},{},[1]);
785
+ ; })();
trunk/assets/js/admin-script.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ !function(){var e=void 0,t=void 0;!function n(t,r,o){function i(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof e&&e;if(!a&&u)return u(s,!0);if(l)return l(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var p=r[s]={exports:{}};t[s][0].call(p.exports,function(e){var n=t[s][1][e];return i(n?n:e)},p,p.exports,n,t,r,o)}return r[s].exports}for(var l="function"==typeof e&&e,s=0;s<o.length;s++)i(o[s]);return i}({1:[function(e,t,n){"use strict";window.Boxzilla_Admin=e("./admin/_admin.js")},{"./admin/_admin.js":2}],2:[function(e,t,n){"use strict";!function(){function n(){u.find(".boxzilla-trigger-options").toggle(""!==this.value)}function r(){l(this).parents("tr").remove()}function o(){var e="tr"===this.tagName.toLowerCase()?this:l(this).parents("tr").get(0),t=e.querySelector(".boxzilla-rule-condition").value,n=e.querySelector(".boxzilla-rule-value"),r=e.querySelector(".boxzilla-rule-qualifier"),o=n.cloneNode(!0),i=l(o);switch(l(e.querySelectorAll(".boxzilla-helper")).remove(),o.removeAttribute("name"),o.className=o.className+" boxzilla-helper",n.parentNode.insertBefore(o,n.nextSibling),i.change(function(){n.value=this.value}),o.style.display="",n.style.display="none",r.style.display="",t){default:o.placeholder=h.enterCommaSeparatedValues;break;case"":case"everywhere":r.value="1",n.value="",o.style.display="none",r.style.display="none";break;case"is_single":case"is_post":o.placeholder=h.enterCommaSeparatedPosts,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post",{multiple:!0,multipleSep:","});break;case"is_page":o.placeholder=h.enterCommaSeparatedPages,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=page",{multiple:!0,multipleSep:","});break;case"is_post_type":o.placeholder=h.enterCommaSeparatedPostTypes,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_type",{multiple:!0,multipleSep:","});break;case"is_url":o.placeholder=h.enterCommaSeparatedRelativeUrls;break;case"is_post_in_category":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=category",{multiple:!0,multipleSep:","});break;case"is_post_with_tag":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_tag",{multiple:!0,multipleSep:","})}}function i(){var e={key:a.querySelectorAll(".boxzilla-rule-row").length},t=d(e);return l(document.getElementById("boxzilla-box-rules")).after(t),!1}var l=window.jQuery,s=e("./_option.js"),a=document.getElementById("boxzilla-box-options-controls"),u=l(a);if(0!==u.length){var c=e("wolfy87-eventemitter"),p=new c,f=e("./_designer.js")(l,s,p),d=wp.template("rule-row-template"),h=boxzilla_i18n;u.on("click",".boxzilla-add-rule",i),u.on("click",".boxzilla-remove-rule",r),u.on("change",".boxzilla-rule-condition",o),u.find(".boxzilla-auto-show-trigger").on("change",n),l(window).load(function(){"undefined"==typeof window.tinyMCE&&(document.getElementById("notice-notinymce").style.display="")}),l(".boxzilla-rule-row").each(o),t.exports={Designer:f,Option:s,events:p}}}()},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t,n){function o(){"object"===r(window.tinyMCE)&&null!==tinyMCE.get("content")&&(a=e("#content_ifr"),s=a.contents().find("html"),s.css({background:"white"}),u=s.find("#tinymce"),u.addClass("boxzilla boxzilla-"+c),u.css({margin:0,background:"white",display:"inline-block",width:"auto","min-width":"240px",position:"relative"}),u.get(0).style.cssText+=";padding: 25px !important;",f=!0,n.trigger("editor.init"))}function i(){return!!f&&(u.css({"border-color":p.borderColor.getColorValue(),"border-width":p.borderWidth.getPxValue(),"border-style":p.borderStyle.getValue(),"background-color":p.backgroundColor.getColorValue(),width:p.width.getPxValue(),color:p.color.getColorValue()}),n.trigger("editor.styles.apply"),!0)}function l(){for(var e in p)"theme"!==e.substring(0,5)&&p[e].clear();i(),n.trigger("editor.styles.reset")}var s,a,u,c=document.getElementById("post_ID").value||0,p={},f=!1,d=e("#boxzilla-box-appearance-controls");return p.borderColor=new t("border-color"),p.borderWidth=new t("border-width"),p.borderStyle=new t("border-style"),p.backgroundColor=new t("background-color"),p.width=new t("width"),p.color=new t("color"),d.find("input.boxzilla-color-field").wpColorPicker({change:i,clear:i}),d.find(":input").not(".boxzilla-color-field").change(i),n.on("editor.init",i),{init:o,resetStyles:l,options:p}};t.exports=o},{}],4:[function(e,t,n){"use strict";var r=window.jQuery,o=function(e){"string"==typeof e&&(e=document.getElementById("boxzilla-"+e)),e||console.error("Unable to find option element."),this.element=e};o.prototype.getColorValue=function(){return this.element.value.length>0?r(this.element).hasClass("wp-color-field")?r(this.element).wpColorPicker("color"):this.element.value:""},o.prototype.getPxValue=function(e){return this.element.value.length>0?parseInt(this.element.value)+"px":e||""},o.prototype.getValue=function(e){return this.element.value.length>0?this.element.value:e||""},o.prototype.clear=function(){this.element.value=""},o.prototype.setValue=function(e){this.element.value=e},t.exports=o},{}],5:[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 o(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,l=this,s=l.EventEmitter;i.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},i.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,t){var n,o=this.getListenersAsObject(e),i="object"==typeof t;for(n in o)o.hasOwnProperty(n)&&r(o[n],t)===-1&&o[n].push(i?t:{listener:t,once:!1});return this},i.on=o("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=o("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,t){var n,o,i=this.getListenersAsObject(e);for(o in i)i.hasOwnProperty(o)&&(n=r(i[o],t),n!==-1&&i[o].splice(n,1));return this},i.off=o("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var r,o,i=e?this.removeListener:this.addListener,l=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)i.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(o=t[r])&&("function"==typeof o?i.call(this,r,o):l.call(this,r,o));return this},i.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},i.removeAllListeners=o("removeEvent"),i.emitEvent=function(e,t){var n,r,o,i,l,s=this.getListenersAsObject(e);for(i in s)if(s.hasOwnProperty(i))for(n=s[i].slice(0),o=n.length;o--;)r=n[o],r.once===!0&&this.removeListener(e,r.listener),l=r.listener.apply(this,t||[]),l===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},i.trigger=o("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return l.EventEmitter=s,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof n&&n.exports?n.exports=e:l.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
+ //# sourceMappingURL=admin-script.min.js.map
trunk/assets/js/admin-script.min.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["admin-script.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","window","Boxzilla_Admin","./admin/_admin.js","2","toggleTriggerOptions","$optionControls","find","toggle","this","value","removeRule","$","parents","remove","setContextualHelpers","context","tagName","toLowerCase","get","condition","querySelector","valueInput","qualifierInput","betterInput","cloneNode","$betterInput","querySelectorAll","removeAttribute","className","parentNode","insertBefore","nextSibling","change","style","display","placeholder","i18n","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","addRuleFields","data","key","optionControls","html","rowTemplate","document","getElementById","after","jQuery","Option","EventEmitter","events","Designer","wp","template","boxzilla_i18n","on","load","tinyMCE","each","./_designer.js","./_option.js","wolfy87-eventemitter","3","_typeof","Symbol","iterator","obj","constructor","prototype","init","$editorFrame","$editor","contents","css","background","$innerEditor","addClass","boxId","margin","width","min-width","position","cssText","visualEditorInitialised","trigger","applyStyles","border-color","options","borderColor","getColorValue","border-width","borderWidth","getPxValue","border-style","borderStyle","getValue","background-color","backgroundColor","color","resetStyles","substring","clear","$appearanceControls","wpColorPicker","not","4","element","console","error","hasClass","fallbackValue","parseInt","setValue","5","indexOfListener","listeners","listener","alias","name","apply","arguments","proto","originalGlobalValue","getListeners","evt","response","_getEvents","RegExp","hasOwnProperty","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","single","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceRetur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,EAAIqI,EAAU9H,OAEPP,KAGHsI,EAAWD,EAAUrI,GAEjBsI,EAASqB,QAAS,GAClBzI,KAAK8I,eAAelB,EAAKR,EAASA,UAGtCS,EAAWT,EAASA,SAASG,MAAMvH,KAAM2J,OAErC9B,IAAa7H,KAAK8J,uBAClB9J,KAAK8I,eAAelB,EAAKR,EAASA,SAMlD,OAAOpH,OAMXyH,EAAMrC,QAAUiC,EAAM,aAUtBI,EAAMsC,KAAO,SAAcnC,GACvB,GAAI+B,GAAOrB,MAAMlE,UAAUyF,MAAMzK,KAAKoI,UAAW,EACjD,OAAOxH,MAAK0J,UAAU9B,EAAK+B,IAW/BlC,EAAMuC,mBAAqB,SAA4B/J,GAEnD,MADAD,MAAKiK,iBAAmBhK,EACjBD,MAWXyH,EAAMqC,oBAAsB,WACxB,OAAI9J,KAAKgI,eAAe,qBACbhI,KAAKiK,kBAapBxC,EAAMK,WAAa,WACf,MAAO9H,MAAKwJ,UAAYxJ,KAAKwJ,aAQjCvG,EAAaiH,WAAa,WAEtB,MADA/K,GAAQ8D,aAAeyE,EAChBzE,GAIW,kBAAX5E,IAAyBA,EAAO8L,IACvC9L,EAAO,WACH,MAAO4E,KAGY,gBAAX1D,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAU8D,EAGjB9D,EAAQ8D,aAAeA,IAE7B7D,KAAKY,gBAEI","file":"admin-script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = 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\nwindow.Boxzilla_Admin = require('./admin/_admin.js');\n\n},{\"./admin/_admin.js\":2}],2:[function(require,module,exports){\n'use strict';\n\n(function () {\n\t'use strict';\n\n\tvar $ = window.jQuery;\n\tvar Option = require('./_option.js');\n\tvar optionControls = document.getElementById('boxzilla-box-options-controls');\n\tvar $optionControls = $(optionControls);\n\n\t// sanity check, are we on the correct page?\n\tif ($optionControls.length === 0) {\n\t\treturn;\n\t}\n\n\tvar EventEmitter = require('wolfy87-eventemitter');\n\tvar events = new EventEmitter();\n\tvar Designer = require('./_designer.js')($, Option, events);\n\tvar rowTemplate = wp.template('rule-row-template');\n\tvar i18n = boxzilla_i18n;\n\n\t// events\n\t$optionControls.on('click', \".boxzilla-add-rule\", addRuleFields);\n\t$optionControls.on('click', \".boxzilla-remove-rule\", removeRule);\n\t$optionControls.on('change', \".boxzilla-rule-condition\", setContextualHelpers);\n\t$optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);\n\n\t$(window).load(function () {\n\t\tif (typeof window.tinyMCE === \"undefined\") {\n\t\t\tdocument.getElementById('notice-notinymce').style.display = '';\n\t\t}\n\t});\n\n\t// call contextual helper method for each row\n\t$('.boxzilla-rule-row').each(setContextualHelpers);\n\n\tfunction toggleTriggerOptions() {\n\t\t$optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');\n\t}\n\n\tfunction removeRule() {\n\t\t$(this).parents('tr').remove();\n\t}\n\n\tfunction setContextualHelpers() {\n\n\t\tvar context = this.tagName.toLowerCase() === \"tr\" ? this : $(this).parents('tr').get(0);\n\t\tvar condition = context.querySelector('.boxzilla-rule-condition').value;\n\t\tvar valueInput = context.querySelector('.boxzilla-rule-value');\n\t\tvar qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n\t\tvar betterInput = valueInput.cloneNode(true);\n\t\tvar $betterInput = $(betterInput);\n\n\t\t// remove previously added helpers\n\t\t$(context.querySelectorAll('.boxzilla-helper')).remove();\n\n\t\t// prepare better input\n\t\tbetterInput.removeAttribute('name');\n\t\tbetterInput.className = betterInput.className + ' boxzilla-helper';\n\t\tvalueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n\t\t$betterInput.change(function () {\n\t\t\tvalueInput.value = this.value;\n\t\t});\n\n\t\tbetterInput.style.display = '';\n\t\tvalueInput.style.display = 'none';\n\t\tqualifierInput.style.display = '';\n\n\t\t// change placeholder for textual help\n\t\tswitch (condition) {\n\t\t\tdefault:\n\t\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedValues;\n\t\t\t\tbreak;\n\n\t\t\tcase '':\n\t\t\tcase 'everywhere':\n\t\t\t\tqualifierInput.value = '1';\n\t\t\t\tvalueInput.value = '';\n\t\t\t\tbetterInput.style.display = 'none';\n\t\t\t\tqualifierInput.style.display = 'none';\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_single':\n\t\t\tcase 'is_post':\n\t\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPosts;\n\t\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", { multiple: true, multipleSep: \",\" });\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_page':\n\t\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPages;\n\t\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", { multiple: true, multipleSep: \",\" });\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_post_type':\n\t\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n\t\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", { multiple: true, multipleSep: \",\" });\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_url':\n\t\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_post_in_category':\n\t\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", { multiple: true, multipleSep: \",\" });\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_post_with_tag':\n\t\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", { multiple: true, multipleSep: \",\" });\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tfunction addRuleFields() {\n\t\tvar data = {\n\t\t\t'key': optionControls.querySelectorAll('.boxzilla-rule-row').length\n\t\t};\n\t\tvar html = rowTemplate(data);\n\t\t$(document.getElementById('boxzilla-box-rules')).after(html);\n\t\treturn false;\n\t}\n\n\tmodule.exports = {\n\t\t'Designer': Designer,\n\t\t'Option': Option,\n\t\t'events': events\n\t};\n})();\n\n},{\"./_designer.js\":3,\"./_option.js\":4,\"wolfy87-eventemitter\":5}],3:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar Designer = function Designer($, Option, events) {\n\n\t// vars\n\tvar boxId = document.getElementById('post_ID').value || 0,\n\t $editor,\n\t $editorFrame,\n\t $innerEditor,\n\t options = {},\n\t visualEditorInitialised = false;\n\n\tvar $appearanceControls = $(\"#boxzilla-box-appearance-controls\");\n\n\t// create Option objects\n\toptions.borderColor = new Option('border-color');\n\toptions.borderWidth = new Option('border-width');\n\toptions.borderStyle = new Option('border-style');\n\toptions.backgroundColor = new Option('background-color');\n\toptions.width = new Option('width');\n\toptions.color = new Option('color');\n\n\t// functions\n\tfunction init() {\n\n\t\t// Only run if TinyMCE has actually inited\n\t\tif (_typeof(window.tinyMCE) !== \"object\" || tinyMCE.get('content') === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// add classes to TinyMCE <html>\n\t\t$editorFrame = $(\"#content_ifr\");\n\t\t$editor = $editorFrame.contents().find('html');\n\t\t$editor.css({\n\t\t\t'background': 'white'\n\t\t});\n\n\t\t// add content class and padding to TinyMCE <body>\n\t\t$innerEditor = $editor.find('#tinymce');\n\t\t$innerEditor.addClass('boxzilla boxzilla-' + boxId);\n\t\t$innerEditor.css({\n\t\t\t'margin': 0,\n\t\t\t'background': 'white',\n\t\t\t'display': 'inline-block',\n\t\t\t'width': 'auto',\n\t\t\t'min-width': '240px',\n\t\t\t'position': 'relative'\n\t\t});\n\t\t$innerEditor.get(0).style.cssText += ';padding: 25px !important;';\n\n\t\tvisualEditorInitialised = true;\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.init');\n\t}\n\n\t/**\n * Applies the styles from the options to the TinyMCE Editor\n *\n * @return bool\n */\n\tfunction applyStyles() {\n\n\t\tif (!visualEditorInitialised) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// apply styles from CSS editor\n\t\t$innerEditor.css({\n\t\t\t'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),\n\t\t\t'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),\n\t\t\t'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),\n\t\t\t'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),\n\t\t\t'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),\n\t\t\t'color': options.color.getColorValue() // getColorValue( 'color', '' )\n\t\t});\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.apply');\n\n\t\treturn true;\n\t}\n\n\tfunction resetStyles() {\n\t\tfor (var key in options) {\n\t\t\tif (key.substring(0, 5) === 'theme') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\toptions[key].clear();\n\t\t}\n\t\tapplyStyles();\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.reset');\n\t}\n\n\t// event binders\n\t$appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });\n\t$appearanceControls.find(\":input\").not(\".boxzilla-color-field\").change(applyStyles);\n\tevents.on('editor.init', applyStyles);\n\n\t// public methods\n\treturn {\n\t\t'init': init,\n\t\t'resetStyles': resetStyles,\n\t\t'options': options\n\t};\n};\n\nmodule.exports = Designer;\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\n\nvar Option = function Option(element) {\n\n\t// find corresponding element\n\tif (typeof element == \"string\") {\n\t\telement = document.getElementById('boxzilla-' + element);\n\t}\n\n\tif (!element) {\n\t\tconsole.error(\"Unable to find option element.\");\n\t}\n\n\tthis.element = element;\n};\n\nOption.prototype.getColorValue = function () {\n\tif (this.element.value.length > 0) {\n\t\tif ($(this.element).hasClass('wp-color-field')) {\n\t\t\treturn $(this.element).wpColorPicker('color');\n\t\t} else {\n\t\t\treturn this.element.value;\n\t\t}\n\t}\n\n\treturn '';\n};\n\nOption.prototype.getPxValue = function (fallbackValue) {\n\tif (this.element.value.length > 0) {\n\t\treturn parseInt(this.element.value) + \"px\";\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.getValue = function (fallbackValue) {\n\n\tif (this.element.value.length > 0) {\n\t\treturn this.element.value;\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.clear = function () {\n\tthis.element.value = '';\n};\n\nOption.prototype.setValue = function (value) {\n\tthis.element.value = value;\n};\n\nmodule.exports = Option;\n\n},{}],5:[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; })();"]}
trunk/assets/js/index.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ if( ! defined( 'STB::VERSION' ) ) {
3
+ header( 'Status: 403 Forbidden' );
4
+ header( 'HTTP/1.1 403 Forbidden' );
5
+ exit;
6
+ }
trunk/assets/js/script.js ADDED
@@ -0,0 +1,1458 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function () { var require = undefined; var module = undefined; var exports = 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){
2
+ 'use strict';
3
+
4
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
5
+
6
+ (function () {
7
+ 'use strict';
8
+
9
+ var Boxzilla = require('boxzilla');
10
+ var options = window.boxzilla_options;
11
+ var isLoggedIn = document.body.className.indexOf('logged-in') > -1;
12
+
13
+ // failsafe against including script twice.
14
+ if (options.inited) {
15
+ return;
16
+ }
17
+
18
+ // print message when test mode is enabled
19
+ if (isLoggedIn && options.testMode) {
20
+ console.log('Boxzilla: Test mode is enabled. Please disable test mode if you\'re done testing.');
21
+ }
22
+
23
+ // init boxzilla
24
+ Boxzilla.init();
25
+
26
+ // create boxes from options
27
+ for (var i = 0; i < options.boxes.length; i++) {
28
+ // get opts
29
+ var boxOpts = options.boxes[i];
30
+ boxOpts.testMode = isLoggedIn && options.testMode;
31
+
32
+ // fix http:// links in box content....
33
+ if (window.location.protocol === "https:" && window.location.host) {
34
+ var o = "http://" + window.location.host;
35
+ var n = old.replace('http://', 'https://');
36
+ boxOpts.content = boxOpts.content.replace(o, n);
37
+ }
38
+
39
+ // create box
40
+ var box = Boxzilla.create(boxOpts.id, boxOpts);
41
+
42
+ // add custom css to box
43
+ css(box.element, boxOpts.css);
44
+
45
+ box.element.firstChild.firstChild.className += " first-child";
46
+ box.element.firstChild.lastChild.className += " last-child";
47
+ }
48
+
49
+ // helper function for setting CSS styles
50
+ function css(element, styles) {
51
+ if (styles.background_color) {
52
+ element.style.background = styles.background_color;
53
+ }
54
+
55
+ if (styles.color) {
56
+ element.style.color = styles.color;
57
+ }
58
+
59
+ if (styles.border_color) {
60
+ element.style.borderColor = styles.border_color;
61
+ }
62
+
63
+ if (styles.border_width) {
64
+ element.style.borderWidth = parseInt(styles.border_width) + "px";
65
+ }
66
+
67
+ if (styles.border_style) {
68
+ element.style.borderStyle = styles.border_style;
69
+ }
70
+
71
+ if (styles.width) {
72
+ element.style.maxWidth = parseInt(styles.width) + "px";
73
+ }
74
+ }
75
+
76
+ /**
77
+ * If a MailChimp for WordPress form was submitted, open the box containing that form (if any)
78
+ *
79
+ * TODO: Just set location hash from MailChimp for WP?
80
+ */
81
+ window.addEventListener('load', function () {
82
+ if (_typeof(window.mc4wp_forms_config) === "object" && window.mc4wp_forms_config.submitted_form) {
83
+ var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;
84
+ var boxes = Boxzilla.boxes;
85
+ for (var boxId in boxes) {
86
+ if (!boxes.hasOwnProperty(boxId)) {
87
+ continue;
88
+ }
89
+ var box = boxes[boxId];
90
+ if (box.element.querySelector(selector)) {
91
+ box.show();
92
+ return;
93
+ }
94
+ }
95
+ }
96
+ });
97
+
98
+ options.inited = true;
99
+ window.Boxzilla = Boxzilla;
100
+ })();
101
+
102
+ },{"boxzilla":4}],2:[function(require,module,exports){
103
+ 'use strict';
104
+
105
+ var duration = 320;
106
+
107
+ function css(element, styles) {
108
+ for (var property in styles) {
109
+ element.style[property] = styles[property];
110
+ }
111
+ }
112
+
113
+ function initObjectProperties(properties, value) {
114
+ var newObject = {};
115
+ for (var i = 0; i < properties.length; i++) {
116
+ newObject[properties[i]] = value;
117
+ }
118
+ return newObject;
119
+ }
120
+
121
+ function copyObjectProperties(properties, object) {
122
+ var newObject = {};
123
+ for (var i = 0; i < properties.length; i++) {
124
+ newObject[properties[i]] = object[properties[i]];
125
+ }
126
+ return newObject;
127
+ }
128
+
129
+ /**
130
+ * Checks if the given element is currently being animated.
131
+ *
132
+ * @param element
133
+ * @returns {boolean}
134
+ */
135
+ function animated(element) {
136
+ return !!element.getAttribute('data-animated');
137
+ }
138
+
139
+ /**
140
+ * Toggles the element using the given animation.
141
+ *
142
+ * @param element
143
+ * @param animation Either "fade" or "slide"
144
+ */
145
+ function toggle(element, animation) {
146
+ var nowVisible = element.style.display != 'none' || element.offsetLeft > 0;
147
+
148
+ // create clone for reference
149
+ var clone = element.cloneNode(true);
150
+ var cleanup = function cleanup() {
151
+ element.removeAttribute('data-animated');
152
+ element.setAttribute('style', clone.getAttribute('style'));
153
+ element.style.display = nowVisible ? 'none' : '';
154
+ };
155
+
156
+ // store attribute so everyone knows we're animating this element
157
+ element.setAttribute('data-animated', "true");
158
+
159
+ // toggle element visiblity right away if we're making something visible
160
+ if (!nowVisible) {
161
+ element.style.display = '';
162
+ }
163
+
164
+ var hiddenStyles, visibleStyles;
165
+
166
+ // animate properties
167
+ if (animation === 'slide') {
168
+ hiddenStyles = initObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 0);
169
+ visibleStyles = {};
170
+
171
+ if (!nowVisible) {
172
+ var computedStyles = window.getComputedStyle(element);
173
+ visibleStyles = copyObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], computedStyles);
174
+ css(element, hiddenStyles);
175
+ }
176
+
177
+ // don't show a scrollbar during animation
178
+ element.style.overflowY = 'hidden';
179
+ animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);
180
+ } else {
181
+ hiddenStyles = { opacity: 0 };
182
+ visibleStyles = { opacity: 1 };
183
+ if (!nowVisible) {
184
+ css(element, hiddenStyles);
185
+ }
186
+
187
+ animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);
188
+ }
189
+ }
190
+
191
+ function animate(element, targetStyles, fn) {
192
+ var last = +new Date();
193
+ var initialStyles = window.getComputedStyle(element);
194
+ var currentStyles = {};
195
+ var propSteps = {};
196
+
197
+ for (var property in targetStyles) {
198
+ // make sure we have an object filled with floats
199
+ targetStyles[property] = parseFloat(targetStyles[property]);
200
+
201
+ // calculate step size & current value
202
+ var to = targetStyles[property];
203
+ var current = parseFloat(initialStyles[property]);
204
+
205
+ // is there something to do?
206
+ if (current == to) {
207
+ delete targetStyles[property];
208
+ continue;
209
+ }
210
+
211
+ propSteps[property] = (to - current) / duration; // points per second
212
+ currentStyles[property] = current;
213
+ }
214
+
215
+ var tick = function tick() {
216
+ var now = +new Date();
217
+ var timeSinceLastTick = now - last;
218
+ var done = true;
219
+
220
+ var step, to, increment, newValue;
221
+ for (var property in targetStyles) {
222
+ step = propSteps[property];
223
+ to = targetStyles[property];
224
+ increment = step * timeSinceLastTick;
225
+ newValue = currentStyles[property] + increment;
226
+
227
+ if (step > 0 && newValue >= to || step < 0 && newValue <= to) {
228
+ newValue = to;
229
+ } else {
230
+ done = false;
231
+ }
232
+
233
+ // store new value
234
+ currentStyles[property] = newValue;
235
+
236
+ var suffix = property !== "opacity" ? "px" : "";
237
+ element.style[property] = newValue + suffix;
238
+ }
239
+
240
+ last = +new Date();
241
+
242
+ // keep going until we're done for all props
243
+ if (!done) {
244
+ window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);
245
+ } else {
246
+ // call callback
247
+ fn && fn();
248
+ }
249
+ };
250
+
251
+ tick();
252
+ }
253
+
254
+ module.exports = {
255
+ 'toggle': toggle,
256
+ 'animate': animate,
257
+ 'animated': animated
258
+ };
259
+
260
+ },{}],3:[function(require,module,exports){
261
+ 'use strict';
262
+
263
+ var defaults = {
264
+ 'animation': 'fade',
265
+ 'rehide': false,
266
+ 'content': '',
267
+ 'cookie': null,
268
+ 'icon': '&times',
269
+ 'minimumScreenWidth': 0,
270
+ 'position': 'center',
271
+ 'testMode': false,
272
+ 'trigger': false,
273
+ 'closable': true
274
+ },
275
+ Boxzilla,
276
+ Animator = require('./animator.js');
277
+
278
+ /**
279
+ * Merge 2 objects, values of the latter overwriting the former.
280
+ *
281
+ * @param obj1
282
+ * @param obj2
283
+ * @returns {*}
284
+ */
285
+ function merge(obj1, obj2) {
286
+ var obj3 = {};
287
+ for (var attrname in obj1) {
288
+ obj3[attrname] = obj1[attrname];
289
+ }
290
+ for (var attrname in obj2) {
291
+ obj3[attrname] = obj2[attrname];
292
+ }
293
+ return obj3;
294
+ }
295
+
296
+ /**
297
+ * Get the real height of entire document.
298
+ * @returns {number}
299
+ */
300
+ function getDocumentHeight() {
301
+ var body = document.body,
302
+ html = document.documentElement;
303
+
304
+ var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
305
+
306
+ return height;
307
+ }
308
+
309
+ // Box Object
310
+ var Box = function Box(id, config) {
311
+ this.id = id;
312
+
313
+ // store config values
314
+ this.config = merge(defaults, config);
315
+
316
+ // store ref to overlay
317
+ this.overlay = document.getElementById('boxzilla-overlay');
318
+
319
+ // state
320
+ this.visible = false;
321
+ this.dismissed = false;
322
+ this.triggered = false;
323
+ this.triggerHeight = 0;
324
+ this.cookieSet = false;
325
+ this.element = null;
326
+ this.closeIcon = null;
327
+
328
+ // if a trigger was given, calculate values once and store
329
+ if (this.config.trigger) {
330
+ if (this.config.trigger.method === 'percentage' || this.config.trigger.method === 'element') {
331
+ this.triggerHeight = this.calculateTriggerHeight();
332
+ }
333
+
334
+ this.cookieSet = this.isCookieSet();
335
+ }
336
+
337
+ // create dom elements for this box
338
+ this.dom();
339
+
340
+ // further initialise the box
341
+ this.events();
342
+ };
343
+
344
+ // initialise the box
345
+ Box.prototype.events = function () {
346
+ var box = this;
347
+
348
+ // attach event to "close" icon inside box
349
+ this.closeIcon && this.closeIcon.addEventListener('click', box.dismiss.bind(this));
350
+
351
+ this.element.addEventListener('click', function (e) {
352
+ if (e.target.tagName === 'A') {
353
+ Boxzilla.trigger('box.interactions.link', [box, e.target]);
354
+ }
355
+ }, false);
356
+
357
+ this.element.addEventListener('submit', function (e) {
358
+ box.setCookie();
359
+ Boxzilla.trigger('box.interactions.form', [box, e.target]);
360
+ }, false);
361
+
362
+ window.addEventListener("hashchange", function () {
363
+ var needle = "#boxzilla-" + box.id;
364
+ if (location.hash === needle) {
365
+ box.toggle();
366
+ }
367
+ });
368
+
369
+ // maybe show box right away
370
+ if (this.fits() && this.locationHashRefersBox()) {
371
+ window.addEventListener('load', this.show.bind(this));
372
+ }
373
+ };
374
+
375
+ // generate dom elements for this box
376
+ Box.prototype.dom = function () {
377
+ var wrapper = document.createElement('div');
378
+ wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';
379
+
380
+ var box = document.createElement('div');
381
+ box.setAttribute('id', 'boxzilla-' + this.id);
382
+ box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;
383
+ box.style.display = 'none';
384
+ wrapper.appendChild(box);
385
+
386
+ var content = document.createElement('div');
387
+ content.className = 'boxzilla-content';
388
+ content.innerHTML = this.config.content;
389
+ box.appendChild(content);
390
+
391
+ // remove <script> from box content and append them to the document body
392
+ var scripts = content.querySelectorAll('script');
393
+ if (scripts.length) {
394
+ var script = document.createElement('script');
395
+ for (var i = 0; i < scripts.length; i++) {
396
+ script.appendChild(document.createTextNode(scripts[i].text));
397
+ scripts[i].parentNode.removeChild(scripts[i]);
398
+ }
399
+ document.body.appendChild(script);
400
+ }
401
+
402
+ if (this.config.closable && this.config.icon) {
403
+ var closeIcon = document.createElement('span');
404
+ closeIcon.className = "boxzilla-close-icon";
405
+ closeIcon.innerHTML = this.config.icon;
406
+ box.appendChild(closeIcon);
407
+ this.closeIcon = closeIcon;
408
+ }
409
+
410
+ document.body.appendChild(wrapper);
411
+ this.element = box;
412
+ };
413
+
414
+ // set (calculate) custom box styling depending on box options
415
+ Box.prototype.setCustomBoxStyling = function () {
416
+
417
+ // reset element to its initial state
418
+ var origDisplay = this.element.style.display;
419
+ this.element.style.display = '';
420
+ this.element.style.overflowY = 'auto';
421
+ this.element.style.maxHeight = 'none';
422
+
423
+ // get new dimensions
424
+ var windowHeight = window.innerHeight;
425
+ var boxHeight = this.element.clientHeight;
426
+
427
+ // add scrollbar to box and limit height
428
+ if (boxHeight > windowHeight) {
429
+ this.element.style.maxHeight = windowHeight + "px";
430
+ this.element.style.overflowY = 'scroll';
431
+ }
432
+
433
+ // set new top margin for boxes which are centered
434
+ if (this.config.position === 'center') {
435
+ var newTopMargin = (windowHeight - boxHeight) / 2;
436
+ newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;
437
+ this.element.style.marginTop = newTopMargin + "px";
438
+ }
439
+
440
+ this.element.style.display = origDisplay;
441
+ };
442
+
443
+ // toggle visibility of the box
444
+ Box.prototype.toggle = function (show) {
445
+
446
+ // revert visibility if no explicit argument is given
447
+ if (typeof show === "undefined") {
448
+ show = !this.visible;
449
+ }
450
+
451
+ // is box already at desired visibility?
452
+ if (show === this.visible) {
453
+ return false;
454
+ }
455
+
456
+ // is box being animated?
457
+ if (Animator.animated(this.element)) {
458
+ return false;
459
+ }
460
+
461
+ // if box should be hidden but is not closable, bail.
462
+ if (!show && !this.config.closable) {
463
+ return false;
464
+ }
465
+
466
+ // set new visibility status
467
+ this.visible = show;
468
+
469
+ // calculate new styling rules
470
+ this.setCustomBoxStyling();
471
+
472
+ // trigger event
473
+ Boxzilla.trigger('box.' + (show ? 'show' : 'hide'), [this]);
474
+
475
+ // show or hide box using selected animation
476
+ if (this.config.position === 'center') {
477
+ this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');
478
+ Animator.toggle(this.overlay, "fade");
479
+ }
480
+
481
+ Animator.toggle(this.element, this.config.animation);
482
+
483
+ // focus on first input field in box
484
+ var firstInput = this.element.querySelector('input, textarea');
485
+ if (firstInput) {
486
+ firstInput.focus();
487
+ }
488
+
489
+ return true;
490
+ };
491
+
492
+ // show the box
493
+ Box.prototype.show = function () {
494
+ return this.toggle(true);
495
+ };
496
+
497
+ // hide the box
498
+ Box.prototype.hide = function () {
499
+ return this.toggle(false);
500
+ };
501
+
502
+ // calculate trigger height
503
+ Box.prototype.calculateTriggerHeight = function () {
504
+ var triggerHeight = 0;
505
+
506
+ if (this.config.trigger.method === 'element') {
507
+ var triggerElement = document.body.querySelector(this.config.trigger.value);
508
+ if (triggerElement) {
509
+ var offset = triggerElement.getBoundingClientRect();
510
+ triggerHeight = offset.top;
511
+ }
512
+ } else if (this.config.trigger.method === 'percentage') {
513
+ triggerHeight = this.config.trigger.value / 100 * getDocumentHeight();
514
+ }
515
+
516
+ return triggerHeight;
517
+ };
518
+
519
+ // checks whether window.location.hash equals the box element ID or that of any element inside the box
520
+ Box.prototype.locationHashRefersBox = function () {
521
+
522
+ if (!window.location.hash || 0 === window.location.hash.length) {
523
+ return false;
524
+ }
525
+
526
+ var elementId = window.location.hash.substring(1);
527
+ if (elementId === this.element.id) {
528
+ return true;
529
+ } else if (this.element.querySelector('#' + elementId)) {
530
+ return true;
531
+ }
532
+
533
+ return false;
534
+ };
535
+
536
+ Box.prototype.fits = function () {
537
+ if (this.config.minimumScreenWidth <= 0) {
538
+ return true;
539
+ }
540
+
541
+ return window.innerWidth > this.config.minimumScreenWidth;
542
+ };
543
+
544
+ // is this box enabled?
545
+ Box.prototype.mayAutoShow = function () {
546
+
547
+ if (this.dismissed) {
548
+ return false;
549
+ }
550
+
551
+ // check if box fits on given minimum screen width
552
+ if (!this.fits()) {
553
+ return false;
554
+ }
555
+
556
+ // if trigger empty or error in calculating triggerHeight, return false
557
+ if (!this.config.trigger) {
558
+ return false;
559
+ }
560
+
561
+ // rely on cookie value (show if not set, don't show if set)
562
+ return !this.cookieSet;
563
+ };
564
+
565
+ Box.prototype.mayRehide = function () {
566
+ return this.config.rehide && this.triggered;
567
+ };
568
+
569
+ Box.prototype.isCookieSet = function () {
570
+ // always show on test mode
571
+ if (this.config.testMode) {
572
+ return false;
573
+ }
574
+
575
+ // if either cookie is null or trigger & dismiss are both falsey, don't bother checking.
576
+ if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {
577
+ return false;
578
+ }
579
+
580
+ var cookieSet = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + 'boxzilla_box_' + this.id + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1") === "true";
581
+ return cookieSet;
582
+ };
583
+
584
+ // set cookie that disables automatically showing the box
585
+ Box.prototype.setCookie = function (hours) {
586
+ var expiryDate = new Date();
587
+ expiryDate.setHours(expiryDate.getHours() + hours);
588
+ document.cookie = 'boxzilla_box_' + this.id + '=true; expires=' + expiryDate.toUTCString() + '; path=/';
589
+ };
590
+
591
+ Box.prototype.trigger = function () {
592
+ var shown = this.show();
593
+ if (!shown) {
594
+ return;
595
+ }
596
+
597
+ this.triggered = true;
598
+ if (this.config.cookie && this.config.cookie.triggered) {
599
+ this.setCookie(this.config.cookie.triggered);
600
+ }
601
+ };
602
+
603
+ /**
604
+ * Dismisses the box and optionally sets a cookie.
605
+ *
606
+ * @param e The event that triggered this dismissal.
607
+ * @returns {boolean}
608
+ */
609
+ Box.prototype.dismiss = function (e) {
610
+ // prevent default action
611
+ e && e.preventDefault();
612
+
613
+ // only dismiss box if it's currently open.
614
+ if (!this.visible) {
615
+ return false;
616
+ }
617
+
618
+ // hide box element
619
+ this.hide();
620
+
621
+ // set cookie
622
+ if (this.config.cookie && this.config.cookie.dismissed) {
623
+ this.setCookie(this.config.cookie.dismissed);
624
+ }
625
+
626
+ this.dismissed = true;
627
+ Boxzilla.trigger('box.dismiss', [this]);
628
+ return true;
629
+ };
630
+
631
+ module.exports = function (_Boxzilla) {
632
+ Boxzilla = _Boxzilla;
633
+ return Box;
634
+ };
635
+
636
+ },{"./animator.js":2}],4:[function(require,module,exports){
637
+ 'use strict';
638
+
639
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
640
+
641
+ var EventEmitter = require('wolfy87-eventemitter'),
642
+ Boxzilla = Object.create(EventEmitter.prototype),
643
+ Box = require('./box.js')(Boxzilla),
644
+ Timer = require('./timer.js'),
645
+ boxes = [],
646
+ overlay,
647
+ exitIntentDelayTimer,
648
+ exitIntentTriggered,
649
+ siteTimer,
650
+ pageTimer,
651
+ pageViews;
652
+
653
+ function throttle(fn, threshhold, scope) {
654
+ threshhold || (threshhold = 250);
655
+ var last, deferTimer;
656
+ return function () {
657
+ var context = scope || this;
658
+
659
+ var now = +new Date(),
660
+ args = arguments;
661
+ if (last && now < last + threshhold) {
662
+ // hold on to it
663
+ clearTimeout(deferTimer);
664
+ deferTimer = setTimeout(function () {
665
+ last = now;
666
+ fn.apply(context, args);
667
+ }, threshhold);
668
+ } else {
669
+ last = now;
670
+ fn.apply(context, args);
671
+ }
672
+ };
673
+ }
674
+
675
+ // "keyup" listener
676
+ function onKeyUp(e) {
677
+ if (e.keyCode == 27) {
678
+ Boxzilla.dismiss();
679
+ }
680
+ }
681
+
682
+ // check "pageviews" criteria for each box
683
+ function checkPageViewsCriteria() {
684
+
685
+ // don't bother if another box is currently open
686
+ if (isAnyBoxVisible()) {
687
+ return;
688
+ }
689
+
690
+ boxes.forEach(function (box) {
691
+ if (!box.mayAutoShow()) {
692
+ return;
693
+ }
694
+
695
+ if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {
696
+ box.trigger();
697
+ }
698
+ });
699
+ }
700
+
701
+ // check time trigger criteria for each box
702
+ function checkTimeCriteria() {
703
+ // don't bother if another box is currently open
704
+ if (isAnyBoxVisible()) {
705
+ return;
706
+ }
707
+
708
+ boxes.forEach(function (box) {
709
+ if (!box.mayAutoShow()) {
710
+ return;
711
+ }
712
+
713
+ // check "time on site" trigger
714
+ if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {
715
+ box.trigger();
716
+ }
717
+
718
+ // check "time on page" trigger
719
+ if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {
720
+ box.trigger();
721
+ }
722
+ });
723
+ }
724
+
725
+ // check triggerHeight criteria for all boxes
726
+ function checkHeightCriteria() {
727
+ var scrollY = (window.scrollY || window.pageYOffset) + window.innerHeight * 0.75;
728
+
729
+ boxes.forEach(function (box) {
730
+
731
+ if (!box.mayAutoShow() || box.triggerHeight <= 0) {
732
+ return;
733
+ }
734
+
735
+ if (scrollY > box.triggerHeight) {
736
+ // don't bother if another box is currently open
737
+ if (isAnyBoxVisible()) {
738
+ return;
739
+ }
740
+
741
+ // trigger box
742
+ box.trigger();
743
+ } else if (box.mayRehide()) {
744
+ box.hide();
745
+ }
746
+ });
747
+ }
748
+
749
+ // recalculate heights and variables based on height
750
+ function recalculateHeights() {
751
+ boxes.forEach(function (box) {
752
+ box.setCustomBoxStyling();
753
+ });
754
+ }
755
+
756
+ function onOverlayClick(e) {
757
+ var x = e.offsetX;
758
+ var y = e.offsetY;
759
+
760
+ // calculate if click was near a box to avoid closing it (click error margin)
761
+ boxes.forEach(function (box) {
762
+ var rect = box.element.getBoundingClientRect();
763
+ var margin = 100 + window.innerWidth * 0.05;
764
+
765
+ // if click was not anywhere near box, dismiss it.
766
+ if (x < rect.left - margin || x > rect.right + margin || y < rect.top - margin || y > rect.bottom + margin) {
767
+ box.dismiss();
768
+ }
769
+ });
770
+ }
771
+
772
+ function triggerExitIntent() {
773
+ // do nothing if already triggered OR another box is visible.
774
+ if (exitIntentTriggered || isAnyBoxVisible()) {
775
+ return;
776
+ }
777
+
778
+ boxes.forEach(function (box) {
779
+ if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {
780
+ box.trigger();
781
+ }
782
+ });
783
+
784
+ exitIntentTriggered = true;
785
+ }
786
+
787
+ function onMouseLeave(e) {
788
+ var delay = 400;
789
+
790
+ // did mouse leave at top of window?
791
+ if (e.clientY <= 0) {
792
+ exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);
793
+ }
794
+ }
795
+
796
+ function isAnyBoxVisible() {
797
+
798
+ for (var i = 0; i < boxes.length; i++) {
799
+ var box = boxes[i];
800
+
801
+ if (box.visible) {
802
+ return true;
803
+ }
804
+ }
805
+
806
+ return false;
807
+ }
808
+
809
+ function onMouseEnter() {
810
+ if (exitIntentDelayTimer) {
811
+ window.clearInterval(exitIntentDelayTimer);
812
+ exitIntentDelayTimer = null;
813
+ }
814
+ }
815
+
816
+ var timers = {
817
+ start: function start() {
818
+ var sessionTime = sessionStorage.getItem('boxzilla_timer');
819
+ if (sessionTime) siteTimer.time = sessionTime;
820
+ siteTimer.start();
821
+ pageTimer.start();
822
+ },
823
+ stop: function stop() {
824
+ sessionStorage.setItem('boxzilla_timer', siteTimer.time);
825
+ siteTimer.stop();
826
+ pageTimer.stop();
827
+ }
828
+ };
829
+
830
+ // initialise & add event listeners
831
+ Boxzilla.init = function () {
832
+ siteTimer = new Timer(sessionStorage.getItem('boxzilla_timer') || 0);
833
+ pageTimer = new Timer(0);
834
+ pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;
835
+
836
+ // insert styles into DOM
837
+ var styles = require('./styles.js');
838
+ var styleElement = document.createElement('style');
839
+ styleElement.setAttribute("type", "text/css");
840
+ styleElement.innerHTML = styles;
841
+ document.head.appendChild(styleElement);
842
+
843
+ // add overlay element to dom
844
+ overlay = document.createElement('div');
845
+ overlay.style.display = 'none';
846
+ overlay.id = 'boxzilla-overlay';
847
+ document.body.appendChild(overlay);
848
+
849
+ // event binds
850
+ window.addEventListener('touchmove', throttle(checkHeightCriteria));
851
+ window.addEventListener('scroll', throttle(checkHeightCriteria));
852
+ window.addEventListener('resize', throttle(recalculateHeights));
853
+ window.addEventListener('load', recalculateHeights);
854
+ overlay.addEventListener('click', onOverlayClick);
855
+ window.setInterval(checkTimeCriteria, 1000);
856
+ window.setTimeout(checkPageViewsCriteria, 1000);
857
+ document.documentElement.addEventListener('mouseleave', onMouseLeave);
858
+ document.documentElement.addEventListener('mouseenter', onMouseEnter);
859
+ document.addEventListener('keyup', onKeyUp);
860
+
861
+ timers.start();
862
+ window.addEventListener('focus', timers.start);
863
+ window.addEventListener('beforeunload', function () {
864
+ timers.stop();
865
+ sessionStorage.setItem('boxzilla_pageviews', ++pageViews);
866
+ });
867
+ window.addEventListener('blur', timers.stop);
868
+
869
+ Boxzilla.trigger('ready');
870
+ };
871
+
872
+ /**
873
+ * Create a new Box
874
+ *
875
+ * @param string id
876
+ * @param object opts
877
+ *
878
+ * @returns Box
879
+ */
880
+ Boxzilla.create = function (id, opts) {
881
+ var box = new Box(id, opts);
882
+ boxes.push(box);
883
+ return box;
884
+ };
885
+
886
+ Boxzilla.get = function (id) {
887
+ for (var i = 0; i < boxes.length; i++) {
888
+ var box = boxes[i];
889
+ if (box.id == id) {
890
+ return box;
891
+ }
892
+ }
893
+
894
+ throw new Error("No box exists with ID " + id);
895
+ };
896
+
897
+ // dismiss a single box (or all by omitting id param)
898
+ Boxzilla.dismiss = function (id) {
899
+ // if no id given, dismiss all current open boxes
900
+ if (typeof id === "undefined") {
901
+ boxes.forEach(function (box) {
902
+ box.dismiss();
903
+ });
904
+ } else if (_typeof(boxes[id]) === "object") {
905
+ Boxzilla.get(id).dismiss();
906
+ }
907
+ };
908
+
909
+ Boxzilla.hide = function (id) {
910
+ if (typeof id === "undefined") {
911
+ boxes.forEach(function (box) {
912
+ box.hide();
913
+ });
914
+ } else {
915
+ Boxzilla.get(id).hide();
916
+ }
917
+ };
918
+
919
+ Boxzilla.show = function (id) {
920
+ if (typeof id === "undefined") {
921
+ boxes.forEach(function (box) {
922
+ box.show();
923
+ });
924
+ } else {
925
+ Boxzilla.get(id).show();
926
+ }
927
+ };
928
+
929
+ Boxzilla.toggle = function (id) {
930
+ if (typeof id === "undefined") {
931
+ boxes.forEach(function (box) {
932
+ box.toggle();
933
+ });
934
+ } else {
935
+ Boxzilla.get(id).toggle();
936
+ }
937
+ };
938
+
939
+ // expose each individual box.
940
+ Boxzilla.boxes = boxes;
941
+
942
+ window.Boxzilla = Boxzilla;
943
+
944
+ if (typeof module !== 'undefined' && module.exports) {
945
+ module.exports = Boxzilla;
946
+ }
947
+
948
+ },{"./box.js":3,"./styles.js":5,"./timer.js":6,"wolfy87-eventemitter":7}],5:[function(require,module,exports){
949
+ "use strict";
950
+
951
+ var styles = "@media(max-width:780px){body,html{-webkit-overflow-scrolling:touch!important}}#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}";
952
+ module.exports = styles;
953
+
954
+ },{}],6:[function(require,module,exports){
955
+ 'use strict';
956
+
957
+ var Timer = function Timer(start) {
958
+ this.time = start;
959
+ this.interval = 0;
960
+ };
961
+
962
+ Timer.prototype.tick = function () {
963
+ this.time++;
964
+ };
965
+
966
+ Timer.prototype.start = function () {
967
+ if (!this.interval) {
968
+ this.interval = window.setInterval(this.tick.bind(this), 1000);
969
+ }
970
+ };
971
+
972
+ Timer.prototype.stop = function () {
973
+ if (this.interval) {
974
+ window.clearInterval(this.interval);
975
+ this.interval = 0;
976
+ }
977
+ };
978
+
979
+ module.exports = Timer;
980
+
981
+ },{}],7:[function(require,module,exports){
982
+ /*!
983
+ * EventEmitter v4.2.11 - git.io/ee
984
+ * Unlicense - http://unlicense.org/
985
+ * Oliver Caldwell - http://oli.me.uk/
986
+ * @preserve
987
+ */
988
+
989
+ ;(function () {
990
+ 'use strict';
991
+
992
+ /**
993
+ * Class for managing events.
994
+ * Can be extended to provide event functionality in other classes.
995
+ *
996
+ * @class EventEmitter Manages event registering and emitting.
997
+ */
998
+ function EventEmitter() {}
999
+
1000
+ // Shortcuts to improve speed and size
1001
+ var proto = EventEmitter.prototype;
1002
+ var exports = this;
1003
+ var originalGlobalValue = exports.EventEmitter;
1004
+
1005
+ /**
1006
+ * Finds the index of the listener for the event in its storage array.
1007
+ *
1008
+ * @param {Function[]} listeners Array of listeners to search through.
1009
+ * @param {Function} listener Method to look for.
1010
+ * @return {Number} Index of the specified listener, -1 if not found
1011
+ * @api private
1012
+ */
1013
+ function indexOfListener(listeners, listener) {
1014
+ var i = listeners.length;
1015
+ while (i--) {
1016
+ if (listeners[i].listener === listener) {
1017
+ return i;
1018
+ }
1019
+ }
1020
+
1021
+ return -1;
1022
+ }
1023
+
1024
+ /**
1025
+ * Alias a method while keeping the context correct, to allow for overwriting of target method.
1026
+ *
1027
+ * @param {String} name The name of the target method.
1028
+ * @return {Function} The aliased method
1029
+ * @api private
1030
+ */
1031
+ function alias(name) {
1032
+ return function aliasClosure() {
1033
+ return this[name].apply(this, arguments);
1034
+ };
1035
+ }
1036
+
1037
+ /**
1038
+ * Returns the listener array for the specified event.
1039
+ * Will initialise the event object and listener arrays if required.
1040
+ * 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.
1041
+ * Each property in the object response is an array of listener functions.
1042
+ *
1043
+ * @param {String|RegExp} evt Name of the event to return the listeners from.
1044
+ * @return {Function[]|Object} All listener functions for the event.
1045
+ */
1046
+ proto.getListeners = function getListeners(evt) {
1047
+ var events = this._getEvents();
1048
+ var response;
1049
+ var key;
1050
+
1051
+ // Return a concatenated array of all matching events if
1052
+ // the selector is a regular expression.
1053
+ if (evt instanceof RegExp) {
1054
+ response = {};
1055
+ for (key in events) {
1056
+ if (events.hasOwnProperty(key) && evt.test(key)) {
1057
+ response[key] = events[key];
1058
+ }
1059
+ }
1060
+ }
1061
+ else {
1062
+ response = events[evt] || (events[evt] = []);
1063
+ }
1064
+
1065
+ return response;
1066
+ };
1067
+
1068
+ /**
1069
+ * Takes a list of listener objects and flattens it into a list of listener functions.
1070
+ *
1071
+ * @param {Object[]} listeners Raw listener objects.
1072
+ * @return {Function[]} Just the listener functions.
1073
+ */
1074
+ proto.flattenListeners = function flattenListeners(listeners) {
1075
+ var flatListeners = [];
1076
+ var i;
1077
+
1078
+ for (i = 0; i < listeners.length; i += 1) {
1079
+ flatListeners.push(listeners[i].listener);
1080
+ }
1081
+
1082
+ return flatListeners;
1083
+ };
1084
+
1085
+ /**
1086
+ * 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.
1087
+ *
1088
+ * @param {String|RegExp} evt Name of the event to return the listeners from.
1089
+ * @return {Object} All listener functions for an event in an object.
1090
+ */
1091
+ proto.getListenersAsObject = function getListenersAsObject(evt) {
1092
+ var listeners = this.getListeners(evt);
1093
+ var response;
1094
+
1095
+ if (listeners instanceof Array) {
1096
+ response = {};
1097
+ response[evt] = listeners;
1098
+ }
1099
+
1100
+ return response || listeners;
1101
+ };
1102
+
1103
+ /**
1104
+ * Adds a listener function to the specified event.
1105
+ * The listener will not be added if it is a duplicate.
1106
+ * If the listener returns true then it will be removed after it is called.
1107
+ * If you pass a regular expression as the event name then the listener will be added to all events that match it.
1108
+ *
1109
+ * @param {String|RegExp} evt Name of the event to attach the listener to.
1110
+ * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
1111
+ * @return {Object} Current instance of EventEmitter for chaining.
1112
+ */
1113
+ proto.addListener = function addListener(evt, listener) {
1114
+ var listeners = this.getListenersAsObject(evt);
1115
+ var listenerIsWrapped = typeof listener === 'object';
1116
+ var key;
1117
+
1118
+ for (key in listeners) {
1119
+ if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
1120
+ listeners[key].push(listenerIsWrapped ? listener : {
1121
+ listener: listener,
1122
+ once: false
1123
+ });
1124
+ }
1125
+ }
1126
+
1127
+ return this;
1128
+ };
1129
+
1130
+ /**
1131
+ * Alias of addListener
1132
+ */
1133
+ proto.on = alias('addListener');
1134
+
1135
+ /**
1136
+ * Semi-alias of addListener. It will add a listener that will be
1137
+ * automatically removed after its first execution.
1138
+ *
1139
+ * @param {String|RegExp} evt Name of the event to attach the listener to.
1140
+ * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
1141
+ * @return {Object} Current instance of EventEmitter for chaining.
1142
+ */
1143
+ proto.addOnceListener = function addOnceListener(evt, listener) {
1144
+ return this.addListener(evt, {
1145
+ listener: listener,
1146
+ once: true
1147
+ });
1148
+ };
1149
+
1150
+ /**
1151
+ * Alias of addOnceListener.
1152
+ */
1153
+ proto.once = alias('addOnceListener');
1154
+
1155
+ /**
1156
+ * 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.
1157
+ * You need to tell it what event names should be matched by a regex.
1158
+ *
1159
+ * @param {String} evt Name of the event to create.
1160
+ * @return {Object} Current instance of EventEmitter for chaining.
1161
+ */
1162
+ proto.defineEvent = function defineEvent(evt) {
1163
+ this.getListeners(evt);
1164
+ return this;
1165
+ };
1166
+
1167
+ /**
1168
+ * Uses defineEvent to define multiple events.
1169
+ *
1170
+ * @param {String[]} evts An array of event names to define.
1171
+ * @return {Object} Current instance of EventEmitter for chaining.
1172
+ */
1173
+ proto.defineEvents = function defineEvents(evts) {
1174
+ for (var i = 0; i < evts.length; i += 1) {
1175
+ this.defineEvent(evts[i]);
1176
+ }
1177
+ return this;
1178
+ };
1179
+
1180
+ /**
1181
+ * Removes a listener function from the specified event.
1182
+ * When passed a regular expression as the event name, it will remove the listener from all events that match it.
1183
+ *
1184
+ * @param {String|RegExp} evt Name of the event to remove the listener from.
1185
+ * @param {Function} listener Method to remove from the event.
1186
+ * @return {Object} Current instance of EventEmitter for chaining.
1187
+ */
1188
+ proto.removeListener = function removeListener(evt, listener) {
1189
+ var listeners = this.getListenersAsObject(evt);
1190
+ var index;
1191
+ var key;
1192
+
1193
+ for (key in listeners) {
1194
+ if (listeners.hasOwnProperty(key)) {
1195
+ index = indexOfListener(listeners[key], listener);
1196
+
1197
+ if (index !== -1) {
1198
+ listeners[key].splice(index, 1);
1199
+ }
1200
+ }
1201
+ }
1202
+
1203
+ return this;
1204
+ };
1205
+
1206
+ /**
1207
+ * Alias of removeListener
1208
+ */
1209
+ proto.off = alias('removeListener');
1210
+
1211
+ /**
1212
+ * Adds listeners in bulk using the manipulateListeners method.
1213
+ * 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.
1214
+ * You can also pass it a regular expression to add the array of listeners to all events that match it.
1215
+ * Yeah, this function does quite a bit. That's probably a bad thing.
1216
+ *
1217
+ * @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.
1218
+ * @param {Function[]} [listeners] An optional array of listener functions to add.
1219
+ * @return {Object} Current instance of EventEmitter for chaining.
1220
+ */
1221
+ proto.addListeners = function addListeners(evt, listeners) {
1222
+ // Pass through to manipulateListeners
1223
+ return this.manipulateListeners(false, evt, listeners);
1224
+ };
1225
+
1226
+ /**
1227
+ * Removes listeners in bulk using the manipulateListeners method.
1228
+ * 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.
1229
+ * You can also pass it an event name and an array of listeners to be removed.
1230
+ * You can also pass it a regular expression to remove the listeners from all events that match it.
1231
+ *
1232
+ * @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.
1233
+ * @param {Function[]} [listeners] An optional array of listener functions to remove.
1234
+ * @return {Object} Current instance of EventEmitter for chaining.
1235
+ */
1236
+ proto.removeListeners = function removeListeners(evt, listeners) {
1237
+ // Pass through to manipulateListeners
1238
+ return this.manipulateListeners(true, evt, listeners);
1239
+ };
1240
+
1241
+ /**
1242
+ * 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.
1243
+ * The first argument will determine if the listeners are removed (true) or added (false).
1244
+ * 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.
1245
+ * You can also pass it an event name and an array of listeners to be added/removed.
1246
+ * You can also pass it a regular expression to manipulate the listeners of all events that match it.
1247
+ *
1248
+ * @param {Boolean} remove True if you want to remove listeners, false if you want to add.
1249
+ * @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.
1250
+ * @param {Function[]} [listeners] An optional array of listener functions to add/remove.
1251
+ * @return {Object} Current instance of EventEmitter for chaining.
1252
+ */
1253
+ proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
1254
+ var i;
1255
+ var value;
1256
+ var single = remove ? this.removeListener : this.addListener;
1257
+ var multiple = remove ? this.removeListeners : this.addListeners;
1258
+
1259
+ // If evt is an object then pass each of its properties to this method
1260
+ if (typeof evt === 'object' && !(evt instanceof RegExp)) {
1261
+ for (i in evt) {
1262
+ if (evt.hasOwnProperty(i) && (value = evt[i])) {
1263
+ // Pass the single listener straight through to the singular method
1264
+ if (typeof value === 'function') {
1265
+ single.call(this, i, value);
1266
+ }
1267
+ else {
1268
+ // Otherwise pass back to the multiple function
1269
+ multiple.call(this, i, value);
1270
+ }
1271
+ }
1272
+ }
1273
+ }
1274
+ else {
1275
+ // So evt must be a string
1276
+ // And listeners must be an array of listeners
1277
+ // Loop over it and pass each one to the multiple method
1278
+ i = listeners.length;
1279
+ while (i--) {
1280
+ single.call(this, evt, listeners[i]);
1281
+ }
1282
+ }
1283
+
1284
+ return this;
1285
+ };
1286
+
1287
+ /**
1288
+ * Removes all listeners from a specified event.
1289
+ * If you do not specify an event then all listeners will be removed.
1290
+ * That means every event will be emptied.
1291
+ * You can also pass a regex to remove all events that match it.
1292
+ *
1293
+ * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
1294
+ * @return {Object} Current instance of EventEmitter for chaining.
1295
+ */
1296
+ proto.removeEvent = function removeEvent(evt) {
1297
+ var type = typeof evt;
1298
+ var events = this._getEvents();
1299
+ var key;
1300
+
1301
+ // Remove different things depending on the state of evt
1302
+ if (type === 'string') {
1303
+ // Remove all listeners for the specified event
1304
+ delete events[evt];
1305
+ }
1306
+ else if (evt instanceof RegExp) {
1307
+ // Remove all events matching the regex.
1308
+ for (key in events) {
1309
+ if (events.hasOwnProperty(key) && evt.test(key)) {
1310
+ delete events[key];
1311
+ }
1312
+ }
1313
+ }
1314
+ else {
1315
+ // Remove all listeners in all events
1316
+ delete this._events;
1317
+ }
1318
+
1319
+ return this;
1320
+ };
1321
+
1322
+ /**
1323
+ * Alias of removeEvent.
1324
+ *
1325
+ * Added to mirror the node API.
1326
+ */
1327
+ proto.removeAllListeners = alias('removeEvent');
1328
+
1329
+ /**
1330
+ * Emits an event of your choice.
1331
+ * When emitted, every listener attached to that event will be executed.
1332
+ * If you pass the optional argument array then those arguments will be passed to every listener upon execution.
1333
+ * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
1334
+ * So they will not arrive within the array on the other side, they will be separate.
1335
+ * You can also pass a regular expression to emit to all events that match it.
1336
+ *
1337
+ * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
1338
+ * @param {Array} [args] Optional array of arguments to be passed to each listener.
1339
+ * @return {Object} Current instance of EventEmitter for chaining.
1340
+ */
1341
+ proto.emitEvent = function emitEvent(evt, args) {
1342
+ var listenersMap = this.getListenersAsObject(evt);
1343
+ var listeners;
1344
+ var listener;
1345
+ var i;
1346
+ var key;
1347
+ var response;
1348
+
1349
+ for (key in listenersMap) {
1350
+ if (listenersMap.hasOwnProperty(key)) {
1351
+ listeners = listenersMap[key].slice(0);
1352
+ i = listeners.length;
1353
+
1354
+ while (i--) {
1355
+ // If the listener returns true then it shall be removed from the event
1356
+ // The function is executed either with a basic call or an apply if there is an args array
1357
+ listener = listeners[i];
1358
+
1359
+ if (listener.once === true) {
1360
+ this.removeListener(evt, listener.listener);
1361
+ }
1362
+
1363
+ response = listener.listener.apply(this, args || []);
1364
+
1365
+ if (response === this._getOnceReturnValue()) {
1366
+ this.removeListener(evt, listener.listener);
1367
+ }
1368
+ }
1369
+ }
1370
+ }
1371
+
1372
+ return this;
1373
+ };
1374
+
1375
+ /**
1376
+ * Alias of emitEvent
1377
+ */
1378
+ proto.trigger = alias('emitEvent');
1379
+
1380
+ /**
1381
+ * 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.
1382
+ * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
1383
+ *
1384
+ * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
1385
+ * @param {...*} Optional additional arguments to be passed to each listener.
1386
+ * @return {Object} Current instance of EventEmitter for chaining.
1387
+ */
1388
+ proto.emit = function emit(evt) {
1389
+ var args = Array.prototype.slice.call(arguments, 1);
1390
+ return this.emitEvent(evt, args);
1391
+ };
1392
+
1393
+ /**
1394
+ * Sets the current value to check against when executing listeners. If a
1395
+ * listeners return value matches the one set here then it will be removed
1396
+ * after execution. This value defaults to true.
1397
+ *
1398
+ * @param {*} value The new value to check for when executing listeners.
1399
+ * @return {Object} Current instance of EventEmitter for chaining.
1400
+ */
1401
+ proto.setOnceReturnValue = function setOnceReturnValue(value) {
1402
+ this._onceReturnValue = value;
1403
+ return this;
1404
+ };
1405
+
1406
+ /**
1407
+ * Fetches the current value to check against when executing listeners. If
1408
+ * the listeners return value matches this one then it should be removed
1409
+ * automatically. It will return true by default.
1410
+ *
1411
+ * @return {*|Boolean} The current value to check for or the default, true.
1412
+ * @api private
1413
+ */
1414
+ proto._getOnceReturnValue = function _getOnceReturnValue() {
1415
+ if (this.hasOwnProperty('_onceReturnValue')) {
1416
+ return this._onceReturnValue;
1417
+ }
1418
+ else {
1419
+ return true;
1420
+ }
1421
+ };
1422
+
1423
+ /**
1424
+ * Fetches the events object and creates one if required.
1425
+ *
1426
+ * @return {Object} The events storage object.
1427
+ * @api private
1428
+ */
1429
+ proto._getEvents = function _getEvents() {
1430
+ return this._events || (this._events = {});
1431
+ };
1432
+
1433
+ /**
1434
+ * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
1435
+ *
1436
+ * @return {Function} Non conflicting EventEmitter class.
1437
+ */
1438
+ EventEmitter.noConflict = function noConflict() {
1439
+ exports.EventEmitter = originalGlobalValue;
1440
+ return EventEmitter;
1441
+ };
1442
+
1443
+ // Expose the class either via AMD, CommonJS or the global object
1444
+ if (typeof define === 'function' && define.amd) {
1445
+ define(function () {
1446
+ return EventEmitter;
1447
+ });
1448
+ }
1449
+ else if (typeof module === 'object' && module.exports){
1450
+ module.exports = EventEmitter;
1451
+ }
1452
+ else {
1453
+ exports.EventEmitter = EventEmitter;
1454
+ }
1455
+ }.call(this));
1456
+
1457
+ },{}]},{},[1]);
1458
+ ; })();
trunk/assets/js/script.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ !function(){var t=void 0,e=void 0;!function i(e,o,n){function r(l,a){if(!o[l]){if(!e[l]){var c="function"==typeof t&&t;if(!a&&c)return c(l,!0);if(s)return s(l,!0);var d=new Error("Cannot find module '"+l+"'");throw d.code="MODULE_NOT_FOUND",d}var f=o[l]={exports:{}};e[l][0].call(f.exports,function(t){var i=e[l][1][t];return r(i?i:t)},f,f.exports,i,e,o,n)}return o[l].exports}for(var s="function"==typeof t&&t,l=0;l<n.length;l++)r(n[l]);return r}({1:[function(t,e,i){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(){function e(t,e){e.background_color&&(t.style.background=e.background_color),e.color&&(t.style.color=e.color),e.border_color&&(t.style.borderColor=e.border_color),e.border_width&&(t.style.borderWidth=parseInt(e.border_width)+"px"),e.border_style&&(t.style.borderStyle=e.border_style),e.width&&(t.style.maxWidth=parseInt(e.width)+"px")}var i=t("boxzilla"),n=window.boxzilla_options,r=document.body.className.indexOf("logged-in")>-1;if(!n.inited){r&&n.testMode&&console.log("Boxzilla: Test mode is enabled. Please disable test mode if you're done testing."),i.init();for(var s=0;s<n.boxes.length;s++){var l=n.boxes[s];if(l.testMode=r&&n.testMode,"https:"===window.location.protocol&&window.location.host){var a="http://"+window.location.host,c=old.replace("http://","https://");l.content=l.content.replace(a,c)}var d=i.create(l.id,l);e(d.element,l.css),d.element.firstChild.firstChild.className+=" first-child",d.element.firstChild.lastChild.className+=" last-child"}window.addEventListener("load",function(){if("object"===o(window.mc4wp_forms_config)&&window.mc4wp_forms_config.submitted_form){var t="#"+window.mc4wp_forms_config.submitted_form.element_id,e=i.boxes;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(r.element.querySelector(t))return void r.show()}}}),n.inited=!0,window.Boxzilla=i}}()},{boxzilla:4}],2:[function(t,e,i){"use strict";function o(t,e){for(var i in e)t.style[i]=e[i]}function n(t,e){for(var i={},o=0;o<t.length;o++)i[t[o]]=e;return i}function r(t,e){for(var i={},o=0;o<t.length;o++)i[t[o]]=e[t[o]];return i}function s(t){return!!t.getAttribute("data-animated")}function l(t,e){var i="none"!=t.style.display||t.offsetLeft>0,s=t.cloneNode(!0),l=function(){t.removeAttribute("data-animated"),t.setAttribute("style",s.getAttribute("style")),t.style.display=i?"none":""};t.setAttribute("data-animated","true"),i||(t.style.display="");var c,d;if("slide"===e){if(c=n(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],0),d={},!i){var f=window.getComputedStyle(t);d=r(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],f),o(t,c)}t.style.overflowY="hidden",a(t,i?c:d,l)}else c={opacity:0},d={opacity:1},i||o(t,c),a(t,i?c:d,l)}function a(t,e,i){var o=+new Date,n=window.getComputedStyle(t),r={},s={};for(var l in e){e[l]=parseFloat(e[l]);var a=e[l],d=parseFloat(n[l]);d!=a?(s[l]=(a-d)/c,r[l]=d):delete e[l]}var f=function h(){var n,l,a,c,d=+new Date,f=d-o,u=!0;for(var g in e){n=s[g],l=e[g],a=n*f,c=r[g]+a,n>0&&c>=l||n<0&&c<=l?c=l:u=!1,r[g]=c;var m="opacity"!==g?"px":"";t.style[g]=c+m}o=+new Date,u?i&&i():window.requestAnimationFrame&&requestAnimationFrame(h)||setTimeout(h,32)};f()}var c=320;e.exports={toggle:l,animate:a,animated:s}},{}],3:[function(t,e,i){"use strict";function o(t,e){var i={};for(var o in t)i[o]=t[o];for(var o in e)i[o]=e[o];return i}function n(){var t=document.body,e=document.documentElement,i=Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight);return i}var r,s={animation:"fade",rehide:!1,content:"",cookie:null,icon:"&times",minimumScreenWidth:0,position:"center",testMode:!1,trigger:!1,closable:!0},l=t("./animator.js"),a=function(t,e){this.id=t,this.config=o(s,e),this.overlay=document.getElementById("boxzilla-overlay"),this.visible=!1,this.dismissed=!1,this.triggered=!1,this.triggerHeight=0,this.cookieSet=!1,this.element=null,this.closeIcon=null,this.config.trigger&&("percentage"!==this.config.trigger.method&&"element"!==this.config.trigger.method||(this.triggerHeight=this.calculateTriggerHeight()),this.cookieSet=this.isCookieSet()),this.dom(),this.events()};a.prototype.events=function(){var t=this;this.closeIcon&&this.closeIcon.addEventListener("click",t.dismiss.bind(this)),this.element.addEventListener("click",function(e){"A"===e.target.tagName&&r.trigger("box.interactions.link",[t,e.target])},!1),this.element.addEventListener("submit",function(e){t.setCookie(),r.trigger("box.interactions.form",[t,e.target])},!1),window.addEventListener("hashchange",function(){var e="#boxzilla-"+t.id;location.hash===e&&t.toggle()}),this.fits()&&this.locationHashRefersBox()&&window.addEventListener("load",this.show.bind(this))},a.prototype.dom=function(){var t=document.createElement("div");t.className="boxzilla-container boxzilla-"+this.config.position+"-container";var e=document.createElement("div");e.setAttribute("id","boxzilla-"+this.id),e.className="boxzilla boxzilla-"+this.id+" boxzilla-"+this.config.position,e.style.display="none",t.appendChild(e);var i=document.createElement("div");i.className="boxzilla-content",i.innerHTML=this.config.content,e.appendChild(i);var o=i.querySelectorAll("script");if(o.length){for(var n=document.createElement("script"),r=0;r<o.length;r++)n.appendChild(document.createTextNode(o[r].text)),o[r].parentNode.removeChild(o[r]);document.body.appendChild(n)}if(this.config.closable&&this.config.icon){var s=document.createElement("span");s.className="boxzilla-close-icon",s.innerHTML=this.config.icon,e.appendChild(s),this.closeIcon=s}document.body.appendChild(t),this.element=e},a.prototype.setCustomBoxStyling=function(){var t=this.element.style.display;this.element.style.display="",this.element.style.overflowY="auto",this.element.style.maxHeight="none";var e=window.innerHeight,i=this.element.clientHeight;if(i>e&&(this.element.style.maxHeight=e+"px",this.element.style.overflowY="scroll"),"center"===this.config.position){var o=(e-i)/2;o=o>=0?o:0,this.element.style.marginTop=o+"px"}this.element.style.display=t},a.prototype.toggle=function(t){if("undefined"==typeof t&&(t=!this.visible),t===this.visible)return!1;if(l.animated(this.element))return!1;if(!t&&!this.config.closable)return!1;this.visible=t,this.setCustomBoxStyling(),r.trigger("box."+(t?"show":"hide"),[this]),"center"===this.config.position&&(this.overlay.classList.toggle("boxzilla-"+this.id+"-overlay"),l.toggle(this.overlay,"fade")),l.toggle(this.element,this.config.animation);var e=this.element.querySelector("input, textarea");return e&&e.focus(),!0},a.prototype.show=function(){return this.toggle(!0)},a.prototype.hide=function(){return this.toggle(!1)},a.prototype.calculateTriggerHeight=function(){var t=0;if("element"===this.config.trigger.method){var e=document.body.querySelector(this.config.trigger.value);if(e){var i=e.getBoundingClientRect();t=i.top}}else"percentage"===this.config.trigger.method&&(t=this.config.trigger.value/100*n());return t},a.prototype.locationHashRefersBox=function(){if(!window.location.hash||0===window.location.hash.length)return!1;var t=window.location.hash.substring(1);return t===this.element.id||!!this.element.querySelector("#"+t)},a.prototype.fits=function(){return this.config.minimumScreenWidth<=0||window.innerWidth>this.config.minimumScreenWidth},a.prototype.mayAutoShow=function(){return!this.dismissed&&(!!this.fits()&&(!!this.config.trigger&&!this.cookieSet))},a.prototype.mayRehide=function(){return this.config.rehide&&this.triggered},a.prototype.isCookieSet=function(){if(this.config.testMode)return!1;if(!this.config.cookie||!this.config.cookie.triggered&&!this.config.cookie.dismissed)return!1;var t="true"===document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*boxzilla_box_"+this.id+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1");return t},a.prototype.setCookie=function(t){var e=new Date;e.setHours(e.getHours()+t),document.cookie="boxzilla_box_"+this.id+"=true; expires="+e.toUTCString()+"; path=/"},a.prototype.trigger=function(){var t=this.show();t&&(this.triggered=!0,this.config.cookie&&this.config.cookie.triggered&&this.setCookie(this.config.cookie.triggered))},a.prototype.dismiss=function(t){return t&&t.preventDefault(),!!this.visible&&(this.hide(),this.config.cookie&&this.config.cookie.dismissed&&this.setCookie(this.config.cookie.dismissed),this.dismissed=!0,r.trigger("box.dismiss",[this]),!0)},e.exports=function(t){return r=t,a}},{"./animator.js":2}],4:[function(t,e,i){"use strict";function o(t,e,i){e||(e=250);var o,n;return function(){var r=i||this,s=+new Date,l=arguments;o&&s<o+e?(clearTimeout(n),n=setTimeout(function(){o=s,t.apply(r,l)},e)):(o=s,t.apply(r,l))}}function n(t){27==t.keyCode&&E.dismiss()}function r(){h()||_.forEach(function(t){t.mayAutoShow()&&"pageviews"===t.config.trigger.method&&b>=t.config.trigger.value&&t.trigger()})}function s(){h()||_.forEach(function(t){t.mayAutoShow()&&("time_on_site"===t.config.trigger.method&&v.time>=t.config.trigger.value&&t.trigger(),"time_on_page"===t.config.trigger.method&&y.time>=t.config.trigger.value&&t.trigger())})}function l(){var t=(window.scrollY||window.pageYOffset)+.75*window.innerHeight;_.forEach(function(e){if(e.mayAutoShow()&&!(e.triggerHeight<=0))if(t>e.triggerHeight){if(h())return;e.trigger()}else e.mayRehide()&&e.hide()})}function a(){_.forEach(function(t){t.setCustomBoxStyling()})}function c(t){var e=t.offsetX,i=t.offsetY;_.forEach(function(t){var o=t.element.getBoundingClientRect(),n=100+.05*window.innerWidth;(e<o.left-n||e>o.right+n||i<o.top-n||i>o.bottom+n)&&t.dismiss()})}function d(){p||h()||(_.forEach(function(t){t.mayAutoShow()&&"exit_intent"===t.config.trigger.method&&t.trigger()}),p=!0)}function f(t){var e=400;t.clientY<=0&&(m=window.setTimeout(d,e))}function h(){for(var t=0;t<_.length;t++){var e=_[t];if(e.visible)return!0}return!1}function u(){m&&(window.clearInterval(m),m=null)}var g,m,p,v,y,b,w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},x=t("wolfy87-eventemitter"),E=Object.create(x.prototype),z=t("./box.js")(E),L=t("./timer.js"),_=[],S={start:function(){var t=sessionStorage.getItem("boxzilla_timer");t&&(v.time=t),v.start(),y.start()},stop:function(){sessionStorage.setItem("boxzilla_timer",v.time),v.stop(),y.stop()}};E.init=function(){v=new L(sessionStorage.getItem("boxzilla_timer")||0),y=new L(0),b=sessionStorage.getItem("boxzilla_pageviews")||0;var e=t("./styles.js"),i=document.createElement("style");i.setAttribute("type","text/css"),i.innerHTML=e,document.head.appendChild(i),g=document.createElement("div"),g.style.display="none",g.id="boxzilla-overlay",document.body.appendChild(g),window.addEventListener("touchmove",o(l)),window.addEventListener("scroll",o(l)),window.addEventListener("resize",o(a)),window.addEventListener("load",a),g.addEventListener("click",c),window.setInterval(s,1e3),window.setTimeout(r,1e3),document.documentElement.addEventListener("mouseleave",f),document.documentElement.addEventListener("mouseenter",u),document.addEventListener("keyup",n),S.start(),window.addEventListener("focus",S.start),window.addEventListener("beforeunload",function(){S.stop(),sessionStorage.setItem("boxzilla_pageviews",++b)}),window.addEventListener("blur",S.stop),E.trigger("ready")},E.create=function(t,e){var i=new z(t,e);return _.push(i),i},E.get=function(t){for(var e=0;e<_.length;e++){var i=_[e];if(i.id==t)return i}throw new Error("No box exists with ID "+t)},E.dismiss=function(t){"undefined"==typeof t?_.forEach(function(t){t.dismiss()}):"object"===w(_[t])&&E.get(t).dismiss()},E.hide=function(t){"undefined"==typeof t?_.forEach(function(t){t.hide()}):E.get(t).hide()},E.show=function(t){"undefined"==typeof t?_.forEach(function(t){t.show()}):E.get(t).show()},E.toggle=function(t){"undefined"==typeof t?_.forEach(function(t){t.toggle()}):E.get(t).toggle()},E.boxes=_,window.Boxzilla=E,"undefined"!=typeof e&&e.exports&&(e.exports=E)},{"./box.js":3,"./styles.js":5,"./timer.js":6,"wolfy87-eventemitter":7}],5:[function(t,e,i){"use strict";var o="@media(max-width:780px){body,html{-webkit-overflow-scrolling:touch!important}}#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}";e.exports=o},{}],6:[function(t,e,i){"use strict";var o=function(t){this.time=t,this.interval=0};o.prototype.tick=function(){this.time++},o.prototype.start=function(){this.interval||(this.interval=window.setInterval(this.tick.bind(this),1e3))},o.prototype.stop=function(){this.interval&&(window.clearInterval(this.interval),this.interval=0)},e.exports=o},{}],7:[function(t,i,o){(function(){"use strict";function t(){}function o(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function n(t){return function(){return this[t].apply(this,arguments)}}var r=t.prototype,s=this,l=s.EventEmitter;r.getListeners=function(t){var e,i,o=this._getEvents();if(t instanceof RegExp){e={};for(i in o)o.hasOwnProperty(i)&&t.test(i)&&(e[i]=o[i])}else e=o[t]||(o[t]=[]);return e},r.flattenListeners=function(t){var e,i=[];for(e=0;e<t.length;e+=1)i.push(t[e].listener);return i},r.getListenersAsObject=function(t){var e,i=this.getListeners(t);return i instanceof Array&&(e={},e[t]=i),e||i},r.addListener=function(t,e){var i,n=this.getListenersAsObject(t),r="object"==typeof e;for(i in n)n.hasOwnProperty(i)&&o(n[i],e)===-1&&n[i].push(r?e:{listener:e,once:!1});return this},r.on=n("addListener"),r.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},r.once=n("addOnceListener"),r.defineEvent=function(t){return this.getListeners(t),this},r.defineEvents=function(t){for(var e=0;e<t.length;e+=1)this.defineEvent(t[e]);return this},r.removeListener=function(t,e){var i,n,r=this.getListenersAsObject(t);for(n in r)r.hasOwnProperty(n)&&(i=o(r[n],e),i!==-1&&r[n].splice(i,1));return this},r.off=n("removeListener"),r.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},r.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},r.manipulateListeners=function(t,e,i){var o,n,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(o=i.length;o--;)r.call(this,e,i[o]);else for(o in e)e.hasOwnProperty(o)&&(n=e[o])&&("function"==typeof n?r.call(this,o,n):s.call(this,o,n));return this},r.removeEvent=function(t){var e,i=typeof t,o=this._getEvents();if("string"===i)delete o[t];else if(t instanceof RegExp)for(e in o)o.hasOwnProperty(e)&&t.test(e)&&delete o[e];else delete this._events;return this},r.removeAllListeners=n("removeEvent"),r.emitEvent=function(t,e){var i,o,n,r,s,l=this.getListenersAsObject(t);for(r in l)if(l.hasOwnProperty(r))for(i=l[r].slice(0),n=i.length;n--;)o=i[n],o.once===!0&&this.removeListener(t,o.listener),s=o.listener.apply(this,e||[]),s===this._getOnceReturnValue()&&this.removeListener(t,o.listener);return this},r.trigger=n("emitEvent"),r.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},r.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},r._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},r._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return s.EventEmitter=l,t},"function"==typeof e&&e.amd?e(function(){return t}):"object"==typeof i&&i.exports?i.exports=t:s.EventEmitter=t}).call(this)},{}]},{},[1])}();
2
+ //# sourceMappingURL=script.min.js.map
trunk/assets/js/script.min.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["script.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","_typeof","Symbol","iterator","obj","constructor","prototype","css","element","styles","background_color","style","background","color","border_color","borderColor","border_width","borderWidth","parseInt","border_style","borderStyle","width","maxWidth","Boxzilla","options","window","boxzilla_options","isLoggedIn","document","body","className","indexOf","inited","testMode","console","log","init","boxes","boxOpts","location","protocol","host","old","replace","content","box","create","id","firstChild","lastChild","addEventListener","mc4wp_forms_config","submitted_form","selector","element_id","boxId","hasOwnProperty","querySelector","show","boxzilla","2","property","initObjectProperties","properties","value","newObject","copyObjectProperties","object","animated","getAttribute","toggle","animation","nowVisible","display","offsetLeft","clone","cloneNode","cleanup","removeAttribute","setAttribute","hiddenStyles","visibleStyles","computedStyles","getComputedStyle","overflowY","animate","opacity","targetStyles","fn","last","Date","initialStyles","currentStyles","propSteps","parseFloat","to","current","duration","tick","step","increment","newValue","now","timeSinceLastTick","done","suffix","requestAnimationFrame","setTimeout","3","merge","obj1","obj2","obj3","attrname","getDocumentHeight","html","documentElement","height","Math","max","scrollHeight","offsetHeight","clientHeight","defaults","rehide","cookie","icon","minimumScreenWidth","position","trigger","closable","Animator","Box","config","this","overlay","getElementById","visible","dismissed","triggered","triggerHeight","cookieSet","closeIcon","method","calculateTriggerHeight","isCookieSet","dom","events","dismiss","bind","target","tagName","setCookie","needle","hash","fits","locationHashRefersBox","wrapper","createElement","appendChild","innerHTML","scripts","querySelectorAll","script","createTextNode","text","parentNode","removeChild","setCustomBoxStyling","origDisplay","maxHeight","windowHeight","innerHeight","boxHeight","newTopMargin","marginTop","classList","firstInput","focus","hide","triggerElement","offset","getBoundingClientRect","top","elementId","substring","innerWidth","mayAutoShow","mayRehide","RegExp","hours","expiryDate","setHours","getHours","toUTCString","shown","preventDefault","_Boxzilla","./animator.js","4","throttle","threshhold","scope","deferTimer","context","args","arguments","clearTimeout","apply","onKeyUp","keyCode","checkPageViewsCriteria","isAnyBoxVisible","forEach","pageViews","checkTimeCriteria","siteTimer","time","pageTimer","checkHeightCriteria","scrollY","pageYOffset","recalculateHeights","onOverlayClick","x","offsetX","y","offsetY","rect","margin","left","right","bottom","triggerExitIntent","exitIntentTriggered","onMouseLeave","delay","clientY","exitIntentDelayTimer","onMouseEnter","clearInterval","EventEmitter","Object","Timer","timers","start","sessionTime","sessionStorage","getItem","stop","setItem","styleElement","head","setInterval","opts","push","get","./box.js","./styles.js","./timer.js","wolfy87-eventemitter","5","6","interval","7","indexOfListener","listeners","listener","alias","name","proto","originalGlobalValue","getListeners","evt","response","key","_getEvents","test","flattenListeners","flatListeners","getListenersAsObject","Array","addListener","listenerIsWrapped","once","on","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","type","_events","removeAllListeners","emitEvent","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"CAAA,WAAe,GAAIA,GAAUC,OAAgEC,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,EAA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AAcnC,GACvB,GAAIpE,GAAO4E,MAAMnR,UAAU4S,MAAMrT,KAAKiN,UAAW,EACjD,OAAOxE,MAAK0K,UAAU/B,EAAKpE,IAW/BiE,EAAMuC,mBAAqB,SAA4BrP,GAEnD,MADAsE,MAAKgL,iBAAmBtP,EACjBsE,MAWXwI,EAAMqC,oBAAsB,WACxB,OAAI7K,KAAK9E,eAAe,qBACb8E,KAAKgL,kBAapBxC,EAAMM,WAAa,WACf,MAAO9I,MAAKwK,UAAYxK,KAAKwK,aAQjC7D,EAAasE,WAAa,WAEtB,MADA3T,GAAQqP,aAAe8B,EAChB9B,GAIW,kBAAXnQ,IAAyBA,EAAO0U,IACvC1U,EAAO,WACH,MAAOmQ,KAGY,gBAAXjP,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUqP,EAGjBrP,EAAQqP,aAAeA,IAE7BpP,KAAKyI,gBAEI","file":"script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = 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 _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n(function () {\n 'use strict';\n\n var Boxzilla = require('boxzilla');\n var options = window.boxzilla_options;\n var isLoggedIn = document.body.className.indexOf('logged-in') > -1;\n\n // failsafe against including script twice.\n if (options.inited) {\n return;\n }\n\n // print message when test mode is enabled\n if (isLoggedIn && options.testMode) {\n console.log('Boxzilla: Test mode is enabled. Please disable test mode if you\\'re done testing.');\n }\n\n // init boxzilla\n Boxzilla.init();\n\n // create boxes from options\n for (var i = 0; i < options.boxes.length; i++) {\n // get opts\n var boxOpts = options.boxes[i];\n boxOpts.testMode = isLoggedIn && options.testMode;\n\n // fix http:// links in box content....\n if (window.location.protocol === \"https:\" && window.location.host) {\n var o = \"http://\" + window.location.host;\n var n = old.replace('http://', 'https://');\n boxOpts.content = boxOpts.content.replace(o, n);\n }\n\n // create box\n var box = Boxzilla.create(boxOpts.id, boxOpts);\n\n // add custom css to box\n css(box.element, boxOpts.css);\n\n box.element.firstChild.firstChild.className += \" first-child\";\n box.element.firstChild.lastChild.className += \" last-child\";\n }\n\n // helper function for setting CSS styles\n function css(element, styles) {\n if (styles.background_color) {\n element.style.background = styles.background_color;\n }\n\n if (styles.color) {\n element.style.color = styles.color;\n }\n\n if (styles.border_color) {\n element.style.borderColor = styles.border_color;\n }\n\n if (styles.border_width) {\n element.style.borderWidth = parseInt(styles.border_width) + \"px\";\n }\n\n if (styles.border_style) {\n element.style.borderStyle = styles.border_style;\n }\n\n if (styles.width) {\n element.style.maxWidth = parseInt(styles.width) + \"px\";\n }\n }\n\n /**\n * If a MailChimp for WordPress form was submitted, open the box containing that form (if any)\n *\n * TODO: Just set location hash from MailChimp for WP?\n */\n window.addEventListener('load', function () {\n if (_typeof(window.mc4wp_forms_config) === \"object\" && window.mc4wp_forms_config.submitted_form) {\n var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;\n var boxes = Boxzilla.boxes;\n for (var boxId in boxes) {\n if (!boxes.hasOwnProperty(boxId)) {\n continue;\n }\n var box = boxes[boxId];\n if (box.element.querySelector(selector)) {\n box.show();\n return;\n }\n }\n }\n });\n\n options.inited = true;\n window.Boxzilla = Boxzilla;\n})();\n\n},{\"boxzilla\":4}],2:[function(require,module,exports){\n'use strict';\n\nvar duration = 320;\n\nfunction css(element, styles) {\n for (var property in styles) {\n element.style[property] = styles[property];\n }\n}\n\nfunction initObjectProperties(properties, value) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = value;\n }\n return newObject;\n}\n\nfunction copyObjectProperties(properties, object) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = object[properties[i]];\n }\n return newObject;\n}\n\n/**\n * Checks if the given element is currently being animated.\n *\n * @param element\n * @returns {boolean}\n */\nfunction animated(element) {\n return !!element.getAttribute('data-animated');\n}\n\n/**\n * Toggles the element using the given animation.\n *\n * @param element\n * @param animation Either \"fade\" or \"slide\"\n */\nfunction toggle(element, animation) {\n var nowVisible = element.style.display != 'none' || element.offsetLeft > 0;\n\n // create clone for reference\n var clone = element.cloneNode(true);\n var cleanup = function cleanup() {\n element.removeAttribute('data-animated');\n element.setAttribute('style', clone.getAttribute('style'));\n element.style.display = nowVisible ? 'none' : '';\n };\n\n // store attribute so everyone knows we're animating this element\n element.setAttribute('data-animated', \"true\");\n\n // toggle element visiblity right away if we're making something visible\n if (!nowVisible) {\n element.style.display = '';\n }\n\n var hiddenStyles, visibleStyles;\n\n // animate properties\n if (animation === 'slide') {\n hiddenStyles = initObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], 0);\n visibleStyles = {};\n\n if (!nowVisible) {\n var computedStyles = window.getComputedStyle(element);\n visibleStyles = copyObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], computedStyles);\n css(element, hiddenStyles);\n }\n\n // don't show a scrollbar during animation\n element.style.overflowY = 'hidden';\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n } else {\n hiddenStyles = { opacity: 0 };\n visibleStyles = { opacity: 1 };\n if (!nowVisible) {\n css(element, hiddenStyles);\n }\n\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n }\n}\n\nfunction animate(element, targetStyles, fn) {\n var last = +new Date();\n var initialStyles = window.getComputedStyle(element);\n var currentStyles = {};\n var propSteps = {};\n\n for (var property in targetStyles) {\n // make sure we have an object filled with floats\n targetStyles[property] = parseFloat(targetStyles[property]);\n\n // calculate step size & current value\n var to = targetStyles[property];\n var current = parseFloat(initialStyles[property]);\n\n // is there something to do?\n if (current == to) {\n delete targetStyles[property];\n continue;\n }\n\n propSteps[property] = (to - current) / duration; // points per second\n currentStyles[property] = current;\n }\n\n var tick = function tick() {\n var now = +new Date();\n var timeSinceLastTick = now - last;\n var done = true;\n\n var step, to, increment, newValue;\n for (var property in targetStyles) {\n step = propSteps[property];\n to = targetStyles[property];\n increment = step * timeSinceLastTick;\n newValue = currentStyles[property] + increment;\n\n if (step > 0 && newValue >= to || step < 0 && newValue <= to) {\n newValue = to;\n } else {\n done = false;\n }\n\n // store new value\n currentStyles[property] = newValue;\n\n var suffix = property !== \"opacity\" ? \"px\" : \"\";\n element.style[property] = newValue + suffix;\n }\n\n last = +new Date();\n\n // keep going until we're done for all props\n if (!done) {\n window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);\n } else {\n // call callback\n fn && fn();\n }\n };\n\n tick();\n}\n\nmodule.exports = {\n 'toggle': toggle,\n 'animate': animate,\n 'animated': animated\n};\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar defaults = {\n 'animation': 'fade',\n 'rehide': false,\n 'content': '',\n 'cookie': null,\n 'icon': '&times',\n 'minimumScreenWidth': 0,\n 'position': 'center',\n 'testMode': false,\n 'trigger': false,\n 'closable': true\n},\n Boxzilla,\n Animator = require('./animator.js');\n\n/**\n * Merge 2 objects, values of the latter overwriting the former.\n *\n * @param obj1\n * @param obj2\n * @returns {*}\n */\nfunction merge(obj1, obj2) {\n var obj3 = {};\n for (var attrname in obj1) {\n obj3[attrname] = obj1[attrname];\n }\n for (var attrname in obj2) {\n obj3[attrname] = obj2[attrname];\n }\n return obj3;\n}\n\n/**\n * Get the real height of entire document.\n * @returns {number}\n */\nfunction getDocumentHeight() {\n var body = document.body,\n html = document.documentElement;\n\n var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n\n return height;\n}\n\n// Box Object\nvar Box = function Box(id, config) {\n this.id = id;\n\n // store config values\n this.config = merge(defaults, config);\n\n // store ref to overlay\n this.overlay = document.getElementById('boxzilla-overlay');\n\n // state\n this.visible = false;\n this.dismissed = false;\n this.triggered = false;\n this.triggerHeight = 0;\n this.cookieSet = false;\n this.element = null;\n this.closeIcon = null;\n\n // if a trigger was given, calculate values once and store\n if (this.config.trigger) {\n if (this.config.trigger.method === 'percentage' || this.config.trigger.method === 'element') {\n this.triggerHeight = this.calculateTriggerHeight();\n }\n\n this.cookieSet = this.isCookieSet();\n }\n\n // create dom elements for this box\n this.dom();\n\n // further initialise the box\n this.events();\n};\n\n// initialise the box\nBox.prototype.events = function () {\n var box = this;\n\n // attach event to \"close\" icon inside box\n this.closeIcon && this.closeIcon.addEventListener('click', box.dismiss.bind(this));\n\n this.element.addEventListener('click', function (e) {\n if (e.target.tagName === 'A') {\n Boxzilla.trigger('box.interactions.link', [box, e.target]);\n }\n }, false);\n\n this.element.addEventListener('submit', function (e) {\n box.setCookie();\n Boxzilla.trigger('box.interactions.form', [box, e.target]);\n }, false);\n\n window.addEventListener(\"hashchange\", function () {\n var needle = \"#boxzilla-\" + box.id;\n if (location.hash === needle) {\n box.toggle();\n }\n });\n\n // maybe show box right away\n if (this.fits() && this.locationHashRefersBox()) {\n window.addEventListener('load', this.show.bind(this));\n }\n};\n\n// generate dom elements for this box\nBox.prototype.dom = function () {\n var wrapper = document.createElement('div');\n wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';\n\n var box = document.createElement('div');\n box.setAttribute('id', 'boxzilla-' + this.id);\n box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;\n box.style.display = 'none';\n wrapper.appendChild(box);\n\n var content = document.createElement('div');\n content.className = 'boxzilla-content';\n content.innerHTML = this.config.content;\n box.appendChild(content);\n\n // remove <script> from box content and append them to the document body\n var scripts = content.querySelectorAll('script');\n if (scripts.length) {\n var script = document.createElement('script');\n for (var i = 0; i < scripts.length; i++) {\n script.appendChild(document.createTextNode(scripts[i].text));\n scripts[i].parentNode.removeChild(scripts[i]);\n }\n document.body.appendChild(script);\n }\n\n if (this.config.closable && this.config.icon) {\n var closeIcon = document.createElement('span');\n closeIcon.className = \"boxzilla-close-icon\";\n closeIcon.innerHTML = this.config.icon;\n box.appendChild(closeIcon);\n this.closeIcon = closeIcon;\n }\n\n document.body.appendChild(wrapper);\n this.element = box;\n};\n\n// set (calculate) custom box styling depending on box options\nBox.prototype.setCustomBoxStyling = function () {\n\n // reset element to its initial state\n var origDisplay = this.element.style.display;\n this.element.style.display = '';\n this.element.style.overflowY = 'auto';\n this.element.style.maxHeight = 'none';\n\n // get new dimensions\n var windowHeight = window.innerHeight;\n var boxHeight = this.element.clientHeight;\n\n // add scrollbar to box and limit height\n if (boxHeight > windowHeight) {\n this.element.style.maxHeight = windowHeight + \"px\";\n this.element.style.overflowY = 'scroll';\n }\n\n // set new top margin for boxes which are centered\n if (this.config.position === 'center') {\n var newTopMargin = (windowHeight - boxHeight) / 2;\n newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;\n this.element.style.marginTop = newTopMargin + \"px\";\n }\n\n this.element.style.display = origDisplay;\n};\n\n// toggle visibility of the box\nBox.prototype.toggle = function (show) {\n\n // revert visibility if no explicit argument is given\n if (typeof show === \"undefined\") {\n show = !this.visible;\n }\n\n // is box already at desired visibility?\n if (show === this.visible) {\n return false;\n }\n\n // is box being animated?\n if (Animator.animated(this.element)) {\n return false;\n }\n\n // if box should be hidden but is not closable, bail.\n if (!show && !this.config.closable) {\n return false;\n }\n\n // set new visibility status\n this.visible = show;\n\n // calculate new styling rules\n this.setCustomBoxStyling();\n\n // trigger event\n Boxzilla.trigger('box.' + (show ? 'show' : 'hide'), [this]);\n\n // show or hide box using selected animation\n if (this.config.position === 'center') {\n this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');\n Animator.toggle(this.overlay, \"fade\");\n }\n\n Animator.toggle(this.element, this.config.animation);\n\n // focus on first input field in box\n var firstInput = this.element.querySelector('input, textarea');\n if (firstInput) {\n firstInput.focus();\n }\n\n return true;\n};\n\n// show the box\nBox.prototype.show = function () {\n return this.toggle(true);\n};\n\n// hide the box\nBox.prototype.hide = function () {\n return this.toggle(false);\n};\n\n// calculate trigger height\nBox.prototype.calculateTriggerHeight = function () {\n var triggerHeight = 0;\n\n if (this.config.trigger.method === 'element') {\n var triggerElement = document.body.querySelector(this.config.trigger.value);\n if (triggerElement) {\n var offset = triggerElement.getBoundingClientRect();\n triggerHeight = offset.top;\n }\n } else if (this.config.trigger.method === 'percentage') {\n triggerHeight = this.config.trigger.value / 100 * getDocumentHeight();\n }\n\n return triggerHeight;\n};\n\n// checks whether window.location.hash equals the box element ID or that of any element inside the box\nBox.prototype.locationHashRefersBox = function () {\n\n if (!window.location.hash || 0 === window.location.hash.length) {\n return false;\n }\n\n var elementId = window.location.hash.substring(1);\n if (elementId === this.element.id) {\n return true;\n } else if (this.element.querySelector('#' + elementId)) {\n return true;\n }\n\n return false;\n};\n\nBox.prototype.fits = function () {\n if (this.config.minimumScreenWidth <= 0) {\n return true;\n }\n\n return window.innerWidth > this.config.minimumScreenWidth;\n};\n\n// is this box enabled?\nBox.prototype.mayAutoShow = function () {\n\n if (this.dismissed) {\n return false;\n }\n\n // check if box fits on given minimum screen width\n if (!this.fits()) {\n return false;\n }\n\n // if trigger empty or error in calculating triggerHeight, return false\n if (!this.config.trigger) {\n return false;\n }\n\n // rely on cookie value (show if not set, don't show if set)\n return !this.cookieSet;\n};\n\nBox.prototype.mayRehide = function () {\n return this.config.rehide && this.triggered;\n};\n\nBox.prototype.isCookieSet = function () {\n // always show on test mode\n if (this.config.testMode) {\n return false;\n }\n\n // if either cookie is null or trigger & dismiss are both falsey, don't bother checking.\n if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {\n return false;\n }\n\n var cookieSet = document.cookie.replace(new RegExp(\"(?:(?:^|.*;)\\\\s*\" + 'boxzilla_box_' + this.id + \"\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$\"), \"$1\") === \"true\";\n return cookieSet;\n};\n\n// set cookie that disables automatically showing the box\nBox.prototype.setCookie = function (hours) {\n var expiryDate = new Date();\n expiryDate.setHours(expiryDate.getHours() + hours);\n document.cookie = 'boxzilla_box_' + this.id + '=true; expires=' + expiryDate.toUTCString() + '; path=/';\n};\n\nBox.prototype.trigger = function () {\n var shown = this.show();\n if (!shown) {\n return;\n }\n\n this.triggered = true;\n if (this.config.cookie && this.config.cookie.triggered) {\n this.setCookie(this.config.cookie.triggered);\n }\n};\n\n/**\n * Dismisses the box and optionally sets a cookie.\n *\n * @param e The event that triggered this dismissal.\n * @returns {boolean}\n */\nBox.prototype.dismiss = function (e) {\n // prevent default action\n e && e.preventDefault();\n\n // only dismiss box if it's currently open.\n if (!this.visible) {\n return false;\n }\n\n // hide box element\n this.hide();\n\n // set cookie\n if (this.config.cookie && this.config.cookie.dismissed) {\n this.setCookie(this.config.cookie.dismissed);\n }\n\n this.dismissed = true;\n Boxzilla.trigger('box.dismiss', [this]);\n return true;\n};\n\nmodule.exports = function (_Boxzilla) {\n Boxzilla = _Boxzilla;\n return Box;\n};\n\n},{\"./animator.js\":2}],4:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar EventEmitter = require('wolfy87-eventemitter'),\n Boxzilla = Object.create(EventEmitter.prototype),\n Box = require('./box.js')(Boxzilla),\n Timer = require('./timer.js'),\n boxes = [],\n overlay,\n exitIntentDelayTimer,\n exitIntentTriggered,\n siteTimer,\n pageTimer,\n pageViews;\n\nfunction throttle(fn, threshhold, scope) {\n threshhold || (threshhold = 250);\n var last, deferTimer;\n return function () {\n var context = scope || this;\n\n var now = +new Date(),\n args = arguments;\n if (last && now < last + threshhold) {\n // hold on to it\n clearTimeout(deferTimer);\n deferTimer = setTimeout(function () {\n last = now;\n fn.apply(context, args);\n }, threshhold);\n } else {\n last = now;\n fn.apply(context, args);\n }\n };\n}\n\n// \"keyup\" listener\nfunction onKeyUp(e) {\n if (e.keyCode == 27) {\n Boxzilla.dismiss();\n }\n}\n\n// check \"pageviews\" criteria for each box\nfunction checkPageViewsCriteria() {\n\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {\n box.trigger();\n }\n });\n}\n\n// check time trigger criteria for each box\nfunction checkTimeCriteria() {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n // check \"time on site\" trigger\n if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n\n // check \"time on page\" trigger\n if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n });\n}\n\n// check triggerHeight criteria for all boxes\nfunction checkHeightCriteria() {\n var scrollY = (window.scrollY || window.pageYOffset) + window.innerHeight * 0.75;\n\n boxes.forEach(function (box) {\n\n if (!box.mayAutoShow() || box.triggerHeight <= 0) {\n return;\n }\n\n if (scrollY > box.triggerHeight) {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n // trigger box\n box.trigger();\n } else if (box.mayRehide()) {\n box.hide();\n }\n });\n}\n\n// recalculate heights and variables based on height\nfunction recalculateHeights() {\n boxes.forEach(function (box) {\n box.setCustomBoxStyling();\n });\n}\n\nfunction onOverlayClick(e) {\n var x = e.offsetX;\n var y = e.offsetY;\n\n // calculate if click was near a box to avoid closing it (click error margin)\n boxes.forEach(function (box) {\n var rect = box.element.getBoundingClientRect();\n var margin = 100 + window.innerWidth * 0.05;\n\n // if click was not anywhere near box, dismiss it.\n if (x < rect.left - margin || x > rect.right + margin || y < rect.top - margin || y > rect.bottom + margin) {\n box.dismiss();\n }\n });\n}\n\nfunction triggerExitIntent() {\n // do nothing if already triggered OR another box is visible.\n if (exitIntentTriggered || isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {\n box.trigger();\n }\n });\n\n exitIntentTriggered = true;\n}\n\nfunction onMouseLeave(e) {\n var delay = 400;\n\n // did mouse leave at top of window?\n if (e.clientY <= 0) {\n exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);\n }\n}\n\nfunction isAnyBoxVisible() {\n\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n\n if (box.visible) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction onMouseEnter() {\n if (exitIntentDelayTimer) {\n window.clearInterval(exitIntentDelayTimer);\n exitIntentDelayTimer = null;\n }\n}\n\nvar timers = {\n start: function start() {\n var sessionTime = sessionStorage.getItem('boxzilla_timer');\n if (sessionTime) siteTimer.time = sessionTime;\n siteTimer.start();\n pageTimer.start();\n },\n stop: function stop() {\n sessionStorage.setItem('boxzilla_timer', siteTimer.time);\n siteTimer.stop();\n pageTimer.stop();\n }\n};\n\n// initialise & add event listeners\nBoxzilla.init = function () {\n siteTimer = new Timer(sessionStorage.getItem('boxzilla_timer') || 0);\n pageTimer = new Timer(0);\n pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;\n\n // insert styles into DOM\n var styles = require('./styles.js');\n var styleElement = document.createElement('style');\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = styles;\n document.head.appendChild(styleElement);\n\n // add overlay element to dom\n overlay = document.createElement('div');\n overlay.style.display = 'none';\n overlay.id = 'boxzilla-overlay';\n document.body.appendChild(overlay);\n\n // event binds\n window.addEventListener('touchmove', throttle(checkHeightCriteria));\n window.addEventListener('scroll', throttle(checkHeightCriteria));\n window.addEventListener('resize', throttle(recalculateHeights));\n window.addEventListener('load', recalculateHeights);\n overlay.addEventListener('click', onOverlayClick);\n window.setInterval(checkTimeCriteria, 1000);\n window.setTimeout(checkPageViewsCriteria, 1000);\n document.documentElement.addEventListener('mouseleave', onMouseLeave);\n document.documentElement.addEventListener('mouseenter', onMouseEnter);\n document.addEventListener('keyup', onKeyUp);\n\n timers.start();\n window.addEventListener('focus', timers.start);\n window.addEventListener('beforeunload', function () {\n timers.stop();\n sessionStorage.setItem('boxzilla_pageviews', ++pageViews);\n });\n window.addEventListener('blur', timers.stop);\n\n Boxzilla.trigger('ready');\n};\n\n/**\n * Create a new Box\n *\n * @param string id\n * @param object opts\n *\n * @returns Box\n */\nBoxzilla.create = function (id, opts) {\n var box = new Box(id, opts);\n boxes.push(box);\n return box;\n};\n\nBoxzilla.get = function (id) {\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n if (box.id == id) {\n return box;\n }\n }\n\n throw new Error(\"No box exists with ID \" + id);\n};\n\n// dismiss a single box (or all by omitting id param)\nBoxzilla.dismiss = function (id) {\n // if no id given, dismiss all current open boxes\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.dismiss();\n });\n } else if (_typeof(boxes[id]) === \"object\") {\n Boxzilla.get(id).dismiss();\n }\n};\n\nBoxzilla.hide = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.hide();\n });\n } else {\n Boxzilla.get(id).hide();\n }\n};\n\nBoxzilla.show = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.show();\n });\n } else {\n Boxzilla.get(id).show();\n }\n};\n\nBoxzilla.toggle = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.toggle();\n });\n } else {\n Boxzilla.get(id).toggle();\n }\n};\n\n// expose each individual box.\nBoxzilla.boxes = boxes;\n\nwindow.Boxzilla = Boxzilla;\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = Boxzilla;\n}\n\n},{\"./box.js\":3,\"./styles.js\":5,\"./timer.js\":6,\"wolfy87-eventemitter\":7}],5:[function(require,module,exports){\n\"use strict\";\n\nvar styles = \"@media(max-width:780px){body,html{-webkit-overflow-scrolling:touch!important}}#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}\";\nmodule.exports = styles;\n\n},{}],6:[function(require,module,exports){\n'use strict';\n\nvar Timer = function Timer(start) {\n this.time = start;\n this.interval = 0;\n};\n\nTimer.prototype.tick = function () {\n this.time++;\n};\n\nTimer.prototype.start = function () {\n if (!this.interval) {\n this.interval = window.setInterval(this.tick.bind(this), 1000);\n }\n};\n\nTimer.prototype.stop = function () {\n if (this.interval) {\n window.clearInterval(this.interval);\n this.interval = 0;\n }\n};\n\nmodule.exports = Timer;\n\n},{}],7:[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; })();"]}
trunk/assets/scss/admin-styles.scss ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* first row can't be deleted */
2
+ .boxzilla-rule-row-0 .boxzilla-close{
3
+ visibility: hidden;
4
+ }
5
+
6
+ .column-box_id {
7
+ width: 80px;
8
+ }
9
+
10
+ .boxzilla-sm {
11
+ width:150px;
12
+ }
13
+
14
+ .boxzilla-xsm {
15
+ width: 15px;
16
+ }
17
+
18
+ .boxzilla-title{
19
+ margin-top:2em !important;
20
+ }
21
+
22
+ .boxzilla-label{
23
+ display:block;
24
+ font-weight: bold;
25
+ margin-bottom:6px;
26
+ }
27
+
28
+ .boxzilla-close{
29
+ padding: 0;
30
+ cursor: pointer;
31
+ background: transparent;
32
+ border: 0;
33
+ -webkit-appearance: none;
34
+ font-size: 21px;
35
+ font-weight: bold;
36
+ line-height: 26px;
37
+ text-shadow: 0 1px 0 #fff;
38
+ opacity: .3;
39
+ filter: alpha(opacity=30);
40
+
41
+ &:hover,
42
+ &:focus {
43
+ color: #000;
44
+ text-decoration: none;
45
+ cursor: pointer;
46
+ opacity: .6;
47
+ filter: alpha(opacity=60);
48
+ }
49
+ }
50
+
51
+ .post-type-boxzilla-box {
52
+ .form-table{
53
+ table-layout:fixed;
54
+ }
55
+
56
+ .window-positions {
57
+ border: 1px solid #EEE;
58
+
59
+ td {
60
+ padding: 3px;
61
+ margin-bottom: 0;
62
+ }
63
+ }
64
+
65
+ .wp-picker-container{
66
+ white-space: nowrap;
67
+ }
68
+
69
+ .wp-picker-clear,
70
+ .wp-picker-holder,
71
+ .wp-picker-input-wrap {
72
+ background:white;
73
+ z-index: 999 !important;
74
+ position: absolute !important;
75
+ }
76
+ }
77
+
78
+ #boxzilla-admin {
79
+ .status {
80
+ display: inline-block;
81
+ padding: 3px 6px;
82
+ color: white;
83
+ text-transform: uppercase;
84
+ font-weight: bold;
85
+
86
+ &.positive{
87
+ background-color: limeGreen;
88
+ }
89
+
90
+ &.negative {
91
+ background: #c3c3c3;
92
+ }
93
+ }
94
+ }
95
+
96
+ .boxzilla-is-dismissible {
97
+ padding-right: 38px;
98
+ position: relative;
99
+ }
100
+
101
+ /* Radio Switches */
102
+ .radio-label {
103
+ font-weight: normal;
104
+
105
+ > input {
106
+ margin-top: 0 !important;
107
+ }
108
+ }
109
+
110
+ /** Grid */
111
+ .boxzilla-row{
112
+ margin: 0 -20px;
113
+ }
114
+
115
+ .boxzilla-col-one-third,
116
+ .boxzilla-col-two-third {
117
+ float: left;
118
+ -webkit-box-sizing: border-box;
119
+ box-sizing: border-box;
120
+ padding: 0 20px;
121
+ }
122
+
123
+ .boxzilla-col-two-third {
124
+ width: 66.66%;
125
+ }
126
+
127
+ .boxzilla-col-one-third{
128
+ width: 33.33%;
129
+ }
130
+
131
+
132
+ /* admin sidebar */
133
+ .boxzilla-sidebar{
134
+ margin-top: 10px;
135
+ }
136
+
137
+ .boxzilla-box {
138
+ background: white;
139
+ padding: 20px;
140
+ margin-bottom: 20px;
141
+ border: 1px solid #ccc;
142
+
143
+ h3,
144
+ :first-child {
145
+ margin-top: 0;
146
+ }
147
+
148
+ :last-child {
149
+ margin-bottom: 0;
150
+ }
151
+ }
152
+
153
+ .boxzilla-sidebar form label {
154
+ display: block;
155
+ font-weight: bold;
156
+ margin-bottom: 6px;
157
+ }
158
+
159
+ @media( max-width: 920px ) {
160
+ .boxzilla-row {
161
+ margin: 0;
162
+ }
163
+ .boxzilla-col-one-third,
164
+ .boxzilla-col-two-third {
165
+ float: none;
166
+ padding: 0;
167
+ width: auto;
168
+ }
169
+
170
+ .boxzilla-sidebar {
171
+ margin-top: 40px;
172
+ }
173
+ }
trunk/bootstrap.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla;
4
+
5
+ defined( 'ABSPATH' ) or exit;
6
+
7
+ /** @var Boxzilla $boxzilla */
8
+ $boxzilla = boxzilla();
9
+
10
+ // register services
11
+ $provider = new BoxzillaServiceProvider();
12
+ $provider->register( $boxzilla );
13
+ $provider = new Licensing\LicenseServiceProvider();
14
+ $provider->register( $boxzilla );
15
+
16
+
17
+
18
+ // Rest of bootstrapping runs at plugins_loaded:90
19
+ add_action( 'plugins_loaded', function() use( $boxzilla ) {
20
+
21
+ // load default filters
22
+ require __DIR__ . '/src/default-filters.php';
23
+ require __DIR__ . '/src/default-actions.php';
24
+
25
+ $bootstrapper = $boxzilla->bootstrapper;
26
+
27
+ $bootstrapper->admin(function() use( $boxzilla ){
28
+ $boxzilla['admin']->init();
29
+
30
+ if( count( $boxzilla->plugins ) > 0 ) {
31
+ $boxzilla['license_manager']->hook();
32
+ $boxzilla['update_manager']->hook();
33
+ }
34
+ });
35
+
36
+ $bootstrapper->ajax(function() use( $boxzilla ) {
37
+ $boxzilla['filter.autocomplete']->add_hooks();
38
+ });
39
+
40
+ $bootstrapper->front(function() use( $boxzilla ) {
41
+ add_action( 'template_redirect', function() use( $boxzilla ) {
42
+ $boxzilla['box_loader']->init();
43
+ });
44
+ });
45
+
46
+ $bootstrapper->cron(function() use( $boxzilla ) {
47
+ $boxzilla['license_poller']->hook();
48
+ });
49
+
50
+ $bootstrapper->run();
51
+ }, 90 );
trunk/boxzilla.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Boxzilla
4
+ Version: 3.1.7
5
+ Plugin URI: https://boxzillaplugin.com/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page
6
+ Description: Call-To-Action Boxes that display after visitors scroll down far enough. Unobtrusive, but highly conversing!
7
+ Author: ibericode
8
+ Author URI: https://ibericode.com/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page
9
+ Text Domain: boxzilla
10
+ Domain Path: /languages/
11
+ License: GPL v3
12
+
13
+ Boxzilla Plugin
14
+ Copyright (C) 2013-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
18
+ the Free Software Foundation, either version 3 of the License, or
19
+ (at your option) any later version.
20
+
21
+ This program is distributed in the hope that it will be useful,
22
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ GNU General Public License for more details.
25
+
26
+ You should have received a copy of the GNU General Public License
27
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
28
+ */
29
+
30
+ if ( ! defined( 'ABSPATH' ) ) {
31
+ header( 'Status: 403 Forbidden' );
32
+ header( 'HTTP/1.1 403 Forbidden' );
33
+ exit;
34
+ }
35
+
36
+
37
+ /**
38
+ * @ignore
39
+ * @internal
40
+ */
41
+ function __load_boxzilla() {
42
+
43
+ define( 'BOXZILLA_FILE', __FILE__ );
44
+ define( 'BOXZILLA_VERSION', '3.1.7' );
45
+
46
+ require __DIR__ . '/bootstrap.php';
47
+ }
48
+
49
+ // Check if we're on PHP 5.2, if so: bail early.
50
+ if( version_compare( PHP_VERSION, '5.3', '<' ) ) {
51
+ require dirname( __FILE__ ) . '/src/class-php-fallback.php';
52
+ new Boxzilla_PHP_Fallback( 'Boxzilla', plugin_basename( __FILE__ ) );
53
+ return;
54
+ }
55
+
56
+ // load autoloader but only if not loaded already (for compat with sitewide autoloader)
57
+ if( ! function_exists( 'boxzilla' ) ) {
58
+ require __DIR__ . '/vendor/autoload.php';
59
+ }
60
+
61
+ // register activation hook
62
+ register_activation_hook( __FILE__, array( 'Boxzilla\\Admin\\Installer', 'run' ) );
63
+
64
+ // hook into plugins_loaded for boostrapping
65
+ add_action( 'plugins_loaded', '__load_boxzilla', 8 );
66
+
67
+
68
+
trunk/languages/boxzilla-es_ES.mo ADDED
Binary file
trunk/languages/boxzilla-es_ES.po ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Scroll Triggered Boxes\n"
4
+ "POT-Creation-Date: 2014-04-18 12:14+0100\n"
5
+ "PO-Revision-Date: 2014-06-23 01:46+0100\n"
6
+ "Last-Translator: Danny <hi@dannyvankooten.com>\n"
7
+ "Language-Team: Danny van Kooten <hi@dannyvankooten.com>\n"
8
+ "Language: en_US\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.5.5\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-KeywordsList: __;_e\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+
18
+ #: ../includes/class-admin.php:58
19
+ msgid "Box Options"
20
+ msgstr "Opciones de caja"
21
+
22
+ #: ../includes/class-admin.php:67
23
+ msgid "Need support?"
24
+ msgstr "¿Necesitas soporte?"
25
+
26
+ #: ../includes/class-admin.php:75
27
+ msgid "Donate $10, $20 or $50"
28
+ msgstr "Dona 10, 20 o 50 dólares"
29
+
30
+ #: ../includes/class-admin.php:83
31
+ msgid "About the developer"
32
+ msgstr "Sobre el desarrollador"
33
+
34
+ #: ../includes/views/metabox-options.php:7
35
+ msgid "Scroll Triggered Box Options"
36
+ msgstr "Opciones de Scroll Triggered Box"
37
+
38
+ #: ../includes/views/metabox-options.php:9
39
+ msgid "Display Options"
40
+ msgstr "Opciones de visualización"
41
+
42
+ #: ../includes/views/metabox-options.php:15
43
+ msgid "Show this box"
44
+ msgstr "Mostrar esta caja"
45
+
46
+ #: ../includes/views/metabox-options.php:18
47
+ msgid "Basic"
48
+ msgstr "Básico"
49
+
50
+ #: ../includes/views/metabox-options.php:19
51
+ msgid "Everywhere"
52
+ msgstr "En todas partes"
53
+
54
+ #: ../includes/views/metabox-options.php:20
55
+ msgid "if Post Type is"
56
+ msgstr "Si la entrada es de tipo"
57
+
58
+ #: ../includes/views/metabox-options.php:21
59
+ msgid "if Page is"
60
+ msgstr "Si la página es"
61
+
62
+ #: ../includes/views/metabox-options.php:22
63
+ msgid "if Page is not"
64
+ msgstr "Si la página no es"
65
+
66
+ #: ../includes/views/metabox-options.php:23
67
+ msgid "if Post is"
68
+ msgstr "Si la entrada es"
69
+
70
+ #: ../includes/views/metabox-options.php:25
71
+ msgid "Advanced"
72
+ msgstr "Avanzado"
73
+
74
+ #: ../includes/views/metabox-options.php:26
75
+ msgid "Manual conditon"
76
+ msgstr "Condicion manual"
77
+
78
+ #: ../includes/views/metabox-options.php:31
79
+ msgid "Leave empty for any or enter (comma-separated) names or ID's"
80
+ msgstr ""
81
+ "Dejar en blanco para cualquiera o introduzca (separado por comas) nombres o "
82
+ "IDs"
83
+
84
+ #: ../includes/views/metabox-options.php:39
85
+ msgid "Add rule"
86
+ msgstr "Añadir regla"
87
+
88
+ #: ../includes/views/metabox-options.php:42
89
+ #, php-format
90
+ msgid ""
91
+ "For using advanced (manual) rules, have a look at %sthe WordPress "
92
+ "Conditional Tags Codex page%s."
93
+ msgstr ""
94
+ "Para el uso de reglas avanzadas (manuales) echar un vistazo a las "
95
+ "%setiquetas condicionales de WordPress en el Codex%s"
96
+
97
+ #: ../includes/views/metabox-options.php:45
98
+ msgid "Box Position"
99
+ msgstr "Posición de la caja"
100
+
101
+ #: ../includes/views/metabox-options.php:48
102
+ msgid "Top Left"
103
+ msgstr "Arriba a la izquierda"
104
+
105
+ #: ../includes/views/metabox-options.php:49
106
+ msgid "Top Right"
107
+ msgstr "Arriba a la derecha"
108
+
109
+ #: ../includes/views/metabox-options.php:50
110
+ msgid "Bottom Left"
111
+ msgstr "Abajo a la izquierda"
112
+
113
+ #: ../includes/views/metabox-options.php:51
114
+ msgid "Bottom Right"
115
+ msgstr "Abajo a la derecha"
116
+
117
+ #: ../includes/views/metabox-options.php:57
118
+ msgid "Trigger Point"
119
+ msgstr "Punto de disparo"
120
+
121
+ #: ../includes/views/metabox-options.php:61
122
+ msgid "of page height"
123
+ msgstr "de altura de la página"
124
+
125
+ #: ../includes/views/metabox-options.php:64
126
+ msgid "Element Selector"
127
+ msgstr "Selecto de elementos"
128
+
129
+ #: ../includes/views/metabox-options.php:70
130
+ msgid "Example: #comments (element must exist or box won't be shown)"
131
+ msgstr ""
132
+ "Ejemplo: #Comentarios (el elemento debe existir o la caja no será mostrada)"
133
+
134
+ #: ../includes/views/metabox-options.php:74
135
+ msgid "Animation"
136
+ msgstr "Animación"
137
+
138
+ #: ../includes/views/metabox-options.php:76
139
+ msgid "Fade In"
140
+ msgstr "Fade In"
141
+
142
+ #: ../includes/views/metabox-options.php:77
143
+ msgid "Slide In"
144
+ msgstr "Slide in"
145
+
146
+ #: ../includes/views/metabox-options.php:78
147
+ msgid "Which animation type should be used to show the box when triggered?"
148
+ msgstr ""
149
+ "¿Qué tipo de animación se debe utilizar cuando se activa el desencadenador "
150
+ "de la caja?"
151
+
152
+ #: ../includes/views/metabox-options.php:82
153
+ msgid "Cookie expiration days"
154
+ msgstr "Dias de vencimiento de la cookie"
155
+
156
+ #: ../includes/views/metabox-options.php:85
157
+ msgid "After closing the box, how many days should it stay hidden?"
158
+ msgstr "Después de cerrar la caja, ¿cuantos días debería permanecer oculta?"
159
+
160
+ #: ../includes/views/metabox-options.php:90
161
+ msgid "Auto-hide?"
162
+ msgstr "¿Auto-ocultar?"
163
+
164
+ #: ../includes/views/metabox-options.php:92
165
+ #: ../includes/views/metabox-options.php:101
166
+ msgid "Yes"
167
+ msgstr "Si"
168
+
169
+ #: ../includes/views/metabox-options.php:93
170
+ #: ../includes/views/metabox-options.php:102
171
+ msgid "No"
172
+ msgstr "No"
173
+
174
+ #: ../includes/views/metabox-options.php:94
175
+ msgid "Hide box again when visitors scroll back up?"
176
+ msgstr "¿Ocultar la caja cuando los visitantes se desplacen hacia arriba?"
177
+
178
+ #: ../includes/views/metabox-options.php:99
179
+ msgid "Enable test mode?"
180
+ msgstr "¿Activar el modo de prueba?"
181
+
182
+ #: ../includes/views/metabox-options.php:103
183
+ msgid ""
184
+ "If test mode is enabled, the box will show up regardless of whether a cookie "
185
+ "has been set."
186
+ msgstr ""
187
+ "Si el modo de pruebas está activo, la caja se mostrará independientemente de "
188
+ "la configuración de cookie establecida."
189
+
190
+ #: ../includes/views/metabox-options.php:108
191
+ msgid "Appearance"
192
+ msgstr "Apariencia"
193
+
194
+ #: ../includes/views/metabox-options.php:112
195
+ msgid "Background color"
196
+ msgstr "Color de fondo"
197
+
198
+ #: ../includes/views/metabox-options.php:116
199
+ msgid "Text color"
200
+ msgstr "Color del texto"
201
+
202
+ #: ../includes/views/metabox-options.php:120
203
+ msgid "Box width"
204
+ msgstr "Ancho de la caja"
205
+
206
+ #: ../includes/views/metabox-options.php:126
207
+ msgid "Border color"
208
+ msgstr "Color del borde"
209
+
210
+ #: ../includes/views/metabox-options.php:130
211
+ msgid "Border width"
212
+ msgstr "Ancho del borde"
trunk/languages/boxzilla-fr_FR.mo ADDED
Binary file
trunk/languages/boxzilla-fr_FR.po ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Scroll Triggered Boxes\n"
4
+ "POT-Creation-Date: 2014-04-18 12:14+0100\n"
5
+ "PO-Revision-Date: 2016-06-09 11:58+0100\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Generator: Poedit 1.5.5\n"
12
+ "X-Poedit-Basepath: .\n"
13
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
14
+ "X-Poedit-KeywordsList: __;_e\n"
15
+ "X-Poedit-SearchPath-0: ..\n"
16
+
17
+ #: ../includes/class-admin.php:58
18
+ msgid "Box Options"
19
+ msgstr "Options de boîte"
20
+
21
+ #: ../includes/class-admin.php:67
22
+ msgid "Need support?"
23
+ msgstr "Besoin de support ?"
24
+
25
+ #: ../includes/class-admin.php:75
26
+ msgid "Donate $10, $20 or $50"
27
+ msgstr "Donner 10 $, 20 $ ou 50 $"
28
+
29
+ #: ../includes/class-admin.php:83
30
+ msgid "About the developer"
31
+ msgstr "A propos du développeur"
32
+
33
+ #: ../includes/views/metabox-options.php:7
34
+ msgid "Scroll Triggered Box Options"
35
+ msgstr "Options de Scroll Triggered Box"
36
+
37
+ #: ../includes/views/metabox-options.php:9
38
+ msgid "Display Options"
39
+ msgstr "Options d'affichage"
40
+
41
+ #: ../includes/views/metabox-options.php:15
42
+ msgid "Show this box"
43
+ msgstr "Afficher cette boîte"
44
+
45
+ #: ../includes/views/metabox-options.php:18
46
+ msgid "Basic"
47
+ msgstr "Basique"
48
+
49
+ #: ../includes/views/metabox-options.php:19
50
+ msgid "Everywhere"
51
+ msgstr "Partout sur le site"
52
+
53
+ #: ../includes/views/metabox-options.php:20
54
+ msgid "if Post Type is"
55
+ msgstr "Si le Post Type est"
56
+
57
+ #: ../includes/views/metabox-options.php:21
58
+ msgid "if Page is"
59
+ msgstr "Si la page est"
60
+
61
+ #: ../includes/views/metabox-options.php:22
62
+ msgid "if Page is not"
63
+ msgstr "Si la page n'est pas"
64
+
65
+ #: ../includes/views/metabox-options.php:23
66
+ msgid "if Post is"
67
+ msgstr "Si l'article est"
68
+
69
+ #: ../includes/views/metabox-options.php:25
70
+ msgid "Advanced"
71
+ msgstr "Avancé"
72
+
73
+ #: ../includes/views/metabox-options.php:26
74
+ msgid "Manual conditon"
75
+ msgstr "Condition manuelle"
76
+
77
+ #: ../includes/views/metabox-options.php:31
78
+ msgid "Leave empty for any or enter (comma-separated) names or ID's"
79
+ msgstr ""
80
+ "Laisser vide pour tous ou une liste de noms ou d'ID séparés par des virgules"
81
+
82
+ #: ../includes/views/metabox-options.php:39
83
+ msgid "Add rule"
84
+ msgstr "Ajouter une règle"
85
+
86
+ #: ../includes/views/metabox-options.php:42
87
+ #, php-format
88
+ msgid ""
89
+ "For using advanced (manual) rules, have a look at %sthe WordPress "
90
+ "Conditional Tags Codex page%s."
91
+ msgstr ""
92
+ "Pour des régles manuelles avancées, voir %sthe WordPress Conditional Tags "
93
+ "Codex page%s."
94
+
95
+ #: ../includes/views/metabox-options.php:45
96
+ msgid "Box Position"
97
+ msgstr "Position de la boîte"
98
+
99
+ #: ../includes/views/metabox-options.php:48
100
+ msgid "Top Left"
101
+ msgstr "En haut à gauche"
102
+
103
+ #: ../includes/views/metabox-options.php:49
104
+ msgid "Top Right"
105
+ msgstr "En haut à droite"
106
+
107
+ #: ../includes/views/metabox-options.php:50
108
+ msgid "Bottom Left"
109
+ msgstr "En bas à gauche"
110
+
111
+ #: ../includes/views/metabox-options.php:51
112
+ msgid "Bottom Right"
113
+ msgstr "En bas à droite"
114
+
115
+ #: ../includes/views/metabox-options.php:57
116
+ msgid "Trigger Point"
117
+ msgstr "Seuil de déclenchement"
118
+
119
+ #: ../includes/views/metabox-options.php:61
120
+ msgid "of page height"
121
+ msgstr "de la hauteur de la page"
122
+
123
+ #: ../includes/views/metabox-options.php:64
124
+ msgid "Element Selector"
125
+ msgstr "Un élément précis dans la page"
126
+
127
+ #: ../includes/views/metabox-options.php:70
128
+ msgid "Example: #comments (element must exist or box won't be shown)"
129
+ msgstr ""
130
+ "Exemple: #comments (l'élément doit exister sinon la boîte n'apparaîtra pas)"
131
+
132
+ #: ../includes/views/metabox-options.php:74
133
+ msgid "Animation"
134
+ msgstr "Animation"
135
+
136
+ #: ../includes/views/metabox-options.php:76
137
+ msgid "Fade In"
138
+ msgstr "Fondu enchaîné"
139
+
140
+ #: ../includes/views/metabox-options.php:77
141
+ msgid "Slide In"
142
+ msgstr "Glissement"
143
+
144
+ #: ../includes/views/metabox-options.php:78
145
+ msgid "Which animation type should be used to show the box when triggered?"
146
+ msgstr "Quelle type d'animation lors de l'apparition de le boîte ?"
147
+
148
+ #: ../includes/views/metabox-options.php:82
149
+ msgid "Cookie expiration days"
150
+ msgstr "Nombre de jours avant expiration du cookie"
151
+
152
+ #: ../includes/views/metabox-options.php:85
153
+ msgid "After closing the box, how many days should it stay hidden?"
154
+ msgstr ""
155
+ "Après la fermeture de la boîte, combien de jours avant qu'elle ne s'affiche "
156
+ "à nouveau ?"
157
+
158
+ #: ../includes/views/metabox-options.php:90
159
+ msgid "Auto-hide?"
160
+ msgstr "Masquage automatique ?"
161
+
162
+ #: ../includes/views/metabox-options.php:92
163
+ #: ../includes/views/metabox-options.php:101
164
+ msgid "Yes"
165
+ msgstr "Oui"
166
+
167
+ #: ../includes/views/metabox-options.php:93
168
+ #: ../includes/views/metabox-options.php:102
169
+ msgid "No"
170
+ msgstr "Non"
171
+
172
+ #: ../includes/views/metabox-options.php:94
173
+ msgid "Hide box again when visitors scroll back up?"
174
+ msgstr ""
175
+ "Masque la boîte à nouveau lorsque le visiteur revient en haut de page ?"
176
+
177
+ #: ../includes/views/metabox-options.php:99
178
+ msgid "Enable test mode?"
179
+ msgstr "Activer le mode test ?"
180
+
181
+ #: ../includes/views/metabox-options.php:103
182
+ msgid ""
183
+ "If test mode is enabled, the box will show up regardless of whether a cookie "
184
+ "has been set."
185
+ msgstr ""
186
+ "Si le mode test est activé, la boîte va s'afficher indépendamment des "
187
+ "cookies."
188
+
189
+ #: ../includes/views/metabox-options.php:108
190
+ msgid "Appearance"
191
+ msgstr "Apparence"
192
+
193
+ #: ../includes/views/metabox-options.php:112
194
+ msgid "Background color"
195
+ msgstr "Couleur de fond"
196
+
197
+ #: ../includes/views/metabox-options.php:116
198
+ msgid "Text color"
199
+ msgstr "Couleur du texte"
200
+
201
+ #: ../includes/views/metabox-options.php:120
202
+ msgid "Box width"
203
+ msgstr "Largeur de bordure"
204
+
205
+ #: ../includes/views/metabox-options.php:126
206
+ msgid "Border color"
207
+ msgstr "Couleur de bordure"
208
+
209
+ #: ../includes/views/metabox-options.php:130
210
+ msgid "Border width"
211
+ msgstr "Largeur de bordure"
trunk/languages/boxzilla-nl_NL.mo ADDED
Binary file
trunk/languages/boxzilla-nl_NL.po ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Scroll Triggered Boxes\n"
4
+ "POT-Creation-Date: 2014-04-18 12:14+0100\n"
5
+ "PO-Revision-Date: 2014-04-18 12:16+0100\n"
6
+ "Last-Translator: Danny <hi@dannyvankooten.com>\n"
7
+ "Language-Team: Danny van Kooten <hi@dannyvankooten.com>\n"
8
+ "Language: en_US\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.6.4\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-KeywordsList: __;_e\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+
18
+ #: ../includes/class-admin.php:58
19
+ msgid "Box Options"
20
+ msgstr "Box Opties"
21
+
22
+ #: ../includes/class-admin.php:67
23
+ msgid "Need support?"
24
+ msgstr "Support nodig?"
25
+
26
+ #: ../includes/class-admin.php:75
27
+ msgid "Donate $10, $20 or $50"
28
+ msgstr "Doneer $10, $20 of $50"
29
+
30
+ #: ../includes/class-admin.php:83
31
+ msgid "About the developer"
32
+ msgstr "Over de ontwikkelaar"
33
+
34
+ #: ../includes/views/metabox-options.php:7
35
+ msgid "Scroll Triggered Box Options"
36
+ msgstr "Scroll Triggered Box Opties"
37
+
38
+ #: ../includes/views/metabox-options.php:9
39
+ msgid "Display Options"
40
+ msgstr "Weergave Opties"
41
+
42
+ #: ../includes/views/metabox-options.php:15
43
+ msgid "Show this box"
44
+ msgstr "Toon deze box"
45
+
46
+ #: ../includes/views/metabox-options.php:18
47
+ msgid "Basic"
48
+ msgstr "Standaard"
49
+
50
+ #: ../includes/views/metabox-options.php:19
51
+ msgid "Everywhere"
52
+ msgstr "Overal"
53
+
54
+ #: ../includes/views/metabox-options.php:20
55
+ msgid "if Post Type is"
56
+ msgstr "Als \"post type\" ... is"
57
+
58
+ #: ../includes/views/metabox-options.php:21
59
+ msgid "if Page is"
60
+ msgstr "Als \"page\" niet ... is"
61
+
62
+ #: ../includes/views/metabox-options.php:22
63
+ msgid "if Page is not"
64
+ msgstr "Als \"page\" niet ... is"
65
+
66
+ #: ../includes/views/metabox-options.php:23
67
+ msgid "if Post is"
68
+ msgstr "Als \"post\" niet ... is"
69
+
70
+ #: ../includes/views/metabox-options.php:25
71
+ msgid "Advanced"
72
+ msgstr "Geavanceerd"
73
+
74
+ #: ../includes/views/metabox-options.php:26
75
+ msgid "Manual conditon"
76
+ msgstr "Manuele Voorwaarde"
77
+
78
+ #: ../includes/views/metabox-options.php:31
79
+ msgid "Leave empty for any or enter (comma-separated) names or ID's"
80
+ msgstr ""
81
+ "Laat leeg voor alles of voer de namen of ID's in, gescheiden door een komma."
82
+
83
+ #: ../includes/views/metabox-options.php:39
84
+ msgid "Add rule"
85
+ msgstr "Regel toevoegen"
86
+
87
+ #: ../includes/views/metabox-options.php:42
88
+ #, php-format
89
+ msgid ""
90
+ "For using advanced (manual) rules, have a look at %sthe WordPress "
91
+ "Conditional Tags Codex page%s."
92
+ msgstr ""
93
+ "Voor het gebruken van geavanceerde manuele voorwaardes, bekijk de "
94
+ "%sWordPress Conditional Tags Codex pagina%s"
95
+
96
+ #: ../includes/views/metabox-options.php:45
97
+ msgid "Box Position"
98
+ msgstr "Box Positie"
99
+
100
+ #: ../includes/views/metabox-options.php:48
101
+ msgid "Top Left"
102
+ msgstr "Linksboven"
103
+
104
+ #: ../includes/views/metabox-options.php:49
105
+ msgid "Top Right"
106
+ msgstr "Rechtsboven"
107
+
108
+ #: ../includes/views/metabox-options.php:50
109
+ msgid "Bottom Left"
110
+ msgstr "Linksonder"
111
+
112
+ #: ../includes/views/metabox-options.php:51
113
+ msgid "Bottom Right"
114
+ msgstr "Rechtsonder"
115
+
116
+ #: ../includes/views/metabox-options.php:57
117
+ msgid "Trigger Point"
118
+ msgstr "Triggerpunt"
119
+
120
+ #: ../includes/views/metabox-options.php:61
121
+ msgid "of page height"
122
+ msgstr "van pagina hoogte"
123
+
124
+ #: ../includes/views/metabox-options.php:64
125
+ msgid "Element Selector"
126
+ msgstr "Element selector"
127
+
128
+ #: ../includes/views/metabox-options.php:70
129
+ msgid "Example: #comments (element must exist or box won't be shown)"
130
+ msgstr "Voorbeeld: #comments (element moet bestaan of de box blijft verborgen)"
131
+
132
+ #: ../includes/views/metabox-options.php:74
133
+ msgid "Animation"
134
+ msgstr "Animatie"
135
+
136
+ #: ../includes/views/metabox-options.php:76
137
+ msgid "Fade In"
138
+ msgstr "Fade In"
139
+
140
+ #: ../includes/views/metabox-options.php:77
141
+ msgid "Slide In"
142
+ msgstr "Slide In"
143
+
144
+ #: ../includes/views/metabox-options.php:78
145
+ msgid "Which animation type should be used to show the box when triggered?"
146
+ msgstr ""
147
+ "Welk animatietype moet worden gebruikt wanneer de box wordt getriggert?"
148
+
149
+ #: ../includes/views/metabox-options.php:82
150
+ msgid "Cookie expiration days"
151
+ msgstr "Cookie verloopt in ... dagen"
152
+
153
+ #: ../includes/views/metabox-options.php:85
154
+ msgid "After closing the box, how many days should it stay hidden?"
155
+ msgstr "Hoelang moet de box verborgen blijven nadat iemand de box sluit?"
156
+
157
+ #: ../includes/views/metabox-options.php:90
158
+ msgid "Auto-hide?"
159
+ msgstr "Automatisch verbergen?"
160
+
161
+ #: ../includes/views/metabox-options.php:92
162
+ #: ../includes/views/metabox-options.php:101
163
+ msgid "Yes"
164
+ msgstr "Ja"
165
+
166
+ #: ../includes/views/metabox-options.php:93
167
+ #: ../includes/views/metabox-options.php:102
168
+ msgid "No"
169
+ msgstr "Nee"
170
+
171
+ #: ../includes/views/metabox-options.php:94
172
+ msgid "Hide box again when visitors scroll back up?"
173
+ msgstr "Verberg box wanneer bezoekers terug omhoog scrollen?"
174
+
175
+ #: ../includes/views/metabox-options.php:99
176
+ msgid "Enable test mode?"
177
+ msgstr "Test modus activeren?"
178
+
179
+ #: ../includes/views/metabox-options.php:103
180
+ msgid ""
181
+ "If test mode is enabled, the box will show up regardless of whether a cookie "
182
+ "has been set."
183
+ msgstr ""
184
+ "Als test modus actief is zal de box altijd getoond worden, zelfs als er een "
185
+ "cookie geplaatst is."
186
+
187
+ #: ../includes/views/metabox-options.php:108
188
+ msgid "Appearance"
189
+ msgstr "Weergave"
190
+
191
+ #: ../includes/views/metabox-options.php:112
192
+ msgid "Background color"
193
+ msgstr "Achtergrondkleur"
194
+
195
+ #: ../includes/views/metabox-options.php:116
196
+ msgid "Text color"
197
+ msgstr "Tekstkleur"
198
+
199
+ #: ../includes/views/metabox-options.php:120
200
+ msgid "Box width"
201
+ msgstr "Box breedte"
202
+
203
+ #: ../includes/views/metabox-options.php:126
204
+ msgid "Border color"
205
+ msgstr "Border kleur"
206
+
207
+ #: ../includes/views/metabox-options.php:130
208
+ msgid "Border width"
209
+ msgstr "Border breedte"
trunk/languages/boxzilla.pot ADDED
@@ -0,0 +1,407 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016 boxzilla
2
+ # This file is distributed under the same license as the boxzilla package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: boxzilla\n"
6
+ "MIME-Version: 1.0\n"
7
+ "Content-Type: text/plain; charset=UTF-8\n"
8
+ "Content-Transfer-Encoding: 8bit\n"
9
+ "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
10
+ "X-Poedit-Basepath: ..\n"
11
+ "X-Poedit-SourceCharset: UTF-8\n"
12
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
13
+ "X-Poedit-SearchPath-0: .\n"
14
+ "X-Poedit-SearchPathExcluded-0: *.js\n"
15
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+
17
+ #: src/admin/class-admin.php:207
18
+ msgid "Awesome, you are using Boxzilla! You can now safely <a href=\"%s\">deactivate the Scroll Triggered Boxes plugin</a>."
19
+ msgstr ""
20
+
21
+ #: src/admin/class-admin.php:341
22
+ msgid "Box ID"
23
+ msgstr ""
24
+
25
+ #: src/admin/class-admin.php:347
26
+ msgid "Box Title"
27
+ msgstr ""
28
+
29
+ #: src/admin/class-admin.php:415, src/admin/class-admin.php:417, src/admin/views/settings.php:7
30
+ msgid "Settings"
31
+ msgstr ""
32
+
33
+ #: src/admin/class-admin.php:427, src/admin/class-admin.php:429
34
+ msgid "Extensions"
35
+ msgstr ""
36
+
37
+ #: src/admin/class-admin.php:615
38
+ msgid "Enter a comma-separated list of values."
39
+ msgstr ""
40
+
41
+ #: src/admin/class-admin.php:617
42
+ msgid "Enter a comma-separated list of post slugs or post ID's.."
43
+ msgstr ""
44
+
45
+ #: src/admin/class-admin.php:619
46
+ msgid "Enter a comma-separated list of page slugs or page ID's.."
47
+ msgstr ""
48
+
49
+ #: src/admin/class-admin.php:621
50
+ msgid "Enter a comma-separated list of post types.."
51
+ msgstr ""
52
+
53
+ #: src/admin/class-admin.php:623
54
+ msgid "Enter a comma-separated list of relative URL's, eg /contact/"
55
+ msgstr ""
56
+
57
+ #: src/admin/class-admin.php:689
58
+ msgid "Box Appearance"
59
+ msgstr ""
60
+
61
+ #: src/admin/class-admin.php:707
62
+ msgid "Box Options"
63
+ msgstr ""
64
+
65
+ #: src/admin/class-admin.php:725
66
+ msgid "Looking for help?"
67
+ msgstr ""
68
+
69
+ #: src/admin/class-admin.php:741
70
+ msgid "Subscribe to our newsletter"
71
+ msgstr ""
72
+
73
+ #: src/admin/class-review-notice.php:74
74
+ msgid "You've been using Boxzilla for some time now; we hope you love it!"
75
+ msgstr ""
76
+
77
+ #: src/admin/class-review-notice.php:75
78
+ msgid "If you do, please <a href=\"%s\">leave us a 5★ rating on WordPress.org</a>. It would be of great help to us."
79
+ msgstr ""
80
+
81
+ #: src/admin/class-review-notice.php:77
82
+ msgid "Dismiss this notice."
83
+ msgstr ""
84
+
85
+ #: src/admin/views/extensions.php:4
86
+ msgid "Available Add-On Plugins"
87
+ msgstr ""
88
+
89
+ #: src/admin/views/extensions.php:6
90
+ msgid "There are various add-ons available for Boxzilla which further enhance the functionality of the core plugin."
91
+ msgstr ""
92
+
93
+ #: src/admin/views/extensions.php:9
94
+ msgid "To gain instant access the premium add-on plugins listed here, <a href=\"%s\">have a look at our pricing</a>."
95
+ msgstr ""
96
+
97
+ #: src/admin/views/extensions.php:18
98
+ msgid "You will be redirected to the Boxzilla site in a few seconds.."
99
+ msgstr ""
100
+
101
+ #: src/admin/views/extensions.php:19
102
+ msgid "If not, please click here: %s."
103
+ msgstr ""
104
+
105
+ #: src/admin/views/metaboxes/box-appearance-controls.php:2
106
+ msgid "For the best experience when styling your box, please use the default WordPress visual editor."
107
+ msgstr ""
108
+
109
+ #: src/admin/views/metaboxes/box-appearance-controls.php:8
110
+ msgid "Background color"
111
+ msgstr ""
112
+
113
+ #: src/admin/views/metaboxes/box-appearance-controls.php:12
114
+ msgid "Text color"
115
+ msgstr ""
116
+
117
+ #: src/admin/views/metaboxes/box-appearance-controls.php:16
118
+ msgid "Box width"
119
+ msgstr ""
120
+
121
+ #: src/admin/views/metaboxes/box-appearance-controls.php:18, src/admin/views/metaboxes/box-appearance-controls.php:29
122
+ msgid "Width in px"
123
+ msgstr ""
124
+
125
+ #: src/admin/views/metaboxes/box-appearance-controls.php:23
126
+ msgid "Border color"
127
+ msgstr ""
128
+
129
+ #: src/admin/views/metaboxes/box-appearance-controls.php:27
130
+ msgid "Border width"
131
+ msgstr ""
132
+
133
+ #: src/admin/views/metaboxes/box-appearance-controls.php:32, src/admin/views/metaboxes/box-appearance-controls.php:40
134
+ msgid "Border style"
135
+ msgstr ""
136
+
137
+ #: src/admin/views/metaboxes/box-appearance-controls.php:46
138
+ msgid "<a href=\"%s\">Click here to reset all styling settings</a>."
139
+ msgstr ""
140
+
141
+ #: src/admin/views/metaboxes/box-option-controls.php:21
142
+ msgid "Select a condition"
143
+ msgstr ""
144
+
145
+ #: src/admin/views/metaboxes/box-option-controls.php:23
146
+ msgid "everywhere"
147
+ msgstr ""
148
+
149
+ #: src/admin/views/metaboxes/box-option-controls.php:25
150
+ msgid "if page"
151
+ msgstr ""
152
+
153
+ #: src/admin/views/metaboxes/box-option-controls.php:27
154
+ msgid "if post"
155
+ msgstr ""
156
+
157
+ #: src/admin/views/metaboxes/box-option-controls.php:29
158
+ msgid "if post tag"
159
+ msgstr ""
160
+
161
+ #: src/admin/views/metaboxes/box-option-controls.php:31
162
+ msgid "if post category"
163
+ msgstr ""
164
+
165
+ #: src/admin/views/metaboxes/box-option-controls.php:33
166
+ msgid "if post type"
167
+ msgstr ""
168
+
169
+ #: src/admin/views/metaboxes/box-option-controls.php:35
170
+ msgid "if URL"
171
+ msgstr ""
172
+
173
+ #: src/admin/views/metaboxes/box-option-controls.php:37
174
+ msgid "if referer"
175
+ msgstr ""
176
+
177
+ #: src/admin/views/metaboxes/box-option-controls.php:75
178
+ msgid "Load this box if"
179
+ msgstr ""
180
+
181
+ #: src/admin/views/metaboxes/box-option-controls.php:81
182
+ msgid "Request matches"
183
+ msgstr ""
184
+
185
+ #: src/admin/views/metaboxes/box-option-controls.php:85
186
+ msgid "any"
187
+ msgstr ""
188
+
189
+ #: src/admin/views/metaboxes/box-option-controls.php:87
190
+ msgid "all"
191
+ msgstr ""
192
+
193
+ #: src/admin/views/metaboxes/box-option-controls.php:91
194
+ msgid "of the following conditions."
195
+ msgstr ""
196
+
197
+ #: src/admin/views/metaboxes/box-option-controls.php:133, src/admin/views/metaboxes/box-option-controls.php:421
198
+ msgid "is"
199
+ msgstr ""
200
+
201
+ #: src/admin/views/metaboxes/box-option-controls.php:135, src/admin/views/metaboxes/box-option-controls.php:423
202
+ msgid "is not"
203
+ msgstr ""
204
+
205
+ #: src/admin/views/metaboxes/box-option-controls.php:141, src/admin/views/metaboxes/box-option-controls.php:429
206
+ msgid "Leave empty for any or enter (comma-separated) names or ID's"
207
+ msgstr ""
208
+
209
+ #: src/admin/views/metaboxes/box-option-controls.php:157
210
+ msgid "Add rule"
211
+ msgstr ""
212
+
213
+ #: src/admin/views/metaboxes/box-option-controls.php:163
214
+ msgid "Box Position"
215
+ msgstr ""
216
+
217
+ #: src/admin/views/metaboxes/box-option-controls.php:175
218
+ msgid "Top Left"
219
+ msgstr ""
220
+
221
+ #: src/admin/views/metaboxes/box-option-controls.php:189
222
+ msgid "Top Right"
223
+ msgstr ""
224
+
225
+ #: src/admin/views/metaboxes/box-option-controls.php:207
226
+ msgid "Center"
227
+ msgstr ""
228
+
229
+ #: src/admin/views/metaboxes/box-option-controls.php:225
230
+ msgid "Bottom Left"
231
+ msgstr ""
232
+
233
+ #: src/admin/views/metaboxes/box-option-controls.php:239
234
+ msgid "Bottom Right"
235
+ msgstr ""
236
+
237
+ #: src/admin/views/metaboxes/box-option-controls.php:257
238
+ msgid "Animation"
239
+ msgstr ""
240
+
241
+ #: src/admin/views/metaboxes/box-option-controls.php:261
242
+ msgid "Fade In"
243
+ msgstr ""
244
+
245
+ #: src/admin/views/metaboxes/box-option-controls.php:263
246
+ msgid "Slide In"
247
+ msgstr ""
248
+
249
+ #: src/admin/views/metaboxes/box-option-controls.php:265
250
+ msgid "Which animation type should be used to show the box when triggered?"
251
+ msgstr ""
252
+
253
+ #: src/admin/views/metaboxes/box-option-controls.php:273
254
+ msgid "Auto-show box?"
255
+ msgstr ""
256
+
257
+ #: src/admin/views/metaboxes/box-option-controls.php:277
258
+ msgid "Never"
259
+ msgstr ""
260
+
261
+ #: src/admin/views/metaboxes/box-option-controls.php:279
262
+ msgid "Yes, after %s seconds on the page."
263
+ msgstr ""
264
+
265
+ #: src/admin/views/metaboxes/box-option-controls.php:281
266
+ msgid "Yes, when at %s of page height"
267
+ msgstr ""
268
+
269
+ #: src/admin/views/metaboxes/box-option-controls.php:283
270
+ msgid "Yes, when at element %s"
271
+ msgstr ""
272
+
273
+ #: src/admin/views/metaboxes/box-option-controls.php:283
274
+ msgid "Example: #comments"
275
+ msgstr ""
276
+
277
+ #: src/admin/views/metaboxes/box-option-controls.php:295
278
+ msgid "Cookie expiration"
279
+ msgstr ""
280
+
281
+ #: src/admin/views/metaboxes/box-option-controls.php:305, src/admin/views/metaboxes/box-option-controls.php:315
282
+ msgid "hours"
283
+ msgstr ""
284
+
285
+ #: src/admin/views/metaboxes/box-option-controls.php:323
286
+ msgid "After this box is triggered or dismissed, how many hours should it stay hidden?"
287
+ msgstr ""
288
+
289
+ #: src/admin/views/metaboxes/box-option-controls.php:331
290
+ msgid "Do not auto-show box on small screens?"
291
+ msgstr ""
292
+
293
+ #: src/admin/views/metaboxes/box-option-controls.php:335
294
+ msgid "Do not auto-show on screens smaller than %s."
295
+ msgstr ""
296
+
297
+ #: src/admin/views/metaboxes/box-option-controls.php:337
298
+ msgid "Leave empty if you <strong>do</strong> want to auto-show the box on small screens."
299
+ msgstr ""
300
+
301
+ #: src/admin/views/metaboxes/box-option-controls.php:347
302
+ msgid "Auto-hide?"
303
+ msgstr ""
304
+
305
+ #: src/admin/views/metaboxes/box-option-controls.php:355
306
+ msgid "Hide box again when visitors scroll back up?"
307
+ msgstr ""
308
+
309
+ #: src/admin/views/metaboxes/box-option-controls.php:363, src/admin/views/settings.php:20
310
+ msgid "Enable test mode?"
311
+ msgstr ""
312
+
313
+ #: src/admin/views/metaboxes/box-option-controls.php:371, src/admin/views/settings.php:24
314
+ msgid "If test mode is enabled, all boxes will show up regardless of whether a cookie has been set."
315
+ msgstr ""
316
+
317
+ #: src/admin/views/metaboxes/need-help.php:2
318
+ msgid "Please make sure to look at the following available resources."
319
+ msgstr ""
320
+
321
+ #: src/default-actions.php:12, src/default-actions.php:24
322
+ msgid "Boxzilla"
323
+ msgstr ""
324
+
325
+ #: src/default-actions.php:13
326
+ msgid "Box"
327
+ msgstr ""
328
+
329
+ #: src/default-actions.php:14
330
+ msgid "Add New"
331
+ msgstr ""
332
+
333
+ #: src/default-actions.php:15
334
+ msgid "Add New Box"
335
+ msgstr ""
336
+
337
+ #: src/default-actions.php:16
338
+ msgid "Edit Box"
339
+ msgstr ""
340
+
341
+ #: src/default-actions.php:17
342
+ msgid "New Box"
343
+ msgstr ""
344
+
345
+ #: src/default-actions.php:18
346
+ msgid "All Boxes"
347
+ msgstr ""
348
+
349
+ #: src/default-actions.php:19
350
+ msgid "View Box"
351
+ msgstr ""
352
+
353
+ #: src/default-actions.php:20
354
+ msgid "Search Boxes"
355
+ msgstr ""
356
+
357
+ #: src/default-actions.php:21
358
+ msgid "No Boxes found"
359
+ msgstr ""
360
+
361
+ #: src/default-actions.php:22
362
+ msgid "No Boxes found in Trash"
363
+ msgstr ""
364
+
365
+ #: src/licensing/class-api.php:162
366
+ msgid "The Boxzilla server returned an invalid response."
367
+ msgstr ""
368
+
369
+ #: src/licensing/views/license-form.php:8
370
+ msgid "License & Plugin Updates"
371
+ msgstr ""
372
+
373
+ #: src/licensing/views/license-form.php:13
374
+ msgid "Warning! You are <u>not</u> receiving plugin updates for the following plugin(s):"
375
+ msgstr ""
376
+
377
+ #: src/licensing/views/license-form.php:27
378
+ msgid "License Key"
379
+ msgstr ""
380
+
381
+ #: src/licensing/views/license-form.php:29
382
+ msgid "Enter your license key.."
383
+ msgstr ""
384
+
385
+ #: src/licensing/views/license-form.php:32
386
+ msgid "The license key received when purchasing your premium Boxzilla plan. <a href=\"%s\">You can find it here</a>."
387
+ msgstr ""
388
+
389
+ #: src/licensing/views/license-form.php:37
390
+ msgid "License Status"
391
+ msgstr ""
392
+
393
+ #: src/licensing/views/license-form.php:41
394
+ msgid "ACTIVE"
395
+ msgstr ""
396
+
397
+ #: src/licensing/views/license-form.php:41
398
+ msgid "you are receiving plugin updates"
399
+ msgstr ""
400
+
401
+ #: src/licensing/views/license-form.php:43
402
+ msgid "INACTIVE"
403
+ msgstr ""
404
+
405
+ #: src/licensing/views/license-form.php:43
406
+ msgid "you are <strong>not</strong> receiving plugin updates"
407
+ msgstr ""
trunk/readme.txt ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Boxzilla ===
2
+ Contributors: Ibericode, DvanKooten, hchouhan, lapzor
3
+ Donate link: https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=donate-link
4
+ Tags: scroll triggered box, cta, social, pop-up, newsletter, call to action, mailchimp, contact form 7, social media, mc4wp, ibericode
5
+ Requires at least: 3.8
6
+ Tested up to: 4.6.1
7
+ Stable tag: 3.1.7
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Flexible call to action boxes, popping up or sliding in at just the right time.
12
+
13
+ == Description ==
14
+
15
+ ### Boxzilla for WordPress
16
+
17
+ Boxzilla is a *lightweight* plugin for adding flexible call-to-actions to your WordPress site. Boxes can slide or fade in at any point and can contain whatever content you like.
18
+
19
+ #### Some of Boxzilla's features
20
+
21
+ - Boxes can contain _any_ content you like.
22
+ - Various box triggers:
23
+ - Scroll percentage
24
+ - Reaching a certain page element
25
+ - X amount of time on the page
26
+ - Exit Intent (premium)
27
+ - Time on Site (premium)
28
+ - Manually by clicking a link or button
29
+ - Customizable box position on the screen.
30
+ - Various visibility animations.
31
+ - Advanced page targeting.
32
+ - Full control over how long (and whether) boxes should stay hidden.
33
+ - Customizable box appearance using a simple & intuitive interface.
34
+ - Mobile optimized.
35
+
36
+ [Read more about Boxzilla](https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description).
37
+
38
+ > This is the successor of the old [Scroll Triggered Boxes](https://wordpress.org/plugins/scroll-triggered-boxes/) plugin.
39
+
40
+ #### Documentation
41
+
42
+ Please have a look at the [Boxzilla KB](https://kb.boxzillaplugin.com/).
43
+
44
+ #### Demo
45
+
46
+ There's a [Boxzilla demo](https://demo.boxzillaplugin.com#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description) with some examples.
47
+
48
+ #### Add-on plugins
49
+
50
+ The core Boxzilla plugin is and always will be free. Additional advanced functionality is available through several add-ons. Not only do they extend the core functionality of the plugin, they also help to fund further development of the core (free) plugin.
51
+
52
+ [Browse available add-ons for Boxzilla](https://boxzillaplugin.com/add-ons/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description).
53
+
54
+ #### Contributing and reporting bugs=
55
+
56
+ You can contribute to [Boxzilla on GitHub](https://github.com/ibericode/boxzilla).
57
+
58
+ #### Support
59
+
60
+ Please use the [WordPress.org plugin support forums](https://wordpress.org/support/plugin/boxzilla) for community support where we try to help all users.
61
+
62
+ If you think you've found a bug, please [report it on GitHub](https://github.com/ibericode/boxzilla/issues).
63
+
64
+ If you're on [one of the available premium plans](https://boxzillaplugin.com/pricing#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description), please use the support email for a faster reply.
65
+
66
+ == Frequently Asked Questions ==
67
+
68
+ = What does this plugin do? =
69
+
70
+ Have a look at the [Boxzilla demo site](https://demo.boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description).
71
+
72
+ = How to display a form in the box? =
73
+
74
+ Boxzilla will work with any plugin that offers shortcodes, like [MailChimp for WordPress](https://wordpress.org/plugins/mailchimp-for-wp/).
75
+
76
+ = Can I have a box open after clicking a certain link or button? =
77
+
78
+ Sure, by linking to the box element.
79
+
80
+ *Example (box ID is 94 in this example)*
81
+ `
82
+ <a href="#boxzilla-94">Open Box</a>
83
+ `
84
+
85
+ = Can I have a box to open right after opening a page? =
86
+
87
+ Sure, just include `boxzilla-` followed by the box ID in the URL.
88
+
89
+ *Example (box ID is 94 in this example)*
90
+ `
91
+ http://your-wordpress-site.com/some-page/#boxzilla-94
92
+ `
93
+
94
+ = Can I customize the appearance of a box =
95
+
96
+ Boxzilla comes with a simple interface for customizing most box colors & borders. You can apply your own CSS by utilizing any of the following element selectors.
97
+
98
+ `
99
+ .boxzilla { } /* all boxes */
100
+ .boxzilla-5 { } /* box with ID 5 */
101
+ `
102
+
103
+ = I want to disable auto-paragraphs in the box content =
104
+
105
+ All default WordPress filters are added to the `stb_content` filter hook. If you want to remove any of them, add the respectable line to your theme its `functions.php` file.
106
+
107
+ `
108
+ remove_filter( 'boxzilla_box_content', 'wptexturize') ;
109
+ remove_filter( 'boxzilla_box_content', 'convert_smilies' );
110
+ remove_filter( 'boxzilla_box_content', 'convert_chars' );
111
+ remove_filter( 'boxzilla_box_content', 'wpautop' );
112
+ remove_filter( 'boxzilla_box_content', 'do_shortcode' );
113
+ remove_filter( 'boxzilla_box_content', 'shortcode_unautop' );
114
+ `
115
+
116
+ = I want to make it impossible to close a box =
117
+ `
118
+ add_filter( 'boxzilla_box_options', function( $opts, $box ) {
119
+ $opts['closable'] = false;
120
+ return $opts;
121
+ }, 10, 2 );
122
+ `
123
+
124
+ == Installation ==
125
+
126
+ = Installing the plugin =
127
+
128
+ 1. In your WordPress admin panel, go to *Plugins > New Plugin*, search for *Boxzilla* and click "Install now"
129
+ 1. Alternatively, download the plugin and upload the contents of `boxzilla.zip` to your plugins directory, which usually is `/wp-content/plugins/`.
130
+ 1. Activate the plugin.
131
+
132
+ = Creating a Boxzilla box =
133
+
134
+ 1. Go to *Boxzilla > Add New*
135
+ 1. Add some content to the box
136
+ 1. (Optional) customize the appearance of the box by changing the *Appearance Settings*
137
+
138
+ = Additional Customization =
139
+
140
+ Have a look at the [frequently asked questions](https://wordpress.org/plugins/boxzilla/faq/) section for some examples of additional customization.
141
+
142
+ == Screenshots ==
143
+
144
+ 1. A scroll triggered box with a newsletter sign-up form.
145
+ 2. Another scroll triggered box, this time with social media sharing options.
146
+ 3. A differently styled social triggered box.
147
+ 4. Configuring and customizing your boxes is easy.
148
+
149
+ == Changelog ==
150
+
151
+
152
+ #### 3.1.7 - November 8, 2016
153
+
154
+ **Fixes**
155
+
156
+ - Cookie length value was reset on every plugin update.
157
+ - Scroll to bottom when closing box in MobileSafari browsers.
158
+
159
+ **Improvements**
160
+
161
+ - Add CSS class to overlay when box is toggled.
162
+ - Ask for [plugin review](https://wordpress.org/support/plugin/boxzilla/reviews/#new-post) after 2 weeks of usage.
163
+
164
+
165
+ #### 3.1.6 - October 18, 2016
166
+
167
+ **Improvements**
168
+
169
+ - Failsafe against including the Boxzilla script twice, to prevent duplicate elements.
170
+
171
+
172
+ #### 3.1.5 - September 6, 2016
173
+
174
+ **Fixes**
175
+
176
+ - Box cookies were being set for _all_ boxes when dismissing a box using the overlay or ESCAPE key.
177
+ - Auto-close not working since version 3.1.3
178
+
179
+ **Improvements**
180
+
181
+ - Prevent default click event action when clicking close icon.
182
+ - Add helper classes for the [Boxzilla - Theme Pack add-on](https://boxzillaplugin.com/add-ons/theme-pack/).
183
+
184
+
185
+ #### 3.1.4 - August 24, 2016
186
+
187
+ **Fixes**
188
+
189
+ - `Boxzilla.show(123)` no longer working in previous update.
190
+
191
+
192
+ #### 3.1.3 - August 24, 2016
193
+
194
+ **Improvements**
195
+
196
+ - Don't trigger any new boxes when a box is currently open.
197
+ - Fail gracefully when not running PHP 5.3 or higher.
198
+
199
+
200
+ #### 3.1.2 - August 2, 2016
201
+
202
+ **Fixes**
203
+
204
+ - Exit-Intent not working in Safari & Firefox.
205
+
206
+
207
+ #### 3.1.1 - August 1, 2016
208
+
209
+ **Fixes**
210
+
211
+ - Scroll triggers not working in IE11.
212
+
213
+ **Improvements**
214
+
215
+ - Allow `<img>` elements inside links that open boxes.
216
+ - Better page height detection.
217
+
218
+
219
+ #### 3.1 - July 19, 2016
220
+
221
+ **Improvements**
222
+
223
+ - Completely removed jQuery dependency, resulting in better performance & smoother animations.
224
+ - Completely removed CSS file dependency.
225
+ - Box position is now visually hinted in box settings.
226
+ - Event binding improvements for [Exit Intent detection](https://boxzillaplugin.com/add-ons/exit-intent/).
227
+
228
+ **Additions**
229
+
230
+ - You can now set a cookie after the box is triggered, to prevent consecutively showing the box if a visitor does not explicitly dismiss it.
231
+
232
+
233
+ #### 3.0.3 - July 5, 2016
234
+
235
+ **Improvements**
236
+
237
+ - Add `id` attribute to box element.
238
+ - Automatically fix links in box content that use HTTP when HTTPS is needed.
239
+ - Restore global jQuery object after running user scripts, to failsafe errors.
240
+
241
+ **Additions**
242
+
243
+ - When using [MailChimp for WordPress](https://wordpress.org/plugins/mailchimp-for-wp/) without AJAX, the box will now automatically re-open after reloading the page.
244
+
245
+
246
+ #### 3.0.2 - June 21, 2016
247
+
248
+ **Fixes**
249
+
250
+ - Box condition "is post" was not working with an empty value.
251
+
252
+ **Improvements**
253
+
254
+ - Prevent PHP notice when saving box without changing box rules.
255
+
256
+ **Additions**
257
+
258
+ - Added French translation files, thanks to Benoit Mercusot.
259
+
260
+
261
+ #### 3.0.1 - May 23, 2016
262
+
263
+ **Improvements**
264
+
265
+ - You can now use `<script>` tags directly in box content (again).
266
+
267
+ **Additions**
268
+
269
+ - Add "post tag is / is not" loading condition.
270
+ - Plugin will now show a notice to deactivate old Scroll Triggered Boxes plugin.
271
+ - Internal changes to dependency container for use in add-on plugins.
272
+ - Add-on: [Boxzilla Pageviews Trigger](https://boxzillaplugin.com/add-ons/pageviews/).
273
+ - Add-on: [Boxzilla WooCommerce](https://boxzillaplugin.com/add-ons/woocommerce/)
274
+
275
+
276
+ #### 3.0 - May 11, 2016
277
+
278
+ Initial release of [Boxzilla](https://boxzillaplugin.com/), formerly known as [Scroll Triggered Boxes](https://wordpress.org/plugins/scroll-triggered-boxes/).
279
+
280
+ If you're upgrading from the old plugin, please check [updating to Boxzilla from Scroll Triggered Boxes](https://kb.boxzillaplugin.com/updating-from-scroll-triggered-boxes/) for a list of changes you should be aware of.
281
+
282
+
283
+ == Upgrade Notice ==
284
+
285
+ = 2.1 =
286
+ Added autocomplete to box filters & minor bux fixes for filter rules.
trunk/src/admin/class-admin.php ADDED
@@ -0,0 +1,764 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Admin;
4
+
5
+ use Boxzilla\Plugin,
6
+ Boxzilla\Box,
7
+ Boxzilla\Boxzilla;
8
+ use WP_Post;
9
+ use WP_Screen;
10
+
11
+ class Admin {
12
+
13
+ /**
14
+ * @var Plugin $plugin
15
+ */
16
+ private $plugin;
17
+
18
+ /**
19
+ * @var Boxzilla
20
+ */
21
+ protected $boxzilla;
22
+
23
+ /**
24
+ * @var ReviewNotice
25
+ */
26
+ protected $review_notice;
27
+
28
+ /**
29
+ * @param Plugin $plugin
30
+ * @param Boxzilla $boxzilla
31
+ */
32
+ public function __construct( Plugin $plugin, Boxzilla $boxzilla ) {
33
+ $this->plugin = $plugin;
34
+ $this->boxzilla = $boxzilla;
35
+ $this->review_notice = new ReviewNotice();
36
+ }
37
+
38
+ /**
39
+ * Initialise the all admin related stuff
40
+ */
41
+ public function init() {
42
+
43
+ // Load the plugin textdomain
44
+ load_plugin_textdomain( 'boxzilla', null, basename( $this->plugin->dir() ) . '/languages' );
45
+
46
+ // action hooks
47
+ $this->add_hooks();
48
+ $this->run_migrations();
49
+ }
50
+
51
+ /**
52
+ * Add necessary hooks
53
+ */
54
+ protected function add_hooks() {
55
+ add_action( 'admin_init', array( $this, 'lazy_add_hooks' ) );
56
+ add_action( 'admin_init', array( $this, 'register' ) );
57
+ add_action( 'init', array( $this, 'listen_for_actions' ) );
58
+ add_action( 'admin_menu', array( $this, 'menu' ) );
59
+ add_action( 'admin_notices', array( $this, 'notices' ) );
60
+ add_action( 'save_post_boxzilla-box', array( $this, 'save_box_options' ), 20, 2 );
61
+ add_action( 'trashed_post', array( $this, 'flush_rules' ) );
62
+ add_action( 'untrashed_post', array( $this, 'flush_rules' ) );
63
+
64
+ $this->review_notice->add_hooks();
65
+ }
66
+
67
+ /**
68
+ * Listen for admin actions.
69
+ */
70
+ public function listen_for_actions() {
71
+
72
+ // triggered?
73
+ $vars = array_merge( $_POST, $_GET );
74
+ if( empty( $vars['_boxzilla_admin_action'] ) ) {
75
+ return false;
76
+ }
77
+
78
+ // authorized?
79
+ if( ! current_user_can( 'edit_posts' ) ) {
80
+ return false;
81
+ }
82
+
83
+ // fire action
84
+ $action = $vars['_boxzilla_admin_action'];
85
+ do_action( 'boxzilla_admin_' . $action );
86
+
87
+ return true;
88
+ }
89
+
90
+ /**
91
+ * All logic for admin notices lives here.
92
+ */
93
+ public function notices() {
94
+ global $pagenow,
95
+ $current_screen;
96
+
97
+ if( ( $pagenow === 'plugins.php' || ( $current_screen && $current_screen->post_type === 'boxzilla-box' ) )
98
+ && current_user_can( 'install_plugins' )
99
+ && is_plugin_active( 'scroll-triggered-boxes/index.php' ) ) {
100
+
101
+ $url = wp_nonce_url( 'plugins.php?action=deactivate&plugin=scroll-triggered-boxes/index.php', 'deactivate-plugin_' . 'scroll-triggered-boxes/index.php' );
102
+ ?>
103
+ <div class="notice notice-info">
104
+ <p><?php printf( __( 'Awesome, you are using Boxzilla! You can now safely <a href="%s">deactivate the Scroll Triggered Boxes plugin</a>.', 'boxzilla' ), $url ); ?></p>
105
+ </div>
106
+ <?php
107
+ }
108
+
109
+ }
110
+
111
+ /**
112
+ * Checks current version against stored version & runs necessary update routines.
113
+ *
114
+ * @return bool
115
+ */
116
+ protected function run_migrations() {
117
+
118
+ // Only run if db option is at older version than code constant
119
+ $previous_version = get_option( 'boxzilla_version', '0' );
120
+ $current_version = $this->plugin->version();
121
+
122
+ if( version_compare( $current_version, $previous_version, '<=' ) ) {
123
+ return false;
124
+ }
125
+
126
+ $upgrade_routines = new Migrations( $previous_version, $current_version, __DIR__ . '/migrations' );
127
+ $upgrade_routines->run();
128
+ update_option( 'boxzilla_version', $current_version );
129
+ }
130
+
131
+ public function lazy_add_hooks() {
132
+ global $pagenow;
133
+
134
+ add_action( 'admin_enqueue_scripts', array( $this, 'load_assets' ) );
135
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
136
+ add_filter( 'tiny_mce_before_init', array( $this, 'tinymce_init' ) );
137
+ add_filter( 'manage_edit-boxzilla-box_columns', array( $this, 'post_type_column_titles' ) );
138
+ add_action( 'manage_boxzilla-box_posts_custom_column', array( $this, 'post_type_column_content' ), 10, 2 );
139
+ add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
140
+
141
+ if ( $pagenow === 'plugins.php' ) {
142
+ add_filter( 'plugin_action_links', array( $this, 'add_plugin_settings_link' ), 10, 2 );
143
+ add_filter( 'plugin_row_meta', array( $this, 'add_plugin_meta_links' ), 10, 2 );
144
+ }
145
+ }
146
+
147
+ /**
148
+ * @param $post_id
149
+ */
150
+ public function post_type_column_box_id_content( $post_id ) {
151
+ echo $post_id;
152
+ }
153
+
154
+ /**
155
+ * @param $column
156
+ * @param $post_id
157
+ */
158
+ public function post_type_column_content( $column, $post_id ) {
159
+ if ( method_exists( $this, 'post_type_column_' . $column . '_content' ) ) {
160
+ call_user_func( array( $this, 'post_type_column_' . $column . '_content' ), $post_id );
161
+ }
162
+ }
163
+
164
+ /**
165
+ * @param $columns
166
+ *
167
+ * @return mixed
168
+ */
169
+ public function post_type_column_titles( $columns ) {
170
+ $columns = self::array_insert( $columns, array(
171
+ 'box_id' => __( 'Box ID', 'boxzilla' )
172
+ ), 1 );
173
+
174
+ $columns['title'] = __( 'Box Title', 'boxzilla' );
175
+
176
+ return $columns;
177
+ }
178
+
179
+ /**
180
+ * Register stuffs
181
+ */
182
+ public function register() {
183
+
184
+ // register settings
185
+ register_setting( 'boxzilla_settings', 'boxzilla_settings', array( $this, 'sanitize_settings' ) );
186
+
187
+ // register scripts
188
+ $pre_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
189
+
190
+ wp_register_script( 'boxzilla-admin', $this->plugin->url( '/assets/js/admin-script' . $pre_suffix . '.js' ), array(
191
+ 'jquery',
192
+ 'wp-util',
193
+ 'wp-color-picker',
194
+ 'suggest'
195
+ ), $this->plugin->version(), true );
196
+
197
+ // load stylesheets
198
+ wp_register_style( 'boxzilla-admin', $this->plugin->url( '/assets/css/admin-styles' . $pre_suffix . '.css' ), array(), $this->plugin->version() );
199
+ }
200
+
201
+ /**
202
+ * Renders the STB Menu items
203
+ */
204
+ public function menu() {
205
+
206
+ $menu_items = array(
207
+ array(
208
+ __( 'Settings', 'boxzilla' ),
209
+ __( 'Settings', 'boxzilla' ),
210
+ 'boxzilla-settings',
211
+ array( $this, 'show_settings_page' )
212
+ ),
213
+ array(
214
+ __( 'Extensions', 'boxzilla' ),
215
+ '<span style="color: orange">' . __( 'Extensions', 'boxzilla' ) . '</span>',
216
+ 'boxzilla-extensions',
217
+ array( $this, 'show_extensions_page' )
218
+ )
219
+ );
220
+
221
+ $menu_items = apply_filters( 'boxzilla_admin_menu_items', $menu_items );
222
+
223
+ foreach ( $menu_items as $item ) {
224
+ add_submenu_page( 'edit.php?post_type=boxzilla-box', $item[0] . '- Boxzilla', $item[1], 'manage_options', $item[2], $item[3] );
225
+ }
226
+ }
227
+
228
+ /**
229
+ * Shows the settings page
230
+ */
231
+ public function show_settings_page() {
232
+ $opts = $this->boxzilla->options;
233
+ require __DIR__ . '/views/settings.php';
234
+ }
235
+
236
+ /**
237
+ * Shows the extensions page
238
+ */
239
+ public function show_extensions_page() {
240
+ $extensions = $this->fetch_extensions();
241
+ require __DIR__ . '/views/extensions.php';
242
+ }
243
+
244
+ /**
245
+ * Are we currently editing a box?
246
+ *
247
+ * @return bool
248
+ */
249
+ protected function on_edit_box_page() {
250
+ global $pagenow;
251
+
252
+ if ( ! in_array( $pagenow, array( 'post-new.php', 'post.php' ) ) ) {
253
+ return false;
254
+ }
255
+
256
+ if ( isset( $_GET['post_type'] ) && $_GET['post_type'] === 'boxzilla-box' ) {
257
+ return true;
258
+ }
259
+
260
+ if ( get_post_type() === 'boxzilla-box' ) {
261
+ return true;
262
+ }
263
+
264
+ return false;
265
+ }
266
+
267
+ /**
268
+ * @param $args
269
+ *
270
+ * @return mixed
271
+ */
272
+ public function tinymce_init( $args ) {
273
+
274
+ // only act on our post type
275
+ if ( get_post_type() !== 'boxzilla-box' ) {
276
+ return $args;
277
+ }
278
+
279
+ $args['setup'] = 'function( editor ) { if(typeof(window.Boxzilla_Admin) === \'undefined\') { return; } editor.on("PreInit", window.Boxzilla_Admin.Designer.init ); }';
280
+
281
+ return $args;
282
+ }
283
+
284
+ /**
285
+ * Load plugin assets
286
+ */
287
+ public function load_assets() {
288
+
289
+ $screen = get_current_screen();
290
+
291
+ if ( ! $screen instanceof WP_Screen ) {
292
+ return false;
293
+ }
294
+
295
+ if ( $screen->base === 'edit' && $screen->post_type === 'boxzilla-box' ) {
296
+ // load stylesheets
297
+ wp_enqueue_style( 'boxzilla-admin' );
298
+ }
299
+
300
+ if ( $screen->base === 'post' && $screen->post_type === 'boxzilla-box' ) {
301
+ // color picker
302
+ wp_enqueue_style( 'wp-color-picker' );
303
+
304
+ // load scripts
305
+ wp_enqueue_script( 'boxzilla-admin' );
306
+
307
+ wp_localize_script( 'boxzilla-admin' ,'boxzilla_i18n', array(
308
+ 'enterCommaSeparatedValues' => __( 'Enter a comma-separated list of values.', 'boxzilla' ),
309
+ 'enterCommaSeparatedPosts' => __( "Enter a comma-separated list of post slugs or post ID's..", 'boxzilla' ),
310
+ 'enterCommaSeparatedPages' => __( "Enter a comma-separated list of page slugs or page ID's..", 'boxzilla' ),
311
+ 'enterCommaSeparatedPostTypes' => __( "Enter a comma-separated list of post types..", 'boxzilla' ),
312
+ 'enterCommaSeparatedRelativeUrls' => __( "Enter a comma-separated list of relative URL's, eg /contact/", 'boxzilla' ),
313
+ )
314
+ );
315
+
316
+ // load stylesheets
317
+ wp_enqueue_style( 'boxzilla-admin' );
318
+
319
+ // allow add-ons to easily load their own scripts or stylesheets
320
+ do_action( 'boxzilla_load_admin_assets' );
321
+ }
322
+
323
+ if ( isset( $_GET['page'] ) && $_GET['page'] === 'boxzilla-settings' ) {
324
+ // load stylesheets
325
+ wp_enqueue_style( 'boxzilla-admin' );
326
+ }
327
+
328
+ }
329
+
330
+ /**
331
+ * Register meta boxes
332
+ *
333
+ * @param string $post_type
334
+ *
335
+ * @return bool
336
+ */
337
+ public function add_meta_boxes( $post_type ) {
338
+
339
+ if ( $post_type !== 'boxzilla-box' ) {
340
+ return false;
341
+ }
342
+
343
+ add_meta_box(
344
+ 'boxzilla-box-appearance-controls',
345
+ __( 'Box Appearance', 'boxzilla' ),
346
+ array( $this, 'metabox_box_appearance_controls' ),
347
+ 'boxzilla-box',
348
+ 'normal',
349
+ 'core'
350
+ );
351
+
352
+ add_meta_box(
353
+ 'boxzilla-box-options-controls',
354
+ __( 'Box Options', 'boxzilla' ),
355
+ array( $this, 'metabox_box_option_controls' ),
356
+ 'boxzilla-box',
357
+ 'normal',
358
+ 'core'
359
+ );
360
+
361
+ add_meta_box(
362
+ 'boxzilla-support',
363
+ __( 'Looking for help?', 'boxzilla' ),
364
+ array( $this, 'metabox_support' ),
365
+ 'boxzilla-box',
366
+ 'side'
367
+ );
368
+
369
+ add_meta_box(
370
+ 'boxzilla-email-optin',
371
+ __( 'Subscribe to our newsletter', 'boxzilla' ),
372
+ array( $this, 'metabox_email_optin' ),
373
+ 'boxzilla-box',
374
+ 'side'
375
+ );
376
+
377
+ return true;
378
+ }
379
+
380
+ /**
381
+ * @param \WP_Post $post
382
+ * @param $metabox
383
+ */
384
+ public function metabox_box_appearance_controls( \WP_Post $post, $metabox ) {
385
+
386
+ // get box options
387
+ $box = new Box( $post );
388
+ $opts = $box->get_options();
389
+
390
+ // include view
391
+ include __DIR__ . '/views/metaboxes/box-appearance-controls.php';
392
+ }
393
+
394
+ /**
395
+ * @param \WP_Post $post
396
+ * @param $metabox
397
+ */
398
+ public function metabox_box_option_controls( \WP_Post $post, $metabox ) {
399
+
400
+ // get box options
401
+ $box = new Box( $post );
402
+ $opts = $box->get_options();
403
+ $global_opts = $this->boxzilla->options;
404
+
405
+ if ( empty( $opts['rules'] ) ) {
406
+ $opts['rules'][] = array( 'condition' => '', 'qualifier' => 1, 'value' => '' );
407
+ }
408
+
409
+ // include view
410
+ include __DIR__ . '/views/metaboxes/box-option-controls.php';
411
+ }
412
+
413
+ /**
414
+ * @param \WP_Post $post
415
+ * @param $metabox
416
+ */
417
+ public function metabox_email_optin( \WP_Post $post, $metabox ) {
418
+ include __DIR__ . '/views/metaboxes/email-optin.php';
419
+ }
420
+
421
+ /**
422
+ * @param \WP_Post $post
423
+ * @param $metabox
424
+ */
425
+ public function metabox_support( \WP_Post $post, $metabox ) {
426
+ include __DIR__ . '/views/metaboxes/need-help.php';
427
+ }
428
+
429
+
430
+ /**
431
+ * Saves box options and rules
432
+ *
433
+ * @param int $box_id
434
+ *
435
+ * @return bool
436
+ */
437
+ public function save_box_options( $box_id, $post ) {
438
+
439
+ // Only act on our own post type
440
+ if ( $post->post_type !== 'boxzilla-box' ) {
441
+ return false;
442
+ }
443
+
444
+ // is this a revision save?
445
+ if ( wp_is_post_revision( $box_id ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
446
+ return false;
447
+ }
448
+
449
+ // can user edit this post?
450
+ if ( ! current_user_can( 'edit_post', $box_id ) ) {
451
+ return false;
452
+ }
453
+
454
+ // make sure options array is set
455
+ if ( ! isset( $_POST['boxzilla_box'] ) || ! is_array( $_POST['boxzilla_box'] ) ) {
456
+ return false;
457
+ }
458
+
459
+ // get new options from $_POST
460
+ $opts = $this->sanitize_box_options( $_POST['boxzilla_box'] );
461
+
462
+ // allow extensions to filter the saved options
463
+ $opts = apply_filters( 'boxzilla_saved_options', $opts, $box_id );
464
+
465
+ // save individual box settings
466
+ update_post_meta( $box_id, 'boxzilla_options', $opts );
467
+
468
+ // update global settings if given
469
+ if( ! empty( $_POST['boxzilla_global_settings'] ) ) {
470
+ $global_settings = get_option( 'boxzilla_settings', array() );
471
+ if( ! is_array( $global_settings ) ) { $global_settings = array(); }
472
+ $global_settings = array_merge( $global_settings, $_POST['boxzilla_global_settings'] );
473
+ update_option( 'boxzilla_settings', $global_settings );
474
+ }
475
+
476
+ $this->flush_rules( $box_id );
477
+
478
+ return true;
479
+ }
480
+
481
+ /**
482
+ * @param array $opts
483
+ *
484
+ * @return array
485
+ */
486
+ public function sanitize_settings( $opts ) {
487
+ return $opts;
488
+ }
489
+
490
+ /**
491
+ * @param string $url_string
492
+ *
493
+ * @return string
494
+ */
495
+ public function sanitize_url( $url_string ) {
496
+
497
+ // if empty, just return a slash
498
+ if( empty( $url_string ) ) {
499
+ return '/';
500
+ }
501
+
502
+ // if string looks like an absolute URL, extract just the path
503
+ if( preg_match( '/^((https|http)?\:\/\/)?(\w+\.)?\w+\.\w+\.*/i', $url_string ) ) {
504
+
505
+ // make sure URL has scheme prepended, to make parse_url() understand..
506
+ $url_string = 'https://' . str_replace( array( 'http://', 'https://' ), '', $url_string );
507
+
508
+ // get just the path
509
+ $url_string = parse_url( $url_string, PHP_URL_PATH );
510
+ }
511
+
512
+ // leading slash it
513
+ return '/' . ltrim( $url_string, '/' );
514
+ }
515
+
516
+ /**
517
+ * @param array $rule
518
+ * @return array The sanitized rule array
519
+ */
520
+ public function sanitize_box_rule( $rule) {
521
+
522
+ $rule['value'] = trim( $rule['value'] );
523
+
524
+ // convert to array
525
+ $rule['value'] = explode( ',', trim( $rule['value'], ',' ) );
526
+
527
+ // trim all whitespace in value field
528
+ $rule['value'] = array_map( 'trim', $rule['value'] );
529
+
530
+ // Make sure "is_url" values have a leading slash
531
+ if ( $rule['condition'] === 'is_url' ) {
532
+ $rule['value'] = array_map( array( $this, 'sanitize_url' ), $rule['value'] );
533
+ }
534
+
535
+ // (re)set value to 0 when condition is everywhere
536
+ if ( $rule['condition'] === 'everywhere' ) {
537
+ $rule['value'] = '';
538
+ }
539
+
540
+ // convert back to string before saving
541
+ if ( is_array( $rule['value'] ) ) {
542
+ $rule['value'] = join( ',', $rule['value'] );
543
+ }
544
+
545
+ $rule['qualifier'] = isset( $rule['qualifier'] ) && ! $rule['qualifier'] ? 0 : 1;
546
+
547
+ return $rule;
548
+ }
549
+
550
+ /**
551
+ * @param array $css
552
+ * @return array
553
+ */
554
+ public function sanitize_box_css( $css ) {
555
+
556
+ // sanitize settings
557
+ if ( '' !== $css['width'] ) {
558
+ $css['width'] = absint( $css['width'] );
559
+ }
560
+
561
+ if ( '' !== $css['border_width'] ) {
562
+ $css['border_width'] = absint( $css['border_width'] );
563
+ }
564
+
565
+ // make sure colors start with `#`
566
+ $color_keys = array( 'color', 'background_color', 'border_color' );
567
+ foreach ( $color_keys as $key ) {
568
+ $value = $css[ $key ];
569
+ $color = sanitize_text_field( $value );
570
+
571
+ // make sure color starts with `#`
572
+ if ( '' !== $color && $color[0] !== '#' ) {
573
+ $color = '#' . $color;
574
+ }
575
+ $css[ $key ] = $color;
576
+ }
577
+
578
+ return $css;
579
+ }
580
+
581
+ /**
582
+ * Sanitize the options for this box.
583
+ *
584
+ * @param array $opts
585
+ *
586
+ * @return array
587
+ */
588
+ protected function sanitize_box_options( $opts ) {
589
+
590
+ static $defaults = array(
591
+ 'rules' => array(),
592
+ 'css' => array()
593
+ );
594
+
595
+ $opts = array_replace_recursive( $defaults, $opts );
596
+
597
+ $opts['rules'] = array_map( array( $this, 'sanitize_box_rule' ), $opts['rules'] );
598
+ $opts['css'] = $this->sanitize_box_css( $opts['css'] );
599
+ $opts['cookie']['triggered'] = absint( $opts['cookie']['triggered'] );
600
+ $opts['cookie']['dismissed'] = absint( $opts['cookie']['dismissed'] );
601
+ $opts['trigger'] = sanitize_text_field( $opts['trigger'] );
602
+ $opts['trigger_percentage'] = absint( $opts['trigger_percentage'] );
603
+ $opts['trigger_element'] = sanitize_text_field( $opts['trigger_element'] );
604
+
605
+ return $opts;
606
+ }
607
+
608
+ /**
609
+ * Add the settings link to the Plugins overview
610
+ *
611
+ * @param array $links
612
+ * @param string $slug
613
+ *
614
+ * @return array
615
+ */
616
+ public function add_plugin_settings_link( $links, $slug ) {
617
+ if ( $slug !== $this->plugin->slug() ) {
618
+ return $links;
619
+ }
620
+
621
+ $settings_link = '<a href="' . admin_url( 'edit.php?post_type=boxzilla-box' ) . '">' . __( 'Boxes' ) . '</a>';
622
+ array_unshift( $links, $settings_link );
623
+
624
+ return $links;
625
+ }
626
+
627
+ /**
628
+ * Adds meta links to the plugin in the WP Admin > Plugins screen
629
+ *
630
+ * @param array $links
631
+ * @param string $slug
632
+ *
633
+ * @return array
634
+ */
635
+ public function add_plugin_meta_links( $links, $slug ) {
636
+ if ( $slug !== $this->plugin->slug() ) {
637
+ return $links;
638
+ }
639
+
640
+ $links[] = '<a href="https://kb.boxzillaplugin.com/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page">Documentation</a>';
641
+ $links[] = '<a href="https://boxzillaplugin.com/add-ons/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page">Add-ons</a>';
642
+
643
+ return $links;
644
+ }
645
+
646
+ /**
647
+ * Flush all box rules
648
+ *
649
+ * Loops through all published boxes and fills the rules option
650
+ *
651
+ * @param int $post_id
652
+ */
653
+ public function flush_rules( $post_id ) {
654
+
655
+ // only act on our own post type
656
+ $post = get_post( $post_id );
657
+ if ( $post instanceof WP_Post && $post->post_type !== 'boxzilla-box' ) {
658
+ return;
659
+ }
660
+
661
+ // get all published boxes
662
+ $boxes = get_posts(
663
+ array(
664
+ 'post_type' => 'boxzilla-box',
665
+ 'post_status' => 'publish',
666
+ 'numberposts' => - 1
667
+ )
668
+ );
669
+
670
+ // setup empty array of rules
671
+ $rules = array();
672
+
673
+ // fill rules array
674
+ if ( is_array( $boxes ) ) {
675
+
676
+ foreach ( $boxes as $box ) {
677
+ // get box meta data
678
+ $box_meta = get_post_meta( $box->ID, 'boxzilla_options', true );
679
+
680
+ // add box rules to all rules
681
+ $rules[ $box->ID ] = $box_meta['rules'];
682
+ $rules[ $box->ID ]['comparision'] = isset( $box_meta['rules_comparision'] ) ? $box_meta['rules_comparision'] : 'any';
683
+
684
+ }
685
+
686
+ }
687
+
688
+ update_option( 'boxzilla_rules', $rules );
689
+ }
690
+
691
+ /**
692
+ * Fetches a list of available add-on plugins
693
+ *
694
+ * @return array
695
+ */
696
+ protected function fetch_extensions() {
697
+
698
+ $extensions = get_transient( 'boxzilla_remote_extensions' );
699
+ if ( $extensions ) {
700
+ return $extensions;
701
+ }
702
+
703
+ $request = wp_remote_get( 'https://api.boxzillaplugin.com/v1/plugins' );
704
+
705
+ if ( is_wp_error( $request ) ) {
706
+ return array();
707
+ }
708
+
709
+ $response = wp_remote_retrieve_body( $request );
710
+ $response = json_decode( $response );
711
+
712
+ if ( is_array( $response->data ) ) {
713
+ set_transient( 'boxzilla_remote_extensions', $response->data, HOUR_IN_SECONDS );
714
+
715
+ return $response->data;
716
+ }
717
+
718
+ return array();
719
+ }
720
+
721
+ /**
722
+ * @param $arr
723
+ * @param $insert
724
+ * @param $position
725
+ *
726
+ * @return array
727
+ */
728
+ public static function array_insert( $arr, $insert, $position ) {
729
+ $i = 0;
730
+ $ret = array();
731
+ foreach ( $arr as $key => $value ) {
732
+ if ( $i == $position ) {
733
+ foreach ( $insert as $ikey => $ivalue ) {
734
+ $ret[ $ikey ] = $ivalue;
735
+ }
736
+ }
737
+ $ret[ $key ] = $value;
738
+ $i ++;
739
+ }
740
+
741
+ return $ret;
742
+ }
743
+
744
+ /**
745
+ * @param string $text
746
+ *
747
+ * @return string
748
+ */
749
+ public function admin_footer_text( $text ) {
750
+ $screen = get_current_screen();
751
+
752
+ if ( ! $screen instanceof WP_Screen ) {
753
+ return $text;
754
+ }
755
+
756
+ $on_edit_page = $screen->parent_base === 'edit' && $screen->post_type === 'boxzilla-box';
757
+ if ( $on_edit_page ) {
758
+ return sprintf( 'If you enjoy using <strong>Boxzilla</strong>, please <a href="%s" target="_blank">leave us a ★★★★★ rating</a>. A <strong style="text-decoration: underline;">huge</strong> thank you in advance!', 'https://wordpress.org/support/view/plugin-reviews/boxzilla?rate=5#postform' );
759
+ }
760
+
761
+ return $text;
762
+ }
763
+
764
+ }
trunk/src/admin/class-autocomplete.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Filter;
4
+
5
+ class Autocomplete {
6
+
7
+ public function add_hooks() {
8
+ add_action( 'wp_ajax_boxzilla_autocomplete', array( $this, 'ajax' ) );
9
+ }
10
+
11
+ /**
12
+ * AJAX listener for autocomplete
13
+ */
14
+ public function ajax() {
15
+ $q = ( isset( $_GET['q'] ) ) ? sanitize_text_field( $_GET['q'] ) : '';
16
+ $type = ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'page', 'post', 'category', 'post_type', 'post_tag' ) ) ) ? $_GET['type'] : 'post';
17
+
18
+ // do nothing if supplied 'q' parameter is omitted or empty
19
+ // or less than 2 characters long
20
+ if( empty( $q ) || strlen( $q ) < 2 ) {
21
+ die();
22
+ }
23
+
24
+ switch( $type ) {
25
+
26
+ default:
27
+ case 'post':
28
+ case 'page':
29
+ echo $this->list_posts( $q, $type );
30
+ break;
31
+
32
+ case 'category':
33
+ echo $this->list_categories( $q );
34
+ break;
35
+
36
+ case 'post_type':
37
+ echo $this->list_post_types( $q );
38
+ break;
39
+
40
+ case 'post_tag':
41
+ echo $this->list_tags( $q );
42
+ break;
43
+ }
44
+
45
+ die();
46
+ }
47
+
48
+ /**
49
+ * @param string $query
50
+ * @param string $post_type
51
+ *
52
+ * @return string
53
+ */
54
+ protected function list_posts( $query, $post_type = 'post' ) {
55
+ global $wpdb;
56
+ $sql = $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p WHERE p.post_type = '%s' AND p.post_status = 'publish' AND ( p.post_title LIKE '%s' OR p.post_name LIKE '%s' ) GROUP BY p.post_name", $post_type, $query . '%%', $query . '%%' );
57
+ $post_slugs = $wpdb->get_col( $sql );
58
+ return join( $post_slugs, PHP_EOL );
59
+ }
60
+
61
+ /**
62
+ * @param string $query
63
+ *
64
+ * @return string
65
+ */
66
+ protected function list_categories( $query ) {
67
+ $terms = get_terms( 'category', array( 'name__like' => $query, 'fields' => 'names', 'hide_empty' => false ) );
68
+ return join( $terms, PHP_EOL );
69
+ }
70
+
71
+ /**
72
+ * @param string $query
73
+ *
74
+ * @return string
75
+ */
76
+ protected function list_tags( $query ) {
77
+ $terms = get_terms( 'post_tag', array( 'name__like' => $query, 'fields' => 'names', 'hide_empty' => false ) );
78
+ return join( $terms, PHP_EOL );
79
+ }
80
+
81
+
82
+ /**
83
+ * @param string $query
84
+ *
85
+ * @return string
86
+ */
87
+ protected function list_post_types( $query ) {
88
+ $post_types = get_post_types( array( 'public' => true ), 'names' );
89
+ $matched_post_types = array_filter( $post_types, function( $name ) use( $query ) {
90
+ return strpos( $name, $query ) === 0;
91
+ });
92
+
93
+ return join( $matched_post_types, PHP_EOL );
94
+ }
95
+ }
trunk/src/admin/class-installer.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace Boxzilla\Admin;
5
+
6
+ class Installer {
7
+
8
+ /**
9
+ * Run the installer
10
+ */
11
+ public static function run() {
12
+ $installer = new self;
13
+ $installer->install();
14
+ }
15
+
16
+ /**
17
+ * The main install method
18
+ */
19
+ public function install() {
20
+
21
+ // don't install sample boxes on multisite
22
+ if( is_multisite() ) {
23
+ return;
24
+ }
25
+
26
+ $this->transfer_from_stb();
27
+ $this->create_sample_box();
28
+ }
29
+
30
+ /**
31
+ *
32
+ */
33
+ public function transfer_from_stb() {
34
+ global $wpdb;
35
+
36
+ // transfer post types
37
+ $query = $wpdb->prepare( "UPDATE {$wpdb->posts} SET post_type = %s WHERE post_type = %s", 'boxzilla-box', 'scroll-triggered-box' );
38
+ $wpdb->query( $query );
39
+
40
+ // transfer post meta
41
+ $query = $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_key = %s WHERE meta_key = %s", 'boxzilla_options', 'stb_options' );
42
+ $wpdb->query( $query );
43
+
44
+ // transfer rules
45
+ $query = $wpdb->prepare( "UPDATE {$wpdb->options} SET option_name = %s WHERE option_name = %s", 'boxzilla_rules', 'stb_rules' );
46
+ $wpdb->query( $query );
47
+ }
48
+
49
+ /**
50
+ * @return bool
51
+ */
52
+ protected function create_sample_box() {
53
+
54
+ // only create sample box if no boxes were found
55
+ $boxes = get_posts(
56
+ array(
57
+ 'post_type' => 'boxzilla-box',
58
+ 'post_status' => array( 'publish', 'draft' )
59
+ )
60
+ );
61
+
62
+ if( ! empty( $boxes ) ) {
63
+ return false;
64
+ }
65
+
66
+ $box_id = wp_insert_post(
67
+ array(
68
+ 'post_type' => 'boxzilla-box',
69
+ 'post_title' => "Sample Box",
70
+ 'post_content' => "<h4>Hello world.</h4><p>This is a sample box, with some sample content in it.</p>",
71
+ 'post_status' => 'draft',
72
+ )
73
+ );
74
+
75
+ // set box settings
76
+ $settings = array(
77
+ 'css' => array(
78
+ 'background_color' => '#edf9ff',
79
+ 'color' => '',
80
+ 'width' => '340',
81
+ 'border_color' => '#dd7575',
82
+ 'border_width' => '4',
83
+ 'border_style' => 'dashed',
84
+ 'position' => 'bottom-right',
85
+ 'manual' => ''
86
+ )
87
+ );
88
+
89
+ update_post_meta( $box_id, 'boxzilla_options', $settings );
90
+
91
+ return true;
92
+ }
93
+ }
trunk/src/admin/class-migrations.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Admin;
4
+
5
+ use Exception;
6
+
7
+ /**
8
+ *
9
+ */
10
+ class Migrations {
11
+
12
+ /**
13
+ * @var float
14
+ */
15
+ protected $version_from = 0;
16
+
17
+ /**
18
+ * @var float
19
+ */
20
+ protected $version_to = 0;
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ protected $migrations_dir = '';
26
+
27
+ /**
28
+ * @param float $from
29
+ * @param float $to
30
+ * @param string $migrations_dir
31
+ */
32
+ public function __construct( $from, $to, $migrations_dir ) {
33
+ $this->version_from = $from;
34
+ $this->version_to = $to;
35
+ $this->migrations_dir = $migrations_dir;
36
+ }
37
+
38
+ /**
39
+ * Run the various upgrade routines, all the way up to the latest version
40
+ */
41
+ public function run() {
42
+ $migrations = $this->find_migrations();
43
+ // run in sub-function for scope
44
+ array_map( array( $this, 'run_migration' ), $migrations );
45
+ }
46
+
47
+ /**
48
+ * @return array
49
+ */
50
+ public function find_migrations() {
51
+ $files = glob( rtrim( $this->migrations_dir, '/' ) . '/*.php' );
52
+ $migrations = array();
53
+
54
+ // return empty array when glob returns non-array value.
55
+ if( ! is_array( $files ) ) {
56
+ return $migrations;
57
+ }
58
+
59
+ foreach( $files as $file ) {
60
+ $migration = basename( $file );
61
+ $parts = explode( '-', $migration );
62
+ $version = $parts[0];
63
+
64
+ // check if migration file is not for an even higher version
65
+ if( version_compare( $version, $this->version_to, '>' ) ) {
66
+ continue;
67
+ }
68
+
69
+ // check if we ran migration file before.
70
+ if( version_compare( $this->version_from, $version, '>=' ) ) {
71
+ continue;
72
+ }
73
+
74
+ // schedule migration file for running
75
+ $migrations[] = $file;
76
+ }
77
+
78
+ return $migrations;
79
+ }
80
+
81
+ /**
82
+ * Include a migration file and runs it.
83
+ *
84
+ * @param string $file
85
+ *
86
+ * @throws Exception
87
+ */
88
+ protected function run_migration( $file ) {
89
+
90
+ if( ! file_exists( $file ) ) {
91
+ throw new Exception( "Migration file $file does not exist.");
92
+ }
93
+
94
+ include $file;
95
+ }
96
+ }
trunk/src/admin/class-notices.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Admin;
4
+
5
+ class Notices {
6
+
7
+ /**
8
+ * @var array
9
+ */
10
+ protected $notices = array();
11
+
12
+ /**
13
+ * Constructor
14
+ */
15
+ public function __construct() {
16
+ add_action( 'admin_notices', array( $this, 'show' ) );
17
+ }
18
+
19
+ /**
20
+ * @param $message
21
+ * @param $type
22
+ *
23
+ * @return $this
24
+ */
25
+ public function add( $message, $type = 'updated' ) {
26
+ $this->notices[] = array(
27
+ 'message' => $message,
28
+ 'type' => $type,
29
+ );
30
+
31
+ return $this;
32
+ }
33
+
34
+ /**
35
+ * Output the registered notices
36
+ */
37
+ public function show() {
38
+ foreach( $this->notices as $notice ) {
39
+ echo sprintf( '<div class="notice notice-%s"><p>%s</p></div>', $notice['type'], $notice['message'] );
40
+ }
41
+ }
42
+ }
trunk/src/admin/class-review-notice.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Admin;
4
+ use WP_Screen;
5
+
6
+ /**
7
+ * Class ReviewNotice
8
+ *
9
+ * @ignore
10
+ */
11
+ class ReviewNotice {
12
+
13
+ /**
14
+ * @var string
15
+ */
16
+ protected $meta_key_dismissed = '_boxzilla_review_notice_dismissed';
17
+
18
+ /**
19
+ * Constructor.
20
+ */
21
+ public function __construct() {
22
+
23
+ }
24
+
25
+ /**
26
+ * Add action & filter hooks.
27
+ */
28
+ public function add_hooks() {
29
+ add_action( 'admin_notices', array( $this, 'show' ) );
30
+ add_action( 'boxzilla_admin_dismiss_review_notice', array( $this, 'dismiss' ) );
31
+ }
32
+
33
+ /**
34
+ * Set flag in user meta so notice won't be shown.
35
+ */
36
+ public function dismiss() {
37
+ $user = wp_get_current_user();
38
+ update_user_meta( $user->ID, $this->meta_key_dismissed, 1 );
39
+ }
40
+
41
+ /**
42
+ * @return bool
43
+ */
44
+ public function show() {
45
+ $screen = get_current_screen();
46
+ if( ! $screen instanceof WP_Screen ) {
47
+ return false;
48
+ }
49
+
50
+ // on some boxzilla screen?
51
+ if( $screen->post_type !== 'boxzilla-box' ) {
52
+ return false;
53
+ }
54
+
55
+ // authorized?
56
+ if( ! current_user_can( 'edit_posts' ) ) {
57
+ return false;
58
+ }
59
+
60
+ // only show if 2 weeks have passed since first use.
61
+ $two_weeks_in_seconds = ( 60 * 60 * 24 * 14 );
62
+ if( $this->time_since_first_use() <= $two_weeks_in_seconds ) {
63
+ return false;
64
+ }
65
+
66
+ // only show if user did not dismiss before
67
+ $user = wp_get_current_user();
68
+ if( get_user_meta( $user->ID, $this->meta_key_dismissed, true ) ) {
69
+ return false;
70
+ }
71
+
72
+ echo '<div class="notice notice-info boxzilla-is-dismissible">';
73
+ echo '<p>';
74
+ echo __( 'You\'ve been using Boxzilla for some time now; we hope you love it!', 'boxzilla' ) . ' <br />';
75
+ echo sprintf( __( 'If you do, please <a href="%s">leave us a 5★ rating on WordPress.org</a>. It would be of great help to us.', 'boxzilla' ), 'https://wordpress.org/support/view/plugin-reviews/boxzilla?rate=5#new-post' );
76
+ echo '</p>';
77
+ echo '<form method="POST"><button type="submit" class="notice-dismiss"><span class="screen-reader-text">'. __( 'Dismiss this notice.', 'boxzilla' ) .'</span></button><input type="hidden" name="_boxzilla_admin_action" value="dismiss_review_notice"/></form>';
78
+ echo '</div>';
79
+ return true;
80
+ }
81
+
82
+ /**
83
+ * @return int
84
+ */
85
+ private function time_since_first_use() {
86
+ $options = get_option( 'boxzilla_settings' );
87
+
88
+ // option was never added before, do it now.
89
+ if( empty( $options['first_activated_on'] ) ) {
90
+ $options['first_activated_on'] = time();
91
+ update_option( 'boxzilla_settings', $options );
92
+ }
93
+
94
+ return time() - $options['first_activated_on'];
95
+ }
96
+ }
trunk/src/admin/migrations/3.1-cookie-option.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or exit;
4
+
5
+ $posts = get_posts( array( 'post_type' => 'boxzilla-box' ) );
6
+
7
+ if( ! empty( $posts ) ) {
8
+ foreach( $posts as $post ) {
9
+ $settings = get_post_meta( $post->ID, 'boxzilla_options', true );
10
+
11
+ if( ! is_array( $settings ) ) {
12
+ continue;
13
+ }
14
+
15
+ // translate from days to hours
16
+ $new_value = intval( $settings['cookie'] ) * 24;
17
+
18
+ // store in new location
19
+ $settings['cookie'] = array(
20
+ 'dismissed' => $new_value
21
+ );
22
+ update_post_meta( $post->ID, 'boxzilla_options', $settings );
23
+ }
24
+ }
trunk/src/admin/views/extensions.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php defined( 'ABSPATH' ) or exit; ?>
2
+ <div class="wrap" id="boxzilla-admin" class="boxzilla-extensions">
3
+
4
+ <h2><?php _e( 'Available Add-On Plugins', 'boxzilla' ); ?></h2>
5
+ <p>
6
+ <?php _e( "There are various add-ons available for Boxzilla which further enhance the functionality of the core plugin.", 'boxzilla' ); ?>
7
+ </p>
8
+ <p>
9
+ <?php printf( __( 'To gain instant access the premium add-on plugins listed here, <a href="%s">have a look at our pricing</a>.', 'boxzilla' ), 'https://boxzillaplugin.com/pricing#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=extensions-page' ); ?>
10
+ </p>
11
+
12
+ <?php if( empty( $extensions ) ) : ?>
13
+ <script>
14
+ window.setTimeout( function() {
15
+ window.location.href = 'https://boxzillaplugin.com/add-ons/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=extensions-page';
16
+ }, 2000 );
17
+ </script>
18
+ <p><?php _e( 'You will be redirected to the Boxzilla site in a few seconds..', 'boxzilla' ); ?></p>
19
+ <p><?php printf( __( 'If not, please click here: %s.', 'boxzilla' ), '<a href="https://boxzillaplugin.com/add-ons/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=extensions-page" target="_blank">View add-on plugins</a>' ); ?></p>
20
+ <?php else : ?>
21
+
22
+ <?php foreach( $extensions as $plugin ) : ?>
23
+
24
+ <div class="plugin">
25
+ <a href="<?php echo esc_url( $plugin->page_url ); ?>" class="unstyled"><img src="<?php echo esc_url( $plugin->image_url ); ?>" alt="<?php echo $plugin->name; ?>" width="280" height="220"></a>
26
+ <div class="caption">
27
+ <h3><a href="<?php echo esc_url( $plugin->page_url ); ?>" class="unstyled"><?php echo $plugin->name; ?></a></h3>
28
+ <p><?php echo esc_html( $plugin->short_description ); ?></p>
29
+ <p>
30
+ <a class="button" href="<?php echo esc_url( $plugin->page_url ); ?>" title="More about <?php echo esc_attr( $plugin->name ); ?>">Read More</a>
31
+ <span class="type"><?php echo esc_html( $plugin->type ); ?></span>
32
+ </p>
33
+ </div>
34
+ </div>
35
+
36
+ <?php endforeach; ?>
37
+
38
+ <br style="clear: both;" />
39
+
40
+ <?php endif; ?>
41
+ </div>
42
+
43
+ <style type="text/css">
44
+ .plugin {
45
+ width: 280px;
46
+ border: 1px solid #ccc;
47
+ margin: 0 20px 20px 0;
48
+ float: left;
49
+ }
50
+
51
+ .plugin .caption {
52
+ padding: 0 20px;
53
+ }
54
+
55
+ .plugin .type {
56
+ float: right;
57
+ text-transform: uppercase;
58
+ font-weight: bold;
59
+ }
60
+ </style>
trunk/src/admin/views/metaboxes/box-appearance-controls.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php defined( 'ABSPATH' ) or exit; ?>
2
+ <div id="notice-notinymce" class="error" style="display: none;"><p><?php _e( 'For the best experience when styling your box, please use the default WordPress visual editor.', 'boxzilla' ); ?></p></div>
3
+
4
+ <table class="form-table">
5
+ <?php do_action( 'boxzilla_before_box_appearance_controls', $box, $opts ); ?>
6
+ <tr valign="top">
7
+ <td>
8
+ <label class="boxzilla-label" for="boxzilla-background-color"><?php _e( 'Background color', 'boxzilla' ); ?></label>
9
+ <input id="boxzilla-background-color" name="boxzilla_box[css][background_color]" type="text" class="boxzilla-color-field" value="<?php echo esc_attr($opts['css']['background_color']); ?>" />
10
+ </td>
11
+ <td>
12
+ <label class="boxzilla-label" for="boxzilla-color"><?php _e( 'Text color', 'boxzilla' ); ?></label>
13
+ <input id="boxzilla-color" name="boxzilla_box[css][color]" type="text" class="boxzilla-color-field" value="<?php echo esc_attr($opts['css']['color']); ?>" />
14
+ </td>
15
+ <td>
16
+ <label class="boxzilla-label" for="boxzilla-width"><?php _e( 'Box width', 'boxzilla' ); ?></label>
17
+ <input id="boxzilla-width" name="boxzilla_box[css][width]" id="boxzilla-box-width" min="0" max="3200" type="number" step="1" value="<?php echo esc_attr($opts['css']['width']); ?>" />
18
+ <p class="help"><?php _e( 'Width in px', 'boxzilla' ); ?></p>
19
+ </td>
20
+ </tr>
21
+ <tr valign="top">
22
+ <td>
23
+ <label class="boxzilla-label" for="boxzilla-border-color"><?php _e( 'Border color', 'boxzilla' ); ?></label>
24
+ <input name="boxzilla_box[css][border_color]" id="boxzilla-border-color" type="text" class="boxzilla-color-field" value="<?php echo esc_attr($opts['css']['border_color']); ?>" />
25
+ </td>
26
+ <td>
27
+ <label class="boxzilla-label" for="boxzilla-border-width"><?php _e( 'Border width', 'boxzilla' ); ?></label>
28
+ <input name="boxzilla_box[css][border_width]" id="boxzilla-border-width" type="number" min="0" max="25" step="1" value="<?php echo esc_attr($opts['css']['border_width']); ?>" />
29
+ <p class="help"><?php _e( 'Width in px', 'boxzilla' ); ?></p>
30
+ </td>
31
+ <td>
32
+ <label class="boxzilla-label" for="boxzilla-border-style"><?php _e( 'Border style', 'boxzilla' ); ?></label>
33
+ <select name="boxzilla_box[css][border_style]" id="boxzilla-border-style">
34
+ <option value="" <?php selected( $opts['css']['border_style'], '' ); ?>><?php _e( 'Default', 'boxzilla-theme-pack' ); ?></option>
35
+ <option value="solid" <?php selected( $opts['css']['border_style'], 'solid' ); ?>><?php _e( 'Solid', 'boxzilla-theme-pack' ); ?></option>
36
+ <option value="dashed" <?php selected( $opts['css']['border_style'], 'dashed' ); ?>><?php _e( 'Dashed', 'boxzilla-theme-pack' ); ?></option>
37
+ <option value="dotted" <?php selected( $opts['css']['border_style'], 'dotted' ); ?>><?php _e( 'Dotted', 'boxzilla-theme-pack' ); ?></option>
38
+ <option value="double" <?php selected( $opts['css']['border_style'], 'double' ); ?>><?php _e( 'Double', 'boxzilla-theme-pack' ); ?></option>
39
+ </select>
40
+ <p class="help"><?php _e( 'Border style', 'boxzilla' ); ?></p>
41
+ </td>
42
+ </tr>
43
+ <?php do_action( 'boxzilla_after_box_appearance_controls', $box, $opts ); ?>
44
+ </table>
45
+
46
+ <p><?php printf( __( '<a href="%s">Click here to reset all styling settings</a>.', 'boxzilla' ), 'javascript:Boxzilla_Admin.Designer.resetStyles();' ); ?></p>
trunk/src/admin/views/metaboxes/box-option-controls.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or exit;
4
+
5
+ /** @var \Boxzilla\Box $box */
6
+ /** @var array $opts */
7
+ /** @var array $global_opts */
8
+
9
+ /** @var array $rule_options */
10
+ $rule_options = array(
11
+ '' => __( "Select a condition", 'boxzilla' ),
12
+ 'everywhere' => __( 'everywhere', 'boxzilla' ),
13
+ 'is_page' => __( 'if page', 'boxzilla' ),
14
+ 'is_single' => __( 'if post', 'boxzilla' ),
15
+ 'is_post_with_tag' => __( 'if post tag', 'boxzilla' ),
16
+ 'is_post_in_category' => __( 'if post category', 'boxzilla' ),
17
+ 'is_post_type' => __( 'if post type', 'boxzilla' ),
18
+ 'is_url' => __( 'if URL', 'boxzilla' ),
19
+ 'is_referer' => __( 'if referer', 'boxzilla' ),
20
+ );
21
+
22
+ /**
23
+ * @ignore
24
+ */
25
+ $rule_options = apply_filters( 'boxzilla_rules_options', $rule_options );
26
+
27
+ ?>
28
+ <table class="form-table">
29
+ <?php
30
+
31
+ /**
32
+ * @ignore
33
+ */
34
+ do_action( 'boxzilla_before_box_option_controls', $box, $opts );
35
+
36
+ ?>
37
+ <tr>
38
+ <th><?php _e( 'Load this box if', 'boxzilla' ); ?></th>
39
+ <td>
40
+ <label>
41
+ <?php _e( 'Request matches', 'boxzilla' ); ?>
42
+ <select name="boxzilla_box[rules_comparision]">
43
+ <option value="any" <?php selected( $opts['rules_comparision'], 'any' ); ?>><?php _e( 'any', 'boxzilla' ); ?></option>
44
+ <option value="all" <?php selected( $opts['rules_comparision'], 'all' ); ?>><?php _e( 'all', 'boxzilla' ); ?></option>
45
+ </select>
46
+ <?php _e( 'of the following conditions.', 'boxzilla' ); ?>
47
+ </label>
48
+ </td>
49
+ </tr>
50
+ <tbody id="boxzilla-box-rules">
51
+ <?php
52
+ $key = 0;
53
+ foreach( $opts['rules'] as $rule ) { if( ! array_key_exists( 'condition', $rule ) ) { continue; } ?>
54
+ <tr valign="top" class="boxzilla-rule-row boxzilla-rule-row-<?php echo $key; ?>">
55
+ <th style="text-align: right; font-weight: normal;">
56
+ <span class="boxzilla-close boxzilla-remove-rule"><span class="dashicons dashicons-dismiss"></span></span>
57
+ </th>
58
+ <td>
59
+ <select class="boxzilla-rule-condition" name="boxzilla_box[rules][<?php echo $key; ?>][condition]">
60
+ <?php foreach( $rule_options as $value => $label ) {
61
+ $readonly = $value == '' ? 'readonly': '';
62
+ printf( '<option value="%s" %s %s>%s</option>', $value, $readonly, selected( $rule['condition'], $value ), $label );
63
+ } ?>
64
+ </select>
65
+
66
+ <select class="boxzilla-rule-qualifier" name="boxzilla_box[rules][<?php echo $key; ?>][qualifier]">
67
+ <option value="1" <?php selected( ! isset( $rule['qualifier'] ) || $rule['qualifier'] ); ?>><?php _e( 'is', 'boxzilla' ); ?></option>
68
+ <option value="0" <?php selected( isset( $rule['qualifier'] ) && !$rule['qualifier'] ); ?>><?php _e( 'is not', 'boxzilla' ); ?></option>
69
+ </select>
70
+
71
+ <input class="boxzilla-rule-value regular-text" name="boxzilla_box[rules][<?php echo $key; ?>][value]" type="text" value="<?php echo esc_attr( $rule['value'] ); ?>" placeholder="<?php _e( 'Leave empty for any or enter (comma-separated) names or ID\'s', 'boxzilla' ); ?>" style="<?php if( in_array( $rule['condition'], array( '', 'everywhere' ) ) ) { echo 'display: none;'; } ?>" />
72
+ </td>
73
+ </tr>
74
+ <?php $key++;
75
+ } ?>
76
+ </tbody>
77
+ <tr>
78
+ <th></th>
79
+ <td><button type="button" class="button boxzilla-add-rule"><?php _e( 'Add rule', 'boxzilla' ); ?></button></td>
80
+ </tr>
81
+ <tr valign="top">
82
+ <th><label for="boxzilla_position"><?php _e( 'Box Position', 'boxzilla' ); ?></label></th>
83
+ <td>
84
+ <table class="window-positions">
85
+ <tr>
86
+ <td>
87
+ <?php
88
+ $value = 'top-left'; $label = __( 'Top Left', 'boxzilla' );
89
+ printf( '<label><input type="radio" name="boxzilla_box[css][position]" value="%s" %s> &nbsp; %s</label>', $value, checked( $opts['css']['position'], $value, false ), $label );
90
+ ?>
91
+ </td>
92
+ <td></td>
93
+ <td>
94
+ <?php
95
+ $value = 'top-right'; $label = __( 'Top Right', 'boxzilla' );
96
+ printf( '<label><input type="radio" name="boxzilla_box[css][position]" value="%s" %s> &nbsp; %s</label>', $value, checked( $opts['css']['position'], $value, false ), $label );
97
+ ?>
98
+ </td>
99
+ </tr>
100
+ <tr>
101
+ <td></td>
102
+ <td>
103
+ <?php
104
+ $value = 'center'; $label = __( 'Center', 'boxzilla' );
105
+ printf( '<label><input type="radio" name="boxzilla_box[css][position]" value="%s" %s> &nbsp; %s</label>', $value, checked( $opts['css']['position'], $value, false ), $label );
106
+ ?>
107
+ </td>
108
+ <td></td>
109
+ </tr>
110
+ <tr>
111
+ <td>
112
+ <?php
113
+ $value = 'bottom-left'; $label = __( 'Bottom Left', 'boxzilla' );
114
+ printf( '<label><input type="radio" name="boxzilla_box[css][position]" value="%s" %s> &nbsp; %s</label>', $value, checked( $opts['css']['position'], $value, false ), $label );
115
+ ?>
116
+ </td>
117
+ <td></td>
118
+ <td>
119
+ <?php
120
+ $value = 'bottom-right'; $label = __( 'Bottom Right', 'boxzilla' );
121
+ printf( '<label><input type="radio" name="boxzilla_box[css][position]" value="%s" %s> &nbsp; %s</label>', $value, checked( $opts['css']['position'], $value, false ), $label );
122
+ ?>
123
+ </td>
124
+ </tr>
125
+ </table>
126
+ </td>
127
+ </tr>
128
+ <tr valign="top">
129
+ <th><label><?php _e( 'Animation', 'boxzilla' ); ?></label></th>
130
+ <td>
131
+ <label><input type="radio" name="boxzilla_box[animation]" value="fade" <?php checked($opts['animation'], 'fade'); ?> /> <?php _e( 'Fade In', 'boxzilla' ); ?></label> &nbsp;
132
+ <label><input type="radio" name="boxzilla_box[animation]" value="slide" <?php checked($opts['animation'], 'slide'); ?> /> <?php _e( 'Slide In', 'boxzilla' ); ?></label>
133
+ <p class="help"><?php _e( 'Which animation type should be used to show the box when triggered?', 'boxzilla' ); ?></p>
134
+ </td>
135
+ </tr>
136
+ <tr valign="top">
137
+ <th><label for="boxzilla_trigger"><?php _e( 'Auto-show box?', 'boxzilla' ); ?></label></th>
138
+ <td>
139
+ <label><input type="radio" class="boxzilla-auto-show-trigger" name="boxzilla_box[trigger]" value="" <?php checked( $opts['trigger'], '' ); ?> /> <?php _e( 'Never', 'boxzilla' ); ?></label><br />
140
+ <label><input type="radio" class="boxzilla-auto-show-trigger" name="boxzilla_box[trigger]" value="time_on_page" <?php checked( $opts['trigger'], 'time_on_page' ); ?> /> <?php printf( __( 'Yes, after %s seconds on the page.', 'boxzilla' ), '<input type="number" name="boxzilla_box[trigger_time_on_page]" min="0" value="' . esc_attr( $opts['trigger_time_on_page'] ) . '" />' ); ?></label><br />
141
+ <label><input type="radio" class="boxzilla-auto-show-trigger" name="boxzilla_box[trigger]" value="percentage" <?php checked( $opts['trigger'], 'percentage' ); ?> /> <?php printf( __( 'Yes, when at %s of page height', 'boxzilla' ), '<input type="number" name="boxzilla_box[trigger_percentage]" min="0" max="100" value="' . esc_attr( $opts['trigger_percentage'] ) . '" />%' ); ?></label><br />
142
+ <label><input type="radio" class="boxzilla-auto-show-trigger" name="boxzilla_box[trigger]" value="element" <?php checked( $opts['trigger'], 'element' ); ?> /> <?php printf( __( 'Yes, when at element %s', 'boxzilla' ), '<input type="text" name="boxzilla_box[trigger_element]" value="' . esc_attr( $opts['trigger_element'] ) . '" placeholder="' . __( 'Example: #comments', 'boxzilla') .'" />' ); ?></label><br />
143
+ <?php do_action( 'boxzilla_output_auto_show_trigger_options', $opts ); ?>
144
+ </td>
145
+ </tr>
146
+ <tbody class="boxzilla-trigger-options" style="display: <?php echo ( $opts['trigger'] === '' ) ? 'none' : 'table-row-group'; ?>;">
147
+ <tr valign="top">
148
+ <th><label for="boxzilla_cookie"><?php _e( 'Cookie expiration', 'boxzilla' ); ?></label></th>
149
+ <td>
150
+ <div style="display: inline-block; margin-right: 20px;">
151
+ <label for="boxzilla_cookie_triggered" style="font-weight: bold; display: block;"><?php esc_html_e( 'Triggered', 'mailchimp-for-wp' ); ?></label>
152
+ <input type="number" id="boxzilla_cookie_triggered" name="boxzilla_box[cookie][triggered]" min="0" step="1" value="<?php echo esc_attr($opts['cookie']['triggered']); ?>" />
153
+ <small><?php _e( 'hours', 'boxzilla' ); ?></small>
154
+ </div>
155
+ <div style="display: inline-block;">
156
+ <label for="boxzilla_cookie_dismissed" style="font-weight: bold; display: block;"><?php esc_html_e( 'Dismissed', 'mailchimp-for-wp' ); ?></label>
157
+ <input type="number" id="boxzilla_cookie_dismissed" name="boxzilla_box[cookie][dismissed]" min="0" step="1" value="<?php echo esc_attr($opts['cookie']['dismissed']); ?>" />
158
+ <small><?php _e( 'hours', 'boxzilla' ); ?></small>
159
+ </div>
160
+ <br />
161
+
162
+ <p class="help"><?php _e( 'After this box is triggered or dismissed, how many hours should it stay hidden?', 'boxzilla' ); ?></p>
163
+ </td>
164
+ </tr>
165
+ <tr valign="top">
166
+ <th><label for="boxzilla_hide_on_screen_size"><?php _e( 'Do not auto-show box on small screens?', 'boxzilla' ); ?></label></th>
167
+ <td>
168
+ <p><?php printf( __( 'Do not auto-show on screens smaller than %s.', 'boxzilla' ), '<input type="number" min="0" name="boxzilla_box[hide_on_screen_size]" value="' . esc_attr( $opts['hide_on_screen_size'] ) . '" style="max-width: 70px;" />px' ); ?></p>
169
+ <p class="help"><?php _e( 'Leave empty if you <strong>do</strong> want to auto-show the box on small screens.', 'boxzilla' ); ?></p>
170
+ </td>
171
+
172
+ </tr>
173
+ <tr valign="top">
174
+ <th><label for="boxzilla_auto_hide"><?php _e( 'Auto-hide?', 'boxzilla' ); ?></label></th>
175
+ <td>
176
+ <label><input type="radio" name="boxzilla_box[auto_hide]" value="1" <?php checked( $opts['auto_hide'], 1 ); ?> /> <?php _e( 'Yes' ); ?></label> &nbsp;
177
+ <label><input type="radio" name="boxzilla_box[auto_hide]" value="0" <?php checked( $opts['auto_hide'], 0 ); ?> /> <?php _e( 'No' ); ?></label> &nbsp;
178
+ <p class="help"><?php _e( 'Hide box again when visitors scroll back up?', 'boxzilla' ); ?></p>
179
+ </td>
180
+ </tr>
181
+ <tr valign="top">
182
+ <th><label for="boxzilla_test_mode"><?php _e( 'Enable test mode?', 'boxzilla' ); ?></label></th>
183
+ <td>
184
+ <label><input type="radio" id="boxzilla_test_mode_1" name="boxzilla_global_settings[test_mode]" value="1" <?php checked( $global_opts['test_mode'], 1 ); ?> /> <?php _e( 'Yes' ); ?></label> &nbsp;
185
+ <label><input type="radio" id="boxzilla_test_mode_0" name="boxzilla_global_settings[test_mode]" value="0" <?php checked( $global_opts['test_mode'], 0 ); ?> /> <?php _e( 'No' ); ?></label> &nbsp;
186
+ <p class="help"><?php _e( 'If test mode is enabled, all boxes will show up regardless of whether a cookie has been set.', 'boxzilla' ); ?></p>
187
+ </td>
188
+ </tr>
189
+ <?php
190
+
191
+ /**
192
+ * @ignore
193
+ */
194
+ do_action( 'boxzilla_after_box_option_controls', $box, $opts ); ?>
195
+ </tbody>
196
+ </table>
197
+
198
+
199
+ <script type="text/html" id="tmpl-rule-row-template">
200
+ <tr valign="top" class="boxzilla-rule-row boxzilla-rule-row-{{{data.key}}}">
201
+ <th style="text-align: right; font-weight: normal;">
202
+ <span class="boxzilla-close boxzilla-remove-rule"><span class="dashicons dashicons-dismiss"></span></span>
203
+ </th>
204
+ <td class="boxzilla-sm">
205
+ <select class="boxzilla-rule-condition" name="boxzilla_box[rules][{{{data.key}}}][condition]">
206
+ <?php foreach( $rule_options as $value => $label ) {
207
+ printf( '<option value="%s" %s %s>%s</option>', $value, disabled( $value, '', false ), '', $label );
208
+ } ?>
209
+ </select>
210
+ <select class="boxzilla-rule-qualifier" name="boxzilla_box[rules][{{{data.key}}}][qualifier]" style="display: none;" >
211
+ <option value="1" selected><?php _e( 'is', 'boxzilla' ); ?></option>
212
+ <option value="0"><?php _e( 'is not', 'boxzilla' ); ?></option>
213
+ </select>
214
+
215
+ <input class="boxzilla-rule-value regular-text" name="boxzilla_box[rules][{{{data.key}}}][value]" type="text" value="" placeholder="<?php _e( 'Leave empty for any or enter (comma-separated) names or ID\'s', 'boxzilla' ); ?>" style="display: none;" />
216
+ </td>
217
+ </tr>
218
+ </script>
trunk/src/admin/views/metaboxes/email-optin.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) or exit;
3
+ $user = wp_get_current_user(); ?>
4
+ <form action="//dannyvankooten.us1.list-manage.com/subscribe/post?u=a2d08947dcd3683512ce174c5&amp;id=e3e1e0f8d8" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
5
+ <p>Get the most out of the Boxzilla plugin by subscribing to our newsletter filled with tips & tricks.</p>
6
+
7
+ <p class="mc-field-group">
8
+ <label for="mce-EMAIL" style="margin-bottom: 0;">Email Address &nbsp;<span style="color: red;">*</span></label>
9
+ <input type="email" value="<?php echo esc_attr( $user->user_email ); ?>" name="EMAIL" class="widefat" id="mce-EMAIL">
10
+ </p>
11
+ <p class="mc-field-group">
12
+ <label for="mce-FNAME" style="margin-bottom: 0;">First Name &nbsp;<small style="font-weight: normal;">(optional)</small></label>
13
+ <input type="text" value="<?php echo esc_attr( $user->first_name ); ?>" name="FNAME" class="widefat" id="mce-FNAME">
14
+ </p>
15
+ <div id="mce-responses" class="clear">
16
+ <div class="response" id="mce-error-response" style="display:none"></div>
17
+ <div class="response" id="mce-success-response" style="display:none"></div>
18
+ </div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
19
+ <div style="position: absolute; left: -5000px;"><input type="text" name="b_a2d08947dcd3683512ce174c5_e3e1e0f8d8" tabindex="-1" value=""></div>
20
+ <div class="clear"><input type="submit" value="Subscribe" name="subscribe" class="button button-primary"></div>
21
+
22
+ <p class="help" style="margin-bottom: 0;"><small>No spam, unsubscribe at any time, max once a month.</small></p>
23
+ </form>
trunk/src/admin/views/metaboxes/need-help.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php defined( 'ABSPATH' ) or exit; ?>
2
+ <p><?php _e( 'Please make sure to look at the following available resources.', 'boxzilla' ); ?></p>
3
+ <ul class="ul-square">
4
+ <li><a href="https://kb.boxzillaplugin.com/">Knowledge Base</a></li>
5
+ <li><a href="https://wordpress.org/plugins/boxzilla/faq/">Frequently Asked Questions</a></li>
6
+ <li><a href="https://wordpress.org/support/plugin/boxzilla">Support forums on WordPress.org</a></li>
7
+ </ul>
8
+
trunk/src/admin/views/settings.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php defined( 'ABSPATH' ) or exit; ?>
2
+ <div class="wrap" id="boxzilla-admin" class="boxzilla-settings">
3
+
4
+ <div class="boxzilla-row">
5
+ <div class="boxzilla-col-two-third">
6
+
7
+ <h2><?php _e( 'Settings', 'boxzilla' ); ?></h2>
8
+
9
+ <?php do_action( 'boxzilla_before_settings' ); ?>
10
+
11
+ <form action="<?php echo admin_url( 'options.php' ); ?>" method="post">
12
+
13
+ <?php settings_fields( 'boxzilla_settings' ); ?>
14
+
15
+ <table class="form-table">
16
+
17
+ <?php do_action( 'boxzilla_before_settings_rows' ); ?>
18
+
19
+ <tr valign="top">
20
+ <th><label for="boxzilla_test_mode"><?php _e( 'Enable test mode?', 'boxzilla' ); ?></label></th>
21
+ <td>
22
+ <label><input type="radio" id="boxzilla_test_mode_1" name="boxzilla_settings[test_mode]" value="1" <?php checked( $opts['test_mode'], 1 ); ?> /> <?php _e( 'Yes' ); ?></label> &nbsp;
23
+ <label><input type="radio" id="boxzilla_test_mode_0" name="boxzilla_settings[test_mode]" value="0" <?php checked( $opts['test_mode'], 0 ); ?> /> <?php _e( 'No' ); ?></label> &nbsp;
24
+ <p class="help"><?php _e( 'If test mode is enabled, all boxes will show up regardless of whether a cookie has been set.', 'boxzilla' ); ?></p>
25
+ </td>
26
+ </tr>
27
+
28
+ <?php do_action( 'boxzilla_after_settings_rows' ); ?>
29
+ </table>
30
+
31
+ <?php submit_button(); ?>
32
+ </form>
33
+
34
+ <?php do_action( 'boxzilla_after_settings' ); ?>
35
+ </div>
36
+
37
+ <div class="boxzilla-sidebar boxzilla-col-one-third">
38
+
39
+ <!-- Begin MailChimp Signup Form -->
40
+ <div class="boxzilla-box">
41
+ <h3>Subscribe to our mailing list</h3>
42
+ <?php include __DIR__ . '/metaboxes/email-optin.php'; ?>
43
+ </div>
44
+ <!--End mc_embed_signup-->
45
+
46
+ <div class="boxzilla-box">
47
+ <h3>Looking for help?</h3>
48
+ <?php include __DIR__ . '/metaboxes/need-help.php'; ?>
49
+ </div>
50
+
51
+ </div>
52
+ </div>
53
+
54
+ <br style="clear: both;" />
55
+
56
+ </div>
trunk/src/class-bootstrapper.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla;
4
+
5
+ use InvalidArgumentException;
6
+
7
+ /**
8
+ * Class Bootstrapper
9
+ * @package Boxzilla
10
+ *
11
+ * @method void admin( callable $callback )
12
+ * @method void cron( callable $callback )
13
+ * @method void front( callable $callback )
14
+ * @method void ajax( callable $callback )
15
+ * @method void cli( callable $callback )
16
+ */
17
+ class Bootstrapper {
18
+
19
+ /**
20
+ * @var array
21
+ */
22
+ private $bootstrappers = array(
23
+ 'admin' => array(),
24
+ 'ajax' => array(),
25
+ 'cli' => array(),
26
+ 'cron' => array(),
27
+ 'front' => array(),
28
+ 'global' => array(),
29
+ );
30
+
31
+ /**
32
+ * @param string $section
33
+ * @param callable $callable
34
+ */
35
+ public function register( $section, $callable ) {
36
+
37
+ if( ! isset( $this->bootstrappers[ $section ] ) ) {
38
+ throw new InvalidArgumentException( "Section $section is invalid." );
39
+ }
40
+
41
+ if( ! is_callable( $callable ) ) {
42
+ throw new InvalidArgumentException( 'Callable argument is not callable.' );
43
+ }
44
+
45
+ $this->bootstrappers[ $section ][] = $callable;
46
+ }
47
+
48
+ /**
49
+ * @param string $name
50
+ * @param array $arguments
51
+ */
52
+ public function __call( $name, $arguments ) {
53
+ if( isset( $this->bootstrappers[ $name ] ) ) {
54
+ $this->register( $name, $arguments[0] );
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Run registered bootstrappers
60
+ *
61
+ * @param string $section
62
+ */
63
+ public function run( $section = '' ) {
64
+
65
+ if( ! $section ) {
66
+ $section = $this->section();
67
+ }
68
+
69
+ // call all global callbacks
70
+ foreach( $this->bootstrappers['global'] as $callback ) {
71
+ $callback();
72
+ }
73
+
74
+ // call section specific callbacks
75
+ foreach( $this->bootstrappers[ $section ] as $callback ) {
76
+ $callback();
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Get currently active section.
82
+ *
83
+ * @return string
84
+ */
85
+ public function section() {
86
+ if( is_admin() ) {
87
+ if( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
88
+ return 'ajax';
89
+ } else {
90
+ return 'admin';
91
+ }
92
+ } else {
93
+ if( defined( 'DOING_CRON' ) && DOING_CRON ) {
94
+ return 'cron';
95
+ } else if( defined( 'WP_CLI' ) && WP_CLI ) {
96
+ return 'cli';
97
+ } else {
98
+ return 'front';
99
+ }
100
+ }
101
+ }
102
+
103
+ }
trunk/src/class-box.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla;
4
+
5
+ use WP_Post;
6
+
7
+ class Box {
8
+
9
+ /**
10
+ * @var int
11
+ */
12
+ public $ID;
13
+
14
+ /**
15
+ * @var array
16
+ */
17
+ public $options = array();
18
+
19
+ /**
20
+ * @var string
21
+ */
22
+ public $title = '';
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ protected $content = '';
28
+
29
+ /**
30
+ * @var bool
31
+ */
32
+ public $enabled = false;
33
+
34
+ /**
35
+ * @param WP_Post|int $post
36
+ */
37
+ public function __construct( $post ) {
38
+
39
+ // fetch post if it hasn't been fetched yet
40
+ if( ! $post instanceof WP_Post ) {
41
+ $post = get_post( $post );
42
+ }
43
+
44
+ // store ID in property for quick access
45
+ $this->ID = $post->ID;
46
+
47
+ // store title in property
48
+ $this->title = $post->post_title;
49
+
50
+ // store content in property
51
+ $this->content = $post->post_content;
52
+
53
+ // is this box enabled?
54
+ $this->enabled = ( $post->post_status === 'publish' );
55
+
56
+ // load and store options in property
57
+ $this->options = $this->load_options();
58
+ }
59
+
60
+ /**
61
+ * Get the options for this box.
62
+ **
63
+ * @return array Array of box options
64
+ */
65
+ protected function load_options() {
66
+
67
+ static $defaults = array(
68
+ 'css' => array(
69
+ 'background_color' => '',
70
+ 'color' => '',
71
+ 'width' => '',
72
+ 'border_color' => '',
73
+ 'border_width' => '',
74
+ 'border_style' => '',
75
+ 'position' => 'bottom-right',
76
+ ),
77
+ 'rules' => array(
78
+ 0 => array(
79
+ 'condition' => '',
80
+ 'value' => '',
81
+ ),
82
+ ),
83
+ 'rules_comparision' => 'any',
84
+ 'cookie' => array(
85
+ 'triggered' => 0,
86
+ 'dismissed' => 0,
87
+ ),
88
+ 'trigger' => 'percentage',
89
+ 'trigger_percentage' => 65,
90
+ 'trigger_element' => '',
91
+ 'trigger_time_on_site' => 0,
92
+ 'trigger_time_on_page' => 0,
93
+ 'animation' => 'fade',
94
+ 'auto_hide' => 0,
95
+ 'hide_on_screen_size' => '',
96
+ 'closable' => true,
97
+ );
98
+ $box = $this;
99
+
100
+ $options = get_post_meta( $this->ID, 'boxzilla_options', true );
101
+ $options = is_array( $options ) ? $options : array();
102
+
103
+ // merge options with default options
104
+ $options = array_replace_recursive( $defaults, $options );
105
+
106
+ // allow others to filter the final array of options
107
+ /**
108
+ * Filter the options for a given box
109
+ *
110
+ * @param array $options
111
+ * @param Box $box
112
+ */
113
+ $options = apply_filters( 'boxzilla_box_options', $options, $box );
114
+
115
+ return $options;
116
+ }
117
+
118
+ /**
119
+ * @return bool
120
+ */
121
+ public function is_enabled() {
122
+ return $this->enabled;
123
+ }
124
+
125
+ /**
126
+ * Get the options for this box
127
+ *
128
+ * @return array
129
+ */
130
+ public function get_options() {
131
+ return $this->options;
132
+ }
133
+
134
+ /**
135
+ * Get the close / hide icon for this box
136
+ *
137
+ * @return string
138
+ */
139
+ public function get_close_icon() {
140
+
141
+ $box = $this;
142
+ $html = '&times;';
143
+
144
+ /**
145
+ * Filters the HTML for the close icon.
146
+ *
147
+ * @param string $html
148
+ * @param Box $box
149
+ */
150
+ $close_icon = (string) apply_filters( 'boxzilla_box_close_icon', $html, $box );
151
+
152
+ return $close_icon;
153
+ }
154
+
155
+ /**
156
+ * Get the content of this box
157
+ *
158
+ * @return mixed|void
159
+ */
160
+ public function get_content() {
161
+ $content = $this->content;
162
+ $box = $this;
163
+
164
+ /**
165
+ * Filters the HTML for the box content
166
+ *
167
+ * @param string $content
168
+ * @param Box $box
169
+ */
170
+ $content = apply_filters( 'boxzilla_box_content', $content, $box );
171
+ return $content;
172
+ }
173
+
174
+ /**
175
+ * Get the minimum allowed screen size for this box
176
+ *
177
+ * @return int
178
+ */
179
+ public function get_minimum_screen_size() {
180
+
181
+ if( $this->options['hide_on_screen_size'] > 0 ) {
182
+ $minimum_screen_size = absint( $this->options['hide_on_screen_size'] );
183
+ } else {
184
+ $minimum_screen_size = 0;
185
+ }
186
+
187
+ return $minimum_screen_size;
188
+ }
189
+
190
+ public function get_client_options() {
191
+ $box = $this;
192
+
193
+ $trigger = false;
194
+ if( $box->options['trigger'] ) {
195
+
196
+ $trigger = array( 'method' => $this->options['trigger'] );
197
+
198
+ if( isset( $this->options[ 'trigger_' . $this->options['trigger'] ] ) ) {
199
+ $trigger['value'] = $this->options[ 'trigger_' . $this->options['trigger'] ];
200
+ }
201
+ }
202
+
203
+ $client_options = array(
204
+ 'id' => $box->ID,
205
+ 'icon' => $box->get_close_icon(),
206
+ 'content' => $box->get_content(),
207
+ 'css' => array_filter( $box->options['css'] ),
208
+ 'trigger' => $trigger,
209
+ 'animation' => $box->options['animation'],
210
+ 'cookie' => array(
211
+ 'triggered' => absint( $box->options['cookie']['triggered'] ),
212
+ 'dismissed' => absint( $box->options['cookie']['dismissed'] ),
213
+ ),
214
+ 'rehide' => (bool) $box->options['auto_hide'],
215
+ 'position' => $box->options['css']['position'],
216
+ 'minimumScreenWidth' => $box->get_minimum_screen_size(),
217
+ 'closable' => $box->options['closable'],
218
+ );
219
+
220
+ /**
221
+ * Filter the final options for the JS Boxzilla client.
222
+ *
223
+ * @param array $client_options
224
+ * @param Box $box
225
+ */
226
+ $client_options = apply_filters( 'boxzilla_box_client_options', $client_options, $box );
227
+
228
+ return $client_options;
229
+ }
230
+
231
+ }
trunk/src/class-boxzilla-service-provider.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla;
4
+
5
+ use Boxzilla\Admin\Admin;
6
+ use Boxzilla\Admin\Notices;
7
+ use Boxzilla\DI\Container;
8
+ use Boxzilla\DI\ServiceProviderInterface;
9
+
10
+ class BoxzillaServiceProvider implements ServiceProviderInterface {
11
+
12
+ /**
13
+ * Registers services on the given container.
14
+ *
15
+ * This method should only be used to configure services and parameters.
16
+ * It should not get services.
17
+ *
18
+ * @param Container $container An Container instance
19
+ */
20
+ public function register( Container $container ) {
21
+
22
+ $container['admin'] = function( $container ) {
23
+ return new Admin( $container->plugin, $container );
24
+ };
25
+
26
+ $container['bootstrapper'] = new Bootstrapper();
27
+
28
+ $container['box_loader'] = function( $container ) {
29
+ return new BoxLoader( $container->plugin, $container->options );
30
+ };
31
+
32
+ $container['filter.autocomplete'] = function( $container ) {
33
+ return new Filter\Autocomplete();
34
+ };
35
+
36
+ $container['notices'] = function( $container ) {
37
+ return new Notices();
38
+ };
39
+
40
+ $container['options'] = function( $container ) {
41
+ $defaults = array(
42
+ 'test_mode' => 0
43
+ );
44
+
45
+ $options = (array) get_option( 'boxzilla_settings', $defaults );
46
+ $options = array_merge( $defaults, $options );
47
+ return $options;
48
+ };
49
+
50
+ $container['plugin'] = new Plugin(
51
+ 'boxzilla',
52
+ 'Boxzilla',
53
+ BOXZILLA_VERSION,
54
+ BOXZILLA_FILE,
55
+ dirname( BOXZILLA_FILE )
56
+ );
57
+
58
+ $container['plugins'] = function( $container ) {
59
+ $plugins = (array) apply_filters( 'boxzilla_extensions', array() );
60
+ return new Collection( $plugins );
61
+ };
62
+
63
+
64
+
65
+
66
+
67
+
68
+ }
69
+ }
trunk/src/class-boxzilla.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla;
4
+
5
+ use Boxzilla\DI\ContainerWithPropertyAccess;
6
+ use Boxzilla\Licensing\License;
7
+
8
+ /**
9
+ * Class Boxzilla
10
+ *
11
+ * @package Boxzilla
12
+ *
13
+ * @property array $options
14
+ * @property Plugin $plugin
15
+ * @property Plugin[] $plugins
16
+ * @property License $license
17
+ * @property Bootstrapper $bootstrapper
18
+ *
19
+ */
20
+ class Boxzilla extends ContainerWithPropertyAccess {}
trunk/src/class-collection.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla;
4
+
5
+ use Iterator;
6
+ use Countable;
7
+ use ArrayAccess;
8
+
9
+ class Collection implements Iterator, Countable, ArrayAccess {
10
+
11
+ protected $elements = array();
12
+ private $position = 0;
13
+
14
+ public function __construct( array $elements ) {
15
+ $this->elements = $elements;
16
+ $this->position = 0;
17
+ }
18
+
19
+ function rewind() {
20
+ $this->position = 0;
21
+ }
22
+
23
+ function current() {
24
+ return $this->elements[ $this->position ];
25
+ }
26
+
27
+ function key() {
28
+ return $this->position;
29
+ }
30
+
31
+ function next() {
32
+ ++$this->position;
33
+ }
34
+
35
+ function valid() {
36
+ return isset( $this->elements[ $this->position ] );
37
+ }
38
+
39
+ /**
40
+ * @param $callback
41
+ *
42
+ * @return array
43
+ */
44
+ function map($callback) {
45
+ $result = array();
46
+
47
+ foreach( $this->elements as $element ) {
48
+ $result[] = $callback( $element );
49
+ }
50
+
51
+ return $result;
52
+ }
53
+
54
+ /**
55
+ * @param $callback
56
+ *
57
+ * @return null
58
+ */
59
+ function find($callback) {
60
+
61
+ foreach( $this->elements as $element ) {
62
+ if( $callback( $element ) ) {
63
+ return $element;
64
+ }
65
+ }
66
+
67
+ return null;
68
+ }
69
+
70
+ /**
71
+ * (PHP 5 &gt;= 5.1.0)<br/>
72
+ * Count elements of an object
73
+ * @link http://php.net/manual/en/countable.count.php
74
+ * @return int The custom count as an integer.
75
+ * </p>
76
+ * <p>
77
+ * The return value is cast to an integer.
78
+ */
79
+ public function count() {
80
+ return count( $this->elements );
81
+ }
82
+
83
+ /**
84
+ * Whether a offset exists
85
+ * @link http://php.net/manual/en/arrayaccess.offsetexists.php
86
+ * @param mixed $offset <p>
87
+ * An offset to check for.
88
+ * </p>
89
+ * @return boolean true on success or false on failure.
90
+ * </p>
91
+ * <p>
92
+ * The return value will be casted to boolean if non-boolean was returned.
93
+ * @since 5.0.0
94
+ */
95
+ public function offsetExists($offset)
96
+ {
97
+ return isset( $this->elements[ $offset ] );
98
+ }
99
+
100
+ /**
101
+ * Offset to retrieve
102
+ * @link http://php.net/manual/en/arrayaccess.offsetget.php
103
+ * @param mixed $offset <p>
104
+ * The offset to retrieve.
105
+ * </p>
106
+ * @return mixed Can return all value types.
107
+ * @since 5.0.0
108
+ */
109
+ public function offsetGet($offset)
110
+ {
111
+ return $this->elements[ $offset ];
112
+ }
113
+
114
+ /**
115
+ * Offset to set
116
+ * @link http://php.net/manual/en/arrayaccess.offsetset.php
117
+ * @param mixed $offset <p>
118
+ * The offset to assign the value to.
119
+ * </p>
120
+ * @param mixed $value <p>
121
+ * The value to set.
122
+ * </p>
123
+ * @return void
124
+ * @since 5.0.0
125
+ */
126
+ public function offsetSet($offset, $value)
127
+ {
128
+ $this->elements[ $offset ] = $value;
129
+ }
130
+
131
+ /**
132
+ * Offset to unset
133
+ * @link http://php.net/manual/en/arrayaccess.offsetunset.php
134
+ * @param mixed $offset <p>
135
+ * The offset to unset.
136
+ * </p>
137
+ * @return void
138
+ * @since 5.0.0
139
+ */
140
+ public function offsetUnset($offset)
141
+ {
142
+ unset( $this->elements[ $offset] );
143
+ }
144
+
145
+ /**
146
+ * Return a random value out of the collection.
147
+ *
148
+ * @return mixed
149
+ */
150
+ public function random() {
151
+ $key = array_rand( $this->elements );
152
+ return $this->elements[ $key ];
153
+ }
154
+ }
trunk/src/class-loader.php ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla;
4
+
5
+ class BoxLoader {
6
+
7
+ /**
8
+ * @var Plugin
9
+ */
10
+ private $plugin;
11
+
12
+ /**
13
+ * @var array
14
+ */
15
+ private $box_ids_to_load = array();
16
+
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $options;
21
+
22
+ /**
23
+ * Constructor
24
+ *
25
+ * @param Plugin $plugin
26
+ * @param array $options
27
+ */
28
+ public function __construct( Plugin $plugin, array $options ) {
29
+ $this->plugin = $plugin;
30
+ $this->options = $options;
31
+ }
32
+
33
+ /**
34
+ * Initializes the plugin, runs on `wp` hook.
35
+ */
36
+ public function init() {
37
+
38
+ $this->box_ids_to_load = $this->filter_boxes();
39
+
40
+ // Only add other hooks if necessary
41
+ if( count( $this->box_ids_to_load ) > 0 ) {
42
+ add_action( 'wp_enqueue_scripts', array( $this, 'load_assets' ), 90 );
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Get global rules for all boxes
48
+ *
49
+ * @return array
50
+ */
51
+ protected function get_filter_rules() {
52
+ $rules = get_option( 'boxzilla_rules', array() );
53
+
54
+ if( ! is_array( $rules ) ) {
55
+ return array();
56
+ }
57
+
58
+ return $rules;
59
+ }
60
+
61
+
62
+ /**
63
+ * Match a string against an array of patterns, glob-style.
64
+ *
65
+ * @param string $string
66
+ * @param array $patterns
67
+ *
68
+ * @return boolean
69
+ */
70
+ protected function match_patterns( $string, $patterns ) {
71
+ $string = strtolower( $string );
72
+
73
+ foreach( $patterns as $pattern ) {
74
+
75
+ $pattern = strtolower( $pattern );
76
+
77
+ if( function_exists( 'fnmatch' ) ) {
78
+ $match = fnmatch( $pattern, $string );
79
+ } else {
80
+ $match = ( $pattern === $string );
81
+ }
82
+
83
+ if( $match ) {
84
+ return true;
85
+ }
86
+ }
87
+
88
+ return false;
89
+ }
90
+
91
+ /**
92
+ * Check if this rule passes (conditional matches expected value)
93
+ *
94
+ * @param string $condition
95
+ * @param string $value
96
+ * @param boolean $qualifier
97
+ *
98
+ * @return bool
99
+ */
100
+ protected function match_rule( $condition, $value, $qualifier = true ) {
101
+
102
+ $matched = false;
103
+
104
+ // cast value to array & trim whitespace or excess comma's
105
+ $value = array_map( 'trim', explode( ',', rtrim( trim( $value ), ',' ) ) );
106
+
107
+ switch ( $condition ) {
108
+ case 'everywhere';
109
+ $matched = true;
110
+ break;
111
+
112
+ case 'is_url':
113
+ $matched = $this->match_patterns( $_SERVER['REQUEST_URI'], $value );
114
+ break;
115
+
116
+ case 'is_referer':
117
+ if( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
118
+ $referer = $_SERVER['HTTP_REFERER'];
119
+ $matched = $this->match_patterns( $referer, $value );
120
+ }
121
+ break;
122
+
123
+ case 'is_post_type':
124
+ $post_type = (string) get_post_type();
125
+ $matched = in_array( $post_type, (array) $value );
126
+ break;
127
+
128
+ case 'is_single':
129
+ case 'is_post':
130
+ // convert to empty string if array with just empty string in it
131
+ $value = ( $value === array( '' ) ) ? '' : $value;
132
+ $matched = is_single( $value );
133
+ break;
134
+
135
+ case 'is_post_in_category':
136
+ $matched = is_singular( 'post' ) && has_category( $value );
137
+ break;
138
+
139
+
140
+ case 'is_page':
141
+ $matched = is_page( $value );
142
+ break;
143
+
144
+ case 'is_post_with_tag':
145
+ $matched = is_singular( 'post' ) && has_tag( $value );
146
+ break;
147
+ }
148
+
149
+ /**
150
+ * Filters whether a given box rule matches the condition and expected value.
151
+ *
152
+ * The dynamic portion of the hook, `$condition`, refers to the condition being matched.
153
+ *
154
+ * @param boolean $matched
155
+ * @param array $value
156
+ */
157
+ $matched = apply_filters( 'boxzilla_box_rule_matches_' . $condition, $matched, $value );
158
+
159
+ // if qualifier is set to false, we need to reverse this value here.
160
+ if( ! $qualifier ) {
161
+ $matched = ! $matched;
162
+ }
163
+
164
+ return $matched;
165
+ }
166
+
167
+ /**
168
+ * Checks which boxes should be loaded for this request.
169
+ *
170
+ * @return array
171
+ */
172
+ private function filter_boxes() {
173
+
174
+ $box_ids_to_load = array();
175
+ $rules = $this->get_filter_rules();
176
+
177
+ foreach( $rules as $box_id => $box_rules ) {
178
+
179
+ $matched = false;
180
+ $comparision = isset( $box_rules['comparision'] ) ? $box_rules['comparision'] : 'any';
181
+
182
+ // loop through all rules for all boxes
183
+ foreach ( $box_rules as $rule ) {
184
+
185
+ // skip faulty values (and comparision rule)
186
+ if( empty( $rule['condition'] ) ) {
187
+ continue;
188
+ }
189
+
190
+ $qualifier = isset( $rule['qualifier'] ) ? $rule['qualifier'] : true;
191
+ $matched = $this->match_rule( $rule['condition'], $rule['value'], $qualifier );
192
+
193
+ // break out of loop if we've already matched
194
+ if( $comparision === 'any' && $matched ) {
195
+ break;
196
+ }
197
+
198
+ // no need to continue if this rule didn't match
199
+ if( $comparision === 'all' && ! $matched ) {
200
+ break;
201
+ }
202
+ }
203
+
204
+ // value of $matched at this point determines whether box should be loaded
205
+ $load_box = $matched;
206
+
207
+ /**
208
+ * Filters whether a box should be loaded into the page HTML.
209
+ *
210
+ * The dynamic portion of the hook, `$box_id`, refers to the ID of the box. Return true if you want to output the box.
211
+ *
212
+ * @param boolean $load_box
213
+ */
214
+ $load_box = apply_filters( 'boxzilla_load_box_' . $box_id, $load_box );
215
+
216
+ /**
217
+ * Filters whether a box should be loaded into the page HTML.
218
+ *
219
+ * @param boolean $load_box
220
+ * @param int $box_id
221
+ */
222
+ $load_box = apply_filters( 'boxzilla_load_box', $load_box, $box_id );
223
+
224
+ // if matched, box should be loaded on this page
225
+ if ( $load_box ) {
226
+ $box_ids_to_load[] = $box_id;
227
+ }
228
+
229
+ }
230
+
231
+ return $box_ids_to_load;
232
+ }
233
+
234
+ /**
235
+ * Load plugin styles
236
+ */
237
+ public function load_assets() {
238
+ $pre_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
239
+ wp_enqueue_script('boxzilla', $this->plugin->url('/assets/js/script' . $pre_suffix . '.js' ), array(), $this->plugin->version(), true );
240
+
241
+ $this->pass_box_options();
242
+
243
+ do_action( 'boxzilla_load_assets', $this );
244
+ }
245
+
246
+ /**
247
+ * Get an array of Box objects. These are the boxes that will be loaded for the current request.
248
+ *
249
+ * @return Box[]
250
+ */
251
+ public function get_matched_boxes() {
252
+ static $boxes;
253
+
254
+ if( is_null( $boxes ) ) {
255
+
256
+ if( count( $this->box_ids_to_load ) === 0 ) {
257
+ $boxes = array();
258
+ return $boxes;
259
+ }
260
+
261
+ // query Box posts
262
+ $boxes = get_posts(
263
+ array(
264
+ 'post_type' => 'boxzilla-box',
265
+ 'post_status' => 'publish',
266
+ 'post__in' => $this->box_ids_to_load,
267
+ 'numberposts' => -1
268
+ )
269
+ );
270
+
271
+ // create `Box` instances out of \WP_Post instances
272
+ foreach ( $boxes as $key => $box ) {
273
+ $boxes[ $key ] = new Box( $box );
274
+ }
275
+ }
276
+
277
+ return $boxes;
278
+ }
279
+
280
+ /**
281
+ * Create array of Box options and pass it to JavaScript script.
282
+ */
283
+ public function pass_box_options() {
284
+
285
+ // create boxzilla_Global_Options object
286
+ $plugin_options = $this->options;
287
+ $boxes = $this->get_matched_boxes();
288
+
289
+ $data = array(
290
+ 'testMode' => (bool) $plugin_options['test_mode'],
291
+ 'boxes' => array_map( function(Box $box) { return $box->get_client_options(); }, $boxes ),
292
+ );
293
+
294
+ wp_localize_script( 'boxzilla', 'boxzilla_options', $data );
295
+ }
296
+
297
+ }
298
+
299
+
trunk/src/class-php-fallback.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Boxzilla_PHP_Fallback {
4
+
5
+ /**
6
+ * @var string
7
+ */
8
+ private $plugin_name = '';
9
+
10
+ /**
11
+ * @var string
12
+ */
13
+ private $plugin_file = '';
14
+
15
+ /**
16
+ * @param $plugin_name
17
+ * @param $plugin_file
18
+ */
19
+ public function __construct( $plugin_name, $plugin_file ) {
20
+
21
+ $this->plugin_name = $plugin_name;
22
+ $this->plugin_file = $plugin_file;
23
+
24
+ // deactivate plugin straight away
25
+ add_action( 'admin_init', array( $this, 'deactivate_self' ) );
26
+ }
27
+
28
+ /**
29
+ * @return bool
30
+ */
31
+ public function deactivate_self() {
32
+ if( ! current_user_can( 'activate_plugins' ) ) {
33
+ return false;
34
+ }
35
+
36
+ // deactivate self
37
+ deactivate_plugins( $this->plugin_file );
38
+
39
+ // get rid of "Plugin activated" notice
40
+ if( isset( $_GET['activate'] ) ) {
41
+ unset( $_GET['activate'] );
42
+ }
43
+
44
+ // show notice to user
45
+ add_action( 'admin_notices', array( $this, 'show_notice' ) );
46
+
47
+ return true;
48
+ }
49
+
50
+ /**
51
+ * @return void
52
+ */
53
+ public function show_notice() {
54
+ ?>
55
+ <div class="updated">
56
+ <p><?php printf( '<strong>%s</strong> did not activate because it requires <strong>PHP v5.3</strong> or higher, while your server is running <strong>PHP v%s</strong>.', $this->plugin_name, PHP_VERSION ); ?>
57
+ <p><?php printf( '<a href="%s">Updating your PHP version</a> makes your site faster, more secure and should be easy for your host.', 'http://www.wpupdatephp.com/update/#utm_source=wp-plugin&utm_medium=boxzillas&utm_campaign=activation-notice' ); ?></p>
58
+ </div>
59
+ <?php
60
+ }
61
+
62
+ }
trunk/src/class-plugin.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla;
4
+
5
+ class Plugin {
6
+
7
+ /**
8
+ * @var string The current version of the plugin
9
+ */
10
+ protected $version = '1.0';
11
+
12
+ /**
13
+ * @var string
14
+ */
15
+ protected $file = '';
16
+
17
+ /**
18
+ * @var string
19
+ */
20
+ protected $dir = '';
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ protected $name = '';
26
+
27
+ /**
28
+ * @var string
29
+ */
30
+ protected $slug = '';
31
+
32
+ /**
33
+ * @var int
34
+ */
35
+ protected $id = 0;
36
+
37
+ /**
38
+ * Constructor
39
+ *
40
+ * @param int $id
41
+ * @param string $name
42
+ * @param string $version
43
+ * @param string $file
44
+ * @param string $dir (optional)
45
+ */
46
+ public function __construct( $id, $name, $version, $file, $dir = '' ) {
47
+ $this->id = $id;
48
+ $this->name = $name;
49
+ $this->version = $version;
50
+ $this->file = $file;
51
+ $this->dir = $dir;
52
+ $this->slug = plugin_basename( $file );
53
+
54
+ if( empty( $dir ) ) {
55
+ $this->dir = dirname( $file );
56
+ }
57
+ }
58
+
59
+ /**
60
+ * @return int
61
+ */
62
+ public function id() {
63
+ return $this->id;
64
+ }
65
+
66
+ /**
67
+ * @return string
68
+ */
69
+ public function slug() {
70
+ return $this->slug;
71
+ }
72
+
73
+ /**
74
+ * @return string
75
+ */
76
+ public function name() {
77
+ return $this->name;
78
+ }
79
+
80
+ /**
81
+ * @return string
82
+ */
83
+ public function version() {
84
+ return $this->version;
85
+ }
86
+
87
+ /**
88
+ * @return string
89
+ */
90
+ public function file() {
91
+ return $this->file;
92
+ }
93
+
94
+ /**
95
+ * @return string
96
+ */
97
+ public function dir() {
98
+ return $this->dir;
99
+ }
100
+
101
+ /**
102
+ * @param string $path
103
+ *
104
+ * @return mixed
105
+ */
106
+ public function url( $path = '' ) {
107
+ return plugins_url( $path, $this->file() );
108
+ }
109
+ }
trunk/src/default-actions.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or exit;
4
+
5
+ $boxzilla = boxzilla();
6
+
7
+ // Register custom post type
8
+ add_action( 'init', function() use( $boxzilla ){
9
+ $args = array(
10
+ 'public' => false,
11
+ 'labels' => array(
12
+ 'name' => __( 'Boxzilla', 'boxzilla' ),
13
+ 'singular_name' => __( 'Box', 'boxzilla' ),
14
+ 'add_new' => __( 'Add New', 'boxzilla' ),
15
+ 'add_new_item' => __( 'Add New Box', 'boxzilla' ),
16
+ 'edit_item' => __( 'Edit Box', 'boxzilla' ),
17
+ 'new_item' => __( 'New Box', 'boxzilla' ),
18
+ 'all_items' => __( 'All Boxes', 'boxzilla' ),
19
+ 'view_item' => __( 'View Box', 'boxzilla' ),
20
+ 'search_items' => __( 'Search Boxes', 'boxzilla' ),
21
+ 'not_found' => __( 'No Boxes found', 'boxzilla' ),
22
+ 'not_found_in_trash' => __( 'No Boxes found in Trash', 'boxzilla' ),
23
+ 'parent_item_colon' => '',
24
+ 'menu_name' => __( 'Boxzilla', 'boxzilla' )
25
+ ),
26
+ 'show_ui' => true,
27
+ 'menu_position' => '108.1337133',
28
+ 'menu_icon' => $boxzilla->plugin->url( '/assets/img/menu-icon.png' ),
29
+ 'query_var' => false
30
+ );
31
+
32
+ register_post_type( 'boxzilla-box', $args );
33
+ });
trunk/src/default-filters.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or exit;
4
+
5
+ add_filter( 'boxzilla_box_content', 'wptexturize') ;
6
+ add_filter( 'boxzilla_box_content', 'convert_smilies' );
7
+ add_filter( 'boxzilla_box_content', 'convert_chars' );
8
+ add_filter( 'boxzilla_box_content', 'wpautop' );
9
+ add_filter( 'boxzilla_box_content', 'shortcode_unautop' );
10
+ add_filter( 'boxzilla_box_content', 'do_shortcode', 11 );
trunk/src/di/class-container-with-property-access.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\DI;
4
+
5
+ /**
6
+ * Class ContainerWithPropertyAccess
7
+ *
8
+ * This modifies Pimple so it is PSR-11 compatible and can be accessed using property accessors.
9
+ *
10
+ * @package Boxzilla\DI
11
+ */
12
+ class ContainerWithPropertyAccess extends Container {
13
+
14
+ /**
15
+ * @param string $name
16
+ * @return mixed
17
+ */
18
+ public function __get( $name ) {
19
+ return $this->offsetGet( $name );
20
+ }
21
+
22
+ /**
23
+ * @param string $name
24
+ * @param mixed $value
25
+ */
26
+ public function __set( $name, $value ) {
27
+ $this[ $name ] = $value;
28
+ }
29
+
30
+ /**
31
+ * @param string $name
32
+ * @return bool
33
+ */
34
+ public function __isset( $name ) {
35
+ return $this->offsetExists( $name );
36
+ }
37
+
38
+ /**
39
+ * @param string $name
40
+ * @return bool
41
+ */
42
+ public function has( $name ) {
43
+ return $this->offsetExists( $name );
44
+ }
45
+
46
+ /**
47
+ * @param string $name
48
+ * @return mixed
49
+ */
50
+ public function get( $name ) {
51
+ return $this->offsetGet( $name );
52
+ }
53
+
54
+ }
trunk/src/di/class-container.php ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Pimple.
5
+ *
6
+ * Copyright (c) 2009 Fabien Potencier
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is furnished
13
+ * to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+
27
+ namespace Boxzilla\DI;
28
+
29
+ /**
30
+ * Container main class.
31
+ *
32
+ * @author Fabien Potencier
33
+ */
34
+ class Container implements \ArrayAccess
35
+ {
36
+ private $values = array();
37
+ private $factories;
38
+ private $protected;
39
+ private $frozen = array();
40
+ private $raw = array();
41
+ private $keys = array();
42
+
43
+ /**
44
+ * Instantiate the container.
45
+ *
46
+ * Objects and parameters can be passed as argument to the constructor.
47
+ *
48
+ * @param array $values The parameters or objects.
49
+ */
50
+ public function __construct(array $values = array())
51
+ {
52
+ $this->factories = new \SplObjectStorage();
53
+ $this->protected = new \SplObjectStorage();
54
+
55
+ foreach ($values as $key => $value) {
56
+ $this->offsetSet($key, $value);
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Sets a parameter or an object.
62
+ *
63
+ * Objects must be defined as Closures.
64
+ *
65
+ * Allowing any PHP callable leads to difficult to debug problems
66
+ * as function names (strings) are callable (creating a function with
67
+ * the same name as an existing parameter would break your container).
68
+ *
69
+ * @param string $id The unique identifier for the parameter or object
70
+ * @param mixed $value The value of the parameter or a closure to define an object
71
+ * @throws \RuntimeException Prevent override of a frozen service
72
+ */
73
+ public function offsetSet($id, $value)
74
+ {
75
+ if (isset($this->frozen[$id])) {
76
+ throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id));
77
+ }
78
+
79
+ $this->values[$id] = $value;
80
+ $this->keys[$id] = true;
81
+ }
82
+
83
+ /**
84
+ * Gets a parameter or an object.
85
+ *
86
+ * @param string $id The unique identifier for the parameter or object
87
+ *
88
+ * @return mixed The value of the parameter or an object
89
+ *
90
+ * @throws \InvalidArgumentException if the identifier is not defined
91
+ */
92
+ public function offsetGet($id)
93
+ {
94
+ if (!isset($this->keys[$id])) {
95
+ throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
96
+ }
97
+
98
+ if (
99
+ isset($this->raw[$id])
100
+ || !is_object($this->values[$id])
101
+ || isset($this->protected[$this->values[$id]])
102
+ || !method_exists($this->values[$id], '__invoke')
103
+ ) {
104
+ return $this->values[$id];
105
+ }
106
+
107
+ if (isset($this->factories[$this->values[$id]])) {
108
+ return $this->values[$id]($this);
109
+ }
110
+
111
+ $raw = $this->values[$id];
112
+ $val = $this->values[$id] = $raw($this);
113
+ $this->raw[$id] = $raw;
114
+
115
+ $this->frozen[$id] = true;
116
+
117
+ return $val;
118
+ }
119
+
120
+ /**
121
+ * Checks if a parameter or an object is set.
122
+ *
123
+ * @param string $id The unique identifier for the parameter or object
124
+ *
125
+ * @return bool
126
+ */
127
+ public function offsetExists($id)
128
+ {
129
+ return isset($this->keys[$id]);
130
+ }
131
+
132
+ /**
133
+ * Unsets a parameter or an object.
134
+ *
135
+ * @param string $id The unique identifier for the parameter or object
136
+ */
137
+ public function offsetUnset($id)
138
+ {
139
+ if (isset($this->keys[$id])) {
140
+ if (is_object($this->values[$id])) {
141
+ unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]);
142
+ }
143
+
144
+ unset($this->values[$id], $this->frozen[$id], $this->raw[$id], $this->keys[$id]);
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Marks a callable as being a factory service.
150
+ *
151
+ * @param callable $callable A service definition to be used as a factory
152
+ *
153
+ * @return callable The passed callable
154
+ *
155
+ * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
156
+ */
157
+ public function factory($callable)
158
+ {
159
+ if (!is_object($callable) || !method_exists($callable, '__invoke')) {
160
+ throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.');
161
+ }
162
+
163
+ $this->factories->attach($callable);
164
+
165
+ return $callable;
166
+ }
167
+
168
+ /**
169
+ * Protects a callable from being interpreted as a service.
170
+ *
171
+ * This is useful when you want to store a callable as a parameter.
172
+ *
173
+ * @param callable $callable A callable to protect from being evaluated
174
+ *
175
+ * @return callable The passed callable
176
+ *
177
+ * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
178
+ */
179
+ public function protect($callable)
180
+ {
181
+ if (!is_object($callable) || !method_exists($callable, '__invoke')) {
182
+ throw new \InvalidArgumentException('Callable is not a Closure or invokable object.');
183
+ }
184
+
185
+ $this->protected->attach($callable);
186
+
187
+ return $callable;
188
+ }
189
+
190
+ /**
191
+ * Gets a parameter or the closure defining an object.
192
+ *
193
+ * @param string $id The unique identifier for the parameter or object
194
+ *
195
+ * @return mixed The value of the parameter or the closure defining an object
196
+ *
197
+ * @throws \InvalidArgumentException if the identifier is not defined
198
+ */
199
+ public function raw($id)
200
+ {
201
+ if (!isset($this->keys[$id])) {
202
+ throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
203
+ }
204
+
205
+ if (isset($this->raw[$id])) {
206
+ return $this->raw[$id];
207
+ }
208
+
209
+ return $this->values[$id];
210
+ }
211
+
212
+ /**
213
+ * Extends an object definition.
214
+ *
215
+ * Useful when you want to extend an existing object definition,
216
+ * without necessarily loading that object.
217
+ *
218
+ * @param string $id The unique identifier for the object
219
+ * @param callable $callable A service definition to extend the original
220
+ *
221
+ * @return callable The wrapped callable
222
+ *
223
+ * @throws \InvalidArgumentException if the identifier is not defined or not a service definition
224
+ */
225
+ public function extend($id, $callable)
226
+ {
227
+ if (!isset($this->keys[$id])) {
228
+ throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
229
+ }
230
+
231
+ if (!is_object($this->values[$id]) || !method_exists($this->values[$id], '__invoke')) {
232
+ throw new \InvalidArgumentException(sprintf('Identifier "%s" does not contain an object definition.', $id));
233
+ }
234
+
235
+ if (!is_object($callable) || !method_exists($callable, '__invoke')) {
236
+ throw new \InvalidArgumentException('Extension service definition is not a Closure or invokable object.');
237
+ }
238
+
239
+ $factory = $this->values[$id];
240
+
241
+ $extended = function ($c) use ($callable, $factory) {
242
+ return $callable($factory($c), $c);
243
+ };
244
+
245
+ if (isset($this->factories[$factory])) {
246
+ $this->factories->detach($factory);
247
+ $this->factories->attach($extended);
248
+ }
249
+
250
+ return $this[$id] = $extended;
251
+ }
252
+
253
+ /**
254
+ * Returns all defined value names.
255
+ *
256
+ * @return array An array of value names
257
+ */
258
+ public function keys()
259
+ {
260
+ return array_keys($this->values);
261
+ }
262
+
263
+ /**
264
+ * Registers a service provider.
265
+ *
266
+ * @param ServiceProviderInterface $provider A ServiceProviderInterface instance
267
+ * @param array $values An array of values that customizes the provider
268
+ *
269
+ * @return static
270
+ */
271
+ public function register(ServiceProviderInterface $provider, array $values = array())
272
+ {
273
+ $provider->register($this);
274
+
275
+ foreach ($values as $key => $value) {
276
+ $this[$key] = $value;
277
+ }
278
+
279
+ return $this;
280
+ }
281
+ }
trunk/src/di/interface-service-provider.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Pimple.
5
+ *
6
+ * Copyright (c) 2009 Fabien Potencier
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is furnished
13
+ * to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+
27
+ namespace Boxzilla\DI;
28
+
29
+ /**
30
+ * Pimple service provider interface.
31
+ *
32
+ * @author Fabien Potencier
33
+ * @author Dominik Zogg
34
+ */
35
+ interface ServiceProviderInterface
36
+ {
37
+ /**
38
+ * Registers services on the given container.
39
+ *
40
+ * This method should only be used to configure services and parameters.
41
+ * It should not get services.
42
+ *
43
+ * @param Container $container A Container instance
44
+ */
45
+ public function register(Container $container);
46
+ }
trunk/src/functions.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use Boxzilla\Boxzilla;
4
+
5
+ /**
6
+ * @return Boxzilla
7
+ */
8
+ function boxzilla() {
9
+ static $instance;
10
+
11
+ if( is_null( $instance ) ) {
12
+ $instance = new Boxzilla();
13
+ }
14
+
15
+ return $instance;
16
+ }
17
+
trunk/src/licensing/class-api-exception.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Licensing;
4
+
5
+ use Exception;
6
+
7
+ class API_Exception extends Exception {
8
+
9
+ /**
10
+ * @var string
11
+ */
12
+ protected $apiCode;
13
+
14
+ /**
15
+ * API_Exception constructor.
16
+ *
17
+ * @param string $message
18
+ * @param string $apiCode (optional)
19
+ */
20
+ public function __construct( $message, $apiCode = '' ) {
21
+ parent::__construct( $message );
22
+
23
+ $this->apiCode = $apiCode;
24
+ }
25
+
26
+ /**
27
+ * @return string
28
+ */
29
+ public function getApiCode() {
30
+ return $this->apiCode;
31
+ }
32
+
33
+ }
trunk/src/licensing/class-api.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Licensing;
4
+
5
+ use Boxzilla\Plugin;
6
+ use Exception;
7
+ use WP_Error;
8
+
9
+ class API {
10
+
11
+ /**
12
+ * @var License
13
+ */
14
+ protected $license;
15
+
16
+ /**
17
+ * The API url
18
+ *
19
+ * @var string
20
+ */
21
+ public $url = '';
22
+
23
+ /**
24
+ * @var int
25
+ */
26
+ protected $error_code = 0;
27
+
28
+ /**
29
+ * @var string
30
+ */
31
+ protected $error_message = '';
32
+
33
+ /**
34
+ * @var
35
+ */
36
+ protected $last_response;
37
+
38
+ /**
39
+ * @param string $url
40
+ * @param License $license
41
+ */
42
+ public function __construct( $url, License $license ) {
43
+ $this->url = $url;
44
+ $this->license = $license;
45
+ }
46
+
47
+ /**
48
+ * Gets license status
49
+ *
50
+ * @return object
51
+ */
52
+ public function get_license() {
53
+ $endpoint = '/license';
54
+ $response = $this->request( 'GET', $endpoint );
55
+ return $response;
56
+ }
57
+
58
+
59
+ /**
60
+ * Logs the current site in to the remote API
61
+ *
62
+ * @return object
63
+ */
64
+ public function activate_license() {
65
+ $endpoint = '/license/activations';
66
+ $args = array(
67
+ 'site_url' => get_option( 'siteurl' )
68
+ );
69
+ $response = $this->request( 'POST', $endpoint, $args );
70
+ return $response;
71
+ }
72
+
73
+ /**
74
+ * Logs the current site out of the remote API
75
+ *
76
+ * @return object
77
+ */
78
+ public function deactivate_license() {
79
+ $endpoint = sprintf( '/license/activations/%s', $this->license->activation_key );
80
+ $response = $this->request( 'DELETE', $endpoint );
81
+ return $response;
82
+ }
83
+
84
+ /**
85
+ * @param Plugin $plugin
86
+ * @return object
87
+ */
88
+ public function get_plugin( Plugin $plugin ) {
89
+ $endpoint = sprintf( '/plugins/%s?format=wp', $plugin->id() );
90
+ $response = $this->request( 'GET', $endpoint );
91
+ return $response;
92
+ }
93
+
94
+ /**
95
+ * @param Plugin[] $plugins (optional)
96
+ * @return object
97
+ */
98
+ public function get_plugins( $plugins = null ) {
99
+
100
+ $args = array(
101
+ 'format' => 'wp',
102
+ );
103
+
104
+ // create array of plugin sids if given
105
+ if( $plugins ) {
106
+ $plugin_slugs = $plugins->map(function( $p ) { return $p->id(); });
107
+ $args['sids'] = implode(',', $plugin_slugs );
108
+ }
109
+
110
+ $endpoint = add_query_arg( $args, '/plugins' );
111
+ $response = $this->request( 'GET', $endpoint );
112
+ return $response;
113
+ }
114
+
115
+ /**
116
+ * @param string $method
117
+ * @param string $endpoint
118
+ * @param array $data
119
+ *
120
+ * @return object|array
121
+ */
122
+ public function request( $method, $endpoint, $data = array() ) {
123
+
124
+ $url = $this->url . $endpoint;
125
+ $args = array(
126
+ 'method' => $method,
127
+ 'headers' => array(),
128
+ );
129
+
130
+ // add license key to headers if set
131
+ if( ! empty( $this->license->key ) ) {
132
+ $args['headers']['Authorization'] = 'Bearer ' . urlencode( $this->license->key );
133
+ }
134
+
135
+ if( in_array( $method, array( 'GET', 'DELETE' ) ) ) {
136
+ $url = add_query_arg( $data, $url );
137
+ } else {
138
+ $args['body'] = $data;
139
+ }
140
+
141
+ $response = wp_remote_request( $url, $args );
142
+ return $this->parse_response( $response );
143
+ }
144
+
145
+ /**
146
+ * @param mixed $response
147
+ *
148
+ * @return object|null
149
+ *
150
+ * @throws API_Exception
151
+ */
152
+ public function parse_response( $response ) {
153
+ // test for wp errors
154
+ if( $response instanceof WP_Error) {
155
+ throw new API_Exception( $response->get_error_message() );
156
+ }
157
+
158
+ // retrieve response body
159
+ $body = wp_remote_retrieve_body( $response );
160
+ $json = json_decode( $body );
161
+ if( ! is_object( $json ) ) {
162
+ throw new API_Exception( __( "The Boxzilla server returned an invalid response.", 'boxzilla' ) );
163
+ }
164
+
165
+ // did request return an error response?
166
+ if( isset( $json->error ) ) {
167
+ throw new API_Exception( $json->error->message, $json->error->code );
168
+ }
169
+
170
+ // return actual response data
171
+ return $json->data;
172
+ }
173
+
174
+ }
trunk/src/licensing/class-license-manager.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Licensing;
4
+
5
+ use Boxzilla\Admin\Notices;
6
+ use Boxzilla\Collection;
7
+ use Exception;
8
+
9
+ class LicenseManager {
10
+
11
+ /**
12
+ * @var array
13
+ */
14
+ protected $extensions = array();
15
+
16
+ /**
17
+ * @var License
18
+ */
19
+ protected $license;
20
+
21
+ /**
22
+ * @var API
23
+ */
24
+ protected $api;
25
+
26
+ /**
27
+ * @var Notices
28
+ */
29
+ protected $notices;
30
+
31
+ /**
32
+ * @param Collection $extensions
33
+ * @param API $api
34
+ * @param License $license
35
+ * @param Notices $notices
36
+ */
37
+ public function __construct( Collection $extensions, API $api, License $license, Notices $notices ) {
38
+ $this->extensions = $extensions;
39
+ $this->license = $license;
40
+ $this->api = $api;
41
+ $this->notices = $notices;
42
+ }
43
+
44
+ /**
45
+ * @param mixed $object
46
+ * @param string $property
47
+ * @param string $default
48
+ *
49
+ * @return string
50
+ */
51
+ protected function get_object_property( $object, $property, $default = '' ) {
52
+ return isset( $object->$property ) ? $object->$property : $default;
53
+ }
54
+
55
+ /**
56
+ * @return bool
57
+ */
58
+ public function hook() {
59
+
60
+ // do nothing if no extensions are registered at this point
61
+ if( count( $this->extensions ) === 0 ) {
62
+ return;
63
+ }
64
+
65
+ // hooks
66
+ add_action( 'boxzilla_after_settings', array( $this, 'show_license_form' ) );
67
+ add_action( 'admin_notices', array( $this, 'show_notice' ), 1 );
68
+
69
+ // listen for activation / deactivation requests
70
+ $this->listen();
71
+ }
72
+
73
+ /**
74
+ * Maybe show notice to activate license.
75
+ */
76
+ public function show_notice() {
77
+ global $current_screen;
78
+
79
+ if( $this->license->activated ) {
80
+ return;
81
+ }
82
+
83
+ if( $this->get_object_property( $current_screen, 'post_type' ) !== 'boxzilla-box' ) {
84
+ return;
85
+ }
86
+
87
+ $plugin = $this->extensions->random();
88
+ $this->notices->add( sprintf( 'Please <a href="%s">activate your Boxzilla license</a> to use %s.', admin_url( 'edit.php?post_type=boxzilla-box&page=boxzilla-settings' ), '<strong>' . $plugin->name() . '</strong>' ), 'warning' );
89
+ }
90
+
91
+ /**
92
+ * @return void
93
+ */
94
+ protected function listen() {
95
+
96
+ // do nothing if not authenticated
97
+ if( ! current_user_can( 'manage_options' ) ) {
98
+ return;
99
+ }
100
+
101
+ // nothing to do
102
+ if( ! isset( $_POST['boxzilla_license_form'] ) ) {
103
+ return;
104
+ }
105
+
106
+ $action = isset( $_POST['action'] ) ? $_POST['action'] : 'activate';
107
+ $key_changed = false;
108
+
109
+ // did key change or was "activate" button pressed?
110
+ $new_license_key = sanitize_text_field( $_POST['boxzilla_license_key'] );
111
+ if( $new_license_key !== $this->license->key ) {
112
+ $this->license->key = $new_license_key;
113
+ $key_changed = true;
114
+ }
115
+
116
+ // run actions
117
+ if( $action === 'deactivate' ) {
118
+ $this->deactivate_license();
119
+ } elseif( $action === 'activate' || $key_changed ) {
120
+ $this->activate_license();
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Deactivate the license
126
+ */
127
+ protected function deactivate_license() {
128
+ try {
129
+ $activation = $this->api->deactivate_license();
130
+ $this->notices->add( $activation->message, 'info' );
131
+ } catch( API_Exception $e ) {
132
+ $this->notices->add( $e->getMessage(), 'warning' );
133
+ }
134
+
135
+ $this->license->activated = false;
136
+ $this->license->activation_key = '';
137
+ $this->license->save();
138
+ }
139
+
140
+ /**
141
+ * Activate the license
142
+ */
143
+ protected function activate_license() {
144
+ try {
145
+ $activation = $this->api->activate_license();
146
+ } catch( API_Exception $e ) {
147
+ $this->notices->add( $e->getMessage(), 'warning' );
148
+ return;
149
+ }
150
+
151
+ $this->license->activation_key = $activation->key;
152
+ $this->license->activated = true;
153
+ $this->license->save();
154
+
155
+ $this->notices->add( $activation->message, 'info' );
156
+ }
157
+
158
+ /**
159
+ * Shows the license form
160
+ */
161
+ public function show_license_form() {
162
+ $license = $this->license;
163
+ require __DIR__ . '/views/license-form.php';
164
+ }
165
+
166
+ }
trunk/src/licensing/class-license-service-provider.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Licensing;
4
+
5
+ use Boxzilla\DI\Container,
6
+ Boxzilla\DI\ServiceProviderInterface;
7
+
8
+ class LicenseServiceProvider implements ServiceProviderInterface {
9
+
10
+ /**
11
+ * Registers all licensing related services
12
+ *
13
+ * @param Container $container
14
+ */
15
+ public function register( Container $container ) {
16
+
17
+ $container['license'] = function( $container ) {
18
+ return new License( 'boxzilla_license' );
19
+ };
20
+
21
+ $container['license_api'] = function( $container ) {
22
+ $api_url = 'https://api.boxzillaplugin.com/v1';
23
+ return new API( $api_url, $container['license'] );
24
+ };
25
+
26
+ $container['license_manager'] = function( $container ) {
27
+ return new LicenseManager( $container['plugins'], $container['license_api'], $container['license'], $container['notices'] );
28
+ };
29
+
30
+ $container['update_manager'] = function( $container ) {
31
+ return new UpdateManager( $container['plugins'], $container['license_api'], $container['license'] );
32
+ };
33
+
34
+ $container['license_poller'] = function( $container ) {
35
+ return new Poller( $container['license_api'], $container['license'] );
36
+ };
37
+ }
38
+
39
+ }
trunk/src/licensing/class-license.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Licensing;
4
+
5
+ /**
6
+ * Class License
7
+ *
8
+ *
9
+ * @property string $key
10
+ * @property string $site
11
+ * @property string $activation_key
12
+ * @property boolean $activated
13
+ * @property string $expires_at
14
+ *
15
+ * @package Boxzilla\Licensing
16
+ */
17
+ class License {
18
+
19
+ /**
20
+ * @var string The name of the option that holds the License data
21
+ */
22
+ protected $option_key = '';
23
+
24
+ /**
25
+ * @var bool Loaded?
26
+ */
27
+ protected $loaded = false;
28
+
29
+ /**
30
+ * @var bool Any changes?
31
+ */
32
+ protected $dirty = false;
33
+
34
+ /**
35
+ * @var array
36
+ */
37
+ protected $data;
38
+
39
+ /**
40
+ * @param string $option_key
41
+ */
42
+ public function __construct( $option_key ) {
43
+ $this->option_key = $option_key;
44
+ }
45
+
46
+ /**
47
+ * @param string $name
48
+ * @param mixed $value
49
+ */
50
+ public function __set($name, $value) {
51
+ $this->load();
52
+ $this->data[ $name ] = $value;
53
+ $this->dirty = true;
54
+ }
55
+
56
+ /**
57
+ * @param string $name
58
+ *
59
+ * @return mixed
60
+ */
61
+ public function __get($name) {
62
+ $this->load();
63
+ return $this->data[ $name ];
64
+ }
65
+
66
+ /**
67
+ * @param $name
68
+ *
69
+ * @return bool
70
+ */
71
+ public function __isset( $name ) {
72
+ $this->load();
73
+ return isset( $this->data[ $name ] );
74
+ }
75
+
76
+ /**
77
+ * Load the license data from the database
78
+ */
79
+ protected function load() {
80
+ static $defaults = array(
81
+ 'key' => '',
82
+ 'activation_key' => '',
83
+ 'activated' => false,
84
+ 'expires_at' => ''
85
+ );
86
+
87
+ if( ! $this->loaded ) {
88
+ $data = (array) get_option( $this->option_key, array() );
89
+ $this->data = array_replace( $defaults, $data );
90
+ $this->loaded = true;
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Reload the license data from DB
96
+ */
97
+ public function reload() {
98
+ $this->loaded = false;
99
+ $this->load();
100
+ }
101
+
102
+ /**
103
+ * Save the license in the database
104
+ *
105
+ * @return License
106
+ */
107
+ public function save() {
108
+ if( $this->dirty ) {
109
+ update_option( $this->option_key, $this->data );
110
+ $this->dirty = false;
111
+ }
112
+ }
113
+
114
+ }
trunk/src/licensing/class-poller.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Licensing;
4
+
5
+ class Poller {
6
+
7
+ /**
8
+ * @var API
9
+ */
10
+ protected $api;
11
+
12
+ /**
13
+ * @var License
14
+ */
15
+ protected $license;
16
+
17
+ /**
18
+ * Poller constructor.
19
+ *
20
+ * @param API $api
21
+ * @param License $license
22
+ */
23
+ public function __construct( API $api, License $license ) {
24
+ $this->api = $api;
25
+ $this->license = $license;
26
+ }
27
+
28
+ /**
29
+ * Add hooks.
30
+ */
31
+ public function hook() {
32
+ if( ! wp_next_scheduled( 'boxzilla_check_license_status' ) ) {
33
+ wp_schedule_event( time(), 'daily', 'boxzilla_check_license_status' );
34
+ };
35
+
36
+ add_action( 'boxzilla_check_license_status', array( $this, 'run' ) );
37
+ }
38
+
39
+ /**
40
+ * Run!
41
+ */
42
+ public function run() {
43
+ // don't run if license not active
44
+ if( ! $this->license->activated ) {
45
+ return;
46
+ }
47
+
48
+ // assume valid by default, in case of server errors on our side.
49
+ $license_still_valid = true;
50
+
51
+ try {
52
+ $remote_license = $this->api->get_license();
53
+ $license_still_valid = $remote_license->valid;
54
+ } catch( API_Exception $e ) {
55
+ // license key wasn't found or expired
56
+ if( in_array( $e->getApiCode(), array( 'license_invalid', 'license_expired' ) ) ) {
57
+ $license_still_valid = false;
58
+ }
59
+ }
60
+
61
+ if( ! $license_still_valid ) {
62
+ $this->license->activated = false;
63
+ $this->license->save();
64
+ }
65
+
66
+ }
67
+ }
trunk/src/licensing/class-update-manager.php ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Licensing;
4
+
5
+ use Boxzilla\Collection,
6
+ Boxzilla\Plugin,
7
+ Boxzilla\Admin\Notices;
8
+
9
+ class UpdateManager {
10
+
11
+ /**
12
+ * @var Collection
13
+ */
14
+ protected $extensions;
15
+
16
+ /**
17
+ * @var API
18
+ */
19
+ protected $api;
20
+
21
+ /**
22
+ * @var License
23
+ */
24
+ protected $license;
25
+
26
+ /**
27
+ * @var
28
+ */
29
+ protected $available_updates;
30
+
31
+ /**
32
+ * @param Collection $extensions
33
+ * @param API $api
34
+ * @param License $license
35
+ */
36
+ public function __construct( Collection $extensions, API $api, License $license ) {
37
+ $this->extensions = $extensions;
38
+ $this->license = $license;
39
+ $this->api = $api;
40
+ }
41
+
42
+ /**
43
+ * Add hooks
44
+ */
45
+ public function hook() {
46
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'add_updates' ) );
47
+ add_filter( 'plugins_api', array( $this, 'get_plugin_info' ), 20, 3 );
48
+ add_filter( 'http_request_args', array( $this, 'add_auth_headers' ), 10, 2 );
49
+ }
50
+
51
+ /**
52
+ * This adds the license key header to download package requests.
53
+ *
54
+ * @param array $args
55
+ * @param string $url
56
+ *
57
+ * @return mixed
58
+ */
59
+ public function add_auth_headers( $args, $url ) {
60
+ if( strpos( $url, $this->api->url ) !== 0 || strpos( $url, 'download' ) === false ) {
61
+ return $args;
62
+ }
63
+
64
+ if( empty( $args['headers'] ) ) {
65
+ $args['headers'] = array();
66
+ }
67
+
68
+ $args['headers']['Authorization'] = 'Bearer ' . urlencode( $this->license->key );
69
+ return $args;
70
+ }
71
+
72
+ /**
73
+ * @param $result
74
+ * @param string $action
75
+ * @param null $args
76
+ *
77
+ * @return object
78
+ */
79
+ public function get_plugin_info( $result, $action = '', $args = null ) {
80
+
81
+ // do nothing for unrelated requests
82
+ if( $action !== 'plugin_information' || ! isset( $args->slug ) ) {
83
+ return $result;
84
+ }
85
+
86
+ // only act on our plugins
87
+ $plugin = $this->extensions->find( function( $p ) use($args) {
88
+ return dirname( $p->slug() ) == $args->slug;
89
+ });
90
+
91
+ // was it a plugin of ours?
92
+ if( $plugin ) {
93
+ return $this->get_update_info( $plugin );
94
+ }
95
+
96
+ return $result;
97
+ }
98
+
99
+ /**
100
+ * @param object $updates
101
+ * @return object
102
+ */
103
+ public function add_updates( $updates ) {
104
+
105
+ // do nothing if no plugins registered
106
+ if( count( $this->extensions ) === 0 ) {
107
+ return $updates;
108
+ }
109
+
110
+ // failsafe WP bug
111
+ if( empty( $updates )
112
+ || empty( $updates->response )
113
+ || ! is_array( $updates->response ) ) {
114
+ return $updates;
115
+ }
116
+
117
+ // fetch available updates
118
+ $available_updates = $this->fetch_updates();
119
+
120
+ // merge with other updates
121
+ $updates->response = array_merge( $updates->response, $available_updates );
122
+
123
+ return $updates;
124
+ }
125
+
126
+ /**
127
+ * Fetch array of available updates from remote server
128
+ *
129
+ * @return array
130
+ */
131
+ protected function fetch_updates() {
132
+
133
+ if( is_array( $this->available_updates ) ) {
134
+ return $this->available_updates;
135
+ }
136
+
137
+ // fetch remote info
138
+ try {
139
+ $remote_plugins = $this->api->get_plugins( $this->extensions );
140
+ } catch( API_Exception $e ) {
141
+ return array();
142
+ }
143
+
144
+ // filter remote plugins, we only want the ones with an update available
145
+ $this->available_updates = $this->filter_remote_plugins( $remote_plugins );
146
+
147
+ return $this->available_updates;
148
+
149
+ }
150
+
151
+ /**
152
+ * @param $remote_plugins
153
+ * @return array
154
+ */
155
+ protected function filter_remote_plugins( $remote_plugins ) {
156
+
157
+ $available_updates = array();
158
+
159
+ // find new versions
160
+ foreach( $remote_plugins as $remote_plugin ) {
161
+
162
+ // find corresponding local plugin
163
+ /** @var Plugin $local_plugin */
164
+ $local_plugin = $this->extensions->find(
165
+ function( $local_plugin ) use( $remote_plugin ){
166
+ /** @var Plugin $local_plugin */
167
+ return $local_plugin->id() == $remote_plugin->sid;
168
+ }
169
+ );
170
+
171
+ // plugin found and local plugin version not same as remote version?
172
+ if( ! $local_plugin || version_compare( $local_plugin->version(), $remote_plugin->version, '>=' ) ) {
173
+ continue;
174
+ }
175
+
176
+ // add some dynamic data
177
+ $available_updates[ $local_plugin->slug() ] = $this->format_response( $local_plugin, $remote_plugin );
178
+ }
179
+
180
+ return $available_updates;
181
+ }
182
+
183
+ /**
184
+ * @param Plugin $plugin
185
+ *
186
+ * @return null
187
+ */
188
+ public function get_update_info( Plugin $plugin ) {
189
+ $available_updates = $this->fetch_updates();
190
+
191
+ if( isset( $available_updates[ $plugin->slug() ] ) ) {
192
+ return $available_updates[ $plugin->slug() ];
193
+ }
194
+
195
+ return null;
196
+ }
197
+
198
+ /**
199
+ * @param Plugin $plugin
200
+ * @param $response
201
+ *
202
+ * @return mixed
203
+ */
204
+ protected function format_response( Plugin $plugin, $response ) {
205
+ $response->new_version = $response->version;
206
+ $response->slug = dirname( $plugin->slug() );
207
+ $response->plugin = $plugin->slug();
208
+
209
+ // add some notices if license is inactive
210
+ if( ! $this->license->activated ) {
211
+ $response->upgrade_notice = sprintf( 'You will need to <a href="%s">activate your license</a> to install this plugin update.', admin_url( 'edit.php?post_type=boxzilla-box&page=boxzilla-settings' ) );
212
+ $response->sections->changelog = '<p>' . sprintf( 'You will need to <a href="%s" target="_top">activate your license</a> to install this plugin update.', admin_url( 'edit.php?post_type=boxzilla-box&page=boxzilla-settings' ) ) . '</p>' . $response->sections->changelog;
213
+ $response->package = null;
214
+ } else {
215
+ // add activation key to download URL
216
+ $response->package = add_query_arg( array( 'key' => $this->license->activation_key ), $response->package );
217
+ }
218
+
219
+ // cast subkey objects to array as that is what WP expects
220
+ $response->sections = get_object_vars( $response->sections );
221
+ $response->banners = get_object_vars( $response->banners );
222
+
223
+ return $response;
224
+ }
225
+
226
+ }
trunk/src/licensing/views/license-form.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // prevent direct file access
3
+ defined( 'ABSPATH' ) or exit;
4
+
5
+ /** @var Boxzilla\Licensing\License $license */
6
+ ?>
7
+
8
+ <h2><?php _e( 'License & Plugin Updates', 'boxzilla' ); ?></h2>
9
+
10
+ <?php if( ! $license->activated ) { ?>
11
+ <div class="error inline">
12
+ <p>
13
+ <strong><?php _e( 'Warning! You are <u>not</u> receiving plugin updates for the following plugin(s):', 'boxzilla' ); ?></strong>
14
+ </p>
15
+ <ul class="ul-square">
16
+ <li><?php echo join( '</li><li>', $this->extensions->map(function($p) { return $p->name(); }) ); ?></li>
17
+ </ul>
18
+ <p>
19
+ To fix this, please activate your license using the form below.
20
+ </p>
21
+ </div>
22
+ <?php } ?>
23
+
24
+ <form method="post">
25
+ <table class="form-table">
26
+ <tr valign="top">
27
+ <th><?php _e( 'License Key', 'boxzilla' ); ?></th>
28
+ <td>
29
+ <input size="40" name="boxzilla_license_key" placeholder="<?php esc_attr_e( 'Enter your license key..', 'boxzilla' ); ?>" value="<?php echo esc_attr( $this->license->key ); ?>" <?php if( $this->license->activated ) { echo 'readonly'; } ?> />
30
+ <input class="button" type="submit" name="action" value="<?php echo ( $this->license->activated ) ? 'deactivate' : 'activate'; ?>" />
31
+ <p class="help">
32
+ <?php echo sprintf( __( 'The license key received when purchasing your premium Boxzilla plan. <a href="%s">You can find it here</a>.', 'boxzilla' ), 'https://account.boxzillaplugin.com/' ); ?>
33
+ </p>
34
+ </td>
35
+ </tr>
36
+ <tr valign="top">
37
+ <th><?php _e( 'License Status', 'boxzilla' ); ?></th>
38
+ <td>
39
+ <?php
40
+ if( $license->activated ) { ?>
41
+ <p><span class="status positive"><?php _e( 'ACTIVE', 'boxzilla' ); ?></span> - <?php _e( 'you are receiving plugin updates', 'boxzilla' ); ?></p>
42
+ <?php } else { ?>
43
+ <p><span class="status negative"><?php _e( 'INACTIVE', 'boxzilla' ); ?></span> - <?php _e( 'you are <strong>not</strong> receiving plugin updates', 'boxzilla' ); ?></p>
44
+ <?php } ?>
45
+ </td>
46
+ </tr>
47
+ </table>
48
+
49
+
50
+
51
+
52
+ <p>
53
+ <input type="submit" class="button button-primary" name="action" value="<?php _e( 'Save Changes' ); ?>" />
54
+ </p>
55
+
56
+ <input type="hidden" name="boxzilla_license_form" value="1" />
57
+ </form>
trunk/vendor/autoload.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer' . '/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit38e5bd5c00bdfd9a6ae58e314c6ae5ae::getLoader();
trunk/vendor/composer/ClassLoader.php ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Autoload;
14
+
15
+ /**
16
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17
+ *
18
+ * $loader = new \Composer\Autoload\ClassLoader();
19
+ *
20
+ * // register classes with namespaces
21
+ * $loader->add('Symfony\Component', __DIR__.'/component');
22
+ * $loader->add('Symfony', __DIR__.'/framework');
23
+ *
24
+ * // activate the autoloader
25
+ * $loader->register();
26
+ *
27
+ * // to enable searching the include path (eg. for PEAR packages)
28
+ * $loader->setUseIncludePath(true);
29
+ *
30
+ * In this example, if you try to use a class in the Symfony\Component
31
+ * namespace or one of its children (Symfony\Component\Console for instance),
32
+ * the autoloader will first look for the class under the component/
33
+ * directory, and it will then fallback to the framework/ directory if not
34
+ * found before giving up.
35
+ *
36
+ * This class is loosely based on the Symfony UniversalClassLoader.
37
+ *
38
+ * @author Fabien Potencier <fabien@symfony.com>
39
+ * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
42
+ */
43
+ class ClassLoader
44
+ {
45
+ // PSR-4
46
+ private $prefixLengthsPsr4 = array();
47
+ private $prefixDirsPsr4 = array();
48
+ private $fallbackDirsPsr4 = array();
49
+
50
+ // PSR-0
51
+ private $prefixesPsr0 = array();
52
+ private $fallbackDirsPsr0 = array();
53
+
54
+ private $useIncludePath = false;
55
+ private $classMap = array();
56
+ private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
58
+
59
+ public function getPrefixes()
60
+ {
61
+ if (!empty($this->prefixesPsr0)) {
62
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
63
+ }
64
+
65
+ return array();
66
+ }
67
+
68
+ public function getPrefixesPsr4()
69
+ {
70
+ return $this->prefixDirsPsr4;
71
+ }
72
+
73
+ public function getFallbackDirs()
74
+ {
75
+ return $this->fallbackDirsPsr0;
76
+ }
77
+
78
+ public function getFallbackDirsPsr4()
79
+ {
80
+ return $this->fallbackDirsPsr4;
81
+ }
82
+
83
+ public function getClassMap()
84
+ {
85
+ return $this->classMap;
86
+ }
87
+
88
+ /**
89
+ * @param array $classMap Class to filename map
90
+ */
91
+ public function addClassMap(array $classMap)
92
+ {
93
+ if ($this->classMap) {
94
+ $this->classMap = array_merge($this->classMap, $classMap);
95
+ } else {
96
+ $this->classMap = $classMap;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Registers a set of PSR-0 directories for a given prefix, either
102
+ * appending or prepending to the ones previously set for this prefix.
103
+ *
104
+ * @param string $prefix The prefix
105
+ * @param array|string $paths The PSR-0 root directories
106
+ * @param bool $prepend Whether to prepend the directories
107
+ */
108
+ public function add($prefix, $paths, $prepend = false)
109
+ {
110
+ if (!$prefix) {
111
+ if ($prepend) {
112
+ $this->fallbackDirsPsr0 = array_merge(
113
+ (array) $paths,
114
+ $this->fallbackDirsPsr0
115
+ );
116
+ } else {
117
+ $this->fallbackDirsPsr0 = array_merge(
118
+ $this->fallbackDirsPsr0,
119
+ (array) $paths
120
+ );
121
+ }
122
+
123
+ return;
124
+ }
125
+
126
+ $first = $prefix[0];
127
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
128
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
129
+
130
+ return;
131
+ }
132
+ if ($prepend) {
133
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
134
+ (array) $paths,
135
+ $this->prefixesPsr0[$first][$prefix]
136
+ );
137
+ } else {
138
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
139
+ $this->prefixesPsr0[$first][$prefix],
140
+ (array) $paths
141
+ );
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Registers a set of PSR-4 directories for a given namespace, either
147
+ * appending or prepending to the ones previously set for this namespace.
148
+ *
149
+ * @param string $prefix The prefix/namespace, with trailing '\\'
150
+ * @param array|string $paths The PSR-4 base directories
151
+ * @param bool $prepend Whether to prepend the directories
152
+ *
153
+ * @throws \InvalidArgumentException
154
+ */
155
+ public function addPsr4($prefix, $paths, $prepend = false)
156
+ {
157
+ if (!$prefix) {
158
+ // Register directories for the root namespace.
159
+ if ($prepend) {
160
+ $this->fallbackDirsPsr4 = array_merge(
161
+ (array) $paths,
162
+ $this->fallbackDirsPsr4
163
+ );
164
+ } else {
165
+ $this->fallbackDirsPsr4 = array_merge(
166
+ $this->fallbackDirsPsr4,
167
+ (array) $paths
168
+ );
169
+ }
170
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
171
+ // Register directories for a new namespace.
172
+ $length = strlen($prefix);
173
+ if ('\\' !== $prefix[$length - 1]) {
174
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
175
+ }
176
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
177
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
178
+ } elseif ($prepend) {
179
+ // Prepend directories for an already registered namespace.
180
+ $this->prefixDirsPsr4[$prefix] = array_merge(
181
+ (array) $paths,
182
+ $this->prefixDirsPsr4[$prefix]
183
+ );
184
+ } else {
185
+ // Append directories for an already registered namespace.
186
+ $this->prefixDirsPsr4[$prefix] = array_merge(
187
+ $this->prefixDirsPsr4[$prefix],
188
+ (array) $paths
189
+ );
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Registers a set of PSR-0 directories for a given prefix,
195
+ * replacing any others previously set for this prefix.
196
+ *
197
+ * @param string $prefix The prefix
198
+ * @param array|string $paths The PSR-0 base directories
199
+ */
200
+ public function set($prefix, $paths)
201
+ {
202
+ if (!$prefix) {
203
+ $this->fallbackDirsPsr0 = (array) $paths;
204
+ } else {
205
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Registers a set of PSR-4 directories for a given namespace,
211
+ * replacing any others previously set for this namespace.
212
+ *
213
+ * @param string $prefix The prefix/namespace, with trailing '\\'
214
+ * @param array|string $paths The PSR-4 base directories
215
+ *
216
+ * @throws \InvalidArgumentException
217
+ */
218
+ public function setPsr4($prefix, $paths)
219
+ {
220
+ if (!$prefix) {
221
+ $this->fallbackDirsPsr4 = (array) $paths;
222
+ } else {
223
+ $length = strlen($prefix);
224
+ if ('\\' !== $prefix[$length - 1]) {
225
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
226
+ }
227
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
228
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Turns on searching the include path for class files.
234
+ *
235
+ * @param bool $useIncludePath
236
+ */
237
+ public function setUseIncludePath($useIncludePath)
238
+ {
239
+ $this->useIncludePath = $useIncludePath;
240
+ }
241
+
242
+ /**
243
+ * Can be used to check if the autoloader uses the include path to check
244
+ * for classes.
245
+ *
246
+ * @return bool
247
+ */
248
+ public function getUseIncludePath()
249
+ {
250
+ return $this->useIncludePath;
251
+ }
252
+
253
+ /**
254
+ * Turns off searching the prefix and fallback directories for classes
255
+ * that have not been registered with the class map.
256
+ *
257
+ * @param bool $classMapAuthoritative
258
+ */
259
+ public function setClassMapAuthoritative($classMapAuthoritative)
260
+ {
261
+ $this->classMapAuthoritative = $classMapAuthoritative;
262
+ }
263
+
264
+ /**
265
+ * Should class lookup fail if not found in the current class map?
266
+ *
267
+ * @return bool
268
+ */
269
+ public function isClassMapAuthoritative()
270
+ {
271
+ return $this->classMapAuthoritative;
272
+ }
273
+
274
+ /**
275
+ * Registers this instance as an autoloader.
276
+ *
277
+ * @param bool $prepend Whether to prepend the autoloader or not
278
+ */
279
+ public function register($prepend = false)
280
+ {
281
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
282
+ }
283
+
284
+ /**
285
+ * Unregisters this instance as an autoloader.
286
+ */
287
+ public function unregister()
288
+ {
289
+ spl_autoload_unregister(array($this, 'loadClass'));
290
+ }
291
+
292
+ /**
293
+ * Loads the given class or interface.
294
+ *
295
+ * @param string $class The name of the class
296
+ * @return bool|null True if loaded, null otherwise
297
+ */
298
+ public function loadClass($class)
299
+ {
300
+ if ($file = $this->findFile($class)) {
301
+ includeFile($file);
302
+
303
+ return true;
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Finds the path to the file where the class is defined.
309
+ *
310
+ * @param string $class The name of the class
311
+ *
312
+ * @return string|false The path if found, false otherwise
313
+ */
314
+ public function findFile($class)
315
+ {
316
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
+ if ('\\' == $class[0]) {
318
+ $class = substr($class, 1);
319
+ }
320
+
321
+ // class map lookup
322
+ if (isset($this->classMap[$class])) {
323
+ return $this->classMap[$class];
324
+ }
325
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
326
+ return false;
327
+ }
328
+
329
+ $file = $this->findFileWithExtension($class, '.php');
330
+
331
+ // Search for Hack files if we are running on HHVM
332
+ if (false === $file && defined('HHVM_VERSION')) {
333
+ $file = $this->findFileWithExtension($class, '.hh');
334
+ }
335
+
336
+ if (false === $file) {
337
+ // Remember that this class does not exist.
338
+ $this->missingClasses[$class] = true;
339
+ }
340
+
341
+ return $file;
342
+ }
343
+
344
+ private function findFileWithExtension($class, $ext)
345
+ {
346
+ // PSR-4 lookup
347
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
348
+
349
+ $first = $class[0];
350
+ if (isset($this->prefixLengthsPsr4[$first])) {
351
+ foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
352
+ if (0 === strpos($class, $prefix)) {
353
+ foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
354
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
355
+ return $file;
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ // PSR-4 fallback dirs
363
+ foreach ($this->fallbackDirsPsr4 as $dir) {
364
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
365
+ return $file;
366
+ }
367
+ }
368
+
369
+ // PSR-0 lookup
370
+ if (false !== $pos = strrpos($class, '\\')) {
371
+ // namespaced class name
372
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
373
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
374
+ } else {
375
+ // PEAR-like class name
376
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
377
+ }
378
+
379
+ if (isset($this->prefixesPsr0[$first])) {
380
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
381
+ if (0 === strpos($class, $prefix)) {
382
+ foreach ($dirs as $dir) {
383
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
384
+ return $file;
385
+ }
386
+ }
387
+ }
388
+ }
389
+ }
390
+
391
+ // PSR-0 fallback dirs
392
+ foreach ($this->fallbackDirsPsr0 as $dir) {
393
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
394
+ return $file;
395
+ }
396
+ }
397
+
398
+ // PSR-0 include paths.
399
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
+ return $file;
401
+ }
402
+
403
+ return false;
404
+ }
405
+ }
406
+
407
+ /**
408
+ * Scope isolated include.
409
+ *
410
+ * Prevents access to $this/self from included files.
411
+ */
412
+ function includeFile($file)
413
+ {
414
+ include $file;
415
+ }
trunk/vendor/composer/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished
9
+ to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+
trunk/vendor/composer/autoload_classmap.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'Boxzilla\\Admin\\Admin' => $baseDir . '/src/admin/class-admin.php',
10
+ 'Boxzilla\\Admin\\Installer' => $baseDir . '/src/admin/class-installer.php',
11
+ 'Boxzilla\\Admin\\Migrations' => $baseDir . '/src/admin/class-migrations.php',
12
+ 'Boxzilla\\Admin\\Notices' => $baseDir . '/src/admin/class-notices.php',
13
+ 'Boxzilla\\Admin\\ReviewNotice' => $baseDir . '/src/admin/class-review-notice.php',
14
+ 'Boxzilla\\Bootstrapper' => $baseDir . '/src/class-bootstrapper.php',
15
+ 'Boxzilla\\Box' => $baseDir . '/src/class-box.php',
16
+ 'Boxzilla\\BoxLoader' => $baseDir . '/src/class-loader.php',
17
+ 'Boxzilla\\Boxzilla' => $baseDir . '/src/class-boxzilla.php',
18
+ 'Boxzilla\\BoxzillaServiceProvider' => $baseDir . '/src/class-boxzilla-service-provider.php',
19
+ 'Boxzilla\\Collection' => $baseDir . '/src/class-collection.php',
20
+ 'Boxzilla\\DI\\Container' => $baseDir . '/src/di/class-container.php',
21
+ 'Boxzilla\\DI\\ContainerWithPropertyAccess' => $baseDir . '/src/di/class-container-with-property-access.php',
22
+ 'Boxzilla\\DI\\ServiceProviderInterface' => $baseDir . '/src/di/interface-service-provider.php',
23
+ 'Boxzilla\\Filter\\Autocomplete' => $baseDir . '/src/admin/class-autocomplete.php',
24
+ 'Boxzilla\\Licensing\\API' => $baseDir . '/src/licensing/class-api.php',
25
+ 'Boxzilla\\Licensing\\API_Exception' => $baseDir . '/src/licensing/class-api-exception.php',
26
+ 'Boxzilla\\Licensing\\License' => $baseDir . '/src/licensing/class-license.php',
27
+ 'Boxzilla\\Licensing\\LicenseManager' => $baseDir . '/src/licensing/class-license-manager.php',
28
+ 'Boxzilla\\Licensing\\LicenseServiceProvider' => $baseDir . '/src/licensing/class-license-service-provider.php',
29
+ 'Boxzilla\\Licensing\\Poller' => $baseDir . '/src/licensing/class-poller.php',
30
+ 'Boxzilla\\Licensing\\UpdateManager' => $baseDir . '/src/licensing/class-update-manager.php',
31
+ 'Boxzilla\\Plugin' => $baseDir . '/src/class-plugin.php',
32
+ 'Boxzilla_PHP_Fallback' => $baseDir . '/src/class-php-fallback.php',
33
+ );
trunk/vendor/composer/autoload_files.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_files.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ '94cc07ee52e9ca5ddcd07a46efdfe8cc' => $baseDir . '/src/functions.php',
10
+ );
trunk/vendor/composer/autoload_namespaces.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_namespaces.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
trunk/vendor/composer/autoload_psr4.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_psr4.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
trunk/vendor/composer/autoload_real.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit38e5bd5c00bdfd9a6ae58e314c6ae5ae
6
+ {
7
+ private static $loader;
8
+
9
+ public static function loadClassLoader($class)
10
+ {
11
+ if ('Composer\Autoload\ClassLoader' === $class) {
12
+ require __DIR__ . '/ClassLoader.php';
13
+ }
14
+ }
15
+
16
+ public static function getLoader()
17
+ {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit38e5bd5c00bdfd9a6ae58e314c6ae5ae', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit38e5bd5c00bdfd9a6ae58e314c6ae5ae', 'loadClassLoader'));
25
+
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
27
+ if ($useStaticLoader) {
28
+ require_once __DIR__ . '/autoload_static.php';
29
+
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit38e5bd5c00bdfd9a6ae58e314c6ae5ae::getInitializer($loader));
31
+ } else {
32
+ $map = require __DIR__ . '/autoload_namespaces.php';
33
+ foreach ($map as $namespace => $path) {
34
+ $loader->set($namespace, $path);
35
+ }
36
+
37
+ $map = require __DIR__ . '/autoload_psr4.php';
38
+ foreach ($map as $namespace => $path) {
39
+ $loader->setPsr4($namespace, $path);
40
+ }
41
+
42
+ $classMap = require __DIR__ . '/autoload_classmap.php';
43
+ if ($classMap) {
44
+ $loader->addClassMap($classMap);
45
+ }
46
+ }
47
+
48
+ $loader->register(true);
49
+
50
+ if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit38e5bd5c00bdfd9a6ae58e314c6ae5ae::$files;
52
+ } else {
53
+ $includeFiles = require __DIR__ . '/autoload_files.php';
54
+ }
55
+ foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire38e5bd5c00bdfd9a6ae58e314c6ae5ae($fileIdentifier, $file);
57
+ }
58
+
59
+ return $loader;
60
+ }
61
+ }
62
+
63
+ function composerRequire38e5bd5c00bdfd9a6ae58e314c6ae5ae($fileIdentifier, $file)
64
+ {
65
+ if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
+ require $file;
67
+
68
+ $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
69
+ }
70
+ }
trunk/vendor/composer/autoload_static.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_static.php @generated by Composer
4
+
5
+ namespace Composer\Autoload;
6
+
7
+ class ComposerStaticInit38e5bd5c00bdfd9a6ae58e314c6ae5ae
8
+ {
9
+ public static $files = array (
10
+ '94cc07ee52e9ca5ddcd07a46efdfe8cc' => __DIR__ . '/../..' . '/src/functions.php',
11
+ );
12
+
13
+ public static $classMap = array (
14
+ 'Boxzilla\\Admin\\Admin' => __DIR__ . '/../..' . '/src/admin/class-admin.php',
15
+ 'Boxzilla\\Admin\\Installer' => __DIR__ . '/../..' . '/src/admin/class-installer.php',
16
+ 'Boxzilla\\Admin\\Migrations' => __DIR__ . '/../..' . '/src/admin/class-migrations.php',
17
+ 'Boxzilla\\Admin\\Notices' => __DIR__ . '/../..' . '/src/admin/class-notices.php',
18
+ 'Boxzilla\\Admin\\ReviewNotice' => __DIR__ . '/../..' . '/src/admin/class-review-notice.php',
19
+ 'Boxzilla\\Bootstrapper' => __DIR__ . '/../..' . '/src/class-bootstrapper.php',
20
+ 'Boxzilla\\Box' => __DIR__ . '/../..' . '/src/class-box.php',
21
+ 'Boxzilla\\BoxLoader' => __DIR__ . '/../..' . '/src/class-loader.php',
22
+ 'Boxzilla\\Boxzilla' => __DIR__ . '/../..' . '/src/class-boxzilla.php',
23
+ 'Boxzilla\\BoxzillaServiceProvider' => __DIR__ . '/../..' . '/src/class-boxzilla-service-provider.php',
24
+ 'Boxzilla\\Collection' => __DIR__ . '/../..' . '/src/class-collection.php',
25
+ 'Boxzilla\\DI\\Container' => __DIR__ . '/../..' . '/src/di/class-container.php',
26
+ 'Boxzilla\\DI\\ContainerWithPropertyAccess' => __DIR__ . '/../..' . '/src/di/class-container-with-property-access.php',
27
+ 'Boxzilla\\DI\\ServiceProviderInterface' => __DIR__ . '/../..' . '/src/di/interface-service-provider.php',
28
+ 'Boxzilla\\Filter\\Autocomplete' => __DIR__ . '/../..' . '/src/admin/class-autocomplete.php',
29
+ 'Boxzilla\\Licensing\\API' => __DIR__ . '/../..' . '/src/licensing/class-api.php',
30
+ 'Boxzilla\\Licensing\\API_Exception' => __DIR__ . '/../..' . '/src/licensing/class-api-exception.php',
31
+ 'Boxzilla\\Licensing\\License' => __DIR__ . '/../..' . '/src/licensing/class-license.php',
32
+ 'Boxzilla\\Licensing\\LicenseManager' => __DIR__ . '/../..' . '/src/licensing/class-license-manager.php',
33
+ 'Boxzilla\\Licensing\\LicenseServiceProvider' => __DIR__ . '/../..' . '/src/licensing/class-license-service-provider.php',
34
+ 'Boxzilla\\Licensing\\Poller' => __DIR__ . '/../..' . '/src/licensing/class-poller.php',
35
+ 'Boxzilla\\Licensing\\UpdateManager' => __DIR__ . '/../..' . '/src/licensing/class-update-manager.php',
36
+ 'Boxzilla\\Plugin' => __DIR__ . '/../..' . '/src/class-plugin.php',
37
+ 'Boxzilla_PHP_Fallback' => __DIR__ . '/../..' . '/src/class-php-fallback.php',
38
+ );
39
+
40
+ public static function getInitializer(ClassLoader $loader)
41
+ {
42
+ return \Closure::bind(function () use ($loader) {
43
+ $loader->classMap = ComposerStaticInit38e5bd5c00bdfd9a6ae58e314c6ae5ae::$classMap;
44
+
45
+ }, null, ClassLoader::class);
46
+ }
47
+ }
trunk/vendor/composer/installed.json ADDED
@@ -0,0 +1 @@
 
1
+ []
vendor/composer/ClassLoader.php CHANGED
@@ -53,8 +53,8 @@ class ClassLoader
53
 
54
  private $useIncludePath = false;
55
  private $classMap = array();
56
-
57
  private $classMapAuthoritative = false;
 
58
 
59
  public function getPrefixes()
60
  {
@@ -322,20 +322,20 @@ class ClassLoader
322
  if (isset($this->classMap[$class])) {
323
  return $this->classMap[$class];
324
  }
325
- if ($this->classMapAuthoritative) {
326
  return false;
327
  }
328
 
329
  $file = $this->findFileWithExtension($class, '.php');
330
 
331
  // Search for Hack files if we are running on HHVM
332
- if ($file === null && defined('HHVM_VERSION')) {
333
  $file = $this->findFileWithExtension($class, '.hh');
334
  }
335
 
336
- if ($file === null) {
337
  // Remember that this class does not exist.
338
- return $this->classMap[$class] = false;
339
  }
340
 
341
  return $file;
@@ -399,6 +399,8 @@ class ClassLoader
399
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
  return $file;
401
  }
 
 
402
  }
403
  }
404
 
53
 
54
  private $useIncludePath = false;
55
  private $classMap = array();
 
56
  private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
58
 
59
  public function getPrefixes()
60
  {
322
  if (isset($this->classMap[$class])) {
323
  return $this->classMap[$class];
324
  }
325
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
326
  return false;
327
  }
328
 
329
  $file = $this->findFileWithExtension($class, '.php');
330
 
331
  // Search for Hack files if we are running on HHVM
332
+ if (false === $file && defined('HHVM_VERSION')) {
333
  $file = $this->findFileWithExtension($class, '.hh');
334
  }
335
 
336
+ if (false === $file) {
337
  // Remember that this class does not exist.
338
+ $this->missingClasses[$class] = true;
339
  }
340
 
341
  return $file;
399
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
  return $file;
401
  }
402
+
403
+ return false;
404
  }
405
  }
406
 
vendor/composer/autoload_classmap.php CHANGED
@@ -10,6 +10,7 @@ return array(
10
  'Boxzilla\\Admin\\Installer' => $baseDir . '/src/admin/class-installer.php',
11
  'Boxzilla\\Admin\\Migrations' => $baseDir . '/src/admin/class-migrations.php',
12
  'Boxzilla\\Admin\\Notices' => $baseDir . '/src/admin/class-notices.php',
 
13
  'Boxzilla\\Bootstrapper' => $baseDir . '/src/class-bootstrapper.php',
14
  'Boxzilla\\Box' => $baseDir . '/src/class-box.php',
15
  'Boxzilla\\BoxLoader' => $baseDir . '/src/class-loader.php',
10
  'Boxzilla\\Admin\\Installer' => $baseDir . '/src/admin/class-installer.php',
11
  'Boxzilla\\Admin\\Migrations' => $baseDir . '/src/admin/class-migrations.php',
12
  'Boxzilla\\Admin\\Notices' => $baseDir . '/src/admin/class-notices.php',
13
+ 'Boxzilla\\Admin\\ReviewNotice' => $baseDir . '/src/admin/class-review-notice.php',
14
  'Boxzilla\\Bootstrapper' => $baseDir . '/src/class-bootstrapper.php',
15
  'Boxzilla\\Box' => $baseDir . '/src/class-box.php',
16
  'Boxzilla\\BoxLoader' => $baseDir . '/src/class-loader.php',
vendor/composer/autoload_real.php CHANGED
@@ -23,24 +23,35 @@ class ComposerAutoloaderInit38e5bd5c00bdfd9a6ae58e314c6ae5ae
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
  spl_autoload_unregister(array('ComposerAutoloaderInit38e5bd5c00bdfd9a6ae58e314c6ae5ae', 'loadClassLoader'));
25
 
26
- $map = require __DIR__ . '/autoload_namespaces.php';
27
- foreach ($map as $namespace => $path) {
28
- $loader->set($namespace, $path);
29
- }
30
 
31
- $map = require __DIR__ . '/autoload_psr4.php';
32
- foreach ($map as $namespace => $path) {
33
- $loader->setPsr4($namespace, $path);
34
- }
 
 
35
 
36
- $classMap = require __DIR__ . '/autoload_classmap.php';
37
- if ($classMap) {
38
- $loader->addClassMap($classMap);
 
 
 
 
 
 
39
  }
40
 
41
  $loader->register(true);
42
 
43
- $includeFiles = require __DIR__ . '/autoload_files.php';
 
 
 
 
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
  composerRequire38e5bd5c00bdfd9a6ae58e314c6ae5ae($fileIdentifier, $file);
46
  }
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
  spl_autoload_unregister(array('ComposerAutoloaderInit38e5bd5c00bdfd9a6ae58e314c6ae5ae', 'loadClassLoader'));
25
 
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
27
+ if ($useStaticLoader) {
28
+ require_once __DIR__ . '/autoload_static.php';
 
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit38e5bd5c00bdfd9a6ae58e314c6ae5ae::getInitializer($loader));
31
+ } else {
32
+ $map = require __DIR__ . '/autoload_namespaces.php';
33
+ foreach ($map as $namespace => $path) {
34
+ $loader->set($namespace, $path);
35
+ }
36
 
37
+ $map = require __DIR__ . '/autoload_psr4.php';
38
+ foreach ($map as $namespace => $path) {
39
+ $loader->setPsr4($namespace, $path);
40
+ }
41
+
42
+ $classMap = require __DIR__ . '/autoload_classmap.php';
43
+ if ($classMap) {
44
+ $loader->addClassMap($classMap);
45
+ }
46
  }
47
 
48
  $loader->register(true);
49
 
50
+ if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit38e5bd5c00bdfd9a6ae58e314c6ae5ae::$files;
52
+ } else {
53
+ $includeFiles = require __DIR__ . '/autoload_files.php';
54
+ }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
  composerRequire38e5bd5c00bdfd9a6ae58e314c6ae5ae($fileIdentifier, $file);
57
  }
vendor/composer/autoload_static.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_static.php @generated by Composer
4
+
5
+ namespace Composer\Autoload;
6
+
7
+ class ComposerStaticInit38e5bd5c00bdfd9a6ae58e314c6ae5ae
8
+ {
9
+ public static $files = array (
10
+ '94cc07ee52e9ca5ddcd07a46efdfe8cc' => __DIR__ . '/../..' . '/src/functions.php',
11
+ );
12
+
13
+ public static $classMap = array (
14
+ 'Boxzilla\\Admin\\Admin' => __DIR__ . '/../..' . '/src/admin/class-admin.php',
15
+ 'Boxzilla\\Admin\\Installer' => __DIR__ . '/../..' . '/src/admin/class-installer.php',
16
+ 'Boxzilla\\Admin\\Migrations' => __DIR__ . '/../..' . '/src/admin/class-migrations.php',
17
+ 'Boxzilla\\Admin\\Notices' => __DIR__ . '/../..' . '/src/admin/class-notices.php',
18
+ 'Boxzilla\\Admin\\ReviewNotice' => __DIR__ . '/../..' . '/src/admin/class-review-notice.php',
19
+ 'Boxzilla\\Bootstrapper' => __DIR__ . '/../..' . '/src/class-bootstrapper.php',
20
+ 'Boxzilla\\Box' => __DIR__ . '/../..' . '/src/class-box.php',
21
+ 'Boxzilla\\BoxLoader' => __DIR__ . '/../..' . '/src/class-loader.php',
22
+ 'Boxzilla\\Boxzilla' => __DIR__ . '/../..' . '/src/class-boxzilla.php',
23
+ 'Boxzilla\\BoxzillaServiceProvider' => __DIR__ . '/../..' . '/src/class-boxzilla-service-provider.php',
24
+ 'Boxzilla\\Collection' => __DIR__ . '/../..' . '/src/class-collection.php',
25
+ 'Boxzilla\\DI\\Container' => __DIR__ . '/../..' . '/src/di/class-container.php',
26
+ 'Boxzilla\\DI\\ContainerWithPropertyAccess' => __DIR__ . '/../..' . '/src/di/class-container-with-property-access.php',
27
+ 'Boxzilla\\DI\\ServiceProviderInterface' => __DIR__ . '/../..' . '/src/di/interface-service-provider.php',
28
+ 'Boxzilla\\Filter\\Autocomplete' => __DIR__ . '/../..' . '/src/admin/class-autocomplete.php',
29
+ 'Boxzilla\\Licensing\\API' => __DIR__ . '/../..' . '/src/licensing/class-api.php',
30
+ 'Boxzilla\\Licensing\\API_Exception' => __DIR__ . '/../..' . '/src/licensing/class-api-exception.php',
31
+ 'Boxzilla\\Licensing\\License' => __DIR__ . '/../..' . '/src/licensing/class-license.php',
32
+ 'Boxzilla\\Licensing\\LicenseManager' => __DIR__ . '/../..' . '/src/licensing/class-license-manager.php',
33
+ 'Boxzilla\\Licensing\\LicenseServiceProvider' => __DIR__ . '/../..' . '/src/licensing/class-license-service-provider.php',
34
+ 'Boxzilla\\Licensing\\Poller' => __DIR__ . '/../..' . '/src/licensing/class-poller.php',
35
+ 'Boxzilla\\Licensing\\UpdateManager' => __DIR__ . '/../..' . '/src/licensing/class-update-manager.php',
36
+ 'Boxzilla\\Plugin' => __DIR__ . '/../..' . '/src/class-plugin.php',
37
+ 'Boxzilla_PHP_Fallback' => __DIR__ . '/../..' . '/src/class-php-fallback.php',
38
+ );
39
+
40
+ public static function getInitializer(ClassLoader $loader)
41
+ {
42
+ return \Closure::bind(function () use ($loader) {
43
+ $loader->classMap = ComposerStaticInit38e5bd5c00bdfd9a6ae58e314c6ae5ae::$classMap;
44
+
45
+ }, null, ClassLoader::class);
46
+ }
47
+ }