Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Commit

Permalink
Merge branch 'release/1.1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Hemberger committed Sep 15, 2017
2 parents 43ada2f + f9ef6af commit 507fd58
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 40 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
### Changelog

#### 1.1.4 (9/15/17)
* Fixed: CPT archive images would not display when using custom archive settings if Mai Content Archives images were not set to display.
* Fixed: Some default settings were getting changed when updating/saving via Genesis > Theme Settings.
* Fixed: Jumpy slider on IE11. Bumped Slick to 1.8.0.

#### 1.1.3.1 (9/14/17)
* Fixed: Header/Footer scripts getting slashed when updating settings via the Customizer.

Expand Down
7 changes: 4 additions & 3 deletions assets/js/slick-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,17 @@ jQuery(document).ready(function($) {
}

$(this).slick({
adaptiveHeight: false, // true breaks things on image-bg aspect-ratio resize
adaptiveHeight: false, // true breaks things on image-bg aspect-ratio resize.
arrows: arrows,
autoplay: autoPlay,
dots: dots,
fade: fade, // Things seem to blow up if columns is > 1
fade: fade, // Things seem to blow up if columns is > 1.
focusOnChange: false, // This is Slick default as of 1.8.0, but i want to make sure, cause if true it makes things really jumpy.
infinite: infinite,
slidesToShow: slidesToShow,
slidesToScroll: slidesToScroll,
autoplaySpeed: speed,
cssEase: fade ? 'linear' : 'ease', // Use linear if fade is true, otherwise default is ease
cssEase: fade ? 'linear' : 'ease', // Use linear if fade is true, otherwise default is ease.
responsive: [{
breakpoint: 1200,
settings: {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/slick-init.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 24 additions & 14 deletions assets/js/slick.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
|___/_|_|\___|_|\_(_)/ |___/
|__/
Version: 1.7.1
Version: 1.8.0
Author: Ken Wheeler
Website: http://kenwheeler.github.io
Docs: http://kenwheeler.github.io/slick
Expand Down Expand Up @@ -61,6 +61,7 @@
edgeFriction: 0.35,
fade: false,
focusOnSelect: false,
focusOnChange: false,
infinite: true,
initialSlide: 0,
lazyLoad: 'ondemand',
Expand Down Expand Up @@ -773,8 +774,8 @@
_.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);

if (_.options.accessibility === true) {
_.$prevArrow.off('keydown.slick', _.keyHandler);
_.$nextArrow.off('keydown.slick', _.keyHandler);
_.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler);
_.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler);
}
}

Expand Down Expand Up @@ -1079,15 +1080,25 @@
targetLeft,
verticalHeight,
verticalOffset = 0,
targetSlide;
targetSlide,
coef;

_.slideOffset = 0;
verticalHeight = _.$slides.first().outerHeight(true);

if (_.options.infinite === true) {
if (_.slideCount > _.options.slidesToShow) {
_.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
verticalOffset = (verticalHeight * _.options.slidesToShow) * -1;
coef = -1

if (_.options.vertical === true && _.options.centerMode === true) {
if (_.options.slidesToShow === 2) {
coef = -1.5;
} else if (_.options.slidesToShow === 1) {
coef = -2
}
}
verticalOffset = (verticalHeight * _.options.slidesToShow) * coef;
}
if (_.slideCount % _.options.slidesToScroll !== 0) {
if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
Expand Down Expand Up @@ -1686,12 +1697,10 @@

if (_.options.accessibility === true) {
_.initADA();
// for non-autoplay: once active slide (group) has updated, set focus on first newly showing slide
if (!_.options.autoplay) {
var $currentSlide = $(_.$slides.get(_.currentSlide));
var x = window.scrollX, y = window.scrollY;
$currentSlide.attr('tabindex', 0).focus();
window.scrollTo(x, y);

if (_.options.focusOnChange) {
var $currentSlide = $(_.$slides.get(_.currentSlide));
$currentSlide.attr('tabindex', 0).focus();
}
}

Expand Down Expand Up @@ -2287,22 +2296,23 @@

if (_.options.centerMode === true) {

var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0;

centerOffset = Math.floor(_.options.slidesToShow / 2);

if (_.options.infinite === true) {

if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {

_.$slides
.slice(index - centerOffset, index + centerOffset + 1)
.slice(index - centerOffset + evenCoef, index + centerOffset + 1)
.addClass('slick-active')
.attr('aria-hidden', 'false');

} else {

indexOffset = _.options.slidesToShow + index;
allSlides
.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2)
.slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2)
.addClass('slick-active')
.attr('aria-hidden', 'false');

Expand Down
2 changes: 1 addition & 1 deletion assets/js/slick.min.js

Large diffs are not rendered by default.

33 changes: 22 additions & 11 deletions lib/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,34 @@
*
* @return array
*/
add_filter( 'pre_update_option_genesis-settings', 'mai_enforce_custom_genesis_settings', 99, 2 );
add_filter( 'pre_update_option_genesis-settings', 'mai_enforce_custom_genesis_settings', 10, 2 );
function mai_enforce_custom_genesis_settings( $new_value, $old_value ) {

// Bail if this isn't happening from a form submission page.
if ( ! isset( $_POST ) || empty( $_POST ) ) {
return $new_value;
}

// Bail if this isn't happening on a page that's submitting a 'genesis-settings' form.
if ( ! isset( $_POST['genesis-settings'] ) || empty( $_POST['genesis-settings'] ) ) {
return $new_value;
}

// Get the submitted and existing settings values.
$values = $_POST[ 'genesis-settings' ];
$settings = get_option( 'genesis-settings' );
foreach ( (array) $settings as $setting => $value ) {

// Loop through em.
foreach ( (array) $settings as $key => $value ) {
/**
* Header/Footer scripts get wp_slash sanitization automatically, we need to unslash before that gets re-applied.
*
* @see genesis/lib/admin/theme-settings save() method.
* If a custom setting is not part of the $_POST submission,
* we need to add to the $new_value array it so it's not lost.
*/
if ( in_array( $setting, array( 'header_scripts', 'footer_scripts' ) ) ) {
$new_value[ $setting ] = wp_unslash( $value );
}
// If a custom setting is not here, we need to add it so it's not lost.
if ( ! isset( $new_value[ $setting ] ) ) {
$new_value[ $setting ] = $value;
if ( ! isset( $values[ $key ] ) ) {
$new_value[ $key ] = genesis_get_option( $key );
}
}

return $new_value;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function mai_enqueue_scripts() {
) );

// Register script for later use
wp_register_script( 'mai-slick', MAI_PRO_ENGINE_PLUGIN_URL . "assets/js/slick{$suffix}.js", array( 'jquery' ), '1.7.1', true );
wp_register_script( 'mai-slick', MAI_PRO_ENGINE_PLUGIN_URL . "assets/js/slick{$suffix}.js", array( 'jquery' ), '1.8.0', true );
wp_register_script( 'mai-slick-init', MAI_PRO_ENGINE_PLUGIN_URL . "assets/js/slick-init{$suffix}.js", array( 'mai-slick' ), MAI_PRO_ENGINE_VERSION, true );

}
Expand Down
16 changes: 9 additions & 7 deletions lib/settings/metaboxes/metaboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,13 @@ function mai_theme_settings_customizer_link( $pagehook ) {
function mai_do_theme_settings_customizer_links() {
// Mai Settings.
printf( '<p><strong>%s</strong></p>', __( 'Edit theme settings in the customizer:', 'mai-pro-engine' ) );
printf( '<p><a class="button" href="%s">%s</a></p>', mai_get_customizer_section_link( 'mai_settings' ), __( 'Mai Settings', 'mai-pro-engine' ) );
printf( '<p><a class="button" href="%s">%s</a></p>', mai_get_customizer_section_link( 'mai_banner_area' ), __( 'Mai Banner Area', 'mai-pro-engine' ) );
printf( '<p><a class="button" href="%s">%s</a></p>', mai_get_customizer_section_link( 'mai_content_archives' ), __( 'Mai Content Archives', 'mai-pro-engine' ) );
printf( '<p><a class="button" href="%s">%s</a></p>', mai_get_customizer_section_link( 'mai_content_singular' ), __( 'Mai Content Singular', 'mai-pro-engine' ) );
printf( '<p><a class="button" href="%s">%s</a></p>', mai_get_customizer_section_link( 'mai_site_layouts' ), __( 'Mai Site Layouts', 'mai-pro-engine' ) );
printf( '<p><a class="button" href="%s">%s</a></p>', mai_get_customizer_section_link( 'genesis_breadcrumbs' ), __( 'Breadcrumbs', 'mai-pro-engine' ) );
printf( '<p><a class="button" href="%s">%s</a></p>', mai_get_customizer_section_link( 'genesis_comments' ), __( 'Comments & Trackbacks', 'mai-pro-engine' ) );
echo '<p>';
printf( '<a class="button" href="%s">%s</a>&nbsp;&nbsp;', mai_get_customizer_section_link( 'mai_settings' ), __( 'Mai Settings', 'mai-pro-engine' ) );
printf( '<a class="button" href="%s">%s</a>&nbsp;&nbsp;', mai_get_customizer_section_link( 'mai_banner_area' ), __( 'Mai Banner Area', 'mai-pro-engine' ) );
printf( '<a class="button" href="%s">%s</a>&nbsp;&nbsp;', mai_get_customizer_section_link( 'mai_content_archives' ), __( 'Mai Content Archives', 'mai-pro-engine' ) );
printf( '<a class="button" href="%s">%s</a>&nbsp;&nbsp;', mai_get_customizer_section_link( 'mai_content_singular' ), __( 'Mai Content Singular', 'mai-pro-engine' ) );
printf( '<a class="button" href="%s">%s</a>&nbsp;&nbsp;', mai_get_customizer_section_link( 'mai_site_layouts' ), __( 'Mai Site Layouts', 'mai-pro-engine' ) );
printf( '<a class="button" href="%s">%s</a>&nbsp;&nbsp;', mai_get_customizer_section_link( 'genesis_breadcrumbs' ), __( 'Breadcrumbs', 'mai-pro-engine' ) );
printf( '<a class="button" href="%s">%s</a>&nbsp;&nbsp;', mai_get_customizer_section_link( 'genesis_comments' ), __( 'Comments & Trackbacks', 'mai-pro-engine' ) );
echo '</p>';
}
9 changes: 9 additions & 0 deletions lib/structure/archives.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,15 @@ function mai_do_content_archive_archive_options() {
// Add the image back, in a custom location
mai_do_archive_image( $image_location );

/**
* Content Archive Thumbnail.
* We need to force this option because genesis_do_post_image() checks if 'content_archive_thumbnail' is enabled,
* even though Mai Pro has its own requirements to display, it won't without forcing this.
*/
add_filter( 'genesis_pre_get_option_content_archive_thumbnail', function( $option ) use ( $content_archive_thumbnail ) {
return $content_archive_thumbnail;
});

// Image Size
add_filter( 'genesis_pre_get_option_image_size', function( $option ) use ( $image_size ) {
return $image_size;
Expand Down
1 change: 1 addition & 0 deletions lib/structure/singular.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function mai_woo_remove_featured_image() {
if ( ! is_product() ) {
return;
}

// Get post types to display featured image on.
$key = sprintf( 'singular_image_%s', get_post_type() );
$display = genesis_get_option( $key );
Expand Down
4 changes: 2 additions & 2 deletions mai-pro-engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Plugin URI: https://maipro.io/
* Description: The Mai Pro Engine plugin
*
* Version: 1.1.3.1
* Version: 1.1.4
*
* GitHub URI: maiprowp/mai-pro-engine
*
Expand Down Expand Up @@ -91,7 +91,7 @@ public function __wakeup() {
private function setup_constants() {

// Plugin version.
define( 'MAI_PRO_ENGINE_VERSION', '1.1.3.1' );
define( 'MAI_PRO_ENGINE_VERSION', '1.1.4' );

// DB version.
define( 'MAI_PRO_ENGINE_DB_VERSION', '1100' );
Expand Down

0 comments on commit 507fd58

Please sign in to comment.