*/ private static function core_defaults() { $defaults = AHA_Hero_Slider_Settings::get_instance()->get_settings(); $def_speed = isset( $defaults['shortcode_autoplay_speed'] ) ? (string) (int) $defaults['shortcode_autoplay_speed'] : '5000'; $def_arrows = ! empty( $defaults['shortcode_show_arrows'] ) ? 'yes' : 'no'; $def_radius = isset( $defaults['shortcode_border_radius'] ) ? (string) absint( $defaults['shortcode_border_radius'] ) : '0'; return array( 'id' => '', 'autoplay_speed' => $def_speed, 'arrows' => $def_arrows, 'radius' => $def_radius, 'transition' => 'slide', 'infinite' => 'yes', 'progress' => '', 'title_tag' => 'h2', 'progress_track' => '', 'progress_fill' => '', 'arrow_bg' => '', 'arrow_icon' => '', 'bullet' => '', 'bullet_active' => '', 'overlay' => '', 'overlay_color' => '', 'overlay_opacity' => '', 'group' => '', ); } /** * Merged default attribute keys/values for shortcode_atts(). * * Extensions may add keys (with safe defaults). Unknown keys in user input are * still merged by WordPress when listed here. * * @since 1.0.0 * * @return array */ public static function get_defaults() { /** * Filter default [aha_hero_slider] attribute keys and values. * * Add-ons register extra keys so `shortcode_atts()` keeps user-supplied values. * Use conservative defaults (e.g. empty string) for keys the core plugin does not read. * * @since 1.0.0 * * @param array $defaults Merged defaults passed to shortcode_atts(). */ return apply_filters( 'aha_hero_slider_shortcode_attribute_defaults', self::core_defaults() ); } /** * Parse and normalize raw shortcode attributes against defaults. * * @since 1.0.0 * * @param array|string $atts Raw attributes from the shortcode tag. * @return array */ public static function parse( $atts ) { $atts = shortcode_atts( self::get_defaults(), $atts, 'aha_hero_slider' ); /** * Filter parsed shortcode attributes (after shortcode_atts). * * @since 1.0.0 * * @param array $atts Parsed attributes. */ return apply_filters( 'aha_hero_slider_shortcode_parsed_atts', $atts ); } }