Version Description
Download this release
Release Info
Developer | bestwebsoft |
Plugin | Facebook Button by BestWebSoft |
Version | 2011.06.07 |
Comparing to | |
See all releases |
Version 2011.06.07
- Thumbs.db +0 -0
- facebook-button-plugin.php +212 -0
- img/facebook-ico.jpg +0 -0
- img/standart-facebook-ico.jpg +0 -0
- readme.txt +67 -0
- screenshot-1.jpg +0 -0
- screenshot-2.jpg +0 -0
- screenshot-3.jpg +0 -0
- screenshot-4.jpg +0 -0
- screenshot-5.jpg +0 -0
Thumbs.db
ADDED
Binary file
|
facebook-button-plugin.php
ADDED
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Facebook Button Plugin
|
4 |
+
Plugin URI: http://bestwebsoft.com/plugin/
|
5 |
+
Description: Put Facebook Button in to your post.
|
6 |
+
Author: BestWebSoft
|
7 |
+
Version: 0.1
|
8 |
+
Author URI: http://bestwebsoft.com/
|
9 |
+
License: GPLv2 or later
|
10 |
+
*/
|
11 |
+
|
12 |
+
/* Copyright 2011 BestWebSoft ( plugin@bestwebsoft.com )
|
13 |
+
|
14 |
+
This program is free software; you can redistribute it and/or modify
|
15 |
+
it under the terms of the GNU General Public License, version 2, as
|
16 |
+
published by the Free Software Foundation.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
//Function 'facebook_button_plugin_page' formed content of the plugin's admin page.
|
29 |
+
function facebook_button_plugin_page() {
|
30 |
+
// Takes all the changed settings on the plugin's admin page and saves them in array 'fb_options_array'.
|
31 |
+
if ( isset ( $_REQUEST['fb_where'] ) && isset ( $_REQUEST['fb_link'] ) && isset ( $_REQUEST['display_option'] ) ) {
|
32 |
+
$fb_options_array [ 'fb_link' ] = $_REQUEST [ 'fb_link' ];
|
33 |
+
$fb_options_array [ 'fb_where' ] = $_REQUEST [ 'fb_where' ];
|
34 |
+
$fb_options_array [ 'display_option' ] = $_REQUEST [ 'display_option' ];
|
35 |
+
update_option ( 'fb_options_array', $fb_options_array );
|
36 |
+
?>
|
37 |
+
<div class="updated fade below-h2"><p><strong>Options saved</strong></p></div>
|
38 |
+
<?php
|
39 |
+
}
|
40 |
+
// Form options
|
41 |
+
if ( isset ( $_FILES [ 'uploadfile' ] [ 'tmp_name' ] ) ) { ?>
|
42 |
+
<div><? facebook_img_upload_and_rename_file($_FILES, $_REQUEST);?></div>
|
43 |
+
<?php } ?>
|
44 |
+
<div class="wrap">
|
45 |
+
<h2>Menu FaceBook Button Plugin Options</h2>
|
46 |
+
<div>
|
47 |
+
<form name="form1" method="post" action="admin.php?page=FaceBookButton" enctype="multipart/form-data" >
|
48 |
+
<p><?php _e("Your's FaceBook Login:"); ?>
|
49 |
+
<input name='fb_link' type='text' value='<?php $fb_options_array = get_option ( 'fb_options_array' ); echo $fb_options_array [ 'fb_link' ] ?>'/>
|
50 |
+
</p>
|
51 |
+
<p>Choose display option:
|
52 |
+
<select name="display_option" onchange="if ( this . value == 'custom' ) { getElementById ( 'display_option_custom' ) . style.display = 'block'; } else { getElementById ( 'display_option_custom' ) . style.display = 'none'; }">
|
53 |
+
<option <?php if ( $fb_options_array [ 'display_option' ] == 'standart' ) echo 'selected="selected"'; ?> value="standart">Standart FaceBook image</option>
|
54 |
+
<option <?php if ( $fb_options_array [ 'display_option' ] == 'custom' ) echo 'selected="selected"'; ?> value="custom">Custom FaceBook image</option>
|
55 |
+
</select>
|
56 |
+
</p>
|
57 |
+
<p>
|
58 |
+
<div id="display_option_custom" <?php if ( $fb_options_array [ 'display_option' ] == 'custom' ) { echo ( 'style="display:block"' ); } else {echo ( 'style="display:none"' ); }?> class="setting-description">
|
59 |
+
<input type="hidden" name="MAX_FILE_SIZE" value="64000"/>
|
60 |
+
<input type="hidden" name="home" value="<?php echo ABSPATH ; ?>"/>
|
61 |
+
<p>Your's FaceBook image:<input name="uploadfile" type="file" /></p>
|
62 |
+
<p><h6>Image properties - Max image width:100px; Max image height:40px; Max image size:32Kb; Image types:"jpg", "jpeg".</h6></p>
|
63 |
+
</div>
|
64 |
+
</p>
|
65 |
+
<p>Your's FaceBook Button Position:
|
66 |
+
<select name="fb_where" onchange="if ( this . value == 'shortcode' ) { getElementById ( 'shortcode' ) . style.display = 'block'; } else { getElementById ( 'shortcode' ) . style.display = 'none'; }">
|
67 |
+
<option <?php if ( $fb_options_array [ 'fb_where' ] == 'before' ) echo 'selected="selected"'; ?> value="before">Before</option>
|
68 |
+
<option <?php if ( $fb_options_array [ 'fb_where' ] == 'after' ) echo 'selected="selected"'; ?> value="after">After</option>
|
69 |
+
<option <?php if ( $fb_options_array [ 'fb_where' ] == 'beforeandafter' ) echo 'selected="selected"'; ?> value="beforeandafter">Before and After</option>
|
70 |
+
<option <?php if ( $fb_options_array [ 'fb_where' ] == 'shortcode ') echo 'selected="selected"'; ?> value="shortcode">Shortcode</option>
|
71 |
+
</select>
|
72 |
+
<span id="shortcode" <?php if ( $fb_options_array [ 'fb_where' ] == 'shortcode' ) { echo ( 'style="display:block"' ); } else { echo ( 'style="display:none"' ); }?> class="setting-description"><code>Past shortcode [fb_button] in to your post aniwhere</code></span>
|
73 |
+
</p>
|
74 |
+
<input type="submit" name="Submit" value="<?php _e( 'Update Options' ) ?>" />
|
75 |
+
</form>
|
76 |
+
<hr />
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
|
80 |
+
<?php
|
81 |
+
}
|
82 |
+
|
83 |
+
//Upload and rename user picture to FaceBook Button
|
84 |
+
function facebook_img_upload_and_rename_file ( $FILES, $REQUEST ) {
|
85 |
+
// Requirements for the uploaded file.
|
86 |
+
$max_image_width = 100;
|
87 |
+
$max_image_height = 40;
|
88 |
+
$max_image_size = 32 * 1024;
|
89 |
+
$valid_types = array( 'jpg', 'jpeg' );
|
90 |
+
|
91 |
+
// Construction to rename downloading file
|
92 |
+
$new_name = 'facebook-ico';
|
93 |
+
$new_ext = '.jpg';
|
94 |
+
$namefile = $new_name.$new_ext;
|
95 |
+
$uploaddir = $_POST [ 'home' ] . 'wp-content/plugins/facebook-button-plugin/img/'; // The directory in which we will take the file:
|
96 |
+
$uploadfile = $uploaddir.$namefile;
|
97 |
+
|
98 |
+
//checks is file download initiated by user
|
99 |
+
if ( isset ( $FILES [ 'uploadfile' ] ) && $REQUEST [ 'display_option' ] == 'custom' ) {
|
100 |
+
//Checking is allowed download file given parameters
|
101 |
+
if ( is_uploaded_file( $_FILES [ 'uploadfile' ] [ 'tmp_name' ] ) ) {
|
102 |
+
$filename = $FILES [ 'uploadfile' ] [ 'tmp_name' ];
|
103 |
+
$ext = substr ( $FILES [ 'uploadfile' ] [ 'name' ], 1 + strrpos( $FILES [ 'uploadfile' ] [ 'name' ], '.' ) );
|
104 |
+
if ( filesize ( $filename ) > $max_image_size ) { ?>
|
105 |
+
<div class="error fade below-h2"><p><strong>Error: File size > 32K</strong></p></div>
|
106 |
+
<?php }
|
107 |
+
elseif ( ! in_array ( $ext, $valid_types ) ) { ?>
|
108 |
+
<div class="error fade below-h2"><p><strong>Error: Invalid file type</strong></p></div>
|
109 |
+
<?php }
|
110 |
+
else {
|
111 |
+
$size = GetImageSize ( $filename );
|
112 |
+
if ( ( $size ) && ( $size[0] <= $max_image_width ) && ( $size[1] <= $max_image_height ) ) {
|
113 |
+
//If file satisfies requirements, we will move them from temp to your plugin folder and rename to 'facebook_ico.jpg'
|
114 |
+
if (move_uploaded_file ( $_FILES [ 'uploadfile' ] [ 'tmp_name' ], $uploadfile ) ) { ?>
|
115 |
+
<div class="updated fade below-h2"><p><strong>Upload successful</strong></p></div>
|
116 |
+
<?php }
|
117 |
+
else { ?>
|
118 |
+
<div class="error fade below-h2"><p><strong>Error: moving file failed</strong></p></div>
|
119 |
+
<?php }
|
120 |
+
}
|
121 |
+
else { ?>
|
122 |
+
<div class="error fade below-h2"><p><strong>Error: check image width or height</strong></p></div>
|
123 |
+
<?php }
|
124 |
+
}
|
125 |
+
}
|
126 |
+
else { ?>
|
127 |
+
<div class="error fade below-h2"><p><strong>Uploading Error: check image properties</strong></p></div>
|
128 |
+
<?php }
|
129 |
+
facebook_display_option ();
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
//Function 'facebook_display_option' reacts to changes type of picture (Standard or Custom) and generates link to image, link transferred to array 'fb_options_array'
|
134 |
+
function facebook_display_option () {
|
135 |
+
|
136 |
+
$fb_options_array = get_option ( 'fb_options_array' );
|
137 |
+
if ( $fb_options_array [ 'display_option' ] == 'standart' ){
|
138 |
+
$fb_img_link = $_GET [ 'home' ] . 'wp-content/plugins/facebook-button-plugin/img/standart-facebook-ico.jpg';
|
139 |
+
} else if ( $fb_options_array [ 'display_option' ] == 'custom'){
|
140 |
+
$fb_img_link = $_GET [ 'home' ] . 'wp-content/plugins/facebook-button-plugin/img/facebook-ico.jpg';
|
141 |
+
}
|
142 |
+
$fb_options_array [ 'fb_img_link' ] = $fb_img_link ;
|
143 |
+
update_option( "fb_options_array", $fb_options_array );
|
144 |
+
}
|
145 |
+
|
146 |
+
//Function 'facebook_button' taking from array 'fb_options_array' necessary information to create FaceBook Button and reacting to your choise in plugin menu - points where it appears.
|
147 |
+
function facebook_button( $content ) {
|
148 |
+
//Query the database to receive array 'fb_options_array' and receiving necessary information to create button
|
149 |
+
$fb_options_array = get_option ( 'fb_options_array' );
|
150 |
+
$fb_where = $fb_options_array [ 'fb_where' ];
|
151 |
+
$img = $fb_options_array [ 'fb_img_link' ];
|
152 |
+
$url = $fb_options_array [ 'fb_link' ];
|
153 |
+
$permalink_post = get_permalink ( $post_ID );
|
154 |
+
//Button
|
155 |
+
$button = '<div id="fb_share">
|
156 |
+
<div style="float:left;margin-right:10px;" >
|
157 |
+
<a name="fb_share" href="http://www.facebook.com/' . $url . '" target="blank">
|
158 |
+
<img src="' . $img . '" alt="Fb-Button" />
|
159 |
+
</a>
|
160 |
+
</div>
|
161 |
+
<div>
|
162 |
+
<div id="fb-root"></div>
|
163 |
+
<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&xfbml=1"></script>
|
164 |
+
<fb:like href="' . $permalink_post . '" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
|
165 |
+
</div>
|
166 |
+
</div>';
|
167 |
+
//Indication where show FaceBook Button depending on selected item in admin page.
|
168 |
+
if ( $fb_where == 'before' ) {
|
169 |
+
return $button . $content;
|
170 |
+
} else if ( $fb_where == 'after' ) {
|
171 |
+
return $content . $button;
|
172 |
+
} else if ( $fb_where == 'beforeandafter' ) {
|
173 |
+
return $button . $content . $button;
|
174 |
+
} else if ( $fb_where == 'shortcode' ) {
|
175 |
+
return $content;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
//Function 'facebook_button_short' are using to create shortcode by FaceBook Button.
|
180 |
+
function facebook_button_short( $content ) {
|
181 |
+
$fb_options_array = get_option ( 'fb_options_array' );
|
182 |
+
$fb_where = $fb_options_array [ 'fb_where' ];
|
183 |
+
$img = $fb_options_array [ 'fb_img_link' ];
|
184 |
+
$url = $fb_options_array [ 'fb_link' ];
|
185 |
+
$permalink_post = get_permalink ( $post_ID );
|
186 |
+
$button = '<div id="fb_share" >
|
187 |
+
<div style="float:left;margin-right:10px;" >
|
188 |
+
<a name="fb_share" href="http://www.facebook.com/'.$url.'" target="blank">
|
189 |
+
<img src="'.$img.'" alt="Fb-Button" />
|
190 |
+
</a>
|
191 |
+
</div>
|
192 |
+
<div>
|
193 |
+
<div id="fb-root"></div>
|
194 |
+
<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&xfbml=1"></script>
|
195 |
+
<fb:like href="'.$permalink_post.'" send="false" layout="button_count" width="400" show_faces="false" font=""></fb:like>
|
196 |
+
</div>
|
197 |
+
</div>';
|
198 |
+
return $button;
|
199 |
+
}
|
200 |
+
|
201 |
+
//Calling a function add administrative menu.
|
202 |
+
add_action( 'admin_menu', 'facebook_button_plugin_add_pages' );
|
203 |
+
|
204 |
+
function facebook_button_plugin_add_pages() {
|
205 |
+
add_options_page ( 'FaceBook Button', 'FaceBook Button', 0, 'FaceBookButton', 'facebook_button_plugin_page' );
|
206 |
+
}
|
207 |
+
|
208 |
+
//Add shortcode.
|
209 |
+
add_shortcode( 'fb_button', 'facebook_button_short' );
|
210 |
+
|
211 |
+
//Add settings links.
|
212 |
+
add_filter( 'the_content', 'facebook_button' );
|
img/facebook-ico.jpg
ADDED
Binary file
|
img/standart-facebook-ico.jpg
ADDED
Binary file
|
readme.txt
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Facebook Like Button Plugin ===
|
2 |
+
Contributors: bestwebsoft
|
3 |
+
Contributors: bestwebsoft
|
4 |
+
Donate link: http://bestwebsoft.com/
|
5 |
+
Tags: Facebook, Facebook Button, Like, Like button, Share, Share button, Facebook like, Facebook like button, Facebook button like, Button like, Facebook share, Facebook share button, Facebook button share
|
6 |
+
Requires at least: 3.1
|
7 |
+
Tested up to: 3.1
|
8 |
+
Stable tag: 2011.06.07
|
9 |
+
|
10 |
+
Add Facebook button to your WordPress website
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
Facebook Button Plugin allows you to add follow button in the most easiest and flexible way.
|
15 |
+
|
16 |
+
== Installation ==
|
17 |
+
|
18 |
+
1. Upload `facebook-button-plugin` folder to the `/wp-content/plugins/` directory.
|
19 |
+
2. Activate the plugin through the 'Plugins' menu in your WordPress admin panel.
|
20 |
+
3. You can adjust necessary settings through your WordPress admin pane in "Settings" > "FaceBook Button".
|
21 |
+
|
22 |
+
== Frequently Asked Questions ==
|
23 |
+
|
24 |
+
= I cannot see Facebook Button icon in the post after plugin installation =
|
25 |
+
|
26 |
+
1. In the WordPress admin panel go to "Plugins", find "Facebook Button Plugin" plugin and press "Activate".
|
27 |
+
|
28 |
+
= How I can deactivate the plugin =
|
29 |
+
|
30 |
+
1. In the WordPress admin panel go to "Plugins", find "Facebook Button Plugin" plugin and press "Deactivate".
|
31 |
+
|
32 |
+
= After clicking on the the Facebook Button icon I got Facebook home page instead of necessary account page =
|
33 |
+
|
34 |
+
1. In the WordPress admin panel go to "Settings", find "Facebook Button" plugin settings page and enter login of your Facebook account. Then press "Update Changes" button.
|
35 |
+
2. If you do not have Facebook account yet you need to create it using this link: http://www.facebook.com . After that go through instructions from the 1st point.
|
36 |
+
|
37 |
+
= How to adjust Facebook Button icon position on the page =
|
38 |
+
|
39 |
+
1. In the WordPress admin panel go to "Settings", find "Facebook Button" plugin settings page and choose one from listed positions: Before, After, Before and After or Shortcode. Then press "Update Changes" button.
|
40 |
+
|
41 |
+
= How to change Facebook Button icon picture =
|
42 |
+
|
43 |
+
1. In the WordPress admin panel go to "Settings", find "Facebook Button" plugin settings page and choose one from listed positions: Standart FaceBook image or Custom FaceBook image. Then press "Update Changes" button.
|
44 |
+
2. If you choose Custom FaceBook image, you can upload yor's oun picture. To uload you must press "Choose file" button and chose yor image in to you folder. Then press "Update Changes" button.
|
45 |
+
|
46 |
+
= After installation and setting adjustment in plugin settings it is still not working =
|
47 |
+
|
48 |
+
1. You need to press "Update Changes" button to update all changes. Make sure that you got "Options Saved" message after saving action.
|
49 |
+
2. After saving your settings you need to refresh your web page where Facebook Button icon should be located.
|
50 |
+
|
51 |
+
== Screenshots ==
|
52 |
+
|
53 |
+
1. Plugin admin page.
|
54 |
+
2. Plugin admin page: select display option.
|
55 |
+
3. Plugin admin page: select FaceBook Button position.
|
56 |
+
4. Displaying FaceBook Button in your post by shortcode.
|
57 |
+
5. Displaying FaceBook Button ater your post.
|
58 |
+
|
59 |
+
== Changelog ==
|
60 |
+
|
61 |
+
= 0.1 =
|
62 |
+
*Ability to install Facebook Button icon wth link to the account page, including settings adjustment functionality via WordPress admin panel.
|
63 |
+
|
64 |
+
== Upgrade Notice ==
|
65 |
+
|
66 |
+
= 0.1 =
|
67 |
+
Ability to install Facebook Button icon wth link to the account page, including settings adjustment functionality via WordPress admin panel.
|
screenshot-1.jpg
ADDED
Binary file
|
screenshot-2.jpg
ADDED
Binary file
|
screenshot-3.jpg
ADDED
Binary file
|
screenshot-4.jpg
ADDED
Binary file
|
screenshot-5.jpg
ADDED
Binary file
|