Social Share WordPress Plugin – AccessPress Social Share - Version 4.0.4

Version Description

  • Addition of options to enable OpenShareCount and NewShareCounts for fetching the twitter share counts.
Download this release

Release Info

Developer Access Keys
Plugin Icon 128x128 Social Share WordPress Plugin – AccessPress Social Share
Version 4.0.4
Comparing to
See all releases

Code changes from version 4.0.3 to 4.0.4

accesspress-social-share.php CHANGED
@@ -4,7 +4,7 @@ defined( 'ABSPATH' ) or die( "No script kiddies please!" );
4
  Plugin name: AccessPress Social Share
5
  Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-share/
6
  Description: A plugin to add various social media shares to a site with dynamic configuration options.
7
- Version: 4.0.3
8
  Author: AccessPress Themes
9
  Author URI: http://accesspressthemes.com
10
  Text Domain: accesspress-social-share
@@ -30,7 +30,7 @@ if ( !defined( 'APSS_LANG_DIR' ) ) {
30
  }
31
 
32
  if ( !defined( 'APSS_VERSION' ) ) {
33
- define( 'APSS_VERSION', '4.0.3' );
34
  }
35
 
36
  if ( !defined( 'APSS_TEXT_DOMAIN' ) ) {
@@ -418,7 +418,20 @@ if ( !class_exists( 'APSS_Class' ) ) {
418
  //for setting the counter transient in separate options value
419
  $apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
420
  if ( false === $twitter_transient_count ) {
421
- $json_string = $this->get_json_values( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $url );
 
 
 
 
 
 
 
 
 
 
 
 
 
422
  $json = json_decode( $json_string, true );
423
  $tweet_count = isset( $json['count'] ) ? intval( $json['count'] ) : 0;
424
  set_transient( $twitter_transient, $tweet_count, $cache_period * HOUR_IN_SECONDS );
@@ -429,6 +442,14 @@ if ( !class_exists( 'APSS_Class' ) ) {
429
  } else {
430
  $tweet_count = $twitter_transient_count;
431
  }
 
 
 
 
 
 
 
 
432
  return $tweet_count;
433
  }
434
 
4
  Plugin name: AccessPress Social Share
5
  Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-share/
6
  Description: A plugin to add various social media shares to a site with dynamic configuration options.
7
+ Version: 4.0.4
8
  Author: AccessPress Themes
9
  Author URI: http://accesspressthemes.com
10
  Text Domain: accesspress-social-share
30
  }
31
 
32
  if ( !defined( 'APSS_VERSION' ) ) {
33
+ define( 'APSS_VERSION', '4.0.4' );
34
  }
35
 
36
  if ( !defined( 'APSS_TEXT_DOMAIN' ) ) {
418
  //for setting the counter transient in separate options value
419
  $apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
420
  if ( false === $twitter_transient_count ) {
421
+ $api_selection = $apss_settings['twitter_counter_api'];
422
+
423
+ // $json_string = $this->get_json_values( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $url );
424
+
425
+ if($api_selection == '2'){
426
+ $json_string = $this->get_json_values( 'http://public.newsharecounts.com/count.json?url=' . $url );
427
+
428
+ }else if($api_selection == '3'){
429
+ $json_string = $this->get_json_values( 'http://opensharecount.com/count.json?url=' . $url );
430
+
431
+ }else{
432
+ $json_string = $this->get_json_values( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $url );
433
+ }
434
+
435
  $json = json_decode( $json_string, true );
436
  $tweet_count = isset( $json['count'] ) ? intval( $json['count'] ) : 0;
437
  set_transient( $twitter_transient, $tweet_count, $cache_period * HOUR_IN_SECONDS );
442
  } else {
443
  $tweet_count = $twitter_transient_count;
444
  }
445
+
446
+ // $json_string = $this->get_json_values( 'http://opensharecount.com/count.json?url=' . $url );
447
+ // // $json_string = $this->get_json_values( 'http://public.newsharecounts.com/count.json?url=' . $url );
448
+ // $json = json_decode( $json_string, true );
449
+ // echo $json['count'];
450
+ // print_r($json);
451
+ // die();
452
+
453
  return $tweet_count;
454
  }
455
 
css/backend.css CHANGED
@@ -383,3 +383,11 @@
383
  display:inline-block;
384
  }
385
 
 
 
 
 
 
 
 
 
383
  display:inline-block;
384
  }
385
 
