<?php
/**
 * Plugin Name: Media Trim — Unused & Duplicate Media Cleaner
 * Plugin URI: https://wordpress.org/plugins/media-trim
 * Description: Clean up your WordPress media library by finding and removing unused, duplicate, and orphaned images. Reclaim disk space and optimize your site performance.
 * Version: 1.0.3
 * Author: MD MEHEDI HASAN PARVEZ
 * Author URI: https://profiles.wordpress.org/mehedi2509
 * License: GPLv2 or later
 * Text Domain: media-trim
 * Domain Path: /languages
 */

namespace MediaTrim;

defined('ABSPATH') || exit;

// Define plugin constants
define('MTRIM_VERSION', '1.0.3');
define('MTRIM_PLUGIN_FILE', __FILE__);
define('MTRIM_PLUGIN_PATH', plugin_dir_path(__FILE__));
define('MTRIM_PLUGIN_URL', plugin_dir_url(__FILE__));
define('MTRIM_PLUGIN_BASENAME', plugin_basename(__FILE__));

/**
 * Basic PSR-4 Autoloader
 */
spl_autoload_register(function ($class) {
    $prefix = 'MediaTrim\\';
    $base_dir = MTRIM_PLUGIN_PATH . 'includes/';

    $len = strlen($prefix);
    if (strncmp($prefix, $class, $len) !== 0) {
        return;
    }

    $relative_class = substr($class, $len);
    $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';

    if (file_exists($file)) {
        require $file;
    }
});

/**
 * Initialize the plugin
 */
Plugin::get_instance();

// Activation/Deactivation hooks
register_activation_hook(__FILE__, [Activator\Activator::get_instance(), 'on_activate']);
