defaults = array(
'title' => '',
'new_tab' => 0,
'size' => 32,
'facebook' => '',
'twitter' => '',
'gplus' => '',
'youtube' => '',
'rss' => '',
'pinterest' => '',
'linkedin' => '',
'email' => '',
'stumbleupon' => '',
'reddit' => '',
'tumblr' => '',
'instagram' => '',
'vimeo' => '',
'foursquare' => '',
'soundcloud' => '',
'github' => '',
'flickr' => '',
'skype' => '',
'behance' => '',
'dribbble' => '',
'dropbox' => '',
'amazon' => '',
'apple' => '',
'snapchat' => '',
'bitbucket' => '',
'stack-overflow'=> '',
'stack-exchange'=> '',
'slack' => '',
'codepen' => '',
'digg' => '',
'deviantart' => '',
'paypal' => '',
'btc' => '',
'odnoklassniki' => '',
'vk' => '',
'whatsapp' => '',
'weixin' => '',
'vine' => '',
'weibo' => '',
'yelp' => '',
'lastfm' => '',
'steam' => '',
'twitch' => '',
);
$this->sizes = array( '32' );
$this->profiles = array(
'facebook' => array(
'label' => __( 'Facebook URI', 'elif-lite' ),
'pattern' => '
',
),
'twitter' => array(
'label' => __( 'Twitter URI', 'elif-lite' ),
'pattern' => '',
),
'gplus' => array(
'label' => __( 'Google+ URI', 'elif-lite' ),
'pattern' => '',
),
'youtube' => array(
'label' => __( 'YouTube URI', 'elif-lite' ),
'pattern' => '',
),
'rss' => array(
'label' => __( 'RSS URI', 'elif-lite' ),
'pattern' => '',
),
'pinterest' => array(
'label' => __( 'Pinterest URI', 'elif-lite' ),
'pattern' => '',
),
'linkedin' => array(
'label' => __( 'Linkedin URI', 'elif-lite' ),
'pattern' => '',
),
'email' => array(
'label' => __( 'Email URI', 'elif-lite' ),
'pattern' => '',
),
'stumbleupon' => array(
'label' => __( 'StumbleUpon URI', 'elif-lite' ),
'pattern' => '',
),
'reddit' => array(
'label' => __( 'Reddit URI', 'elif-lite' ),
'pattern' => '',
),
'tumblr' => array(
'label' => __( 'Tumblr URI', 'elif-lite' ),
'pattern' => '',
),
'instagram' => array(
'label' => __( 'Instagram URI', 'elif-lite' ),
'pattern' => '',
),
'vimeo' => array(
'label' => __( 'Vimeo URI', 'elif-lite' ),
'pattern' => '',
),
'foursquare' => array(
'label' => __( 'FourSquare URI', 'elif-lite' ),
'pattern' => '',
),
'soundcloud' => array(
'label' => __( 'Soundcloud URI', 'elif-lite' ),
'pattern' => '',
),
'github' => array(
'label' => __( 'GitHub URI', 'elif-lite' ),
'pattern' => '',
),
'flickr' => array(
'label' => __( 'Flickr URI', 'elif-lite' ),
'pattern' => '',
),
'skype' => array(
'label' => __( 'Skype URI', 'elif-lite' ),
'pattern' => '',
),
'behance' => array(
'label' => __( 'Behance URI', 'elif-lite' ),
'pattern' => '',
),
'dribbble' => array(
'label' => __( 'Dribbble URI', 'elif-lite' ),
'pattern' => '',
),
'dropbox' => array(
'label' => __( 'Dropbox URI', 'elif-lite' ),
'pattern' => '',
),
'amazon' => array(
'label' => __( 'Amazon URI', 'elif-lite' ),
'pattern' => '',
),
'apple' => array(
'label' => __( 'Apple URI', 'elif-lite' ),
'pattern' => '',
),
'snapchat' => array(
'label' => __( 'Snapchat URI', 'elif-lite' ),
'pattern' => '',
),
'bitbucket' => array(
'label' => __( 'Bitbucket URI', 'elif-lite' ),
'pattern' => '',
),
'stack-overflow' => array(
'label' => __( 'Stack Overflow URI', 'elif-lite' ),
'pattern' => '',
),
'stack-exchange' => array(
'label' => __( 'Stack Exchange URI', 'elif-lite' ),
'pattern' => '',
),
'slack' => array(
'label' => __( 'Slack URI', 'elif-lite' ),
'pattern' => '',
),
'codepen' => array(
'label' => __( 'CodePen URI', 'elif-lite' ),
'pattern' => '',
),
'digg' => array(
'label' => __( 'Digg URI', 'elif-lite' ),
'pattern' => '',
),
'deviantart' => array(
'label' => __( 'Deviantart URI', 'elif-lite' ),
'pattern' => '',
),
'paypal' => array(
'label' => __( 'PayPal URI', 'elif-lite' ),
'pattern' => '',
),
'btc' => array(
'label' => __( 'Bitcoin URI', 'elif-lite' ),
'pattern' => '',
),
'odnoklassniki' => array(
'label' => __( 'Odnoklassniki URI', 'elif-lite' ),
'pattern' => '',
),
'vk' => array(
'label' => __( 'Vk URI', 'elif-lite' ),
'pattern' => '',
),
'whatsapp' => array(
'label' => __( 'Whatsapp URI', 'elif-lite' ),
'pattern' => '',
),
'weixin' => array(
'label' => __( 'Weixin URI', 'elif-lite' ),
'pattern' => '',
),
'vine' => array(
'label' => __( 'Vine URI', 'elif-lite' ),
'pattern' => '',
),
'weibo' => array(
'label' => __( 'Weibo URI', 'elif-lite' ),
'pattern' => '',
),
'yelp' => array(
'label' => __( 'Yelp URI', 'elif-lite' ),
'pattern' => '',
),
'lastfm' => array(
'label' => __( 'lastFM URI', 'elif-lite' ),
'pattern' => '',
),
'steam' => array(
'label' => __( 'Steam URI', 'elif-lite' ),
'pattern' => '',
),
'twitch' => array(
'label' => __( 'Twitch URI', 'elif-lite' ),
'pattern' => '',
),
);
$widget_ops = array(
'classname' => 'elif_social_icons_widget',
'description' => __( 'Show social icons.', 'elif-lite' ),
);
$control_ops = array(
'id_base' => 'social-icons',
#'width' => 505,
#'height' => 350,
);
parent::__construct ( 'social-icons', __( 'Themient: Social Icons', 'elif-lite' ), $widget_ops, $control_ops );
}
function form( $instance ) {
/** Merge with defaults */
$instance = wp_parse_args( (array) $instance, $this->defaults );
?>
profiles as $profile => $data ) {
printf( '', esc_attr( $this->get_field_id( $profile ) ), esc_attr( $data['label'] ) );
printf( '
', esc_attr( $this->get_field_id( $profile ) ), esc_attr( $this->get_field_name( $profile ) ), esc_url( $instance[$profile] ) );
}
}
function update( $newinstance, $oldinstance ) {
foreach ( $newinstance as $key => $value ) {
/** Sanitize Profile URIs */
if ( array_key_exists( $key, (array) $this->profiles ) ) {
$newinstance[$key] = esc_url( $newinstance[$key] );
}
}
return $newinstance;
}
function widget( $args, $instance ) {
extract( $args );
/** Merge with defaults */
$instance = wp_parse_args( (array) $instance, $this->defaults );
echo $before_widget;
if ( ! empty( $instance['title'] ) )
echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
$output = '';
$new_tab = $instance['new_tab'] ? 'target="_blank"' : '';
foreach ( (array) $this->profiles as $profile => $data ) {
if ( ! empty( $instance[$profile] ) )
$output .= sprintf( $data['pattern'], esc_url( $instance[$profile] ), $new_tab );
}
if ( $output )
printf( '', '', $output );
echo $after_widget;
}
}
add_action( 'widgets_init', create_function( '', 'register_widget( "elif_social_icons_widget" );' ) );