PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.8.9
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.8.9
4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.5.2 All 199 releases
betterdocs / includes / Utils / Node.php

Node.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 3.8.9, at includes/Utils/Node.php

36 lines 1001 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WPDeveloper\BetterDocs\Utils;
3
4 class Node {
5 public $title;
6 public $tag;
7 public $tag_number;
8 public $key;
9 /**
10 * Summary of $items
11 * @var array
12 */
13 public $items;
14
15 public function print( $items, $toc_hierarchy, $level ) {
16 $html = '';
17 if ( ! empty( $items ) ) {
18 $toc_hierarchy_class = ( $toc_hierarchy != 'off' && $toc_hierarchy != '' ) ? 'toc-list betterdocs-hierarchial-toc' : 'toc-list';
19 $html .= $level === 1 ? '<ul class = "' . $toc_hierarchy_class . '">' : '<ul class = "betterdocs-toc-list-level-' . $level . '">';
20 foreach ( $items as $item ) {
21 $html .= '<li class = "betterdocs-toc-heading-level-' . ( $item->key ) . '">';
22 $html .= '<a href="#' . $item->tag_number . '">' . strip_tags( $item->title ) . '</a>';
23 if ( ! empty( $items ) ) {
24 $html .= $this->print( $item->items, $toc_hierarchy, ++$level );
25 } else {
26 $level = 1;
27 break;
28 }
29 $html .= '</li>';
30 }
31 $html .= '</ul>';
32 }
33 return $html;
34 }
35 }
36