PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.0
Forumax – AI Powered Advanced Community Forum Plugin v2.5.0
2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 All 30 releases
← All changes | includes/Elementor/Single_forum.php +43 -34 1.3.2 → 2.5.0 View file →
@@ -11,29 +11,33 @@
11 11 if (!defined('ABSPATH')) {
12 12 exit;
13 13 }
14 14
15 -class Single_forum extends Widget_Base
16 -{
15 +class Single_forum extends Widget_Base {
17 16
18 - public function get_name ()
19 - {
17 + public function get_name() {
18 + // return 'forumax_docy_single_forum';
19 + $theme = wp_get_theme();
20 + $theme_name = strtolower($theme->get('Name'));
21 + if ($theme_name == 'docy') {
22 + return 'docy_single_forum';
23 + }
20 24 return 'ama_single_forum';
21 25 }
22 26
23 27 public function get_title ()
24 28 {
25 - return __('BBPC Single Forum', 'bbp-core');
29 + return __('Single Forum (Forumax)', 'forumax');
26 30 }
27 31
28 32 public function get_icon ()
29 33 {
30 - return 'bbpc_icon_ama_single_forum';
34 + return 'bbpc_icon_ama_single_forum eicon-folder-o';
31 35 }
32 36
33 37 public function get_categories ()
34 38 {
35 - return [ 'bbp-core' ];
39 + return [ 'forumax' ];
36 40 }
37 41
38 42 public function get_style_depends ()
39 43 {
@@ -46,17 +50,17 @@
46 50 //-------- Select Style ---------- //
47 51 $this->start_controls_section(
48 52 'style_sec',
49 53 [
50 - 'label' => esc_html__('Preset Skins', 'bbp-core'),
54 + 'label' => esc_html__('Preset Skins', 'forumax'),
51 55 ]
52 56 );
53 57
54 58 $this->add_control(
55 59 'forum_id', [
56 - 'label' => esc_html__('Select Forum', 'bbp-core'),
60 + 'label' => esc_html__('Select Forum', 'forumax'),
57 61 'type' => Controls_Manager::SELECT,
58 - 'options' => bbp_core_get_posts('forum')
62 + 'options' => forumax_get_posts('forum')
59 63 ]
60 64 );
61 65
62 66 $this->add_control(
@@ -61,22 +65,24 @@
61 65
62 66 $this->add_control(
63 67 'style',
64 68 [
65 - 'label' => esc_html__('Forums Style', 'bbp-core'),
66 - 'type' => Controls_Manager::CHOOSE,
69 + 'label' => esc_html__('Forums Style', 'forumax'),
70 + 'type' => Controls_Manager::VISUAL_CHOICE,
67 71 'options' => [
68 72 '1' => [
69 - 'icon' => 'single_forum_1',
70 - 'title' => esc_html__('01 : Single Forum With Topics', 'bbp-core'),
73 + 'image' => FORUMAX_IMG . 'forums3.jpg',
74 + 'title' => esc_html__('01 : Single Forum With Topics', 'forumax'),
71 75 ],
72 76 '2' => [
73 - 'icon' => 'single_forum_2',
74 - 'title' => esc_html__('02 : Single Forum', 'bbp-core'),
77 + 'image' => FORUMAX_IMG . 'forums4.png',
78 + 'title' => esc_html__('02 : Single Forum', 'forumax'),
75 79 ],
76 80 ],
77 81 'default' => '1',
78 82 'toggle' => false,
83 + 'label_block' => true,
84 + 'separator' => 'before'
79 85 ]
80 86 );
81 87
82 88 $this->end_controls_section(); // End Style
@@ -83,17 +89,17 @@
83 89
84 90
85 91 $this->start_controls_section(
86 92 'forum_thumb', [
87 - 'label' => __('Thumbnail', 'bbp-core'),
93 + 'label' => __('Thumbnail', 'forumax'),
88 94 ]
89 95 );
90 96
91 97 $this->add_control(
92 98 'cover_image', [
93 - 'label' => __('Custom Cover Image', 'bbp-core'),
99 + 'label' => __('Custom Cover Image', 'forumax'),
94 100 'type' => Controls_Manager::MEDIA,
95 - 'description' => __('If this is not set, the featured image will be used by default', 'bbp-core')
101 + 'description' => __('If this is not set, the featured image will be used by default', 'forumax')
96 102 ]
97 103 );
98 104
99 105 $this->end_controls_section();
@@ -100,16 +106,16 @@
100 106
101 107 // --- Filter Options
102 108 $this->start_controls_section(
103 109 'filter_opt', [
104 - 'label' => __('Filter Options', 'bbp-core'),
110 + 'label' => __('Filter Options', 'forumax'),
105 111 ]
106 112 );
107 113
108 114 $this->add_control(
109 115 'ppp', [
110 - 'label' => esc_html__('Topics', 'bbp-core'),
111 - 'description' => esc_html__('Maximum number of topics.', 'bbp-core'),
116 + 'label' => esc_html__('Topics', 'forumax'),
117 + 'description' => esc_html__('Maximum number of topics.', 'forumax'),
112 118 'type' => Controls_Manager::NUMBER,
113 119 'default' => 3
114 120 ]
115 121 );
@@ -115,9 +121,9 @@
115 121 );
116 122
117 123 $this->add_control(
118 124 'order', [
119 - 'label' => esc_html__('Order', 'bbp-core'),
125 + 'label' => esc_html__('Order', 'forumax'),
120 126 'type' => Controls_Manager::SELECT,
121 127 'options' => [
122 128 'ASC' => 'ASC',
123 129 'DESC' => 'DESC'
@@ -128,11 +134,11 @@
128 134
129 135 $this->add_control(
130 136 'word_length',
131 137 [
132 - 'label' => __('Number of Words', 'bbp-core'),
138 + 'label' => __('Number of Words', 'forumax'),
133 139 'type' => Controls_Manager::NUMBER,
134 - 'description' => __('Number of words to show as forum content', 'bbp-core'),
140 + 'description' => __('Number of words to show as forum content', 'forumax'),
135 141 'default' => 12
136 142 ]
137 143 );
138 144
@@ -138,12 +144,12 @@
138 144
139 145 $this->add_control(
140 146 'read_more',
141 147 [
142 - 'label' => esc_html__('Read More Text', 'bbp-core'),
148 + 'label' => esc_html__('Read More Text', 'forumax'),
143 149 'type' => Controls_Manager::TEXT,
144 150 'label_block' => true,
145 - 'default' => __('View All', 'bbp-core'),
151 + 'default' => __('View All', 'forumax'),
146 152 ]
147 153 );
148 154
149 155 $this->end_controls_section();
@@ -150,9 +156,9 @@
150 156
151 157 /**============== Background shape Image =====================**/
152 158 $this->start_controls_section(
153 159 'single_forum_style', [
154 - 'label' => __('Single Forum Style', 'bbp-core'),
160 + 'label' => __('Single Forum Style', 'forumax'),
155 161 'tab' => Controls_Manager::TAB_STYLE,
156 162 ]
157 163 );
158 164
@@ -167,9 +173,9 @@
167 173 $this->add_group_control(
168 174 Group_Control_Typography::get_type(),
169 175 [
170 176 'name' => 'title_typography',
171 - 'label' => __('Title Typography', 'bbp-core'),
177 + 'label' => __('Title Typography', 'forumax'),
172 178 'separator' => 'before',
173 179 'selector' => '{{WRAPPER}} .forum-with-topics .topic-table .topic-contents .title h3, {{WRAPPER}} .forum-card .card-title h3',
174 180 ]
175 181 );
@@ -176,9 +182,9 @@
176 182
177 183 $this->add_control(
178 184 'title_color',
179 185 [
180 - 'label' => __('Title Color', 'bbp-core'),
186 + 'label' => __('Title Color', 'forumax'),
181 187 'type' => Controls_Manager::COLOR,
182 188 'separator' => 'after',
183 189 'selectors' => [
184 190 '{{WRAPPER}} .forum-with-topics .topic-table .topic-contents .title h3' => 'color: {{VALUE}}',
@@ -190,9 +196,9 @@
190 196 $this->add_group_control(
191 197 Group_Control_Typography::get_type(),
192 198 [
193 199 'name' => 'excerpt_typography',
194 - 'label' => __('Excerpt Typography', 'bbp-core'),
200 + 'label' => __('Excerpt Typography', 'forumax'),
195 201 'selector' => '{{WRAPPER}} .forum-with-topics .topic-table .topic-contents .title p, {{WRAPPER}} .forum-card .card-body',
196 202 ]
197 203 );
198 204
@@ -198,9 +204,9 @@
198 204
199 205 $this->add_control(
200 206 'excerpt_color',
201 207 [
202 - 'label' => __('Excerpt Color', 'bbp-core'),
208 + 'label' => __('Excerpt Color', 'forumax'),
203 209 'type' => Controls_Manager::COLOR,
204 210 'selectors' => [
205 211 '{{WRAPPER}} .forum-with-topics .topic-table .topic-contents .title p' => 'color: {{VALUE}}',
206 212 '{{WRAPPER}} .forum-card .card-body' => 'color: {{VALUE}}'
@@ -225,13 +231,16 @@
225 231 'post_parent' => $forum_id,
226 232 ));
227 233
228 234 if ($forum_id) {
229 - include "inc/single-forum/single-forum-{$settings['style']}.php";
235 + // Whitelist valid style values to prevent Local File Inclusion
236 + $allowed_styles = array( '1', '2' );
237 + $style = isset( $settings['style'] ) && in_array( $settings['style'], $allowed_styles, true ) ? $settings['style'] : '1';
238 + include __DIR__ . "/inc/single-forum/single-forum-{$style}.php";
230 239 } else { ?>
231 240 <div class="alert alert-warning" role="alert">
232 - <?php _e('Please select a forum.', 'bbp-core'); ?>
241 + <?php esc_html_e('Please select a forum.', 'forumax'); ?>
233 242 </div>
234 243 <?php
235 244 }
236 245 }
237 246 }