Facebook_Widget

The Responsive Minimal Facebook Widget class.

Defined (1)

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

/functions/widgets.php  
  1. class Facebook_Widget extends WP_Widget { 
  2.  
  3. function Facebook_Widget() { 
  4. $widget_ops = array( 'classname' => 'facebook', 'description' => __('Select the facebook account to show.', 'facebook') ); 
  5.  
  6. $control_ops = array( 'width' => 200, 'height' => 350, 'id_base' => 'facebook-widget' ); 
  7.  
  8. $this->WP_Widget( 'facebook-widget', __('Shock Facebook', 'facebook'), $widget_ops, $control_ops ); 
  9.  
  10. function widget( $args, $instance ) { 
  11. extract( $args ); 
  12.  
  13. $title = apply_filters('widget_title', $instance['title'] ); 
  14. $name = $instance['name']; 
  15. $face_height = $instance['height']; 
  16. $face_width = $instance['width']; 
  17.  
  18. echo $before_widget; 
  19.  
  20. echo $before_title . $title . $after_title; 
  21.  
  22. printf(__('<div></div>')); 
  23.  
  24. echo $after_widget; 
  25.  
  26. function update( $new_instance, $old_instance ) { 
  27. $instance = $old_instance; 
  28.  
  29. $instance['title'] = strip_tags( $new_instance['title'] ); 
  30. $instance['name'] = strip_tags( $new_instance['name'] ); 
  31. $instance['height'] = $new_instance['height']; 
  32. $instance['width'] = $new_instance['width']; 
  33.  
  34. return $instance; 
  35.  
  36. function form( $instance ) { 
  37.  
  38. $defaults = array( 'title' => __('Facebook Activity', 'facebook'), 'name' => __('facebook.com', 'facebook'), 'height' => '300', 'width' => '200'); 
  39. $instance = wp_parse_args( (array) $instance, $defaults ); ?> 
  40.  
  41. <!-- Title --> 
  42.  
  43. <p> 
  44. <label for="<?php echo $this->get_field_id( 'title' ); ?>"> 
  45. <?php _e('Title:', 'hybrid'); ?> 
  46. </label> 
  47. <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" /> 
  48. </p> 
  49. <p> 
  50. <label for="<?php echo $this->get_field_id( 'name' ); ?>"> 
  51. <?php _e('Facebook account:', 'facebook'); ?> 
  52. </label> 
  53. <input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'name' ); ?>" value="<?php echo $instance['name']; ?>" style="width:100%;" /> 
  54. </p> 
  55. <p> 
  56. <label for="<?php echo $this->get_field_id( 'height' ); ?>"> 
  57. <?php _e('Box height:', 'facebook'); ?> 
  58. </label> 
  59. <input id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" value="<?php echo $instance['height']; ?>" style="width:100%;" /> 
  60. </p> 
  61. <p> 
  62. <label for="<?php echo $this->get_field_id( 'width' ); ?>"> 
  63. <?php _e('Box width(175px or 255px):', 'facebook'); ?> 
  64. </label> 
  65. <input id="<?php echo $this->get_field_id( 'width' ); ?>" name="<?php echo $this->get_field_name( 'width' ); ?>" value="<?php echo $instance['width']; ?>" style="width:100%;" /> 
  66. </p> 
  67. <?php