';
$social_links = us_config( 'social_links' );
// Decoding items in case it is shortcode
if ( ! empty( $items ) AND ! is_array( $items ) ) {
$items = json_decode( urldecode( $items ), TRUE );
if ( ! is_array( $items ) ) {
$items = array();
}
} elseif ( empty( $items ) OR ! is_array( $items ) ) {
$items = array();
}
foreach ( $items as $index => $item ) {
$social_title = ( isset( $social_links[ $item['type'] ] ) ) ? $social_links[ $item['type'] ] : $item['type'];
$social_url = ( isset( $item['url'] ) ) ? $item['url'] : '';
$social_target = $social_icon = $social_custom_bg = $social_custom_color = '';
// Custom type
if ( $item['type'] == 'custom' ) {
$social_title = ( ! empty( $item['title'] ) ) ? $item['title'] : us_translate( 'Title' );
$social_url = esc_url( $social_url );
$social_target = ' target="_blank"';
if ( isset( $item['icon'] ) ) {
$social_icon = us_prepare_icon_tag( $item['icon'] );
}
$social_custom_bg = us_prepare_inline_css(
array(
'background' => $item['color'],
)
);
$social_custom_color = us_prepare_inline_css(
array(
'color' => $item['color'],
)
);
// Email type
} elseif ( $item['type'] == 'email' ) {
if ( filter_var( $social_url, FILTER_VALIDATE_EMAIL ) ) {
$social_url = 'mailto:' . $social_url;
}
// Skype type
} elseif ( $item['type'] == 'skype' ) {
if ( strpos( $social_url, ':' ) === FALSE ) {
$social_url = 'skype:' . esc_attr( $social_url );
}
// All others types
} else {
$social_url = esc_url( $social_url );
$social_target = ' target="_blank"';
}
$output .= '
';
}
$output .= '