Skip to content

Commit

Permalink
Merge branch 'release/1.38.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Jul 20, 2022
2 parents cce12e7 + a8573a3 commit 1381ff9
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 14 deletions.
12 changes: 10 additions & 2 deletions js/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ jQuery( function ( $ ) {
numItems = $items.find( '.sow-carousel-item' ).length,
complete = numItems >= $$.data( 'item_count' ),
numVisibleItems = Math.ceil( $items.outerWidth() / $items.find( '.sow-carousel-item' ).outerWidth( true ) ),
numVisibleItemsFloor = Math.floor( $items.outerWidth() / $items.find( '.sow-carousel-item' ).outerWidth( true ) ),
slidesToScroll = $items.slick( 'slickGetOption', 'slidesToScroll' ),
lastPosition = numItems - numVisibleItems,
loading = false;
Expand Down Expand Up @@ -162,12 +163,19 @@ jQuery( function ( $ ) {
if ( $$.data( 'carousel_settings' ).loop ) {
$items.slick( 'slickGoTo', 0 );
}
// Check if the number of slides to scroll exceeds lastPosition, go to the last slide.
// If the total number of slides is higher than the number of visible items, go to the last item.
} else if ( slidesToScroll >= numVisibleItemsFloor ) {
// There's more slides than items, update Slick settings to allow for scrolling of partially visible items.
$items.slick( 'slickSetOption', 'slidesToShow', numVisibleItemsFloor );
$items.slick( 'slickSetOption', 'slidesToScroll', numVisibleItemsFloor );
$items.slick( 'slickNext' );
// Check if the number of slides to scroll exceeds lastPosition, go to the last slide, or
} else if ( $items.slick( 'slickCurrentSlide' ) + slidesToScroll > lastPosition ) {
$items.setSlideTo( lastPosition );
} else {
$items.slick( 'slickNext' );
}

} else if ( $( this ).hasClass( 'sow-carousel-previous' ) ) {
if ( $$.data( 'carousel_settings' ).loop && $items.slick( 'slickCurrentSlide' ) == 0 ) {
$items.slick( 'slickGoTo', lastPosition );
Expand Down Expand Up @@ -292,7 +300,7 @@ jQuery( function ( $ ) {
$( '.sow-carousel-wrapper' ).each( function() {
var currentCarousel = $( this ),
$items = currentCarousel.find( '.sow-carousel-items.slick-initialized' ),
numVisibleItems = Math.ceil( $items.outerWidth() / $items.find( '.sow-carousel-item' ).outerWidth( true ) ),
numVisibleItems = Math.floor( $items.outerWidth() / $items.find( '.sow-carousel-item' ).outerWidth( true ) ),
navigation = currentCarousel.parent().parent().find( '.sow-carousel-navigation' );

if ( numVisibleItems >= currentCarousel.data( 'item_count' ) ) {
Expand Down
5 changes: 5 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ The Widgets Bundle global interface is available at Plugins > SiteOrigin Widgets

== Changelog ==

= 1.38.1 - 20 July 2022 =
* Contact Form: Resolved a notice if Name and Message fields aren't included.
* Post Carousel: Improved partially visible posts navigation.
* Social Media Buttons: Resolved Email network dissociation on edit and save.

= 1.38.0 - 14 July 2022 =
* Anything Carousel: Added `Adaptive Height` setting.
* Hero: Prevented padding reset on mobile if mobile values are empty.
Expand Down
41 changes: 30 additions & 11 deletions widgets/contact/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -1462,17 +1462,36 @@ function spam_check( $post_vars, $email_fields, $instance ) {
}

function send_mail( $email_fields, $instance ) {
$body = '<strong>' . _x( 'From', 'The name of who sent this email', 'so-widgets-bundle' ) . ':</strong> ' .
'<a href="mailto:' . sanitize_email( $email_fields['email'] ) . '">' . esc_html( $email_fields['name'] ) . '</a> ' .
'&#60;' . sanitize_email( $email_fields['email'] ) . '&#62; ' .
( ! empty( $instance['settings']['log_ip_address'] ) ? '( ' . $_SERVER['REMOTE_ADDR'] . ' )' : '' ) .
"\n\n";
foreach ( $email_fields['message'] as $m ) {
$body .= '<strong>' . $m['label'] . ':</strong>';
$body .= "\n";
$body .= htmlspecialchars( $m['value'] );
if ( ! empty( $email_fields['name'] ) || ! empty( $email_fields['email'] ) ) {

$body = '<strong>' . _x( 'From', 'The name of who sent this email', 'so-widgets-bundle' ) . ':</strong> ';

if ( ! empty( $email_fields['email'] ) ) {
$body .= '<a href="mailto:' . sanitize_email( $email_fields['email'] ) . '">';
}

if ( ! empty( $email_fields['name'] ) ) {
$body .= esc_html( $email_fields['name'] ) . ' ';
}

if ( ! empty( $email_fields['email'] ) ) {
$body .= '&#60;' . sanitize_email( $email_fields['email'] ) . '&#62; </a> ';
}

if ( ! empty( $instance['settings']['log_ip_address'] ) ) {
$body .= '( ' . $_SERVER['REMOTE_ADDR'] . ' )';
}
$body .= "\n\n";
}

if ( ! empty( $email_fields['message'] ) ) {
foreach ( $email_fields['message'] as $m ) {
$body .= '<strong>' . $m['label'] . ':</strong>';
$body .= "\n";
$body .= htmlspecialchars( $m['value'] );
$body .= "\n\n";
}
}
$body = wpautop( trim( $body ) );

if ( $this->is_dev_email($instance['settings']['to']) || empty( $instance['settings']['to'] ) ) {
Expand All @@ -1491,8 +1510,8 @@ function send_mail( $email_fields, $instance ) {

$headers = array(
'Content-Type: text/html; charset=UTF-8',
'From: ' . $this->sanitize_header( $email_fields['name'] ) . ' <' . sanitize_email( $instance['settings']['from'] ) . '>',
'Reply-To: ' . $this->sanitize_header( $email_fields['name'] ) . ' <' . sanitize_email( $email_fields['email'] ) . '>',
'From: ' . ( ! empty( $email_fields['name'] ) ? $this->sanitize_header( $email_fields['name'] ) : '' ) . ' <' . sanitize_email( $instance['settings']['from'] ) . '>',
'Reply-To: ' . ( ! empty( $email_fields['name'] ) ? $this->sanitize_header( $email_fields['name'] ) : '' ) . ' <' . sanitize_email( $email_fields['email'] ) . '>',
);

// Check if this is a duplicated send
Expand Down
2 changes: 1 addition & 1 deletion widgets/social-media-buttons/data/networks.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'icon_color' => '#FFFFFF',
'button_color' => '#FAA21B'
),
'email' => array(
'envelope' => array(
'label' => __( 'Email', 'so-widgets-bundle' ),
'base_url' => 'mailto:',
'icon_color' => '#FFFFFF',
Expand Down

0 comments on commit 1381ff9

Please sign in to comment.