HEX
Server: Apache/2.4.49 (FreeBSD) OpenSSL/1.0.2s-freebsd PHP/5.6.36
System: FreeBSD hosting.icon.bg 11.3-RELEASE-p13 FreeBSD 11.3-RELEASE-p13 #0: Tue Sep 1 06:56:51 UTC 2020 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
User: ftpuser (1002)
PHP: 5.6.36
Disabled: NONE
Upload Files
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
	}
}
?>