-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtocflow.php
More file actions
68 lines (60 loc) · 1.94 KB
/
Copy pathtocflow.php
File metadata and controls
68 lines (60 loc) · 1.94 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
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* Plugin Name: TOCflow
* Plugin URI: https://github.com/matthummel-pa/tocflow
* Description: A lightweight Table of Contents block that auto-generates a linked outline from your post headings.
* Version: 1.3.3
* Requires at least: 6.4
* Requires PHP: 7.4
* Author: Matt Hummel
* Author URI: https://matthummel.com
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: tocflow
* Domain Path: /languages
*
* @package TOCflow
* @copyright 2026 Matt Hummel
* @license GPL-2.0-or-later
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'TOCFLOW_VERSION', '1.3.3' );
define( 'TOCFLOW_FILE', __FILE__ );
define( 'TOCFLOW_DIR', plugin_dir_path( __FILE__ ) );
define( 'TOCFLOW_URL', plugin_dir_url( __FILE__ ) );
define( 'TOCFLOW_BASENAME', plugin_basename( __FILE__ ) );
require_once TOCFLOW_DIR . 'includes/class-tocflow-settings.php';
require_once TOCFLOW_DIR . 'includes/class-tocflow-headings.php';
require_once TOCFLOW_DIR . 'includes/class-tocflow-plugin.php';
/**
* Returns the main plugin instance.
*
* @return TOCflow_Plugin
*/
function tocflow() {
return TOCflow_Plugin::instance();
}
tocflow()->boot();
register_activation_hook( TOCFLOW_FILE, array( 'TOCflow_Plugin', 'activate' ) );
register_deactivation_hook( TOCFLOW_FILE, array( 'TOCflow_Plugin', 'deactivate' ) );
/**
* Heading map for a post. Kept as a prefixed wrapper so render.php stays thin.
*
* @param int $post_id Post ID.
* @return array
*/
function tocflow_get_all_headings( $post_id ) {
return TOCflow_Headings::get_all( $post_id );
}
/**
* Render nested list markup from heading data.
*
* @param array $headings Heading data with normalized 'level'.
* @param string $list_tag 'ol' or 'ul'.
* @return string
*/
function tocflow_render_list( $headings, $list_tag ) {
return TOCflow_Headings::render_list( $headings, $list_tag );
}