diff --git a/social-network-widget-register.php b/social-network-widget-register.php
index 0234750..6eb30c4 100644
--- a/social-network-widget-register.php
+++ b/social-network-widget-register.php
@@ -85,6 +85,7 @@ public function render_admin_js() {
* @return void
*/
public function widget( $args, $instance ) {
+ $i = 0;
$html = array();
$instance = wp_parse_args( (array) $instance, $this->defaults );
$instance['title'] = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
@@ -100,14 +101,14 @@ public function widget( $args, $instance ) {
$html['ul_open'] = '
';
foreach ( $instance['icons'] as $icon ) {
if ( ! empty( $icon['url'] ) ) {
- $html['li_open'] = '- ';
- $html['link_open'] = sprintf( '%s', esc_url( $icon['url'], array( 'http', 'https', 'mailto', 'skype' ) ), sanitize_title( $icon['label'] ), $get_target ? '_blank' : '_self', $get_target ? 'noopener noreferrer nofollow' : '', implode( '', $get_colors ) );
+ $html[sprintf( 'li_open_%d', $i )] = '
- ';
+ $html[sprintf( 'link_open_%d', $i )] = sprintf( '', esc_url( $icon['url'], array( 'http', 'https', 'mailto', 'skype' ) ), $get_target ? '_blank' : '_self', $get_target ? 'noopener noreferrer nofollow' : '', implode( '', $get_colors ) );
$found_icon = false;
foreach ( $social_icons as $social_icon ) {
foreach ( $social_icon['url'] as $url_fragment ) {
if ( false !== stripos( $icon['url'], $url_fragment ) ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- $html['link_label'] = sprintf( '%s%s', esc_attr( $social_icon['label'] ), $social_icon['icon'] );
+ $html[sprintf( 'link_label_%d', $i )] = sprintf( '%s%s', esc_attr( $social_icon['label'] ), $social_icon['icon'] );
$found_icon = true;
break;
}
@@ -115,11 +116,12 @@ public function widget( $args, $instance ) {
}
if ( ! $found_icon ) {
- $html['fallback_icon'] = self::get_default_icon();
+ $html[sprintf( 'fallback_icon_%d', $i )] = self::get_default_icon();
}
- $html['link_close'] = '';
+ $html[sprintf( 'link_close_%d', $i )] = '';
}
+ $i++;
}
$html['ul_close'] = '
';
}