Plugin Directory


Ignore:
Timestamp:
07/06/2026 05:21:45 PM (4 months ago)
Author:
subscriptionplugin
Message:

Release version 1.0.18

File:
1 edited

Legend:

Unmodified
Added
Removed
  • subscription-system/trunk/subscription-system.php

    r3587496 r3598150  
    1717 * Plugin URI:        https://mediahubster.in/subscription-system
    1818 * Description:       A comprehensive subscription management system for WordPress.
    19  * Version:           1.0.17
     19 * Version:           1.0.18
    2020 * Author:            Joe Youngblood
    2121 * Author URI:        https://mediahubster.in
    … …  
    9797
    9898// Define plugin constants
    99 define('SUBS_SYS_VERSION', '1.0.17');
     99define('SUBS_SYS_VERSION', '1.0.18');
    100100define('SUBS_SYS_PLUGIN_DIR', plugin_dir_path(__FILE__));
    101101define('SUBS_SYS_PLUGIN_URL', plugin_dir_url(__FILE__));
    102102define('SUBS_SYS_PLUGIN_BASENAME', plugin_basename(__FILE__));
     103
     104/**
     105 * Shared helper: enqueue interest-subscribe modal assets + localize script vars.
     106 * Called by both the shortcode handler and the floating-button/auto-open renderer
     107 * so the JS object is always fully populated regardless of which trigger is used.
     108 *
     109 * @param string $plugin_name Plugin slug.
     110 * @param string $version     Plugin version string.
     111 */
     112function subs_sys_enqueue_interest_modal_assets( $plugin_name, $version ) {
     113    static $done = false;
     114    if ( $done ) {
     115        return;
     116    }
     117    $done = true;
     118
     119    wp_enqueue_style(
     120        $plugin_name . '-interest-subscribe',
     121        SUBS_SYS_PLUGIN_URL . 'public/css/interest-subscribe.css',
     122        array(),
     123        $version
     124    );
     125
     126    wp_enqueue_script(
     127        $plugin_name . '-interest-subscribe',
     128        SUBS_SYS_PLUGIN_URL . 'public/js/interest-subscribe.js',
     129        array( 'jquery' ),
     130        $version,
     131        true
     132    );
     133
     134    $current_user = wp_get_current_user();
     135    $is_logged_in = $current_user->exists();
     136
     137    wp_localize_script(
     138        $plugin_name . '-interest-subscribe',
     139        'ssInterestVars',
     140        array(
     141            'ajax_url'              => admin_url( 'admin-ajax.php' ),
     142            'nonce'                 => wp_create_nonce( 'interest_subscription_nonce' ),
     143            'auto_open'             => (int) get_option( 'subs_modal_auto_open', 0 ),
     144            'auto_open_delay'       => absint( get_option( 'subs_modal_auto_open_delay', 3 ) ),
     145            'hide_fields_logged_in' => (int) get_option( 'subs_modal_hide_fields_logged_in', 1 ),
     146            'is_logged_in'          => $is_logged_in ? 1 : 0,
     147            'i18n'                  => array(
     148                'processing'  => __( 'Processing...', 'subscription-system' ),
     149                'submit'      => __( 'Subscribe', 'subscription-system' ),
     150                'error'       => __( 'Something went wrong. Please try again.', 'subscription-system' ),
     151                'select_plan' => __( 'Please select a subscription plan.', 'subscription-system' ),
     152            ),
     153        )
     154    );
     155}
    103156
    104157// Load Composer autoloader if it exists
    … …  
    312365        KEY status (status)
    313366    ) $charset_collate;";
     367
     368    // Create interest subscriptions table
     369    $interest_table = $wpdb->prefix . 'subscription_interest_subscriptions';
     370    $sql_interest = "CREATE TABLE IF NOT EXISTS $interest_table (
     371        id mediumint(9) NOT NULL AUTO_INCREMENT,
     372        user_id bigint(20) DEFAULT NULL,
     373        plan_id mediumint(9) DEFAULT NULL,
     374        subscriber_name varchar(100) NOT NULL,
     375        subscriber_email varchar(100) NOT NULL,
     376        category_ids text NOT NULL,
     377        tag_ids text NOT NULL,
     378        plan_type varchar(20) NOT NULL DEFAULT 'free',
     379        status varchar(20) NOT NULL DEFAULT 'active',
     380        payment_id varchar(100) DEFAULT NULL,
     381        created_at datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
     382        updated_at datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL,
     383        PRIMARY KEY  (id),
     384        KEY user_id (user_id),
     385        KEY plan_id (plan_id),
     386        KEY subscriber_email (subscriber_email),
     387        KEY status (status),
     388        KEY plan_type (plan_type)
     389    ) $charset_collate;";
    314390   
    315391    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    … …  
    324400    dbDelta($sql_content_subscriptions);
    325401    dbDelta($sql_content_notifications);
     402    dbDelta($sql_interest);
    326403   
    327404    // Add version to options
    … …  
    364441    $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}subscription_content_subscriptions");
    365442    $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}subscription_content_notifications");
     443    $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}subscription_interest_subscriptions");
    366444
    367445    // Delete options
Note: See TracChangeset for help on using the changeset viewer.