<?php
/**
 * Plugin Name: Papy3D Fact Viewer for Chuck365
 * Plugin URI: https://laforge.papy-3d-factory.xyz
 * Description: Displays a unique and different Chuck Norris fact every day via the official Chuck365.fr API.
 * Version: 4.0.2
 * Requires at least: 6.5
 * Tested up to: 7.1
 * Requires PHP: 8.3
 * Author: papy3d
 * Author URI: https://papy-3d-factory.xyz
 * Text Domain: papy3d-fact-viewer-for-chuck365
 * Domain Path: /languages
 * License: GPLv3 or later
 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
 *
 * @package Papy3DFactViewerForChuck365
 */

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

// Plugin constants.
if ( ! defined( 'PAPYFAVI_VERSION' ) ) {
	define( 'PAPYFAVI_VERSION', '4.0.2' );
}
if ( ! defined( 'PAPYFAVI_PLUGIN_FILE' ) ) {
	define( 'PAPYFAVI_PLUGIN_FILE', __FILE__ );
}
if ( ! defined( 'PAPYFAVI_PLUGIN_DIR' ) ) {
	define( 'PAPYFAVI_PLUGIN_DIR', plugin_dir_path( PAPYFAVI_PLUGIN_FILE ) );
}
if ( ! defined( 'PAPYFAVI_PLUGIN_URL' ) ) {
	define( 'PAPYFAVI_PLUGIN_URL', plugin_dir_url( PAPYFAVI_PLUGIN_FILE ) );
}
if ( ! defined( 'PAPYFAVI_ASSET_VERSION' ) ) {
	$papyfavi_asset_version = PAPYFAVI_VERSION;

	if (
		defined( 'WP_DEBUG' )
		&& WP_DEBUG
		&& file_exists( PAPYFAVI_PLUGIN_DIR . 'js/admin-settings.js' )
	) {
		$papyfavi_asset_version .= '.' . (string) filemtime( PAPYFAVI_PLUGIN_DIR . 'js/admin-settings.js' );
	}

	define( 'PAPYFAVI_ASSET_VERSION', $papyfavi_asset_version );
	unset( $papyfavi_asset_version );
}

require_once PAPYFAVI_PLUGIN_DIR . 'includes/class-papy3d-fact-viewer-for-chuck365-plugin.php';

add_action(
	'plugins_loaded',
	static function (): void {
		new Papy3D_Fact_Viewer_For_Chuck365_Plugin();
	}
);
