| 1 |
<?php |
| 2 |
/** |
| 3 |
* Main PHP file used to for initial calls to Leaky Paywall classes and functions. |
| 4 |
* |
| 5 |
* @package Leaky Paywall |
| 6 |
* @since 1.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
/* |
| 10 |
Plugin Name: Leaky Paywall |
| 11 |
Plugin URI: https://leakypaywall.com/ |
| 12 |
Description: The first and most flexible metered paywall for WordPress. Sell subscriptions without sacrificing search and social visibility. |
| 13 |
Author: Leaky Paywall |
| 14 |
Version: 5.1.7 |
| 15 |
Author URI: https://leakypaywall.com/ |
| 16 |
Tags: paywall, subscriptions, metered, membership, pay wall, content monetization, metered access, metered pay wall, paid content |
| 17 |
Text Domain: leaky-paywall |
| 18 |
Domain Path: /i18n |
| 19 |
Requires at least: 5.6 |
| 20 |
Requires PHP: 7.4 |
| 21 |
*/ |
| 22 |
|
| 23 |
// Define global variables... |
| 24 |
if ( ! defined( 'ZEEN101_STORE_URL' ) ) { |
| 25 |
define( 'ZEEN101_STORE_URL', 'https://zeen101.com' ); |
| 26 |
} |
| 27 |
|
| 28 |
define( 'LEAKY_PAYWALL_NAME', 'Leaky Paywall for WordPress' ); |
| 29 |
define( 'LEAKY_PAYWALL_SLUG', 'leaky-paywall' ); |
| 30 |
define( 'LEAKY_PAYWALL_VERSION', '5.1.7' ); |
| 31 |
define( 'LEAKY_PAYWALL_DB_VERSION', '1.0.5' ); |
| 32 |
define( 'LEAKY_PAYWALL_URL', plugin_dir_url( __FILE__ ) ); |
| 33 |
define( 'LEAKY_PAYWALL_PATH', plugin_dir_path( __FILE__ ) ); |
| 34 |
define( 'LEAKY_PAYWALL_BASENAME', plugin_basename( __FILE__ ) ); |
| 35 |
define( 'LEAKY_PAYWALL_REL_DIR', dirname( LEAKY_PAYWALL_BASENAME ) ); |
| 36 |
|
| 37 |
define( 'LEAKY_PAYWALL_STRIPE_API_VERSION', '2020-03-02' ); |
| 38 |
define( 'LEAKY_PAYWALL_STRIPE_PARTNER_ID', 'pp_partner_IDILs8UMcYIw41' ); |
| 39 |
|
| 40 |
if ( ! defined( 'PAYPAL_LIVE_URL' ) ) { |
| 41 |
define( 'PAYPAL_LIVE_URL', 'https://www.paypal.com/' ); |
| 42 |
} |
| 43 |
if ( ! defined( 'PAYPAL_SANDBOX_URL' ) ) { |
| 44 |
define( 'PAYPAL_SANDBOX_URL', 'https://www.sandbox.paypal.com/' ); |
| 45 |
} |
| 46 |
if ( ! defined( 'PAYPAL_PAYMENT_SANDBOX_URL' ) ) { |
| 47 |
define( 'PAYPAL_PAYMENT_SANDBOX_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr' ); |
| 48 |
} |
| 49 |
if ( ! defined( 'PAYPAL_PAYMENT_LIVE_URL' ) ) { |
| 50 |
define( 'PAYPAL_PAYMENT_LIVE_URL', 'https://www.paypal.com/cgi-bin/webscr' ); |
| 51 |
} |
| 52 |
if ( ! defined( 'PAYPAL_NVP_API_SANDBOX_URL' ) ) { |
| 53 |
define( 'PAYPAL_NVP_API_SANDBOX_URL', 'https://api-3t.sandbox.paypal.com/nvp' ); |
| 54 |
} |
| 55 |
if ( ! defined( 'PAYPAL_NVP_API_LIVE_URL' ) ) { |
| 56 |
define( 'PAYPAL_NVP_API_LIVE_URL', 'https://api-3t.paypal.com/nvp' ); |
| 57 |
} |
| 58 |
|
| 59 |
// Load Action Scheduler for background processing. |
| 60 |
require_once LEAKY_PAYWALL_PATH . 'vendor/woocommerce/action-scheduler/action-scheduler.php'; |
| 61 |
|
| 62 |
/** |
| 63 |
* Instantiate Pigeon Pack class, require helper files |
| 64 |
* |
| 65 |
* @since 1.0.0 |
| 66 |
*/ |
| 67 |
function leaky_paywall_plugins_loaded() { |
| 68 |
include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 69 |
if ( is_plugin_active( 'issuem/issuem.php' ) ) { |
| 70 |
define( 'ACTIVE_ISSUEM', true ); |
| 71 |
} else { |
| 72 |
define( 'ACTIVE_ISSUEM', false ); |
| 73 |
} |
| 74 |
|
| 75 |
require_once 'class.php'; |
| 76 |
|
| 77 |
// Load license key class early so extension plugins can always use it. |
| 78 |
include LEAKY_PAYWALL_PATH . 'include/license-key.php'; |
| 79 |
|
| 80 |
// Instantiate the Pigeon Pack class. |
| 81 |
if ( class_exists( 'Leaky_Paywall' ) ) { |
| 82 |
|
| 83 |
global $leaky_paywall; |
| 84 |
$leaky_paywall = new Leaky_Paywall(); |
| 85 |
|
| 86 |
require_once LEAKY_PAYWALL_PATH . 'functions.php'; |
| 87 |
require_once LEAKY_PAYWALL_PATH . 'shortcodes.php'; |
| 88 |
require_once LEAKY_PAYWALL_PATH . 'subscriber-table.php'; |
| 89 |
require_once LEAKY_PAYWALL_PATH . 'metaboxes.php'; |
| 90 |
require_once LEAKY_PAYWALL_PATH . 'include/template-functions.php'; |
| 91 |
require_once LEAKY_PAYWALL_PATH . 'include/ach-pending-modal.php'; |
| 92 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/dashboard-widgets.php'; |
| 93 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/lp-transaction.php'; |
| 94 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/lp-incomplete-user.php'; |
| 95 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/tools.php'; |
| 96 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/tools/tools.php'; |
| 97 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/tools/export.php'; |
| 98 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/tools/import.php'; |
| 99 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/insights/functions.php'; |
| 100 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/subscribers/class-lp-subscriber-list-table.php'; |
| 101 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/subscribers/subscriber.php'; |
| 102 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/subscribers/functions.php'; |
| 103 |
|
| 104 |
// Email classes. |
| 105 |
require_once LEAKY_PAYWALL_PATH . 'include/emails/class-lp-email.php'; |
| 106 |
require_once LEAKY_PAYWALL_PATH . 'include/emails/class-lp-email-new-subscriber.php'; |
| 107 |
require_once LEAKY_PAYWALL_PATH . 'include/emails/class-lp-email-admin-new-subscriber.php'; |
| 108 |
require_once LEAKY_PAYWALL_PATH . 'include/emails/class-lp-email-renewal-reminder.php'; |
| 109 |
require_once LEAKY_PAYWALL_PATH . 'include/emails/class-lp-emails.php'; |
| 110 |
|
| 111 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/settings/settings.php'; |
| 112 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/insights/insights.php'; |
| 113 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/dashboard/dashboard.php'; |
| 114 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/onboarding/class-onboarding.php'; |
| 115 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/onboarding/tracking.php'; |
| 116 |
require_once LEAKY_PAYWALL_PATH . 'include/list-builder/class-lp-list-builder.php'; |
| 117 |
require_once LEAKY_PAYWALL_PATH . 'include/class-lp-event-tracking.php'; |
| 118 |
require_once LEAKY_PAYWALL_PATH . 'include/class-lp-store-client.php'; |
| 119 |
require_once LEAKY_PAYWALL_PATH . 'include/pro-license.php'; |
| 120 |
require_once LEAKY_PAYWALL_PATH . 'include/pro-license-migration.php'; |
| 121 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/license-page.php'; |
| 122 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/extensions-page.php'; |
| 123 |
require_once LEAKY_PAYWALL_PATH . 'include/admin/pro-prompts.php'; |
| 124 |
|
| 125 |
include LEAKY_PAYWALL_PATH . 'include/error-tracking.php'; |
| 126 |
include LEAKY_PAYWALL_PATH . 'include/registration-functions.php'; |
| 127 |
include LEAKY_PAYWALL_PATH . 'include/rest-functions.php'; |
| 128 |
include LEAKY_PAYWALL_PATH . 'include/class-restrictions.php'; |
| 129 |
include LEAKY_PAYWALL_PATH . 'include/class-rest-restrictions.php'; |
| 130 |
include LEAKY_PAYWALL_PATH . 'include/class-rest-subscribers.php'; |
| 131 |
include LEAKY_PAYWALL_PATH . 'include/class-lp-transaction.php'; |
| 132 |
include LEAKY_PAYWALL_PATH . 'include/class-lp-logging.php'; |
| 133 |
include LEAKY_PAYWALL_PATH . 'include/class-lp-nag-impressions.php'; |
| 134 |
include LEAKY_PAYWALL_PATH . 'include/incomplete-user-cleanup.php'; |
| 135 |
|
| 136 |
|
| 137 |
// gateways. |
| 138 |
include LEAKY_PAYWALL_PATH . 'include/gateways/gateway-functions.php'; |
| 139 |
include LEAKY_PAYWALL_PATH . 'include/gateways/stripe/functions.php'; |
| 140 |
include LEAKY_PAYWALL_PATH . 'include/gateways/paypal/functions.php'; |
| 141 |
include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateway.php'; |
| 142 |
include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateway-stripe.php'; |
| 143 |
include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateway-stripe-checkout.php'; |
| 144 |
include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateway-paypal.php'; |
| 145 |
include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateway-manual.php'; |
| 146 |
include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateways.php'; |
| 147 |
|
| 148 |
if ( ! class_exists( 'Stripe\Stripe' ) ) { |
| 149 |
require_once LEAKY_PAYWALL_PATH . 'include/stripe/init.php'; |
| 150 |
} |
| 151 |
|
| 152 |
do_action( 'leaky_paywall_plugins_loaded' ); |
| 153 |
} |
| 154 |
} |
| 155 |
add_action( 'plugins_loaded', 'leaky_paywall_plugins_loaded', 4815162342 ); // wait for the plugins to be loaded before init. |
| 156 |
|
| 157 |
/** |
| 158 |
* Runs on plugin activation. |
| 159 |
* |
| 160 |
* Sets onboarding redirect flag and schedules tracking cron. |
| 161 |
* |
| 162 |
* @since 4.23.0 |
| 163 |
*/ |
| 164 |
function leaky_paywall_activate() { |
| 165 |
update_option( 'leaky_paywall_onboarding_redirect', 1 ); |
| 166 |
|
| 167 |
update_option( 'leaky_paywall_onboarding_install_time', time() ); |
| 168 |
|
| 169 |
if ( get_option( 'leaky_paywall_tracking_allow' ) && ! wp_next_scheduled( 'leaky_paywall_tracking_send' ) ) { |
| 170 |
wp_schedule_event( time(), 'weekly', 'leaky_paywall_tracking_send' ); |
| 171 |
} |
| 172 |
} |
| 173 |
register_activation_hook( __FILE__, 'leaky_paywall_activate' ); |
| 174 |
|
| 175 |
function leaky_paywall_deactivate() { |
| 176 |
wp_clear_scheduled_hook( 'leaky_paywall_tracking_send' ); |
| 177 |
} |
| 178 |
register_deactivation_hook( __FILE__, 'leaky_paywall_deactivate' ); |
| 179 |
|