<?php
/**
 * Plugin Name:     Sifency Addons
 * Plugin URI:      https://sifency.com/sifency-addons
 * Description:     250+ Powerful Elementor widgets with 30+ template builder elements and 11+ ready-to-use custom post types.
 * Author:          Sifency
 * Author URI:      https://sifency.com
 * Text Domain:     sifency-addons
 * Domain Path:     /languages
 * Version:         1.0.5
 * Requires at least: 6.2
 * Requires PHP:      7.4
 * Tested up to:      7.0
 * Elementor tested up to: 3.32.5
 * Elementor Pro tested up to: 3.32.5
 * License: GPLv2 or later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 *
 * @package         Sifency_Addons
 * @version         1.0.5
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

define( 'SIFENCY_ADDONS_VERSION', '1.0.5' );
define( 'SIFENCY_ADDONS_TESTED_WP', '7.0' );
define( 'SIFENCY_ADDONS_FILE', __FILE__ );
define( 'SIFENCY_ADDONS_DIR', plugin_dir_path( __FILE__ ) );
define( 'SIFENCY_ADDONS_URL', plugin_dir_url( __FILE__ ) );
define( 'SIFENCY_ADDONS_MIN_PHP_VERSION', '7.4.0' );
define( 'SIFENCY_ADDONS_MIN_WP_VERSION', '6.7' );
define( 'SIFENCY_MIN_ELEMENTOR_VERSION', '3.5.0' );

require_once SIFENCY_ADDONS_DIR . 'includes/notice.php';
require_once SIFENCY_ADDONS_DIR . 'base/sifency-class.php';

/**
 * Track plugin version updates for rollback functionality
 */
function sifency_addons_track_version() {
	$stored_version = get_option( 'sifency_addons_stored_version' );

	if ( $stored_version !== SIFENCY_ADDONS_VERSION ) {
		if ( class_exists( 'Sifency_Addons_Admin_Options' ) ) {
			$options = Sifency_Addons_Admin_Options::instance();
			$options->track_version_update( SIFENCY_ADDONS_VERSION );
		}
		update_option( 'sifency_addons_stored_version', SIFENCY_ADDONS_VERSION );
	}
}
add_action( 'plugins_loaded', 'sifency_addons_track_version' );

/**
 * Main instance of Sifency_Addons.
 *
 * Returns the main instance of Sifency_Addons to prevent the need to use globals.
 *
 * @return Sifency_Addons
 */
function sifency_addons() {
	return Sifency_Addons::instance();
}
sifency_addons();
register_activation_hook( __FILE__, array( 'Sifency_Addons', 'activate' ) );
