atts_orig = $atts; self::set_default_parameters(); self::set_parameters( $atts ); } /** ---------------------------------------------------------------------------- * function set_default_parameters() * sets default/failsafe options for shortcode parameters * --------------------------------------------------------------------------*/ protected function set_default_parameters() { $this->parameters = array( 'post_type' => 'powerslider', 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC', ); } /** ---------------------------------------------------------------------------- * function set_parameters( $atts ) * Parses through shortcode options passed in $atts, and adds query * parameters to $parameters member variable * ---------------------------------------------------------------------------- * * @param Array $atts - options passed from the shortcode through * the PowerSlider_Shortcode instance. */ protected function set_parameters( $atts ) { if ( isset( $atts['powersliderid'] ) ) { $powerslider_ids = explode( ',', sanitize_text_field( $atts['powersliderid'] ) ); $this->parameters['post__in'] = $powerslider_ids; unset( $this->atts_orig['powersliderid'] ); } if ( isset( $atts['powersliderslug'] ) ) { $this->parameters['name'] = $atts['powersliderslug']; unset( $this->atts_orig['powersliderslug'] ); } if ( isset( $atts['powerslidername'] ) ) { $this->parameters['title'] = $atts['powerslidername']; unset( $this->atts_orig['powerslidername'] ); } } /** ---------------------------------------------------------------------------- * function output_powerslider() * Queries the database for slides based on data in the parameters array * does a have_posts() loop with a shortcode template * and concantenates and returns $output * --------------------------------------------------------------------------*/ public function output_powerslider() { $powersliders = new WP_Query( $this->parameters ); if ( $powersliders->have_posts() ) { $powersliders->the_post(); global $post; $cur_powerslider_id = $post->ID; echo "\r\n"; echo '
' . "\r\n"; echo '
' . "\r\n"; echo '
' . "\r\n"; $powerslides = new Add_PowerSlides( $this->atts_orig ); echo ( wp_kses_post( $powerslides->output_customposts() ) ); echo '
' . "\r\n"; echo '
' . "\r\n"; echo '
' . "\r\n"; $autoplay = false; $autoplay_speed = false; $arrows = false; $centermode = false; $centerpadding = false; $dots = false; $draggable = false; $fade = false; $infinite = false; $pauseonfocus = false; $pauseonhover = false; $pauseondotshover = false; $script = false; $style = false; $slidestoshow = false; $slidestoscroll = false; $speed = false; $swipe = false; $swipetoslide = false; $touchmove = false; $vertical = false; $custom = get_post_custom( $cur_powerslider_id ); if ( $custom ) { if ( isset( $custom['autoplay'][0] ) ) { $autoplay = $custom['autoplay'][0]; } if ( isset( $custom['autoplay_speed'][0] ) ) { $autoplay_speed = $custom['autoplay_speed'][0]; } if ( isset( $custom['arrows'][0] ) ) { $arrows = $custom['arrows'][0]; } if ( isset( $custom['centermode'][0] ) ) { $centermode = $custom['centermode'][0]; } if ( isset( $custom['centerpadding'][0] ) ) { $centerpadding = $custom['centerpadding'][0]; } if ( isset( $custom['dots'][0] ) ) { $dots = $custom['dots'][0]; } if ( isset( $custom['draggable'][0] ) ) { $draggable = $custom['draggable'][0]; } if ( isset( $custom['fade'][0] ) ) { $fade = $custom['fade'][0]; } if ( isset( $custom['infinite'][0] ) ) { $infinite = $custom['infinite'][0]; } if ( isset( $custom['pauseonfocus'][0] ) ) { $pauseonfocus = $custom['pauseonfocus'][0]; } if ( isset( $custom['pauseonhover'][0] ) ) { $pauseonhover = $custom['pauseonhover'][0]; } if ( isset( $custom['pauseondotshover'][0] ) ) { $pauseondotshover = $custom['pauseondotshover'][0]; } if ( isset( $custom['script'][0] ) ) { $script = $custom['script'][0]; } if ( isset( $custom['style'][0] ) ) { $style = $custom['style'][0]; } if ( isset( $custom['slidestoshow'][0] ) ) { $slidestoshow = $custom['slidestoshow'][0]; } if ( isset( $custom['slidestoscroll'][0] ) ) { $slidestoscroll = $custom['slidestoscroll'][0]; } if ( isset( $custom['speed'][0] ) ) { $speed = $custom['speed'][0]; } if ( isset( $custom['swipe'][0] ) ) { $swipe = $custom['swipe'][0]; } if ( isset( $custom['swipetoslide'][0] ) ) { $swipetoslide = $custom['swipetoslide'][0]; } if ( isset( $custom['touchmove'][0] ) ) { $touchmove = $custom['touchmove'][0]; } if ( isset( $custom['vertical'][0] ) ) { $vertical = $custom['vertical'][0]; } } echo '' . "\r\n"; if ( $style ) { echo '' . "\r\n"; } } else { echo '
' . "\r\n"; } } }