Plugin Directory

Changeset 3049171


Ignore:
Timestamp:
03/11/2024 01:45:52 PM (2 years ago)
Author:
dkjensen
Message:

Update to version 2.8.0 from GitHub

Location:
wc-cart-pdf
Files:
13 added
1 deleted
26 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wc-cart-pdf/tags/2.8.0/assets/blocks/blocks.asset.php

    r3000367 r3049171  
    1 <?php return array('dependencies' => array('react', 'wp-blockEditor', 'wp-blocks', 'wp-i18n'), 'version' => 'b50906793e5e63fc');
     1<?php return array('dependencies' => array('react', 'wp-blockEditor', 'wp-blocks', 'wp-i18n'), 'version' => '82dad062ce6751b0');
  • wc-cart-pdf/tags/2.8.0/assets/blocks/blocks.js

    r3000367 r3049171  
    11/*! For license information please see blocks.js.LICENSE.txt */
    2 (()=>{var e={184:(e,t)=>{var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r)){if(r.length){var i=o.apply(null,r);i&&e.push(i)}}else if("object"===a){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var l in r)n.call(r,l)&&r[l]&&e.push(l)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},251:(e,t,r)=>{"use strict";var n=r(196),o=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,r){var n,a={},u=null,c=null;for(n in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,n)&&!s.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===a[n]&&(a[n]=t[n]);return{$$typeof:o,type:e,key:u,ref:c,props:a,_owner:l.current}}t.jsx=u},893:(e,t,r)=>{"use strict";e.exports=r(251)},196:e=>{"use strict";e.exports=window.React}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=r(184),t=r.n(e);const n=window.wp.i18n,o=window.wp.blocks,a=window.wp.blockEditor,i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"wc-cart-button/cart-pdf-button","title":"Cart PDF Button","category":"design","description":"Download WooCommerce cart as PDF.","keywords":["button","cart","pdf"],"textdomain":"wc-cart-pdf","attributes":{"text":{"type":"string","source":"html","selector":"a","__experimentalRole":"content","default":"Download Cart as PDF"},"backgroundColor":{"type":"string"},"textColor":{"type":"string"},"gradient":{"type":"string"},"width":{"type":"number"}},"supports":{"anchor":true,"align":false,"alignWide":false,"color":{"__experimentalSkipSerialization":true,"gradients":true,"__experimentalDefaultControls":{"background":true,"text":true}},"typography":{"fontSize":true,"lineHeight":true,"__experimentalFontFamily":true,"__experimentalFontWeight":true,"__experimentalFontStyle":true,"__experimentalTextTransform":true,"__experimentalTextDecoration":true,"__experimentalLetterSpacing":true,"__experimentalDefaultControls":{"fontSize":true}},"reusable":false,"shadow":true,"spacing":{"__experimentalSkipSerialization":true,"padding":["horizontal","vertical"],"__experimentalDefaultControls":{"padding":true}},"__experimentalBorder":{"color":true,"radius":true,"style":true,"width":true,"__experimentalSkipSerialization":true,"__experimentalDefaultControls":{"color":true,"radius":true,"style":true,"width":true}},"__experimentalSelector":".wp-block-wc-cart-button-cart-pdf-button .cart-pdf-button"},"editorScript":"file:./blocks.js","style":["file:./blocks.css"]}');var l=r(893);function s(e){return s="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},s(e)}function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==s(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===s(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f=i.name;(0,o.registerBlockType)("wc-cart-pdf/cart-pdf",c(c({name:f},i),{},{example:{attributes:{text:"Download Cart as PDF"}},edit:function(e){var r=e.attributes,i=e.setAttributes,s=r.text,u=(0,a.__experimentalUseBorderProps)(r),p=(0,a.__experimentalUseColorProps)(r),f=(0,a.__experimentalGetSpacingClassesAndStyles)(r),d=t()("cart-pdf-button","button","wp-element-button",p.className,u.className);return(0,l.jsx)("div",c(c({},(0,a.useBlockProps)()),{},{children:(0,l.jsx)(a.RichText,{tagName:"a","aria-label":(0,n.__)("Button text","wc-cart-pdf"),placeholder:(0,n.__)("Add text…","wc-cart-pdf"),value:s,onChange:function(e){return i({text:e})},withoutInteractiveFormatting:!0,className:d,style:c(c(c({},u.style),p.style),f.style),onSplit:function(){return(0,o.createBlock)("core/paragraph")},identifier:"text",rel:"nofollow noopener"})}))},save:function(e){var r=e.attributes,n=r.text,o=(0,a.__experimentalGetBorderClassesAndStyles)(r),i=(0,a.__experimentalGetColorClassesAndStyles)(r),s=(0,a.__experimentalGetSpacingClassesAndStyles)(r),u=t()("cart-pdf-button","button","wp-element-button",i.className,o.className);return(0,l.jsx)("div",c(c({},a.useBlockProps.save()),{},{children:(0,l.jsx)(a.RichText.Content,{tagName:"a",value:n,className:u,style:c(c(c({},o.style),i.style),s.style),target:"_blank",rel:"nofollow noopener"})}))}})),document.addEventListener("DOMContentLoaded",(function(){(0,window.wc.blocksCheckout.registerCheckoutFilters)("example-extension",{additionalCartCheckoutInnerBlockTypes:function(e){return e.push("wc-cart-button/cart-pdf-button"),e}})}))})()})();
     2(()=>{var t={20:(t,e,r)=>{"use strict";var n=r(609),o=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(t,e,r){var n,a={},u=null,c=null;for(n in void 0!==r&&(u=""+r),void 0!==e.key&&(u=""+e.key),void 0!==e.ref&&(c=e.ref),e)i.call(e,n)&&!s.hasOwnProperty(n)&&(a[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps)void 0===a[n]&&(a[n]=e[n]);return{$$typeof:o,type:t,key:u,ref:c,props:a,_owner:l.current}}e.jsx=u},848:(t,e,r)=>{"use strict";t.exports=r(20)},609:t=>{"use strict";t.exports=window.React},942:(t,e)=>{var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var t="",e=0;e<arguments.length;e++){var r=arguments[e];r&&(t=i(t,a(r)))}return t}function a(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return o.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var r in t)n.call(t,r)&&t[r]&&(e=i(e,r));return e}function i(t,e){return e?t?t+" "+e:t+e:t}t.exports?(o.default=o,t.exports=o):void 0===(r=function(){return o}.apply(e,[]))||(t.exports=r)}()}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=r(942),e=r.n(t);const n=window.wp.i18n,o=window.wp.blocks,a=window.wp.blockEditor,i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"wc-cart-button/cart-pdf-button","title":"Cart PDF Button","category":"design","description":"Download WooCommerce cart as PDF.","keywords":["button","cart","pdf"],"textdomain":"wc-cart-pdf","attributes":{"text":{"type":"string","source":"html","selector":"a","__experimentalRole":"content","default":"Download Cart as PDF"},"backgroundColor":{"type":"string"},"textColor":{"type":"string"},"gradient":{"type":"string"},"width":{"type":"number"}},"supports":{"anchor":true,"align":false,"alignWide":false,"color":{"__experimentalSkipSerialization":true,"gradients":true,"__experimentalDefaultControls":{"background":true,"text":true}},"typography":{"fontSize":true,"lineHeight":true,"__experimentalFontFamily":true,"__experimentalFontWeight":true,"__experimentalFontStyle":true,"__experimentalTextTransform":true,"__experimentalTextDecoration":true,"__experimentalLetterSpacing":true,"__experimentalDefaultControls":{"fontSize":true}},"reusable":false,"shadow":true,"spacing":{"__experimentalSkipSerialization":true,"padding":["horizontal","vertical"],"__experimentalDefaultControls":{"padding":true}},"__experimentalBorder":{"color":true,"radius":true,"style":true,"width":true,"__experimentalSkipSerialization":true,"__experimentalDefaultControls":{"color":true,"radius":true,"style":true,"width":true}},"__experimentalSelector":".wp-block-wc-cart-button-cart-pdf-button .cart-pdf-button"},"editorScript":"file:./blocks.js","style":["file:./blocks.css"]}');var l=r(848);function s(t){return s="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},s(t)}function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach((function(e){p(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function p(t,e,r){var n;return n=function(t,e){if("object"!=s(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(e,"string"),(e="symbol"==s(n)?n:String(n))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var f=i.name;(0,o.registerBlockType)("wc-cart-pdf/cart-pdf",c(c({name:f},i),{},{example:{attributes:{text:"Download Cart as PDF"}},edit:function(t){var r=t.attributes,i=t.setAttributes,s=r.text,u=(0,a.__experimentalUseBorderProps)(r),p=(0,a.__experimentalUseColorProps)(r),f=(0,a.__experimentalGetSpacingClassesAndStyles)(r),d=e()("cart-pdf-button","button","wp-element-button",p.className,u.className);return(0,l.jsx)("div",c(c({},(0,a.useBlockProps)()),{},{children:(0,l.jsx)(a.RichText,{tagName:"a","aria-label":(0,n.__)("Button text","wc-cart-pdf"),placeholder:(0,n.__)("Add text…","wc-cart-pdf"),value:s,onChange:function(t){return i({text:t})},withoutInteractiveFormatting:!0,className:d,style:c(c(c({},u.style),p.style),f.style),onSplit:function(){return(0,o.createBlock)("core/paragraph")},identifier:"text",rel:"nofollow noopener"})}))},save:function(t){var r=t.attributes,n=r.text,o=(0,a.__experimentalGetBorderClassesAndStyles)(r),i=(0,a.__experimentalGetColorClassesAndStyles)(r),s=(0,a.__experimentalGetSpacingClassesAndStyles)(r),u=e()("cart-pdf-button","button","wp-element-button",i.className,o.className);return(0,l.jsx)("div",c(c({},a.useBlockProps.save()),{},{children:(0,l.jsx)(a.RichText.Content,{tagName:"a",value:n,className:u,style:c(c(c({},o.style),i.style),s.style),target:"_blank",rel:"nofollow noopener"})}))}})),document.addEventListener("DOMContentLoaded",(function(){(0,window.wc.blocksCheckout.registerCheckoutFilters)("wc-cart-pdf",{additionalCartCheckoutInnerBlockTypes:function(t){return t.push("wc-cart-button/cart-pdf-button"),t}})}))})()})();
  • wc-cart-pdf/tags/2.8.0/assets/js/wc-cart-pdf.asset.php

    r3000367 r3049171  
    1 <?php return array('dependencies' => array(), 'version' => '18cd043881021062');
     1<?php return array('dependencies' => array(), 'version' => 'bec0048d46997709');
  • wc-cart-pdf/tags/2.8.0/assets/js/wc-cart-pdf.js

    r3000367 r3049171  
    11/*! For license information please see wc-cart-pdf.js.LICENSE.txt */
    2 (()=>{"use strict";var e,r={263:()=>{function e(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)e[n]=t[n]}return e}var r,t,n=function r(t,n){function o(r,o,i){if("undefined"!=typeof document){"number"==typeof(i=e({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var a in i)i[a]&&(c+="; "+a,!0!==i[a]&&(c+="="+i[a].split(";")[0]));return document.cookie=r+"="+t.write(o,r)+c}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},o=0;o<r.length;o++){var i=r[o].split("="),c=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(n[a]=t.read(c,a),e===a)break}catch(e){}}return e?n[e]:n}},remove:function(r,t){o(r,"",e({},t,{expires:-1}))},withAttributes:function(t){return r(this.converter,e({},this.attributes,t))},withConverter:function(t){return r(e({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});r=jQuery('form[name="checkout"]'),t=cartpdf.capture_fields||[],r.on("change",":input",(function(e){e.preventDefault();var r=new FormData(document.querySelectorAll('form[name="checkout"]')[0]),o={};r.forEach((function(e,r){t.includes(r)&&(o[r]=e)}));var i=JSON.stringify(o);n.set("wc-cart-pdf-customer",i)}))},440:()=>{}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var i=t[e]={exports:{}};return r[e](i,i.exports,n),i.exports}n.m=r,e=[],n.O=(r,t,o,i)=>{if(!t){var c=1/0;for(p=0;p<e.length;p++){for(var[t,o,i]=e[p],a=!0,u=0;u<t.length;u++)(!1&i||c>=i)&&Object.keys(n.O).every((e=>n.O[e](t[u])))?t.splice(u--,1):(a=!1,i<c&&(c=i));if(a){e.splice(p--,1);var f=o();void 0!==f&&(r=f)}}return r}i=i||0;for(var p=e.length;p>0&&e[p-1][2]>i;p--)e[p]=e[p-1];e[p]=[t,o,i]},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={75:0,572:0};n.O.j=r=>0===e[r];var r=(r,t)=>{var o,i,[c,a,u]=t,f=0;if(c.some((r=>0!==e[r]))){for(o in a)n.o(a,o)&&(n.m[o]=a[o]);if(u)var p=u(n)}for(r&&r(t);f<c.length;f++)i=c[f],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return n.O(p)},t=self.webpackChunkwc_cart_pdf=self.webpackChunkwc_cart_pdf||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),n.O(void 0,[572],(()=>n(263)));var o=n.O(void 0,[572],(()=>n(440)));o=n.O(o)})();
     2(()=>{var e,t={623:(e,t,r)=>{"use strict";function n(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var o=function e(t,r){function o(e,o,i){if("undefined"!=typeof document){"number"==typeof(i=n({},r,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var a in i)i[a]&&(c+="; "+a,!0!==i[a]&&(c+="="+i[a].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+c}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},o=0;o<r.length;o++){var i=r[o].split("="),c=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(n[a]=t.read(c,a),e===a)break}catch(e){}}return e?n[e]:n}},remove:function(e,t){o(e,"",n({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,n({},this.attributes,t))},withConverter:function(t){return e(n({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"}),i=r(221),c=r.n(i);function a(e){return a="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},a(e)}var u=function(e){var t=cartpdf.capture_fields||[];try{if(!e||"object"!==a(e))throw new Error("Invalid object");for(var r in e)t.includes(r)||delete e[r];var n=JSON.stringify(e);o.set("wc-cart-pdf-customer",n)}catch(e){console.error(e)}};const l=function(){if("undefined"!=typeof wp&&wp&&wp.data){var e=c()((function(){var e=wp.data.select("wc/store/cart").getCustomerData(),t={};for(var r in e.shippingAddress)t["shipping_".concat(r)]=e.shippingAddress[r];for(var n in e.billingAddress)t["billing_".concat(n)]=e.billingAddress[n];u(t)}),250);wp.data.subscribe(e)}var t=document.querySelector('form[name="checkout"]'),r=null==t?void 0:t.querySelectorAll("input, textarea, select");null==r||r.forEach((function(e){e.addEventListener("change",(function(e){e.preventDefault();var r=new FormData(t),n={};r.forEach((function(e,t){n[t]=e})),u(n)}))}))};function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,c,a=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(c=r.return(),Object(c)!==c))return}finally{if(l)throw o}}return a}}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}const p=function(){var e=document.getElementById("wc-cart-pdf-modal"),t=null==e?void 0:e.querySelector("form"),r=null==t?void 0:t.getAttribute("action"),n=null==e?void 0:e.querySelector("#wc-cart-pdf-capture-form-errors");if(e&&t&&r&&n){var i,c=document.querySelector(".cart-pdf-button"),a=!1;(null==c?void 0:c.addEventListener("click",l))||(i=setInterval((function(){document.querySelector(".cart-pdf-button")&&(clearInterval(i),document.querySelector(".cart-pdf-button").addEventListener("click",l))}),250)),t.addEventListener("submit",(function(i){if(i.preventDefault(),!a){a=!0;var c,u=new FormData(t),l={},d=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=s(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return c=e.done,e},e:function(e){a=!0,i=e},f:function(){try{c||null==r.return||r.return()}finally{if(a)throw i}}}}(u.entries());try{for(d.s();!(c=d.n()).done;){var p=f(c.value,2),v=p[0],y=p[1];l[v]=y}}catch(e){d.e(e)}finally{d.f()}o.set("wc-cart-pdf-customer",JSON.stringify(l)),l.nonce=cartpdf.nonce,fetch("".concat(cartpdf.ajax_url,"?action=wc_cart_pdf_modal_form_save"),{method:"POST",body:new URLSearchParams(l).toString(),headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then((function(e){return e.json()})).then((function(t){if(t.success){var o=new URL(r);l.email_copy&&"1"===l.email_copy&&o.searchParams.set("email_copy","1"),window.location.href=o.toString(),e.close()}else n.textContent=(null==t?void 0:t.data)||"An error occurred."})).catch((function(e){var t;n.textContent=(null==e||null===(t=e.responseJSON)||void 0===t?void 0:t.data)||"An error occurred."})).finally((function(){a=!1}))}}))}else console.error("WC Cart PDF: Modal capture elements not found.");function u(t){t.target!==e&&t.target!==e.querySelector(".wc-cart-pdf-modal-close")||(e.close(),e.removeEventListener("click",u))}function l(r){r.preventDefault(),e.showModal(),t.querySelector("input").focus(),e.addEventListener("click",u)}};document.addEventListener("DOMContentLoaded",(function(){var e,t;null!==(e=cartpdf)&&void 0!==e&&null!==(e=e.modules)&&void 0!==e&&e.capture_customer&&l(),null!==(t=cartpdf)&&void 0!==t&&null!==(t=t.modules)&&void 0!==t&&t.modal_capture&&p()}))},873:(e,t,r)=>{var n=r(325).Symbol;e.exports=n},552:(e,t,r)=>{var n=r(873),o=r(659),i=r(350),c=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":c&&c in Object(e)?o(e):i(e)}},128:(e,t,r)=>{var n=r(800),o=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(o,""):e}},840:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},659:(e,t,r)=>{var n=r(873),o=Object.prototype,i=o.hasOwnProperty,c=o.toString,a=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var o=c.call(e);return n&&(t?e[a]=r:delete e[a]),o}},350:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},325:(e,t,r)=>{var n=r(840),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();e.exports=i},800:e=>{var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},221:(e,t,r)=>{var n=r(805),o=r(124),i=r(374),c=Math.max,a=Math.min;e.exports=function(e,t,r){var u,l,f,s,d,p,v=0,y=!1,m=!1,b=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var r=u,n=l;return u=l=void 0,v=t,s=e.apply(n,r)}function g(e){var r=e-p;return void 0===p||r>=t||r<0||m&&e-v>=f}function w(){var e=o();if(g(e))return x(e);d=setTimeout(w,function(e){var r=t-(e-p);return m?a(r,f-(e-v)):r}(e))}function x(e){return d=void 0,b&&u?h(e):(u=l=void 0,s)}function S(){var e=o(),r=g(e);if(u=arguments,l=this,p=e,r){if(void 0===d)return function(e){return v=e,d=setTimeout(w,t),y?h(e):s}(p);if(m)return clearTimeout(d),d=setTimeout(w,t),h(p)}return void 0===d&&(d=setTimeout(w,t)),s}return t=i(t)||0,n(r)&&(y=!!r.leading,f=(m="maxWait"in r)?c(i(r.maxWait)||0,t):f,b="trailing"in r?!!r.trailing:b),S.cancel=function(){void 0!==d&&clearTimeout(d),v=0,u=p=l=d=void 0},S.flush=function(){return void 0===d?s:x(o())},S}},805:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},394:(e,t,r)=>{var n=r(552),o=r(346);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==n(e)}},124:(e,t,r)=>{var n=r(325);e.exports=function(){return n.Date.now()}},374:(e,t,r)=>{var n=r(128),o=r(805),i=r(394),c=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=a.test(e);return r||u.test(e)?l(e.slice(2),r?2:8):c.test(e)?NaN:+e}},594:()=>{},917:()=>{}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.m=t,e=[],n.O=(t,r,o,i)=>{if(!r){var c=1/0;for(f=0;f<e.length;f++){for(var[r,o,i]=e[f],a=!0,u=0;u<r.length;u++)(!1&i||c>=i)&&Object.keys(n.O).every((e=>n.O[e](r[u])))?r.splice(u--,1):(a=!1,i<c&&(c=i));if(a){e.splice(f--,1);var l=o();void 0!==l&&(t=l)}}return t}i=i||0;for(var f=e.length;f>0&&e[f-1][2]>i;f--)e[f]=e[f-1];e[f]=[r,o,i]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={864:0,913:0,910:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var o,i,[c,a,u]=r,l=0;if(c.some((t=>0!==e[t]))){for(o in a)n.o(a,o)&&(n.m[o]=a[o]);if(u)var f=u(n)}for(t&&t(r);l<c.length;l++)i=c[l],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return n.O(f)},r=self.webpackChunkwc_cart_pdf=self.webpackChunkwc_cart_pdf||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),n.O(void 0,[913,910],(()=>n(623))),n.O(void 0,[913,910],(()=>n(594)));var o=n.O(void 0,[913,910],(()=>n(917)));o=n.O(o)})();
  • wc-cart-pdf/tags/2.8.0/includes/markup.php

    r2576121 r3049171  
    55 * @package dkjensen/wc-cart-pdf
    66 */
     7
     8/**
     9 * Enqueue script to save customer information in a cookie
     10 *
     11 * @return void
     12 */
     13function wc_cart_pdf_scripts() {
     14    wp_enqueue_style( 'wc-cart-pdf', WC_CART_PDF_URL . 'assets/css/wc-cart-pdf.css', array(), WC_CART_PDF_VER );
     15
     16    wp_register_script( 'wc-cart-pdf', WC_CART_PDF_URL . 'assets/js/wc-cart-pdf.js', array(), WC_CART_PDF_VER, true );
     17
     18    wp_localize_script(
     19        'wc-cart-pdf',
     20        'cartpdf',
     21        array(
     22            'modules'        => array(
     23                'capture_customer' => (int) get_option( 'wc_cart_pdf_capture_customer', 0 ),
     24                'modal_capture'    => (int) get_option( 'wc_cart_pdf_modal_capture', 0 ),
     25            ),
     26            'ajax_url'       => admin_url( 'admin-ajax.php' ),
     27            'nonce'          => wp_create_nonce( 'wc_cart_pdf_modal' ),
     28            'capture_fields' => apply_filters(
     29                'wc_cart_pdf_capture_customer_fields',
     30                array(
     31                    'email',
     32                    'first_name',
     33                    'last_name',
     34                    'display_name',
     35                    'username',
     36                    'billing_first_name',
     37                    'billing_last_name',
     38                    'billing_company',
     39                    'billing_address_1',
     40                    'billing_address_2',
     41                    'billing_city',
     42                    'billing_postcode',
     43                    'billing_country',
     44                    'billing_state',
     45                    'billing_email',
     46                    'billing_phone',
     47                    'shipping_first_name',
     48                    'shipping_last_name',
     49                    'shipping_company',
     50                    'shipping_address_1',
     51                    'shipping_address_2',
     52                    'shipping_city',
     53                    'shipping_postcode',
     54                    'shipping_country',
     55                    'shipping_state',
     56                )
     57            ),
     58        )
     59    );
     60
     61    wp_enqueue_script( 'wc-cart-pdf' );
     62}
     63add_action( 'wp_enqueue_scripts', 'wc_cart_pdf_scripts' );
    764
    865/**
     
    2986 * Renders the download cart as PDF button in checkout
    3087 *
    31  * @since 2.1.4
    3288 * @return void
    3389 */
     
    44100 * Expand {site_title} placeholder variable
    45101 *
    46  * @since 1.0.3
    47102 * @param string $string Default footer text.
    48103 * @return string
  • wc-cart-pdf/tags/2.8.0/includes/modules/capture-customer.php

    r2576407 r3049171  
    55 * @package dkjensen/wc-cart-pdf
    66 */
    7 
    8 if ( ! function_exists( 'get_option' ) || ! get_option( 'wc_cart_pdf_capture_customer', false ) ) {
    9     return;
    10 }
    11 
    12 /**
    13  * Enqueue script to save customer information in a cookie
    14  *
    15  * @since 2.1.4
    16  * @return void
    17  */
    18 function wc_cart_pdf_scripts() {
    19     wp_register_script( 'wc-cart-pdf', WC_CART_PDF_URL . 'assets/js/wc-cart-pdf.js', array( 'jquery' ), WC_CART_PDF_VER, true );
    20 
    21     wp_localize_script(
    22         'wc-cart-pdf',
    23         'cartpdf',
    24         array(
    25             'capture_fields' => apply_filters(
    26                 'wc_cart_pdf_capture_customer_fields',
    27                 array(
    28                     'email',
    29                     'first_name',
    30                     'last_name',
    31                     'display_name',
    32                     'username',
    33                     'billing_first_name',
    34                     'billing_last_name',
    35                     'billing_company',
    36                     'billing_address_1',
    37                     'billing_address_2',
    38                     'billing_city',
    39                     'billing_postcode',
    40                     'billing_country',
    41                     'billing_state',
    42                     'billing_email',
    43                     'billing_phone',
    44                     'shipping_first_name',
    45                     'shipping_last_name',
    46                     'shipping_company',
    47                     'shipping_address_1',
    48                     'shipping_address_2',
    49                     'shipping_city',
    50                     'shipping_postcode',
    51                     'shipping_country',
    52                     'shipping_state',
    53                 )
    54             ),
    55         )
    56     );
    57 
    58     wp_enqueue_script( 'wc-cart-pdf' );
    59 }
    60 add_action( 'wp_enqueue_scripts', 'wc_cart_pdf_scripts' );
    617
    628/**
  • wc-cart-pdf/tags/2.8.0/includes/modules/copy-admin.php

    r2576121 r3049171  
    55 * @package dkjensen/wc-cart-pdf
    66 */
    7 
    8 if ( ! function_exists( 'get_option' ) || ! get_option( 'wc_cart_pdf_copy_admin', false ) ) {
    9     return;
    10 }
    117
    128/**
  • wc-cart-pdf/tags/2.8.0/includes/modules/unique-increment.php

    r2619353 r3049171  
    55 * @package dkjensen/wc-cart-pdf
    66 */
    7 
    8 if ( ! function_exists( 'get_option' ) || ! get_option( 'wc_cart_pdf_unique_increment', false ) ) {
    9     return;
    10 }
    117
    128/**
  • wc-cart-pdf/tags/2.8.0/languages/wc-cart-pdf.pot

    r3000367 r3049171  
    1 # Copyright (C) 2023 CloudCatch LLC
     1# Copyright (C) 2024 CloudCatch LLC
    22# This file is distributed under the same license as the WooCommerce Cart PDF package.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WooCommerce Cart PDF 2.7.0\n"
     5"Project-Id-Version: WooCommerce Cart PDF 2.8.0\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wc-cart-pdf\n"
    7 "POT-Creation-Date: 2023-11-22 21:48:15+00:00\n"
     7"POT-Creation-Date: 2024-03-11 13:45:22+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=utf-8\n"
    1010"Content-Transfer-Encoding: 8bit\n"
    11 "PO-Revision-Date: 2023-MO-DA HO:MI+ZONE\n"
     11"PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n"
    1212"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    1313"Language-Team: LANGUAGE <LL@li.org>\n"
     
    2323msgstr ""
    2424
    25 #: includes/markup.php:21 wc-cart-pdf.php:234
     25#: includes/class-wc-cart-pdf-settings.php:18
     26msgid "Cart PDF"
     27msgstr ""
     28
     29#: includes/class-wc-cart-pdf-settings.php:19
     30msgid "WC Cart PDF allows customers to download their cart as a PDF."
     31msgstr ""
     32
     33#: includes/class-wc-cart-pdf-settings.php:181
     34msgid "Button label"
     35msgstr ""
     36
     37#: includes/class-wc-cart-pdf-settings.php:182
     38msgid "Text that is displayed on the button which generates the PDF."
     39msgstr ""
     40
     41#: includes/class-wc-cart-pdf-settings.php:185 includes/markup.php:78
    2642msgid "Download Cart as PDF"
    2743msgstr ""
    2844
    29 #: includes/modules/copy-admin.php:29
     45#: includes/class-wc-cart-pdf-settings.php:188
     46msgid "Logo URL"
     47msgstr ""
     48
     49#: includes/class-wc-cart-pdf-settings.php:189
     50msgid "Image URL of logo for the cart PDF, must live on current server."
     51msgstr ""
     52
     53#: includes/class-wc-cart-pdf-settings.php:195
     54msgid "Logo width"
     55msgstr ""
     56
     57#: includes/class-wc-cart-pdf-settings.php:196
     58msgid "Logo size used for the cart PDF."
     59msgstr ""
     60
     61#: includes/class-wc-cart-pdf-settings.php:203
     62msgid "Logo alignment"
     63msgstr ""
     64
     65#: includes/class-wc-cart-pdf-settings.php:204
     66msgid "Alignment of the logo within header of the cart PDF."
     67msgstr ""
     68
     69#: includes/class-wc-cart-pdf-settings.php:209
     70msgid "Left"
     71msgstr ""
     72
     73#: includes/class-wc-cart-pdf-settings.php:210
     74msgid "Center"
     75msgstr ""
     76
     77#: includes/class-wc-cart-pdf-settings.php:211
     78msgid "Right"
     79msgstr ""
     80
     81#: includes/class-wc-cart-pdf-settings.php:215
     82msgid "Open PDF in new tab instead of downloading"
     83msgstr ""
     84
     85#: includes/class-wc-cart-pdf-settings.php:222
     86msgid "Send a copy of PDF to admin via email"
     87msgstr ""
     88
     89#: includes/class-wc-cart-pdf-settings.php:229
     90msgid "Show Download Cart as PDF on checkout"
     91msgstr ""
     92
     93#: includes/class-wc-cart-pdf-settings.php:236
     94msgid "Capture customer information on checkout"
     95msgstr ""
     96
     97#: includes/class-wc-cart-pdf-settings.php:243
     98msgid "Display unique generated PDF number"
     99msgstr ""
     100
     101#: includes/class-wc-cart-pdf-settings.php:250
     102msgid "Require customer to populate their information before downloading PDF"
     103msgstr ""
     104
     105#: includes/modules/copy-admin.php:25
    30106msgid "A user has downloaded their cart as PDF, and is attached to this email."
    31107msgstr ""
    32108
    33 #: includes/modules/copy-admin.php:34
     109#: includes/modules/copy-admin.php:30
    34110msgid "Name"
    35111msgstr ""
    36112
    37 #: includes/modules/copy-admin.php:35
     113#: includes/modules/copy-admin.php:31 templates/modal-capture.php:16
    38114msgid "Email"
    39115msgstr ""
    40116
    41 #: includes/modules/copy-admin.php:52
     117#: includes/modules/copy-admin.php:48
    42118msgid "A user has downloaded their cart as PDF"
    43119msgstr ""
    44120
    45 #: templates/cart-table.php:52 templates/cart-table.php:92
     121#: includes/modules/modal-capture.php:33
     122msgid "Email is required."
     123msgstr ""
     124
     125#: includes/modules/modal-capture.php:49
     126msgid "Security check failed."
     127msgstr ""
     128
     129#: includes/modules/modal-capture.php:64
     130msgid "Customer information saved."
     131msgstr ""
     132
     133#: includes/modules/modal-capture.php:86
     134msgid "A copy of your cart has been attached as a PDF to this email."
     135msgstr ""
     136
     137#: includes/modules/modal-capture.php:91
     138#. translators: %s site title
     139msgid "Your cart from %s"
     140msgstr ""
     141
     142#: templates/cart-table.php:49 templates/cart-table.php:89
    46143msgid "Product"
    47144msgstr ""
    48145
    49 #: templates/cart-table.php:53 templates/cart-table.php:112
     146#: templates/cart-table.php:50 templates/cart-table.php:109
    50147msgid "Price"
    51148msgstr ""
    52149
    53 #: templates/cart-table.php:54 templates/cart-table.php:118
     150#: templates/cart-table.php:51 templates/cart-table.php:115
    54151msgid "Quantity"
    55152msgstr ""
    56153
    57 #: templates/cart-table.php:55 templates/cart-table.php:122
    58 #: templates/cart-table.php:185 templates/cart-table.php:186
     154#: templates/cart-table.php:52 templates/cart-table.php:119
     155#: templates/cart-table.php:182 templates/cart-table.php:183
    59156msgid "Total"
    60157msgstr ""
    61158
    62 #: templates/cart-table.php:107
     159#: templates/cart-table.php:104
    63160msgid "Available on backorder"
    64161msgstr ""
    65162
    66 #: templates/cart-table.php:134 templates/cart-table.php:135
     163#: templates/cart-table.php:131 templates/cart-table.php:132
    67164msgid "Subtotal"
    68165msgstr ""
    69166
    70 #: templates/cart-table.php:140 templates/cart-table.php:141
     167#: templates/cart-table.php:137 templates/cart-table.php:138
    71168msgid "Shipping"
    72169msgstr ""
    73170
    74 #: templates/cart-table.php:163
     171#: templates/cart-table.php:160
    75172msgid "(estimated for %s)"
     173msgstr ""
     174
     175#: templates/modal-capture.php:13
     176msgid "Please enter your email address to receive your cart as a PDF."
     177msgstr ""
     178
     179#: templates/modal-capture.php:20
     180msgid "Send a copy of the PDF via email."
     181msgstr ""
     182
     183#: templates/modal-capture.php:23
     184msgid "Submit"
    76185msgstr ""
    77186
     
    80189msgstr ""
    81190
    82 #: wc-cart-pdf.php:68
     191#: wc-cart-pdf.php:90
    83192msgid "WooCommerce Cart PDF requirements not met"
    84193msgstr ""
    85194
    86 #: wc-cart-pdf.php:69
     195#: wc-cart-pdf.php:91
    87196msgid ""
    88197"WooCommerce Cart PDF requires at least PHP 5.6.0 with the mbstring and gd "
     
    90199msgstr ""
    91200
    92 #: wc-cart-pdf.php:110
     201#: wc-cart-pdf.php:132
    93202msgid "Invalid nonce. Unable to process PDF for download."
    94 msgstr ""
    95 
    96 #: wc-cart-pdf.php:225
    97 msgid "Cart PDF"
    98 msgstr ""
    99 
    100 #: wc-cart-pdf.php:245
    101 msgid "Button label"
    102 msgstr ""
    103 
    104 #: wc-cart-pdf.php:246
    105 msgid "Text that is displayed on the button which generates the PDF."
    106 msgstr ""
    107 
    108 #: wc-cart-pdf.php:267
    109 msgid "Logo URL"
    110 msgstr ""
    111 
    112 #: wc-cart-pdf.php:268
    113 msgid "Image URL of logo for the cart PDF, must live on current server."
    114 msgstr ""
    115 
    116 #: wc-cart-pdf.php:290
    117 msgid "Logo width"
    118 msgstr ""
    119 
    120 #: wc-cart-pdf.php:291
    121 msgid "Logo size used for the cart PDF."
    122 msgstr ""
    123 
    124 #: wc-cart-pdf.php:317
    125 msgid "Logo alignment"
    126 msgstr ""
    127 
    128 #: wc-cart-pdf.php:318
    129 msgid "Alignment of the logo within header of the cart PDF."
    130 msgstr ""
    131 
    132 #: wc-cart-pdf.php:323
    133 msgid "Left"
    134 msgstr ""
    135 
    136 #: wc-cart-pdf.php:324
    137 msgid "Center"
    138 msgstr ""
    139 
    140 #: wc-cart-pdf.php:325
    141 msgid "Right"
    142 msgstr ""
    143 
    144 #: wc-cart-pdf.php:393
    145 msgid "Open PDF in new tab instead of downloading"
    146 msgstr ""
    147 
    148 #: wc-cart-pdf.php:403
    149 msgid "Send a copy of PDF to admin via email"
    150 msgstr ""
    151 
    152 #: wc-cart-pdf.php:413
    153 msgid "Show Download Cart as PDF on checkout"
    154 msgstr ""
    155 
    156 #: wc-cart-pdf.php:423
    157 msgid "Capture customer information on checkout"
    158 msgstr ""
    159 
    160 #: wc-cart-pdf.php:433
    161 msgid "Display unique generated PDF number"
    162203msgstr ""
    163204
  • wc-cart-pdf/tags/2.8.0/readme.txt

    r3000367 r3049171  
    11=== WooCommerce Cart PDF ===
    22Contributors: cloudcatch, dkjensen, seattlewebco, davidperez, exstheme
    3 Tested up to: 6.4.1
     3Tested up to: 6.4.3
    44Requires PHP: 5.6.0
    5 Stable tag: 2.7.0
     5Stable tag: 2.8.0
    66
    77Adds ability for users and guests to download their WooCommerce cart as PDF
     
    2727
    2828== Changelog ==
     29
     302.8.0
     31* Migrate settings to WooCommerce > Settings > Integration > Cart PDF
     32* Add ability to capture customer details via modal popup before downloading cart as PDF
     33* Additional compatbility with WooCommerce blocks
    2934
    30352.7.0
  • wc-cart-pdf/tags/2.8.0/templates/cart-table.php

    r2619353 r3049171  
    33 * WC Cart PDF template
    44 *
    5  * @package wc-cart-pdf
     5 * @package dkjensen/wc-cart-pdf
    66 */
    77
    88/**
    99 * Before template hook
    10  *
    11  * @since 1.0.4
    12  * @package dkjensen/wc-cart-pdf
    1310 */
    1411do_action( 'wc_cart_pdf_before_template' );
     
    201198/**
    202199 * After template hook
    203  *
    204  * @since 1.0.4
    205200 */
    206201do_action( 'wc_cart_pdf_after_template' );
  • wc-cart-pdf/tags/2.8.0/vendor/composer/installed.php

    r3000367 r3049171  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => '0930e4ee28e4a1bbd20a8a512a25b37c39d526ea',
     6        'reference' => 'cf177ce1a8d7fddfefb154ea9fa1a2bf8c69fa4e',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => '0930e4ee28e4a1bbd20a8a512a25b37c39d526ea',
     16            'reference' => 'cf177ce1a8d7fddfefb154ea9fa1a2bf8c69fa4e',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • wc-cart-pdf/tags/2.8.0/wc-cart-pdf.php

    r3000367 r3049171  
    33 * Plugin Name:         WooCommerce Cart PDF
    44 * Description:         Allows customers to download their cart as a PDF
    5  * Version:             2.7.0
     5 * Version:             2.8.0
    66 * Author:              CloudCatch LLC
    77 * Author URI:          https://cloudcatch.io
     
    1111 * Requires at least:   6.2
    1212 * Requires PHP:        5.6.0
    13  * WC tested up to:     8.3.1
     13 * WC tested up to:     8.6.1
    1414 *
    1515 * This program is free software; you can redistribute it and/or modify
     
    3232define( 'WC_CART_PDF_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
    3333define( 'WC_CART_PDF_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
    34 define( 'WC_CART_PDF_VER', '2.7.0' );
     34define( 'WC_CART_PDF_TEMPLATE_PATH', WC_CART_PDF_PATH . 'templates/' );
     35define( 'WC_CART_PDF_VER', '2.8.0' );
    3536
    3637require_once WC_CART_PDF_PATH . 'vendor/autoload.php';
     
    4041require_once WC_CART_PDF_PATH . 'includes/markup.php';
    4142require_once WC_CART_PDF_PATH . 'includes/blocks.php';
    42 
    43 require_once WC_CART_PDF_PATH . 'includes/modules/capture-customer.php';
    44 require_once WC_CART_PDF_PATH . 'includes/modules/copy-admin.php';
    45 require_once WC_CART_PDF_PATH . 'includes/modules/unique-increment.php';
     43require_once WC_CART_PDF_PATH . 'includes/settings.php';
     44
     45/**
     46 * Load modules
     47 *
     48 * @return void
     49 */
     50function wc_cart_pdf_load_modules() {
     51    if ( get_option( 'wc_cart_pdf_capture_customer', false ) ) {
     52        require_once WC_CART_PDF_PATH . 'includes/modules/capture-customer.php';
     53    }
     54
     55    if ( get_option( 'wc_cart_pdf_copy_admin', false ) ) {
     56        require_once WC_CART_PDF_PATH . 'includes/modules/copy-admin.php';
     57    }
     58
     59    if ( get_option( 'wc_cart_pdf_unique_increment', false ) ) {
     60        require_once WC_CART_PDF_PATH . 'includes/modules/unique-increment.php';
     61    }
     62
     63    if ( get_option( 'wc_cart_pdf_modal_capture', false ) ) {
     64        require_once WC_CART_PDF_PATH . 'includes/modules/modal-capture.php';
     65    }
     66}
     67add_action( 'plugins_loaded', 'wc_cart_pdf_load_modules' );
    4668
    4769/**
     
    128150    $mpdf->autoLangToFont       = true;
    129151
    130     $cart_table = wc_locate_template( 'cart-table.php', '/woocommerce/wc-cart-pdf/', __DIR__ . '/templates/' );
    131     $css        = wc_locate_template( 'pdf-styles.php', '/woocommerce/wc-cart-pdf/', __DIR__ . '/templates/' );
     152    $cart_table = wc_locate_template( 'cart-table.php', '/woocommerce/wc-cart-pdf/', WC_CART_PDF_TEMPLATE_PATH );
     153    $css        = wc_locate_template( 'pdf-styles.php', '/woocommerce/wc-cart-pdf/', WC_CART_PDF_TEMPLATE_PATH );
    132154
    133155    /**
     
    213235
    214236/**
    215  * Register various customizer options for modifying the cart PDF
    216  *
    217  * @since 1.0.3
    218  * @param WP_Customize_Manager $wp_customize Theme Customizer object.
    219  * @return void
    220  */
    221 function wc_cart_pdf_customize_register( $wp_customize ) {
    222     $wp_customize->add_section(
    223         'wc_cart_pdf',
    224         array(
    225             'title'                 => __( 'Cart PDF', 'wc-cart-pdf' ),
    226             'priority'              => 50,
    227             'panel'                 => 'woocommerce',
    228         )
    229     );
    230 
    231     $wp_customize->add_setting(
    232         'wc_cart_pdf_button_label',
    233         array(
    234             'default'               => __( 'Download Cart as PDF', 'wc-cart-pdf' ),
    235             'type'                  => 'option',
    236             'capability'            => 'manage_woocommerce',
    237             'sanitize_callback'     => 'esc_html',
    238             'transport'             => 'refresh',
    239         )
    240     );
    241 
    242     $wp_customize->add_control(
    243         'wc_cart_pdf_button_label',
    244         array(
    245             'label'                 => __( 'Button label', 'wc-cart-pdf' ),
    246             'description'           => __( 'Text that is displayed on the button which generates the PDF.', 'wc-cart-pdf' ),
    247             'section'               => 'wc_cart_pdf',
    248             'settings'              => 'wc_cart_pdf_button_label',
    249             'type'                  => 'text',
    250         )
    251     );
    252 
    253     $wp_customize->add_setting(
    254         'wc_cart_pdf_logo',
    255         array(
    256             'default'               => get_option( 'woocommerce_email_header_image' ),
    257             'type'                  => 'option',
    258             'capability'            => 'manage_woocommerce',
    259             'sanitize_callback'     => 'esc_url',
    260             'transport'             => 'postMessage',
    261         )
    262     );
    263 
    264     $wp_customize->add_control(
    265         'wc_cart_pdf_logo',
    266         array(
    267             'label'                 => __( 'Logo URL', 'wc-cart-pdf' ),
    268             'description'           => __( 'Image URL of logo for the cart PDF, must live on current server.', 'wc-cart-pdf' ),
    269             'section'               => 'wc_cart_pdf',
    270             'settings'              => 'wc_cart_pdf_logo',
    271             'type'                  => 'text',
    272         )
    273     );
    274 
    275     $wp_customize->add_setting(
    276         'wc_cart_pdf_logo_width',
    277         array(
    278             'default'               => 400,
    279             'type'                  => 'option',
    280             'capability'            => 'manage_woocommerce',
    281             'sanitize_callback'     => 'absint',
    282             'sanitize_js_callback'  => 'absint',
    283             'transport'             => 'postMessage',
    284         )
    285     );
    286 
    287     $wp_customize->add_control(
    288         'wc_cart_pdf_logo_width',
    289         array(
    290             'label'                 => __( 'Logo width', 'wc-cart-pdf' ),
    291             'description'           => __( 'Logo size used for the cart PDF.', 'wc-cart-pdf' ),
    292             'section'               => 'wc_cart_pdf',
    293             'settings'              => 'wc_cart_pdf_logo_width',
    294             'type'                  => 'number',
    295             'input_attrs'           => array(
    296                 'min'           => 0,
    297                 'step'          => 1,
    298             ),
    299         )
    300     );
    301 
    302     $wp_customize->add_setting(
    303         'wc_cart_pdf_logo_alignment',
    304         array(
    305             'default'               => 'center',
    306             'type'                  => 'option',
    307             'capability'            => 'manage_woocommerce',
    308             'sanitize_callback'     => 'wc_clean',
    309             'sanitize_js_callback'  => 'wc_clean',
    310             'transport'             => 'postMessage',
    311         )
    312     );
    313 
    314     $wp_customize->add_control(
    315         'wc_cart_pdf_logo_alignment',
    316         array(
    317             'label'                 => __( 'Logo alignment', 'wc-cart-pdf' ),
    318             'description'           => __( 'Alignment of the logo within header of the cart PDF.', 'wc-cart-pdf' ),
    319             'section'               => 'wc_cart_pdf',
    320             'settings'              => 'wc_cart_pdf_logo_alignment',
    321             'type'                  => 'radio',
    322             'choices'               => array(
    323                 'left'          => __( 'Left', 'wc-cart-pdf' ),
    324                 'center'        => __( 'Center', 'wc-cart-pdf' ),
    325                 'right'         => __( 'Right', 'wc-cart-pdf' ),
    326             ),
    327         )
    328     );
    329 
    330     $wp_customize->add_setting(
    331         'wc_cart_pdf_open_pdf',
    332         array(
    333             'default'               => '',
    334             'type'                  => 'option',
    335             'capability'            => 'manage_woocommerce',
    336             'sanitize_callback'     => 'wc_clean',
    337             'sanitize_js_callback'  => 'wc_clean',
    338             'transport'             => 'postMessage',
    339         )
    340     );
    341 
    342     $wp_customize->add_setting(
    343         'wc_cart_pdf_copy_admin',
    344         array(
    345             'default'               => '',
    346             'type'                  => 'option',
    347             'capability'            => 'manage_woocommerce',
    348             'sanitize_callback'     => 'wc_clean',
    349             'sanitize_js_callback'  => 'wc_clean',
    350             'transport'             => 'postMessage',
    351         )
    352     );
    353 
    354     $wp_customize->add_setting(
    355         'wc_cart_pdf_show_checkout',
    356         array(
    357             'default'               => '',
    358             'type'                  => 'option',
    359             'capability'            => 'manage_woocommerce',
    360             'sanitize_callback'     => 'wc_clean',
    361             'sanitize_js_callback'  => 'wc_clean',
    362             'transport'             => 'postMessage',
    363         )
    364     );
    365 
    366     $wp_customize->add_setting(
    367         'wc_cart_pdf_capture_customer',
    368         array(
    369             'default'               => '',
    370             'type'                  => 'option',
    371             'capability'            => 'manage_woocommerce',
    372             'sanitize_callback'     => 'wc_clean',
    373             'sanitize_js_callback'  => 'wc_clean',
    374             'transport'             => 'postMessage',
    375         )
    376     );
    377 
    378     $wp_customize->add_setting(
    379         'wc_cart_pdf_unique_increment',
    380         array(
    381             'default'               => '',
    382             'type'                  => 'option',
    383             'capability'            => 'manage_woocommerce',
    384             'sanitize_callback'     => 'wc_clean',
    385             'sanitize_js_callback'  => 'wc_clean',
    386             'transport'             => 'postMessage',
    387         )
    388     );
    389 
    390     $wp_customize->add_control(
    391         'wc_cart_pdf_open_pdf',
    392         array(
    393             'label'                 => __( 'Open PDF in new tab instead of downloading', 'wc-cart-pdf' ),
    394             'section'               => 'wc_cart_pdf',
    395             'settings'              => 'wc_cart_pdf_open_pdf',
    396             'type'                  => 'checkbox',
    397         )
    398     );
    399 
    400     $wp_customize->add_control(
    401         'wc_cart_pdf_copy_admin',
    402         array(
    403             'label'                 => __( 'Send a copy of PDF to admin via email', 'wc-cart-pdf' ),
    404             'section'               => 'wc_cart_pdf',
    405             'settings'              => 'wc_cart_pdf_copy_admin',
    406             'type'                  => 'checkbox',
    407         )
    408     );
    409 
    410     $wp_customize->add_control(
    411         'wc_cart_pdf_show_checkout',
    412         array(
    413             'label'                 => __( 'Show Download Cart as PDF on checkout', 'wc-cart-pdf' ),
    414             'section'               => 'wc_cart_pdf',
    415             'settings'              => 'wc_cart_pdf_show_checkout',
    416             'type'                  => 'checkbox',
    417         )
    418     );
    419 
    420     $wp_customize->add_control(
    421         'wc_cart_pdf_capture_customer',
    422         array(
    423             'label'                 => __( 'Capture customer information on checkout', 'wc-cart-pdf' ),
    424             'section'               => 'wc_cart_pdf',
    425             'settings'              => 'wc_cart_pdf_capture_customer',
    426             'type'                  => 'checkbox',
    427         )
    428     );
    429 
    430     $wp_customize->add_control(
    431         'wc_cart_pdf_unique_increment',
    432         array(
    433             'label'                 => __( 'Display unique generated PDF number', 'wc-cart-pdf' ),
    434             'section'               => 'wc_cart_pdf',
    435             'settings'              => 'wc_cart_pdf_unique_increment',
    436             'type'                  => 'checkbox',
    437         )
    438     );
    439 }
    440 add_action( 'customize_register', 'wc_cart_pdf_customize_register' );
    441 
    442 /**
    443237 * Declare compatibility with HPOS.
    444238 */
    445239add_action(
    446240    'before_woocommerce_init',
    447     function() {
     241    function () {
    448242        if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
    449243            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
  • wc-cart-pdf/trunk/assets/blocks/blocks.asset.php

    r3000367 r3049171  
    1 <?php return array('dependencies' => array('react', 'wp-blockEditor', 'wp-blocks', 'wp-i18n'), 'version' => 'b50906793e5e63fc');
     1<?php return array('dependencies' => array('react', 'wp-blockEditor', 'wp-blocks', 'wp-i18n'), 'version' => '82dad062ce6751b0');
  • wc-cart-pdf/trunk/assets/blocks/blocks.js

    r3000367 r3049171  
    11/*! For license information please see blocks.js.LICENSE.txt */
    2 (()=>{var e={184:(e,t)=>{var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r)){if(r.length){var i=o.apply(null,r);i&&e.push(i)}}else if("object"===a){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var l in r)n.call(r,l)&&r[l]&&e.push(l)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},251:(e,t,r)=>{"use strict";var n=r(196),o=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,r){var n,a={},u=null,c=null;for(n in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,n)&&!s.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===a[n]&&(a[n]=t[n]);return{$$typeof:o,type:e,key:u,ref:c,props:a,_owner:l.current}}t.jsx=u},893:(e,t,r)=>{"use strict";e.exports=r(251)},196:e=>{"use strict";e.exports=window.React}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=r(184),t=r.n(e);const n=window.wp.i18n,o=window.wp.blocks,a=window.wp.blockEditor,i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"wc-cart-button/cart-pdf-button","title":"Cart PDF Button","category":"design","description":"Download WooCommerce cart as PDF.","keywords":["button","cart","pdf"],"textdomain":"wc-cart-pdf","attributes":{"text":{"type":"string","source":"html","selector":"a","__experimentalRole":"content","default":"Download Cart as PDF"},"backgroundColor":{"type":"string"},"textColor":{"type":"string"},"gradient":{"type":"string"},"width":{"type":"number"}},"supports":{"anchor":true,"align":false,"alignWide":false,"color":{"__experimentalSkipSerialization":true,"gradients":true,"__experimentalDefaultControls":{"background":true,"text":true}},"typography":{"fontSize":true,"lineHeight":true,"__experimentalFontFamily":true,"__experimentalFontWeight":true,"__experimentalFontStyle":true,"__experimentalTextTransform":true,"__experimentalTextDecoration":true,"__experimentalLetterSpacing":true,"__experimentalDefaultControls":{"fontSize":true}},"reusable":false,"shadow":true,"spacing":{"__experimentalSkipSerialization":true,"padding":["horizontal","vertical"],"__experimentalDefaultControls":{"padding":true}},"__experimentalBorder":{"color":true,"radius":true,"style":true,"width":true,"__experimentalSkipSerialization":true,"__experimentalDefaultControls":{"color":true,"radius":true,"style":true,"width":true}},"__experimentalSelector":".wp-block-wc-cart-button-cart-pdf-button .cart-pdf-button"},"editorScript":"file:./blocks.js","style":["file:./blocks.css"]}');var l=r(893);function s(e){return s="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},s(e)}function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==s(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===s(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f=i.name;(0,o.registerBlockType)("wc-cart-pdf/cart-pdf",c(c({name:f},i),{},{example:{attributes:{text:"Download Cart as PDF"}},edit:function(e){var r=e.attributes,i=e.setAttributes,s=r.text,u=(0,a.__experimentalUseBorderProps)(r),p=(0,a.__experimentalUseColorProps)(r),f=(0,a.__experimentalGetSpacingClassesAndStyles)(r),d=t()("cart-pdf-button","button","wp-element-button",p.className,u.className);return(0,l.jsx)("div",c(c({},(0,a.useBlockProps)()),{},{children:(0,l.jsx)(a.RichText,{tagName:"a","aria-label":(0,n.__)("Button text","wc-cart-pdf"),placeholder:(0,n.__)("Add text…","wc-cart-pdf"),value:s,onChange:function(e){return i({text:e})},withoutInteractiveFormatting:!0,className:d,style:c(c(c({},u.style),p.style),f.style),onSplit:function(){return(0,o.createBlock)("core/paragraph")},identifier:"text",rel:"nofollow noopener"})}))},save:function(e){var r=e.attributes,n=r.text,o=(0,a.__experimentalGetBorderClassesAndStyles)(r),i=(0,a.__experimentalGetColorClassesAndStyles)(r),s=(0,a.__experimentalGetSpacingClassesAndStyles)(r),u=t()("cart-pdf-button","button","wp-element-button",i.className,o.className);return(0,l.jsx)("div",c(c({},a.useBlockProps.save()),{},{children:(0,l.jsx)(a.RichText.Content,{tagName:"a",value:n,className:u,style:c(c(c({},o.style),i.style),s.style),target:"_blank",rel:"nofollow noopener"})}))}})),document.addEventListener("DOMContentLoaded",(function(){(0,window.wc.blocksCheckout.registerCheckoutFilters)("example-extension",{additionalCartCheckoutInnerBlockTypes:function(e){return e.push("wc-cart-button/cart-pdf-button"),e}})}))})()})();
     2(()=>{var t={20:(t,e,r)=>{"use strict";var n=r(609),o=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(t,e,r){var n,a={},u=null,c=null;for(n in void 0!==r&&(u=""+r),void 0!==e.key&&(u=""+e.key),void 0!==e.ref&&(c=e.ref),e)i.call(e,n)&&!s.hasOwnProperty(n)&&(a[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps)void 0===a[n]&&(a[n]=e[n]);return{$$typeof:o,type:t,key:u,ref:c,props:a,_owner:l.current}}e.jsx=u},848:(t,e,r)=>{"use strict";t.exports=r(20)},609:t=>{"use strict";t.exports=window.React},942:(t,e)=>{var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var t="",e=0;e<arguments.length;e++){var r=arguments[e];r&&(t=i(t,a(r)))}return t}function a(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return o.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var r in t)n.call(t,r)&&t[r]&&(e=i(e,r));return e}function i(t,e){return e?t?t+" "+e:t+e:t}t.exports?(o.default=o,t.exports=o):void 0===(r=function(){return o}.apply(e,[]))||(t.exports=r)}()}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=r(942),e=r.n(t);const n=window.wp.i18n,o=window.wp.blocks,a=window.wp.blockEditor,i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"wc-cart-button/cart-pdf-button","title":"Cart PDF Button","category":"design","description":"Download WooCommerce cart as PDF.","keywords":["button","cart","pdf"],"textdomain":"wc-cart-pdf","attributes":{"text":{"type":"string","source":"html","selector":"a","__experimentalRole":"content","default":"Download Cart as PDF"},"backgroundColor":{"type":"string"},"textColor":{"type":"string"},"gradient":{"type":"string"},"width":{"type":"number"}},"supports":{"anchor":true,"align":false,"alignWide":false,"color":{"__experimentalSkipSerialization":true,"gradients":true,"__experimentalDefaultControls":{"background":true,"text":true}},"typography":{"fontSize":true,"lineHeight":true,"__experimentalFontFamily":true,"__experimentalFontWeight":true,"__experimentalFontStyle":true,"__experimentalTextTransform":true,"__experimentalTextDecoration":true,"__experimentalLetterSpacing":true,"__experimentalDefaultControls":{"fontSize":true}},"reusable":false,"shadow":true,"spacing":{"__experimentalSkipSerialization":true,"padding":["horizontal","vertical"],"__experimentalDefaultControls":{"padding":true}},"__experimentalBorder":{"color":true,"radius":true,"style":true,"width":true,"__experimentalSkipSerialization":true,"__experimentalDefaultControls":{"color":true,"radius":true,"style":true,"width":true}},"__experimentalSelector":".wp-block-wc-cart-button-cart-pdf-button .cart-pdf-button"},"editorScript":"file:./blocks.js","style":["file:./blocks.css"]}');var l=r(848);function s(t){return s="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},s(t)}function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach((function(e){p(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function p(t,e,r){var n;return n=function(t,e){if("object"!=s(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(e,"string"),(e="symbol"==s(n)?n:String(n))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var f=i.name;(0,o.registerBlockType)("wc-cart-pdf/cart-pdf",c(c({name:f},i),{},{example:{attributes:{text:"Download Cart as PDF"}},edit:function(t){var r=t.attributes,i=t.setAttributes,s=r.text,u=(0,a.__experimentalUseBorderProps)(r),p=(0,a.__experimentalUseColorProps)(r),f=(0,a.__experimentalGetSpacingClassesAndStyles)(r),d=e()("cart-pdf-button","button","wp-element-button",p.className,u.className);return(0,l.jsx)("div",c(c({},(0,a.useBlockProps)()),{},{children:(0,l.jsx)(a.RichText,{tagName:"a","aria-label":(0,n.__)("Button text","wc-cart-pdf"),placeholder:(0,n.__)("Add text…","wc-cart-pdf"),value:s,onChange:function(t){return i({text:t})},withoutInteractiveFormatting:!0,className:d,style:c(c(c({},u.style),p.style),f.style),onSplit:function(){return(0,o.createBlock)("core/paragraph")},identifier:"text",rel:"nofollow noopener"})}))},save:function(t){var r=t.attributes,n=r.text,o=(0,a.__experimentalGetBorderClassesAndStyles)(r),i=(0,a.__experimentalGetColorClassesAndStyles)(r),s=(0,a.__experimentalGetSpacingClassesAndStyles)(r),u=e()("cart-pdf-button","button","wp-element-button",i.className,o.className);return(0,l.jsx)("div",c(c({},a.useBlockProps.save()),{},{children:(0,l.jsx)(a.RichText.Content,{tagName:"a",value:n,className:u,style:c(c(c({},o.style),i.style),s.style),target:"_blank",rel:"nofollow noopener"})}))}})),document.addEventListener("DOMContentLoaded",(function(){(0,window.wc.blocksCheckout.registerCheckoutFilters)("wc-cart-pdf",{additionalCartCheckoutInnerBlockTypes:function(t){return t.push("wc-cart-button/cart-pdf-button"),t}})}))})()})();
  • wc-cart-pdf/trunk/assets/js/wc-cart-pdf.asset.php

    r3000367 r3049171  
    1 <?php return array('dependencies' => array(), 'version' => '18cd043881021062');
     1<?php return array('dependencies' => array(), 'version' => 'bec0048d46997709');
  • wc-cart-pdf/trunk/assets/js/wc-cart-pdf.js

    r3000367 r3049171  
    11/*! For license information please see wc-cart-pdf.js.LICENSE.txt */
    2 (()=>{"use strict";var e,r={263:()=>{function e(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)e[n]=t[n]}return e}var r,t,n=function r(t,n){function o(r,o,i){if("undefined"!=typeof document){"number"==typeof(i=e({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var a in i)i[a]&&(c+="; "+a,!0!==i[a]&&(c+="="+i[a].split(";")[0]));return document.cookie=r+"="+t.write(o,r)+c}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},o=0;o<r.length;o++){var i=r[o].split("="),c=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(n[a]=t.read(c,a),e===a)break}catch(e){}}return e?n[e]:n}},remove:function(r,t){o(r,"",e({},t,{expires:-1}))},withAttributes:function(t){return r(this.converter,e({},this.attributes,t))},withConverter:function(t){return r(e({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});r=jQuery('form[name="checkout"]'),t=cartpdf.capture_fields||[],r.on("change",":input",(function(e){e.preventDefault();var r=new FormData(document.querySelectorAll('form[name="checkout"]')[0]),o={};r.forEach((function(e,r){t.includes(r)&&(o[r]=e)}));var i=JSON.stringify(o);n.set("wc-cart-pdf-customer",i)}))},440:()=>{}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var i=t[e]={exports:{}};return r[e](i,i.exports,n),i.exports}n.m=r,e=[],n.O=(r,t,o,i)=>{if(!t){var c=1/0;for(p=0;p<e.length;p++){for(var[t,o,i]=e[p],a=!0,u=0;u<t.length;u++)(!1&i||c>=i)&&Object.keys(n.O).every((e=>n.O[e](t[u])))?t.splice(u--,1):(a=!1,i<c&&(c=i));if(a){e.splice(p--,1);var f=o();void 0!==f&&(r=f)}}return r}i=i||0;for(var p=e.length;p>0&&e[p-1][2]>i;p--)e[p]=e[p-1];e[p]=[t,o,i]},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={75:0,572:0};n.O.j=r=>0===e[r];var r=(r,t)=>{var o,i,[c,a,u]=t,f=0;if(c.some((r=>0!==e[r]))){for(o in a)n.o(a,o)&&(n.m[o]=a[o]);if(u)var p=u(n)}for(r&&r(t);f<c.length;f++)i=c[f],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return n.O(p)},t=self.webpackChunkwc_cart_pdf=self.webpackChunkwc_cart_pdf||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),n.O(void 0,[572],(()=>n(263)));var o=n.O(void 0,[572],(()=>n(440)));o=n.O(o)})();
     2(()=>{var e,t={623:(e,t,r)=>{"use strict";function n(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var o=function e(t,r){function o(e,o,i){if("undefined"!=typeof document){"number"==typeof(i=n({},r,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var a in i)i[a]&&(c+="; "+a,!0!==i[a]&&(c+="="+i[a].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+c}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},o=0;o<r.length;o++){var i=r[o].split("="),c=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(n[a]=t.read(c,a),e===a)break}catch(e){}}return e?n[e]:n}},remove:function(e,t){o(e,"",n({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,n({},this.attributes,t))},withConverter:function(t){return e(n({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"}),i=r(221),c=r.n(i);function a(e){return a="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},a(e)}var u=function(e){var t=cartpdf.capture_fields||[];try{if(!e||"object"!==a(e))throw new Error("Invalid object");for(var r in e)t.includes(r)||delete e[r];var n=JSON.stringify(e);o.set("wc-cart-pdf-customer",n)}catch(e){console.error(e)}};const l=function(){if("undefined"!=typeof wp&&wp&&wp.data){var e=c()((function(){var e=wp.data.select("wc/store/cart").getCustomerData(),t={};for(var r in e.shippingAddress)t["shipping_".concat(r)]=e.shippingAddress[r];for(var n in e.billingAddress)t["billing_".concat(n)]=e.billingAddress[n];u(t)}),250);wp.data.subscribe(e)}var t=document.querySelector('form[name="checkout"]'),r=null==t?void 0:t.querySelectorAll("input, textarea, select");null==r||r.forEach((function(e){e.addEventListener("change",(function(e){e.preventDefault();var r=new FormData(t),n={};r.forEach((function(e,t){n[t]=e})),u(n)}))}))};function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,c,a=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(c=r.return(),Object(c)!==c))return}finally{if(l)throw o}}return a}}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}const p=function(){var e=document.getElementById("wc-cart-pdf-modal"),t=null==e?void 0:e.querySelector("form"),r=null==t?void 0:t.getAttribute("action"),n=null==e?void 0:e.querySelector("#wc-cart-pdf-capture-form-errors");if(e&&t&&r&&n){var i,c=document.querySelector(".cart-pdf-button"),a=!1;(null==c?void 0:c.addEventListener("click",l))||(i=setInterval((function(){document.querySelector(".cart-pdf-button")&&(clearInterval(i),document.querySelector(".cart-pdf-button").addEventListener("click",l))}),250)),t.addEventListener("submit",(function(i){if(i.preventDefault(),!a){a=!0;var c,u=new FormData(t),l={},d=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=s(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return c=e.done,e},e:function(e){a=!0,i=e},f:function(){try{c||null==r.return||r.return()}finally{if(a)throw i}}}}(u.entries());try{for(d.s();!(c=d.n()).done;){var p=f(c.value,2),v=p[0],y=p[1];l[v]=y}}catch(e){d.e(e)}finally{d.f()}o.set("wc-cart-pdf-customer",JSON.stringify(l)),l.nonce=cartpdf.nonce,fetch("".concat(cartpdf.ajax_url,"?action=wc_cart_pdf_modal_form_save"),{method:"POST",body:new URLSearchParams(l).toString(),headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then((function(e){return e.json()})).then((function(t){if(t.success){var o=new URL(r);l.email_copy&&"1"===l.email_copy&&o.searchParams.set("email_copy","1"),window.location.href=o.toString(),e.close()}else n.textContent=(null==t?void 0:t.data)||"An error occurred."})).catch((function(e){var t;n.textContent=(null==e||null===(t=e.responseJSON)||void 0===t?void 0:t.data)||"An error occurred."})).finally((function(){a=!1}))}}))}else console.error("WC Cart PDF: Modal capture elements not found.");function u(t){t.target!==e&&t.target!==e.querySelector(".wc-cart-pdf-modal-close")||(e.close(),e.removeEventListener("click",u))}function l(r){r.preventDefault(),e.showModal(),t.querySelector("input").focus(),e.addEventListener("click",u)}};document.addEventListener("DOMContentLoaded",(function(){var e,t;null!==(e=cartpdf)&&void 0!==e&&null!==(e=e.modules)&&void 0!==e&&e.capture_customer&&l(),null!==(t=cartpdf)&&void 0!==t&&null!==(t=t.modules)&&void 0!==t&&t.modal_capture&&p()}))},873:(e,t,r)=>{var n=r(325).Symbol;e.exports=n},552:(e,t,r)=>{var n=r(873),o=r(659),i=r(350),c=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":c&&c in Object(e)?o(e):i(e)}},128:(e,t,r)=>{var n=r(800),o=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(o,""):e}},840:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},659:(e,t,r)=>{var n=r(873),o=Object.prototype,i=o.hasOwnProperty,c=o.toString,a=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var o=c.call(e);return n&&(t?e[a]=r:delete e[a]),o}},350:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},325:(e,t,r)=>{var n=r(840),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();e.exports=i},800:e=>{var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},221:(e,t,r)=>{var n=r(805),o=r(124),i=r(374),c=Math.max,a=Math.min;e.exports=function(e,t,r){var u,l,f,s,d,p,v=0,y=!1,m=!1,b=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var r=u,n=l;return u=l=void 0,v=t,s=e.apply(n,r)}function g(e){var r=e-p;return void 0===p||r>=t||r<0||m&&e-v>=f}function w(){var e=o();if(g(e))return x(e);d=setTimeout(w,function(e){var r=t-(e-p);return m?a(r,f-(e-v)):r}(e))}function x(e){return d=void 0,b&&u?h(e):(u=l=void 0,s)}function S(){var e=o(),r=g(e);if(u=arguments,l=this,p=e,r){if(void 0===d)return function(e){return v=e,d=setTimeout(w,t),y?h(e):s}(p);if(m)return clearTimeout(d),d=setTimeout(w,t),h(p)}return void 0===d&&(d=setTimeout(w,t)),s}return t=i(t)||0,n(r)&&(y=!!r.leading,f=(m="maxWait"in r)?c(i(r.maxWait)||0,t):f,b="trailing"in r?!!r.trailing:b),S.cancel=function(){void 0!==d&&clearTimeout(d),v=0,u=p=l=d=void 0},S.flush=function(){return void 0===d?s:x(o())},S}},805:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},394:(e,t,r)=>{var n=r(552),o=r(346);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==n(e)}},124:(e,t,r)=>{var n=r(325);e.exports=function(){return n.Date.now()}},374:(e,t,r)=>{var n=r(128),o=r(805),i=r(394),c=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=a.test(e);return r||u.test(e)?l(e.slice(2),r?2:8):c.test(e)?NaN:+e}},594:()=>{},917:()=>{}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.m=t,e=[],n.O=(t,r,o,i)=>{if(!r){var c=1/0;for(f=0;f<e.length;f++){for(var[r,o,i]=e[f],a=!0,u=0;u<r.length;u++)(!1&i||c>=i)&&Object.keys(n.O).every((e=>n.O[e](r[u])))?r.splice(u--,1):(a=!1,i<c&&(c=i));if(a){e.splice(f--,1);var l=o();void 0!==l&&(t=l)}}return t}i=i||0;for(var f=e.length;f>0&&e[f-1][2]>i;f--)e[f]=e[f-1];e[f]=[r,o,i]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={864:0,913:0,910:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var o,i,[c,a,u]=r,l=0;if(c.some((t=>0!==e[t]))){for(o in a)n.o(a,o)&&(n.m[o]=a[o]);if(u)var f=u(n)}for(t&&t(r);l<c.length;l++)i=c[l],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return n.O(f)},r=self.webpackChunkwc_cart_pdf=self.webpackChunkwc_cart_pdf||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),n.O(void 0,[913,910],(()=>n(623))),n.O(void 0,[913,910],(()=>n(594)));var o=n.O(void 0,[913,910],(()=>n(917)));o=n.O(o)})();
  • wc-cart-pdf/trunk/includes/markup.php

    r2576121 r3049171  
    55 * @package dkjensen/wc-cart-pdf
    66 */
     7
     8/**
     9 * Enqueue script to save customer information in a cookie
     10 *
     11 * @return void
     12 */
     13function wc_cart_pdf_scripts() {
     14    wp_enqueue_style( 'wc-cart-pdf', WC_CART_PDF_URL . 'assets/css/wc-cart-pdf.css', array(), WC_CART_PDF_VER );
     15
     16    wp_register_script( 'wc-cart-pdf', WC_CART_PDF_URL . 'assets/js/wc-cart-pdf.js', array(), WC_CART_PDF_VER, true );
     17
     18    wp_localize_script(
     19        'wc-cart-pdf',
     20        'cartpdf',
     21        array(
     22            'modules'        => array(
     23                'capture_customer' => (int) get_option( 'wc_cart_pdf_capture_customer', 0 ),
     24                'modal_capture'    => (int) get_option( 'wc_cart_pdf_modal_capture', 0 ),
     25            ),
     26            'ajax_url'       => admin_url( 'admin-ajax.php' ),
     27            'nonce'          => wp_create_nonce( 'wc_cart_pdf_modal' ),
     28            'capture_fields' => apply_filters(
     29                'wc_cart_pdf_capture_customer_fields',
     30                array(
     31                    'email',
     32                    'first_name',
     33                    'last_name',
     34                    'display_name',
     35                    'username',
     36                    'billing_first_name',
     37                    'billing_last_name',
     38                    'billing_company',
     39                    'billing_address_1',
     40                    'billing_address_2',
     41                    'billing_city',
     42                    'billing_postcode',
     43                    'billing_country',
     44                    'billing_state',
     45                    'billing_email',
     46                    'billing_phone',
     47                    'shipping_first_name',
     48                    'shipping_last_name',
     49                    'shipping_company',
     50                    'shipping_address_1',
     51                    'shipping_address_2',
     52                    'shipping_city',
     53                    'shipping_postcode',
     54                    'shipping_country',
     55                    'shipping_state',
     56                )
     57            ),
     58        )
     59    );
     60
     61    wp_enqueue_script( 'wc-cart-pdf' );
     62}
     63add_action( 'wp_enqueue_scripts', 'wc_cart_pdf_scripts' );
    764
    865/**
     
    2986 * Renders the download cart as PDF button in checkout
    3087 *
    31  * @since 2.1.4
    3288 * @return void
    3389 */
     
    44100 * Expand {site_title} placeholder variable
    45101 *
    46  * @since 1.0.3
    47102 * @param string $string Default footer text.
    48103 * @return string
  • wc-cart-pdf/trunk/includes/modules/capture-customer.php

    r2576407 r3049171  
    55 * @package dkjensen/wc-cart-pdf
    66 */
    7 
    8 if ( ! function_exists( 'get_option' ) || ! get_option( 'wc_cart_pdf_capture_customer', false ) ) {
    9     return;
    10 }
    11 
    12 /**
    13  * Enqueue script to save customer information in a cookie
    14  *
    15  * @since 2.1.4
    16  * @return void
    17  */
    18 function wc_cart_pdf_scripts() {
    19     wp_register_script( 'wc-cart-pdf', WC_CART_PDF_URL . 'assets/js/wc-cart-pdf.js', array( 'jquery' ), WC_CART_PDF_VER, true );
    20 
    21     wp_localize_script(
    22         'wc-cart-pdf',
    23         'cartpdf',
    24         array(
    25             'capture_fields' => apply_filters(
    26                 'wc_cart_pdf_capture_customer_fields',
    27                 array(
    28                     'email',
    29                     'first_name',
    30                     'last_name',
    31                     'display_name',
    32                     'username',
    33                     'billing_first_name',
    34                     'billing_last_name',
    35                     'billing_company',
    36                     'billing_address_1',
    37                     'billing_address_2',
    38                     'billing_city',
    39                     'billing_postcode',
    40                     'billing_country',
    41                     'billing_state',
    42                     'billing_email',
    43                     'billing_phone',
    44                     'shipping_first_name',
    45                     'shipping_last_name',
    46                     'shipping_company',
    47                     'shipping_address_1',
    48                     'shipping_address_2',
    49                     'shipping_city',
    50                     'shipping_postcode',
    51                     'shipping_country',
    52                     'shipping_state',
    53                 )
    54             ),
    55         )
    56     );
    57 
    58     wp_enqueue_script( 'wc-cart-pdf' );
    59 }
    60 add_action( 'wp_enqueue_scripts', 'wc_cart_pdf_scripts' );
    617
    628/**
  • wc-cart-pdf/trunk/includes/modules/copy-admin.php

    r2576121 r3049171  
    55 * @package dkjensen/wc-cart-pdf
    66 */
    7 
    8 if ( ! function_exists( 'get_option' ) || ! get_option( 'wc_cart_pdf_copy_admin', false ) ) {
    9     return;
    10 }
    117
    128/**
  • wc-cart-pdf/trunk/includes/modules/unique-increment.php

    r2619353 r3049171  
    55 * @package dkjensen/wc-cart-pdf
    66 */
    7 
    8 if ( ! function_exists( 'get_option' ) || ! get_option( 'wc_cart_pdf_unique_increment', false ) ) {
    9     return;
    10 }
    117
    128/**
  • wc-cart-pdf/trunk/languages/wc-cart-pdf.pot

    r3000367 r3049171  
    1 # Copyright (C) 2023 CloudCatch LLC
     1# Copyright (C) 2024 CloudCatch LLC
    22# This file is distributed under the same license as the WooCommerce Cart PDF package.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WooCommerce Cart PDF 2.7.0\n"
     5"Project-Id-Version: WooCommerce Cart PDF 2.8.0\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wc-cart-pdf\n"
    7 "POT-Creation-Date: 2023-11-22 21:48:15+00:00\n"
     7"POT-Creation-Date: 2024-03-11 13:45:22+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=utf-8\n"
    1010"Content-Transfer-Encoding: 8bit\n"
    11 "PO-Revision-Date: 2023-MO-DA HO:MI+ZONE\n"
     11"PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n"
    1212"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    1313"Language-Team: LANGUAGE <LL@li.org>\n"
     
    2323msgstr ""
    2424
    25 #: includes/markup.php:21 wc-cart-pdf.php:234
     25#: includes/class-wc-cart-pdf-settings.php:18
     26msgid "Cart PDF"
     27msgstr ""
     28
     29#: includes/class-wc-cart-pdf-settings.php:19
     30msgid "WC Cart PDF allows customers to download their cart as a PDF."
     31msgstr ""
     32
     33#: includes/class-wc-cart-pdf-settings.php:181
     34msgid "Button label"
     35msgstr ""
     36
     37#: includes/class-wc-cart-pdf-settings.php:182
     38msgid "Text that is displayed on the button which generates the PDF."
     39msgstr ""
     40
     41#: includes/class-wc-cart-pdf-settings.php:185 includes/markup.php:78
    2642msgid "Download Cart as PDF"
    2743msgstr ""
    2844
    29 #: includes/modules/copy-admin.php:29
     45#: includes/class-wc-cart-pdf-settings.php:188
     46msgid "Logo URL"
     47msgstr ""
     48
     49#: includes/class-wc-cart-pdf-settings.php:189
     50msgid "Image URL of logo for the cart PDF, must live on current server."
     51msgstr ""
     52
     53#: includes/class-wc-cart-pdf-settings.php:195
     54msgid "Logo width"
     55msgstr ""
     56
     57#: includes/class-wc-cart-pdf-settings.php:196
     58msgid "Logo size used for the cart PDF."
     59msgstr ""
     60
     61#: includes/class-wc-cart-pdf-settings.php:203
     62msgid "Logo alignment"
     63msgstr ""
     64
     65#: includes/class-wc-cart-pdf-settings.php:204
     66msgid "Alignment of the logo within header of the cart PDF."
     67msgstr ""
     68
     69#: includes/class-wc-cart-pdf-settings.php:209
     70msgid "Left"
     71msgstr ""
     72
     73#: includes/class-wc-cart-pdf-settings.php:210
     74msgid "Center"
     75msgstr ""
     76
     77#: includes/class-wc-cart-pdf-settings.php:211
     78msgid "Right"
     79msgstr ""
     80
     81#: includes/class-wc-cart-pdf-settings.php:215
     82msgid "Open PDF in new tab instead of downloading"
     83msgstr ""
     84
     85#: includes/class-wc-cart-pdf-settings.php:222
     86msgid "Send a copy of PDF to admin via email"
     87msgstr ""
     88
     89#: includes/class-wc-cart-pdf-settings.php:229
     90msgid "Show Download Cart as PDF on checkout"
     91msgstr ""
     92
     93#: includes/class-wc-cart-pdf-settings.php:236
     94msgid "Capture customer information on checkout"
     95msgstr ""
     96
     97#: includes/class-wc-cart-pdf-settings.php:243
     98msgid "Display unique generated PDF number"
     99msgstr ""
     100
     101#: includes/class-wc-cart-pdf-settings.php:250
     102msgid "Require customer to populate their information before downloading PDF"
     103msgstr ""
     104
     105#: includes/modules/copy-admin.php:25
    30106msgid "A user has downloaded their cart as PDF, and is attached to this email."
    31107msgstr ""
    32108
    33 #: includes/modules/copy-admin.php:34
     109#: includes/modules/copy-admin.php:30
    34110msgid "Name"
    35111msgstr ""
    36112
    37 #: includes/modules/copy-admin.php:35
     113#: includes/modules/copy-admin.php:31 templates/modal-capture.php:16
    38114msgid "Email"
    39115msgstr ""
    40116
    41 #: includes/modules/copy-admin.php:52
     117#: includes/modules/copy-admin.php:48
    42118msgid "A user has downloaded their cart as PDF"
    43119msgstr ""
    44120
    45 #: templates/cart-table.php:52 templates/cart-table.php:92
     121#: includes/modules/modal-capture.php:33
     122msgid "Email is required."
     123msgstr ""
     124
     125#: includes/modules/modal-capture.php:49
     126msgid "Security check failed."
     127msgstr ""
     128
     129#: includes/modules/modal-capture.php:64
     130msgid "Customer information saved."
     131msgstr ""
     132
     133#: includes/modules/modal-capture.php:86
     134msgid "A copy of your cart has been attached as a PDF to this email."
     135msgstr ""
     136
     137#: includes/modules/modal-capture.php:91
     138#. translators: %s site title
     139msgid "Your cart from %s"
     140msgstr ""
     141
     142#: templates/cart-table.php:49 templates/cart-table.php:89
    46143msgid "Product"
    47144msgstr ""
    48145
    49 #: templates/cart-table.php:53 templates/cart-table.php:112
     146#: templates/cart-table.php:50 templates/cart-table.php:109
    50147msgid "Price"
    51148msgstr ""
    52149
    53 #: templates/cart-table.php:54 templates/cart-table.php:118
     150#: templates/cart-table.php:51 templates/cart-table.php:115
    54151msgid "Quantity"
    55152msgstr ""
    56153
    57 #: templates/cart-table.php:55 templates/cart-table.php:122
    58 #: templates/cart-table.php:185 templates/cart-table.php:186
     154#: templates/cart-table.php:52 templates/cart-table.php:119
     155#: templates/cart-table.php:182 templates/cart-table.php:183
    59156msgid "Total"
    60157msgstr ""
    61158
    62 #: templates/cart-table.php:107
     159#: templates/cart-table.php:104
    63160msgid "Available on backorder"
    64161msgstr ""
    65162
    66 #: templates/cart-table.php:134 templates/cart-table.php:135
     163#: templates/cart-table.php:131 templates/cart-table.php:132
    67164msgid "Subtotal"
    68165msgstr ""
    69166
    70 #: templates/cart-table.php:140 templates/cart-table.php:141
     167#: templates/cart-table.php:137 templates/cart-table.php:138
    71168msgid "Shipping"
    72169msgstr ""
    73170
    74 #: templates/cart-table.php:163
     171#: templates/cart-table.php:160
    75172msgid "(estimated for %s)"
     173msgstr ""
     174
     175#: templates/modal-capture.php:13
     176msgid "Please enter your email address to receive your cart as a PDF."
     177msgstr ""
     178
     179#: templates/modal-capture.php:20
     180msgid "Send a copy of the PDF via email."
     181msgstr ""
     182
     183#: templates/modal-capture.php:23
     184msgid "Submit"
    76185msgstr ""
    77186
     
    80189msgstr ""
    81190
    82 #: wc-cart-pdf.php:68
     191#: wc-cart-pdf.php:90
    83192msgid "WooCommerce Cart PDF requirements not met"
    84193msgstr ""
    85194
    86 #: wc-cart-pdf.php:69
     195#: wc-cart-pdf.php:91
    87196msgid ""
    88197"WooCommerce Cart PDF requires at least PHP 5.6.0 with the mbstring and gd "
     
    90199msgstr ""
    91200
    92 #: wc-cart-pdf.php:110
     201#: wc-cart-pdf.php:132
    93202msgid "Invalid nonce. Unable to process PDF for download."
    94 msgstr ""
    95 
    96 #: wc-cart-pdf.php:225
    97 msgid "Cart PDF"
    98 msgstr ""
    99 
    100 #: wc-cart-pdf.php:245
    101 msgid "Button label"
    102 msgstr ""
    103 
    104 #: wc-cart-pdf.php:246
    105 msgid "Text that is displayed on the button which generates the PDF."
    106 msgstr ""
    107 
    108 #: wc-cart-pdf.php:267
    109 msgid "Logo URL"
    110 msgstr ""
    111 
    112 #: wc-cart-pdf.php:268
    113 msgid "Image URL of logo for the cart PDF, must live on current server."
    114 msgstr ""
    115 
    116 #: wc-cart-pdf.php:290
    117 msgid "Logo width"
    118 msgstr ""
    119 
    120 #: wc-cart-pdf.php:291
    121 msgid "Logo size used for the cart PDF."
    122 msgstr ""
    123 
    124 #: wc-cart-pdf.php:317
    125 msgid "Logo alignment"
    126 msgstr ""
    127 
    128 #: wc-cart-pdf.php:318
    129 msgid "Alignment of the logo within header of the cart PDF."
    130 msgstr ""
    131 
    132 #: wc-cart-pdf.php:323
    133 msgid "Left"
    134 msgstr ""
    135 
    136 #: wc-cart-pdf.php:324
    137 msgid "Center"
    138 msgstr ""
    139 
    140 #: wc-cart-pdf.php:325
    141 msgid "Right"
    142 msgstr ""
    143 
    144 #: wc-cart-pdf.php:393
    145 msgid "Open PDF in new tab instead of downloading"
    146 msgstr ""
    147 
    148 #: wc-cart-pdf.php:403
    149 msgid "Send a copy of PDF to admin via email"
    150 msgstr ""
    151 
    152 #: wc-cart-pdf.php:413
    153 msgid "Show Download Cart as PDF on checkout"
    154 msgstr ""
    155 
    156 #: wc-cart-pdf.php:423
    157 msgid "Capture customer information on checkout"
    158 msgstr ""
    159 
    160 #: wc-cart-pdf.php:433
    161 msgid "Display unique generated PDF number"
    162203msgstr ""
    163204
  • wc-cart-pdf/trunk/readme.txt

    r3000367 r3049171  
    11=== WooCommerce Cart PDF ===
    22Contributors: cloudcatch, dkjensen, seattlewebco, davidperez, exstheme
    3 Tested up to: 6.4.1
     3Tested up to: 6.4.3
    44Requires PHP: 5.6.0
    5 Stable tag: 2.7.0
     5Stable tag: 2.8.0
    66
    77Adds ability for users and guests to download their WooCommerce cart as PDF
     
    2727
    2828== Changelog ==
     29
     302.8.0
     31* Migrate settings to WooCommerce > Settings > Integration > Cart PDF
     32* Add ability to capture customer details via modal popup before downloading cart as PDF
     33* Additional compatbility with WooCommerce blocks
    2934
    30352.7.0
  • wc-cart-pdf/trunk/templates/cart-table.php

    r2619353 r3049171  
    33 * WC Cart PDF template
    44 *
    5  * @package wc-cart-pdf
     5 * @package dkjensen/wc-cart-pdf
    66 */
    77
    88/**
    99 * Before template hook
    10  *
    11  * @since 1.0.4
    12  * @package dkjensen/wc-cart-pdf
    1310 */
    1411do_action( 'wc_cart_pdf_before_template' );
     
    201198/**
    202199 * After template hook
    203  *
    204  * @since 1.0.4
    205200 */
    206201do_action( 'wc_cart_pdf_after_template' );
  • wc-cart-pdf/trunk/vendor/composer/installed.php

    r3000367 r3049171  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => '0930e4ee28e4a1bbd20a8a512a25b37c39d526ea',
     6        'reference' => 'cf177ce1a8d7fddfefb154ea9fa1a2bf8c69fa4e',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => '0930e4ee28e4a1bbd20a8a512a25b37c39d526ea',
     16            'reference' => 'cf177ce1a8d7fddfefb154ea9fa1a2bf8c69fa4e',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • wc-cart-pdf/trunk/wc-cart-pdf.php

    r3000367 r3049171  
    33 * Plugin Name:         WooCommerce Cart PDF
    44 * Description:         Allows customers to download their cart as a PDF
    5  * Version:             2.7.0
     5 * Version:             2.8.0
    66 * Author:              CloudCatch LLC
    77 * Author URI:          https://cloudcatch.io
     
    1111 * Requires at least:   6.2
    1212 * Requires PHP:        5.6.0
    13  * WC tested up to:     8.3.1
     13 * WC tested up to:     8.6.1
    1414 *
    1515 * This program is free software; you can redistribute it and/or modify
     
    3232define( 'WC_CART_PDF_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
    3333define( 'WC_CART_PDF_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
    34 define( 'WC_CART_PDF_VER', '2.7.0' );
     34define( 'WC_CART_PDF_TEMPLATE_PATH', WC_CART_PDF_PATH . 'templates/' );
     35define( 'WC_CART_PDF_VER', '2.8.0' );
    3536
    3637require_once WC_CART_PDF_PATH . 'vendor/autoload.php';
     
    4041require_once WC_CART_PDF_PATH . 'includes/markup.php';
    4142require_once WC_CART_PDF_PATH . 'includes/blocks.php';
    42 
    43 require_once WC_CART_PDF_PATH . 'includes/modules/capture-customer.php';
    44 require_once WC_CART_PDF_PATH . 'includes/modules/copy-admin.php';
    45 require_once WC_CART_PDF_PATH . 'includes/modules/unique-increment.php';
     43require_once WC_CART_PDF_PATH . 'includes/settings.php';
     44
     45/**
     46 * Load modules
     47 *
     48 * @return void
     49 */
     50function wc_cart_pdf_load_modules() {
     51    if ( get_option( 'wc_cart_pdf_capture_customer', false ) ) {
     52        require_once WC_CART_PDF_PATH . 'includes/modules/capture-customer.php';
     53    }
     54
     55    if ( get_option( 'wc_cart_pdf_copy_admin', false ) ) {
     56        require_once WC_CART_PDF_PATH . 'includes/modules/copy-admin.php';
     57    }
     58
     59    if ( get_option( 'wc_cart_pdf_unique_increment', false ) ) {
     60        require_once WC_CART_PDF_PATH . 'includes/modules/unique-increment.php';
     61    }
     62
     63    if ( get_option( 'wc_cart_pdf_modal_capture', false ) ) {
     64        require_once WC_CART_PDF_PATH . 'includes/modules/modal-capture.php';
     65    }
     66}
     67add_action( 'plugins_loaded', 'wc_cart_pdf_load_modules' );
    4668
    4769/**
     
    128150    $mpdf->autoLangToFont       = true;
    129151
    130     $cart_table = wc_locate_template( 'cart-table.php', '/woocommerce/wc-cart-pdf/', __DIR__ . '/templates/' );
    131     $css        = wc_locate_template( 'pdf-styles.php', '/woocommerce/wc-cart-pdf/', __DIR__ . '/templates/' );
     152    $cart_table = wc_locate_template( 'cart-table.php', '/woocommerce/wc-cart-pdf/', WC_CART_PDF_TEMPLATE_PATH );
     153    $css        = wc_locate_template( 'pdf-styles.php', '/woocommerce/wc-cart-pdf/', WC_CART_PDF_TEMPLATE_PATH );
    132154
    133155    /**
     
    213235
    214236/**
    215  * Register various customizer options for modifying the cart PDF
    216  *
    217  * @since 1.0.3
    218  * @param WP_Customize_Manager $wp_customize Theme Customizer object.
    219  * @return void
    220  */
    221 function wc_cart_pdf_customize_register( $wp_customize ) {
    222     $wp_customize->add_section(
    223         'wc_cart_pdf',
    224         array(
    225             'title'                 => __( 'Cart PDF', 'wc-cart-pdf' ),
    226             'priority'              => 50,
    227             'panel'                 => 'woocommerce',
    228         )
    229     );
    230 
    231     $wp_customize->add_setting(
    232         'wc_cart_pdf_button_label',
    233         array(
    234             'default'               => __( 'Download Cart as PDF', 'wc-cart-pdf' ),
    235             'type'                  => 'option',
    236             'capability'            => 'manage_woocommerce',
    237             'sanitize_callback'     => 'esc_html',
    238             'transport'             => 'refresh',
    239         )
    240     );
    241 
    242     $wp_customize->add_control(
    243         'wc_cart_pdf_button_label',
    244         array(
    245             'label'                 => __( 'Button label', 'wc-cart-pdf' ),
    246             'description'           => __( 'Text that is displayed on the button which generates the PDF.', 'wc-cart-pdf' ),
    247             'section'               => 'wc_cart_pdf',
    248             'settings'              => 'wc_cart_pdf_button_label',
    249             'type'                  => 'text',
    250         )
    251     );
    252 
    253     $wp_customize->add_setting(
    254         'wc_cart_pdf_logo',
    255         array(
    256             'default'               => get_option( 'woocommerce_email_header_image' ),
    257             'type'                  => 'option',
    258             'capability'            => 'manage_woocommerce',
    259             'sanitize_callback'     => 'esc_url',
    260             'transport'             => 'postMessage',
    261         )
    262     );
    263 
    264     $wp_customize->add_control(
    265         'wc_cart_pdf_logo',
    266         array(
    267             'label'                 => __( 'Logo URL', 'wc-cart-pdf' ),
    268             'description'           => __( 'Image URL of logo for the cart PDF, must live on current server.', 'wc-cart-pdf' ),
    269             'section'               => 'wc_cart_pdf',
    270             'settings'              => 'wc_cart_pdf_logo',
    271             'type'                  => 'text',
    272         )
    273     );
    274 
    275     $wp_customize->add_setting(
    276         'wc_cart_pdf_logo_width',
    277         array(
    278             'default'               => 400,
    279             'type'                  => 'option',
    280             'capability'            => 'manage_woocommerce',
    281             'sanitize_callback'     => 'absint',
    282             'sanitize_js_callback'  => 'absint',
    283             'transport'             => 'postMessage',
    284         )
    285     );
    286 
    287     $wp_customize->add_control(
    288         'wc_cart_pdf_logo_width',
    289         array(
    290             'label'                 => __( 'Logo width', 'wc-cart-pdf' ),
    291             'description'           => __( 'Logo size used for the cart PDF.', 'wc-cart-pdf' ),
    292             'section'               => 'wc_cart_pdf',
    293             'settings'              => 'wc_cart_pdf_logo_width',
    294             'type'                  => 'number',
    295             'input_attrs'           => array(
    296                 'min'           => 0,
    297                 'step'          => 1,
    298             ),
    299         )
    300     );
    301 
    302     $wp_customize->add_setting(
    303         'wc_cart_pdf_logo_alignment',
    304         array(
    305             'default'               => 'center',
    306             'type'                  => 'option',
    307             'capability'            => 'manage_woocommerce',
    308             'sanitize_callback'     => 'wc_clean',
    309             'sanitize_js_callback'  => 'wc_clean',
    310             'transport'             => 'postMessage',
    311         )
    312     );
    313 
    314     $wp_customize->add_control(
    315         'wc_cart_pdf_logo_alignment',
    316         array(
    317             'label'                 => __( 'Logo alignment', 'wc-cart-pdf' ),
    318             'description'           => __( 'Alignment of the logo within header of the cart PDF.', 'wc-cart-pdf' ),
    319             'section'               => 'wc_cart_pdf',
    320             'settings'              => 'wc_cart_pdf_logo_alignment',
    321             'type'                  => 'radio',
    322             'choices'               => array(
    323                 'left'          => __( 'Left', 'wc-cart-pdf' ),
    324                 'center'        => __( 'Center', 'wc-cart-pdf' ),
    325                 'right'         => __( 'Right', 'wc-cart-pdf' ),
    326             ),
    327         )
    328     );
    329 
    330     $wp_customize->add_setting(
    331         'wc_cart_pdf_open_pdf',
    332         array(
    333             'default'               => '',
    334             'type'                  => 'option',
    335             'capability'            => 'manage_woocommerce',
    336             'sanitize_callback'     => 'wc_clean',
    337             'sanitize_js_callback'  => 'wc_clean',
    338             'transport'             => 'postMessage',
    339         )
    340     );
    341 
    342     $wp_customize->add_setting(
    343         'wc_cart_pdf_copy_admin',
    344         array(
    345             'default'               => '',
    346             'type'                  => 'option',
    347             'capability'            => 'manage_woocommerce',
    348             'sanitize_callback'     => 'wc_clean',
    349             'sanitize_js_callback'  => 'wc_clean',
    350             'transport'             => 'postMessage',
    351         )
    352     );
    353 
    354     $wp_customize->add_setting(
    355         'wc_cart_pdf_show_checkout',
    356         array(
    357             'default'               => '',
    358             'type'                  => 'option',
    359             'capability'            => 'manage_woocommerce',
    360             'sanitize_callback'     => 'wc_clean',
    361             'sanitize_js_callback'  => 'wc_clean',
    362             'transport'             => 'postMessage',
    363         )
    364     );
    365 
    366     $wp_customize->add_setting(
    367         'wc_cart_pdf_capture_customer',
    368         array(
    369             'default'               => '',
    370             'type'                  => 'option',
    371             'capability'            => 'manage_woocommerce',
    372             'sanitize_callback'     => 'wc_clean',
    373             'sanitize_js_callback'  => 'wc_clean',
    374             'transport'             => 'postMessage',
    375         )
    376     );
    377 
    378     $wp_customize->add_setting(
    379         'wc_cart_pdf_unique_increment',
    380         array(
    381             'default'               => '',
    382             'type'                  => 'option',
    383             'capability'            => 'manage_woocommerce',
    384             'sanitize_callback'     => 'wc_clean',
    385             'sanitize_js_callback'  => 'wc_clean',
    386             'transport'             => 'postMessage',
    387         )
    388     );
    389 
    390     $wp_customize->add_control(
    391         'wc_cart_pdf_open_pdf',
    392         array(
    393             'label'                 => __( 'Open PDF in new tab instead of downloading', 'wc-cart-pdf' ),
    394             'section'               => 'wc_cart_pdf',
    395             'settings'              => 'wc_cart_pdf_open_pdf',
    396             'type'                  => 'checkbox',
    397         )
    398     );
    399 
    400     $wp_customize->add_control(
    401         'wc_cart_pdf_copy_admin',
    402         array(
    403             'label'                 => __( 'Send a copy of PDF to admin via email', 'wc-cart-pdf' ),
    404             'section'               => 'wc_cart_pdf',
    405             'settings'              => 'wc_cart_pdf_copy_admin',
    406             'type'                  => 'checkbox',
    407         )
    408     );
    409 
    410     $wp_customize->add_control(
    411         'wc_cart_pdf_show_checkout',
    412         array(
    413             'label'                 => __( 'Show Download Cart as PDF on checkout', 'wc-cart-pdf' ),
    414             'section'               => 'wc_cart_pdf',
    415             'settings'              => 'wc_cart_pdf_show_checkout',
    416             'type'                  => 'checkbox',
    417         )
    418     );
    419 
    420     $wp_customize->add_control(
    421         'wc_cart_pdf_capture_customer',
    422         array(
    423             'label'                 => __( 'Capture customer information on checkout', 'wc-cart-pdf' ),
    424             'section'               => 'wc_cart_pdf',
    425             'settings'              => 'wc_cart_pdf_capture_customer',
    426             'type'                  => 'checkbox',
    427         )
    428     );
    429 
    430     $wp_customize->add_control(
    431         'wc_cart_pdf_unique_increment',
    432         array(
    433             'label'                 => __( 'Display unique generated PDF number', 'wc-cart-pdf' ),
    434             'section'               => 'wc_cart_pdf',
    435             'settings'              => 'wc_cart_pdf_unique_increment',
    436             'type'                  => 'checkbox',
    437         )
    438     );
    439 }
    440 add_action( 'customize_register', 'wc_cart_pdf_customize_register' );
    441 
    442 /**
    443237 * Declare compatibility with HPOS.
    444238 */
    445239add_action(
    446240    'before_woocommerce_init',
    447     function() {
     241    function () {
    448242        if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
    449243            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
Note: See TracChangeset for help on using the changeset viewer.