43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Plugin Name: KB Markdown Importer
|
|
* Description: Imports GitLab based Markdown documentation into WordPress as a versioned knowledgebase.
|
|
* Version: 0.1.0
|
|
* Requires PHP: 8.1
|
|
* Author: Codex
|
|
* Text Domain: kb-markdown-importer
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
if (! defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
define('KB_MARKDOWN_IMPORTER_VERSION', '0.1.0');
|
|
define('KB_MARKDOWN_IMPORTER_FILE', __FILE__);
|
|
define('KB_MARKDOWN_IMPORTER_DIR', plugin_dir_path(__FILE__));
|
|
define('KB_MARKDOWN_IMPORTER_URL', plugin_dir_url(__FILE__));
|
|
|
|
spl_autoload_register(static function (string $class): void {
|
|
$prefix = 'KbMarkdownImporter\\';
|
|
|
|
if (0 !== strncmp($class, $prefix, strlen($prefix))) {
|
|
return;
|
|
}
|
|
|
|
$relative = substr($class, strlen($prefix));
|
|
$path = KB_MARKDOWN_IMPORTER_DIR . 'includes/' . str_replace('\\', '/', $relative) . '.php';
|
|
|
|
if (is_readable($path)) {
|
|
require_once $path;
|
|
}
|
|
});
|
|
|
|
register_activation_hook(__FILE__, [KbMarkdownImporter\Plugin::class, 'activate']);
|
|
register_deactivation_hook(__FILE__, [KbMarkdownImporter\Plugin::class, 'deactivate']);
|
|
|
|
add_action('plugins_loaded', static function (): void {
|
|
KbMarkdownImporter\Plugin::instance()->boot();
|
|
});
|