PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.2.6
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.2.6
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 / Admin / Customizer / Sections / Section.php

Section.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.2.6, at includes/Admin/Customizer/Sections/Section.php

81 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPDeveloper\BetterDocs\Admin\Customizer\Sections;
4
5 use WPDeveloper\BetterDocs\Core\Settings;
6 use WPDeveloper\BetterDocs\Utils\Enqueue;
7 use WPDeveloper\BetterDocs\Admin\Customizer\Sanitizer;
8
9 abstract class Section {
10 protected $customizer = null;
11 protected $defaults = null;
12 /**
13 * Customizer Panel ID
14 *
15 * @var string
16 */
17 protected $panel_id = 'betterdocs_customize_options';
18
19 /**
20 * Sanitizer
21 *
22 * @var Sanitizer
23 */
24 protected $sanitizer;
25
26 /**
27 * Settings
28 * @var Settings
29 */
30 protected $settings;
31 protected $priority = 100;
32
33 abstract public function get_id();
34 abstract public function get_title();
35
36 /**
37 * Enqueue Manager
38 *
39 * @var Enqueue
40 */
41 protected $assets;
42
43 public function __construct( Sanitizer $sanitizer, Settings $settings ) {
44 $this->sanitizer = $sanitizer;
45 $this->settings = $settings;
46 $this->assets = betterdocs()->assets;
47 }
48
49 public function set_customizer( $customizer, $defaults ) {
50 $this->customizer = $customizer;
51 $this->defaults = $defaults;
52 }
53
54 public function section() {
55 $this->customizer->add_section(
56 $this->get_id(),
57 [
58 'title' => $this->get_title(),
59 'priority' => $this->priority,
60 'panel' => $this->panel_id
61 ]
62 );
63 }
64
65 public function register( $customizer, $defaults ) {
66 $this->set_customizer( $customizer, $defaults );
67 $_methods = get_class_methods( $this );
68 if ( ! empty( $_methods ) ) {
69 $this->section();
70
71 foreach ( $_methods as $method ) {
72 if ( in_array( $method, [ 'get_id', 'section', 'get_title', 'register', 'set_customizer', '__construct' ] ) ) {
73 continue;
74 }
75
76 $this->{$method}();
77 }
78 }
79 }
80 }
81