386
+
387
+ .apss-counter-api {
388
+ margin-top: 10px;
389
+ }
390
+
391
+ .apss-counter-api-options.apss-counter-settings.clearfix {
392
+ margin-top: 10px !important;
393
+ }
inc/backend/activation.php CHANGED
@@ -23,6 +23,7 @@ $apss_share_settings['disable_frontend_assets'] = '0';
23
  $apss_share_settings['share_text'] = '';
24
  $apss_share_settings['twitter_username'] = '';
25
  $apss_share_settings['counter_enable_options'] = '0';
 
26
  $apss_share_settings['total_counter_enable_options'] = '0';
27
  $apss_share_settings['cache_period'] = '24';
28
  $apss_share_settings['apss_social_counts_transients'] = array();
23
  $apss_share_settings['share_text'] = '';
24
  $apss_share_settings['twitter_username'] = '';
25
  $apss_share_settings['counter_enable_options'] = '0';
26
+ $apss_share_settings['twitter_counter_api'] = '1';
27
  $apss_share_settings['total_counter_enable_options'] = '0';
28
  $apss_share_settings['cache_period'] = '24';
29
  $apss_share_settings['apss_social_counts_transients'] = array();
inc/backend/main-page.php CHANGED
@@ -175,6 +175,31 @@
175
  } ?> /><label for="counter_enable_options_y"><?php _e( 'Yes', 'accesspress-social-share' ); ?></label></div>
176
  </div>
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  <div class="apss-total-counter-settings clearfix">
179
  <h4><?php _e( 'Social share total counter enable?', 'accesspress-social-share' ); ?> </h4>
180
  <div class="misc-opt"><input type="radio" id='total_counter_enable_options_n' name="apss_share_settings[total_counter_enable_options]" value="0" <?php if ( isset( $options['total_counter_enable_options'] ) && $options['total_counter_enable_options'] == '0' ) {
175
  } ?> /><label for="counter_enable_options_y"><?php _e( 'Yes', 'accesspress-social-share' ); ?></label></div>
176
  </div>
177
 
178
+ <div class="apss-counter-api-options apss-counter-settings clearfix" style="<?php if(isset($options['counter_enable_options']) && $options['counter_enable_options'] == '1'){ echo 'display:block'; }else{ echo 'display:none'; } ?>">
179
+ <div class='apss-counter-api'>
180
+ <input type="radio" id='apss_twitter_counter_option' name="apss_share_settings[twitter_counter_api]" value="1" <?php if(isset($options['twitter_counter_api'])){ if($options['twitter_counter_api'] == '1') {
181
+ echo "checked='checked'";
182
+ } } ?> />
183
+ <label for="apss_twitter_counter_option"><?php _e( "Don't show Twitter share counts", 'accesspress-social-share' ); ?></label>
184
+ <div class="apss_notes_cache_settings"> Please select this option if you don't want to show twitter share counts.</div>
185
+ </div>
186
+
187
+ <div class='apss-counter-api'>
188
+ <input type="radio" id='apss_twitter_counter_option_1' name="apss_share_settings[twitter_counter_api]" value="2" <?php if(isset($options['twitter_counter_api'])){ if($options['twitter_counter_api'] == '2') {
189
+ echo "checked='checked'";
190
+ } } ?> />
191
+ <label for="apss_twitter_counter_option_1"><?php _e( 'Use', 'accesspress-social-share'); ?> <a href='http://newsharecounts.com' target='_blank'>NewShareCounts</a><?php _e( ' to show Twitter share counts', 'accesspress-social-share' ); ?></label>
192
+ <div class="apss_notes_cache_settings"> To use newsharecount public API, you have to enter your website url <?php echo site_url(); ?> and sign in using Twitter at their <a href='http://newsharecounts.com/' target='_blank'>website</a>.</div>
193
+ </div>
194
+
195
+ <div class='apss-counter-api'>
196
+ <input type="radio" id='apss_twitter_counter_option_2' name="apss_share_settings[twitter_counter_api]" value="3" <?php if(isset($options['twitter_counter_api'])){ if($options['twitter_counter_api'] == '3') {
197
+ echo "checked='checked'";
198
+ }} ?> /><label for="apss_twitter_counter_option_2"><?php _e( 'Use', 'accesspress-social-share'); ?> <a href='http://http://opensharecount.com/.com' target='_blank'>OpenShareCount</a><?php _e( ' to show Twitter share counts', 'accesspress-social-share' ); ?></label>
199
+ <div class="apss_notes_cache_settings"> To use opensharecount public API, you have to sign up and register your website url <?php echo site_url(); ?> at their <a href='http://opensharecount.com/' target='_blank'>website</a>. </div>
200
+ </div>
201
+ </div>
202
+
203
  <div class="apss-total-counter-settings clearfix">
