CWP_FB_Like_Box

Plugin Name: Facebook like Box Description: facebook like box Version: 1.

Defined (1)

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

/widgets/facebook-like-box/fb-like-box.php  
  1. class CWP_FB_Like_Box extends WP_Widget 
  2. function CWP_FB_Like_Box() 
  3. $widget_ops = array('classname' => 'cwp_fb_like_box', 'description' => 'Facebook like box' ); 
  4. $this->WP_Widget('CWP_FB_Like_Box', 'CWP - Facebook like box', $widget_ops); 
  5. function form($instance) 
  6. $instance = wp_parse_args( (array) $instance, array(  
  7. 'title' => '',  
  8. 'page_url' => '',  
  9. 'width' => '292',  
  10. 'height' => '',  
  11. 'faces' => true,  
  12. 'color' => 'light',  
  13. 'stream' => true,  
  14. 'border' => true,  
  15. 'header' => true 
  16. ) ); 
  17. $title = $instance['title']; 
  18. $page_url = $instance['page_url']; 
  19. $width = $instance['width']; 
  20. $height = $instance['height']; 
  21. $faces = $instance['faces']; 
  22. $color = $instance['color']; 
  23. $stream = $instance['stream']; 
  24. $border = $instance['border']; 
  25. $header = $instance['header']; 
  26. ?> 
  27. <p> 
  28. <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget title:', 'megaresponsive-lite'); ?></label> 
  29. <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /> 
  30. </p> 
  31. <p> 
  32. <label for="<?php echo $this->get_field_id('page_url'); ?>"><?php _e('Facebook Page URL:', 'megaresponsive-lite'); ?></label> 
  33. <input class="widefat" id="<?php echo $this->get_field_id('page_url'); ?>" name="<?php echo $this->get_field_name('page_url'); ?>" type="text" value="<?php echo $page_url; ?>" /> 
  34. </p> 
  35. <p> 
  36. <span style="margin-right:10px;"><?php _e('Size:', 'megaresponsive-lite'); ?></span><br/> 
  37. <label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width:', 'megaresponsive-lite'); ?></label> 
  38. <input class="widefat" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="text" value="<?php echo $width; ?>" style="width: 40px; text-align: right;" />px  
  39.  
  40. <label for="<?php echo $this->get_field_id('height'); ?>"><?php _e('Height:', 'megaresponsive-lite'); ?></label> 
  41. <input class="widefat" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo $height; ?>" style="width: 40px; text-align: right;" />px  
  42. </p> 
  43.  
  44. <hr size="1" color="#dfdfdf" /> 
  45. <p> 
  46. <label for="<?php echo $this->get_field_id('faces'); ?>"><?php _e('Show faces:', 'megaresponsive-lite'); ?></label> 
  47. <input id="<?php echo $this->get_field_id('faces'); ?>" name="<?php echo $this->get_field_name('faces'); ?>" type="checkbox" value="1" <?php checked( '1', $faces ); ?>/> 
  48. </p> 
  49.  
  50. <hr size="1" color="#dfdfdf" /> 
  51. <p> 
  52. <label for="<?php echo $this->get_field_id('stream'); ?>"><?php _e('Show stream:', 'megaresponsive-lite'); ?></label> 
  53. <input id="<?php echo $this->get_field_id('stream'); ?>" name="<?php echo $this->get_field_name('stream'); ?>" type="checkbox" value="1" <?php checked( '1', $stream ); ?>/> 
  54. </p> 
  55.  
  56. <hr size="1" color="#dfdfdf" />  
  57. <p> 
  58. <label for="<?php echo $this->get_field_id('border'); ?>"><?php _e('Show border:', 'megaresponsive-lite'); ?></label> 
  59. <input id="<?php echo $this->get_field_id('border'); ?>" name="<?php echo $this->get_field_name('border'); ?>" type="checkbox" value="1" <?php checked( '1', $border ); ?>/> 
  60. </p> 
  61. <hr size="1" color="#dfdfdf" /> 
  62. <p> 
  63. <label for="<?php echo $this->get_field_id('header'); ?>"><?php _e('Show header:', 'megaresponsive-lite'); ?></label> 
  64. <input id="<?php echo $this->get_field_id('header'); ?>" name="<?php echo $this->get_field_name('header'); ?>" type="checkbox" value="1" <?php checked( '1', $header ); ?>/> 
  65. </p> 
  66. <hr size="1" color="#dfdfdf" /> 
  67. <p> 
  68. <label for="<?php echo $this->get_field_id('color'); ?>"><?php _e('Color scheme', 'megaresponsive-lite'); ?></label> 
  69. <select name="<?php echo $this->get_field_name('color'); ?>" id="<?php echo $this->get_field_id('color'); ?>" class="widefat"> 
  70. <?php 
  71. $options = array('light', 'dark'); 
  72. foreach ($options as $option) { 
  73. echo '<option value="' . $option . '" id="' . $option . '"', $color == $option ? ' selected="selected"' : '', '>', $option, '</option>'; 
  74. ?> 
  75. </select> 
  76. </p> 
  77. <?php 
  78.  
  79. function update($new_instance, $old_instance) 
  80. $instance = $old_instance; 
  81. $instance['title'] = $new_instance['title']; 
  82. $instance['page_url'] = $new_instance['page_url']; 
  83. $instance['width'] = $new_instance['width']; 
  84. $instance['height'] = $new_instance['height']; 
  85. $instance['faces'] = $new_instance['faces']; 
  86. $instance['color'] = $new_instance['color']; 
  87. $instance['stream'] = $new_instance['stream']; 
  88. $instance['border'] = $new_instance['border']; 
  89. $instance['header'] = $new_instance['header']; 
  90. return $instance; 
  91.  
  92. function widget($args, $instance) 
  93. extract($args, EXTR_SKIP); 
  94.  
  95. $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); 
  96. $page_url = empty($instance['page_url']) ? ' ' : apply_filters('widget_page_url', $instance['page_url']); 
  97. $width = empty($instance['width']) ? ' ' : apply_filters('widget_width', $instance['width']); 
  98. $height = empty($instance['height']) ? ' ' : apply_filters('widget_height', $instance['height']); 
  99. $faces = empty($instance['faces']) ? ' ' : apply_filters('widget_faces', $instance['faces']); 
  100. $color = empty($instance['color']) ? ' ' : apply_filters('widget_color', $instance['color']); 
  101. $stream = empty($instance['stream']) ? ' ' : apply_filters('widget_stream', $instance['stream']); 
  102. $border = empty($instance['border']) ? ' ' : apply_filters('widget_border', $instance['border']); 
  103. $header = empty($instance['header']) ? ' ' : apply_filters('widget_header', $instance['header']); 
  104. echo '<aside id="cwp_facebook_like_box" class="widget widget_cwp_facebook_like_box">'; 
  105. if( trim($title) ) 
  106. echo '<h1 class="widget-title"><span>'.$title.'</span></h1>'; 
  107. if ( trim($page_url) ) 
  108. echo '<div class="fb-like-box" data-href="'.$page_url.'" data-width="'.$width.'" data-height="'.$height.'" data-show-faces="'.$faces.'" data-colorscheme="'.$color.'" data-stream="'.$stream.'" data-show-border="'.$border.'" data-header="'.$header.'"></div>';  
  109.  
  110. echo '</aside>';