-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplover-toc.php
76 lines (69 loc) · 2.56 KB
/
plover-toc.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* PloverToc
*
* @author Wasseem Khayrattee
* @copyright 2024 Wasseem Khayrattee
* @license GPL-3.0-only
*
* @wordpress-plugin
* Plugin Name: PloverToc
* Plugin URI: https://github.com/PloverHub/plover-toc
* Description: A plugin to automatically generate a TOC for posts, pages and custom post types by parsing headers. It adds ID anchor attributes for proper in-page links.
* Version: 0.7.0
* Requires at least: 6.4.0
* Author: Wasseem Khayrattee
* Author URI: https://github.com/wkhayrattee
* License: GPL-3.0-only
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: plover-toc
* Domain Path: /languages
*
*
* reference: https://developer.wordpress.org/plugins/plugin-basics/header-requirements/
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version GPL-3.0-only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see https://www.gnu.org/licenses/gpl-3.0.html
*/
/**
* Make sure we don't expose any info if called directly
*/
use PloverToc\PluginManager;
if (!function_exists('add_action')) {
header('Status: 403 Forbidden');
header('HTTP/1.1 403 Forbidden');
exit;
}
/**
* Some global constants for our use-case
*/
define('PLOVER_TOC_PLUGIN_VERSION', '0.7.0');
define('PLOVER_TOC_PLUGIN_MINIMUM_WP_VERSION', '6.4.0');
define('PLOVER_TOC_PLUGIN_DIR_URL', plugin_dir_url(__FILE__)); //has trailing slash at end
define('PLOVER_TOC_PLUGIN_DIR', plugin_dir_path(__FILE__)); //has trailing slash at end
define('PLOVER_TOC_PLUGIN_BASENAME', plugin_basename(PLOVER_TOC_PLUGIN_DIR));
define('PLOVER_TOC_PLUGIN_TEMPLATES', PLOVER_TOC_PLUGIN_DIR . 'templates' . DIRECTORY_SEPARATOR);
define('PLOVER_TOC_PLUGIN_ERROR_LOG_FILE', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'plover-toc_message.log');
/**
* composer autoloading
*/
require_once PLOVER_TOC_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'includes/vendor/autoload.php';
/**
* Register main Hooks
*/
register_activation_hook(__FILE__, ['PloverToc\\PluginManager', 'plugin_activation']);
register_deactivation_hook(__FILE__, ['PloverToc\\PluginManager', 'plugin_deactivation']);
/**
* Load general frontend logic & background processes
*/
PluginManager::run();