Changeset 3273939
- Timestamp:
- 04/15/2025 09:22:48 PM (12 months ago)
- Location:
- subscriptions-for-woo
- Files:
-
- 44 added
- 7 edited
-
tags/2.5.5 (added)
-
tags/2.5.5/autoload.php (added)
-
tags/2.5.5/classes (added)
-
tags/2.5.5/classes/PPSFWOO (added)
-
tags/2.5.5/classes/PPSFWOO/class-ppsfwoo-ajax-actions-priv.php (added)
-
tags/2.5.5/classes/PPSFWOO/class-ppsfwoo-ajax-actions.php (added)
-
tags/2.5.5/classes/PPSFWOO/class-ppsfwoo-database.php (added)
-
tags/2.5.5/classes/PPSFWOO/class-ppsfwoo-exception.php (added)
-
tags/2.5.5/classes/PPSFWOO/class-ppsfwoo-order.php (added)
-
tags/2.5.5/classes/PPSFWOO/class-ppsfwoo-pay-pal.php (added)
-
tags/2.5.5/classes/PPSFWOO/class-ppsfwoo-plan.php (added)
-
tags/2.5.5/classes/PPSFWOO/class-ppsfwoo-plugin-main.php (added)
-
tags/2.5.5/classes/PPSFWOO/class-ppsfwoo-product.php (added)
-
tags/2.5.5/classes/PPSFWOO/class-ppsfwoo-subscriber.php (added)
-
tags/2.5.5/classes/PPSFWOO/class-ppsfwoo-webhook.php (added)
-
tags/2.5.5/css (added)
-
tags/2.5.5/css/frontend.css (added)
-
tags/2.5.5/css/frontend.min.css (added)
-
tags/2.5.5/css/style.css (added)
-
tags/2.5.5/css/style.min.css (added)
-
tags/2.5.5/js (added)
-
tags/2.5.5/js/get-sub.js (added)
-
tags/2.5.5/js/get-sub.min.js (added)
-
tags/2.5.5/js/main.js (added)
-
tags/2.5.5/js/main.min.js (added)
-
tags/2.5.5/js/paypal-button.js (added)
-
tags/2.5.5/js/paypal-button.min.js (added)
-
tags/2.5.5/license.txt (added)
-
tags/2.5.5/readme.txt (added)
-
tags/2.5.5/subscriptions-for-woo.php (added)
-
tags/2.5.5/templates (added)
-
tags/2.5.5/templates/edit-user.php (added)
-
tags/2.5.5/templates/options-page.php (added)
-
tags/2.5.5/templates/paypal-button.php (added)
-
tags/2.5.5/templates/subscriber-table-settings-page.php (added)
-
tags/2.5.5/templates/tab-content (added)
-
tags/2.5.5/templates/tab-content/go-pro.php (added)
-
tags/2.5.5/templates/tab-content/tab-advanced.php (added)
-
tags/2.5.5/templates/tab-content/tab-general.php (added)
-
tags/2.5.5/templates/tab-content/tab-plans.php (added)
-
tags/2.5.5/templates/tab-content/tab-subscribers.php (added)
-
tags/2.5.5/templates/table-plans.php (added)
-
tags/2.5.5/templates/table-webhooks.php (added)
-
tags/2.5.5/templates/thank-you.php (added)
-
trunk/classes/PPSFWOO/class-ppsfwoo-pay-pal.php (modified) (3 diffs)
-
trunk/css/frontend.css (modified) (2 diffs)
-
trunk/css/frontend.min.css (modified) (1 diff)
-
trunk/js/paypal-button.js (modified) (1 diff)
-
trunk/js/paypal-button.min.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/subscriptions-for-woo.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
subscriptions-for-woo/trunk/classes/PPSFWOO/class-ppsfwoo-pay-pal.php
r3262268 r3273939 47 47 * Displays a PayPal button for a specific product, allowing customers to subscribe to a subscription product. 48 48 * 49 * @param null|int $product_id The ID of the product to display the button for. Defaults to the current product ID if not provided. 50 */ 51 public static function button($product_id = null) 49 * @param null|int $product_id The ID of the product to display the button for. Defaults to the current product ID if not provided. 50 * @param mixed $button_text 51 */ 52 public static function button($product_id = null, $button_text = '') 52 53 { 53 54 $product_id = !empty($product_id) ? $product_id : get_the_ID(); 55 56 $button_text = !empty($button_text) ? $button_text : PluginMain::get_option('ppsfwoo_button_text'); 54 57 55 58 $product = wc_get_product($product_id); … … 81 84 .addEventListener('click', function() { 82 85 this.style.display = 'none'; 83 document.getElementById('lds-ellipsis-{$product_id}').style.setProperty('display', ' inline-block', 'important');86 document.getElementById('lds-ellipsis-{$product_id}').style.setProperty('display', 'block'); 84 87 ppsfwooInitializePayPalSubscription({$product_id}, this); 85 88 }); … … 91 94 92 95 PluginMain::display_template('paypal-button', [ 93 'button_text' => PluginMain::get_option('ppsfwoo_button_text'),96 'button_text' => $button_text, 94 97 'product_id' => $product_id, 95 98 ]); -
subscriptions-for-woo/trunk/css/frontend.css
r3258064 r3273939 3 3 font-size:1.5em; 4 4 word-break: normal; 5 width: 100%; 5 6 } 6 7 .ppsfwoo-quantity-input { … … 30 31 } 31 32 .lds-ellipsis { 32 display: none !important;33 display: none; 33 34 position: relative; 34 35 width: 80px; 35 36 height: 80px; 37 margin: auto; 36 38 } 37 39 .lds-ellipsis div { -
subscriptions-for-woo/trunk/css/frontend.min.css
r3254343 r3273939 1 .ppsfwoo-subscribe-button{margin-bottom:15px;font-size:1.5em;word-break:normal }.ppsfwoo-quantity-input{margin-bottom:15px}.inactive-subscription,.ppsfwoo-cancelled{display:none}.subs-actions a{margin-right:10px;padding:10px}p.order-again{display:none}.please-wait{font-weight:bold}#waiting-ellipsis::after{content:'';animation:ellipsis-animation 2s infinite}.lds-ellipsis,.lds-ellipsis div{box-sizing:border-box}.lds-ellipsis{display:none !important;position:relative;width:80px;height:80px}.lds-ellipsis div{position:absolute;top:33.33333px;width:13.33333px;height:13.33333px;border-radius:50%;background:currentColor;animation-timing-function:cubic-bezier(0, 1, 1, 0)}.lds-ellipsis div:nth-child(1){left:8px;animation:lds-ellipsis1 0.6s infinite}.lds-ellipsis div:nth-child(2){left:8px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(3){left:32px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(4){left:56px;animation:lds-ellipsis3 0.6s infinite}@keyframes lds-ellipsis1{0%{transform:scale(0)}100%{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}100%{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0, 0)}100%{transform:translate(24px, 0)}}@keyframes ellipsis-animation{25%{content:'. '}50%{content:'. .'}75%{content:'. . .'}}@media screen and (max-width:673px){.subs-actions a{display:block;margin-bottom:3px;text-align:center !important}.subs-actions::before{content:"" !important}.subs-actions a.inactive-subscription,.subs-actions a.ppsfwoo-cancelled{display:none}}1 .ppsfwoo-subscribe-button{margin-bottom:15px;font-size:1.5em;word-break:normal;width:100%}.ppsfwoo-quantity-input{margin-bottom:15px}.inactive-subscription,.ppsfwoo-cancelled{display:none}.subs-actions a{margin-right:10px;padding:10px}p.order-again{display:none}.please-wait{font-weight:bold}#waiting-ellipsis::after{content:'';animation:ellipsis-animation 2s infinite}.lds-ellipsis,.lds-ellipsis div{box-sizing:border-box}.lds-ellipsis{display:none;position:relative;width:80px;height:80px;margin:auto}.lds-ellipsis div{position:absolute;top:33.33333px;width:13.33333px;height:13.33333px;border-radius:50%;background:currentColor;animation-timing-function:cubic-bezier(0, 1, 1, 0)}.lds-ellipsis div:nth-child(1){left:8px;animation:lds-ellipsis1 0.6s infinite}.lds-ellipsis div:nth-child(2){left:8px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(3){left:32px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(4){left:56px;animation:lds-ellipsis3 0.6s infinite}@keyframes lds-ellipsis1{0%{transform:scale(0)}100%{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}100%{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0, 0)}100%{transform:translate(24px, 0)}}@keyframes ellipsis-animation{25%{content:'. '}50%{content:'. .'}75%{content:'. . .'}}@media screen and (max-width:673px){.subs-actions a{display:block;margin-bottom:3px;text-align:center !important}.subs-actions::before{content:"" !important}.subs-actions a.inactive-subscription,.subs-actions a.ppsfwoo-cancelled{display:none}} -
subscriptions-for-woo/trunk/js/paypal-button.js
r3258064 r3273939 127 127 throw new Error("No plan id found for product with ID " + product_id); 128 128 } else { 129 document.getElementById('lds-ellipsis-' + product_id).style.setProperty("display", "none" , "important");129 document.getElementById('lds-ellipsis-' + product_id).style.setProperty("display", "none"); 130 130 if(response.quantity_supported) { 131 131 ppsfwooCreateQuantityInput(product_id); -
subscriptions-for-woo/trunk/js/paypal-button.min.js
r3254343 r3273939 1 function ppsfwooGetQuantityInputId(e){return"ppsfwoo-quantity-input-"+e}function ppsfwooCreateQuantityInput(e){var t=document.getElementById("ppsfwoo-quantity-input-container-"+e),n=document.createElement("input"),o=document.createElement("label"),e=ppsfwooGetQuantityInputId(e);n.type="number",n.id=e,n.classList.add("ppsfwoo-quantity-input"),n.name="quantity",n.min="1",n.value="1",o.setAttribute("for",e),o.innerHTML="Quantity: ",t?t.appendChild(o).appendChild(n):alert("Unable to render PayPal button")}function ppsfwooSendPostRequest(a,p){return new Promise((t,n)=>{var e,o=new XMLHttpRequest,r=(o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(200===o.status)try{var e=JSON.parse(o.responseText);t(e)}catch(e){n(new Error("Invalid JSON response"))}else n(new Error("Request failed: "+o.status))},o.onerror=function(){n(new Error("Network error occurred"))},new URLSearchParams);for(e in p)r.append(e,p[e]);o.open("POST",a,!0),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(r.toString())})}function ppsfwooLogButtonError(e){ppsfwooSendPostRequest("/wp-admin/admin-ajax.php",{action:"ppsfwoo_admin_ajax_callback",method:"log_paypal_buttons_error",message:e}).then(e=>{console.log(e)}).catch(e=>{console.log(e)})}function ppsfwooCreateBtnContainer(o,e,r){return new Promise((e,t)=>{var n=document.createElement("div");n.setAttribute("id","paypal-button-container-"+o),r?r.insertAdjacentElement("afterend",n):alert("Unable to render PayPal button"),requestAnimationFrame(()=>e(n))})}function ppsfwooRender(n,r,a,e){ppsfwooCreateBtnContainer(r,a,e).then(e=>{paypal.Buttons({style:{shape:"rect",layout:"vertical",color:"gold",label:"subscribe"},createSubscription:function(e,t){var n=document.getElementById(ppsfwooGetQuantityInputId(a)),o={plan_id:r};return n&&(o.quantity=n.value),t.subscription.create(o)},onApprove:function(e,t){e=ppsfwoo_paypal_ajax_var.redirect+"?subs_id="+e.subscriptionID+"&subs_id_redirect_nonce="+n;window.location.assign(e)},onError:function(e){e.message&&ppsfwooLogButtonError(e.message)}}).render("#"+e.id)})}function ppsfwooInitializePayPalSubscription(t,n){ppsfwooSendPostRequest("/wp-admin/admin-ajax.php",{action:"ppsfwoo_admin_ajax_callback",method:"subs_id_redirect_nonce",product_id:t}).then(async e=>{if(e.error)throw new Error("No plan id found for product with ID "+t);document.getElementById("lds-ellipsis-"+t).style.setProperty("display","none" ,"important"),e.quantity_supported&&ppsfwooCreateQuantityInput(t),ppsfwooRender(e.nonce,e.plan_id,t,n)}).catch(e=>{console.log(e),ppsfwooLogButtonError(e),alert("There has been an unexpeced error. Please refresh and try again.")})}1 function ppsfwooGetQuantityInputId(e){return"ppsfwoo-quantity-input-"+e}function ppsfwooCreateQuantityInput(e){var t=document.getElementById("ppsfwoo-quantity-input-container-"+e),n=document.createElement("input"),o=document.createElement("label"),e=ppsfwooGetQuantityInputId(e);n.type="number",n.id=e,n.classList.add("ppsfwoo-quantity-input"),n.name="quantity",n.min="1",n.value="1",o.setAttribute("for",e),o.innerHTML="Quantity: ",t?t.appendChild(o).appendChild(n):alert("Unable to render PayPal button")}function ppsfwooSendPostRequest(a,p){return new Promise((t,n)=>{var e,o=new XMLHttpRequest,r=(o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(200===o.status)try{var e=JSON.parse(o.responseText);t(e)}catch(e){n(new Error("Invalid JSON response"))}else n(new Error("Request failed: "+o.status))},o.onerror=function(){n(new Error("Network error occurred"))},new URLSearchParams);for(e in p)r.append(e,p[e]);o.open("POST",a,!0),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(r.toString())})}function ppsfwooLogButtonError(e){ppsfwooSendPostRequest("/wp-admin/admin-ajax.php",{action:"ppsfwoo_admin_ajax_callback",method:"log_paypal_buttons_error",message:e}).then(e=>{console.log(e)}).catch(e=>{console.log(e)})}function ppsfwooCreateBtnContainer(o,e,r){return new Promise((e,t)=>{var n=document.createElement("div");n.setAttribute("id","paypal-button-container-"+o),r?r.insertAdjacentElement("afterend",n):alert("Unable to render PayPal button"),requestAnimationFrame(()=>e(n))})}function ppsfwooRender(n,r,a,e){ppsfwooCreateBtnContainer(r,a,e).then(e=>{paypal.Buttons({style:{shape:"rect",layout:"vertical",color:"gold",label:"subscribe"},createSubscription:function(e,t){var n=document.getElementById(ppsfwooGetQuantityInputId(a)),o={plan_id:r};return n&&(o.quantity=n.value),t.subscription.create(o)},onApprove:function(e,t){e=ppsfwoo_paypal_ajax_var.redirect+"?subs_id="+e.subscriptionID+"&subs_id_redirect_nonce="+n;window.location.assign(e)},onError:function(e){e.message&&ppsfwooLogButtonError(e.message)}}).render("#"+e.id)})}function ppsfwooInitializePayPalSubscription(t,n){ppsfwooSendPostRequest("/wp-admin/admin-ajax.php",{action:"ppsfwoo_admin_ajax_callback",method:"subs_id_redirect_nonce",product_id:t}).then(async e=>{if(e.error)throw new Error("No plan id found for product with ID "+t);document.getElementById("lds-ellipsis-"+t).style.setProperty("display","none"),e.quantity_supported&&ppsfwooCreateQuantityInput(t),ppsfwooRender(e.nonce,e.plan_id,t,n)}).catch(e=>{console.log(e),ppsfwooLogButtonError(e),alert("There has been an unexpeced error. Please refresh and try again.")})} -
subscriptions-for-woo/trunk/readme.txt
r3270663 r3273939 4 4 License: GPLv2 or later 5 5 License URI: http://www.gnu.org/licenses/gpl-2.0.html 6 Stable tag: 2.5. 46 Stable tag: 2.5.5 7 7 WC tested up to: 9.7.1 8 8 Requires at least: 6.4.3 … … 123 123 == Changelog == 124 124 125 = 2.5.5 = 126 * Improvement: update paypal subscribe button to 100% of container 127 * Improvement: center waiting elipsis on subscribe button click 128 125 129 = 2.5.4 = 126 130 * Bugfix: deleted products cause error on order template in admin area 127 * Improvem net: add missing css identifier in js128 * Improvem net: add missing docblock129 * Improvem net: check for tab content before attempting to include in options page menu130 * Improvem net: add min and max to number type for options page131 * Improvem net: move localize script for paypal button to paypal class131 * Improvement: add missing css identifier in js 132 * Improvement: add missing docblock 133 * Improvement: check for tab content before attempting to include in options page menu 134 * Improvement: add min and max to number type for options page 135 * Improvement: move localize script for paypal button to paypal class 132 136 133 137 = 2.5.3 = 134 * Improvem net: remove superfluous import statements138 * Improvement: remove superfluous import statements 135 139 * Improvement: remove superfluous period after required PHP version 136 140 * Improvement: move plugin init to PluginMain class -
subscriptions-for-woo/trunk/subscriptions-for-woo.php
r3270659 r3273939 11 11 * License: GPLv2 or later 12 12 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 13 * Version: 2.5. 413 * Version: 2.5.5 14 14 * WC requires at least: 8.6.0 15 15 * WC tested up to: 9.7.1
Note: See TracChangeset
for help on using the changeset viewer.