'', 'style' => '', 'size' => '', 'show_title' => 'true', 'title_text' => '', 'title_style' => '', 'show_icons' => '', 'icon_style' => '', 'ai_title' => '', 'social_title' => '', ), $atts, 'ayudawp_share_buttons' ); $options = get_option( 'ayudawp_aiss_options' ); // Override options with shortcode attributes. $shortcode_options = $options; // Handle buttons parameter. if ( ! empty( $atts['buttons'] ) ) { $enabled_buttons = array_map( 'trim', explode( ',', $atts['buttons'] ) ); } else { $enabled_buttons = isset( $options['enabled_buttons'] ) ? $options['enabled_buttons'] : array(); } if ( empty( $enabled_buttons ) || ! is_array( $enabled_buttons ) ) { return ''; } // Handle style parameter. if ( ! empty( $atts['style'] ) ) { $shortcode_options['button_colors'] = sanitize_text_field( $atts['style'] ); } // Handle size parameter (v1.6.0). if ( ! empty( $atts['size'] ) ) { $shortcode_options['button_size'] = sanitize_text_field( $atts['size'] ); } // Handle title parameters. if ( ! empty( $atts['title_text'] ) ) { $shortcode_options['title_text'] = $atts['title_text']; } if ( ! empty( $atts['title_style'] ) ) { $shortcode_options['title_style'] = $atts['title_style']; } // Handle show_title parameter. if ( 'false' === $atts['show_title'] ) { $shortcode_options['title_text'] = ''; } // Handle icons parameters. if ( ! empty( $atts['show_icons'] ) ) { $shortcode_options['show_icons'] = ( 'true' === $atts['show_icons'] ); } if ( ! empty( $atts['icon_style'] ) ) { $shortcode_options['icon_style'] = $atts['icon_style']; } // Handle section titles (v1.6.0). if ( ! empty( $atts['ai_title'] ) ) { $shortcode_options['_sc_ai_title'] = sanitize_text_field( $atts['ai_title'] ); } if ( ! empty( $atts['social_title'] ) ) { $shortcode_options['_sc_social_title'] = sanitize_text_field( $atts['social_title'] ); } $current_url = get_permalink(); $current_title = get_the_title(); $html = AyudaWP_AISS_Buttons::ayudawp_generate_buttons_html( $enabled_buttons, $shortcode_options, $current_url, $current_title ); // Add shortcode-specific class. $html = str_replace( 'class="ayudawp-share-buttons', 'class="ayudawp-share-buttons shortcode-buttons', $html ); return $html; } }