<?php

/**
 * The plugin bootstrap file.
 *
 * @link            https://aiopodcasting.com
 * @since           1.0.0
 * @package         AiO_Podcast_Studio
 *
 * @wordpress-plugin
 * Plugin Name:     AiO Podcast Studio
 * Plugin URI:      https://aiopodcasting.com
 * Description:     AiO Podcast Studio makes it easy to create, manage, and publish podcasts in WordPress. Import via RSS or add manually, organize content with categories, tags, and participants, and distribute to platforms like Apple and Spotify — all from a streamlined, creator-focused interface.
 * Version:         1.0.2
 * Author:          Team AiO Podcast Studio
 * License:         GPLv2 or later
 * License URI:     http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:     aio-podcast-studio
 * Domain Path:     /languages
 * 
 */
// Exit if accessed directly
if ( !defined( 'WPINC' ) ) {
    die;
}
if ( function_exists( 'aiopod_fs' ) ) {
    aiopod_fs()->set_basename( false, __FILE__ );
    return;
}
if ( !function_exists( 'aiopod_fs' ) ) {
    function aiopod_fs() {
        global $aiopod_fs;
        if ( !isset( $aiopod_fs ) ) {
            // Include Freemius SDK.
            require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
            $aiopod_fs = fs_dynamic_init( array(
                'id'               => '31552',
                'slug'             => 'aio-podcast-studio',
                'type'             => 'plugin',
                'public_key'       => 'pk_4cfc9c08f0e68e173e5b03dd50249',
                'is_premium'       => false,
                'has_addons'       => false,
                'has_paid_plans'   => true,
                'is_org_compliant' => true,
                'trial'            => array(
                    'days'               => 7,
                    'is_require_payment' => false,
                ),
                'menu'             => array(
                    'slug'       => 'aio-podcast-studio',
                    'first-path' => 'admin.php?page=aio-podcast-studio',
                ),
                'is_live'          => true,
            ) );
        }
        return $aiopod_fs;
    }

    // Init Freemius.
    aiopod_fs();
    // Signal that SDK was initiated.
    do_action( 'aiopod_fs_loaded' );
}
// The current version of the plugin
if ( !defined( 'AIOPOD_PLUGIN_VERSION' ) ) {
    define( 'AIOPOD_PLUGIN_VERSION', '1.0.2' );
}
// The unique identifier of the plugin
if ( !defined( 'AIOPOD_PLUGIN_SLUG' ) ) {
    define( 'AIOPOD_PLUGIN_SLUG', 'aio-podcast-studio' );
}
// Path to the plugin directory
if ( !defined( 'AIOPOD_PLUGIN_DIR' ) ) {
    define( 'AIOPOD_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
// URL of the plugin
if ( !defined( 'AIOPOD_PLUGIN_URL' ) ) {
    define( 'AIOPOD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
// The plugin file name
if ( !defined( 'AIOPOD_PLUGIN_FILE_NAME' ) ) {
    define( 'AIOPOD_PLUGIN_FILE_NAME', plugin_basename( __FILE__ ) );
}
// URL of the placeholder image (default)
if ( !defined( 'AIOPOD_PLUGIN_PLACEHOLDER_IMAGE_URL' ) ) {
    define( 'AIOPOD_PLUGIN_PLACEHOLDER_IMAGE_URL', AIOPOD_PLUGIN_URL . 'public/assets/images/placeholder-image.png' );
}
// URL of the placeholder image (avatar)
if ( !defined( 'AIOPOD_PLUGIN_PLACEHOLDER_AVATAR_URL' ) ) {
    define( 'AIOPOD_PLUGIN_PLACEHOLDER_AVATAR_URL', AIOPOD_PLUGIN_URL . 'public/assets/images/placeholder-avatar.png' );
}
// The global plugin variable
$aiopod = array();
if ( !function_exists( 'aiopod_activate' ) ) {
    /**
     * The code that runs during plugin activation.
     * This action is documented in includes/activator.php
     */
    function aiopod_activate(  $network_wide  ) {
        if ( is_multisite() && $network_wide ) {
            deactivate_plugins( AIOPOD_PLUGIN_FILE_NAME );
            wp_die( __( 'Sorry, this plugin cannot be activated network-wide. Please activate it individually on each site where it is needed.', 'aio-podcast-studio' ), __( 'Network Activation Not Allowed', 'aio-podcast-studio' ), array(
                'back_link' => true,
            ) );
        }
        require_once AIOPOD_PLUGIN_DIR . 'includes/activator.php';
        AIOPOD_Activator::activate();
    }

    register_activation_hook( __FILE__, 'aiopod_activate' );
}
if ( !function_exists( 'aiopod_deactivate' ) ) {
    /**
     * The code that runs during plugin deactivation.
     * This action is documented in includes/deactivator.php
     */
    function aiopod_deactivate() {
        require_once AIOPOD_PLUGIN_DIR . 'includes/deactivator.php';
        AIOPOD_Deactivator::deactivate();
    }

    register_deactivation_hook( __FILE__, 'aiopod_deactivate' );
}
if ( !function_exists( 'aiopod_run' ) ) {
    /**
     * Begins execution of the plugin.
     *
     * @since 1.0.0
     */
    function aiopod_run() {
        require AIOPOD_PLUGIN_DIR . 'includes/init.php';
        $plugin = new AIOPOD_Init();
        $plugin->run();
    }

    aiopod_run();
}
if ( !function_exists( 'aiopod_uninstall' ) ) {
    /**
     * The code that runs during plugin uninstallation.
     * This action is documented in includes/uninstall.php
     */
    function aiopod_uninstall() {
        require_once AIOPOD_PLUGIN_DIR . 'includes/uninstall.php';
        AIOPOD_Uninstall::uninstall();
    }

    aiopod_fs()->add_action( 'after_uninstall', 'aiopod_uninstall' );
}