-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvo-html-sitemap.php
59 lines (48 loc) · 1.5 KB
/
vo-html-sitemap.php
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
58
59
<?php
/**
* Plugin Name: VO HTML Sitemap
* Description: Van Ons plugin to add an HTML sitemap to your site.
* Author: Van Ons
* Author URI: https://van-ons.nl/
* Version: 1.0.8
* Text Domain: vo-html-sitemap
* Domain Path: /languages
* Requires at least: 6.4
* Requires PHP: 8.0
* License: MIT
*/
namespace VOHTMLSitemap;
use Exception;
if (!defined('ABSPATH') || !function_exists('add_filter')) {
header('Status: 403 Forbidden');
header('HTTP/1.1 403 Forbidden');
exit();
}
// Define plugin constants.
define('VOHTMLSITEMAP_VERSION', '1.0.8');
define('VOHTMLSITEMAP_ROOT', __DIR__ . '/');
define('VOHTMLSITEMAP_ROOT_FILE', __FILE__);
define('VOHTMLSITEMAP_FILE', plugin_basename(__FILE__));
define('VOHTMLSITEMAP_NAMESPACE', 'VOHTMLSitemap');
define('VOHTMLSITEMAP_PREFIX', strtolower(VOHTMLSITEMAP_NAMESPACE));
define('VOHTMLSITEMAP_RESOURCES_PATH', VOHTMLSITEMAP_ROOT . 'resources/');
define('VOHTMLSITEMAP_SRC_PATH', VOHTMLSITEMAP_ROOT . 'src/');
/**
* Autoload classes
*
* @throws Exception
*/
function autoload(string $class): void
{
if (!str_contains($class, VOHTMLSITEMAP_NAMESPACE)) {
return;
}
$result = str_replace([VOHTMLSITEMAP_NAMESPACE . '\\', '\\'], ['', '/'], $class);
$result .= '.php';
if (!file_exists(VOHTMLSITEMAP_SRC_PATH . $result)) {
return;
}
require VOHTMLSITEMAP_SRC_PATH . $result;
}
spl_autoload_register(VOHTMLSITEMAP_NAMESPACE . '\\autoload');
Plugin::init();