PluginProbe ʕ •ᴥ•ʔ
Premium Addons for Elementor – Powerful Elementor Templates & Widgets / 4.11.32
Premium Addons for Elementor – Powerful Elementor Templates & Widgets v4.11.32
4.11.79 4.11.78 4.11.77 4.11.76 4.11.75 3.20.5 4.11.69 3.20.6 4.11.7 3.20.7 4.11.70 3.20.8 4.11.71 3.20.9 4.11.72 3.21.1 4.11.73 3.21.2 4.11.74 3.21.3 4.11.8 3.21.4 4.11.9 3.21.5 4.2.0 3.21.6 4.2.1 3.3.0 4.2.2 3.3.1 4.2.3 3.3.2 4.2.4 3.3.3 4.2.5 3.3.4 4.2.6 3.3.5 4.2.7 3.3.6 4.2.8 3.3.7 4.2.9 3.3.8 4.3.0 3.3.9 4.3.1 3.4.0 4.3.2 3.4.1 4.3.3 3.4.2 4.3.4 3.4.3 4.3.5 3.4.4 4.3.6 3.4.5 4.3.7 3.4.6 4.3.8 3.4.7 4.3.9 3.4.8 4.4.0 3.4.9 4.4.1 3.5.0 4.4.2 3.5.1 4.4.3 3.5.2 4.4.4 3.5.3 4.4.5 3.5.4 4.4.6 3.5.5 4.4.7 3.5.6 4.4.8 3.5.7 4.4.9 3.5.8 4.5.0 3.5.9 4.5.1 3.6.0 4.5.2 3.6.1 4.5.3 3.6.2 4.5.4 3.6.3 4.5.5 3.6.4 4.5.6 3.6.5 4.5.7 3.6.6 4.5.8 3.6.7 4.5.9 3.6.8 4.6.0 3.6.9 4.6.1 3.7.0 4.7.0 3.7.1 4.7.1 3.7.2 4.7.2 3.7.3 4.7.3 3.7.4 4.7.4 3.7.5 4.7.5 3.7.6 4.7.6 3.7.7 4.7.7 3.7.8 4.7.8 3.7.9 4.7.9 3.8.0 4.8.0 3.8.1 4.8.1 3.8.2 4.8.10 3.8.3 4.8.11 3.8.4 4.8.2 3.8.5 4.8.3 3.8.6 4.8.4 3.8.7 4.8.5 3.8.8 4.8.6 3.8.9 4.8.7 3.9.0 4.8.8 3.9.1 4.8.9 3.9.2 4.9.0 3.9.3 4.9.0-beta1 3.9.4 4.9.0-beta2 3.9.5 4.9.1 3.9.6 4.9.10 3.9.7 4.9.11 3.9.8 4.9.12 3.9.9 4.9.13 4.0.1 4.9.14 4.0.3 4.9.15 4.0.4 4.9.16 4.0.5 4.9.17 4.0.6 4.9.18 4.0.7 4.9.19 4.0.8 4.9.2 4.0.9 4.9.20 4.1.0 4.9.21 4.1.1 4.9.22 4.1.2 4.9.23 4.1.3 4.9.24 trunk 4.1.4 4.9.25 1.0 4.1.5 4.9.26 1.01 4.1.6 4.9.27 1.02 4.1.7 4.9.28 1.03 4.1.8 4.9.29 1.04 4.1.9 4.9.3 1.05 4.10.0 4.9.30 1.06 4.10.1 4.9.31 1.07 4.10.10 4.9.32 1.08 4.10.11 4.9.33 1.09 4.10.12 4.9.34 2.0 4.10.13 4.9.35 2.0.1 4.10.14 4.9.36 2.0.2 4.10.15 4.9.37 2.0.3 4.10.16 4.9.38 2.0.4 4.10.17 4.9.39 2.0.5 4.10.18 4.9.4 2.0.6 4.10.19 4.9.40 2.0.7 4.10.2 4.9.41 2.0.8 4.10.20 4.9.42 2.0.9 4.10.21 4.9.43 2.1.0 4.10.22 4.9.45 2.1.1 4.10.23 4.9.46 2.1.2 4.10.24 4.9.47 2.1.3 4.10.25 4.9.48 2.1.4 4.10.26 4.9.49 2.1.5 4.10.27 4.9.5 2.1.5-beta1 4.10.28 4.9.50 2.1.6 4.10.29 4.9.51 2.1.7 4.10.3 4.9.52 2.1.8 4.10.30 4.9.53 2.1.9 4.10.31 4.9.54 2.2.0 4.10.32 4.9.55 2.2.1 4.10.33 4.9.56 2.2.2 4.10.34 4.9.57 2.2.3 4.10.35 4.9.6 2.2.4 4.10.36 4.9.7 2.2.5 4.10.37 4.9.8 2.2.6 4.10.38 4.9.9 2.2.7 4.10.39 2.2.8 4.10.4 2.2.9 4.10.40 2.3.0 4.10.41 2.3.1 4.10.42 2.3.2 4.10.43 2.3.3 4.10.44 2.3.4 4.10.45 2.3.5 4.10.46 2.3.6 4.10.47 2.3.7 4.10.48 2.3.8 4.10.49 2.3.9 4.10.5 2.4.0 4.10.50 2.4.1 4.10.51 2.5.0 4.10.52 2.5.1 4.10.53 2.5.2 4.10.54 2.5.3 4.10.55 2.5.4 4.10.56 2.5.5 4.10.57 2.5.6 4.10.58 2.5.7 4.10.59 2.5.8 4.10.6 2.5.9 4.10.60 2.6.0 4.10.61 2.6.1 4.10.62 2.6.2 4.10.63 2.6.3 4.10.64 2.6.4 4.10.65 2.6.5 4.10.66 2.6.6 4.10.67 2.6.7 4.10.68 2.6.8 4.10.69 2.6.9 4.10.7 2.7.0 4.10.70 2.7.1 4.10.71 2.7.2 4.10.72 2.7.3 4.10.73 2.7.4 4.10.74 2.7.5 4.10.75 2.7.6 4.10.76 2.7.7 4.10.77 2.7.8 4.10.78 2.7.9 4.10.79 2.8.0 4.10.8 2.8.1 4.10.80 2.8.2 4.10.81 2.8.3 4.10.82 2.8.4 4.10.83 2.8.5 4.10.84 2.8.6 4.10.85 2.8.7 4.10.86 2.8.8 4.10.87 2.8.9 4.10.88 2.9.0 4.10.89 2.9.1 4.10.9 2.9.2 4.10.90 2.9.3 4.11.0 2.9.4 4.11.1 2.9.5 4.11.10 2.9.6 4.11.11 2.9.7 4.11.12 2.9.8 4.11.13 2.9.9 4.11.14 3.0.0 4.11.15 3.0.1 4.11.16 3.0.2 4.11.17 3.0.3 4.11.18 3.0.4 4.11.19 3.0.5 4.11.2 3.0.6 4.11.20 3.0.7 4.11.21 3.0.8 4.11.22 3.0.9 4.11.23 3.1.0 4.11.24 3.1.1 4.11.25 3.1.2 4.11.26 3.1.3 4.11.27 3.1.4 4.11.28 3.1.5 4.11.29 3.1.6 4.11.3 3.1.7 4.11.30 3.1.8 4.11.31 3.1.9 4.11.32 3.10.0 4.11.33 3.10.1 4.11.34 3.10.2 4.11.35 3.10.3 4.11.36 3.10.4 4.11.37 3.10.5 4.11.38 3.10.6 4.11.39 3.10.7 4.11.4 3.10.8 4.11.40 3.10.9 4.11.41 3.11.0 4.11.42 3.11.1 4.11.43 3.11.2 4.11.44 3.11.3 4.11.45 3.11.4 4.11.46 3.11.5 4.11.47 3.11.6 4.11.48 3.11.7 4.11.49 3.11.8 4.11.5 3.11.9 4.11.50 3.12.0 4.11.51 3.12.1 4.11.52 3.12.2 4.11.53 3.12.3 4.11.54 3.2.0 4.11.55 3.2.1 4.11.56 3.2.2 4.11.57 3.2.3 4.11.58 3.2.4 4.11.59 3.2.5 4.11.6 3.2.6 4.11.60 3.2.7 4.11.61 3.2.8 4.11.62 3.2.9 4.11.63 3.20.0 4.11.64 3.20.1 4.11.65 3.20.2 4.11.66 3.20.3 4.11.67 3.20.4 4.11.68
premium-addons-for-elementor / widgets / premium-tcloud.php
premium-addons-for-elementor / widgets Last commit date
dep 9 months ago premium-banner.php 9 months ago premium-blog.php 9 months ago premium-button.php 9 months ago premium-carousel.php 9 months ago premium-contactform.php 9 months ago premium-countdown.php 9 months ago premium-counter.php 9 months ago premium-dual-header.php 9 months ago premium-fancytext.php 9 months ago premium-grid.php 9 months ago premium-icon-list.php 9 months ago premium-image-button.php 9 months ago premium-image-scroll.php 9 months ago premium-image-separator.php 9 months ago premium-lottie.php 9 months ago premium-maps.php 9 months ago premium-media-wheel.php 9 months ago premium-mobile-menu.php 9 months ago premium-modalbox.php 9 months ago premium-nav-menu.php 9 months ago premium-notifications.php 9 months ago premium-person.php 9 months ago premium-pinterest-feed.php 9 months ago premium-post-ticker.php 9 months ago premium-pricing-table.php 9 months ago premium-progressbar.php 9 months ago premium-search-form.php 9 months ago premium-svg-drawer.php 9 months ago premium-tcloud.php 9 months ago premium-testimonials.php 9 months ago premium-textual-showcase.php 9 months ago premium-tiktok-feed.php 9 months ago premium-title.php 9 months ago premium-videobox.php 9 months ago premium-vscroll.php 9 months ago premium-weather.php 9 months ago premium-world-clock.php 9 months ago
premium-tcloud.php
1111 lines
1 <?php
2 /**
3 * Premium Tags Cloud.
4 */
5
6 namespace PremiumAddons\Widgets;
7
8 // Elementor Classes.
9 use Elementor\Modules\DynamicTags\Module as TagsModule;
10 use Elementor\Plugin;
11 use Elementor\Widget_Base;
12 use Elementor\Utils;
13 use Elementor\Control_Media;
14 use Elementor\Controls_Manager;
15 use Elementor\Icons_Manager;
16 use Elementor\Group_Control_Border;
17 use Elementor\Group_Control_Css_Filter;
18 use Elementor\Group_Control_Box_Shadow;
19 use Elementor\Group_Control_Text_Shadow;
20 use Elementor\Group_Control_Image_Size;
21 use Elementor\Group_Control_Typography;
22
23 // PremiumAddons Classes.
24 use PremiumAddons\Includes\Premium_Template_Tags as Blog_Helper;
25 use PremiumAddons\Admin\Includes\Admin_Helper;
26 use PremiumAddons\Includes\Helper_Functions;
27 use PremiumAddons\Includes\Controls\Premium_Tax_Filter;
28
29 if ( ! defined( 'ABSPATH' ) ) {
30 exit; // If this file is called directly, abort.
31 }
32
33 /**
34 * Class Premium_Tcloud
35 */
36 class Premium_Tcloud extends Widget_Base {
37
38 /**
39 * Retrieve Widget Name.
40 *
41 * @since 1.0.0
42 * @access public
43 */
44 public function get_name() {
45 return 'premium-tcloud';
46 }
47
48 /**
49 * Retrieve Widget Title.
50 *
51 * @since 1.0.0
52 * @access public
53 */
54 public function get_title() {
55 return __( 'Tags Cloud', 'premium-addons-for-elementor' );
56 }
57
58 /**
59 * Retrieve Widget Dependent CSS.
60 *
61 * @since 1.0.0
62 * @access public
63 *
64 * @return array CSS style handles.
65 */
66 public function get_style_depends() {
67 return array(
68 'pa-glass',
69 'premium-addons',
70 );
71 }
72
73 /**
74 * Retrieve Widget Dependent JS.
75 *
76 * @since 1.0.0
77 * @access public
78 *
79 * @return array JS script handles.
80 */
81 public function get_script_depends() {
82
83 return array(
84 'pa-glass',
85 'pa-awesomecloud',
86 'pa-tagcanvas',
87 'premium-addons',
88 );
89 }
90
91 /**
92 * Retrieve Widget Icon.
93 *
94 * @since 1.0.0
95 * @access public
96 *
97 * @return string widget icon.
98 */
99 public function get_icon() {
100 return 'pa-tags-cloud';
101 }
102
103 /**
104 * Retrieve Widget Categories.
105 *
106 * @since 1.5.1
107 * @access public
108 *
109 * @return array Widget categories.
110 */
111 public function get_categories() {
112 return array( 'premium-elements' );
113 }
114
115 /**
116 * Retrieve Widget Keywords.
117 *
118 * @since 1.0.0
119 * @access public
120 *
121 * @return string Widget keywords.
122 */
123 public function get_keywords() {
124 return array( 'pa', 'premium', 'premium tags cloud', 'tag', 'cat', 'product', 'woo', 'query', 'cpt' );
125 }
126
127 /**
128 * Retrieve Widget Support URL.
129 *
130 * @access public
131 *
132 * @return string support URL.
133 */
134 public function get_custom_help_url() {
135 return 'https://premiumaddons.com/support/';
136 }
137
138 public function has_widget_inner_wrapper(): bool {
139 return ! Helper_Functions::check_elementor_experiment( 'e_optimized_markup' );
140 }
141
142 /**
143 * Register Image Controls controls.
144 *
145 * @since 1.0.0
146 * @access protected
147 */
148 protected function register_controls() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
149
150 $papro_activated = apply_filters( 'papro_activated', false );
151
152 $this->start_controls_section(
153 'display_options_section',
154 array(
155 'label' => __( 'Display Options', 'premium-addons-for-elementor' ),
156 )
157 );
158
159 $options = apply_filters(
160 'pa_tcloud_layouts',
161 array(
162 'layouts' => array(
163 'default' => __( 'Default', 'premium-addons-for-elementor' ),
164 'ribbon' => __( 'Label', 'premium-addons-for-elementor' ),
165 'shape' => __( 'Shape (Pro)', 'premium-addons-for-elementor' ),
166 'sphere' => __( 'Sphere (Pro)', 'premium-addons-for-elementor' ),
167 ),
168 'order_condition' => array( 'shape', 'sphere' ),
169 'source_condition' => array(
170 'post_type_filter' => 'post',
171 ),
172 )
173 );
174
175 $this->add_control(
176 'words_order',
177 array(
178 'label' => __( 'Words Order', 'premium-addons-for-elementor' ),
179 'type' => Controls_Manager::SELECT,
180 'options' => $options['layouts'],
181 'default' => 'default',
182 'frontend_available' => true,
183 )
184 );
185
186 $this->add_responsive_control(
187 'circle_position',
188 array(
189 'label' => __( 'Circle Position', 'premium-addons-for-elementor' ),
190 'type' => Controls_Manager::SLIDER,
191 'size_units' => array( 'px', 'em', '%', 'custom' ),
192 'selectors' => array(
193 '{{WRAPPER}} .premium-tcloud-term::after' => 'left: {{SIZE}}{{UNIT}}',
194 ),
195 'frontend_available' => true,
196 'condition' => array(
197 'words_order' => 'ribbon',
198 ),
199 )
200 );
201
202 $this->add_control(
203 'words_remove',
204 array(
205 'label' => __( 'Words to Remove', 'premium-addons-for-elementor' ),
206 'type' => Controls_Manager::TEXT,
207 'description' => __( 'Add a list of words separated by comma to be removed. For example, word1,word2, etc.', 'premium-addons-for-elementor' ),
208 'label_block' => true,
209 'condition' => array(
210 'words_order!' => $options['order_condition'],
211 ),
212 )
213 );
214
215 $this->add_control(
216 'words_number',
217 array(
218 'label' => __( 'Max Number of Words', 'premium-addons-for-elementor' ),
219 'description' => __( 'Use this option to strip term to specific number of words.', 'premium-addons-for-elementor' ),
220 'type' => Controls_Manager::NUMBER,
221 'condition' => array(
222 'words_order!' => $options['order_condition'],
223 ),
224 )
225 );
226
227 $this->add_control(
228 'show_posts_number',
229 array(
230 'label' => __( 'Show Posts Number', 'premium-addons-for-elementor' ),
231 'type' => Controls_Manager::SWITCHER,
232 'default' => 'yes',
233 'condition' => array(
234 'words_order' => array( 'default', 'ribbon' ),
235 'get_from_current!' => 'yes',
236 ),
237 )
238 );
239
240 $this->add_control(
241 'suffix_word',
242 array(
243 'label' => __( 'Replace With', 'premium-addons-for-elementor' ),
244 'type' => Controls_Manager::TEXT,
245 'description' => __( 'Use this option if the number of words is larger than a specific number.', 'premium-addons-for-elementor' ),
246 'label_block' => true,
247 'condition' => array(
248 'words_order!' => $options['order_condition'],
249 'words_number!' => '',
250 ),
251 )
252 );
253
254 if ( ! $papro_activated ) {
255 $get_pro = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'tcloud-widget', 'wp-editor', 'get-pro' );
256
257 $this->add_control(
258 'tcloud_notice',
259 array(
260 'type' => Controls_Manager::RAW_HTML,
261 'raw' => __( 'This option is available in Premium Addons Pro.', 'premium-addons-for-elementor' ) . '<a href="' . esc_url( $get_pro ) . '" target="_blank">' . __( 'Upgrade now!', 'premium-addons-for-elementor' ) . '</a>',
262 'content_classes' => 'papro-upgrade-notice',
263 'condition' => array(
264 'words_order' => $options['order_condition'],
265 ),
266 )
267 );
268
269 } else {
270 do_action( 'pa_tcloud_shape_controls', $this );
271 }
272
273 $this->add_control(
274 'new_tab',
275 array(
276 'label' => __( 'Open Links in New Tab', 'premium-addons-for-elementor' ),
277 'type' => Controls_Manager::SWITCHER,
278 'default' => 'yes',
279 'frontend_available' => true,
280 'condition' => array(
281 'words_order!' => $options['order_condition'],
282 ),
283 )
284 );
285
286 $this->add_control(
287 'colors_select',
288 array(
289 'label' => __( 'Words Colors', 'premium-addons-for-elementor' ),
290 'type' => Controls_Manager::SELECT,
291 'options' => array(
292 'random-light' => __( 'Random Light', 'premium-addons-for-elementor' ),
293 'random-dark' => __( 'Random Dark', 'premium-addons-for-elementor' ),
294 'custom' => __( 'Custom', 'premium-addons-for-elementor' ),
295 ),
296 'default' => 'random-light',
297 'frontend_available' => true,
298 'condition' => array(
299 'words_order!' => $options['order_condition'],
300 ),
301 )
302 );
303
304 $this->add_control(
305 'words_colors',
306 array(
307 'label' => __( 'Colors to Select From', 'premium-addons-for-elementor' ),
308 'type' => Controls_Manager::TEXTAREA,
309 'description' => __( 'Add the colors you want to select from. Each color in a separate line. You can use this ', 'premium-addons-for-elementor' ) . '<a href="https://www.w3schools.com/colors/colors_names.asp" target="_blank">link</a>' . __( ' to get colors.', 'premium-addons-for-elementor' ),
310
311 'label_block' => true,
312 'frontend_available' => true,
313 'condition' => array(
314 'words_order!' => $options['order_condition'],
315 'colors_select' => 'custom',
316 ),
317 )
318 );
319
320 if ( $papro_activated ) {
321 do_action( 'pa_tcloud_sphere_controls', $this );
322 }
323
324 $this->add_responsive_control(
325 'direction',
326 array(
327 'label' => __( 'Direction', 'premium-addons-for-elementor' ),
328 'type' => Controls_Manager::CHOOSE,
329 'options' => array(
330 'row' => array(
331 'title' => __( 'Row', 'premium-addons-for-elementor' ),
332 'icon' => 'eicon-arrow-right',
333 ),
334 'column' => array(
335 'title' => __( 'Column', 'premium-addons-for-elementor' ),
336 'icon' => 'eicon-arrow-down',
337 ),
338 ),
339 'default' => 'row',
340 'toggle' => false,
341 'prefix_class' => 'premium-tcloud__',
342 'selectors' => array(
343 '{{WRAPPER}} .premium-tcloud-canvas-container' => 'flex-direction: {{VALUE}};',
344 ),
345 'condition' => array(
346 'words_order!' => $options['order_condition'],
347 ),
348 )
349 );
350
351 $this->add_responsive_control(
352 'align',
353 array(
354 'label' => __( 'Alignment', 'premium-addons-for-elementor' ),
355 'type' => Controls_Manager::CHOOSE,
356 'options' => array(
357 'flex-start' => array(
358 'title' => __( 'Start', 'premium-addons-for-elementor' ),
359 'icon' => is_rtl() ? 'eicon-text-align-right' : 'eicon-text-align-left',
360 ),
361 'center' => array(
362 'title' => __( 'Center', 'premium-addons-for-elementor' ),
363 'icon' => 'eicon-text-align-justify',
364 ),
365 'flex-end' => array(
366 'title' => __( 'End', 'premium-addons-for-elementor' ),
367 'icon' => is_rtl() ? 'eicon-text-align-left' : 'eicon-text-align-right',
368 ),
369 ),
370 'default' => 'flex-start',
371 'toggle' => false,
372 'selectors' => array(
373 '{{WRAPPER}}.premium-tcloud__row .premium-tcloud-canvas-container' => 'justify-content: {{VALUE}};',
374 '{{WRAPPER}}.premium-tcloud__column .premium-tcloud-canvas-container' => 'align-items: {{VALUE}};',
375 ),
376 'condition' => array(
377 'words_order!' => $options['order_condition'],
378 ),
379 )
380 );
381
382 $this->end_controls_section();
383
384 $this->start_controls_section(
385 'query_section',
386 array(
387 'label' => __( 'Query', 'premium-addons-for-elementor' ),
388 'condition' => array(
389 'words_order!' => $options['order_condition'],
390 ),
391 )
392 );
393
394 $post_types = Blog_Helper::get_posts_types();
395
396 foreach ( $post_types as $id => $label ) {
397
398 if ( 'post' !== $id ) {
399 $post_types[ $id ] .= apply_filters( 'pa_pro_label', __( ' (Pro)', 'premium-addons-for-elementor' ) );
400 }
401 }
402
403 $this->add_control(
404 'post_type_filter',
405 array(
406 'label' => __( 'Post Type', 'premium-addons-for-elementor' ),
407 'type' => Controls_Manager::SELECT,
408 'label_block' => true,
409 'options' => $post_types,
410 'default' => 'post',
411 )
412 );
413
414 $this->add_control(
415 'filter_tabs_type',
416 array(
417 'label' => __( 'Source', 'premium-addons-for-elementor' ),
418 'type' => Premium_Tax_Filter::TYPE,
419 'default' => 'category',
420 'condition' => $options['source_condition'],
421 )
422 );
423
424 $this->add_control(
425 'no_tax_notice',
426 array(
427 'raw' => __( 'This post type has no taxonomies to show.', 'premium-addons-for-elementor' ),
428 'type' => Controls_Manager::RAW_HTML,
429 'classes' => 'premium-live-temp-title control-hidden',
430 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
431 'condition' => $options['source_condition'],
432 )
433 );
434
435 $this->add_control(
436 'get_from_current',
437 array(
438 'label' => __( 'Get from Current Page', 'premium-addons-for-elementor' ),
439 'type' => Controls_Manager::SWITCHER,
440 'description' => __( 'Use this to get the terms of the current page. Useful when building a Single Post/Product template.', 'premium-addons-for-elementor' ),
441 'condition' => $options['source_condition'],
442 )
443 );
444
445 $this->add_control(
446 'show_parents_only',
447 array(
448 'label' => __( 'Show Parent Terms Only', 'premium-addons-for-elementor' ),
449 'type' => Controls_Manager::SWITCHER,
450 'condition' => $options['source_condition'],
451 )
452 );
453
454 $this->add_control(
455 'terms_number',
456 array(
457 'label' => __( 'Number of Terms to Show', 'premium-addons-for-elementor' ),
458 'type' => Controls_Manager::NUMBER,
459 'condition' => $options['source_condition'],
460 )
461 );
462
463 $this->add_control(
464 'order_by',
465 array(
466 'label' => __( 'Order By', 'premium-addons-for-elementor' ),
467 'type' => Controls_Manager::SELECT,
468 'separator' => 'before',
469 'label_block' => true,
470 'options' => array(
471 'none' => __( 'None', 'premium-addons-for-elementor' ),
472 'name' => __( 'Name Alphabetically', 'premium-addons-for-elementor' ),
473 'slug' => __( 'Slug Alphabetically', 'premium-addons-for-elementor' ),
474 'description' => __( 'Description Alphabetically', 'premium-addons-for-elementor' ),
475 'ID' => __( 'Term ID', 'premium-addons-for-elementor' ),
476 'count' => __( 'Posts Number', 'premium-addons-for-elementor' ),
477 ),
478 'default' => 'none',
479 'condition' => $options['source_condition'],
480 )
481 );
482
483 $this->add_control(
484 'order',
485 array(
486 'label' => __( 'Order', 'premium-addons-for-elementor' ),
487 'type' => Controls_Manager::SELECT,
488 'label_block' => true,
489 'options' => array(
490 'ASC' => __( 'Ascending', 'premium-addons-for-elementor' ),
491 'DESC' => __( 'Descending', 'premium-addons-for-elementor' ),
492 ),
493 'default' => 'ASC',
494 'condition' => $options['source_condition'],
495 )
496 );
497
498 $this->end_controls_section();
499
500 $this->start_controls_section(
501 'section_pa_docs',
502 array(
503 'label' => __( 'Help & Docs', 'premium-addons-for-elementor' ),
504 )
505 );
506
507 $docs = array(
508 'https://premiumaddons.com/docs/elementor-tags-cloud-widget/' => __( 'Getting started »', 'premium-addons-for-elementor' ),
509 );
510
511 $doc_index = 1;
512 foreach ( $docs as $url => $title ) {
513
514 $doc_url = Helper_Functions::get_campaign_link( $url, 'tcloud-widget', 'wp-editor', 'get-support' );
515
516 $this->add_control(
517 'doc_' . $doc_index,
518 array(
519 'type' => Controls_Manager::RAW_HTML,
520 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc_url, $title ),
521 'content_classes' => 'editor-pa-doc',
522 )
523 );
524
525 ++$doc_index;
526
527 }
528
529 $this->end_controls_section();
530
531 $this->start_controls_section(
532 'term_style',
533 array(
534 'label' => __( 'Term', 'premium-addons-for-elementor' ),
535 'tab' => Controls_Manager::TAB_STYLE,
536 'condition' => array(
537 'words_order' => array( 'default', 'ribbon' ),
538 ),
539 )
540 );
541
542 $this->add_group_control(
543 Group_Control_Typography::get_type(),
544 array(
545 'name' => 'term_typo',
546 'selector' => '{{WRAPPER}} .premium-tcloud-term-link',
547 )
548 );
549
550 $this->add_control(
551 'fsize_scale',
552 array(
553 'label' => __( 'Font Size Scale (px)', 'premium-addons-for-elementor' ),
554 'type' => Controls_Manager::SLIDER,
555 'description' => __( 'This option is used to increase the font size of each term based on the number of posts in it.', 'premium-addons-for-elementor' ),
556 'range' => array(
557 'px' => array(
558 'min' => 0,
559 'max' => 5,
560 'step' => 0.1,
561 ),
562 ),
563 'default' => array(
564 'size' => 0,
565 ),
566 'frontend_available' => true,
567 )
568 );
569
570 $this->start_controls_tabs( 'term_style_tabs' );
571
572 $this->start_controls_tab(
573 'term_style_normal',
574 array(
575 'label' => __( 'Normal', 'premium-addons-for-elementor' ),
576 )
577 );
578
579 $this->add_control(
580 'term_color',
581 array(
582 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
583 'type' => Controls_Manager::COLOR,
584 'selectors' => array(
585 '{{WRAPPER}} .premium-tcloud-term-link' => 'color: {{VALUE}}',
586 ),
587 )
588 );
589
590 $this->add_control(
591 'circle_color',
592 array(
593 'label' => __( 'Circle Color', 'premium-addons-for-elementor' ),
594 'type' => Controls_Manager::COLOR,
595 'selectors' => array(
596 '{{WRAPPER}} .premium-tcloud-term::after' => 'background-color: {{VALUE}}',
597 ),
598 'condition' => array(
599 'words_order' => 'ribbon',
600 ),
601 )
602 );
603
604 $this->add_control(
605 'term_background_color',
606 array(
607 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
608 'type' => Controls_Manager::COLOR,
609 'selectors' => array(
610 '{{WRAPPER}} .premium-tcloud-term' => 'background-color: {{VALUE}} !important',
611 '{{WRAPPER}} .premium-tcloud-ribbon .premium-tcloud-term::before' => 'border-right-color: {{VALUE}} !important',
612 ),
613 )
614 );
615
616 $this->add_control(
617 'term_lq_effect',
618 array(
619 'label' => __( 'Liquid Glass Effect', 'premium-addons-for-elementor' ),
620 'type' => Controls_Manager::SELECT,
621 'description' => sprintf(
622 /* translators: 1: `<a>` opening tag, 2: `</a>` closing tag. */
623 esc_html__( 'Important: Make sure this element has a semi-transparent background color to see the effect. See all presets from %1$shere%2$s.', 'premium-addons-for-elementor' ),
624 '<a href="https://premiumaddons.com/liquid-glass/" target="_blank">',
625 '</a>'
626 ),
627 'options' => array(
628 'none' => __( 'None', 'premium-addons-for-elementor' ),
629 'glass1' => __( 'Preset 01', 'premium-addons-for-elementor' ),
630 'glass2' => __( 'Preset 02', 'premium-addons-for-elementor' ),
631 'glass3' => apply_filters( 'pa_pro_label', __( 'Preset 03 (Pro)', 'premium-addons-for-elementor' ) ),
632 'glass4' => apply_filters( 'pa_pro_label', __( 'Preset 04 (Pro)', 'premium-addons-for-elementor' ) ),
633 'glass5' => apply_filters( 'pa_pro_label', __( 'Preset 05 (Pro)', 'premium-addons-for-elementor' ) ),
634 'glass6' => apply_filters( 'pa_pro_label', __( 'Preset 06 (Pro)', 'premium-addons-for-elementor' ) ),
635 ),
636 'default' => 'none',
637 'label_block' => true,
638 'render_type' => 'template',
639 )
640 );
641
642 $this->add_group_control(
643 Group_Control_Border::get_type(),
644 array(
645 'name' => 'term_border',
646 'selector' => '{{WRAPPER}} .premium-tcloud-term',
647 'condition' => array(
648 'words_order' => 'default',
649 ),
650 )
651 );
652
653 $this->add_control(
654 'term_border_radius',
655 array(
656 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
657 'type' => Controls_Manager::SLIDER,
658 'size_units' => array( 'px', 'em', '%' ),
659 'selectors' => array(
660 '{{WRAPPER}} .premium-tcloud-term' => 'border-radius: {{SIZE}}{{UNIT}};',
661 ),
662 'condition' => array(
663 'words_order' => 'default',
664 ),
665 )
666 );
667
668 $this->add_group_control(
669 Group_Control_Text_Shadow::get_type(),
670 array(
671 'name' => 'term_text_shadow',
672 'selector' => '{{WRAPPER}} .premium-tcloud-term',
673 )
674 );
675
676 $this->add_group_control(
677 Group_Control_Box_Shadow::get_type(),
678 array(
679 'name' => 'term_shadow',
680 'selector' => '{{WRAPPER}} .premium-tcloud-term',
681 )
682 );
683
684 $this->add_responsive_control(
685 'term_spacing',
686 array(
687 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
688 'type' => Controls_Manager::DIMENSIONS,
689 'size_units' => array( 'px', 'em', '%' ),
690 'selectors' => array(
691 '{{WRAPPER}} .premium-tcloud-term-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
692 ),
693 )
694 );
695
696 $this->add_responsive_control(
697 'term_padding',
698 array(
699 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
700 'type' => Controls_Manager::DIMENSIONS,
701 'size_units' => array( 'px', 'em', '%' ),
702 'selectors' => array(
703 '{{WRAPPER}} .premium-tcloud-term' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
704 ),
705 )
706 );
707
708 $this->end_controls_tab();
709
710 $this->start_controls_tab(
711 'term_style_hover',
712 array(
713 'label' => __( 'Hover', 'premium-addons-for-elementor' ),
714 )
715 );
716
717 $this->add_control(
718 'term_hover_color',
719 array(
720 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
721 'type' => Controls_Manager::COLOR,
722 'selectors' => array(
723 '{{WRAPPER}} .premium-tcloud-term:hover .premium-tcloud-term-link' => 'color: {{VALUE}}',
724 ),
725 )
726 );
727
728 $this->add_control(
729 'circle_hover_color',
730 array(
731 'label' => __( 'Circle Color', 'premium-addons-for-elementor' ),
732 'type' => Controls_Manager::COLOR,
733 'selectors' => array(
734 '{{WRAPPER}} .premium-tcloud-term:hover::after' => 'background-color: {{VALUE}}',
735 ),
736 'condition' => array(
737 'words_order' => 'ribbon',
738 ),
739 )
740 );
741
742 $this->add_control(
743 'term_hover_background_color',
744 array(
745 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
746 'type' => Controls_Manager::COLOR,
747 'selectors' => array(
748 '{{WRAPPER}} .premium-tcloud-term:hover' => 'background-color: {{VALUE}} !important',
749 '{{WRAPPER}} .premium-tcloud-ribbon .premium-tcloud-term:hover::before' => 'border-right-color: {{VALUE}} !important',
750 ),
751 )
752 );
753
754 $this->add_group_control(
755 Group_Control_Border::get_type(),
756 array(
757 'name' => 'term_hover_border',
758 'selector' => '{{WRAPPER}} .premium-tcloud-term:hover',
759 'condition' => array(
760 'words_order' => 'default',
761 ),
762 )
763 );
764
765 $this->add_control(
766 'term_hover_border_radius',
767 array(
768 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
769 'type' => Controls_Manager::SLIDER,
770 'size_units' => array( 'px', 'em', '%' ),
771 'selectors' => array(
772 '{{WRAPPER}} .premium-tcloud-term:hover' => 'border-radius: {{SIZE}}{{UNIT}};',
773 ),
774 'condition' => array(
775 'words_order' => 'default',
776 ),
777 )
778 );
779
780 $this->add_group_control(
781 Group_Control_Text_Shadow::get_type(),
782 array(
783 'name' => 'term_hover_text_shadow',
784 'selector' => '{{WRAPPER}} .premium-tcloud-term:hover',
785 )
786 );
787
788 $this->add_group_control(
789 Group_Control_Box_Shadow::get_type(),
790 array(
791 'name' => 'term_hover_shadow',
792 'selector' => '{{WRAPPER}} .premium-tcloud-term:hover',
793 )
794 );
795
796 $this->add_responsive_control(
797 'term_hover_spacing',
798 array(
799 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
800 'type' => Controls_Manager::DIMENSIONS,
801 'size_units' => array( 'px', 'em', '%' ),
802 'selectors' => array(
803 '{{WRAPPER}} .premium-tcloud-term-wrap:hover' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
804 ),
805 )
806 );
807
808 $this->add_responsive_control(
809 'term_hover_padding',
810 array(
811 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
812 'type' => Controls_Manager::DIMENSIONS,
813 'size_units' => array( 'px', 'em', '%' ),
814 'selectors' => array(
815 '{{WRAPPER}} .premium-tcloud-term:hover' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
816 ),
817 )
818 );
819
820 $this->end_controls_tab();
821
822 $this->end_controls_tabs();
823
824 $this->end_controls_section();
825 }
826
827 /**
828 * Render Image Separator widget output on the frontend.
829 *
830 * Written in PHP and used to generate the final HTML.
831 *
832 * @since 1.0.0
833 * @access protected
834 */
835 protected function render() {
836
837 $settings = $this->get_settings_for_display();
838
839 $papro_activated = apply_filters( 'papro_activated', false );
840
841 if ( ! $papro_activated && ( 'shape' === $settings['words_order'] || 'post' !== $settings['post_type_filter'] ) ) {
842 return;
843 }
844
845 $tax = $settings['filter_tabs_type'];
846
847 $id = $this->get_id();
848
849 $terms = $this->get_taxs( $tax );
850
851 $words_array = array();
852
853 foreach ( $terms as $index => $term ) {
854
855 $term_id = $term->term_id;
856
857 $name = $term->name;
858
859 $full_name = $name;
860
861 if ( ! empty( $settings['words_remove'] ) ) {
862
863 $words_to_remove = explode( ',', $settings['words_remove'] );
864
865 $cleaned_string = str_ireplace( $words_to_remove, '', $name );
866
867 $name = $cleaned_string;
868
869 }
870
871 $should_suffix = false;
872 if ( ! empty( $settings['words_number'] ) ) {
873
874 $name_array = explode( ' ', $term->name );
875
876 if ( count( $name_array ) > 1 && count( $name_array ) > $settings['words_number'] ) {
877
878 $should_suffix = true;
879
880 $new_name = '';
881
882 for ( $i = 0; $i < $settings['words_number']; $i++ ) {
883
884 if ( $i < $settings['words_number'] - 2 ) {
885 $new_name .= $name_array[ $i ] . ' ';
886 } else {
887 $new_name .= $name_array[ $i ];
888 }
889 }
890
891 $name = $new_name;
892
893 }
894 }
895
896 if ( ! empty( $settings['suffix_word'] ) && $should_suffix ) {
897 $name .= $settings['suffix_word'];
898 }
899
900 if ( in_array( $settings['words_order'], array( 'shape', 'sphere' ), true ) && '' !== $settings['text_transform'] ) {
901
902 switch ( $settings['text_transform'] ) {
903
904 case 'uppercase':
905 $name = strtoupper( $name );
906 break;
907
908 case 'lowercase':
909 $name = strtolower( $name );
910 break;
911
912 case 'capitalize':
913 $name = ucwords( $name );
914 break;
915
916 }
917 }
918
919 if ( 'yes' === $settings['get_from_current'] ) {
920 $term->count = 1;
921 }
922
923 $child_terms_count = 'yes' === $settings['show_parents_only'] ? $this->get_child_terms_count( $tax, $term_id ) : 0;
924
925 array_push(
926 $words_array,
927 array(
928 $name,
929 $term->count + $child_terms_count,
930 get_term_link( $term_id, $tax ),
931 $full_name,
932 $term->count + $child_terms_count,
933 )
934 );
935
936 }
937
938 $chart_settings = array(
939 'wordsArr' => $words_array,
940 );
941
942 $this->add_render_attribute(
943 'container',
944 array(
945 'class' => array(
946 'premium-tcloud-container',
947 'premium-tcloud-' . $settings['words_order'],
948 'premium-tcloud-hidden',
949 ),
950 'data-chart' => wp_json_encode( $chart_settings ),
951 )
952 );
953
954 if ( in_array( $settings['words_order'], array( 'shape', 'sphere' ), true ) ) {
955 $this->add_render_attribute(
956 'canvas',
957 array(
958 'id' => 'premium-tcloud-canvas-' . $id,
959 'class' => 'premium-tcloud-canvas',
960 'width' => 1170,
961 'height' => 760,
962 )
963 );
964 }
965
966 $target = 'yes' === $settings['new_tab'] ? '_blank' : '_top';
967
968 if ( 'shape' !== $settings['words_order'] ) {
969 $this->add_render_attribute( 'term', 'class', 'premium-tcloud-term' );
970
971 if ( 'none' !== $settings['term_lq_effect'] ) {
972 $this->add_render_attribute( 'term', 'class', 'premium-con-lq__' . $settings['term_lq_effect'] );
973 }
974 }
975
976 ?>
977
978 <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'container' ) ); ?>>
979
980 <div class="premium-tcloud-canvas-container">
981
982 <?php if ( in_array( $settings['words_order'], array( 'shape', 'sphere' ), true ) ) : ?>
983 <span class="font-loader"></span>
984 <canvas <?php echo wp_kses_post( $this->get_render_attribute_string( 'canvas' ) ); ?>>
985 </canvas>
986 <?php endif; ?>
987
988
989 <?php if ( 'shape' !== $settings['words_order'] ) : ?>
990
991 <?php if ( 'sphere' === $settings['words_order'] ) : ?>
992 <div id="<?php echo esc_attr( 'premium-tcloud-terms-container-' . $id ); ?>" class="premium-tcloud-terms-container">
993 <?php endif; ?>
994
995 <?php foreach ( $words_array as $index => $word ) : ?>
996
997 <?php if ( '' !== $word[0] ) : ?>
998
999 <div class="premium-tcloud-term-wrap">
1000
1001 <span <?php echo wp_kses_post( $this->get_render_attribute_string( 'term' ) ); ?>>
1002 <a class="premium-tcloud-term-link" data-weight="<?php echo esc_attr( $word[1] ); ?>" href="<?php echo esc_url( $word[2] ); ?>" title="<?php echo esc_attr( $word[3] ); ?>" target="<?php echo esc_attr( $target ); ?>"><?php echo wp_kses_post( $word[0] ); ?><?php if ( in_array( $settings['words_order'], array( 'default', 'ribbon' ), true ) && 'yes' === $settings['show_posts_number'] ) : ?>
1003 <span class="premium-tcloud-number">(<?php echo wp_kses_post( $word[4] ); ?>)</span><?php endif; ?></a>
1004 </span>
1005 </div>
1006 <?php endif; ?>
1007 <?php endforeach; ?>
1008
1009 <?php if ( 'sphere' === $settings['words_order'] ) : ?>
1010 </div>
1011 <?php endif; ?>
1012 <?php endif; ?>
1013
1014 </div>
1015
1016 </div>
1017
1018 <?php
1019 }
1020
1021 /**
1022 * Get Taxs
1023 *
1024 * Used to get terms.
1025 *
1026 * @access private
1027 *
1028 * @return object $taxs taxonomies.
1029 */
1030 private function get_taxs( $term ) {
1031
1032 $settings = $this->get_settings_for_display();
1033
1034 $args = array(
1035 'number' => $settings['terms_number'],
1036 'orderby' => $settings['order_by'],
1037 'order' => $settings['order'],
1038 );
1039
1040 if ( 'yes' === $settings['show_parents_only'] ) {
1041 $args = array_merge(
1042 $args,
1043 array(
1044 'parent' => 0,
1045 )
1046 );
1047 }
1048
1049 // Get the terms based on filter source.
1050 if ( 'yes' === $settings['get_from_current'] ) {
1051 $taxs = wp_get_post_terms( get_the_ID(), $term, $args );
1052 } else {
1053
1054 $args = array_merge(
1055 $args,
1056 array(
1057 'taxonomy' => $term,
1058 )
1059 );
1060
1061 $taxs = get_terms( $args );
1062 }
1063
1064 if ( is_wp_error( $taxs ) ) {
1065 return array();
1066 }
1067
1068 return $taxs;
1069 }
1070
1071 /**
1072 * Get Child Terms Count
1073 *
1074 * Used to get child terms count.
1075 *
1076 * @access private
1077 *
1078 * @return int $child_posts_count child terms count.
1079 */
1080 private function get_child_terms_count( $tax, $id ) {
1081
1082 $term_children = get_terms(
1083 array(
1084 'taxonomy' => $tax,
1085 'parent' => $id,
1086 'hide_empty' => true,
1087 'fields' => 'ids',
1088 )
1089 );
1090
1091 if ( empty( $term_children ) ) {
1092 return 0;
1093 }
1094
1095 $child_posts_count = 0;
1096
1097 foreach ( $term_children as $child_id ) {
1098
1099 $term = get_term( $child_id, $tax );
1100
1101 if ( $term && ! is_wp_error( $term ) ) {
1102
1103 $child_posts_count += $term->count;
1104
1105 }
1106 }
1107
1108 return $child_posts_count;
1109 }
1110 }
1111