PluginProbe
Testimonial Customer Feedback / trunk
Testimonial Customer Feedback vtrunk
1.2.8 1.2.7 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.21 1.1.22 1.1.23 1.1.24 1.1.25 1.1.26 1.1.27 1.1.28 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 All 76 releases
testimonial-maker / include / shortcode-options.php

shortcode-options.php in Testimonial Customer Feedback trunk, at include/shortcode-options.php

517 lines 17.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Testimonial Premium - Shortcode Options Parsing
3 // Auto-extracted for modularity
4
5 if (!defined('ABSPATH'))
6 exit;
7
8 if (isset($post_id['cat'])) {
9 $category_ids = explode(",", $post_id['cat']); // convert string into array
10 } else {
11 $category_ids = 0;
12 }
13 // js and css
14 wp_enqueue_script('jquery');
15 wp_enqueue_style('tml-bootstrap-css');
16 wp_enqueue_style('tml-font-awesome-css');
17
18 // owl carousel js and css
19 wp_enqueue_style('tml-owl-carousel-css');
20 wp_enqueue_style('tml-owl-theme-css');
21 wp_enqueue_style('tml-owl-animate-css');
22
23 //owl settings
24 if (isset($post_id['id']) && !empty($post_id['id']) && $post_id['id'] !== 'global') {
25 $testimonial_settings = get_post_meta($post_id['id'], 'testimonial_settings', true);
26 } else {
27 $testimonial_settings = get_option('testimonial_settings');
28 }
29 $GLOBALS['tml_active_settings'] = $testimonial_settings;
30
31 if (isset($post_id['template'])) {
32 $testimonial_carousel_design = $post_id['template']; // template set by shortcode
33 } else {
34 if (isset($testimonial_settings['testimonial_carousel_design']))
35 $testimonial_carousel_design = $testimonial_settings['testimonial_carousel_design'];
36 else
37 $testimonial_carousel_design = 1;
38 }
39
40 // Remap legacy templates to Theme One for backward compatibility
41 $testimonial_carousel_design = intval($testimonial_carousel_design);
42 if ($testimonial_carousel_design < 1 || $testimonial_carousel_design > 3) {
43 $testimonial_carousel_design = 1;
44 }
45
46 if (isset($post_id['effectout'])) {
47 $tml_animateOut_effect = $post_id['effectout'];
48 } else {
49 if (isset($testimonial_settings['tml_animateOut_effect']))
50 $tml_animateOut_effect = $testimonial_settings['tml_animateOut_effect'];
51 else
52 $tml_animateOut_effect = 'slideOutDown';
53 }
54
55 if (isset($post_id['effectin'])) {
56 $tml_animateIn_effect = $post_id['effectin'];
57 } else {
58 if (isset($testimonial_settings['tml_animateIn_effect']))
59 $tml_animateIn_effect = $testimonial_settings['tml_animateIn_effect'];
60 else
61 $tml_animateIn_effect = 'flipInX';
62 }
63
64 if (isset($testimonial_settings['auto_play_carousel']))
65 $auto_play_carousel = $testimonial_settings['auto_play_carousel'];
66 else
67 $auto_play_carousel = "true";
68
69 if (isset($post_id['delay'])) {
70 $tml_slide_speed = $post_id['delay']; // transition speed set by shortcode
71 } else {
72 if (isset($testimonial_settings['tml_slide_speed']))
73 $tml_slide_speed = $testimonial_settings['tml_slide_speed'];
74 else
75 $tml_slide_speed = '3000';
76 }
77
78 if (isset($testimonial_settings['tml_layout_preset']))
79 $tml_layout = $testimonial_settings['tml_layout_preset'];
80 else
81 $tml_layout = 'slider';
82
83 if (!in_array($tml_layout, array('slider', 'grid'))) {
84 $tml_layout = 'slider';
85 }
86 $tml_random_order = 'false';
87 if (isset($testimonial_settings['tml_filter_category']))
88 $tml_filter_category_id = $testimonial_settings['tml_filter_category'];
89 else
90 $tml_filter_category_id = '';
91
92
93 if (isset($testimonial_settings['tml_col_ld']))
94 $tml_col_ld = $testimonial_settings['tml_col_ld'];
95 else
96 $tml_col_ld = '3';
97 if (isset($testimonial_settings['tml_col_d']))
98 $tml_col_d = $testimonial_settings['tml_col_d'];
99 else
100 $tml_col_d = '3';
101 if (isset($testimonial_settings['tml_col_l']))
102 $tml_col_l = $testimonial_settings['tml_col_l'];
103 else
104 $tml_col_l = '2';
105 if (isset($testimonial_settings['tml_col_t']))
106 $tml_col_t = $testimonial_settings['tml_col_t'];
107 else
108 $tml_col_t = '1';
109 if (isset($testimonial_settings['tml_col_m']))
110 $tml_col_m = $testimonial_settings['tml_col_m'];
111 else
112 $tml_col_m = '1';
113 if (isset($testimonial_settings['tml_gap']))
114 $tml_gap = $testimonial_settings['tml_gap'];
115 else
116 $tml_gap = '20';
117 if (isset($testimonial_settings['tml_vgap']))
118 $tml_vgap = $testimonial_settings['tml_vgap'];
119 else
120 $tml_vgap = '20';
121
122 if (isset($testimonial_settings['tml_testimonial_loop']))
123 $tml_testimonial_loop = $testimonial_settings['tml_testimonial_loop'];
124 else
125 $tml_testimonial_loop = 'true';
126 if (isset($testimonial_settings['tml_timeout_speed']))
127 $tml_timeout_speed = $testimonial_settings['tml_timeout_speed'];
128 else
129 $tml_timeout_speed = '3000';
130 if (isset($testimonial_settings['tml_show_star_rating']))
131 $tml_show_star_rating = $testimonial_settings['tml_show_star_rating'];
132 else
133 $tml_show_star_rating = 'true';
134 if (isset($testimonial_settings['tml_star_rating_color']))
135 $tml_star_rating_color = $testimonial_settings['tml_star_rating_color'];
136 else
137 $tml_star_rating_color = '#FFD700';
138 if (isset($testimonial_settings['tml_star_rating_alignment']))
139 $tml_star_rating_alignment = $testimonial_settings['tml_star_rating_alignment'];
140 else
141 $tml_star_rating_alignment = 'center';
142 if (isset($testimonial_settings['tml_image_shape']))
143 $tml_image_shape = $testimonial_settings['tml_image_shape'];
144 else
145 $tml_image_shape = 'circle';
146 if (isset($testimonial_settings['tml_hover_pause']))
147 $tml_hover_pause = $testimonial_settings['tml_hover_pause'];
148 else
149 $tml_hover_pause = 'true';
150 if (isset($testimonial_settings['tml_nav']))
151 $tml_nav = $testimonial_settings['tml_nav'];
152 else
153 $tml_nav = 'false';
154 if (isset($testimonial_settings['tml_pagination']))
155 $tml_pagination = $testimonial_settings['tml_pagination'];
156 else
157 $tml_pagination = 'false';
158 if (isset($testimonial_settings['tml_post_order']))
159 $tml_post_order = $testimonial_settings['tml_post_order'];
160 else
161 $tml_post_order = 'DESC';
162 if (isset($testimonial_settings['tml_order_by']))
163 $tml_order_by = $testimonial_settings['tml_order_by'];
164 else
165 $tml_order_by = 'date';
166 if (isset($testimonial_settings['tml_auto_hight']))
167 $tml_auto_hight = $testimonial_settings['tml_auto_hight'];
168 else
169 $tml_auto_hight = 'false';
170 if (isset($testimonial_settings['tml_rtl']))
171 $tml_rtl = $testimonial_settings['tml_rtl'];
172 else
173 $tml_rtl = 'false';
174
175 if (isset($testimonial_settings['tml_ds_section_title']))
176 $tml_ds_section_title = $testimonial_settings['tml_ds_section_title'];
177 else
178 $tml_ds_section_title = 'hide';
179 if (isset($testimonial_settings['tml_ds_section_title_text']))
180 $tml_ds_section_title_text = $testimonial_settings['tml_ds_section_title_text'];
181 else
182 $tml_ds_section_title_text = 'Testimonials';
183 $tml_ds_schema = 'disabled';
184 if (isset($testimonial_settings['tml_ds_preloader']))
185 $tml_ds_preloader = $testimonial_settings['tml_ds_preloader'];
186 else
187 $tml_ds_preloader = 'disabled';
188 if (isset($testimonial_settings['tml_ds_field_order']))
189 $tml_ds_field_order = $testimonial_settings['tml_ds_field_order'];
190 else
191 $tml_ds_field_order = 'image,content,rating,author,social';
192 if (isset($testimonial_settings['tml_ds_avg_rating']))
193 $tml_ds_avg_rating = $testimonial_settings['tml_ds_avg_rating'];
194 else
195 $tml_ds_avg_rating = 'hide';
196 if (isset($testimonial_settings['tml_ds_ajax_search']))
197 $tml_ds_ajax_search = $testimonial_settings['tml_ds_ajax_search'];
198 else
199 $tml_ds_ajax_search = 'disabled';
200
201 if (isset($testimonial_settings['tml_ds_ajax_search_width']))
202 $tml_ds_ajax_search_width = $testimonial_settings['tml_ds_ajax_search_width'];
203 else
204 $tml_ds_ajax_search_width = 'container';
205
206 if (isset($testimonial_settings['tml_ds_ajax_search_shape']))
207 $tml_ds_ajax_search_shape = $testimonial_settings['tml_ds_ajax_search_shape'];
208 else
209 $tml_ds_ajax_search_shape = 'round';
210
211
212 if (isset($testimonial_settings['tml_ds_card_shadow']))
213 $tml_ds_card_shadow = $testimonial_settings['tml_ds_card_shadow'];
214 else
215 $tml_ds_card_shadow = 'show';
216
217 if (isset($testimonial_settings['tml_autoplay_mobile']))
218 $tml_autoplay_mobile = $testimonial_settings['tml_autoplay_mobile'];
219 else
220 $tml_autoplay_mobile = 'true';
221
222 $tml_nav_position = 'vertical_outer';
223 if (isset($testimonial_settings['tml_nav_mobile_hide']))
224 $tml_nav_mobile_hide = $testimonial_settings['tml_nav_mobile_hide'];
225 else
226 $tml_nav_mobile_hide = 'false';
227 if (isset($testimonial_settings['tml_nav_color']))
228 $tml_nav_color = $testimonial_settings['tml_nav_color'];
229 else
230 $tml_nav_color = '#666666';
231 if (isset($testimonial_settings['tml_nav_bg_color']))
232 $tml_nav_bg_color = $testimonial_settings['tml_nav_bg_color'];
233 else
234 $tml_nav_bg_color = 'transparent';
235 if (isset($testimonial_settings['tml_nav_size']))
236 $tml_nav_size = $testimonial_settings['tml_nav_size'];
237 else
238 $tml_nav_size = '35';
239 if (isset($testimonial_settings['tml_nav_arrow_style']))
240 $tml_nav_arrow_style = $testimonial_settings['tml_nav_arrow_style'];
241 else
242 $tml_nav_arrow_style = 'chevron';
243 if (isset($testimonial_settings['tml_pagination_mobile_hide']))
244 $tml_pagination_mobile_hide = $testimonial_settings['tml_pagination_mobile_hide'];
245 else
246 $tml_pagination_mobile_hide = 'false';
247 $tml_pagination_style = 'bullets';
248 if (isset($testimonial_settings['tml_mouse_draggable']))
249 $tml_mouse_draggable = $testimonial_settings['tml_mouse_draggable'];
250 else
251 $tml_mouse_draggable = 'true';
252 $tml_pagi_enabled = 'false';
253 $tml_pagi_type = 'load_more';
254 $tml_per_page = 6;
255 $tml_pagi_align = 'center';
256
257
258
259
260 if (isset($testimonial_settings['tml_ds_content_show']))
261 $tml_ds_content_show = $testimonial_settings['tml_ds_content_show'];
262 else
263 $tml_ds_content_show = 'show';
264 if (isset($testimonial_settings['tml_ds_content_type']))
265 $tml_ds_content_type = $testimonial_settings['tml_ds_content_type'];
266 else
267 $tml_ds_content_type = 'full';
268 if (isset($testimonial_settings['tml_ds_content_length']))
269 $tml_ds_content_length = $testimonial_settings['tml_ds_content_length'];
270 else
271 $tml_ds_content_length = '50';
272 if (isset($testimonial_settings['tml_ds_content_length_type']))
273 $tml_ds_content_length_type = $testimonial_settings['tml_ds_content_length_type'];
274 else
275 $tml_ds_content_length_type = 'words';
276 $tml_ds_read_more = 'show';
277 $tml_ds_rm_action = 'expand';
278
279 if (isset($testimonial_settings['tml_ds_image_size'])) {
280 $tml_ds_image_size = $testimonial_settings['tml_ds_image_size'];
281 } else {
282 $tml_ds_image_size = '80';
283 }
284
285 // Dynamically adjust WordPress image source size based on visual pixel size to avoid blurriness
286 $tml_ds_image_size_num = intval($tml_ds_image_size);
287 if ($tml_ds_image_size_num > 300) {
288 $tml_ds_image_dim = 'large';
289 } elseif ($tml_ds_image_size_num > 150) {
290 $tml_ds_image_dim = 'medium';
291 } else {
292 $tml_ds_image_dim = 'thumbnail';
293 }
294
295 if (isset($testimonial_settings['tml_ds_image_shape']))
296 $tml_ds_image_shape = $testimonial_settings['tml_ds_image_shape'];
297 else
298 $tml_ds_image_shape = 'circle';
299
300 if (isset($testimonial_settings['tml_ds_name_show']))
301 $tml_ds_name_show = $testimonial_settings['tml_ds_name_show'];
302 else
303 $tml_ds_name_show = 'show';
304 $tml_ds_name_tag = 'h4';
305 if (isset($testimonial_settings['tml_ds_designation_show']))
306 $tml_ds_designation_show = $testimonial_settings['tml_ds_designation_show'];
307 else
308 $tml_ds_designation_show = 'show';
309 if (isset($testimonial_settings['tml_ds_website_show']))
310 $tml_ds_website_show = $testimonial_settings['tml_ds_website_show'];
311 else
312 $tml_ds_website_show = 'show';
313
314
315 // Advanced Typography Extraction & CSS Generation
316 $typography_prefixes = array(
317 'tml_typo_title',
318 'tml_typo_content',
319 'tml_typo_designation',
320 'tml_typo_website',
321 'tml_typo_isotope'
322 );
323
324 $typo_styles = array();
325 foreach ($typography_prefixes as $prefix) {
326 $load = isset($testimonial_settings[$prefix . '_load']) ? $testimonial_settings[$prefix . '_load'] : 'off';
327 if ($load == 'on') {
328 $style = "";
329 $font = isset($testimonial_settings[$prefix . '_font']) ? $testimonial_settings[$prefix . '_font'] : 'inherit';
330 $align = isset($testimonial_settings[$prefix . '_align']) ? $testimonial_settings[$prefix . '_align'] : 'inherit';
331 $transform = isset($testimonial_settings[$prefix . '_transform']) ? $testimonial_settings[$prefix . '_transform'] : 'none';
332 $size = isset($testimonial_settings[$prefix . '_size']) ? $testimonial_settings[$prefix . '_size'] : '';
333 $lh = isset($testimonial_settings[$prefix . '_line_height']) ? $testimonial_settings[$prefix . '_line_height'] : '';
334 $ls = isset($testimonial_settings[$prefix . '_spacing']) ? $testimonial_settings[$prefix . '_spacing'] : '0';
335 $weight = isset($testimonial_settings[$prefix . '_weight']) ? $testimonial_settings[$prefix . '_weight'] : 'inherit';
336 $mt = isset($testimonial_settings[$prefix . '_m_t']) ? $testimonial_settings[$prefix . '_m_t'] : '0';
337 $mb = isset($testimonial_settings[$prefix . '_m_b']) ? $testimonial_settings[$prefix . '_m_b'] : '0';
338 $ml = isset($testimonial_settings[$prefix . '_m_l']) ? $testimonial_settings[$prefix . '_m_l'] : '0';
339 $mr = isset($testimonial_settings[$prefix . '_m_r']) ? $testimonial_settings[$prefix . '_m_r'] : '0';
340 $color_key = $prefix . '_color';
341 if ($prefix == 'tml_typo_title')
342 $color_key = 'tml_title_color';
343 if ($prefix == 'tml_typo_content')
344 $color_key = 'tml_description_color';
345 if ($prefix == 'tml_typo_designation')
346 $color_key = 'tml_designation_color';
347
348 $color = isset($testimonial_settings[$color_key]) && $testimonial_settings[$color_key] !== '' ? $testimonial_settings[$color_key] : '#000000';
349
350 if ($font != 'inherit')
351 $style .= "font-family: $font !important;";
352 if ($align != 'inherit')
353 $style .= "text-align: $align !important;";
354 if ($transform != 'none')
355 $style .= "text-transform: $transform !important;";
356 if ($size != '')
357 $style .= "font-size: {$size}px !important;";
358 if ($lh != '')
359 $style .= "line-height: {$lh}px !important;";
360 if ($ls != '0' && $ls != '')
361 $style .= "letter-spacing: {$ls}px !important;";
362 if ($weight != 'inherit')
363 $style .= "font-weight: $weight !important;";
364 if ($mt != '0' && $mt != '')
365 $style .= "margin-top: {$mt}px !important;";
366 if ($mb != '0' && $mb != '')
367 $style .= "margin-bottom: {$mb}px !important;";
368 if ($ml != '0' && $ml != '')
369 $style .= "margin-left: {$ml}px !important;";
370 if ($mr != '0' && $mr != '')
371 $style .= "margin-right: {$mr}px !important;";
372 if ($color != '')
373 $style .= "color: $color !important;";
374
375 $typo_styles[$prefix] = $style;
376 } else {
377 $typo_styles[$prefix] = "";
378 }
379 }
380
381 if (isset($testimonial_settings['tml_ds_image_show']))
382 $tml_ds_image_show = $testimonial_settings['tml_ds_image_show'];
383 else
384 $tml_ds_image_show = 'show';
385 if (isset($testimonial_settings['tml_ds_image_fallback']))
386 $tml_ds_image_fallback = $testimonial_settings['tml_ds_image_fallback'];
387 else
388 $tml_ds_image_fallback = 'mystery';
389 if (isset($testimonial_settings['tml_mouse_control']))
390 $tml_mouse_control = $testimonial_settings['tml_mouse_control'];
391 else
392 $tml_mouse_control = 'false';
393 $tml_rsp_slide = 'false';
394 $tml_url_hash_slide = 'false';
395 if (isset($testimonial_settings['tml_limit']))
396 $tml_limit = $testimonial_settings['tml_limit'];
397 else
398 $tml_limit = '10';
399
400 $tml_category_order = '';
401 $tml_selected_categories = array();
402 $tml_rating_order = '5,4,3,2,1';
403 $tml_selected_ratings = array();
404
405
406
407 $tml_rating_style = 'star';
408 if (isset($testimonial_settings['tml_ds_rating_default_color']))
409 $tml_ds_rating_default_color = $testimonial_settings['tml_ds_rating_default_color'];
410 else
411 $tml_ds_rating_default_color = '#E0E0E0';
412 if (isset($testimonial_settings['tml_ds_rating_size']))
413 $tml_ds_rating_size = $testimonial_settings['tml_ds_rating_size'];
414 else
415 $tml_ds_rating_size = '19';
416 if (isset($testimonial_settings['tml_ds_rating_gap']))
417 $tml_ds_rating_gap = $testimonial_settings['tml_ds_rating_gap'];
418 else
419 $tml_ds_rating_gap = '2';
420 if (isset($testimonial_settings['tml_ds_rating_pos']))
421 $tml_ds_rating_pos = $testimonial_settings['tml_ds_rating_pos'];
422 else
423 $tml_ds_rating_pos = 'below_name';
424 $tml_ds_video_icon = 'hide';
425 $tml_video_playback = 'external';
426 $tml_ds_video_icon_size = '32';
427 $tml_ds_video_icon_color = '#ffffff';
428 $tml_ds_video_icon_hover_color = '#ffffff';
429 $tml_ds_video_icon_bg = 'rgba(0, 0, 0, 0.4)';
430
431 $rating_args = array(
432 'style' => $tml_rating_style,
433 'color' => $tml_star_rating_color,
434 'default_color' => $tml_ds_rating_default_color,
435 'size' => $tml_ds_rating_size,
436 'gap' => $tml_ds_rating_gap,
437 'alignment' => $tml_star_rating_alignment
438 );
439
440
441 if (isset($post_id['background'])) {
442 $tml_background_color = $post_id['background']; // Background Color set by shortcode
443 } else {
444 if (isset($testimonial_settings['tml_background_color']) && !empty($testimonial_settings['tml_background_color']) && $testimonial_settings['tml_background_color'] !== '#6c6c6c')
445 $tml_background_color = $testimonial_settings['tml_background_color'];
446 else
447 $tml_background_color = "#ffffff";
448 }
449
450
451
452 if (isset($post_id['nfc']) && $post_id['nfc'] !== '') {
453 $tml_title_color = $post_id['nfc']; // name text color set by shortcode
454 } else {
455 if (isset($testimonial_settings['tml_title_color']) && $testimonial_settings['tml_title_color'] !== '')
456 $tml_title_color = $testimonial_settings['tml_title_color'];
457 else
458 $tml_title_color = "#000000";
459 }
460
461 if (isset($post_id['tfc']) && $post_id['tfc'] !== '') {
462 $tml_description_color = $post_id['tfc']; // testimonial text color set by shortcode
463 } else {
464 if (isset($testimonial_settings['tml_description_color']) && $testimonial_settings['tml_description_color'] !== '')
465 $tml_description_color = $testimonial_settings['tml_description_color'];
466 else
467 $tml_description_color = "#000000";
468 }
469
470 if (isset($post_id['dfc']) && $post_id['dfc'] !== '') {
471 $tml_designation_color = $post_id['dfc']; // designation text color set by shortcode
472 } else {
473 if (isset($testimonial_settings['tml_designation_color']) && $testimonial_settings['tml_designation_color'] !== '')
474 $tml_designation_color = $testimonial_settings['tml_designation_color'];
475 else
476 $tml_designation_color = "#000000";
477 }
478
479
480
481 if (isset($post_id['layout'])) {
482 $tml_layout = $post_id['layout'];
483 }
484
485 if (isset($post_id['limit'])) {
486 $tml_limit = intval($post_id['limit']);
487 } else {
488 // Fallback to global limit from settings
489 $tml_limit = isset($testimonial_settings['tml_limit']) ? intval($testimonial_settings['tml_limit']) : -1;
490 }
491
492 // Limit should only work for slider and carousel layouts
493 if (!in_array($tml_layout, array('slider', 'carousel'))) {
494 $tml_limit = -1;
495 }
496
497 // Ajax Pagination Override: Use tml_per_page if pagination is enabled, layout is not slider/carousel, and limit is not set via shortcode
498 if (!in_array($tml_layout, array('slider', 'carousel')) && $tml_pagi_enabled == 'true' && $tml_pagi_type != 'normal' && empty($post_id['limit'])) {
499 $tml_limit = $tml_per_page;
500 }
501
502 if (isset($post_id['is_ajax_request'])) {
503 $is_ajax_request = $post_id['is_ajax_request'];
504 } else {
505 $is_ajax_request = 'false';
506 }
507
508 if (isset($post_id['text_limit'])) {
509 $tml_text_limit = intval($post_id['text_limit']);
510 } else {
511 $tml_text_limit = 0;
512 }
513
514 $tml_rating_filter = 'false';
515
516 $tml_progress_bar = 'false';
517 $tml_social_share = 'false';