PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 2.0.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v2.0.5
4.9.2 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 All 200 releases
betterdocs / includes / elementor / widgets / betterdocs-elementor-content.php

betterdocs-elementor-content.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 2.0.5, at includes/elementor/widgets/betterdocs-elementor-content.php

174 lines 5.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use ElementorPro\Modules\ThemeBuilder\Widgets\Post_Content;
4 use Elementor\Controls_Manager;
5 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
6 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
7 use Elementor\Group_Control_Typography;
8 use Elementor\Core\Schemes;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly
12 }
13
14 class BetterDocs_Elementor_Content extends Post_Content {
15
16 public function get_name() {
17 return 'betterdocs-content';
18 }
19
20 public function get_title() {
21 return __( 'Doc Content', 'betterdocs' );
22 }
23
24 public function get_icon() {
25 return 'betterdocs-icon-Content';
26 }
27
28 public function get_categories() {
29 return [ 'betterdocs-elements-single' ];
30 }
31
32 public function get_keywords() {
33 return [ 'betterdocs-elements', 'content', 'description', 'docs', 'betterdocs' ];
34 }
35
36 public function get_custom_help_url() {
37 return 'https://betterdocs.co/docs/single-doc-in-elementor';
38 }
39
40 protected function _register_controls()
41 {
42 $this->start_controls_section(
43 'section_style',
44 [
45 'label' => __( 'Style', 'betterdocs' ),
46 'tab' => Controls_Manager::TAB_STYLE,
47 ]
48 );
49
50 $this->add_control(
51 'print_btn',
52 [
53 'label' => __( 'Print Button', 'betterdocs' ),
54 'type' => Controls_Manager::SWITCHER,
55 'label_on' => __( 'Show', 'betterdocs' ),
56 'label_off' => __( 'Hide', 'betterdocs' ),
57 'return_value' => '1',
58 'default' => '1',
59 ]
60 );
61
62 $this->add_responsive_control(
63 'align',
64 [
65 'label' => __( 'Alignment', 'betterdocs' ),
66 'type' => Controls_Manager::CHOOSE,
67 'options' => [
68 'left' => [
69 'title' => __( 'Left', 'betterdocs' ),
70 'icon' => 'eicon-text-align-left',
71 ],
72 'center' => [
73 'title' => __( 'Center', 'betterdocs' ),
74 'icon' => 'eicon-text-align-center',
75 ],
76 'right' => [
77 'title' => __( 'Right', 'betterdocs' ),
78 'icon' => 'eicon-text-align-right',
79 ],
80 'justify' => [
81 'title' => __( 'Justified', 'betterdocs' ),
82 'icon' => 'eicon-text-align-justify',
83 ],
84 ],
85 'selectors' => [
86 '{{WRAPPER}}' => 'text-align: {{VALUE}};',
87 ],
88 ]
89 );
90
91 $this->add_group_control(
92 Group_Control_Typography::get_type(),
93 [
94 'name' => 'betterdocs_content_typography',
95 'scheme' => Schemes\Typography::TYPOGRAPHY_1,
96 'selector' => '{{WRAPPER}} .betterdocs-content',
97 ]
98 );
99
100 $this->add_control(
101 'doc_content_color',
102 [
103 'label' => __( 'Doc Content Color', 'betterdocs' ),
104 'type' => Controls_Manager::COLOR,
105 'scheme' => [
106 'type' => Schemes\Color::get_type(),
107 'value' => Schemes\Color::COLOR_1,
108 ],
109 'selectors' => [
110 '{{WRAPPER}} .betterdocs-content' => 'color: {{VALUE}}',
111 ],
112 ]
113 );
114
115 $this->add_control(
116 'doc_content_title_color',
117 [
118 'label' => __( 'Content Title Color', 'plugin-domain' ),
119 'type' => Controls_Manager::COLOR,
120 'scheme' => [
121 'type' => Schemes\Color::get_type(),
122 'value' => Schemes\Color::COLOR_1,
123 ],
124 'selectors' => [
125 '{{WRAPPER}} .betterdocs-content .betterdocs-content-heading' => 'color: {{VALUE}}',
126 ],
127 ]
128 );
129
130 $this->add_group_control(
131 Group_Control_Typography::get_type(),
132 [
133 'name' => 'betterdocs_content_title_typography',
134 'scheme' => Schemes\Typography::TYPOGRAPHY_1,
135 'selector' => '{{WRAPPER}} .betterdocs-content .betterdocs-content-heading',
136 ]
137 );
138 $this->end_controls_section();
139 }
140
141
142 protected function render() {
143 $settings = $this->get_settings_for_display();
144 $this->add_render_attribute('betterdocs-content', 'id', ['betterdocs-single-content']);
145 $this->add_render_attribute('betterdocs-content', 'class', ['betterdocs-entry-content']);
146 if($settings['print_btn'] == 1) {
147 echo '<div class="betterdocs-print-pdf">
148 <span class="betterdocs-print-btn"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" width="20px"><path fill="#66798f" d="M14 16H66V24H14z"></path><path fill="#b0c1d4" d="M8,63.5c-3,0-5.5-2.5-5.5-5.5V26c0-3,2.5-5.5,5.5-5.5h64c3,0,5.5,2.5,5.5,5.5v32 c0,3-2.5,5.5-5.5,5.5H8z"></path><path fill="#66798f" d="M72,21c2.8,0,5,2.2,5,5v32c0,2.8-2.2,5-5,5H8c-2.8,0-5-2.2-5-5V26c0-2.8,2.2-5,5-5H72 M72,20H8 c-3.3,0-6,2.7-6,6v32c0,3.3,2.7,6,6,6h64c3.3,0,6-2.7,6-6V26C78,22.7,75.3,20,72,20L72,20z"></path><path fill="#fff" d="M16.5 2.5H63.5V23.5H16.5z"></path><path fill="#788b9c" d="M63,3v20H17V3H63 M64,2H16v22h48V2L64,2z"></path><path fill="#8bb7f0" d="M22,41.5c-3,0-5.5-2.5-5.5-5.5V20.5h47V36c0,3-2.5,5.5-5.5,5.5H22z"></path><path fill="#4e7ab5" d="M63,21v15c0,2.8-2.2,5-5,5H22c-2.8,0-5-2.2-5-5V21H63 M64,20H16v16c0,3.3,2.7,6,6,6h36 c3.3,0,6-2.7,6-6V20L64,20z"></path><path fill="#fff" d="M16.5 50.5H63.5V77.5H16.5z"></path><path fill="#788b9c" d="M63,51v26H17V51H63 M64,50H16v28h48V50L64,50z"></path><path fill="#d6e3ed" d="M17 52H63V56H17z"></path><path fill="#788b9c" d="M26 59H54V60H26zM26 67H54V68H26z"></path><g><path fill="#ffeea3" d="M70 28A2 2 0 1 0 70 32A2 2 0 1 0 70 28Z"></path></g><path fill="#66798f" d="M17,56v-4h46v4h2c1.7,0,3-1.3,3-3l0,0c0-1.7-1.3-3-3-3H15c-1.7,0-3,1.3-3,3l0,0c0,1.7,1.3,3,3,3H17z"></path></svg></span>
149 </div>';
150 }
151 echo '<div '.$this->get_render_attribute_string('betterdocs-content').'>';
152
153 $toc_setting = get_transient('betterdocs_toc_setting');
154 $htags = ($toc_setting) ? implode(',', $toc_setting['htags']) : '';
155 $enable_toc = ($htags) ? 1 : '';
156 $content = apply_filters('the_content', get_the_content());
157 $shortcode = BetterDocs_Public::betterdocs_the_content(
158 $content,
159 $htags,
160 $enable_toc
161 );
162
163 echo apply_filters('betterdocs_elementor_docs_content', $shortcode);
164 echo '</div>';
165 }
166
167 public function show_in_panel() {
168 // By default don't show.
169 return true;
170 }
171
172
173 }
174