| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Memberful - Membership Plugin |
| 4 |
Plugin URI: http://github.com/memberful/memberful-wp |
| 5 |
Description: Sell memberships and restrict access to content with WordPress and Memberful. |
| 6 |
Version: 1.78.0 |
| 7 |
Author: Memberful |
| 8 |
Author URI: http://memberful.com |
| 9 |
License: GPLv2 or later |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'MEMBERFUL_VERSION' ) ) |
| 13 |
define( 'MEMBERFUL_VERSION', '1.78.0' ); |
| 14 |
|
| 15 |
if ( ! defined( 'MEMBERFUL_PLUGIN_FILE' ) ) |
| 16 |
define( 'MEMBERFUL_PLUGIN_FILE', __FILE__ ); |
| 17 |
|
| 18 |
if ( ! defined( 'MEMBERFUL_DIR' ) ) |
| 19 |
define( 'MEMBERFUL_DIR', dirname( __FILE__ ) ); |
| 20 |
|
| 21 |
if ( ! defined( 'MEMBERFUL_URL' ) ) |
| 22 |
define( 'MEMBERFUL_URL', plugins_url( '', __FILE__ ) ); |
| 23 |
|
| 24 |
if ( ! defined( 'MEMBERFUL_APPS_HOST' ) ) |
| 25 |
define( 'MEMBERFUL_APPS_HOST', 'https://apps.memberful.com' ); |
| 26 |
|
| 27 |
if ( ! defined( 'MEMBERFUL_EMBED_HOST' ) ) |
| 28 |
define( 'MEMBERFUL_EMBED_HOST', 'https://js.memberful.com'); |
| 29 |
|
| 30 |
// Should requests to memberful check the SSL certificate? |
| 31 |
if ( ! defined( 'MEMBERFUL_SSL_VERIFY' ) ) |
| 32 |
define( 'MEMBERFUL_SSL_VERIFY', TRUE ); |
| 33 |
|
| 34 |
require_once MEMBERFUL_DIR . '/src/core-ext.php'; |
| 35 |
require_once MEMBERFUL_DIR . '/src/cron.php'; |
| 36 |
require_once MEMBERFUL_DIR . '/src/urls.php'; |
| 37 |
require_once MEMBERFUL_DIR . '/src/user/map.php'; |
| 38 |
require_once MEMBERFUL_DIR . '/src/user/meta.php'; |
| 39 |
require_once MEMBERFUL_DIR . '/src/user/role_decision.php'; |
| 40 |
require_once MEMBERFUL_DIR . '/src/authenticator.php'; |
| 41 |
require_once MEMBERFUL_DIR . '/src/admin.php'; |
| 42 |
require_once MEMBERFUL_DIR . '/src/admin/editor.php'; |
| 43 |
require_once MEMBERFUL_DIR . '/src/acl.php'; |
| 44 |
require_once MEMBERFUL_DIR . '/src/block-editor.php'; |
| 45 |
require_once MEMBERFUL_DIR . '/src/shortcodes.php'; |
| 46 |
require_once MEMBERFUL_DIR . '/src/widgets.php'; |
| 47 |
require_once MEMBERFUL_DIR . '/src/endpoints.php'; |
| 48 |
require_once MEMBERFUL_DIR . '/src/marketing_content.php'; |
| 49 |
require_once MEMBERFUL_DIR . '/src/content_filter.php'; |
| 50 |
require_once MEMBERFUL_DIR . '/src/search_filter.php'; |
| 51 |
require_once MEMBERFUL_DIR . '/src/entities.php'; |
| 52 |
require_once MEMBERFUL_DIR . '/src/embed.php'; |
| 53 |
require_once MEMBERFUL_DIR . '/src/api.php'; |
| 54 |
require_once MEMBERFUL_DIR . '/src/roles.php'; |
| 55 |
require_once MEMBERFUL_DIR . '/src/syncing.php'; |
| 56 |
require_once MEMBERFUL_DIR . '/src/logout_hooks.php'; |
| 57 |
require_once MEMBERFUL_DIR . '/src/contrib/bbpress.php'; |
| 58 |
require_once MEMBERFUL_DIR . '/vendor/reporting.php'; |
| 59 |
require_once MEMBERFUL_DIR . '/src/private_user_feed.php'; |
| 60 |
require_once MEMBERFUL_DIR . '/src/comments_protection.php'; |
| 61 |
require_once MEMBERFUL_DIR . '/src/nav_menus.php'; |
| 62 |
require_once MEMBERFUL_DIR . '/src/bulk_protect.php'; |
| 63 |
require_once MEMBERFUL_DIR . '/src/hide_admin_toolbar.php'; |
| 64 |
require_once MEMBERFUL_DIR . '/src/block_dashboard_access.php'; |
| 65 |
require_once MEMBERFUL_DIR . '/src/filter_account_menu_items.php'; |
| 66 |
require_once MEMBERFUL_DIR . '/src/contrib/ad-providers.php'; |
| 67 |
|
| 68 |
if ( in_array( 'sensei/woothemes-sensei.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { |
| 69 |
require_once MEMBERFUL_DIR . '/src/contrib/woothemes-sensei.php'; |
| 70 |
} |
| 71 |
|
| 72 |
if ( in_array( 'sfwd-lms/sfwd_lms.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { |
| 73 |
require_once MEMBERFUL_DIR . '/src/contrib/sfwd-learndash.php'; |
| 74 |
} |
| 75 |
|
| 76 |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { |
| 77 |
require_once MEMBERFUL_DIR . '/src/contrib/woocommerce.php'; |
| 78 |
} |
| 79 |
|
| 80 |
if ( in_array( 'elementor/elementor.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { |
| 81 |
require_once MEMBERFUL_DIR . '/src/contrib/elementor.php'; |
| 82 |
} |
| 83 |
|
| 84 |
if ( in_array( 'wp-ultimate-recipe/wp-ultimate-recipe.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { |
| 85 |
require_once MEMBERFUL_DIR . '/src/contrib/wp-ultimate-recipe.php'; |
| 86 |
} |
| 87 |
|
| 88 |
if ( in_array( 'wp-ultimate-recipe-premium/wp-ultimate-recipe-premium.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { |
| 89 |
require_once MEMBERFUL_DIR . '/src/contrib/wp-ultimate-recipe-premium.php'; |
| 90 |
} |
| 91 |
|
| 92 |
function memberful_wp_plugin_activate() { |
| 93 |
add_option( 'memberful_wp_activation_redirect' , true ); |
| 94 |
memberful_clear_obsolete_cron_jobs(); |
| 95 |
} |
| 96 |
register_activation_hook( __FILE__, 'memberful_wp_plugin_activate' ); |
| 97 |
|
| 98 |
function memberful_wp_plugin_deactivate() { |
| 99 |
memberful_clear_cron_jobs(); |
| 100 |
} |
| 101 |
register_deactivation_hook( __FILE__, 'memberful_wp_plugin_deactivate' ); |
| 102 |
|
| 103 |
function memberful_wp_plugin_uninstall() { |
| 104 |
memberful_api_disconnect(); |
| 105 |
memberful_wp_reset(); |
| 106 |
} |
| 107 |
register_uninstall_hook(__FILE__, "memberful_wp_plugin_uninstall"); |
| 108 |
|
| 109 |
function memberful_extend_auth_cookie_expiration( $expirein ) { |
| 110 |
if ( get_option( 'memberful_extend_auth_cookie_expiration' ) ) { |
| 111 |
return 60 * 60 * 24 * 365; // 1 year |
| 112 |
} else { |
| 113 |
return $expirein; |
| 114 |
} |
| 115 |
} |
| 116 |
add_filter( 'auth_cookie_expiration', 'memberful_extend_auth_cookie_expiration' ); |
| 117 |
|