evolved_social_widget

The Evolved evolved social widget class.

Defined (1)

The class is defined in the following location(s).

/admin/widgets/social-widget.php  
  1. class evolved_social_widget extends WP_Widget { 
  2.  
  3. /** 
  4. * Widget setup. 
  5. */ 
  6. function evolved_social_widget() { 
  7. /** Widget settings. */ 
  8. $widget_ops = array( 'classname' => 'evolved_social_widget', 'description' => __('Displays icons with linked to RSS / Facebook/ Twitter / Flickr / YouTube', 'evolved') ); 
  9.  
  10. /** Widget control settings. */ 
  11. $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'evolved_social_widget' ); 
  12.  
  13. /** Create the widget. */ 
  14. $this->WP_Widget( 'evolved_social_widget', __('Evolved: Social icons', 'evolved'), $widget_ops, $control_ops ); 
  15.  
  16. /** 
  17. * How to display the widget on the screen. 
  18. */ 
  19. function widget( $args, $instance ) { 
  20. extract( $args ); 
  21.  
  22. /** Our variables from the widget settings. */ 
  23. $title = apply_filters('widget_title', $instance['title'] ); 
  24. $rss = $instance['rss']; 
  25. $facebook = $instance['facebook']; 
  26. $twitter = $instance['twitter']; 
  27. $youtube = $instance['youtube']; 
  28. $flickr = $instance['flickr']; 
  29.  
  30. /** Before widget (defined by themes). */ 
  31. echo $before_widget; 
  32.  
  33. /** Display the widget title if one was input (before and after defined by themes). */ 
  34. if ( $title ) 
  35. echo $before_title . $title . $after_title; 
  36.  
  37. ?> 
  38. <div class="sidebar-social"> 
  39. <?php if($rss) { ?><a href="<?php echo $rss; ?>" title="<?php _e('Subscribe to RSS feed', 'evolved') ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/rss.png" alt="Subskrybuj RSS" /></a><?php } ?> 
  40. <?php if($facebook) { ?><a href="<?php echo $facebook; ?>" title="<?php _e('Follow me on Facebook', 'evolved') ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/facebook.png" alt="Facebook" /></a><?php } ?> 
  41. <?php if($twitter) { ?><a href="<?php echo $twitter; ?>" title="<?php _e('Follow me on Twitter', 'evolved') ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/twitter.png" alt="Twitter" /></a><?php } ?> 
  42. <?php if($youtube) { ?><a href="<?php echo $youtube; ?>" title="<?php _e('Follow me on YouTube', 'evolved') ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/youtube.png" alt="YouTube" /></a><?php } ?> 
  43. <?php if($flickr) { ?><a href="<?php echo $flickr; ?>" title="<?php _e('Follow me on Flickr', 'evolved') ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/flickr.png" alt="Flickr" /></a><?php } ?> 
  44. </div> 
  45. <?php 
  46.  
  47. /** After widget (defined by themes). */ 
  48. echo $after_widget; 
  49.  
  50. /** 
  51. * Update the widget settings. 
  52. */ 
  53. function update( $new_instance, $old_instance ) { 
  54. $instance = $old_instance; 
  55.  
  56. /** Strip tags for title and name to remove HTML (important for text inputs). */ 
  57. $instance['title'] = strip_tags( $new_instance['title'] ); 
  58. $instance['rss'] = $new_instance['rss']; 
  59. $instance['facebook'] = $new_instance['facebook']; 
  60. $instance['twitter'] = $new_instance['twitter']; 
  61. $instance['youtube'] = $new_instance['youtube']; 
  62. $instance['flickr'] = $new_instance['flickr']; 
  63.  
  64. return $instance; 
  65.  
  66.  
  67. function form( $instance ) { 
  68.  
  69. /** Set up some default widget settings. */ 
  70. $defaults = array( 'title' => __('Follow me', 'evolved_social_widget'), 'rss' => '', 'facebook' => '', 'twitter' => '', 'flickr' => ''); 
  71. $instance = wp_parse_args( (array) $instance, $defaults ); ?> 
  72.  
  73. <!-- Widget Title: Text Input --> 
  74. <p> 
  75. <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title', 'evolved') ?>:</label> 
  76. <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:90%;" /> 
  77. </p> 
  78.  
  79. <!-- RSS URL --> 
  80. <p> 
  81. <label for="<?php echo $this->get_field_id( 'rss' ); ?>"><?php _e('URL address of your RSS feed', 'evolved') ?>:</label> 
  82. <input id="<?php echo $this->get_field_id( 'rss' ); ?>" name="<?php echo $this->get_field_name( 'rss' ); ?>" value="<?php echo $instance['rss']; ?>" style="width:90%;" /> 
  83. <small><?php _e('Enter full feed URL. If you don\'t want to display this, leave empty.', 'evolved') ?></small> 
  84. </p> 
  85.  
  86. <!-- Facebook URL --> 
  87. <p> 
  88. <label for="<?php echo $this->get_field_id( 'facebook' ); ?>"><?php _e('URL address of your Facebook profile or page', 'evolved') ?>:</label> 
  89. <input id="<?php echo $this->get_field_id( 'facebook' ); ?>" name="<?php echo $this->get_field_name( 'facebook' ); ?>" value="<?php echo $instance['facebook']; ?>" style="width:90%;" /> 
  90. <small><?php _e('Enter full URL of your Facebook profile or page. If you don\'t want to display this, leave empty.', 'evolved') ?></small> 
  91. </p> 
  92. <!-- Twitter URL --> 
  93. <p> 
  94. <label for="<?php echo $this->get_field_id( 'twitter' ); ?>"><?php _e('URL address of your Twitter profile page', 'evolved') ?>:</label> 
  95. <input id="<?php echo $this->get_field_id( 'twitter' ); ?>" name="<?php echo $this->get_field_name( 'twitter' ); ?>" value="<?php echo $instance['twitter']; ?>" style="width:90%;" /> 
  96. <small><?php _e('Enter full URL of your Twitter profile page. If you don\'t want to display this, leave empty.', 'evolved') ?></small> 
  97. </p> 
  98. <!-- YouTube URL --> 
  99. <p> 
  100. <label for="<?php echo $this->get_field_id( 'youtube' ); ?>"><?php _e('URL address of your YouTube profile page', 'evolved') ?>:</label> 
  101. <input id="<?php echo $this->get_field_id( 'youtube' ); ?>" name="<?php echo $this->get_field_name( 'youtube' ); ?>" value="<?php echo $instance['youtube']; ?>" style="width:90%;" /> 
  102. <small><?php _e('Enter full URL of your YouTube profile page. If you don\'t want to display this, leave empty.', 'evolved') ?></small> 
  103. </p> <!-- Flickr URL --> 
  104. <p> 
  105. <label for="<?php echo $this->get_field_id( 'flickr' ); ?>">Adres profliu na Flickr:</label> 
  106. <input id="<?php echo $this->get_field_id( 'flickr' ); ?>" name="<?php echo $this->get_field_name( 'flickr' ); ?>" value="<?php echo $instance['flickr']; ?>" style="width:90%;" /> 
  107. <small><?php _e('Enter full URL to your Flickr profile. If you don\'t want to display this, leave empty.', 'evolved') ?></small> 
  108. </p> 
  109.  
  110. <?php