Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 11.76 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /* Change the following Part in your functions.php! --- Ari Social Links Widget */
  2. class Ari_SocialLinks_Widget extends WP_Widget {
  3.         function Ari_SocialLinks_Widget() {
  4.                 $widget_ops = array('classname' => 'widget_social_links', 'description' => 'A list with your social profile links' );
  5.                 $this->WP_Widget('social_links', 'Ari Social Links', $widget_ops);
  6.         }
  7.         function widget($args, $instance) {
  8.                 extract($args, EXTR_SKIP);
  9.                 echo $before_widget;
  10.                 $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
  11.                
  12.                 $rss_title = empty($instance['rss_title']) ? ' ' : apply_filters('widget_rss_title', $instance['rss_title']);  
  13.                 $rss_url = empty($instance['rss_url']) ? ' ' : apply_filters('widget_rss_url', $instance['rss_url']);
  14.                 $twitter_title = empty($instance['twitter_title']) ? ' ' : apply_filters('widget_twitter_title', $instance['twitter_title']);  
  15.                 $twitter_url = empty($instance['twitter_url']) ? ' ' : apply_filters('widget_twitter_url', $instance['twitter_url']);
  16.     $googleplus_title = empty($instance['googleplus_title']) ? ' ' : apply_filters('widget_googleplus_title', $instance['googleplus_title']);  
  17.     $googleplus_url = empty($instance['googleplus_url']) ? ' ' : apply_filters('widget_googleplus_url', $instance['googleplus_url']);  
  18.                 $fb_title = empty($instance['fb_title']) ? ' ' : apply_filters('widget_fb_title', $instance['fb_title']);
  19.                 $fb_url = empty($instance['fb_url']) ? ' ' : apply_filters('widget_fb_url', $instance['fb_url']);      
  20.                 $flickr_title = empty($instance['flickr_title']) ? ' ' : apply_filters('widget_flickr_title', $instance['flickr_title']);
  21.                 $flickr_url = empty($instance['flickr_url']) ? ' ' : apply_filters('widget_flickr_url', $instance['flickr_url']);
  22.                 $xing_title = empty($instance['xing_title']) ? ' ' : apply_filters('widget_xing_title', $instance['xing_title']);
  23.                 $xing_url = empty($instance['xing_url']) ? ' ' : apply_filters('widget_xing_url', $instance['xing_url']);
  24.                 $linkedin_title = empty($instance['linkedin_title']) ? ' ' : apply_filters('widget_linkedin_title', $instance['linkedin_title']);
  25.                 $linkedin_url = empty($instance['linkedin_url']) ? ' ' : apply_filters('widget_linkedin_url', $instance['linkedin_url']);
  26.                 $delicious_title = empty($instance['delicious_title']) ? ' ' : apply_filters('widget_delicious_title', $instance['delicious_title']);
  27.                 $delicious_url = empty($instance['delicious_url']) ? ' ' : apply_filters('widget_delicious_url', $instance['delicious_url']);
  28.                
  29.                 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
  30.                 echo '<ul>';
  31.         if($rss_title == ' ') { echo ''; } else {  echo  '<li class="widget_sociallinks"><a href=" '. $rss_url .'" class="rss" title=" '.RSS.' ">'. $rss_title .'</a></li>'; }
  32.                 if($twitter_title == ' ') { echo ''; } else {  echo  '<li class="widget_sociallinks"><a href=" '. $twitter_url .'" class="twitter" title=" '.Twitter.' ">'. $twitter_title .'</a></li>'; }
  33.                 if($googleplus_title == ' ') { echo ''; } else {  echo  '<li class="widget_sociallinks"><a href=" '. $googleplus_url .'" class="googleplus" title=" '.GooglePlus.' ">'. $googleplus_title .'</a></li>'; }
  34.     if($fb_title == ' ') { echo ''; } else {  echo  '<li class="widget_sociallinks"><a href=" '. $fb_url .'" class="facebook" title=" '.Facebook.' ">'. $fb_title .'</a></li>'; }
  35.                 if($flickr_title == ' ') { echo ''; } else {  echo  '<li class="widget_sociallinks"><a href=" '. $flickr_url .'" class="flickr" title=" '.Flickr.' ">'. $flickr_title .'</a></li>'; }
  36.                 if($xing_title == ' ') { echo ''; } else {  echo  '  <li class="widget_sociallinks"><a href=" '. $xing_url .'" class="xing" title=" '.Xing.' ">'. $xing_title .'</a></li>'; }
  37.                 if($linkedin_title == ' ') { echo ''; } else {  echo  '<li class="widget_sociallinks"><a href=" '. $linkedin_url .'" class="linkedin" title=" '.LinkedIn.' ">'. $linkedin_title .'</a></li>'; }
  38.                 if($delicious_title == ' ') { echo ''; } else {  echo  '<li class="widget_sociallinks"><a href=" '. $delicious_url .'" class="delicious" title=" '.Delicious.' ">'. $delicious_title .'</a></li>'; }
  39.     echo '</ul>';
  40.                 echo $after_widget;
  41.                
  42.         }
  43.         function update($new_instance, $old_instance) {
  44.                 $instance = $old_instance;
  45.                 $instance['title'] = strip_tags($new_instance['title']);
  46.                
  47.                 $instance['rss_title'] = strip_tags($new_instance['rss_title']);
  48.                 $instance['rss_url'] = strip_tags($new_instance['rss_url']);
  49.                 $instance['twitter_title'] = strip_tags($new_instance['twitter_title']);
  50.                 $instance['twitter_url'] = strip_tags($new_instance['twitter_url']);
  51.                 $instance['googleplus_title'] = strip_tags($new_instance['googleplus_title']);
  52.                 $instance['googleplus_url'] = strip_tags($new_instance['googleplus_url']);             
  53.                 $instance['fb_title'] = strip_tags($new_instance['fb_title']);
  54.                 $instance['fb_url'] = strip_tags($new_instance['fb_url']);
  55.                 $instance['flickr_title'] = strip_tags($new_instance['flickr_title']);
  56.                 $instance['flickr_url'] = strip_tags($new_instance['flickr_url']);             
  57.                 $instance['xing_title'] = strip_tags($new_instance['xing_title']);
  58.                 $instance['xing_url'] = strip_tags($new_instance['xing_url']);
  59.                 $instance['linkedin_title'] = strip_tags($new_instance['linkedin_title']);
  60.                 $instance['linkedin_url'] = strip_tags($new_instance['linkedin_url']);
  61.                 $instance['delicious_title'] = strip_tags($new_instance['delicious_title']);
  62.                 $instance['delicious_url'] = strip_tags($new_instance['delicious_url']);
  63.                 return $instance;
  64.         }
  65.         function form($instance) {
  66.                 $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'twitter_title' => '', 'comments_title' => '' ) );
  67.                 $title = strip_tags($instance['title']);       
  68.                 $rss_title = strip_tags($instance['rss_title']);
  69.                 $rss_url = strip_tags($instance['rss_url']);
  70.                 $twitter_title = strip_tags($instance['twitter_title']);
  71.                 $twitter_url = strip_tags($instance['twitter_url']);
  72.                 $googleplus_title = strip_tags($instance['googleplus_title']);
  73.                 $googleplus_url = strip_tags($instance['googleplus_url']);
  74.                 $fb_title = strip_tags($instance['fb_title']);
  75.                 $fb_url = strip_tags($instance['fb_url']);
  76.                 $flickr_title = strip_tags($instance['flickr_title']);
  77.                 $flickr_url = strip_tags($instance['flickr_url']);
  78.                 $xing_title = strip_tags($instance['xing_title']);
  79.                 $xing_url = strip_tags($instance['xing_url']);
  80.                 $linkedin_title = strip_tags($instance['linkedin_title']);
  81.                 $linkedin_url = strip_tags($instance['linkedin_url']);
  82.                 $delicious_title = strip_tags($instance['delicious_title']);
  83.                 $delicious_url = strip_tags($instance['delicious_url']);
  84. ?>
  85.                         <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
  86.                         <p><label for="<?php echo $this->get_field_id('rss_title'); ?>"><?php _e( 'RSS Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('rss_title'); ?>" name="<?php echo $this->get_field_name('rss_title'); ?>" type="text" value="<?php echo esc_attr($rss_title); ?>" /></label></p> 
  87.                         <p><label for="<?php echo $this->get_field_id('rss_url'); ?>"><?php _e( 'RSS  URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('rss_url'); ?>" name="<?php echo $this->get_field_name('rss_url'); ?>" type="text" value="<?php echo esc_attr($rss_url); ?>" /></label></p> 
  88.                         <p><label for="<?php echo $this->get_field_id('twitter_title'); ?>"><?php _e( 'Twitter Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('twitter_title'); ?>" name="<?php echo $this->get_field_name('twitter_title'); ?>" type="text" value="<?php echo esc_attr($twitter_title); ?>" /></label></p>     
  89.                         <p><label for="<?php echo $this->get_field_id('twitter_url'); ?>"><?php _e( 'Twitter  URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('twitter_url'); ?>" name="<?php echo $this->get_field_name('twitter_url'); ?>" type="text" value="<?php echo esc_attr($twitter_url); ?>" /></label></p>     
  90.                         <p><label for="<?php echo $this->get_field_id('googleplus_title'); ?>"><?php _e( 'googleplus Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('googleplus_title'); ?>" name="<?php echo $this->get_field_name('googleplus_title'); ?>" type="text" value="<?php echo esc_attr($googleplus_title); ?>" /></label></p>      
  91.                         <p><label for="<?php echo $this->get_field_id('googleplus_url'); ?>"><?php _e( 'googleplus  URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('googleplus_url'); ?>" name="<?php echo $this->get_field_name('googleplus_url'); ?>" type="text" value="<?php echo esc_attr($googleplus_url); ?>" /></label></p>
  92.                         <p><label for="<?php echo $this->get_field_id('fb_title'); ?>"><?php _e( 'Facebook Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('fb_title'); ?>" name="<?php echo $this->get_field_name('fb_title'); ?>" type="text" value="<?php echo esc_attr($fb_title); ?>" /></label></p>
  93.                         <p><label for="<?php echo $this->get_field_id('fb_url'); ?>"><?php _e( 'Facebook URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('fb_url'); ?>" name="<?php echo $this->get_field_name('fb_url'); ?>" type="text" value="<?php echo esc_attr($fb_url); ?>" /></label></p> 
  94.                         <p><label for="<?php echo $this->get_field_id('flickr_title'); ?>"><?php _e( 'Flickr Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('flickr_title'); ?>" name="<?php echo $this->get_field_name('flickr_title'); ?>" type="text" value="<?php echo esc_attr($flickr_title); ?>" /></label></p>
  95.                         <p><label for="<?php echo $this->get_field_id('flickr_url'); ?>"><?php _e( 'Flickr URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('flickr_url'); ?>" name="<?php echo $this->get_field_name('flickr_url'); ?>" type="text" value="<?php echo esc_attr($flickr_url); ?>" /></label></p>
  96.                         <p><label for="<?php echo $this->get_field_id('xing_title'); ?>"><?php _e( 'Xing Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('xing_title'); ?>" name="<?php echo $this->get_field_name('xing_title'); ?>" type="text" value="<?php echo esc_attr($xing_title); ?>" /></label></p>    
  97.                         <p><label for="<?php echo $this->get_field_id('xing_url'); ?>"><?php _e( 'Xing URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('xing_url'); ?>" name="<?php echo $this->get_field_name('xing_url'); ?>" type="text" value="<?php echo esc_attr($xing_url); ?>" /></label></p>             
  98.                         <p><label for="<?php echo $this->get_field_id('linkedin_title'); ?>"><?php _e( 'LinkedIn Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('linkedin_title'); ?>" name="<?php echo $this->get_field_name('linkedin_title'); ?>" type="text" value="<?php echo esc_attr($linkedin_title); ?>" /></label></p>        
  99.                         <p><label for="<?php echo $this->get_field_id('linkedin_url'); ?>"><?php _e( 'LinkedIn URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('linkedin_url'); ?>" name="<?php echo $this->get_field_name('linkedin_url'); ?>" type="text" value="<?php echo esc_attr($linkedin_url); ?>" /></label></p> 
  100.                         <p><label for="<?php echo $this->get_field_id('delicious_title'); ?>"><?php _e( 'Delicious Text:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('delicious_title'); ?>" name="<?php echo $this->get_field_name('delicious_title'); ?>" type="text" value="<?php echo esc_attr($delicious_title); ?>" /></label></p>
  101.                         <p><label for="<?php echo $this->get_field_id('delicious_url'); ?>"><?php _e( 'Delicious URL:', 'ari' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('delicious_url'); ?>" name="<?php echo $this->get_field_name('delicious_url'); ?>" type="text" value="<?php echo esc_attr($delicious_url); ?>" /></label></p>
  102.  
  103. <?php
  104.         }
  105. }
  106.  
  107. // register Ari SocialLinks Widget
  108. add_action('widgets_init', create_function('', 'return register_widget("Ari_SocialLinks_Widget");'));