get_setting('width'); $options["animation"] = "'slide'"; $options["direction"] = "'horizontal'"; $options["minItems"] = 1; $options["itemMargin"] = apply_filters('metaslider_carousel_margin', $this->get_setting('carouselMargin'), $slider_id); } unset($options["carouselMode"]); } // we don't want this filter hanging around if there's more than one slideshow on the page remove_filter('metaslider_flex_slider_parameters', array( $this, 'enable_carousel_mode' ), 10, 2); return $options; } /** * Ensure CSS transitions are disabled when easing is enabled. * * @param array $options Slider options * @param integer $slider_id Slider ID * @return array $options */ public function manage_easing($options, $slider_id) { if ($options["animation"] == '"fade"') { unset($options['easing']); } if (isset($options["easing"]) && $options["easing"] != '"linear"') { $options['useCSS'] = 'false'; } // we don't want this filter hanging around if there's more than one slideshow on the page remove_filter('metaslider_flex_slider_parameters', array( $this, 'manage_easing' ), 10, 2); return $options; } /** * Add a 'nav-hidden' class to slideshows where the navigation is hidde * * @param string $class Slider class * @param int $id Slider ID * @param array $settings Slider Settings * @return string */ public function remove_bottom_margin($class, $id, $settings) { if (isset($settings["navigation"]) && 'false' == $settings['navigation']) { return $class .= " nav-hidden"; } // We don't want this filter hanging around if there's more than one slideshow on the page remove_filter('metaslider_css_classes', array($this, 'remove_bottom_margin' ), 12); return $class; } /** * Return css to ensure our slides are rendered correctly in the carousel * * @param string $css Css * @param array $settings Css settings * @param integer $slider_id SliderID * @return string $css */ public function get_carousel_css($css, $settings, $slider_id) { if (isset($settings["carouselMode"]) && $settings['carouselMode'] == 'true') { $margin = apply_filters('metaslider_carousel_margin', $this->get_setting('carouselMargin'), $slider_id); $css .= "\n #metaslider_{$slider_id}.flexslider .slides li {margin-right: {$margin}px !important;}"; } // we don't want this filter hanging around if there's more than one slideshow on the page remove_filter('metaslider_css', array( $this, 'get_carousel_css' ), 11, 3); return $css; } /** * Enable the parameters that are accepted by the slider * * @param string $param Parameters * @return array|boolean enabled parameters (false if parameter doesn't exist) */ protected function get_param($param) { $params = array( 'effect' => 'animation', 'direction' => 'direction', 'prevText' => 'prevText', 'nextText' => 'nextText', 'delay' => 'slideshowSpeed', 'animationSpeed' => 'animationSpeed', 'hoverPause' => 'pauseOnHover', 'reverse' => 'reverse', 'navigation' => 'controlNav', 'links' => 'directionNav', 'carouselMode' => 'carouselMode', 'easing' => 'easing', 'autoPlay' => 'slideshow', 'firstSlideFadeIn' => 'fadeFirstSlide' ); return isset($params[$param]) ? $params[$param] : false; } /** * Include slider assets */ public function enqueue_scripts() { parent::enqueue_scripts(); if ($this->get_setting('printJs') == 'true' && ( $this->get_setting('effect') == 'slide' || $this->get_setting('carouselMode') == 'true' )) { wp_enqueue_script('metaslider-easing', METASLIDER_ASSETS_URL . 'easing/jQuery.easing.min.js', array( 'jquery' ), METASLIDER_ASSETS_VERSION); } } /** * Build the HTML for a slider. * * @return string slider markup. */ protected function get_html() { $class = $this->get_setting('noConflict') == 'true' ? "" : ' class="flexslider"'; $return_value = '