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