204
  <h4><?php _e( 'Social share total counter enable?', 'accesspress-social-share' ); ?> </h4>
205
  <div class="misc-opt"><input type="radio" id='total_counter_enable_options_n' name="apss_share_settings[total_counter_enable_options]" value="0" <?php if ( isset( $options['total_counter_enable_options'] ) && $options['total_counter_enable_options'] == '0' ) {
inc/backend/save-settings.php CHANGED
@@ -23,6 +23,7 @@ $apss_share_settings['disable_frontend_assets'] = isset( $_POST['apss_share_se
23
  $apss_share_settings['share_text'] = sanitize_text_field( $_POST['apss_share_settings']['share_text'] );
24
  $apss_share_settings['twitter_username'] = stripslashes_deep( $_POST['apss_share_settings']['twitter_username'] );
25
  $apss_share_settings['counter_enable_options'] = $_POST['apss_share_settings']['counter_enable_options'];
 
26
  $apss_share_settings['total_counter_enable_options'] = $_POST['apss_share_settings']['total_counter_enable_options'];
27
  $apss_share_settings['cache_period'] = is_numeric( $_POST['apss_share_settings']['cache_settings'] ) ? $_POST['apss_share_settings']['cache_settings'] : '24';
28
  $apss_share_settings['dialog_box_options'] = $_POST['apss_share_settings']['dialog_box_options'];
23
  $apss_share_settings['share_text'] = sanitize_text_field( $_POST['apss_share_settings']['share_text'] );
24
  $apss_share_settings['twitter_username'] = stripslashes_deep( $_POST['apss_share_settings']['twitter_username'] );
25
  $apss_share_settings['counter_enable_options'] = $_POST['apss_share_settings']['counter_enable_options'];
26
+ $apss_share_settings['twitter_counter_api'] = $_POST['apss_share_settings']['twitter_counter_api'];
27
  $apss_share_settings['total_counter_enable_options'] = $_POST['apss_share_settings']['total_counter_enable_options'];
28
  $apss_share_settings['cache_period'] = is_numeric( $_POST['apss_share_settings']['cache_settings'] ) ? $_POST['apss_share_settings']['cache_settings'] : '24';
29
  $apss_share_settings['dialog_box_options'] = $_POST['apss_share_settings']['dialog_box_options'];
inc/frontend/content-filter.php CHANGED
@@ -3,6 +3,7 @@
3
  $apss_link_open_option = ($options['dialog_box_options'] == '1') ? "_blank" : "";
4
  $twitter_user = $options['twitter_username'];
5
  $counter_enable_options = $options['counter_enable_options'];
 
6
  $icon_set_value = $options['social_icon_set'];
7
  $url = get_permalink(); //$this->curPageURL();
8
  $cache_period = ($options['cache_period'] != '') ? $options['cache_period'] * 60 * 60 : 24 * 60 * 60;
@@ -63,6 +64,9 @@ foreach ( $options['social_networks'] as $key => $value ) {
63
  <i class='fa fa-twitter'></i>
64
  <span class='apss-social-text'><?php _e( 'Share on Twitter', 'accesspress-social-share' ); ?></span><span class='apss-share'><?php _e( 'Tweet', 'accesspress-social-share' ); ?></span>
65
  </div>
 
 
 
66
  </a>
67
  </div>
68
  <?php
3
  $apss_link_open_option = ($options['dialog_box_options'] == '1') ? "_blank" : "";
4
  $twitter_user = $options['twitter_username'];
5
  $counter_enable_options = $options['counter_enable_options'];
6
+ $twitter_api_use = $options['twitter_counter_api'];
7
  $icon_set_value = $options['social_icon_set'];
8
  $url = get_permalink(); //$this->curPageURL();
9
  $cache_period = ($options['cache_period'] != '') ? $options['cache_period'] * 60 * 60 : 24 * 60 * 60;
64
  <i class='fa fa-twitter'></i>
65
  <span class='apss-social-text'><?php _e( 'Share on Twitter', 'accesspress-social-share' ); ?></span><span class='apss-share'><?php _e( 'Tweet', 'accesspress-social-share' ); ?></span>
66
  </div>
67
+ <?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' && $twitter_api_use !='1' ) { ?>
68
+ <div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
69
+ <?php } ?>
70
  </a>
71
  </div>
72
  <?php
inc/frontend/shortcode.php CHANGED
@@ -5,6 +5,7 @@ $options = get_option( APSS_SETTING_NAME );
5
  $apss_link_open_option = ($options['dialog_box_options'] == '1') ? "_blank" : "";
6
  $twitter_user = $options['twitter_username'];
7
  $icon_set_value = $options['social_icon_set'];
 
8
  $url = get_permalink();
9
  $cache_period = ($options['cache_period'] != '') ? $options['cache_period'] * 60 * 60 : 24 * 60 * 60;
10
  if ( isset( $attr['networks'] ) ) {
@@ -90,9 +91,9 @@ if ( strlen( $content ) >= 100 ) {
90
  <i class='fa fa-twitter'></i>
91
  <span class='apss-social-text'><?php _e( 'Share on Twitter', 'accesspress-social-share' ); ?></span><span class='apss-share'><?php _e( 'Tweet', 'accesspress-social-share' ); ?></span>
92
  </div>
93
- <?php /* if ( isset( $counter_enable_options ) && $counter_enable_options == '1' ) { ?>
94
  <div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
95
- <?php } */ ?>
96
  </a>
97
  </div>
98
  <?php
5
  $apss_link_open_option = ($options['dialog_box_options'] == '1') ? "_blank" : "";
6
  $twitter_user = $options['twitter_username'];
7
  $icon_set_value = $options['social_icon_set'];
8
+ $twitter_api_use = $options['twitter_counter_api'];
9
  $url = get_permalink();
10
  $cache_period = ($options['cache_period'] != '') ? $options['cache_period'] * 60 * 60 : 24 * 60 * 60;
11
  if ( isset( $attr['networks'] ) ) {
91
  <i class='fa fa-twitter'></i>
92
  <span class='apss-social-text'><?php _e( 'Share on Twitter', 'accesspress-social-share' ); ?></span><span class='apss-share'><?php _e( 'Tweet', 'accesspress-social-share' ); ?></span>
93
  </div>
94
+ <?php if ( isset( $counter_enable_options ) && $counter_enable_options == '1' && $twitter_api_use !='1' ) { ?>
95
  <div class='count apss-count' data-url='<?php echo $url; ?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url . '_' . $key; ?>"><?php echo $count; ?></div>
96
+ <?php } ?>
97
  </a>
98
  </div>
99
  <?php
js/backend.js CHANGED
@@ -35,6 +35,14 @@ jQuery('.'+args).html('');
35
  return false;
36
  }
37
  });
 
 
 
 
 
 
 
 
38
  });//document.ready close
39
 
40
  }(jQuery));
