PluginProbe
Leaky Paywall / trunk
Leaky Paywall vtrunk
5.1.9 5.1.8 5.1.7 5.1.6 5.1.5 5.1.4 5.1.3 5.1.2 5.1.1 5.1.0 5.0.9 4.16.17 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.17.0 4.17.1 4.17.2 4.18.0 4.18.1 All 180 releases
leaky-paywall / leaky-paywall.php

leaky-paywall.php in Leaky Paywall trunk, at leaky-paywall.php

206 lines 8.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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.9
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 License: GPLv3
22 License URI: https://www.gnu.org/licenses/gpl-3.0.html
23 */
24
25 // Define global variables...
26 if ( ! defined( 'ZEEN101_STORE_URL' ) ) {
27 define( 'ZEEN101_STORE_URL', 'https://zeen101.com' );
28 }
29
30 define( 'LEAKY_PAYWALL_NAME', 'Leaky Paywall for WordPress' );
31 define( 'LEAKY_PAYWALL_SLUG', 'leaky-paywall' );
32 define( 'LEAKY_PAYWALL_VERSION', '5.1.9' );
33 define( 'LEAKY_PAYWALL_DB_VERSION', '1.0.5' );
34 define( 'LEAKY_PAYWALL_URL', plugin_dir_url( __FILE__ ) );
35 define( 'LEAKY_PAYWALL_PATH', plugin_dir_path( __FILE__ ) );
36 define( 'LEAKY_PAYWALL_BASENAME', plugin_basename( __FILE__ ) );
37 define( 'LEAKY_PAYWALL_REL_DIR', dirname( LEAKY_PAYWALL_BASENAME ) );
38
39 define( 'LEAKY_PAYWALL_STRIPE_API_VERSION', '2020-03-02' );
40 define( 'LEAKY_PAYWALL_STRIPE_PARTNER_ID', 'pp_partner_IDILs8UMcYIw41' );
41
42 if ( ! defined( 'PAYPAL_LIVE_URL' ) ) {
43 define( 'PAYPAL_LIVE_URL', 'https://www.paypal.com/' );
44 }
45 if ( ! defined( 'PAYPAL_SANDBOX_URL' ) ) {
46 define( 'PAYPAL_SANDBOX_URL', 'https://www.sandbox.paypal.com/' );
47 }
48 if ( ! defined( 'PAYPAL_PAYMENT_SANDBOX_URL' ) ) {
49 define( 'PAYPAL_PAYMENT_SANDBOX_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr' );
50 }
51 if ( ! defined( 'PAYPAL_PAYMENT_LIVE_URL' ) ) {
52 define( 'PAYPAL_PAYMENT_LIVE_URL', 'https://www.paypal.com/cgi-bin/webscr' );
53 }
54 if ( ! defined( 'PAYPAL_NVP_API_SANDBOX_URL' ) ) {
55 define( 'PAYPAL_NVP_API_SANDBOX_URL', 'https://api-3t.sandbox.paypal.com/nvp' );
56 }
57 if ( ! defined( 'PAYPAL_NVP_API_LIVE_URL' ) ) {
58 define( 'PAYPAL_NVP_API_LIVE_URL', 'https://api-3t.paypal.com/nvp' );
59 }
60
61 // Load Action Scheduler for background processing.
62 require_once LEAKY_PAYWALL_PATH . 'vendor/woocommerce/action-scheduler/action-scheduler.php';
63
64 /**
65 * Instantiate Pigeon Pack class, require helper files
66 *
67 * @since 1.0.0
68 */
69 function leaky_paywall_plugins_loaded() {
70 include_once ABSPATH . 'wp-admin/includes/plugin.php';
71 if ( is_plugin_active( 'issuem/issuem.php' ) ) {
72 define( 'ACTIVE_ISSUEM', true );
73 } else {
74 define( 'ACTIVE_ISSUEM', false );
75 }
76
77 require_once 'class.php';
78
79 // Load license key class early so extension plugins can always use it.
80 include LEAKY_PAYWALL_PATH . 'include/license-key.php';
81
82 // Instantiate the Pigeon Pack class.
83 if ( class_exists( 'Leaky_Paywall' ) ) {
84
85 global $leaky_paywall;
86 $leaky_paywall = new Leaky_Paywall();
87
88 require_once LEAKY_PAYWALL_PATH . 'functions.php';
89 require_once LEAKY_PAYWALL_PATH . 'shortcodes.php';
90 require_once LEAKY_PAYWALL_PATH . 'subscriber-table.php';
91 require_once LEAKY_PAYWALL_PATH . 'metaboxes.php';
92 require_once LEAKY_PAYWALL_PATH . 'include/template-functions.php';
93 require_once LEAKY_PAYWALL_PATH . 'include/ach-pending-modal.php';
94 require_once LEAKY_PAYWALL_PATH . 'include/admin/dashboard-widgets.php';
95 require_once LEAKY_PAYWALL_PATH . 'include/admin/lp-transaction.php';
96 require_once LEAKY_PAYWALL_PATH . 'include/admin/lp-incomplete-user.php';
97 require_once LEAKY_PAYWALL_PATH . 'include/admin/tools.php';
98 require_once LEAKY_PAYWALL_PATH . 'include/admin/tools/tools.php';
99 require_once LEAKY_PAYWALL_PATH . 'include/admin/tools/export.php';
100 require_once LEAKY_PAYWALL_PATH . 'include/admin/tools/import.php';
101 require_once LEAKY_PAYWALL_PATH . 'include/admin/insights/functions.php';
102 require_once LEAKY_PAYWALL_PATH . 'include/admin/subscribers/class-lp-subscriber-list-table.php';
103 require_once LEAKY_PAYWALL_PATH . 'include/admin/subscribers/subscriber.php';
104 require_once LEAKY_PAYWALL_PATH . 'include/admin/subscribers/functions.php';
105
106 // Email classes.
107 require_once LEAKY_PAYWALL_PATH . 'include/emails/class-lp-email.php';
108 require_once LEAKY_PAYWALL_PATH . 'include/emails/email-template.php';
109 require_once LEAKY_PAYWALL_PATH . 'include/emails/class-lp-email-new-subscriber.php';
110 require_once LEAKY_PAYWALL_PATH . 'include/emails/class-lp-email-admin-new-subscriber.php';
111 require_once LEAKY_PAYWALL_PATH . 'include/emails/class-lp-email-renewal-reminder.php';
112 require_once LEAKY_PAYWALL_PATH . 'include/emails/class-lp-email-payment-receipt.php';
113 require_once LEAKY_PAYWALL_PATH . 'include/emails/class-lp-emails.php';
114 require_once LEAKY_PAYWALL_PATH . 'include/emails/receipt-tags.php';
115
116 require_once LEAKY_PAYWALL_PATH . 'include/admin/settings/settings.php';
117 require_once LEAKY_PAYWALL_PATH . 'include/admin/insights/insights.php';
118 require_once LEAKY_PAYWALL_PATH . 'include/admin/dashboard/dashboard.php';
119 require_once LEAKY_PAYWALL_PATH . 'include/admin/onboarding/class-onboarding.php';
120 require_once LEAKY_PAYWALL_PATH . 'include/admin/onboarding/tracking.php';
121 require_once LEAKY_PAYWALL_PATH . 'include/list-builder/class-lp-list-builder.php';
122 require_once LEAKY_PAYWALL_PATH . 'include/class-lp-event-tracking.php';
123 require_once LEAKY_PAYWALL_PATH . 'include/class-lp-store-client.php';
124 require_once LEAKY_PAYWALL_PATH . 'include/pro-license.php';
125 require_once LEAKY_PAYWALL_PATH . 'include/pro-license-migration.php';
126 require_once LEAKY_PAYWALL_PATH . 'include/admin/license-page.php';
127 require_once LEAKY_PAYWALL_PATH . 'include/admin/extensions-page.php';
128 require_once LEAKY_PAYWALL_PATH . 'include/admin/pro-prompts.php';
129 require_once LEAKY_PAYWALL_PATH . 'include/admin/config-notices.php';
130
131 include LEAKY_PAYWALL_PATH . 'include/error-tracking.php';
132 include LEAKY_PAYWALL_PATH . 'include/registration-functions.php';
133 include LEAKY_PAYWALL_PATH . 'include/rest-functions.php';
134 include LEAKY_PAYWALL_PATH . 'include/class-restrictions.php';
135 include LEAKY_PAYWALL_PATH . 'include/class-rest-restrictions.php';
136 include LEAKY_PAYWALL_PATH . 'include/class-rest-subscribers.php';
137 include LEAKY_PAYWALL_PATH . 'include/class-lp-transaction.php';
138 include LEAKY_PAYWALL_PATH . 'include/private-files.php';
139 include LEAKY_PAYWALL_PATH . 'include/class-lp-logging.php';
140 include LEAKY_PAYWALL_PATH . 'include/class-lp-nag-impressions.php';
141 include LEAKY_PAYWALL_PATH . 'include/incomplete-user-cleanup.php';
142
143
144 // gateways.
145 include LEAKY_PAYWALL_PATH . 'include/gateways/gateway-functions.php';
146 include LEAKY_PAYWALL_PATH . 'include/gateways/stripe/functions.php';
147 include LEAKY_PAYWALL_PATH . 'include/gateways/paypal/functions.php';
148 include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateway.php';
149 include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateway-stripe.php';
150 include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateway-stripe-checkout.php';
151 include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateway-paypal.php';
152 include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateway-manual.php';
153 include LEAKY_PAYWALL_PATH . 'include/gateways/class-leaky-paywall-payment-gateways.php';
154
155 if ( ! class_exists( 'Stripe\Stripe' ) ) {
156 require_once LEAKY_PAYWALL_PATH . 'include/stripe/init.php';
157 }
158
159 do_action( 'leaky_paywall_plugins_loaded' );
160 }
161 }
162 add_action( 'plugins_loaded', 'leaky_paywall_plugins_loaded', 4815162342 ); // wait for the plugins to be loaded before init.
163
164 /**
165 * Runs on plugin activation.
166 *
167 * Sets onboarding redirect flag and schedules tracking cron.
168 *
169 * @since 4.23.0
170 */
171 function leaky_paywall_activate() {
172 update_option( 'leaky_paywall_onboarding_redirect', 1 );
173
174 update_option( 'leaky_paywall_onboarding_install_time', time() );
175
176 if ( get_option( 'leaky_paywall_tracking_allow' ) && ! wp_next_scheduled( 'leaky_paywall_tracking_send' ) ) {
177 wp_schedule_event( time(), 'weekly', 'leaky_paywall_tracking_send' );
178 }
179 }
180 register_activation_hook( __FILE__, 'leaky_paywall_activate' );
181
182 function leaky_paywall_deactivate() {
183 wp_clear_scheduled_hook( 'leaky_paywall_tracking_send' );
184
185 if ( function_exists( 'as_unschedule_all_actions' ) ) {
186 as_unschedule_all_actions( 'leaky_paywall_rotate_debug_log' );
187 }
188
189 // The debug log holds subscriber data. A deactivated plugin has no reason
190 // to leave it on disk.
191 if ( function_exists( 'leaky_paywall_delete_log_files' ) ) {
192 leaky_paywall_delete_log_files();
193 delete_option( 'leaky_paywall_log_started' );
194 }
195
196 if ( function_exists( 'as_unschedule_all_actions' ) ) {
197 as_unschedule_all_actions( 'leaky_paywall_cleanup_exports' );
198 }
199
200 // Subscriber exports are the same story, and more sensitive.
201 if ( function_exists( 'leaky_paywall_delete_export_files' ) ) {
202 leaky_paywall_delete_export_files();
203 }
204 }
205 register_deactivation_hook( __FILE__, 'leaky_paywall_deactivate' );
206