<?php
/**
 * Plugin Name:       Advanced Image Slider & Carousel
 * Plugin URI:        https://wordpress.org/plugins/advance-wp-slider
 * Description:       Modern Swiper carousel with full settings, color system, shortcode, and Elementor widget.
 * Version:           1.1.0
 * Requires at least: 5.8
 * Tested up to:      7.0
 * Requires PHP:      7.4
 * Author:            rajubdpro
 * Author URI:        https://profiles.wordpress.org/rajubdpro/
 * License:           GPL v2 or later
 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain:       advance-wp-slider
 * Domain Path:       /languages
 */

defined( 'ABSPATH' ) || exit;

define( 'AWP_PLUGIN_VERSION', '1.1.0' );
define( 'AWP_SLIDER_PLUGIN_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
define( 'AWP_PLUGIN_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );

require_once AWP_PLUGIN_PATH . 'inc/Awp_Loader.php';

/**
 * Bootstrap the plugin.
 */
function awp_slider() {
	if ( class_exists( 'Awp_Loader' ) ) {
		new Awp_Loader();
	}
}

/**
 * Flush rewrite rules on activation.
 */
function awp_slider_activate() {
	require_once AWP_PLUGIN_PATH . 'inc/class-awp-settings.php';
	require_once AWP_PLUGIN_PATH . 'frontend/Frontend.php';

	Awp_Slider_Frontend::get_instance()->awp_slider_custom_post_type();
	flush_rewrite_rules();

	if ( false === get_option( AWP_Settings::OPTION_KEY ) ) {
		add_option( AWP_Settings::OPTION_KEY, AWP_Settings::defaults() );
	}
}

/**
 * Flush rewrite rules on deactivation.
 */
function awp_slider_deactivate() {
	flush_rewrite_rules();
}

register_activation_hook( __FILE__, 'awp_slider_activate' );
register_deactivation_hook( __FILE__, 'awp_slider_deactivate' );

awp_slider();
