public function shortcode_list($atts, $content = null) { extract(shortcode_atts(array('style' => '1', 'dividers' => '1'), $atts)); $style = in_array($style, array('1', '2', '3')) ? $style : '1'; $dividers = apply_filters('dt_sanitize_flag', $dividers); $classes = array(); $tag = 'ul'; switch ($style) { case '2': $classes[] = 'standard-number-list'; $tag = 'ol'; break; case '3': $classes[] = 'image-arrow'; break; default: $classes[] = 'standard-arrow'; } if ($dividers) { $classes[] = 'list-divider'; } $classes = implode(' ', $classes); // store atts $atts_backup = self::$atts; // change atts self::$atts = array('style' => $style, 'dividers' => $dividers); $output = sprintf('<%1$s class="%2$s">%3$s</%1$s>', $tag, esc_attr($classes), do_shortcode(shortcode_unautop($content))); // restore atts self::$atts = $atts_backup; return $output; }
public function shortcode_list($atts, $content = null) { extract(shortcode_atts(array('style' => '1', 'dividers' => '1', 'bullet_position' => 'middle', 'start' => '1'), $atts)); $style = in_array($style, array('1', '2', '3')) ? $style : '1'; $bullet_position = in_array($bullet_position, array('top', 'middle')) ? $bullet_position : 'middle'; $dividers = apply_filters('dt_sanitize_flag', $dividers); $start = intval($start); $classes = array(); $tag = 'ul'; $attributes = ''; switch ($style) { case '2': $classes[] = 'standard-number-list'; $tag = 'ol'; $attributes .= ' style="counter-reset: my-badass-counter ' . ($start - 1) . ';"'; break; case '3': $classes[] = 'image-arrow'; break; default: $classes[] = 'standard-arrow'; } if ($dividers) { $classes[] = 'list-divider'; } if ('top' == $bullet_position) { $classes[] = 'bullet-top'; } $classes = implode(' ', $classes); // store atts $atts_backup = self::$atts; // change atts self::$atts = array('style' => $style, 'dividers' => $dividers); $output = sprintf('<%1$s%4$s class="%2$s">%3$s</%1$s>', $tag, esc_attr($classes), do_shortcode(shortcode_unautop($content)), $attributes); // restore atts self::$atts = $atts_backup; return $output; }