Version Description
Download this release
Release Info
Developer | BeingMaverick |
Plugin | Add Twitter, Facebook Like, Google plus one Social share |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- readme.txt +45 -0
- tf_admin_page.php +233 -0
- tf_display.php +188 -0
- twitter-facebook-share.php +62 -0
readme.txt
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Add Twitter, Facebook Like, Google plus one Social share ===
|
2 |
+
Contributors: beingmaverick
|
3 |
+
Plugin Site: http://www.searchtechword.com
|
4 |
+
Tags: Facebook like, twitter button, twitter share, Google +1 (plus one) button, Google plus one, Stumbleupon, social share, twitter facebook share, google +1 share
|
5 |
+
Requires at least: 2.8+
|
6 |
+
Tested up to: 3.1.3
|
7 |
+
Stable tag: 1.0.0
|
8 |
+
|
9 |
+
== Description ==
|
10 |
+
<br />
|
11 |
+
[Author Site](http://www.searchtechword.com)|
|
12 |
+
[Plugin Home Page](http://www.searchtechword.com/2011/06/wordpress-plugin-add-twitter-facebook-google-plus-one-share)
|
13 |
+
<br />
|
14 |
+
<br />
|
15 |
+
This plugin is the most efficient way to integrate the important social share buttons like twitter, facebook like, google +1 (plus one) and stumbleupon in three different position and styles.
|
16 |
+
|
17 |
+
* Automatically display the social share buttons Above the post, below the post, both above and below or floating left side of post.
|
18 |
+
|
19 |
+
* Flat/Round border style with/without background color. All easily configurable through settings.
|
20 |
+
|
21 |
+
* Javascript is by default loaded in footer (recommended). This is the most efficient way to load scripts for social share buttons. This will make sure that your site contents are loaded first and the script loading do not interfere with them. Also site loading speed is better by doing so which is an important criteria for SEO.
|
22 |
+
Option to load the script in header as well, if you wish to.
|
23 |
+
|
24 |
+
* Left side floating option is the latest trend these days. The top and left spacing can be configured according to your site layout. Using simple CSS and not ajax for better performance. Also floating bar can be fixed on that position or absolute and can be configured easily through settings.
|
25 |
+
|
26 |
+
* Option to manually display the share box at any position.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
Very easy to install, similar to rest of the plugins.
|
32 |
+
|
33 |
+
1. Download and unzip the plugin twitter-facebook-google-plusone-share.zip.<br />
|
34 |
+
2. Copy the unzipped folder in your Plugins directory under wordpress installation. (wp-content/plugins)<br />
|
35 |
+
3. Activate the plugin through the plugin window in the admin panel.<br />
|
36 |
+
4. Configure the settings through Settings->TWG Social Share in the admin panel.
|
37 |
+
|
38 |
+
== Frequently Asked Questions ==
|
39 |
+
|
40 |
+
If you have any doubts or question or want to customise the plugin then get in touch with me at [SearchTechWord Wordpress Plugin](http://www.searchtechword.com/about-searchtechword/)<br />
|
41 |
+
I will try and help as much as possible and answer all your queries. I am ready to add to more features if you demand for the same, all free of cost. Always there to help you.
|
42 |
+
|
43 |
+
== Screenshots ==
|
44 |
+
You can Check Screen Shots on my website. I use the same plugin to display Social Share :<br />
|
45 |
+
[Twitter Facebook Google Plusone Social Share](http://www.searchtechword.com/2011/06/wordpress-plugin-add-twitter-facebook-google-plus-one-share)<br />
|
tf_admin_page.php
ADDED
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
The main admin page for this plugin. The logic for different user input and form submittion is written here.
|
4 |
+
*/
|
5 |
+
|
6 |
+
function kc_twitter_facebook_admin_menu() {
|
7 |
+
add_options_page('TF Social Share', 'TF Social Share', 'administrator',
|
8 |
+
'kc-social-share', 'kc_twitter_facebook_admin_page');
|
9 |
+
}
|
10 |
+
|
11 |
+
function kc_twitter_facebook_admin_page() {
|
12 |
+
|
13 |
+
$option_name = 'twitter_facebook_share';
|
14 |
+
if (!current_user_can('manage_options')) {
|
15 |
+
wp_die( __('You do not have sufficient permissions to access this page.') );
|
16 |
+
}
|
17 |
+
|
18 |
+
$active_buttons = array(
|
19 |
+
'facebook_like'=>'Facebook like',
|
20 |
+
'twitter'=>'Twitter',
|
21 |
+
'stumbleupon'=>'Stumbleupon',
|
22 |
+
'Google_plusone'=>'Google PlusOne'
|
23 |
+
);
|
24 |
+
|
25 |
+
$out = '';
|
26 |
+
|
27 |
+
if( isset($_POST['twitter_facebook_share_position'])) {
|
28 |
+
$option = array();
|
29 |
+
|
30 |
+
$option['auto'] = (isset($_POST['twitter_facebook_share_auto_display']) and $_POST['twitter_facebook_share_auto_display']=='on') ? true : false;
|
31 |
+
|
32 |
+
foreach (array_keys($active_buttons) as $item) {
|
33 |
+
$option['active_buttons'][$item] = (isset($_POST['twitter_facebook_share_active_'.$item]) and $_POST['twitter_facebook_share_active_'.$item]=='on') ? true : false;
|
34 |
+
}
|
35 |
+
$option['position'] = esc_html($_POST['twitter_facebook_share_position']);
|
36 |
+
$option['border'] = esc_html($_POST['twitter_facebook_share_border']);
|
37 |
+
|
38 |
+
$option['bkcolor'] = (isset($_POST['twitter_facebook_share_background_color']) and $_POST['twitter_facebook_share_background_color']=='on') ? true : false;
|
39 |
+
|
40 |
+
$option['bkcolor_value'] = esc_html($_POST['twitter_facebook_share_bkcolor_value']);
|
41 |
+
$option['jsload'] = (isset($_POST['twitter_facebook_share_javascript_load']) and $_POST['twitter_facebook_share_javascript_load']=='on') ? true : false;
|
42 |
+
|
43 |
+
$option['left_space'] = esc_html($_POST['twitter_facebook_share_left_space']);
|
44 |
+
$option['bottom_space'] = esc_html($_POST['twitter_facebook_share_bottom_space']);
|
45 |
+
$option['float_position'] = esc_html($_POST['twitter_facebook_share_float_position']);
|
46 |
+
|
47 |
+
update_option($option_name, $option);
|
48 |
+
// Put a settings updated message on the screen
|
49 |
+
$out .= '<div class="updated"><p><strong>'.__('Settings saved.', 'menu-test' ).'</strong></p></div>';
|
50 |
+
}
|
51 |
+
|
52 |
+
//GET ARRAY OF STORED VALUES
|
53 |
+
$option = twitter_facebook_share_get_options_stored();
|
54 |
+
|
55 |
+
$sel_above = ($option['position']=='above') ? 'selected="selected"' : '';
|
56 |
+
$sel_below = ($option['position']=='below') ? 'selected="selected"' : '';
|
57 |
+
$sel_both = ($option['position']=='both' ) ? 'selected="selected"' : '';
|
58 |
+
$sel_left = ($option['position']=='left' ) ? 'selected="selected"' : '';
|
59 |
+
|
60 |
+
$sel_flat = ($option['border']=='flat') ? 'selected="selected"' : '';
|
61 |
+
$sel_round = ($option['border']=='round') ? 'selected="selected"' : '';
|
62 |
+
$sel_none = ($option['border']=='none' ) ? 'selected="selected"' : '';
|
63 |
+
|
64 |
+
$sel_fixed = ($option['float_position']=='fixed') ? 'selected="selected"' : '';
|
65 |
+
$sel_absolute = ($option['float_position']=='absolute') ? 'selected="selected"' : '';
|
66 |
+
|
67 |
+
$bkcolor = ($option['bkcolor']) ? 'checked="checked"' : '';
|
68 |
+
$jsload = ($option['jsload']) ? 'checked="checked"' : '';
|
69 |
+
$auto = ($option['auto']) ? 'checked="checked"' : '';
|
70 |
+
|
71 |
+
$out .= '
|
72 |
+
<div class="wrap">
|
73 |
+
<h2>'.__( 'Facebook and Twitter share buttons', 'menu-test' ).'</h2>
|
74 |
+
<form name="form1" method="post" action="">
|
75 |
+
|
76 |
+
<table>
|
77 |
+
|
78 |
+
<tr><td valign="top" colspan="2"><h3>'.__("General Settings", 'menu-test' ).'</h3></td></tr>
|
79 |
+
|
80 |
+
<tr><td style="padding-bottom:20px;" valign="top">'.__("Auto Display", 'menu-test' ).':</td>
|
81 |
+
<td style="padding-bottom:20px;">
|
82 |
+
<input type="checkbox" name="twitter_facebook_share_auto_display" '.$auto.' />
|
83 |
+
<span class="description">'.__("Enable Auto display of Social Share buttons at specified postion", 'menu-test' ).'</span>
|
84 |
+
</td></tr>
|
85 |
+
|
86 |
+
<tr><td style="padding-bottom:20px;" valign="top">'.__("Code for Manual Display", 'menu-test' ).':</td>
|
87 |
+
<td style="padding-bottom:20px;">
|
88 |
+
<code><?php if(function_exists('kc_add_social_share')) kc_add_social_share(); ?></code>
|
89 |
+
</td></tr>
|
90 |
+
|
91 |
+
<tr><td valign="top" style="width:130px;">'.__("Active share buttons", 'menu-test' ).':</td>
|
92 |
+
<td style="padding-bottom:40px;">';
|
93 |
+
|
94 |
+
foreach ($active_buttons as $name => $text) {
|
95 |
+
$checked = ($option['active_buttons'][$name]) ? 'checked="checked"' : '';
|
96 |
+
$out .= '<div style="width:150px; float:left;">
|
97 |
+
<input type="checkbox" name="twitter_facebook_share_active_'.$name.'" '.$checked.' /> '
|
98 |
+
. __($text, 'menu-test' ).' </div>';
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
$out .= '</td></tr>
|
103 |
+
|
104 |
+
<tr><td style="padding-bottom:20px;" valign="top">'.__("Position", 'menu-test' ).':</td>
|
105 |
+
<td style="padding-bottom:20px;"><select name="twitter_facebook_share_position">
|
106 |
+
<option value="above" '.$sel_above.' > '.__('Above the post', 'menu-test' ).'</option>
|
107 |
+
<option value="below" '.$sel_below.' > '.__('Below the post', 'menu-test' ).'</option>
|
108 |
+
<option value="both" '.$sel_both.' > '.__('Above and Below the post', 'menu-test' ).'</option>
|
109 |
+
<option value="left" '.$sel_left.' > '.__('Left Side of the post', 'menu-test' ).'</option>
|
110 |
+
</select>
|
111 |
+
</td></tr>
|
112 |
+
|
113 |
+
<tr><td style="padding-bottom:20px;" valign="top">'.__("Border Style", 'menu-test' ).':</td>
|
114 |
+
<td style="padding-bottom:20px;"><select name="twitter_facebook_share_border">
|
115 |
+
<option value="flat" '.$sel_flat.' > '.__('Flat Border', 'menu-test' ).'</option>
|
116 |
+
<option value="round" '.$sel_round.' > '.__('Round Border', 'menu-test' ).'</option>
|
117 |
+
<option value="none" '.$sel_none.' > '.__('No Border', 'menu-test' ).'</option>
|
118 |
+
</select>
|
119 |
+
</td></tr>
|
120 |
+
|
121 |
+
<tr><td style="padding-bottom:20px;" valign="top">'.__("Show Background Color", 'menu-test' ).':</td>
|
122 |
+
<td style="padding-bottom:20px;">
|
123 |
+
<input type="checkbox" name="twitter_facebook_share_background_color" '.$bkcolor.' />
|
124 |
+
</td></tr>
|
125 |
+
|
126 |
+
<tr><td style="padding-bottom:20px;" valign="top">'.__("Background Color", 'menu-test' ).':</td>
|
127 |
+
<td style="padding-bottom:20px;">
|
128 |
+
<input type="text" name="twitter_facebook_share_bkcolor_value" value="'.$option['bkcolor_value'].'" size="10">
|
129 |
+
<span class="description">'.__("Default Color wont disappoint you", 'menu-test' ).'</span>
|
130 |
+
</td></tr>
|
131 |
+
|
132 |
+
<tr><td style="padding-bottom:20px;" valign="top">'.__("Load Javascript in Footer", 'menu-test' ).':</td>
|
133 |
+
<td style="padding-bottom:20px;">
|
134 |
+
<input type="checkbox" name="twitter_facebook_share_javascript_load" '.$jsload.' />
|
135 |
+
<span class="description">'.__("(Recommended, else loaded in header)", 'menu-test' ).'</span>
|
136 |
+
</td></tr>
|
137 |
+
|
138 |
+
<tr><td valign="top" colspan="2"><h3>'.__("Left Side Floating Specific Options", 'menu-test' ).'</h3></td></tr>
|
139 |
+
|
140 |
+
<tr><td style="padding-bottom:20px;" valign="top">'.__("Left Side Spacing", 'menu-test' ).':</td>
|
141 |
+
<td style="padding-bottom:20px;">
|
142 |
+
<input type="text" name="twitter_facebook_share_left_space" value="'.$option['left_space'].'" size="10">
|
143 |
+
<span class="description">'.__("Spacing from Left Side of Margin", 'menu-test' ).'</span>
|
144 |
+
</td></tr>
|
145 |
+
|
146 |
+
<tr><td style="padding-bottom:20px;" valign="top">'.__("Top Spacing", 'menu-test' ).':</td>
|
147 |
+
<td style="padding-bottom:20px;">
|
148 |
+
<input type="text" name="twitter_facebook_share_bottom_space" value="'.$option['bottom_space'].'" size="10">
|
149 |
+
<span class="description">'.__("Spacing from Top of the page", 'menu-test' ).'</span>
|
150 |
+
</td></tr>
|
151 |
+
|
152 |
+
<tr><td style="padding-bottom:20px;" valign="top">'.__("Float Bar Position", 'menu-test' ).':</td>
|
153 |
+
<td style="padding-bottom:20px;"><select name="twitter_facebook_share_float_position">
|
154 |
+
<option value="fixed" '.$sel_fixed.' > '.__('Fixed Position', 'menu-test' ).'</option>
|
155 |
+
<option value="absolute" '.$sel_absolute.' > '.__('Absolute Position', 'menu-test' ).'</option>
|
156 |
+
</select>
|
157 |
+
</td></tr>
|
158 |
+
|
159 |
+
<tr><td valign="top" colspan="2">
|
160 |
+
<p class="submit">
|
161 |
+
<input type="submit" name="Submit" class="button-primary" value="'.esc_attr('Save Changes').'" />
|
162 |
+
</p>
|
163 |
+
</td></tr>
|
164 |
+
|
165 |
+
|
166 |
+
</table>
|
167 |
+
|
168 |
+
</form>
|
169 |
+
</div>
|
170 |
+
';
|
171 |
+
echo $out;
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
// PRIVATE FUNCTIONS
|
176 |
+
|
177 |
+
function twitter_facebook_share_get_options_stored () {
|
178 |
+
//GET ARRAY OF STORED VALUES
|
179 |
+
$option = get_option('twitter_facebook_share');
|
180 |
+
|
181 |
+
if ($option===false) {
|
182 |
+
//OPTION NOT IN DATABASE, SO WE INSERT DEFAULT VALUES
|
183 |
+
$option = twitter_facebook_share_get_options_default();
|
184 |
+
add_option('twitter_facebook_share', $option);
|
185 |
+
} else if ($option=='above' or $option=='below') {
|
186 |
+
// Versions below 1.2.0 compatibility
|
187 |
+
$option = twitter_facebook_share_get_options_default($option);
|
188 |
+
} else if(!is_array($option)) {
|
189 |
+
// Versions below 1.2.2 compatibility
|
190 |
+
$option = json_decode($option, true);
|
191 |
+
}
|
192 |
+
|
193 |
+
// Versions below 1.5.1 compatibility
|
194 |
+
if (!isset($option['bkcolor'])) {
|
195 |
+
$option['bkcolor'] = true;
|
196 |
+
}
|
197 |
+
|
198 |
+
if (!isset($option['auto'])) {
|
199 |
+
$option['auto'] = true;
|
200 |
+
}
|
201 |
+
// Versions below 1.4.1 compatibility
|
202 |
+
if (!isset($option['bkcolor_value'])) {
|
203 |
+
$option['bkcolor_value'] = '#F0F4F9';
|
204 |
+
}
|
205 |
+
if (!isset($option['left_space'])) {
|
206 |
+
$option['left_space'] = '60px';
|
207 |
+
}
|
208 |
+
if (!isset($option['bottom_space'])) {
|
209 |
+
$option['bottom_space'] = '20%';
|
210 |
+
}
|
211 |
+
|
212 |
+
if (!isset($option['jsload'])) {
|
213 |
+
$option['jsload'] = true;
|
214 |
+
}
|
215 |
+
|
216 |
+
return $option;
|
217 |
+
}
|
218 |
+
|
219 |
+
function twitter_facebook_share_get_options_default ($position='above', $border='flat', $color='#F0F4F9',$left_space='60px',$bottom_space='40%', $float_position='fixed') {
|
220 |
+
$option = array();
|
221 |
+
$option['auto'] = true;
|
222 |
+
$option['active_buttons'] = array('facebook_like'=>true, 'twitter'=>true, 'stumbleupon'=>true, 'Google_plusone'=>true);
|
223 |
+
$option['position'] = $position;
|
224 |
+
$option['border'] = $border;
|
225 |
+
$option['bkcolor'] = true;
|
226 |
+
$option['bkcolor_value'] = $color;
|
227 |
+
$option['jsload'] = true;
|
228 |
+
$option['left_space'] = $left_space;
|
229 |
+
$option['bottom_space'] = $bottom_space;
|
230 |
+
$option['float_position'] = $float_position;
|
231 |
+
return $option;
|
232 |
+
}
|
233 |
+
?>
|
tf_display.php
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Core logic to display social share icons at the required positions.
|
4 |
+
*/
|
5 |
+
require_once('tf_admin_page.php');
|
6 |
+
|
7 |
+
function twitter_facebook_share_init() {
|
8 |
+
// DISABLED IN THE ADMIN PAGES
|
9 |
+
if (is_admin()) {
|
10 |
+
return;
|
11 |
+
}
|
12 |
+
|
13 |
+
//GET ARRAY OF STORED VALUES
|
14 |
+
$option = twitter_facebook_share_get_options_stored();
|
15 |
+
|
16 |
+
if ($option['active_buttons']['facebook_like']==true) {
|
17 |
+
wp_enqueue_script('twitter_facebook_share_facebook', 'http://connect.facebook.net/en_US/all.js#xfbml=1','','',$option['jsload']);
|
18 |
+
}
|
19 |
+
if ($option['active_buttons']['twitter']==true) {
|
20 |
+
wp_enqueue_script('twitter_facebook_share_twitter', 'http://platform.twitter.com/widgets.js','','',$option['jsload']);
|
21 |
+
}
|
22 |
+
|
23 |
+
if ($option['active_buttons']['Google_plusone']==true) {
|
24 |
+
wp_enqueue_script('twitter_facebook_share_google', 'http://apis.google.com/js/plusone.js','','',$option['jsload']);
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
function kc_twitter_facebook_contents($content)
|
32 |
+
{
|
33 |
+
global $single;
|
34 |
+
$output = kc_social_share();
|
35 |
+
if (is_single()) {
|
36 |
+
$option = twitter_facebook_share_get_options_stored();
|
37 |
+
if ($option['position'] == 'above')
|
38 |
+
return $output . $content;
|
39 |
+
if ($option['position'] == 'below')
|
40 |
+
return $content . $output;
|
41 |
+
if ($option['position'] == 'left')
|
42 |
+
return $output . $content;
|
43 |
+
if ($option['position'] == 'both')
|
44 |
+
return $output . $content . $output;
|
45 |
+
} else {
|
46 |
+
return $content;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
// Function to manually display related posts.
|
51 |
+
function kc_add_social_share()
|
52 |
+
{
|
53 |
+
$output = kc_social_share();
|
54 |
+
echo $output;
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
function kc_social_share()
|
60 |
+
{
|
61 |
+
//GET ARRAY OF STORED VALUES
|
62 |
+
$option = twitter_facebook_share_get_options_stored();
|
63 |
+
if (empty($option['bkcolor_value']))
|
64 |
+
$option['bkcolor_value'] = '#F0F4F9';
|
65 |
+
|
66 |
+
?>
|
67 |
+
<style type="text/css">
|
68 |
+
#leftcontainerBox {
|
69 |
+
<?php if ($option['border'] == 'flat')
|
70 |
+
echo 'border:1px solid #808080;';
|
71 |
+
if ($option['border'] == 'round')
|
72 |
+
echo 'border:1px solid #808080;
|
73 |
+
border-radius:5px 5px 5px 5px;
|
74 |
+
box-shadow:2px 2px 5px rgba(0,0,0,0.3);'; ?>
|
75 |
+
float:left;
|
76 |
+
position: <?php echo $option['float_position']; ?>;
|
77 |
+
top:<?php echo $option['bottom_space']; ?>;
|
78 |
+
left:<?php echo $option['left_space'] ?>;
|
79 |
+
z-index:1;
|
80 |
+
<?php if ($option['bkcolor'] == true)
|
81 |
+
echo 'background-color:'; echo $option['bkcolor_value']; ?>
|
82 |
+
}
|
83 |
+
|
84 |
+
#leftcontainerBox .buttons {
|
85 |
+
float:left;
|
86 |
+
clear:both;
|
87 |
+
margin:4px 4px 4px 4px;
|
88 |
+
width:55px;
|
89 |
+
height:60px;
|
90 |
+
padding-bottom:2px;
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
#bottomcontainerBox {
|
95 |
+
<?php if ($option['border'] == 'flat')
|
96 |
+
echo 'border:1px solid #808080;';
|
97 |
+
if ($option['border'] == 'round')
|
98 |
+
echo 'border:1px solid #808080;
|
99 |
+
border-radius:5px 5px 5px 5px;
|
100 |
+
box-shadow:2px 2px 5px rgba(0,0,0,0.3);'; ?>
|
101 |
+
float:left;
|
102 |
+
height:30px;
|
103 |
+
width:100%;
|
104 |
+
<?php if ($option['bkcolor'] == true)
|
105 |
+
echo 'background-color:'; echo $option['bkcolor_value']; ?>
|
106 |
+
}
|
107 |
+
|
108 |
+
#bottomcontainerBox .buttons {
|
109 |
+
float:left;
|
110 |
+
height:30px;
|
111 |
+
width:85px;
|
112 |
+
margin:4px 4px 4px 4px;
|
113 |
+
}
|
114 |
+
|
115 |
+
</style>
|
116 |
+
<?php
|
117 |
+
|
118 |
+
if ($option['position'] == 'left'){
|
119 |
+
$output = '<div id="leftcontainerBox">';
|
120 |
+
if ($option['active_buttons']['facebook_like']==true) {
|
121 |
+
$output .= '
|
122 |
+
<div class="buttons">
|
123 |
+
<fb:like href="' . urlencode(get_permalink($post->ID)) . '" layout="box_count" width="450" show_faces="false" font=""></fb:like>
|
124 |
+
</div>';
|
125 |
+
}
|
126 |
+
|
127 |
+
if ($option['active_buttons']['twitter']==true) {
|
128 |
+
$output .= '
|
129 |
+
<div class="buttons">
|
130 |
+
<a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="searchtechword">Tweet</a>
|
131 |
+
</div>';
|
132 |
+
}
|
133 |
+
|
134 |
+
if ($option['active_buttons']['Google_plusone']==true) {
|
135 |
+
$output .= '
|
136 |
+
<div class="buttons">
|
137 |
+
<g:plusone size="tall"></g:plusone>
|
138 |
+
</div>';
|
139 |
+
}
|
140 |
+
|
141 |
+
if ($option['active_buttons']['stumbleupon']==true) {
|
142 |
+
$output .= '
|
143 |
+
<div class="buttons"><script src="http://www.stumbleupon.com/hostedbadge.php?s=5"></script></div>';
|
144 |
+
}
|
145 |
+
$output .= '</div><div style="clear:both"></div>';
|
146 |
+
return $output;
|
147 |
+
}
|
148 |
+
|
149 |
+
|
150 |
+
if (($option['position'] == 'below') || ($option['position'] == 'above') || ($option['position'] == 'both'))
|
151 |
+
{
|
152 |
+
$output = '<div id="bottomcontainerBox">';
|
153 |
+
if ($option['active_buttons']['facebook_like']==true) {
|
154 |
+
$output .= '
|
155 |
+
<div class="buttons"><iframe src="http://www.facebook.com/plugins/like.php?href=' . rawurlencode(get_permalink()) . '&layout=button_count&show_faces=false&width=100&action=like&font=verdana
|
156 |
+
&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe></div>';
|
157 |
+
}
|
158 |
+
|
159 |
+
if ($option['active_buttons']['Google_plusone']==true) {
|
160 |
+
$output .= '
|
161 |
+
<div class="buttons">
|
162 |
+
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
|
163 |
+
<g:plusone size="medium"></g:plusone>
|
164 |
+
</div>';
|
165 |
+
}
|
166 |
+
|
167 |
+
if ($option['active_buttons']['stumbleupon']==true) {
|
168 |
+
$output .= '
|
169 |
+
<div class="buttons"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1"></script></div>';
|
170 |
+
}
|
171 |
+
|
172 |
+
if ($option['active_buttons']['twitter']==true) {
|
173 |
+
$output .= '
|
174 |
+
<div class="buttons">
|
175 |
+
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="searchtechword">Tweet</a>
|
176 |
+
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
|
177 |
+
</div>';
|
178 |
+
}
|
179 |
+
$output .= '
|
180 |
+
</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>';
|
181 |
+
|
182 |
+
return $output;
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
+
}
|
188 |
+
?>
|
twitter-facebook-share.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Twitter Facebook Social Share
|
4 |
+
Description: WordPress plugin for twitter, facebook, Google +1 (plus one) and other social share. Can add the share box before post contents, after and also floating on left hand side of the post.
|
5 |
+
Author: Kunal Chichkar
|
6 |
+
Author URI: http://www.searchtechword.com
|
7 |
+
Plugin URI: http://www.searchtechword.com/2011/06/wordpress-plugin-add-twitter-facebook-google-plus-one-share
|
8 |
+
Version: 1.0.0
|
9 |
+
License: GPL
|
10 |
+
*/
|
11 |
+
/*
|
12 |
+
This program is free software; you can redistribute it and/or modify
|
13 |
+
it under the terms of the GNU General Public License version 2,
|
14 |
+
as published by the Free Software Foundation.
|
15 |
+
|
16 |
+
This program is distributed in the hope that it will be useful,
|
17 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
+
GNU General Public License for more details.
|
20 |
+
*/
|
21 |
+
|
22 |
+
require_once('tf_admin_page.php');
|
23 |
+
require_once('tf_display.php');
|
24 |
+
|
25 |
+
|
26 |
+
if (!function_exists('is_admin'))
|
27 |
+
{
|
28 |
+
header('Status: 403 Forbidden');
|
29 |
+
header('HTTP/1.1 403 Forbidden');
|
30 |
+
exit();
|
31 |
+
}
|
32 |
+
|
33 |
+
/* Runs when plugin is activated */
|
34 |
+
register_activation_hook(__FILE__,'kc_twitter_facebook_install');
|
35 |
+
|
36 |
+
/* Runs on plugin deactivation*/
|
37 |
+
register_deactivation_hook( __FILE__, 'kc_twitter_facebook_remove' );
|
38 |
+
|
39 |
+
function kc_twitter_facebook_install()
|
40 |
+
{
|
41 |
+
/* Do Nothing */
|
42 |
+
}
|
43 |
+
|
44 |
+
function kc_twitter_facebook_remove() {
|
45 |
+
/* Deletes the database field */
|
46 |
+
delete_option('twitter_facebook_share');
|
47 |
+
}
|
48 |
+
|
49 |
+
if(is_admin())
|
50 |
+
{
|
51 |
+
add_action('admin_menu', 'kc_twitter_facebook_admin_menu');
|
52 |
+
}
|
53 |
+
else
|
54 |
+
{
|
55 |
+
add_action('init', 'twitter_facebook_share_init');
|
56 |
+
$option = twitter_facebook_share_get_options_stored();
|
57 |
+
if($option['auto'] == true)
|
58 |
+
{
|
59 |
+
add_filter('the_content', 'kc_twitter_facebook_contents');
|
60 |
+
}
|
61 |
+
}
|
62 |
+
?>
|