File: /hosting/kak.bg/web/wp-content/themes/Primero/widgets/social-widget.php
<?php
add_action('widgets_init', 'social_load_widgets');
function social_load_widgets()
{
register_widget('Social_Widget');
}
class Social_Widget extends WP_Widget {
function Social_Widget()
{
$widget_ops = array('classname' => 'social', 'description' => 'Social Widget');
$control_ops = array('id_base' => 'social-widget');
$this->WP_Widget('social-widget', 'Primero: Social Widget', $widget_ops, $control_ops);
}
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$description = $instance['description'];
echo $before_widget;
if($title) {
echo $before_title.$title.$after_title;
} ?>
<p><?php echo $description; ?></p>
<div class="social-icons">
<?php if(of_get_option('twitter_id')): ?>
<a href="<?php echo of_get_option('twitter_id'); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/social-icons/twitter.png" alt="" class="transparent" /></a>
<?php endif; ?>
<?php if(of_get_option('facebook_link')): ?>
<a href="<?php echo of_get_option('facebook_link'); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/social-icons/facebook.png" alt="" class="transparent" /></a>
<?php endif; ?>
<?php if(of_get_option('tumblr_link')): ?>
<a href="<?php echo of_get_option('tumblr_link'); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/social-icons/tumblr.png" alt="" class="transparent" /></a>
<?php endif; ?>
<?php if(of_get_option('dribbble_link')): ?>
<a href="<?php echo of_get_option('dribbble_link'); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/social-icons/dribbble.png" alt="" class="transparent" /></a>
<?php endif; ?>
<?php if(of_get_option('skype_id')): ?>
<a href="<?php echo of_get_option('skype_id'); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/social-icons/skype.png" alt="" class="transparent" /></a>
<?php endif; ?>
<?php if(of_get_option('vimeo_channel')): ?>
<a href="<?php echo of_get_option('vimeo_channel'); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/social-icons/vimeo.png" alt="" class="transparent" /></a>
<?php endif; ?>
<?php if(of_get_option('youtube_channel')): ?>
<a href="<?php echo of_get_option('youtube_channel'); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/social-icons/youtube.png" alt="" class="transparent" /></a>
<?php endif; ?>
<?php if(of_get_option('email_address')): ?>
<a href="mailto:<?php echo of_get_option('email_address'); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/social-icons/email.png" alt="" class="transparent" /></a>
<?php endif; ?>
</div>
<?php
echo $after_widget;
}
function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['description'] = $new_instance['description'];
return $instance;
}
function form($instance)
{
$defaults = array('title' => '', 'description' => '');
$instance = wp_parse_args((array) $instance, $defaults); ?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Title:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('description'); ?>">Description:</label>
<textarea class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('description'); ?>" name="<?php echo $this->get_field_name('description'); ?>"><?php echo $instance['description']; ?></textarea>
</p>
<?php
}
}
?>