Plugin Directory

Changeset 3270659


Ignore:
Timestamp:
04/10/2025 06:54:19 PM (12 months ago)
Author:
marknokes
Message:

2.5.4

  • Bugfix: deleted products cause error on order template in admin area
  • Improvemnet: add missing css identifier in js
  • Improvemnet: add missing docblock
  • Improvemnet: check for tab content before attempting to include in options page menu
  • Improvemnet: add min and max to number type for options page
  • Improvemnet: move localize script for paypal button to paypal class
Location:
subscriptions-for-woo
Files:
44 added
11 edited

Legend:

Unmodified
Added
Removed
  • subscriptions-for-woo/tags/2.5.3/classes/PPSFWOO/class-ppsfwoo-order.php

    r3259422 r3270659  
    126126                $product = $item->get_product();
    127127
    128                 if ($product->is_type(Product::TYPE)) {
     128                if ($product && $product->is_type(Product::TYPE)) {
    129129                    $has_subscription = true;
    130130
  • subscriptions-for-woo/tags/2.5.3/classes/PPSFWOO/class-ppsfwoo-plugin-main.php

    r3262268 r3270659  
    115115            'sanitize_callback' => 'absint',
    116116        ],
     117        'ppsfwoo_discount_offer_expires' => [
     118            'name' => 'Offer expires',
     119            'type' => 'number',
     120            'min' => 0,
     121            'default' => 10,
     122            'is_enterprise' => true,
     123            'description' => 'Number of days after a subscribtion expiration that the resubscribe offer is valid. 0 = no limit.',
     124            'sanitize_callback' => 'absint',
     125        ],
    117126        'ppsfwoo_resubscribe_landing_page_id' => [
    118127            'name' => 'Resubscribe landing page',
     
    223232     */
    224233    public $ppsfwoo_reminder = 10;
     234
     235    /**
     236     * Number of days after a subscribtion expiration that the resubscribe offer is valid. 0 = no limit.
     237     *
     238     * @var int
     239     */
     240    public $ppsfwoo_discount_offer_expires = 10;
    225241
    226242    /**
  • subscriptions-for-woo/tags/2.5.3/templates/tab-content/tab-general.php

    r3259422 r3270659  
    148148                            $value = esc_attr($value);
    149149
    150                             echo "<input size='2' type='number' min='1' max='100' id='".esc_attr($option)."' name='".esc_attr($name)."' value='".esc_attr($value)."' ".esc_attr($disabled).' />';
     150                            $min = $array['min'] ?? 1;
     151
     152                            $max = $array['max'] ?? 100;
     153
     154                            echo "<input size='2' type='number' min='".esc_attr($min)."' max='".esc_attr($max)."' id='".esc_attr($option)."' name='".esc_attr($name)."' value='".esc_attr($value)."' ".esc_attr($disabled).' />';
    151155
    152156                            break;
  • subscriptions-for-woo/trunk/classes/PPSFWOO/class-ppsfwoo-order.php

    r3259422 r3270659  
    126126                $product = $item->get_product();
    127127
    128                 if ($product->is_type(Product::TYPE)) {
     128                if ($product && $product->is_type(Product::TYPE)) {
    129129                    $has_subscription = true;
    130130
  • subscriptions-for-woo/trunk/classes/PPSFWOO/class-ppsfwoo-plugin-main.php

    r3262268 r3270659  
    115115            'sanitize_callback' => 'absint',
    116116        ],
     117        'ppsfwoo_discount_offer_expires' => [
     118            'name' => 'Offer expires',
     119            'type' => 'number',
     120            'min' => 0,
     121            'default' => 10,
     122            'is_enterprise' => true,
     123            'description' => 'Number of days after a subscribtion expiration that the resubscribe offer is valid. 0 = no limit.',
     124            'sanitize_callback' => 'absint',
     125        ],
    117126        'ppsfwoo_resubscribe_landing_page_id' => [
    118127            'name' => 'Resubscribe landing page',
     
    225234
    226235    /**
     236     * Number of days after a subscribtion expiration that the resubscribe offer is valid. 0 = no limit.
     237     *
     238     * @var int
     239     */
     240    public $ppsfwoo_discount_offer_expires = 10;
     241
     242    /**
    227243     * Page that customers will visit upon resubscribing to a canceled subscription.
    228244     *
     
    327343            public $product_type;
    328344
     345            /**
     346             * Constructor for the Product class.
     347             *
     348             * @param $product - The product to be assigned to the class
     349             */
    329350            public function __construct($product)
    330351            {
     
    493514    {
    494515        foreach ($tabs as $tab_id => $display_name) {
     516            $file = $this->template_dir."tab-content/{$tab_id}.php";
     517
     518            if (!file_exists($file)) {
     519                continue;
     520            }
    495521            // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    496522            $active = isset($_GET['tab']) && $tab_id === $_GET['tab'] ? 'nav-tab-active' : '';
  • subscriptions-for-woo/trunk/js/main.js

    r3258064 r3270659  
    113113            });
    114114        });
    115         $('.plan-row').on('click', '.copy-button', function(e) {
     115        $('.plan-row, .role-row').on('click', '.copy-button', function(e) {
    116116            var copyText = $(this).prev('.copy-text'),
    117117                tempTextarea = $('<textarea>');
  • subscriptions-for-woo/trunk/js/main.min.js

    r3255492 r3270659  
    1 function ppsfwooDoAjax(e,t,a={}){e={action:"ppsfwoo_admin_ajax_callback",method:e};jQuery.isEmptyObject(a)||(e=jQuery.extend({},e,a)),jQuery.ajax({type:"POST",url:"/wp-admin/admin-ajax.php",data:e,success:t})}function ppsfwooShowLoadingMessage(e){var t=document.createElement("div"),a=(t.setAttribute("role","overlay"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.backgroundColor="rgba(0, 0, 0, 0.5)",t.style.zIndex="1000",document.createElement("div"));a.style.position="absolute",a.style.top="50%",a.style.left="50%",a.style.transform="translate(-50%, -50%)",a.style.backgroundColor="white",a.style.padding="20px",a.style.borderRadius="5px",a.style.boxShadow="0 0 10px rgba(0, 0, 0, 0.3)",a.textContent=e||"Please wait...",t.appendChild(a),document.body.appendChild(t)}function ppsfwooHideLoadingMessage(){var e=document.querySelector('div[role="overlay"]');e&&e.parentNode.removeChild(e)}function ppsfwooShowMsg(e="",t="success"){jQuery("#wpcontent").prepend(`<div style="z-index: 9999; position: fixed; width: 82%" class="notice notice-${t} is-dismissible single-cached"><p>${e}</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>`),setTimeout(function(){jQuery(".notice-dismiss").parent().fadeOut("slow",function(){jQuery(this).remove()})},5e3),jQuery(".notice-dismiss").click(function(e){jQuery(this).parent().remove()})}jQuery(document).ready(function(o){var a;function s(e="tab-plans"){var t=n(window.location.href);window.location.href=t+"&tab="+e}function n(e){var t,a=e.split("?");return 2<=a.length?(t=a[1].split("&").filter(function(e){return!e.startsWith("subs_page_num=")&&!e.startsWith("tab=")}),a[0]+"?"+t.join("&")):e}o("a.deactivate, a.activate").click(function(e){e.preventDefault(),ppsfwooShowLoadingMessage("Processing...");var e=o(this).data("plan-id"),t=o(this).data("nonce");ppsfwooDoAjax("modify_plan",function(e){e=JSON.parse(e);(e.error?(alert(e.error),ppsfwooHideLoadingMessage):s)()},{plan_id:e,paypal_action:o(this).attr("class"),nonce:t})}),o(".plan-row").on("click",".copy-button",function(e){var t=o(this).prev(".copy-text"),a=o("<textarea>");a.val(t.text()),o("body").append(a),a.select(),a[0].setSelectionRange(0,99999),document.execCommand("copy"),a.remove(),alert("Copied to clipboard: "+t.text()),e.preventDefault()}),ppsfwooHideLoadingMessage(),o("#subs-search").on("submit",function(e){e.preventDefault(),ppsfwooDoAjax("search_subscribers",function(e){e=JSON.parse(e);e.error?ppsfwooShowMsg(e.error,"warning"):(o("#tab-subscribers .pagination, .button.export-table-data").hide(),o("#reset").show(),o("#subscribers").replaceWith(e.html))},{email:o("#email-input").val(),search_by_email:o("#search_by_email").val()})}),o("#refresh").click(function(e){e.preventDefault(),ppsfwooShowLoadingMessage("Processing..."),ppsfwooDoAjax("refresh_plans",function(e){e=JSON.parse(e);0===e.length?ppsfwooShowMsg("No plans found.","warning"):e.success?(ppsfwooShowMsg("Successfully refreshed plans."),s()):e.error?ppsfwooShowMsg(e.error,"error"):ppsfwooShowMsg("There has been an error. Please try again and check your <a href='"+ppsfwoo_ajax_var.settings_url+"'>WooCommerce PayPal Payments settings</a>.","error"),ppsfwooHideLoadingMessage()})}),o(".nav-tab-wrapper a").click(function(e){e.preventDefault(),o(".nav-tab").removeClass("nav-tab-active"),o(this).addClass("nav-tab-active"),o(".tab-content").hide(),a=o(this).attr("href"),o("#"+a).show()}),(o(".nav-tab-wrapper a").hasClass("nav-tab-active")?o(".nav-tab-wrapper a.nav-tab-active"):o(".nav-tab-wrapper a:first-child")).click(),o("#ppsfwoo_options").submit(function(e){var t=n(($element=o(this).find("input[name=_wp_http_referer]")).attr("value"));$element.attr("value",t+"&tab="+a)}),o("input[name=ppsfwoo_delete_plugin_data]").click(function(e){if(o(this).is(":checked"))return confirm("Selecting this option will delete plugin options and the subscribers table on plugin deactivation. Are you sure you want to do this?\n\nThe setting will take effect after you 'Save Changes' below.")})});
     1function ppsfwooDoAjax(e,t,a={}){e={action:"ppsfwoo_admin_ajax_callback",method:e};jQuery.isEmptyObject(a)||(e=jQuery.extend({},e,a)),jQuery.ajax({type:"POST",url:"/wp-admin/admin-ajax.php",data:e,success:t})}function ppsfwooShowLoadingMessage(e){var t=document.createElement("div"),a=(t.setAttribute("role","overlay"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.backgroundColor="rgba(0, 0, 0, 0.5)",t.style.zIndex="1000",document.createElement("div"));a.style.position="absolute",a.style.top="50%",a.style.left="50%",a.style.transform="translate(-50%, -50%)",a.style.backgroundColor="white",a.style.padding="20px",a.style.borderRadius="5px",a.style.boxShadow="0 0 10px rgba(0, 0, 0, 0.3)",a.textContent=e||"Please wait...",t.appendChild(a),document.body.appendChild(t)}function ppsfwooHideLoadingMessage(){var e=document.querySelector('div[role="overlay"]');e&&e.parentNode.removeChild(e)}function ppsfwooShowMsg(e="",t="success"){jQuery("#wpcontent").prepend(`<div style="z-index: 9999; position: fixed; width: 82%" class="notice notice-${t} is-dismissible single-cached"><p>${e}</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>`),setTimeout(function(){jQuery(".notice-dismiss").parent().fadeOut("slow",function(){jQuery(this).remove()})},5e3),jQuery(".notice-dismiss").click(function(e){jQuery(this).parent().remove()})}jQuery(document).ready(function(o){var a;function s(e="tab-plans"){var t=n(window.location.href);window.location.href=t+"&tab="+e}function n(e){var t,a=e.split("?");return 2<=a.length?(t=a[1].split("&").filter(function(e){return!e.startsWith("subs_page_num=")&&!e.startsWith("tab=")}),a[0]+"?"+t.join("&")):e}o("a.deactivate, a.activate").click(function(e){e.preventDefault(),ppsfwooShowLoadingMessage("Processing...");var e=o(this).data("plan-id"),t=o(this).data("nonce");ppsfwooDoAjax("modify_plan",function(e){e=JSON.parse(e);(e.error?(alert(e.error),ppsfwooHideLoadingMessage):s)()},{plan_id:e,paypal_action:o(this).attr("class"),nonce:t})}),o(".plan-row, .role-row").on("click",".copy-button",function(e){var t=o(this).prev(".copy-text"),a=o("<textarea>");a.val(t.text()),o("body").append(a),a.select(),a[0].setSelectionRange(0,99999),document.execCommand("copy"),a.remove(),alert("Copied to clipboard: "+t.text()),e.preventDefault()}),ppsfwooHideLoadingMessage(),o("#subs-search").on("submit",function(e){e.preventDefault(),ppsfwooDoAjax("search_subscribers",function(e){e=JSON.parse(e);e.error?ppsfwooShowMsg(e.error,"warning"):(o("#tab-subscribers .pagination, .button.export-table-data").hide(),o("#reset").show(),o("#subscribers").replaceWith(e.html))},{email:o("#email-input").val(),search_by_email:o("#search_by_email").val()})}),o("#refresh").click(function(e){e.preventDefault(),ppsfwooShowLoadingMessage("Processing..."),ppsfwooDoAjax("refresh_plans",function(e){e=JSON.parse(e);0===e.length?ppsfwooShowMsg("No plans found.","warning"):e.success?(ppsfwooShowMsg("Successfully refreshed plans."),s()):e.error?ppsfwooShowMsg(e.error,"error"):ppsfwooShowMsg("There has been an error. Please try again and check your <a href='"+ppsfwoo_ajax_var.settings_url+"'>WooCommerce PayPal Payments settings</a>.","error"),ppsfwooHideLoadingMessage()})}),o(".nav-tab-wrapper a").click(function(e){e.preventDefault(),o(".nav-tab").removeClass("nav-tab-active"),o(this).addClass("nav-tab-active"),o(".tab-content").hide(),a=o(this).attr("href"),o("#"+a).show()}),(o(".nav-tab-wrapper a").hasClass("nav-tab-active")?o(".nav-tab-wrapper a.nav-tab-active"):o(".nav-tab-wrapper a:first-child")).click(),o("#ppsfwoo_options").submit(function(e){var t=n(($element=o(this).find("input[name=_wp_http_referer]")).attr("value"));$element.attr("value",t+"&tab="+a)}),o("input[name=ppsfwoo_delete_plugin_data]").click(function(e){if(o(this).is(":checked"))return confirm("Selecting this option will delete plugin options and the subscribers table on plugin deactivation. Are you sure you want to do this?\n\nThe setting will take effect after you 'Save Changes' below.")})});
  • subscriptions-for-woo/trunk/readme.txt

    r3261715 r3270659  
    44License: GPLv2 or later
    55License URI: http://www.gnu.org/licenses/gpl-2.0.html
    6 Stable tag: 2.5.3
     6Stable tag: 2.5.4
    77WC tested up to: 9.7.1
    88Requires at least: 6.4.3
     
    1313
    1414== Description ==
    15 
    1615Subscriptions for Woo takes the hassle (and high cost) out of managing subscriptions products and services for your business. Simply create your PayPal subscription products and plans in your PayPal business subscriptions dashboard, and sync them with the plugin. After sync, a new product type "Subscription" is added to the product menu. Selection provides an additional tab where you choose your plan. Save and done!
    1716
    1817= Offer Subscription payments to help drive repeat business =
    19 Create stable, predictable income by offering subscription plans. Subscription plans are created and managed at PayPal, where customer payments are securely maintained. **Consumers are nearly three times more likely to purchase when you offer PayPal.**
    20 
    21 = Purpose built =
    22 Built to seamlessly integrate with your WooCommerce store, offering a tailored solution for managing recurring payments and subscriptions. Designed to streamline the subscription process, from setup to management, providing you with the tools you need to drive revenue and foster long-term customer relationships.
    23 
    24 = Low Cost =
    25 We understand the importance of cost-effectiveness for businesses of all sizes, which is why we’ve made it our priority to offer a solution that delivers exceptional functionality without breaking the bank. With transparent pricing and no hidden fees, our plugin provides an affordable subscription management solution that maximizes your ROI.
    26 
    27 = Scalability =
    28 As your business grows and evolves, our plugin grows with you, seamlessly accommodating increased subscription volumes, expanding product catalogs, and evolving customer needs. You can confidently scale your subscription offerings without worrying about technical limitations or disruptions.
    29 
    30 [Subscriptions for Woo](https://wp-subscriptions.com/) allow business and casual sellers to accept reliable recurring payments on a fixed billing schedule (buyers may require a PayPal account).
    31 
    32 It’s easy for shoppers, simple for you, and great for your business – with no monthly or setup fees.
     18Create stable, predictable income by offering subscription plans.
     19- Subscription plans are created and managed at PayPal where customer payments are securely maintained. **Consumers are nearly three times more likely to purchase when you offer PayPal.**
     20- Built to seamlessly integrate with your WooCommerce store, offering a tailored solution for managing recurring payments and subscriptions.
     21- Designed to streamline the subscription process, from setup to management, providing you with the tools you need to drive revenue and foster long-term customer relationships.
     22- As your business grows and evolves, our plugin grows with you, seamlessly accommodating increased subscription volumes, expanding product catalogs, and evolving customer needs.
     23- You can confidently scale your subscription offerings without worrying about technical limitations or disruptions.
     24- [Subscriptions for Woo](https://wp-subscriptions.com/) allow business and casual sellers to accept reliable recurring payments on a fixed billing schedule (buyers may require a PayPal account).
     25- It’s easy for shoppers, simple for you, and great for your business!
     26
     27= Subscriptions for Woo Features =
     28- Unlimited downloads
     29- Unlimited domains
     30- PayPal subscription plan chosen on WooCommerce product
     31
     32= Subscriptions for Woo Premium Features =
     33Everything from above plus the following:
     34- Allow specific users to edit plugin settings and permissions
     35- Allow specific users to view and manage subscribers
     36- Allow specific users to edit subscription products
     37- Give subscribers the ability to manage their own plan, including pausing, cancelling, or re-activating, without needing to wait on you for help
     38- Create virtual and downloadable subscription products
     39
     40= Subscriptions for Woo Enterprise Features =
     41Everything from above plus the following:
     42- Create custom roles to restrict content based on customer subscription(s)
     43- Shortcode allows adding PayPal subscribe button to any page
     44- Allow canceled subscribers to resubscribe and receive a discount
     45- Easily generate WooCommerce products from each plan with one click
     46- Enterprise support
     47
     48[Compare plans at https://wp-subscriptions.com/compare-plans/](https://wp-subscriptions.com/compare-plans/)
    3349
    3450= Activate PayPal =
     
    105121
    106122== Changelog ==
     123
     124= 2.5.4 =
     125* Bugfix: deleted products cause error on order template in admin area
     126* Improvemnet: add missing css identifier in js
     127* Improvemnet: add missing docblock
     128* Improvemnet: check for tab content before attempting to include in options page menu
     129* Improvemnet: add min and max to number type for options page
     130* Improvemnet: move localize script for paypal button to paypal class
    107131
    108132= 2.5.3 =
  • subscriptions-for-woo/trunk/subscriptions-for-woo.php

    r3261715 r3270659  
    1111 * License: GPLv2 or later
    1212 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
    13  * Version: 2.5.3
     13 * Version: 2.5.4
    1414 * WC requires at least: 8.6.0
    1515 * WC tested up to: 9.7.1
  • subscriptions-for-woo/trunk/templates/tab-content/go-pro.php

    r3258064 r3270659  
    1313            <li>Give subscribers the ability to manage their own plan, including pausing, cancelling, or re-activating, without needing to wait on you for help</li>
    1414            <li>Create virtual and downloadable subscription products</li>
     15            <li><span class="pro-name">Enterprise feature:</span> Create custom roles to restrict content based on customer subscription(s)</li>
    1516            <li><span class="pro-name">Enterprise feature:</span> Shortcode, with copy shortcode link, allows adding PayPal subscribe button to any page</li>
    1617            <li><span class="pro-name">Enterprise feature:</span> Allow canceled subscribers to resubscribe and receive a discount</li>
     18            <li><span class="pro-name">Enterprise feature:</span> Easily generate WooCommerce products from each plan with one click</li>
    1719            <li><span class="pro-name">Enterprise feature:</span> Priority enterprise support</li>
    1820        </ul>
  • subscriptions-for-woo/trunk/templates/tab-content/tab-general.php

    r3259422 r3270659  
    148148                            $value = esc_attr($value);
    149149
    150                             echo "<input size='2' type='number' min='1' max='100' id='".esc_attr($option)."' name='".esc_attr($name)."' value='".esc_attr($value)."' ".esc_attr($disabled).' />';
     150                            $min = $array['min'] ?? 1;
     151
     152                            $max = $array['max'] ?? 100;
     153
     154                            echo "<input size='2' type='number' min='".esc_attr($min)."' max='".esc_attr($max)."' id='".esc_attr($option)."' name='".esc_attr($name)."' value='".esc_attr($value)."' ".esc_attr($disabled).' />';
    151155
    152156                            break;
Note: See TracChangeset for help on using the changeset viewer.