| Server IP : 52.25.153.185 / Your IP : 216.73.217.131 Web Server : Apache System : Linux ip-172-26-6-158 5.10.0-35-cloud-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64 User : daemon ( 1) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /bitnami/wordpress/wp-content/plugins/testify/includes/ |
Upload File : |
<?php
if ( !function_exists('testify_shortcode_output') ) {
function testify_shortcode_output($atts) {
global $testify_id;
if (!AGS_TESTIFY_has_license_key()) {
return '';
}
$classes = array();
$dataAttrs = array();
$testifyOptionsDefaults = testify_get_options_defaults();
$isDivi = !empty($atts['_divi']);
$perRow = (isset($atts['thumb_per_row']) ? testify_sanitize_thumb_per_row($atts['thumb_per_row']) : get_theme_mod('testify_thumb_per_row', $testifyOptionsDefaults['thumb_per_row']));
$perRow900 = (isset($atts['thumb_per_row_900']) ? testify_sanitize_thumb_per_row($atts['thumb_per_row_900']) : get_theme_mod('testify_thumb_per_row_900', $testifyOptionsDefaults['thumb_per_row_900']));
$perRow600 = (isset($atts['thumb_per_row_600']) ? testify_sanitize_thumb_per_row($atts['thumb_per_row_600']) : get_theme_mod('testify_thumb_per_row_600', $testifyOptionsDefaults['thumb_per_row_600']));
$perRow400 = (isset($atts['thumb_per_row_400']) ? testify_sanitize_thumb_per_row($atts['thumb_per_row_400']) : get_theme_mod('testify_thumb_per_row_400', $testifyOptionsDefaults['thumb_per_row_400']));
$rootClasses = 'testify-testimonials thumb_per_row_'.$perRow.' thumb_per_row_900_'.$perRow900.' thumb_per_row_600_'.$perRow600.' thumb_per_row_400_'.$perRow400.' flexslider';
$imageWidth = (isset($atts['image_width']) ? (int) $atts['image_width'] : get_theme_mod('testify_image_width', $testifyOptionsDefaults['image_width']));
$imageWidth900 = (isset($atts['image_width_900']) ? (int) $atts['image_width_900'] : get_theme_mod('testify_image_width_900', $testifyOptionsDefaults['image_width_900']));
$imageWidth600 = (isset($atts['image_width_600']) ? (int) $atts['image_width_600'] : get_theme_mod('testify_image_width_600', $testifyOptionsDefaults['image_width_600']));
$imageWidth400 = (isset($atts['image_width_400']) ? (int) $atts['image_width_400'] : get_theme_mod('testify_image_width_400', $testifyOptionsDefaults['image_width_400']));
$navType = (isset($atts['nav_type']) ? testify_sanitize_nav_type($atts['nav_type']) : get_theme_mod('testify_nav_type', $testifyOptionsDefaults['nav_type']));
$css = array(
'.testify-testimonials' => array(),
'.controls' => array(),
'.testify-flex-control-thumbs' => array(),
'.testify-flex-control-thumbs li' => array(),
'ul.slides' => array(),
'.quotation-mark' => array(),
'.testimonial-body' => array(),
'.testimonial-body p' => array(),
'.person-name' => array(),
'.person-name p' => array(),
'.person-name p a' => array(),
'.testimonial-sep' => array(),
//'.slides .testimonial-image' => array(), // set below
'.testimonial' => array()
);
$responsiveCSS = array(
'default' => array(
'.slides .testimonial-image' => array(),
),
900 => array(
'.slides .testimonial-image' => array(),
),
600 => array(
'.slides .testimonial-image' => array(),
),
400 => array(
'.slides .testimonial-image' => array(),
)
);
if (isset($atts['thumb_spacing'])) {
$atts['thumb_spacing'] = absint($atts['thumb_spacing']);
$css['.controls']['margin-top'] = '-'.$atts['thumb_spacing'].'px';
$css['.controls']['margin-left'] = '-'.($atts['thumb_spacing']/2).'px';
$css['.controls']['margin-right'] = '-'.($atts['thumb_spacing']/2).'px';
$css['.testify-flex-control-thumbs']['bottom'] = '-'.$atts['thumb_spacing'].'px';
$css['.testify-flex-control-thumbs li']['border-left-width'] = ($atts['thumb_spacing']/2).'px';
$css['.testify-flex-control-thumbs li']['border-right-width'] = ($atts['thumb_spacing']/2).'px';
$css['.testify-flex-control-thumbs li']['border-bottom-width'] = $atts['thumb_spacing'].'px';
}
if (isset($atts['thumb_row_bgcolor'])) {
$atts['thumb_row_bgcolor'] = testify_sanitize_text($atts['thumb_row_bgcolor']);
$css['.testify-flex-control-thumbs']['background-color'] = $atts['thumb_row_bgcolor'];
$css['.testify-flex-control-thumbs li']['border-left-color'] = $atts['thumb_row_bgcolor'];
$css['.testify-flex-control-thumbs li']['border-right-color'] = $atts['thumb_row_bgcolor'];
$css['.testify-flex-control-thumbs li']['border-bottom-color'] = $atts['thumb_row_bgcolor'];
}
if (isset($atts['thumb_inactive_color'])) {
if (strcasecmp($atts['thumb_inactive_color'][0], 'r') && $atts['thumb_inactive_color'][0] != '#') {
$atts['thumb_inactive_color'] = '#'.$atts['thumb_inactive_color'];
}
$css['.testify-flex-control-thumbs li']['background-color'] = $atts['thumb_inactive_color'];
}
if (isset($atts['qmark_width'])) {
$css['.quotation-mark']['width'] = $atts['qmark_width'].'px';
$css['.quotation-mark']['height'] = (($atts['qmark_width']/38) * 50).'px';
}
if (isset($atts['qmark']) || isset($atts['qmark_width']) || isset($atts['nav_arrows']) || isset($atts['font_size'])) {
$qMark = (isset($atts['qmark']) ? $atts['qmark'] : get_theme_mod('testify_qmark', $testifyOptionsDefaults['qmark']));
$fontSize = (isset($atts['font_size']) ? $atts['font_size'] : get_theme_mod('testify_font_size', $testifyOptionsDefaults['font_size']));
$qMarkWidth = (isset($atts['qmark_width']) ? $atts['qmark_width'] : get_theme_mod('testify_qmark_width', $testifyOptionsDefaults['qmark_width']));
if (empty($qMark)) {
$sidePadding = 0;
$sidePaddingTablet = 0;
} else {
$sidePadding = (($fontSize / 2) + $qMarkWidth);
$sidePaddingTablet = (($fontSize * 0.8) / 2) + ($qMarkWidth * 0.6);
}
$navArrows = (isset($atts['nav_arrows']) ? $atts['nav_arrows'] : get_theme_mod('testify_nav_arrows', $testifyOptionsDefaults['nav_arrows']));
if (!empty($navArrows)) {
// If arrows are displayed, we need at least 50px padding on the sides
$sidePadding = max(50, $sidePadding);
$sidePaddingTablet = (empty($sidePaddingTablet) ? 50 : max(50, $sidePaddingTablet));
}
$css['.testimonial-outer']['padding'] = '0 '.($sidePadding-$sidePaddingTablet).'px';
$css['.testimonial']['padding'] = '0 '.$sidePaddingTablet.'px';
}
if (isset($atts['bgcolor'])) {
$css['.testify-testimonials']['background-color'] = testify_sanitize_text($atts['bgcolor']);
}
if (!$isDivi) {
if (isset($atts['font_size'])) {
$css['.testify-testimonials']['font-size'] = absint($atts['font_size']).'px';
}
if (isset($atts['text_color'])) {
if (strcasecmp($atts['text_color'][0], 'r') && $atts['text_color'][0] != '#') {
$atts['text_color'] = '#'.$atts['text_color'];
}
$css['.testimonial-body']['color'] = $atts['text_color'];
}
if (isset($atts['font_family'])) {
$css['.testimonial-body']['font-family'] = wp_strip_all_tags($atts['font_family']);
}
if (isset($atts['font_weight'])) {
$css['.testimonial-body']['font-weight'] = testify_sanitize_font_weight($atts['font_weight']);
}
if (isset($atts['font_italic'])) {
$css['.testimonial-body']['font-style'] = ($atts['font_italic'] ? 'italic' : 'normal');
}
if (isset($atts['text_uppercase'])) {
$css['.testimonial-body']['text-transform'] = ($atts['text_uppercase'] ? 'uppercase' : 'none');
}
if (isset($atts['font_size_author'])) {
$css['.person-name']['font-size'] = absint($atts['font_size_author']).'px';
}
if (isset($atts['text_color_author'])) {
if (strcasecmp($atts['text_color_author'][0], 'r') && $atts['text_color_author'][0] != '#') {
$atts['text_color_author'] = '#'.$atts['text_color_author'];
}
$css['.person-name p']['color'] = $atts['text_color_author'];
$css['.person-name p a']['color'] = $atts['text_color_author'];
}
if (isset($atts['font_family_author'])) {
$css['.person-name p']['font-family'] = wp_strip_all_tags($atts['font_family_author']);
$css['.person-name p a']['font-family'] = wp_strip_all_tags($atts['font_family_author']);
}
if (isset($atts['font_weight_author'])) {
$css['.person-name p']['font-weight'] = testify_sanitize_font_weight($atts['font_weight_author']);
$css['.person-name p a']['font-weight'] = testify_sanitize_font_weight($atts['font_weight_author']);
}
if (isset($atts['font_italic_author'])) {
$css['.person-name p']['font-style'] = ($atts['font_italic_author'] ? 'italic' : 'normal');
$css['.person-name p a']['font-style'] = ($atts['font_italic_author'] ? 'italic' : 'normal');
}
if (isset($atts['text_uppercase_author'])) {
$css['.person-name p']['text-transform'] = ($atts['text_uppercase_author'] ? 'uppercase' : 'none');
$css['.person-name p a']['text-transform'] = ($atts['text_uppercase_author'] ? 'uppercase' : 'none');
}
}
if (isset($atts['sep_color'])) {
if (strcasecmp($atts['sep_color'][0], 'r') && $atts['sep_color'][0] != '#') {
$atts['sep_color'] = '#'.$atts['sep_color'];
}
$css['.testimonial-sep']['background-color'] = $atts['sep_color'];
}
if (isset($atts['sep_height'])) {
$css['.testimonial-sep']['height'] = $atts['sep_height'].'px';
}
if (isset($atts['align'])) {
$atts['align'] = testify_sanitize_align($atts['align']);
$css['.testify-testimonials']['text-align'] = $atts['align'];
$css['.testimonial-sep']['margin-left'] = ($atts['align'] == 'center' ? 'auto' : 0);
$css['.testimonial-sep']['margin-right'] = ($atts['align'] == 'center' ? 'auto' : 0);
$css['.testimonial-sep']['float'] = ($atts['align'] == 'right' ? 'right' : 'none');
$css['.slides .testimonial-image']['margin-left'] = ($atts['align'] == 'center' ? 'auto' : 0);
$css['.slides .testimonial-image']['margin-right'] = ($atts['align'] == 'center' ? 'auto' : 0);
$css['.slides .testimonial-image']['float'] = ($atts['align'] == 'right' ? 'right' : 'none');
}
if ($navType == 'thumbnails' && (isset($atts['nav_type']) || isset($atts['font_size']))) {
$css['ul.slides']['margin-top'] = ((isset($atts['font_size']) ? $atts['font_size'] : get_theme_mod('testify_font_size', $testifyOptionsDefaults['font_size'])) * 1.5).'px';
} else if (isset($atts['nav_type'])) { // the nav_type attribute is set, to something other than "thumbnails"
$css['ul.slides']['margin-top'] = 0;
}
if (isset($atts['image_width']) || isset($atts['image_width_900']) || isset($atts['image_width_600']) || isset($atts['image_width_400'])) {
if (empty($imageWidth)) {
$responsiveCSS['default']['.testimonial-image']['display'] = 'none';
} else {
$responsiveCSS['default']['.testimonial-image']['display'] = 'block';
$responsiveCSS['default']['.testimonial-image']['max-width'] = $imageWidth.'px';
}
if (empty($imageWidth900)) {
$responsiveCSS[900]['.testimonial-image']['display'] = 'none';
} else {
$responsiveCSS[900]['.testimonial-image']['display'] = 'block';
$responsiveCSS[900]['.testimonial-image']['max-width'] = $imageWidth900.'px';
}
if (empty($imageWidth600)) {
$responsiveCSS[600]['.testimonial-image']['display'] = 'none';
} else {
$responsiveCSS[600]['.testimonial-image']['display'] = 'block';
$responsiveCSS[600]['.testimonial-image']['max-width'] = $imageWidth600.'px';
}
if (empty($imageWidth400)) {
$responsiveCSS[400]['.testimonial-image']['display'] = 'none';
} else {
$responsiveCSS[400]['.testimonial-image']['display'] = 'block';
$responsiveCSS[400]['.testimonial-image']['max-width'] = $imageWidth400.'px';
}
}
$testimonial_image = array(
'border-width' => 0,
'border-color' => 0,
'box-shadow' => 'none',
'border-radius' => 0
);
$image_border_width = (isset($atts['image_border_width']) ? $atts['image_border_width'] : get_theme_mod('testify_image_border_width', $testifyOptionsDefaults['image_border_width']));
if ( $image_border_width ) {
$testimonial_image['border-width'] = absint( $image_border_width ) . 'px';
}
$image_border_color = (isset($atts['image_border_color']) ? $atts['image_border_color'] : get_theme_mod('testify_image_border_color', $testifyOptionsDefaults['image_border_color']));
if ( $image_border_color ) {
if ( strcasecmp($image_border_color[0], 'r') && $image_border_color[0] != '#') {
$image_border_color = '#' . $image_border_color;
}
$testimonial_image['border-color'] = $image_border_color;
}
$image_shadow = (isset($atts['image_shadow']) ? $atts['image_shadow'] : get_theme_mod('testify_image_shadow', $testifyOptionsDefaults['image_shadow']));
if ( $image_shadow ) {
$testimonial_image['box-shadow'] = (empty($image_shadow) ? 'none' : '0 0 5px 0 rgba(0,0,0,0.5)');
}
$image_shape = (isset($atts['image_shape']) ? $atts['image_shape'] : get_theme_mod('testify_image_shape', $testifyOptionsDefaults['image_shape']));
if ( $image_shape ) {
$testimonial_image['border-radius'] = ($image_shape == 'square' ? '0' : '50%');
}
$css['.slides .testimonial-image'] = $testimonial_image;
$testify = '';
if ( isset( $atts['module_id'] ) ) {
$testify_id = sprintf( 'testify-testimonials-%s', $atts['module_id'] );
} else {
$testify_id = 'testify-testimonials-' . wp_rand( 10000, 99999 );
}
$readmore = (isset($atts['readmore']) ? absint($atts['readmore']) : get_theme_mod('testify_readmore', $testifyOptionsDefaults['readmore']));
if ( $readmore )
{
$readmore_limit = (isset($atts['readmore_limit']) ? $atts['readmore_limit'] : get_theme_mod('testify_readmore_limit', $testifyOptionsDefaults['readmore_limit']));
$readmore_morelink = (isset($atts['readmore_morelink']) ? $atts['readmore_morelink'] : get_theme_mod('testify_readmore_morelink', $testifyOptionsDefaults['readmore_morelink']));
$readmore_lesslink = (isset($atts['readmore_lesslink']) ? $atts['readmore_lesslink'] : get_theme_mod('testify_readmore_lesslink', $testifyOptionsDefaults['readmore_lesslink']));
$readmore_use_icon = (isset($atts['readmore_use_icon']) ? $atts['readmore_use_icon'] : get_theme_mod('testify_readmore_use_icon', $testifyOptionsDefaults['readmore_use_icon']));
if (!empty($atts['readmore_icon_et']) && $atts['readmore_icon_et'] != $testifyOptionsDefaults['readmore_icon_et']) {
$readmore_icon = $atts['readmore_icon_et'];
$readmore_icon_isDivi = true;
} else if (isset($atts['readmore_icon'])) {
$readmore_icon = $atts['readmore_icon'];
if ($isDivi) {
$rootClasses .= ' testify-readmore-icon-fa';
}
} else if ($isDivi) {
$readmore_icon = $testifyOptionsDefaults['readmore_icon_et'];
$readmore_icon_isDivi = true;
} else {
$readmore_icon = get_theme_mod('testify_readmore_icon', $testifyOptionsDefaults['readmore_icon']);
}
$readmore_icon_color = (isset($atts['readmore_icon_color']) ? testify_sanitize_text($atts['readmore_icon_color']) : get_theme_mod('testify_readmore_icon_color', $testifyOptionsDefaults['readmore_icon_color']));
$readmore_icon_placement = (isset($atts['readmore_icon_placement']) ? $atts['readmore_icon_placement'] : get_theme_mod('testify_readmore_icon_placement', $testifyOptionsDefaults['readmore_icon_placement']));
if (!empty($atts['readmore_less_icon_et']) && $atts['readmore_less_icon_et'] != $testifyOptionsDefaults['readmore_less_icon_et']) {
$readmore_less_icon = $atts['readmore_less_icon_et'];
$readmore_less_icon_isDivi = true;
} else if (isset($atts['readmore_less_icon'])) {
$readmore_less_icon = $atts['readmore_less_icon'];
if ($isDivi) {
$rootClasses .= ' testify-readmore-less-icon-fa';
}
} else if ($isDivi) {
$readmore_less_icon = $testifyOptionsDefaults['readmore_less_icon_et'];
$readmore_less_icon_isDivi = true;
} else {
$readmore_less_icon = get_theme_mod('testify_readmore_less_icon', $testifyOptionsDefaults['readmore_less_icon']);
}
$readmore_less_icon_color = (isset($atts['readmore_less_icon_color']) ? testify_sanitize_text($atts['readmore_less_icon_color']) : get_theme_mod('testify_readmore_less_icon_color', $testifyOptionsDefaults['readmore_less_icon_color']));
$readmore_less_icon_placement = (isset($atts['readmore_less_icon_placement']) ? $atts['readmore_less_icon_placement'] : get_theme_mod('testify_readmore_less_icon_placement', $testifyOptionsDefaults['readmore_less_icon_placement']));
$classes[] = 'testify-readmore testify-body-hide';
$readmore_icon = '' !== $readmore_icon ? str_replace( ';', '', str_replace( '&#x', '', html_entity_decode( testify_process_font_icon( $readmore_icon, !empty($readmore_icon_isDivi) ) ) ) ) : '';
$readmore_icon_color = '' !== $readmore_icon_color ? sprintf( 'color:%1$s !important;', $readmore_icon_color ) : '';
$readmore_icon_placement = $readmore_icon_placement === 'left' ? ':before' : ':after';
$readmore_less_icon = '' !== $readmore_less_icon ? str_replace( ';', '', str_replace( '&#x', '', html_entity_decode( testify_process_font_icon( $readmore_less_icon, !empty($readmore_less_icon_isDivi) ) ) ) ) : '';
$readmore_less_icon_color = '' !== $readmore_less_icon_color ? sprintf( 'color:%1$s !important;', $readmore_less_icon_color ) : '';
$readmore_less_icon_placement = $readmore_less_icon_placement === 'left' ? ':before' : ':after';
$readmore_icon = 'content:\'\\'. $readmore_icon. '\';';
$readmore_less_icon = 'content:\'\\'. $readmore_less_icon. '\';';
if (!$isDivi) {
$readmore_font = (isset($atts['readmore_font']) ? wp_strip_all_tags($atts['readmore_font']) : get_theme_mod('testify_readmore_font', $testifyOptionsDefaults['readmore_font']));
$readmore_font_size = (isset($atts['readmore_font_size']) ? $atts['readmore_font_size'] : get_theme_mod('testify_readmore_font_size', $testifyOptionsDefaults['readmore_font_size']));
$readmore_color = (isset($atts['readmore_color']) ? testify_sanitize_text($atts['readmore_color']) : get_theme_mod('testify_readmore_color', $testifyOptionsDefaults['readmore_color']));
$readmore_letter_spacing = (isset($atts['readmore_letter_spacing']) ? $atts['readmore_letter_spacing'] : get_theme_mod('testify_readmore_letter_spacing', $testifyOptionsDefaults['readmore_letter_spacing']));
$readmore_font = '' !== $readmore_font ? str_replace( '"', '\'', testify_set_element_font( $readmore_font, true ) ) : '';
$readmore_font_size = '' !== $readmore_font_size ? sprintf( 'font-size:%1$s;', testify_process_range_value( $readmore_font_size ) ) : '';
$readmore_color = '' !== $readmore_color ? sprintf( 'color:%1$s !important;', $readmore_color ) : '';
$readmore_letter_spacing = '' !== $readmore_letter_spacing ? sprintf( 'letter-spacing:%1$s;', testify_process_range_value( $readmore_letter_spacing ) ) : '';
$readmore_icon .= $readmore_font_size;
$readmore_icon .= sprintf( ' line-height:%1$s;', absint($readmore_font_size) > 35 ? '1.7em' : '1em' );
$readmore_less_icon .= $readmore_font_size;
$readmore_less_icon .= sprintf( ' line-height:%1$s;', absint($readmore_font_size) > 35 ? '1.7em' : '1em' );
$dataAttrs[] = 'data-readmore-font="' . esc_attr($readmore_font) . '"';
$dataAttrs[] = 'data-readmore-font-size="' . esc_attr($readmore_font_size) . '"';
$dataAttrs[] = 'data-readmore-color="' . esc_attr($readmore_color) . '"';
$dataAttrs[] = 'data-readmore-letter-spacing="' . esc_attr($readmore_letter_spacing) . '"';
}
$dataAttrs[] = 'data-readmore-limit="' . absint($readmore_limit) . '"';
$dataAttrs[] = 'data-readmore-morelink="' . esc_attr($readmore_morelink) . '"';
$dataAttrs[] = 'data-readmore-lesslink="' . esc_attr($readmore_lesslink) . '"';
$dataAttrs[] = 'data-readmore-use-icon="' . ((int) $readmore_use_icon) . '"';
$dataAttrs[] = 'data-readmore-icon="' . esc_attr($readmore_icon) . '"';
$dataAttrs[] = 'data-readmore-icon-color="' . esc_attr($readmore_icon_color) . '"';
$dataAttrs[] = 'data-readmore-icon-placement="' . esc_attr($readmore_icon_placement) . '"';
$dataAttrs[] = 'data-readmore-less-icon="' . esc_attr($readmore_less_icon) . '"';
$dataAttrs[] = 'data-readmore-less-icon-color="' . esc_attr($readmore_less_icon_color) . '"';
$dataAttrs[] = 'data-readmore-less-icon-placement="' . esc_attr($readmore_less_icon_placement) . '"';
}
$classes = implode( ' ', $classes );
$dataAttrs = implode( ' ', $dataAttrs );
?>
<div
id="<?php echo esc_attr($testify_id) ?>"
class="<?php echo(esc_attr($rootClasses)); ?>"
data-testify-responsive-css="<?php echo(esc_attr(wp_json_encode($responsiveCSS) )); ?>"
data-testify-id="<?php echo esc_html($testify_id); ?>"
data-testify-atts="<?php echo(esc_attr(wp_json_encode($atts) )); ?>"
data-testify-options-defaults="<?php echo(esc_attr(wp_json_encode($testifyOptionsDefaults) )); ?>"
data-testify-navtype="<?php echo(esc_attr( $navType )); ?>"
data-testify-css="<?php echo(esc_attr( wp_json_encode($css) )); ?>"
>
<div class="controls"></div>
<div class="slides-container">
<?php
$qMark = (isset($atts['qmark']) ? absint($atts['qmark']) : get_theme_mod('testify_qmark', $testifyOptionsDefaults['qmark']));
if ($qMark && ($qMarkSvg = file_get_contents(dirname(__FILE__).'/../img/qmark'.$qMark.'.svg'))) {
$qmarkSvg = str_replace('{color}', esc_html(isset($atts['qmark_color']) ? $atts['qmark_color'] : get_theme_mod('testify_qmark_color', $testifyOptionsDefaults['qmark_color'])), $qMarkSvg);
}
?>
<ul class="slides">
<?php
$order = (isset($atts['order']) ? testify_sanitize_order($atts['order']) : get_theme_mod('testify_order', $testifyOptionsDefaults['order']));
$queryArgs = array(
'post_type' => 'testify-testimonial',
'posts_per_page' => (isset($atts['count']) ? absint($atts['count']) : get_theme_mod('testify_count', $testifyOptionsDefaults['count'])),
'orderby' => ($order == 'random' ? 'rand' : 'date')
);
if ($order == 'date_asc') {
$queryArgs['order'] = 'ASC';
}
if (!empty($atts['category'])) {
$categories = (is_array($atts['category']) ? $atts['category'] : explode(',', $atts['category']));
$queryArgs['tax_query'] = array(array(
'taxonomy' => 'testify-cat',
'field' => (is_numeric($categories[0]) ? 'term_id' : 'slug'),
'terms' => $categories
));
}
if (!empty($atts['tag'])) {
$tags = (is_array($atts['tag']) ? $atts['tag'] : explode(',', $atts['tag']));
if (isset($queryArgs['tax_query'])) {
$queryArgs['tax_query']['relation'] = 'AND';
} else {
$queryArgs['tax_query'] = array();
}
$queryArgs['tax_query'][] = array(
'taxonomy' => 'testify-tag',
'field' => (is_numeric($tags[0]) ? 'term_id' : 'slug'),
'terms' => $tags
);
}
$posts = get_posts($queryArgs);
$thumbSize = (isset($atts['thumb_width']) ? $atts['thumb_width'] : get_theme_mod('testify_thumb_width', $testifyOptionsDefaults['thumb_width']));
$thumbSize = ($thumbSize == 0 ? 'full' : array($thumbSize, $thumbSize));
if ($imageWidth || $imageWidth900 || $imageWidth600 || $imageWidth400) {
$imageSize = (isset($atts['image_size']) ? $atts['image_size'] : get_theme_mod('testify_image_size', $testifyOptionsDefaults['image_size']));
$imageSize = ($imageSize == 0 ? 'full' : array($imageSize, $imageSize));
}
$sepShow = (isset($atts['sep_show']) ? $atts['sep_show'] : get_theme_mod('testify_sep_show', $testifyOptionsDefaults['sep_show']));
?>
<?php
$i = 0;
foreach ($posts as $post) {
$authorLink = get_post_meta($post->ID, 'testimonial-author-link', true);
?>
<li class="testify-flex-slide-<?php print ((int) $i + 1); ?>" data-thumb="<?php echo( esc_url( has_post_thumbnail($post->ID) ? get_the_post_thumbnail_url( $post->ID, $thumbSize ) : plugins_url('img/thumbnail-placeholder.png', dirname(__FILE__).'/../testify.php') ) ); ?>">
<?php
if ($navType != 'thumbnails') {
if ( isset($imageSize) && has_post_thumbnail($post->ID) ) {
$attachment_id = get_post_thumbnail_id($post->ID);
$attachment_metadata = wp_get_attachment_metadata($attachment_id);
printf(
'<img class="testimonial-image wp-post-image" src="%s" alt="%s" draggable="false" width="%d" height="%d" srcset="%s">',
esc_url( get_the_post_thumbnail_url($post->ID, $thumbSize) ),
esc_attr( $attachment_metadata['image_meta']['title'] ),
(int) $attachment_metadata['width'],
(int) $attachment_metadata['height'],
esc_attr( wp_get_attachment_image_srcset($attachment_id, 'testimonial-image' ) )
);
}
}
?>
<div class="testimonial-container">
<?php if (isset($qmarkSvg)) { ?>
<div class="quotation-mark"><?php echo($qmarkSvg); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- this is SVG code loaded from a file bundled with the plugin ?></div>
<?php } ?>
<div class="testimonial-outer">
<div id="<?php print esc_attr($testify_id.'-'.$post->ID) ?>" class="testimonial<?php if ( $classes != '' ) {
print ' ' . esc_attr($classes);
} ?>"<?php if ( $dataAttrs != '' ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- data attribute values are escaped when the array is created above
print ' ' . $dataAttrs;
} ?>>
<div class="testimonial-body"><?php echo(do_shortcode( wpautop( wp_kses_post($post->post_content) ) )); ?></div>
<?php if ($sepShow) { ?><hr class="testimonial-sep" /><?php } ?>
<div class="person-name">
<p>
<?php if ( '' != $authorLink ) { ?><a href="<?php print esc_url( $authorLink, array('http', 'https', 'mailto', 'tel', 'fax') ); ?>" rel="nofollow" target="_blank" title="<?php print esc_html__('Testimonial author\'s website (opens in a new window)', 'testify-testify') ?>"><?php } ?>
<?php echo esc_html(get_post_meta($post->ID, "testimonial-author", true)); ?>
<?php if ( '' != $authorLink ) { ?></a><?php } ?>
</p>
</div>
</div>
</div>
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
<style id="testify-css-testimonial-images">
#<?php print esc_attr($testify_id) ?> .testify-flex-control-thumbs li img.testimonial-image {
margin:3px 0;
vertical-align: middle;
border-style: solid;
box-sizing: inherit;
border-width: <?php print esc_html($testimonial_image['border-width']); ?>;
border-color: <?php print esc_html($testimonial_image['border-color']); ?>;
box-shadow: <?php print esc_html($testimonial_image['box-shadow']); ?>;
border-radius: <?php print esc_html($testimonial_image['border-radius']); ?>;
}
</style>
<?php
}
}
?>