Permalink
Browse files

Widgets: added Google+ to social widget icons.

Props to @brendancarr for proposing the original PR.
  • Loading branch information...
zinigor committed Oct 21, 2015
1 parent 02d1791 commit 03be982304168dfb49158e9967eba6e73e143167
Showing with 12 additions and 2 deletions.
  1. +12 −2 modules/widgets/social-media-icons.php
@@ -31,6 +31,7 @@ public function __construct() {
'github_username' => '',
'youtube_username' => '',
'vimeo_username' => '',
'googleplus_username' => '',
);
$this->services = array(
@@ -42,6 +43,7 @@ public function __construct() {
'github' => array( 'GitHub', 'https://github.com/%s/' ),
'youtube' => array( 'YouTube', 'https://www.youtube.com/%s/' ),
'vimeo' => array( 'Vimeo', 'https://vimeo.com/%s/' ),
'googleplus' => array( 'Google+', 'https://plus.google.com/u/0/%s/' ),
);
if ( is_active_widget( false, false, $this->id_base ) ) {
@@ -88,7 +90,15 @@ public function widget( $args, $instance ) {
continue;
}
$index += 10;
$username = $instance[ $service . '_username' ];
$username = $link_username = $instance[ $service . '_username' ];
if (
$service === 'googleplus'
&& ! is_numeric( $username )
&& substr( $username, 0, 1 ) !== "+"
) {
$link_username = "+" . $username;
}
/**
* Fires for each profile link in the social icons widget. Can be used
@@ -101,7 +111,7 @@ public function widget( $args, $instance ) {
* @param string $url the currently processed URL
* @param string $service the lowercase service slug, e.g. 'facebook', 'youtube', etc.
*/
$link = apply_filters( 'jetpack_social_media_icons_widget_profile_link', esc_url( sprintf( $url, $username ) ), $service );
$link = apply_filters( 'jetpack_social_media_icons_widget_profile_link', esc_url( sprintf( $url, $link_username ) ), $service );
$html[ $index ] =
'<a title="' . sprintf( $alt_text, esc_attr( $username ), $service_name )

0 comments on commit 03be982

Please sign in to comment.