PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 1.7.2
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v1.7.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 3.5.2 All 199 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 1.7.2, at includes/elementor/widgets/betterdocs-elementor-content.php

126 lines 4.5 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
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly
11 }
12
13 class BetterDocs_Elementor_Content extends Post_Content {
14
15 public function get_name() {
16 return 'betterdocs-content';
17 }
18
19 public function get_title() {
20 return __( 'Doc Content', 'betterdocs' );
21 }
22
23 public function get_icon() {
24 return 'betterdocs-icon-Content';
25 }
26
27 public function get_categories() {
28 return [ 'betterdocs-elements' ];
29 }
30
31 public function get_keywords() {
32 return [ 'betterdocs-elements', 'content', 'description', 'docs','betterdocs' ];
33 }
34
35 public function get_custom_help_url() {
36 return 'https://betterdocs.co/docs/single-doc-in-elementor';
37 }
38
39 protected function _register_controls()
40 {
41 $this->start_controls_section(
42 'section_style',
43 [
44 'label' => __( 'Style', 'betterdocs' ),
45 'tab' => Controls_Manager::TAB_STYLE,
46 ]
47 );
48
49 $this->add_control(
50 'print_btn',
51 [
52 'label' => __( 'Print Button', 'betterdocs' ),
53 'type' => Controls_Manager::SWITCHER,
54 'label_on' => __( 'Show', 'betterdocs' ),
55 'label_off' => __( 'Hide', 'betterdocs' ),
56 'return_value' => '1',
57 'default' => '1',
58 ]
59 );
60
61 $this->add_responsive_control(
62 'align',
63 [
64 'label' => __( 'Alignment', 'betterdocs' ),
65 'type' => Controls_Manager::CHOOSE,
66 'options' => [
67 'left' => [
68 'title' => __( 'Left', 'betterdocs' ),
69 'icon' => 'eicon-text-align-left',
70 ],
71 'center' => [
72 'title' => __( 'Center', 'betterdocs' ),
73 'icon' => 'eicon-text-align-center',
74 ],
75 'right' => [
76 'title' => __( 'Right', 'betterdocs' ),
77 'icon' => 'eicon-text-align-right',
78 ],
79 'justify' => [
80 'title' => __( 'Justified', 'betterdocs' ),
81 'icon' => 'eicon-text-align-justify',
82 ],
83 ],
84 'selectors' => [
85 '{{WRAPPER}}' => 'text-align: {{VALUE}};',
86 ],
87 ]
88 );
89
90 $this->end_controls_section();
91 }
92
93
94 protected function render() {
95 $settings = $this->get_settings_for_display();
96 $this->add_render_attribute('betterdocs-content', 'id', ['betterdocs-single-content']);
97 $this->add_render_attribute('betterdocs-content', 'class', ['betterdocs-entry-content']);
98 if($settings['print_btn'] == 1) {
99 echo '<div class="betterdocs-print-pdf">
100 <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>
101 </div>';
102 }
103 echo '<div '.$this->get_render_attribute_string('betterdocs-content').'>';
104
105 $toc_setting = get_transient('betterdocs_toc_setting');
106 $htags = ($toc_setting) ? implode(',', $toc_setting['htags']) : '';
107 $enable_toc = ($htags) ? 1 : '';
108 $content = apply_filters('the_content', get_the_content());
109 $shortcode = BetterDocs_Public::betterdocs_the_content(
110 $content,
111 $htags,
112 $enable_toc
113 );
114
115 echo apply_filters('betterdocs_elementor_docs_content', $shortcode);
116 echo '</div>';
117 }
118
119 public function show_in_panel() {
120 // By default don't show.
121 return true;
122 }
123
124
125 }
126