Version Description
- Added options to show/hide social buttons on frontpage and inside categories
Download this release
Release Info
Developer | kasal |
Plugin | Hupso Share Buttons for Twitter, Facebook & Google+ |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- readme.txt +4 -1
- share-buttons-hupso.php +85 -12
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: kasal
|
|
3 |
Tags: twitter, facebook, google+, social, sharing, stumbleupon, addthis, sharethis, sexybookmarks, addtoany, lockerz, shareaholic
|
4 |
Requires at least: 2.8
|
5 |
Tested up to: 3.4
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -79,6 +79,9 @@ Yes. Thay are free and will always be free. And you do not need to open an accou
|
|
79 |
|
80 |
== Changelog ==
|
81 |
|
|
|
|
|
|
|
82 |
= 1.2 =
|
83 |
* Improved default settings
|
84 |
|
3 |
Tags: twitter, facebook, google+, social, sharing, stumbleupon, addthis, sharethis, sexybookmarks, addtoany, lockerz, shareaholic
|
4 |
Requires at least: 2.8
|
5 |
Tested up to: 3.4
|
6 |
+
Stable tag: 1.3
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
79 |
|
80 |
== Changelog ==
|
81 |
|
82 |
+
= 1.3 =
|
83 |
+
* Added options to show/hide social buttons on frontpage and inside categories
|
84 |
+
|
85 |
= 1.2 =
|
86 |
* Improved default settings
|
87 |
|
share-buttons-hupso.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Hupso Share Buttons for Twitter, Facebook & Google+
|
4 |
Plugin URI: http://www.hupso.com/share
|
5 |
Description: Add simple social sharing buttons to your articles. Your visitors will be able to easily share your content on the most popular social networks: Twitter, Facebook, Google Plus, Linkedin, StumbleUpon, Digg, Reddit, Bebo and Delicous. These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
|
6 |
-
Version: 1.
|
7 |
Author: kasal
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -141,6 +141,28 @@ function hupso_admin_settings_show() {
|
|
141 |
<td><hr style="height:1px;"/><input type="radio" name="hupso_button_position" value="below" <?php echo $hupso_below_checked; ?> /> <?php _e('Below the post'); ?><br/>
|
142 |
<input type="radio" name="hupso_button_position" value="above" <?php echo $hupso_above_checked; ?> /> <?php _e('Above the post'); ?><br/></td>
|
143 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
</table>
|
145 |
<br/><br/><input class="button-primary" name="submit" type="submit" value="<?php _e('Save Settings'); ?>" />
|
146 |
</form>
|
@@ -151,6 +173,8 @@ function hupso_admin_settings_show() {
|
|
151 |
function hupso_admin_settings_save() {
|
152 |
|
153 |
global $all_services, $default_services, $hupso_plugin_url;
|
|
|
|
|
154 |
$code = '';
|
155 |
|
156 |
if ( $_POST[ 'hupso_button_size' ] != '' )
|
@@ -187,7 +211,7 @@ function hupso_admin_settings_save() {
|
|
187 |
}
|
188 |
}
|
189 |
$hupso_vars .= ');';
|
190 |
-
$hupso_vars = str_replace(',)', ')', $hupso_vars);
|
191 |
|
192 |
/* save menu type */
|
193 |
if ( $post ) {
|
@@ -195,7 +219,7 @@ function hupso_admin_settings_save() {
|
|
195 |
update_option( 'hupso_menu_type', $hupso_menu_type );
|
196 |
}
|
197 |
else {
|
198 |
-
$hupso_menu_type = get_option ( 'hupso_menu_type', 'labels');
|
199 |
}
|
200 |
$hupso_vars .= 'var hupso_icon_type = "'.$hupso_menu_type.'";';
|
201 |
|
@@ -206,25 +230,38 @@ function hupso_admin_settings_save() {
|
|
206 |
update_option( 'hupso_button_position', $hupso_button_position );
|
207 |
}
|
208 |
else {
|
209 |
-
$hupso_button_position = get_option ( 'hupso_button_position', 'below');
|
210 |
}
|
211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
/* create and save code */
|
213 |
/* all images are server from local Wordpress installation */
|
214 |
/* minified button code is served by Hupso Static Server */
|
215 |
$static_server = 'http://static.hupso.com/share/js/share.js';
|
216 |
$code = '<!-- Hupso Share Buttons (http://www.hupso.com/share) --><a class="hupso_pop" href="http://www.hupso.com/share"><img style="border:0px;" src="'.$hupso_plugin_url.'/buttons/'.$hupso_button_size.'.png" width="'.$width.'" height="'.$height.'" border="0" alt="Share Button"/></a><script type="text/javascript">';
|
217 |
$code .= $hupso_vars;
|
218 |
-
$code .= '</script><script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
|
219 |
update_option( 'hupso_share_buttons_code', $code );
|
220 |
|
221 |
/* create preview */
|
222 |
$msg .= '<h3>' . __('Button Preview'). '</h3><br/>';
|
223 |
-
$msg .= $code . '
|
|
|
|
|
|
|
224 |
$msg .= __('Move your mouse over the button above to see the sharing menu.');
|
225 |
$msg .= '<br/><br/><br/>';
|
226 |
$msg .= '<input class="button-primary" name="submit" type="submit" value="' . __('Update Preview') . '" /> ';
|
227 |
-
|
228 |
return $msg;
|
229 |
}
|
230 |
|
@@ -233,13 +270,49 @@ function hupso_the_content( $content ) {
|
|
233 |
|
234 |
global $hupso_plugin_url;
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
/* default code */
|
237 |
-
$share_code = '<!-- Hupso Share Buttons (http://www.hupso.com/share) --><a class="hupso_pop" href="http://www.hupso.com/share"><img style="border:0px;" src="'
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
|
241 |
-
$code = get_option ( 'hupso_share_buttons_code', $share_code );
|
242 |
-
|
243 |
$position = get_option( 'hupso_button_position', 'below' );
|
244 |
if ($position == 'below')
|
245 |
$new_content = $content . $code;
|
3 |
Plugin Name: Hupso Share Buttons for Twitter, Facebook & Google+
|
4 |
Plugin URI: http://www.hupso.com/share
|
5 |
Description: Add simple social sharing buttons to your articles. Your visitors will be able to easily share your content on the most popular social networks: Twitter, Facebook, Google Plus, Linkedin, StumbleUpon, Digg, Reddit, Bebo and Delicous. These services are used by millions of people every day, so sharing your content there will increase traffic to your website.
|
6 |
+
Version: 1.3
|
7 |
Author: kasal
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
141 |
<td><hr style="height:1px;"/><input type="radio" name="hupso_button_position" value="below" <?php echo $hupso_below_checked; ?> /> <?php _e('Below the post'); ?><br/>
|
142 |
<input type="radio" name="hupso_button_position" value="above" <?php echo $hupso_above_checked; ?> /> <?php _e('Above the post'); ?><br/></td>
|
143 |
</tr>
|
144 |
+
<tr>
|
145 |
+
<td style="width:170px;"><?php _e('Display options'); ?></td>
|
146 |
+
<td><hr style="height:1px;"/>
|
147 |
+
<?php
|
148 |
+
$checked = ' checked="checked" ';
|
149 |
+
|
150 |
+
$hupso_show_frontpage = get_option( 'hupso_show_frontpage', '1' );
|
151 |
+
if ( $hupso_show_frontpage == 1 )
|
152 |
+
$hupso_show_frontpage_checked = $checked;
|
153 |
+
else
|
154 |
+
$hupso_show_frontpage_checked = '';
|
155 |
+
|
156 |
+
$hupso_show_category = get_option( 'hupso_show_category', '1' );
|
157 |
+
if ( $hupso_show_category == 1 )
|
158 |
+
$hupso_show_category_checked = $checked;
|
159 |
+
else
|
160 |
+
$hupso_show_category_checked = '';
|
161 |
+
?>
|
162 |
+
<input type="checkbox" name="hupso_show_frontpage" value="1" <?php echo $hupso_show_frontpage_checked; ?> /> <?php _e('Front page - show social buttons in posts on front page'); ?><br/>
|
163 |
+
<input type="checkbox" name="hupso_show_category" value="1" <?php echo $hupso_show_category_checked; ?> /> <?php _e('Categories - show social buttons in posts when viewing categories, tags, authors or dates'); ?><br/>
|
164 |
+
</td>
|
165 |
+
</tr>
|
166 |
</table>
|
167 |
<br/><br/><input class="button-primary" name="submit" type="submit" value="<?php _e('Save Settings'); ?>" />
|
168 |
</form>
|
173 |
function hupso_admin_settings_save() {
|
174 |
|
175 |
global $all_services, $default_services, $hupso_plugin_url;
|
176 |
+
|
177 |
+
update_option( 'hupso_custom', '1' );
|
178 |
$code = '';
|
179 |
|
180 |
if ( $_POST[ 'hupso_button_size' ] != '' )
|
211 |
}
|
212 |
}
|
213 |
$hupso_vars .= ');';
|
214 |
+
$hupso_vars = str_replace( ',)', ')', $hupso_vars );
|
215 |
|
216 |
/* save menu type */
|
217 |
if ( $post ) {
|
219 |
update_option( 'hupso_menu_type', $hupso_menu_type );
|
220 |
}
|
221 |
else {
|
222 |
+
$hupso_menu_type = get_option ( 'hupso_menu_type', 'labels' );
|
223 |
}
|
224 |
$hupso_vars .= 'var hupso_icon_type = "'.$hupso_menu_type.'";';
|
225 |
|
230 |
update_option( 'hupso_button_position', $hupso_button_position );
|
231 |
}
|
232 |
else {
|
233 |
+
$hupso_button_position = get_option ( 'hupso_button_position', 'below' );
|
234 |
}
|
235 |
|
236 |
+
|
237 |
+
// save display options */
|
238 |
+
if ( $post ) {
|
239 |
+
$hupso_show_frontpage = $_POST[ 'hupso_show_frontpage' ];
|
240 |
+
update_option( 'hupso_show_frontpage', $hupso_show_frontpage );
|
241 |
+
|
242 |
+
$hupso_show_category = $_POST[ 'hupso_show_category' ];
|
243 |
+
update_option( 'hupso_show_category', $hupso_show_category );
|
244 |
+
}
|
245 |
+
|
246 |
+
|
247 |
/* create and save code */
|
248 |
/* all images are server from local Wordpress installation */
|
249 |
/* minified button code is served by Hupso Static Server */
|
250 |
$static_server = 'http://static.hupso.com/share/js/share.js';
|
251 |
$code = '<!-- Hupso Share Buttons (http://www.hupso.com/share) --><a class="hupso_pop" href="http://www.hupso.com/share"><img style="border:0px;" src="'.$hupso_plugin_url.'/buttons/'.$hupso_button_size.'.png" width="'.$width.'" height="'.$height.'" border="0" alt="Share Button"/></a><script type="text/javascript">';
|
252 |
$code .= $hupso_vars;
|
|
|
253 |
update_option( 'hupso_share_buttons_code', $code );
|
254 |
|
255 |
/* create preview */
|
256 |
$msg .= '<h3>' . __('Button Preview'). '</h3><br/>';
|
257 |
+
$msg .= $code . '</script>';
|
258 |
+
$msg .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
|
259 |
+
|
260 |
+
$msg .= '<br/><br/>';
|
261 |
$msg .= __('Move your mouse over the button above to see the sharing menu.');
|
262 |
$msg .= '<br/><br/><br/>';
|
263 |
$msg .= '<input class="button-primary" name="submit" type="submit" value="' . __('Update Preview') . '" /> ';
|
264 |
+
|
265 |
return $msg;
|
266 |
}
|
267 |
|
270 |
|
271 |
global $hupso_plugin_url;
|
272 |
|
273 |
+
/* Do not show share buttons in feeds */
|
274 |
+
if ( is_feed() ) {
|
275 |
+
return $content;
|
276 |
+
}
|
277 |
+
|
278 |
+
$post_url = $GLOBALS['post']->guid;
|
279 |
+
$hupso_show_frontpage = get_option( 'hupso_show_frontpage' , '1' );
|
280 |
+
$hupso_show_category = get_option( 'hupso_show_category' , '1' );
|
281 |
+
|
282 |
+
/* Do not show share buttons if option is disabled */
|
283 |
+
if ( is_home() && $hupso_show_frontpage != 1 ) {
|
284 |
+
return $content;
|
285 |
+
}
|
286 |
+
/* Do not show share buttons if option is disabled */
|
287 |
+
if ( is_archive() && $hupso_show_category != 1 ) {
|
288 |
+
return $content;
|
289 |
+
}
|
290 |
+
|
291 |
/* default code */
|
292 |
+
$share_code = '<!-- Hupso Share Buttons (http://www.hupso.com/share) --><a class="hupso_pop" href="http://www.hupso.com/share"><img style="border:0px;" src="' . $hupso_plugin_url . '/buttons/button120x28.png" width="100" height="23" border="0" alt="Share Button"/></a><script type="text/javascript">var hupso_services=new Array("Twitter","Facebook","Google Plus","Linkedin","StumbleUpon","Digg","Reddit","Bebo","Delicious"); var hupso_icon_type = "labels";';
|
293 |
+
|
294 |
+
$code = get_option( 'hupso_share_buttons_code', $share_code );
|
295 |
+
|
296 |
+
/* Check for old saved button code, prior to version 1.3 */
|
297 |
+
if ( get_option( 'hupso_custom', '0' ) == 0 ) {
|
298 |
+
$old_check = strpos( $code, '</script>' );
|
299 |
+
if ( $old_check !== false ) {
|
300 |
+
$code = substr( $code, 0, $old_check );
|
301 |
+
|
302 |
+
/* Save new code */
|
303 |
+
update_option( 'hupso_custom', '1' );
|
304 |
+
update_option( 'hupso_share_buttons_code', $code );
|
305 |
+
}
|
306 |
+
}
|
307 |
+
|
308 |
+
if ( ( is_home() && $hupso_show_frontpage == 1 ) || ( is_archive() && $hupso_show_category == 1 ) ) {
|
309 |
+
$code .= 'var hupso_url="' . $post_url . '";';
|
310 |
+
}
|
311 |
+
|
312 |
+
$code .= '</script>';
|
313 |
+
$static_server = 'http://static.hupso.com/share/js/share.js';
|
314 |
+
$code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
|
315 |
|
|
|
|
|
316 |
$position = get_option( 'hupso_button_position', 'below' );
|
317 |
if ($position == 'below')
|
318 |
$new_content = $content . $code;
|