<?php
/**
 * Plugin Name: Yatoon Social Feed
 * Plugin URI:  https://yatoon.com/
 * Description: Display Facebook Page & Instagram Business photos on your website. Paste your permanent tokens once - no OAuth, no expiry.
 * Version:     1.0.6
 * Requires at least: 5.8
 * Requires PHP: 7.4
 * Tested up to: 7.0
 * Author:      Yatoon
 * Author URI:  https://yatoon.com
 * License:     GPLv2 or later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: yatoon-social-feed
 */

if ( ! defined( 'ABSPATH' ) ) exit;

define( 'YATOON_SF_VERSION', '1.0.6' );
define( 'YATOON_SF_FILE',    __FILE__ );
define( 'YATOON_SF_DIR',     plugin_dir_path( __FILE__ ) );
define( 'YATOON_SF_URL',     plugin_dir_url( __FILE__ ) );

require_once YATOON_SF_DIR . 'freemius.php';

require_once YATOON_SF_DIR . 'includes/class-database.php';
require_once YATOON_SF_DIR . 'includes/class-api.php';
require_once YATOON_SF_DIR . 'includes/class-sync.php';
require_once YATOON_SF_DIR . 'includes/class-shortcode.php';
require_once YATOON_SF_DIR . 'admin/class-admin.php';

register_activation_hook( __FILE__, array( 'Yatoon_SF_Database', 'install' ) );

register_deactivation_hook( __FILE__, function () {
    // Clear the scheduled auto-sync event. We intentionally do NOT delete
    // any stored options/tokens/photos here - that only happens via
    // uninstall.php if the admin chooses to delete the plugin (not just
    // deactivate it), in line with WordPress.org data-handling guidelines.
    wp_clear_scheduled_hook( 'yatoon_sf_auto_sync' );
} );

add_action( 'plugins_loaded', function () {
    new Yatoon_SF_Admin();
    new Yatoon_SF_Shortcode();
    new Yatoon_SF_Sync();
} );
