attribute['st_quote_override_position'] ? 'quote-override' : '';
$arrow_position = 'arrow-' . esc_attr( $this->attribute['sg_setting_arrow_position'] );
$layout = esc_attr( $this->attribute['sg_layout_testimonial_choose'] );
$output =
'
' . $this->render_testimonials() . '
';
return $this->render_wrapper(
'testimonials',
$output,
array( $arrow_position, $layout, $quote_position ),
array(
'id' => $this->unique_id,
'settings' => $this->render_option(),
)
);
}
/**
* Render Testimonials
*/
private function render_testimonials() {
$testimonials = null;
$layout = $this->attribute['sg_layout_testimonial_choose'];
switch ( $layout ) {
case 'style-1':
$testimonials = $this->render_testimonials_1();
break;
case 'style-2':
$testimonials = $this->render_testimonials_2();
break;
case 'style-3':
$testimonials = $this->render_testimonials_3();
break;
case 'style-4':
$testimonials = $this->render_testimonials_4();
break;
}
return $testimonials;
}
/**
* Render Testimonials Style 1
*/
private function render_testimonials_1() {
$testimonials = '';
$height = 'yes' === $this->attribute['st_wrapper_fix_height'] ? 'fix-height' : '';
$icon = 'yes' === $this->attribute['sg_setting_quote'] ? $this->render_icon_element( $this->attribute['sg_setting_quote_icon'] ) : '';
$icon_class = 'icon-content';
$hover_direction = esc_attr( $this->attribute['st_layout_hover_direction'] );
$image_size = esc_attr( $this->attribute['sg_testimonials_image_size_imagesize_size'] );
$override_quote_position = esc_attr( $this->attribute['st_quote_override_position'] );
if ( 'gradient' === $this->attribute['st_quote_normal_background_background_background'] || 'gradient' === $this->attribute['st_quote_hover_background_background_background'] ) {
$icon_class .= ' hover-gradient';
$icon = '' . $icon . '';
}
foreach ( $this->attribute['sg_testimonials_list'] as $testimonial ) {
$client_name = esc_attr( $testimonial['sg_testimonials_list_client_name'] );
$client_designation = esc_attr( $testimonial['sg_testimonials_list_designation'] );
$client_review = esc_attr( $testimonial['sg_testimonials_list_review'] );
$id = 'elementor-repeater-item-' . esc_attr( $testimonial['_id'] );
$rating_stars = 'yes' === $this->attribute['sg_setting_rating'] ? $this->render_rating( floatval( $testimonial['sg_testimonials_list_rating']['size'] ) ) : '';
$icon_content = '' . $icon . '
';
$content = null;
$img_source = 'source-url';
if ( isset( $testimonial['sg_testimonials_list_client_avatar']['source'] ) ) {
$img_source = 'source-' . $testimonial['sg_testimonials_list_client_avatar']['source'];
}
$profile_image = $this->render_image_element( $testimonial['sg_testimonials_list_client_avatar'], $image_size, null, $img_source, esc_attr( $testimonial['sg_testimonials_list_client_name'] ) );
$comment_bio =
'';
if ( 'yes' === $override_quote_position ) {
$content = $icon_content . $comment_bio . '';
} else {
$content = $comment_bio . '';
}
$testimonials = $testimonials .
'';
}
return $testimonials;
}
/**
* Render Testimonials Style 2
*/
private function render_testimonials_2() {
$testimonials = '';
$height = 'yes' === $this->attribute['st_wrapper_fix_height'] ? 'fix-height' : '';
$icon = 'yes' === $this->attribute['sg_setting_quote'] ? $this->render_icon_element( $this->attribute['sg_setting_quote_icon'] ) : '';
$icon_class = 'icon-content';
$image_position = esc_attr( $this->attribute['sg_layout_image_position'] );
$hover_direction = esc_attr( $this->attribute['st_layout_hover_direction'] );
$image_size = esc_attr( $this->attribute['sg_testimonials_image_size_imagesize_size'] );
$override_quote_position = esc_attr( $this->attribute['st_quote_override_position'] );
if ( 'gradient' === $this->attribute['st_quote_normal_background_background_background'] || 'gradient' === $this->attribute['st_quote_hover_background_background_background'] ) {
$icon_class .= ' hover-gradient';
$icon = '' . $icon . '';
}
foreach ( $this->attribute['sg_testimonials_list'] as $testimonial ) {
$client_name = esc_attr( $testimonial['sg_testimonials_list_client_name'] );
$client_designation = esc_attr( $testimonial['sg_testimonials_list_designation'] );
$client_review = esc_attr( $testimonial['sg_testimonials_list_review'] );
$id = 'elementor-repeater-item-' . esc_attr( $testimonial['_id'] );
$rating_stars = 'yes' === $this->attribute['sg_setting_rating'] ? $this->render_rating( floatval( $testimonial['sg_testimonials_list_rating']['size'] ) ) : '';
$icon_content = '' . $icon . '
';
$content = null;
$img_source = 'source-url';
if ( isset( $testimonial['sg_testimonials_list_client_avatar']['source'] ) ) {
$img_source = 'source-' . $testimonial['sg_testimonials_list_client_avatar']['source'];
}
$profile_image = $this->render_image_element( $testimonial['sg_testimonials_list_client_avatar'], $image_size, null, $img_source, esc_attr( $testimonial['sg_testimonials_list_client_name'] ) );
$bio_details =
'
' . $profile_image . '
' . $client_name . '
' . $client_designation . '
';
if ( 'above' === $image_position ) {
$content =
'
';
} elseif ( 'yes' === $override_quote_position ) {
$content =
$icon_content . '
';
} else {
$content =
'
';
}
$testimonials = $testimonials .
'';
}
return $testimonials;
}
/**
* Render Testimonials Style 3
*/
private function render_testimonials_3() {
$testimonials = '';
$height = 'yes' === $this->attribute['st_wrapper_fix_height'] ? 'fix-height' : '';
$icon = 'yes' === $this->attribute['sg_setting_quote'] ? $this->render_icon_element( $this->attribute['sg_setting_quote_icon'] ) : '';
$icon_class = 'icon-content';
$image_position = esc_attr( $this->attribute['sg_layout_image_position'] );
$hover_direction = esc_attr( $this->attribute['st_layout_hover_direction'] );
$image_size = esc_attr( $this->attribute['sg_testimonials_image_size_imagesize_size'] );
if ( 'gradient' === $this->attribute['st_quote_normal_background_background_background'] || 'gradient' === $this->attribute['st_quote_hover_background_background_background'] ) {
$icon_class .= ' hover-gradient';
$icon = '' . $icon . '';
}
foreach ( $this->attribute['sg_testimonials_list'] as $testimonial ) {
$client_name = esc_attr( $testimonial['sg_testimonials_list_client_name'] );
$client_designation = esc_attr( $testimonial['sg_testimonials_list_designation'] );
$client_review = esc_attr( $testimonial['sg_testimonials_list_review'] );
$id = 'elementor-repeater-item-' . esc_attr( $testimonial['_id'] );
$rating_stars = 'yes' === $this->attribute['sg_setting_rating'] ? $this->render_rating( floatval( $testimonial['sg_testimonials_list_rating']['size'] ) ) : '';
$icon_content = '' . $icon . '
';
$content = null;
$img_source = 'source-url';
if ( isset( $testimonial['sg_testimonials_list_client_avatar']['source'] ) ) {
$img_source = 'source-' . $testimonial['sg_testimonials_list_client_avatar']['source'];
}
$profile_image = $this->render_image_element( $testimonial['sg_testimonials_list_client_avatar'], $image_size, null, $img_source, esc_attr( $testimonial['sg_testimonials_list_client_name'] ) );
$comment_bio =
'
';
if ( 'above' === $image_position ) {
$content = $comment_bio . '';
} else {
$content = '' . $comment_bio;
}
$testimonials = $testimonials .
'
' . $icon_content . $content . '
' . $client_name . '
' . $client_designation . '
';
}
return $testimonials;
}
/**
* Render Testimonials Style 4
*/
private function render_testimonials_4() {
$testimonials = '';
$height = 'yes' === $this->attribute['st_wrapper_fix_height'] ? 'fix-height' : '';
$icon = 'yes' === $this->attribute['sg_setting_quote'] ? $this->render_icon_element( $this->attribute['sg_setting_quote_icon'] ) : '';
$icon_class = 'icon-content';
$image_position = esc_attr( $this->attribute['sg_layout_image_position'] );
$hover_direction = esc_attr( $this->attribute['st_layout_hover_direction'] );
$image_size = esc_attr( $this->attribute['sg_testimonials_image_size_imagesize_size'] );
if ( 'gradient' === $this->attribute['st_quote_normal_background_background_background'] || 'gradient' === $this->attribute['st_quote_hover_background_background_background'] ) {
$icon_class .= ' hover-gradient';
$icon = '' . $icon . '';
}
foreach ( $this->attribute['sg_testimonials_list'] as $testimonial ) {
$client_name = esc_attr( $testimonial['sg_testimonials_list_client_name'] );
$client_designation = esc_attr( $testimonial['sg_testimonials_list_designation'] );
$client_review = esc_attr( $testimonial['sg_testimonials_list_review'] );
$id = 'elementor-repeater-item-' . esc_attr( $testimonial['_id'] );
$rating_stars = 'yes' === $this->attribute['sg_setting_rating'] ? $this->render_rating( floatval( $testimonial['sg_testimonials_list_rating']['size'] ) ) : '';
$icon_content = '' . $icon . '
';
$content = null;
$img_source = 'source-url';
if ( isset( $testimonial['sg_testimonials_list_client_avatar']['source'] ) ) {
$img_source = 'source-' . $testimonial['sg_testimonials_list_client_avatar']['source'];
}
$profile_image = $this->render_image_element( $testimonial['sg_testimonials_list_client_avatar'], $image_size, null, $img_source, esc_attr( $testimonial['sg_testimonials_list_client_name'] ) );
$comment_bio =
'';
if ( 'above' === $image_position ) {
$content = $comment_bio . '';
} else {
$content = '' . $comment_bio;
}
$testimonials = $testimonials .
'
' . $icon_content . $content . '
';
}
return $testimonials;
}
/**
* Render stars rating
*
* @param int $value Rating value.
*/
private function render_rating( $value ) {
$rating = '';
$rating_round = floor( $value );
$rating_full = $this->render_icon_element( $this->attribute['sg_setting_rating_icon_full'] );
$rating_half = $this->render_icon_element( $this->attribute['sg_setting_rating_icon_half'] );
for ( $i = 0; $i < $rating_round; $i++ ) {
$rating = $rating . '' . $rating_full . '';
}
if ( ( $value - $rating_round ) > 0 ) {
$rating = $rating . '' . $rating_half . '';
}
return $rating;
}
/**
* Render Option
*/
private function render_option() {
$default = array(
'widescreen' => array(
'items' => 3,
'margin' => 10,
),
'dekstop' => array(
'items' => 3,
'margin' => 10,
),
'laptop' => array(
'items' => 3,
'margin' => 10,
),
'tablet_extra' => array(
'items' => 3,
'margin' => 10,
),
'tablet' => array(
'items' => 2,
'margin' => 10,
),
'mobile_extra' => array(
'items' => 2,
'margin' => 10,
),
'mobile' => array(
'items' => 1,
'margin' => 10,
),
);
$nav_left = preg_replace( '~[\r\n\s]+~', ' ', $this->render_icon_element( $this->attribute['sg_setting_arrow_left'] ) );
$nav_right = preg_replace( '~[\r\n\s]+~', ' ', $this->render_icon_element( $this->attribute['sg_setting_arrow_right'] ) );
$items = ! empty( $this->attribute['sg_setting_slide_show_responsive']['size'] ) ? $this->attribute['sg_setting_slide_show_responsive']['size'] : $default['dekstop']['items'];
$margin = ! empty( $this->attribute['sg_setting_margin_responsive']['size'] ) ? $this->attribute['sg_setting_margin_responsive']['size'] : $default['dekstop']['margin'];
if ( 'gradient' === $this->attribute['st_arrow_normal_background_background_background'] || 'gradient' === $this->attribute['st_arrow_hover_background_background_background'] ) {
$icon_class = 'hover-gradient';
$nav_left = '' . $nav_left . '';
$nav_right = '' . $nav_right . '';
} else {
$nav_left = '' . $nav_left . '';
$nav_right = '' . $nav_right . '';
}
$prev_key = 'desktop';
$responsive['desktop'] = array(
'items' => $items,
'margin' => $margin,
'breakpoint' => 0,
);
foreach ( jkit_get_responsive_breakpoints() as $breakpoint ) {
$responsive[ $breakpoint['key'] ] = array(
'items' => $default[ $breakpoint['key'] ]['items'],
'margin' => $default[ $breakpoint['key'] ]['margin'],
'breakpoint' => 0,
);
$responsive[ $prev_key ]['breakpoint'] = $breakpoint['value'] + 1;
if ( isset( $this->attribute[ 'sg_setting_slide_show_responsive_' . $breakpoint['key'] ] ) ) {
$responsive[ $breakpoint['key'] ]['items'] = ! empty( $this->attribute[ 'sg_setting_slide_show_responsive_' . $breakpoint['key'] ]['size'] ) ? $this->attribute[ 'sg_setting_slide_show_responsive_' . $breakpoint['key'] ]['size'] : $responsive[ $prev_key ]['items'];
}
if ( isset( $this->attribute[ 'sg_setting_margin_responsive_' . $breakpoint['key'] ] ) ) {
$responsive[ $breakpoint['key'] ]['margin'] = ! empty( $this->attribute[ 'sg_setting_margin_responsive_' . $breakpoint['key'] ]['size'] ) ? $this->attribute[ 'sg_setting_margin_responsive_' . $breakpoint['key'] ]['size'] : $responsive[ $prev_key ]['margin'];
}
$prev_key = $breakpoint['key'];
}
$options = array(
'autoplay' => 'yes' === $this->attribute['sg_setting_autoplay'],
'autoplay_speed' => ! empty( $this->attribute['sg_setting_autoplay_speed']['size'] ) ? intval( $this->attribute['sg_setting_autoplay_speed']['size'] ) : '',
'autoplay_hover_pause' => 'yes' === $this->attribute['sg_setting_autoplay_pause'],
'show_navigation' => 'yes' === $this->attribute['sg_setting_arrow'],
'navigation_left' => $nav_left,
'navigation_right' => $nav_right,
'show_dots' => 'yes' === $this->attribute['sg_setting_dots'],
'arrow_position' => 'top-left' === $this->attribute['sg_setting_arrow_position'] || 'top-right' === $this->attribute['sg_setting_arrow_position'] ? 'top' : 'bottom',
'responsive' => $responsive,
);
return htmlspecialchars( wp_json_encode( $options ), ENT_QUOTES, 'UTF-8' );
}
}
' . $rating_stars . '
' . $client_name . '' . $client_designation . '