-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvirtual-llms-txt.php
More file actions
57 lines (49 loc) · 1.65 KB
/
virtual-llms-txt.php
File metadata and controls
57 lines (49 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* Plugin bootstrap for Virtual llms.txt.
*
* @package Virtual_Llms_Txt
*
* Plugin Name: Virtual llms.txt
* Plugin URI: https://llmstxt.org/
* Description: Serves a virtual llms.txt document from site settings (plain text, per site).
* Version: 1.0.0
* Requires at least: 6.0
* Requires PHP: 8.0
* Author: Contributors
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: virtual-llms-txt
* Domain Path: languages
*
* @license GPL-2.0-or-later
*/
declare( strict_types=1 );
namespace Virtual_Llms_Txt;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'VIRTUAL_LLMS_TXT_VERSION', '1.0.0' );
define( 'VIRTUAL_LLMS_TXT_PLUGIN_FILE', __FILE__ );
define( 'VIRTUAL_LLMS_TXT_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
/**
* PSR-4 autoload for Virtual_Llms_Txt\* classes under src/.
*
* @param string $class_name Fully qualified class name.
*/
function autoload( string $class_name ): void {
$prefix = 'Virtual_Llms_Txt\\';
if ( ! str_starts_with( $class_name, $prefix ) ) {
return;
}
$relative = substr( $class_name, strlen( $prefix ) );
$relative = str_replace( '\\', DIRECTORY_SEPARATOR, $relative );
$file = VIRTUAL_LLMS_TXT_PLUGIN_DIR . 'src' . DIRECTORY_SEPARATOR . $relative . '.php';
if ( is_readable( $file ) ) {
require_once $file;
}
}
spl_autoload_register( __NAMESPACE__ . '\\autoload' );
register_activation_hook( VIRTUAL_LLMS_TXT_PLUGIN_FILE, [ Plugin::class, 'activate' ] );
register_deactivation_hook( VIRTUAL_LLMS_TXT_PLUGIN_FILE, [ Plugin::class, 'deactivate' ] );
Plugin::instance()->register_hooks();