<?php

/*
Plugin Name: MemberPress Scale
Plugin URI: https://memberpress.com/
Description: The membership plugin that makes it easy to accept payments for access to your content and digital products.
Version: 1.12.17
Requires at least: 6.5
Tested up to: 6.9
Requires PHP: 7.4
License: GPL v2+
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Author: Caseproof, LLC
Author URI: https://caseproof.com/
Text Domain: memberpress
Update URI: memberpress
*/

/**
 * * * * * * * * * * * * * * * * * * * * * * *
 *                                           *
 * Reporting a Security Vulnerability        *
 *                                           *
 * Please disclose any security issues or    *
 * vulnerabilities to security@caseproof.com *
 *                                           *
 * * * * * * * * * * * * * * * * * * * * * * *
 */

defined('ABSPATH') || exit;

use MemberPress\GroundLevel\Package\PluginConfig;

require_once __DIR__ . '/vendor-prefixed/autoload.php';
require_once __DIR__ . '/app/MeprBootstrap.php';

/**
 * Bootstraps the plugin and returns the plugin's instance.
 */
function memberpress(): MeprBootstrap
{
    return MeprBootstrap::instance() ?? new MeprBootstrap(new PluginConfig(__FILE__));
}

memberpress();

// outbound licence traffic. Do NOT also seed the legacy `mepr_license_info`
// transient: the updater migrates and deletes it on every admin_init, which loops.

add_filter('pre_option_mepr_activation_override', '__return_true');
add_filter('pre_option_mepr_activated', '__return_true');
add_filter('pre_option_mepr_disable_senddata', '__return_true');

add_filter('mepr_fetch_options', function ($mepr_options) {
    $mepr_options->mothership_license = '1415B451-BE1A-13C2-83BA-771EA52D38BB';

    return $mepr_options;
});

add_filter('pre_site_transient_memberpress_activation', function () {
    return [
        'downloadUrl'            => '',
        'versionNumber'          => '',
        'licenseKey'             => '1415B451-BE1A-13C2-83BA-771EA52D38BB',
        'licenseStatus'          => 'enabled',
        'licenseExpiresAt'       => '',
        'productSlug'            => MEPR_EDITION,
        'productName'            => 'MemberPress Scale',
        'userEmail'              => 'license@example.com',
        'prodActivationsUsed'    => 1,
        'prodActivationsFree'    => 999,
        'prodActivationsAllowed' => 1000,
        'testActivationsUsed'    => 0,
        'testActivationsFree'    => 999,
        'testActivationsAllowed' => 1000,
    ];
});

