WS Facebook Like Box Widget - Version 1.0

Version Description

Download this release

Release Info

Developer webshouter
Plugin Icon 128x128 WS Facebook Like Box Widget
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (3) hide show
  1. index.php +1 -0
  2. readme.txt +67 -0
  3. ws-fecebook-likebox.php +209 -0
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden ?>
readme.txt ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WS Facebook Like Box Widget ===
2
+ Contributors: webshouter
3
+ Tags: facebook, facebook like, likebox, widget, likebox, custom facebook likebox, facebook, facebook badge, facebook button, facebook like, facebook like box, facebook like box shortcode, facebook like box shortcodes, facebook like box widget, facebook like button, Facebook like widget, facebook likebox, facebook likebox widget, facebook meta, facebook meta tag, Facebook Open Graph, Facebook Page, facebook platform, facebook plugin, facebook recommend, facebook share, facebook sidebar, facebook style, facebook wall, Facebook Widget, friends, google +1, google plus, Like, like box, like box facebook, like box sidebox, like box widget, likebox, meta, nice facebook like box, open graph, page, plugin, seo, sharebar, sidebar, social, Social Plugins, social profiles, social share, shortcode, social sidebar, wordpress facebook like box, wordpress like
4
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=T59LYJEC5HAHC
5
+ Requires at least: 3.0
6
+ Tested up to: 4.3.1
7
+ Stable tag: 4.3
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ WS Facebook Like Box Widget provides easy and quick use in your blog. You can fully customize facebook like box in easy way.
12
+
13
+ == Description ==
14
+
15
+ WS Facebook Like Box Widget provides easy and quick use in your blog. You can fully customize facebook like box in easy way.
16
+
17
+ Facebook Like Box Widget. Facebook Like Box Widget is a social plugin that enables Facebook Page owners to attract and gain Likes & Recommendation Comments from their own website.
18
+
19
+ <strong>Features</strong>
20
+
21
+
22
+ * Very Easy to install
23
+ * No facebook api key required
24
+ * Fully customized layout
25
+ * Easy to add shortcode anywhere in your wordpress site.
26
+
27
+ <strong>Shortcode</strong>
28
+
29
+
30
+ >[ws-facebook-likebox url="https://www.facebook.com/webshouter" width="340" height="500" show_faces="true" show_Header="true" show_border="false"]
31
+
32
+ `<?php echo do_shortcode( '[ws-facebook-likebox url="https://www.facebook.com/webshouter" width="340" height="500" show_faces="true" show_Header="true" show_border="false"]' ); ?>`
33
+
34
+ ### Find Us on Social Media
35
+
36
+ * [Facebook](https://www.facebook.com/webshouter)
37
+ * [Twitter](https://twitter.com/webshouter)
38
+
39
+
40
+ == Installation ==
41
+
42
+ This section describes how to install the plugin and get it working.
43
+
44
+ 1. Download [WS Facebook Like Box Widget](https://wordpress.org/plugins/ws-fecebook-likebox/) plugin.
45
+ 2. Upload the WS Facebook Like Box plugin from your admin panel.
46
+ 3. Activate the WS Facebook Like Box plugin.
47
+ 4. Add WS Facebook Like Box widget to your sidebar.
48
+
49
+ == Frequently Asked Questions ==
50
+
51
+ There are no FAQ just yet
52
+
53
+ == Screenshots ==
54
+
55
+ 1. This screenshots for widget settings.
56
+ 2. After see facebook likebox.
57
+ 3. Using shortcode on page.
58
+
59
+
60
+ == Changelog ==
61
+
62
+ Version 1.0 released.
63
+
64
+
65
+ == Upgrade Notice ==
66
+
67
+ Upgrade to Version 1.0.
ws-fecebook-likebox.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WS Facebook Like Box Widget
4
+ Plugin URI: https://wordpress.org/plugins/ws-fecebook-likebox/
5
+ Description: WS Facebook Like Box Widget provides easy and quick use in your blog. You can fully customize facebook like box in easy way.
6
+ Version: 1.0
7
+ Author: Web Shouter
8
+ Author URI: http://www.webshouter.net/
9
+ License: GPL3
10
+ */
11
+
12
+ class WS_FACEBOOK_LIKEBOX extends WP_Widget {
13
+ function __construct() {
14
+ parent::__construct(
15
+ 'ws_fb_like_box', // Base ID
16
+ __( 'WS Facebook Likebox', 'ws-fb-likebox' ), // Name
17
+ array( 'description' => __( 'WS Likebox Widget!', 'ws-fb-likebox' ), ) //Args
18
+ );
19
+ add_action('wp_head', array(&$this, 'ws_add_fb_script_to_head'));
20
+ }
21
+
22
+ //add script to head
23
+ function ws_add_fb_script_to_head(){
24
+
25
+ echo '<div id="fb-root"></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=&version=v2.0";fjs.parentNode.insertBefore(js, fjs);}(document, "script", "facebook-jssdk"));</script>';
26
+
27
+ }
28
+
29
+ public function form( $instance ) {
30
+ if ( isset( $instance['title'] ) ) {
31
+ $title = $instance['title'];
32
+ } else {
33
+ $title = __( 'Facebook Like Box', 'ws-fb-likebox' );
34
+ }
35
+
36
+ if ( isset( $instance['width'] ) ) {
37
+ $width = $instance['width'];
38
+ }
39
+ else{
40
+ $width="300";
41
+ }
42
+
43
+ if ( isset( $instance['height'] ) ) {
44
+ $height = $instance['height'];
45
+ }
46
+ else{
47
+ $height="280";
48
+ }
49
+
50
+ if ( isset( $instance['page_username'] ) ) {
51
+ $page_username = $instance['page_username'];
52
+ }
53
+ else{
54
+ $page_username='https://www.facebook.com/webshouter';
55
+ }
56
+
57
+ if ( isset( $instance['show_friends_faces'] ) ) {
58
+ $show_friends_faces = $instance['show_friends_faces'];
59
+ } else {
60
+ $show_friends_faces = 'on';
61
+ }
62
+
63
+ if ( isset( $instance['show_Header'] ) ) {
64
+ $show_Header = $instance['show_Header'];
65
+ } else {
66
+ $show_Header = 'on';
67
+ }
68
+
69
+ if ( isset( $instance['show_border'] ) ) {
70
+ $show_border = $instance['show_border'];
71
+ } else {
72
+ $show_border = 'on';
73
+ }
74
+
75
+ ?>
76
+ <p>
77
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title' ); ?>:</label>
78
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>"
79
+ name="<?php echo $this->get_field_name( 'title' ); ?>" type="text"
80
+ value="<?php echo esc_attr( $title ); ?>">
81
+ </p>
82
+
83
+ <p>
84
+ <label
85
+ for="<?php echo $this->get_field_id( 'page_username' ); ?>"><?php _e( 'Facebook Page URL' ); ?>:</label>
86
+ <input class="widefat" id="<?php echo $this->get_field_id( 'page_username' ); ?>"
87
+ name="<?php echo $this->get_field_name( 'page_username' ); ?>" type="text"
88
+ value="<?php echo esc_attr( $page_username ); ?>">
89
+ </p>
90
+
91
+ <p>
92
+ <input class="widefat" id="<?php echo $this->get_field_id( 'show_friends_faces' ); ?>"
93
+ name="<?php echo $this->get_field_name( 'show_friends_faces' ); ?>" type="checkbox"
94
+ value="on" <?php checked( $show_friends_faces, 'on' ); ?>>
95
+ <label
96
+ for="<?php echo $this->get_field_id( 'show_friends_faces' ); ?>"><?php _e( 'Show Friends\' Faces' ); ?></label>
97
+ </p>
98
+
99
+ <p>
100
+ <input class="widefat" id="<?php echo $this->get_field_id( 'show_Header' ); ?>"
101
+ name="<?php echo $this->get_field_name( 'show_Header' ); ?>" type="checkbox"
102
+ value="on" <?php checked( $show_Header, 'on' ); ?>>
103
+ <label for="<?php echo $this->get_field_id( 'show_Header' ); ?>"><?php _e( 'Show Header' ); ?></label>
104
+ </p>
105
+
106
+ <p>
107
+ <input class="widefat" id="<?php echo $this->get_field_id( 'show_border' ); ?>"
108
+ name="<?php echo $this->get_field_name( 'show_border' ); ?>" type="checkbox"
109
+ value="on" <?php checked( $show_border, 'on' ); ?>>
110
+ <label for="<?php echo $this->get_field_id( 'show_border' ); ?>"><?php _e( 'Show Border' ); ?></label>
111
+ </p>
112
+
113
+ <p>
114
+ <label
115
+ for="<?php echo $this->get_field_id( 'width' ); ?>"><?php _e( 'Width:' ); ?>:</label>
116
+ <input class="widefat" id="<?php echo $this->get_field_id( 'width' ); ?>"
117
+ name="<?php echo $this->get_field_name( 'width' ); ?>" type="text"
118
+ value="<?php echo esc_attr( $width ); ?>">
119
+ </p>
120
+
121
+ <p>
122
+ <label
123
+ for="<?php echo $this->get_field_id( 'height' ); ?>"><?php _e( 'Height' ); ?>:</label>
124
+ <input class="widefat" id="<?php echo $this->get_field_id( 'height' ); ?>"
125
+ name="<?php echo $this->get_field_name( 'height' ); ?>" type="text"
126
+ value="<?php echo esc_attr( $height ); ?>">
127
+ </p>
128
+
129
+ <p>
130
+ <label><?php _e( 'Shortcode' ); ?>:</label><br />
131
+ <code>[ws-facebook-likebox url="https://www.facebook.com/webshouter" width="340" height="500" show_faces="true" show_Header="true" show_border="false" ]</code>
132
+ <?php
133
+ }
134
+
135
+
136
+
137
+ public function update( $new_instance, $old_instance ) {
138
+ $instance = array();
139
+ $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
140
+ $instance['page_username'] = ( ! empty( $new_instance['page_username'] ) ) ? strip_tags( $new_instance['page_username'] ) : '';
141
+ $instance['show_friends_faces'] = ( ! empty( $new_instance['show_friends_faces'] ) ) ? strip_tags( $new_instance['show_friends_faces'] ) : '';
142
+ $instance['show_Header'] = ( ! empty( $new_instance['show_Header'] ) ) ? strip_tags( $new_instance['show_Header'] ) : '';
143
+ $instance['show_border'] = ( ! empty( $new_instance['show_border'] ) ) ? strip_tags( $new_instance['show_border'] ) : '';
144
+ $instance['width'] = ( ! empty( $new_instance['width'] ) ) ? strip_tags( $new_instance['width'] ) : '';
145
+ $instance['height'] = ( ! empty( $new_instance['height'] ) ) ? strip_tags( $new_instance['height'] ) : '';
146
+ $instance['fb_api_key'] = ( ! empty( $new_instance['fb_api_key'] ) ) ? strip_tags( $new_instance['fb_api_key'] ) : '';
147
+
148
+
149
+ return $instance;
150
+ }
151
+
152
+
153
+ public function widget( $args, $instance ) {
154
+ $title = apply_filters( 'widget_title', $instance['title'] );
155
+ $page_username = $instance['page_username'];
156
+ $show_friends_faces = $instance['show_friends_faces'];
157
+ $show_Header = $instance['show_Header'];
158
+ $show_border = $instance['show_border'];
159
+ $width = $instance['width'];
160
+ $height = $instance['height'];
161
+ $fb_api_key = $instance['fb_api_key'];
162
+
163
+
164
+
165
+ echo $args['before_widget'];
166
+ if ( ! empty( $title ) ) {
167
+ echo $args['before_title'] . $title . $args['after_title'];
168
+ }
169
+
170
+ if ( empty( $page_username ) ) {
171
+ echo "Facebook Page Url is missing in Widget settings.";
172
+ }
173
+ else {
174
+ ?>
175
+ <div class="fb-like-box" data-href="<?php echo $page_username; ?>" data-colorscheme="light" data-width="<?php echo $width; ?>" data-height="<?php echo $height; ?>" data-show-faces="<?php echo ( $show_friends_faces == 'on' ) ? 'true' : 'false'; ?>" data-header="<?php echo ( $show_Header == 'on' ) ? 'true' : 'false'; ?>" data-stream="false" data-show-border="<?php echo ( $show_border == 'on' ) ? 'true' : 'false'; ?>"></div>
176
+
177
+ <?php
178
+ }
179
+
180
+ echo $args['after_widget'];
181
+ }
182
+
183
+ }
184
+
185
+ // register widget
186
+ function register_ws_fb_likebox_widget() {
187
+ register_widget( 'WS_FACEBOOK_LIKEBOX' );
188
+ }
189
+ add_action( 'widgets_init', 'register_ws_fb_likebox_widget' );
190
+
191
+ // Register Shortcode
192
+ function ws_facebook_likebox_add_shortcode( $atts ) {
193
+
194
+ extract( shortcode_atts(
195
+ array(
196
+ 'url' => 'https://www.facebook.com/webshouter',
197
+ 'width' => '380',
198
+ 'height' => '500',
199
+ 'show_faces' => 'true',
200
+ 'show_Header' => 'true',
201
+ 'show_border' => 'false'
202
+ ), $atts )
203
+ );
204
+
205
+ $html='<div class="fb-like-box" data-href="'.$url.'" data-colorscheme="light" data-width="'.$width.'" data-height="'.$height.'" data-show-faces="'.$show_faces.'" data-header="'.$show_Header.'" data-stream="false" data-show-border="'.$show_border.'"></div>';
206
+ return $html;
207
+ }
208
+ add_shortcode( 'ws-facebook-likebox', 'ws_facebook_likebox_add_shortcode' );
209
+