<?php
if (!defined('ABSPATH')) exit;

if (get_option('heru_smm_installed')) {
  wp_redirect(admin_url('admin.php?page=heru-smm'));
  exit;
}

$step = $_GET['step'] ?? 'welcome';
require __DIR__ . "/steps/$step.php";
register_activation_hook(
  HERU_SMM_PATH . 'heru-smm.php',
  function () {
    update_option('heru_smm_show_installer', true);
  }
);
add_action('admin_init', function () {
  if (get_option('heru_smm_show_installer')) {
    delete_option('heru_smm_show_installer');
    wp_redirect(admin_url('admin.php?page=heru-smm-installer'));
    exit;
  }
});