35
  return false;
36
  }
37
  });
38
+
39
+ $('#counter_enable_options_y').click(function(){
40
+ $('.apss-counter-api-options').show();
41
+ });
42
+ $('#counter_enable_options_n').click(function(){
43
+ $('.apss-counter-api-options').hide();
44
+ });
45
+
46
  });//document.ready close
47
 
48
  }(jQuery));
js/frontend.js CHANGED
@@ -35,4 +35,6 @@ jQuery(document).ready(function ($) {
35
  // }
36
  // });
37
  }
 
 
38
  });
35
  // }
36
  // });
37
  }
38
+
39
+
40
  });
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: social share counter, social share, social media share, social network sha
4
  Donate link: http://accesspressthemes.com/donation/
5
  Requires at least: 3.8
6
  Tested up to: 4.4
7
- Stable tag: 4.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -131,6 +131,9 @@ Yes. You can use the AccessPress social share by using shortcode anywhere you wa
131
  6. Backend Miscellaneous Settings Section
132
 
133
  == Changelog ==
 
 
 
134
  = 4.0.3 =
135
  * Removal of unncessary commented codes from twitter share.
136
 
4
  Donate link: http://accesspressthemes.com/donation/
5
  Requires at least: 3.8
6
  Tested up to: 4.4
7
+ Stable tag: 4.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
131
  6. Backend Miscellaneous Settings Section
132
 
133
  == Changelog ==
134
+ = 4.0.4 =
135
+ * Addition of options to enable OpenShareCount and NewShareCounts for fetching the twitter share counts.
136
+
137
  = 4.0.3 =
138
  * Removal of unncessary commented codes from twitter share.
139