<?php

/**
 * Plugin Name:       SkyServers Retragere din Contract (OUG 18/2026)
 * Plugin URI:        https://www.sky-servers.com/skyservers-retragere-din-contract/
 * Description:       Adds the digital contract withdrawal function required by Romanian OUG 18/2026: a public form, a timestamped record, and an automatic email acknowledgement.
 * Version:           1.11.4
 * Requires at least: 6.0
 * Requires PHP:      7.4
 * Author:            Sky Servers SRL
 * Author URI:        https://www.sky-servers.com
 * License:           GPL-2.0-or-later
 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain:       skyservers-retragere-contract
 *
 *
 * @package SkyServers\Retragere
 */
declare (strict_types = 1);
if ( !defined( 'ABSPATH' ) ) {
    exit;
}
define( 'SSRC_VERSION', '1.11.4' );
define( 'SSRC_FILE', __FILE__ );
define( 'SSRC_PATH', plugin_dir_path( __FILE__ ) );
define( 'SSRC_URL', plugin_dir_url( __FILE__ ) );
require_once SSRC_PATH . 'vendor/autoload.php';
// The free build published to wordpress.org and the premium build downloaded
// from Freemius are the same plugin. If both are somehow active, hand the SDK
// the file it should treat as canonical rather than booting a second copy.
if ( function_exists( 'ssrc_fs' ) ) {
    ssrc_fs()->set_basename( false, __FILE__ );
} else {
    /**
     * Freemius glue, kept in the main file because the SDK has to load before
     * anything else asks whether this install is licensed.
     *
     * The wrapper name is ours to pick: fs_dynamic_init() resolves the instance
     * from the id and slug, and the SDK never looks at this function.
     *
     * @return \Freemius
     */
    function ssrc_fs() {
        global $ssrc_fs;
        if ( !isset( $ssrc_fs ) ) {
            require_once SSRC_PATH . 'vendor/freemius/wordpress-sdk/start.php';
            $ssrc_fs = fs_dynamic_init( [
                'id'               => '37453',
                'slug'             => 'skyservers-retragere-contract',
                'type'             => 'plugin',
                'public_key'       => 'pk_de06f3e478cc4457f34c5b721e4da',
                'is_premium'       => false,
                'premium_suffix'   => 'Pro',
                'has_addons'       => false,
                'has_paid_plans'   => true,
                'is_org_compliant' => true,
                'menu'             => [
                    'slug'    => 'ssrc-settings',
                    'parent'  => [
                        'slug' => 'edit.php?post_type=ss_retragere',
                    ],
                    'account' => false,
                    'support' => false,
                ],
                'is_live'          => true,
            ] );
        }
        return $ssrc_fs;
    }

    ssrc_fs();
    // Point every upgrade route at the hosted checkout.
    //
    // In is_org_compliant mode - the configuration wordpress.org requires - the
    // SDK's own pricing screen is not usable, so the Upgrade menu item leads
    // nowhere. Returning a URL here makes the SDK add a plain link item instead
    // of rendering that screen (see add_submenu_link_item in class-freemius.php),
    // which routes the menu, the notices and every other upgrade prompt to the
    // same public checkout in one change.
    ssrc_fs()->add_filter( 'pricing_url', static function () {
        // Product 37453, plan 62233 (Pro).
        return 'https://checkout.freemius.com/mode/dialog/plugin/37453/plan/62233/';
    } );
    // WordPress runs uninstall.php instead of the uninstall hook when the file
    // exists, which would stop Freemius closing its own side of the install.
    // The file is gone; the cleanup hangs off the SDK instead.
    ssrc_fs()->add_action( 'after_uninstall', ['\\SkyServers\\Retragere\\Wp\\Uninstall', 'run'] );
    do_action( 'ssrc_fs_loaded' );
}
/**
 * Single plugin instance.
 */
function ssrc_plugin() : \SkyServers\Retragere\Wp\Plugin {
    static $instance = null;
    if ( null === $instance ) {
        $instance = new \SkyServers\Retragere\Wp\Plugin();
    }
    return $instance;
}

register_activation_hook( __FILE__, ['\\SkyServers\\Retragere\\Wp\\Activation', 'activate'] );
register_deactivation_hook( __FILE__, ['\\SkyServers\\Retragere\\Wp\\Activation', 'deactivate'] );
ssrc_plugin()->boot();