Hupso Share Buttons for Twitter, Facebook & Google+ - Version 3.9.23

Version Description

  • Fix for using echo do_shortcode('[hupso]') inside the loop
Download this release

Release Info

Developer kasal
Plugin Icon 128x128 Hupso Share Buttons for Twitter, Facebook & Google+
Version 3.9.23
Comparing to
See all releases

Code changes from version 3.9.22 to 3.9.23

Files changed (2) hide show
  1. readme.txt +7 -4
  2. share-buttons-hupso.php +243 -6
readme.txt CHANGED
@@ -1,14 +1,14 @@
1
  === Hupso Share Buttons for Twitter, Facebook & Google+ ===
2
  Contributors: kasal
3
  Donate link: http://www.hupso.com/
4
- Tags: twitter, facebook, google, social sharing, share buttons, social share buttons, share icons, stumbleupon, addthis, sharethis, sexybookmarks, addtoany, multisite, pinterest, print, tumblr
5
  Requires at least: 2.8
6
- Tested up to: 3.7
7
- Stable tag: 3.9.22
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Help visitors share your posts on popular social networks: Twitter, Facebook, Google+, Linkedin, Pinterest, StumbleUpon, Tumblr, Reddit and others.
12
 
13
  == Description ==
14
 
@@ -286,6 +286,9 @@ Please send bug reports and suggestion using [this feedback form](http://www.hup
286
 
287
  == Changelog ==
288
 
 
 
 
289
  = 3.9.22 =
290
  * Renren button
291
 
1
  === Hupso Share Buttons for Twitter, Facebook & Google+ ===
2
  Contributors: kasal
3
  Donate link: http://www.hupso.com/
4
+ Tags: twitter, facebook, google, social sharing, share buttons, social share buttons, share icons, stumbleupon, addthis, sharethis, sexybookmarks, addtoany, multisite, pinterest, print, tumblr, bebo
5
  Requires at least: 2.8
6
+ Tested up to: 3.7.1
7
+ Stable tag: 3.9.23
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Help share your posts on popular social networks: Twitter, Facebook, Google+, Linkedin, Pinterest, StumbleUpon, Tumblr, Reddit, Bebo and others.
12
 
13
  == Description ==
14
 
286
 
287
  == Changelog ==
288
 
289
+ = 3.9.23 =
290
+ * Fix for using echo do_shortcode('[hupso]') inside the loop
291
+
292
  = 3.9.22 =
293
  * Renren button
294
 
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, Tumblr, Pinterest, StumbleUpon, Digg, Reddit, Bebo, VKontakte 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: 3.9.22
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -12,7 +12,7 @@ Domain Path: /languages
12
  */
13
 
14
  global $HUPSO_VERSION;
15
- $HUPSO_VERSION = '3.9.22';
16
 
17
  $hupso_dev = '';
18
  $hupso_state = 'normal';
@@ -99,11 +99,11 @@ function hupso_shortcodes( $atts ) {
99
  global $hupso_state, $hupso_shortcode_params;
100
  $hupso_state = 'shortcodes';
101
  if ($atts == '') {
102
- return hupso_the_content('');
103
  }
104
  else {
105
  $hupso_shortcode_params = $atts;
106
- return hupso_the_content('');
107
  }
108
  }
109
 
@@ -1237,6 +1237,7 @@ function hupso_admin_settings_save() {
1237
  /* save custom post types */
1238
  $args = array(
1239
  'public' => true,
 
1240
  '_builtin' => false
1241
  );
1242
  $output = 'names'; // names or objects, note names is the default
@@ -1282,16 +1283,249 @@ function hupso_the_excerpt( $content ) {
1282
  }
1283
  }
1284
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1285
  function hupso_the_content( $content ) {
1286
 
1287
  global $hupso_plugin_url, $wp_version, $hupso_dev, $hupso_state, $HUPSO_SHOW, $hupso_p, $post;
1288
-
1289
  $value = '';
1290
  $hupso_meta_box = get_option( 'hupso_meta_box', '' );
1291
  if ($hupso_meta_box != "1") {
1292
  $value = '';
1293
  } else {
1294
- $value = get_post_meta( $post->ID, 'hupso-share-buttons', true );
 
 
1295
  if ($value == 'default') {
1296
  $value = '';
1297
  }
@@ -1315,6 +1549,9 @@ function hupso_the_content( $content ) {
1315
  if (isset($post)) {
1316
  $name = 'hupso_custom_post_' . $post->post_type;
1317
  }
 
 
 
1318
  $val = get_option( $name, '1' );
1319
  if ($val == '0') {
1320
  $content = str_ireplace('[hupso_hide]', '', $content);
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, Tumblr, Pinterest, StumbleUpon, Digg, Reddit, Bebo, VKontakte 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: 3.9.23
7
  Author: kasal
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
13
 
14
  global $HUPSO_VERSION;
15
+ $HUPSO_VERSION = '3.9.23';
16
 
17
  $hupso_dev = '';
18
  $hupso_state = 'normal';
99
  global $hupso_state, $hupso_shortcode_params;
100
  $hupso_state = 'shortcodes';
101
  if ($atts == '') {
102
+ return hupso_the_content_shortcodes('');
103
  }
104
  else {
105
  $hupso_shortcode_params = $atts;
106
+ return hupso_the_content_shortcodes('');
107
  }
108
  }
109
 
1237
  /* save custom post types */
1238
  $args = array(
1239
  'public' => true,
1240
+
1241
  '_builtin' => false
1242
  );
1243
  $output = 'names'; // names or objects, note names is the default
1283
  }
1284
  }
1285
 
1286
+ function hupso_the_content_shortcodes( $content ) {
1287
+ global $hupso_plugin_url, $wp_version, $hupso_dev, $hupso_state, $HUPSO_SHOW, $hupso_p, $post;
1288
+ global $post_url, $post_title;
1289
+
1290
+ $value = '';
1291
+ $hupso_meta_box = get_option( 'hupso_meta_box', '' );
1292
+ if ($hupso_meta_box != "1") {
1293
+ $value = '';
1294
+ } else {
1295
+ $value = get_post_meta( $post->ID, 'hupso-share-buttons', true );
1296
+ if ($value == 'default') {
1297
+ $value = '';
1298
+ }
1299
+
1300
+ if ($value == 'disabled') {
1301
+ $content = str_ireplace('[hupso_hide]', '', $content);
1302
+ $content = str_ireplace('[hupso]', '', $content);
1303
+ if ($value != 'enabled')
1304
+ return $content;
1305
+ }
1306
+ }
1307
+
1308
+ if ($HUPSO_SHOW == false) {
1309
+ $content = str_ireplace('[hupso_hide]', '', $content);
1310
+ $content = str_ireplace('[hupso]', '', $content);
1311
+ if ($value != 'enabled')
1312
+ return $content;
1313
+ }
1314
+
1315
+ $post_url = ( isset($GLOBALS['post']) ? get_permalink($GLOBALS['post']->ID) : get_permalink() );
1316
+ $post_title = ( isset( $GLOBALS['post'] ) ? $GLOBALS['post']->post_title : '' );
1317
+
1318
+
1319
+ /* Check if we are inside category where buttons are hidden */
1320
+ $cats = get_the_category();
1321
+ if (isset($cats[0])) {
1322
+ $current_category = @$cats[0]->slug;
1323
+ }
1324
+ else {
1325
+ $current_category = '';
1326
+ }
1327
+ $hupso_hide_categories = get_option( 'hupso_hide_categories' , array() );
1328
+ if ( $hupso_hide_categories == '' ) {
1329
+ $hupso_hide_categories = array();
1330
+ }
1331
+
1332
+ $hupso_title_text = get_option( 'hupso_title_text' , 'post' );
1333
+ $hupso_twitter_via = get_option( 'hupso_twitter_via', '' );
1334
+ $hupso_counters_lang = get_option( 'hupso_counters_lang', 'en_US' );
1335
+
1336
+ $hupso_page_url = get_option( 'hupso_page_url', '' );
1337
+ $hupso_page_title = stripslashes(get_option( 'hupso_page_title', '' ));
1338
+
1339
+
1340
+ /* default code */
1341
+ $share_code = '<!-- Hupso Share Buttons - http://www.hupso.com/share/ --><a class="hupso_toolbar" href="http://www.hupso.com/share/"><img src="' . $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/buttons/share-medium.png" style="border:0px; padding-top:5px; float:left;" alt="Share"/></a><script type="text/javascript">var hupso_services_t=new Array("Twitter","Facebook","Google Plus","Linkedin","StumbleUpon","Digg","Reddit","Bebo","Delicious"); var hupso_toolbar_size_t="medium";';
1342
+
1343
+ $code = get_option( 'hupso_share_buttons_code', $share_code );
1344
+ if ( $hupso_p == 'https:' ) {
1345
+ $code = str_replace( 'src="http://static.hupso.com', 'src="https://static.hupso.com', $code );
1346
+ }
1347
+
1348
+ $button_type = get_option( 'hupso_button_type', 'share_toolbar' );
1349
+
1350
+ /* Check for old saved button code, prior to version 1.3 */
1351
+ if ( get_option( 'hupso_custom', '0' ) == 0 ) {
1352
+ $old_check = strpos( $code, '</script>' );
1353
+ if ( $old_check !== false ) {
1354
+ $code = substr( $code, 0, $old_check );
1355
+
1356
+ /* Save new code */
1357
+ update_option( 'hupso_custom', '1' );
1358
+ update_option( 'hupso_share_buttons_code', $code );
1359
+ }
1360
+ }
1361
+
1362
+ /* Check for old saved button code, prior to version 2.0 */
1363
+ $old_check = strpos( $code, 'hupso_pop' );
1364
+ if ( $old_check !== false ) {
1365
+ $button_type = 'share_button';
1366
+ }
1367
+ $old_check = strpos( $code, 'hupso_toolbar' );
1368
+ if ( $old_check !== false ) {
1369
+ $button_type = 'share_toolbar';
1370
+ }
1371
+
1372
+ /* Check for RTL language */
1373
+ $rtl = false;
1374
+ if ( version_compare($wp_version, '3.0', '<' ) ) {
1375
+ if ( get_bloginfo('text_direction') == 'rtl' ) {
1376
+ $rtl = true;
1377
+ }
1378
+ }
1379
+ else {
1380
+ $rtl = is_rtl();
1381
+ }
1382
+
1383
+ if ( $rtl ) {
1384
+ $code = str_replace( 'float:left', 'float:right', $code );
1385
+ }
1386
+
1387
+ /* Twitter via @ */
1388
+ if ( $hupso_twitter_via != '') {
1389
+ $code .= 'var hupso_twitter_via="' . $hupso_twitter_via . '";';
1390
+ }
1391
+
1392
+ /* Get shortcode params (if they exist) */
1393
+ global $hupso_shortcode_params;
1394
+ if ($hupso_shortcode_params != '') {
1395
+ if ( isset( $hupso_shortcode_params['title'] ) ) {
1396
+ $h_title = $hupso_shortcode_params['title'];
1397
+ }
1398
+ else {
1399
+ $h_title = '';
1400
+ }
1401
+ if ( isset( $hupso_shortcode_params['url'] ) ) {
1402
+ $h_url = $hupso_shortcode_params['url'];
1403
+ }
1404
+ else {
1405
+ $h_url = '';
1406
+ }
1407
+ }
1408
+
1409
+
1410
+ /* Shortcode param */
1411
+ if ( ($hupso_shortcode_params != '') && ($h_url != '') ) {
1412
+ $new_url = $h_url;
1413
+ }
1414
+
1415
+ $new_url = $post_url;
1416
+
1417
+ switch ( $button_type ) {
1418
+ case 'share_button':
1419
+ $code .= 'var hupso_url="' . $new_url . '";';
1420
+ break;
1421
+ case 'share_toolbar':
1422
+ $code .= 'var hupso_url_t="' . $new_url . '";';
1423
+ break;
1424
+ case 'counters':
1425
+ $code .= 'var hupso_url_c="' . $new_url . '";';
1426
+ break;
1427
+ }
1428
+
1429
+
1430
+
1431
+ if ( $hupso_title_text == 'post' ) {
1432
+ $ptitle = strip_tags($post_title);
1433
+ if ( $hupso_page_title != '' ) {
1434
+ $new_title = $hupso_page_title;
1435
+ }
1436
+ else {
1437
+ $new_title = $ptitle;
1438
+ }
1439
+
1440
+ /* Shortcode param */
1441
+ if ( ($hupso_shortcode_params != '') && ($h_title != '') ) {
1442
+ $new_title = $h_title;
1443
+ }
1444
+
1445
+ $new_title = $post_title;
1446
+
1447
+ switch ( $button_type ) {
1448
+ case 'share_button':
1449
+ $code .= 'var hupso_title="' . str_replace('"', '&quot;', $new_title) . '";';
1450
+ break;
1451
+ case 'share_toolbar':
1452
+ $code .= 'var hupso_title_t="' . str_replace('"', '&quot;', $new_title) . '";';
1453
+ break;
1454
+ case 'counters':
1455
+ $code .= 'var hupso_title_c="' . str_replace('"', '&quot;', $new_title) . '";';
1456
+ break;
1457
+ }
1458
+ }
1459
+
1460
+ $code .= '</script>';
1461
+
1462
+ switch ( $button_type ) {
1463
+ case 'share_button':
1464
+ $js_file = 'share.js';
1465
+ break;
1466
+ case 'share_toolbar':
1467
+ $js_file = 'share_toolbar.js';
1468
+ break;
1469
+ case 'counters':
1470
+ $js_file = 'counters.js';
1471
+ break;
1472
+ }
1473
+
1474
+ $static_server = $hupso_p . '//static.hupso.com/share' . $hupso_dev . '/js/' . $js_file;
1475
+ $code .= '<script type="text/javascript" src="' . $static_server . '"></script><!-- Hupso Share Buttons -->';
1476
+
1477
+ $position = get_option( 'hupso_button_position', 'below' );
1478
+
1479
+ $hupso_css_style = get_option( 'hupso_css_style', 'padding-bottom:20px; padding-top:10px;');
1480
+ if ($hupso_css_style != '') {
1481
+ $hupso_css_out = ' style="' . $hupso_css_style . '"';
1482
+ }
1483
+ else {
1484
+ $hupso_css_out = '';
1485
+ }
1486
+ $hupso_css_out .= ' class="hupso-share-buttons"';
1487
+
1488
+ if ( stripos($content, '[hupso]') !== false) {
1489
+ $new_content = str_ireplace('[hupso]', '<div ' . $hupso_css_out. '>' . $code . '</div>', $content);
1490
+ }
1491
+ else {
1492
+ switch ( $position ) {
1493
+ case 'below':
1494
+ $new_content = $content . '<div' . $hupso_css_out. '>' . $code . '</div>';
1495
+ break;
1496
+ case 'above':
1497
+ $new_content = '<div' . $hupso_css_out. '>' . $code . '</div>' . $content;
1498
+ break;
1499
+ case 'both':
1500
+ if ( $hupso_state == 'normal' ) {
1501
+ /* article */
1502
+ $new_content = '<div' . $hupso_css_out. '>' . $code . '</div>' . $content . '<div' . $hupso_css_out. '>' . $code . '</div>';
1503
+ }
1504
+ else {
1505
+ /* widget, shortcodes */
1506
+ $new_content = '<div' . $hupso_css_out. '>' . $code . '</div>' . $content;
1507
+ }
1508
+ break;
1509
+ default:
1510
+ $new_content = $content . '<div' . $hupso_css_out. '>' . $code . '</div>';
1511
+ }
1512
+ }
1513
+
1514
+ return $new_content;
1515
+ }
1516
+
1517
  function hupso_the_content( $content ) {
1518
 
1519
  global $hupso_plugin_url, $wp_version, $hupso_dev, $hupso_state, $HUPSO_SHOW, $hupso_p, $post;
1520
+
1521
  $value = '';
1522
  $hupso_meta_box = get_option( 'hupso_meta_box', '' );
1523
  if ($hupso_meta_box != "1") {
1524
  $value = '';
1525
  } else {
1526
+ if (isset($post->ID)) {
1527
+ $value = get_post_meta( $post->ID, 'hupso-share-buttons', true );
1528
+ }
1529
  if ($value == 'default') {
1530
  $value = '';
1531
  }
1549
  if (isset($post)) {
1550
  $name = 'hupso_custom_post_' . $post->post_type;
1551
  }
1552
+ else {
1553
+ $name = '';
1554
+ }
1555
  $val = get_option( $name, '1' );
1556
  if ($val == '0') {
1557
  $content = str_ireplace('[hupso_hide]', '', $content);