This commit is contained in:
Javier Casares 2026-08-12 13:18:40 +00:00
commit bc1cb5e00a
32 changed files with 4254 additions and 0 deletions

View file

@ -0,0 +1,90 @@
<?php
/**
* Core plugin class entry point for the ROBOTSTXT Manager plugin.
*
* @package Robotstxt_Manager
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Robotstxt_Manager_Plugin
*
* Singleton that owns the loader instance and wires up all component hooks.
*/
final class Robotstxt_Manager_Plugin {
/**
* Singleton instance.
*
* @var self|null
*/
private static ?self $instance = null;
/**
* Hook loader.
*
* @var Robotstxt_Manager_Loader
*/
private Robotstxt_Manager_Loader $loader;
/**
* Returns the singleton instance, creating it on the first call.
*
* @return self
*/
public static function get_instance(): self {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor private to enforce singleton usage.
*/
private function __construct() {
$this->loader = new Robotstxt_Manager_Loader();
$this->define_hooks();
}
/**
* Wires component callbacks into the loader.
*
* @return void
*/
private function define_hooks(): void {
$this->loader->add_action( 'init', $this, 'load_textdomain' );
$admin = new Robotstxt_Manager_Admin();
$settings = new Robotstxt_Manager_Settings();
$admin->register( $this->loader );
$settings->register( $this->loader );
}
/**
* Loads the plugin text domain for i18n.
*
* @return void
*/
public function load_textdomain(): void {
load_plugin_textdomain(
'robotstxt-manager',
false,
dirname( ROBOTSTXT_MANAGER_BASENAME ) . '/languages'
);
}
/**
* Dispatches all registered hooks to WordPress.
*
* @return void
*/
public function run(): void {
$this->loader->run();
}
}