initial COmmit: Add KB Antora Importer plugin files
This commit is contained in:
42
kb-antora-importer/kb-antora-importer.php
Normal file
42
kb-antora-importer/kb-antora-importer.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: KB Antora Importer
|
||||
* Description: Imports GitLab/Antora based AsciiDoc documentation into WordPress as a versioned knowledgebase.
|
||||
* Version: 0.1.0
|
||||
* Requires PHP: 8.1
|
||||
* Author: Codex
|
||||
* Text Domain: kb-antora-importer
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
if (! defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define('KB_ANTORA_IMPORTER_VERSION', '0.1.0');
|
||||
define('KB_ANTORA_IMPORTER_FILE', __FILE__);
|
||||
define('KB_ANTORA_IMPORTER_DIR', plugin_dir_path(__FILE__));
|
||||
define('KB_ANTORA_IMPORTER_URL', plugin_dir_url(__FILE__));
|
||||
|
||||
spl_autoload_register(static function (string $class): void {
|
||||
$prefix = 'KbAntoraImporter\\';
|
||||
|
||||
if (0 !== strncmp($class, $prefix, strlen($prefix))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$relative = substr($class, strlen($prefix));
|
||||
$path = KB_ANTORA_IMPORTER_DIR . 'includes/' . str_replace('\\', '/', $relative) . '.php';
|
||||
|
||||
if (is_readable($path)) {
|
||||
require_once $path;
|
||||
}
|
||||
});
|
||||
|
||||
register_activation_hook(__FILE__, [KbAntoraImporter\Plugin::class, 'activate']);
|
||||
register_deactivation_hook(__FILE__, [KbAntoraImporter\Plugin::class, 'deactivate']);
|
||||
|
||||
add_action('plugins_loaded', static function (): void {
|
||||
KbAntoraImporter\Plugin::instance()->boot();
|
||||
});
|
||||
Reference in New Issue
Block a user