Social Share WordPress Plugin – AccessPress Social Share - Version 2.0.1

Version Description

  • Social share counter cache period setting bug fixing done.
Download this release

Release Info

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

Code changes from version 2.0.0 to 2.0.1

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: 2.0.0
8
  Author: AccessPress Themes
9
  Author URI: http://accesspressthemes.com
10
  Text Domain:apss-share
@@ -30,7 +30,7 @@ if( !defined( 'APSS_LANG_DIR' ) ) {
30
  }
31
 
32
  if( !defined( 'APSS_VERSION' ) ) {
33
- define( 'APSS_VERSION', '2.0.0' );
34
  }
35
 
36
  if(!defined('APSS_TEXT_DOMAIN')){
@@ -132,7 +132,7 @@ if( !class_exists( 'APSS_Class' ) ){
132
  $is_lists_authorized = (is_search()) && $all ? true : false;
133
 
134
  $is_attachement_check = in_array('attachment', $options['share_options']);
135
- $is_attachement = (is_attachment() && $is_attachement_check ) ? true : false;
136
 
137
  $front_page = in_array('front_page', $options['share_options']);
138
  $is_front_page=(is_front_page()) && $front_page ? true : false;
@@ -229,7 +229,7 @@ if( !class_exists( 'APSS_Class' ) ){
229
  delete_transient($transient);
230
  }
231
  update_option( APSS_COUNT_TRANSIENTS, array() );
232
- $transient_array = array('apss_tweets_count', 'apss_linkedin_count', 'apss_fb_count', 'apss_pin_count', 'apss_google_plus_count', 'apss_stumble_count', 'apss_delicious_count', 'apss_reddit_count');
233
  foreach ($transient_array as $transient) {
234
  delete_transient($transient);
235
  }
@@ -304,17 +304,16 @@ if( !class_exists( 'APSS_Class' ) ){
304
  //for facebook url share count
305
  function get_fb($url) {
306
  $apss_settings = $this->apss_settings;
307
- $cache_period = $apss_settings['cache_period']*60*60;
308
  $fb_transient = 'fb_' . md5($url);
309
  $fb_transient_count = get_transient($fb_transient);
310
-
311
  //for setting the counter transient in separate options value
312
  $apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
313
  if (false === $fb_transient_count) {
314
  $json_string = $this->get_json_values( 'https://graph.facebook.com/?id=' . $url );
315
  $json = json_decode( $json_string, true );
316
  $facebook_count = isset($json['shares']) ? intval( $json['shares'] ) : 0;
317
- set_transient($fb_transient, $facebook_count, $cache_period);
318
  if( !in_array( $fb_transient, $apss_social_counts_transients) ){
319
  $apss_social_counts_transients[] = $fb_transient;
320
  update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients);
@@ -328,7 +327,7 @@ if( !class_exists( 'APSS_Class' ) ){
328
  //for twitter url share count
329
  function get_tweets($url) {
330
  $apss_settings = $this->apss_settings;
331
- $cache_period = $apss_settings['cache_period']*60*60;
332
  $twitter_transient = 'twitter_' . md5($url);
333
  $twitter_transient_count = get_transient($twitter_transient);
334
 
@@ -338,7 +337,7 @@ if( !class_exists( 'APSS_Class' ) ){
338
  $json_string = $this->get_json_values('http://urls.api.twitter.com/1/urls/count.json?url=' . $url);
339
  $json = json_decode($json_string, true);
340
  $tweet_count = isset($json['count']) ? intval($json['count']) : 0;
341
- set_transient($twitter_transient, $tweet_count, $cache_period);
342
  if(!in_array($twitter_transient, $apss_social_counts_transients)){
343
  $apss_social_counts_transients[] = $twitter_transient;
344
  update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
@@ -352,7 +351,7 @@ if( !class_exists( 'APSS_Class' ) ){
352
  //for google plus url share count
353
  function get_plusones($url) {
354
  $apss_settings = $this->apss_settings;
355
- $cache_period = $apss_settings['cache_period']*60*60;
356
  $googlePlus_transient = 'gp_' . md5($url);
357
  $googlePlus_transient_count = get_transient($googlePlus_transient);
358
 
@@ -370,7 +369,7 @@ if( !class_exists( 'APSS_Class' ) ){
370
  curl_close($curl);
371
  $json = json_decode($curl_results, true);
372
  $plusones_count = isset($json[0]['result']['metadata']['globalCounts']['count']) ? intval($json[0]['result']['metadata']['globalCounts']['count']) : 0;
373
- set_transient($googlePlus_transient, $plusones_count, $cache_period);
374
  if(!in_array($googlePlus_transient, $apss_social_counts_transients)){
375
  $apss_social_counts_transients[] = $googlePlus_transient;
376
  update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
@@ -384,7 +383,7 @@ if( !class_exists( 'APSS_Class' ) ){
384
  //for pinterest url share count
385
  function get_pinterest($url) {
386
  $apss_settings = $this->apss_settings;
387
- $cache_period = $apss_settings['cache_period']*60*60;
388
  $pinterest_transient = 'pinterest_' . md5($url);
389
  $pinterest_transient_count = get_transient($pinterest_transient);
390
 
@@ -395,7 +394,7 @@ if( !class_exists( 'APSS_Class' ) ){
395
  $json_string = preg_replace('/^receiveCount\((.*)\)$/', "\\1", $json_string);
396
  $json = json_decode($json_string, true);
397
  $pinterest_count = isset($json['count']) ? intval($json['count']) : 0;
398
- set_transient($pinterest_transient, $pinterest_count, $cache_period);
399
  if(!in_array($pinterest_transient, $apss_social_counts_transients)){
400
  $apss_social_counts_transients[] = $pinterest_transient;
401
  update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
@@ -410,7 +409,7 @@ if( !class_exists( 'APSS_Class' ) ){
410
  //for linkedin url share count
411
  function get_linkedin($url) {
412
  $apss_settings = $this->apss_settings;
413
- $cache_period = $apss_settings['cache_period']*60*60;
414
  $linkedin_transient = 'linkedin_' . md5($url);
415
  $linkedin_transient_count = get_transient($linkedin_transient);
416
 
@@ -420,7 +419,7 @@ if( !class_exists( 'APSS_Class' ) ){
420
  $json_string = $this->get_json_values("https://www.linkedin.com/countserv/count/share?url=$url&format=json");
421
  $json = json_decode($json_string, true);
422
  $linkedin_count = isset($json['count']) ? intval($json['count']) : 0;
423
- set_transient($linkedin_transient, $linkedin_count, $cache_period);
424
  if(!in_array($linkedin_transient, $apss_social_counts_transients)){
425
  $apss_social_counts_transients[] = $linkedin_transient;
426
  update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
@@ -433,8 +432,8 @@ if( !class_exists( 'APSS_Class' ) ){
433
 
434
  //function to return json values from social media urls
435
  private function get_json_values( $url ){
436
- $apss_settings = $this->apss_settings;
437
- $cache_period = $apss_settings['cache_period']*60*60;
438
  $args = array( 'timeout' => 10 );
439
  $response = wp_remote_get( $url, $args );
440
  $json_response = wp_remote_retrieve_body( $response );
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: 2.0.1
8
  Author: AccessPress Themes
9
  Author URI: http://accesspressthemes.com
10
  Text Domain:apss-share
30
  }
31
 
32
  if( !defined( 'APSS_VERSION' ) ) {
33
+ define( 'APSS_VERSION', '2.0.1' );
34
  }
35
 
36
  if(!defined('APSS_TEXT_DOMAIN')){
132
  $is_lists_authorized = (is_search()) && $all ? true : false;
133
 
134
  $is_attachement_check = in_array('attachment', $options['share_options']);
135
+ $is_attachement = (is_attachment() && $is_attachement_check ) ? true : false;
136
 
137
  $front_page = in_array('front_page', $options['share_options']);
138
  $is_front_page=(is_front_page()) && $front_page ? true : false;
229
  delete_transient($transient);
230
  }
231
  update_option( APSS_COUNT_TRANSIENTS, array() );
232
+ $transient_array = array('apss_tweets_count', 'apss_linkedin_count', 'apss_fb_count', 'apss_pin_count', 'apss_google_plus_count');
233
  foreach ($transient_array as $transient) {
234
  delete_transient($transient);
235
  }
304
  //for facebook url share count
305
  function get_fb($url) {
306
  $apss_settings = $this->apss_settings;
307
+ $cache_period = $apss_settings['cache_period'];
308
  $fb_transient = 'fb_' . md5($url);
309
  $fb_transient_count = get_transient($fb_transient);
 
310
  //for setting the counter transient in separate options value
311
  $apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
312
  if (false === $fb_transient_count) {
313
  $json_string = $this->get_json_values( 'https://graph.facebook.com/?id=' . $url );
314
  $json = json_decode( $json_string, true );
315
  $facebook_count = isset($json['shares']) ? intval( $json['shares'] ) : 0;
316
+ set_transient($fb_transient, $facebook_count, $cache_period * HOUR_IN_SECONDS );
317
  if( !in_array( $fb_transient, $apss_social_counts_transients) ){
318
  $apss_social_counts_transients[] = $fb_transient;
319
  update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients);
327
  //for twitter url share count
328
  function get_tweets($url) {
329
  $apss_settings = $this->apss_settings;
330
+ $cache_period = $apss_settings['cache_period'];
331
  $twitter_transient = 'twitter_' . md5($url);
332
  $twitter_transient_count = get_transient($twitter_transient);
333
 
337
  $json_string = $this->get_json_values('http://urls.api.twitter.com/1/urls/count.json?url=' . $url);
338
  $json = json_decode($json_string, true);
339
  $tweet_count = isset($json['count']) ? intval($json['count']) : 0;
340
+ set_transient($twitter_transient, $tweet_count, $cache_period * HOUR_IN_SECONDS);
341
  if(!in_array($twitter_transient, $apss_social_counts_transients)){
342
  $apss_social_counts_transients[] = $twitter_transient;
343
  update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
351
  //for google plus url share count
352
  function get_plusones($url) {
353
  $apss_settings = $this->apss_settings;
354
+ $cache_period = $apss_settings['cache_period'];
355
  $googlePlus_transient = 'gp_' . md5($url);
356
  $googlePlus_transient_count = get_transient($googlePlus_transient);
357
 
369
  curl_close($curl);
370
  $json = json_decode($curl_results, true);
371
  $plusones_count = isset($json[0]['result']['metadata']['globalCounts']['count']) ? intval($json[0]['result']['metadata']['globalCounts']['count']) : 0;
372
+ set_transient($googlePlus_transient, $plusones_count, $cache_period * HOUR_IN_SECONDS);
373
  if(!in_array($googlePlus_transient, $apss_social_counts_transients)){
374
  $apss_social_counts_transients[] = $googlePlus_transient;
375
  update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
383
  //for pinterest url share count
384
  function get_pinterest($url) {
385
  $apss_settings = $this->apss_settings;
386
+ $cache_period = $apss_settings['cache_period'];
387
  $pinterest_transient = 'pinterest_' . md5($url);
388
  $pinterest_transient_count = get_transient($pinterest_transient);
389
 
394
  $json_string = preg_replace('/^receiveCount\((.*)\)$/', "\\1", $json_string);
395
  $json = json_decode($json_string, true);
396
  $pinterest_count = isset($json['count']) ? intval($json['count']) : 0;
397
+ set_transient($pinterest_transient, $pinterest_count, $cache_period * HOUR_IN_SECONDS);
398
  if(!in_array($pinterest_transient, $apss_social_counts_transients)){
399
  $apss_social_counts_transients[] = $pinterest_transient;
400
  update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
409
  //for linkedin url share count
410
  function get_linkedin($url) {
411
  $apss_settings = $this->apss_settings;
412
+ $cache_period = $apss_settings['cache_period'];
413
  $linkedin_transient = 'linkedin_' . md5($url);
414
  $linkedin_transient_count = get_transient($linkedin_transient);
415
 
419
  $json_string = $this->get_json_values("https://www.linkedin.com/countserv/count/share?url=$url&format=json");
420
  $json = json_decode($json_string, true);
421
  $linkedin_count = isset($json['count']) ? intval($json['count']) : 0;
422
+ set_transient($linkedin_transient, $linkedin_count, $cache_period * HOUR_IN_SECONDS);
423
  if(!in_array($linkedin_transient, $apss_social_counts_transients)){
424
  $apss_social_counts_transients[] = $linkedin_transient;
425
  update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
432
 
433
  //function to return json values from social media urls
434
  private function get_json_values( $url ){
435
+ //$apss_settings = $this->apss_settings;
436
+ //$cache_period = $apss_settings['cache_period'];
437
  $args = array( 'timeout' => 10 );
438
  $response = wp_remote_get( $url, $args );
439
  $json_response = wp_remote_retrieve_body( $response );
inc/backend/main-page.php CHANGED
@@ -150,7 +150,7 @@ if(isset($_SESSION['apss_message'])){ ?>
150
  <input type='text' id="apss_cache_period" name='apss_share_settings[cache_settings]' value="<?php if(isset($options['cache_period'])){ echo $options['cache_period']; } ?>" onkeyup="removeMe('invalid_cache_period');"/>
151
  <span class="error invalid_cache_period"></span>
152
  <div class="apss_notes_cache_settings">
153
- <?php _e( 'Please enter the time in hours in which the social share should be updated. Default is 24 hours', APSS_TEXT_DOMAIN ); ?>
154
  </div>
155
  </div>
156
 
150
  <input type='text' id="apss_cache_period" name='apss_share_settings[cache_settings]' value="<?php if(isset($options['cache_period'])){ echo $options['cache_period']; } ?>" onkeyup="removeMe('invalid_cache_period');"/>
151
  <span class="error invalid_cache_period"></span>
152
  <div class="apss_notes_cache_settings">
153
+ <?php _e( 'Please enter the time in hours in which the social share counter should be updated. Default is 24 hours.', APSS_TEXT_DOMAIN ); ?>
154
  </div>
155
  </div>
156
 
js/frontend.js CHANGED
@@ -1,4 +1,3 @@
1
-
2
  //function from https://halgatewood.com/how-to-customize-the-pin-it-button-for-pinterest
3
  function pinIt()
4
  {
 
1
  //function from https://halgatewood.com/how-to-customize-the-pin-it-button-for-pinterest
2
  function pinIt()
3
  {
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.2
7
- Stable tag: 2.0.0
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
  = 2.0.0 =
135
  * Addition of the fixes for the special characters in post title.
136
 
4
  Donate link: http://accesspressthemes.com/donation/
5
  Requires at least: 3.8
6
  Tested up to: 4.2
7
+ Stable tag: 2.0.1
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
+ = 2.0.1 =
135
+ * Social share counter cache period setting bug fixing done.
136
+
137
  = 2.0.0 =
138
  * Addition of the fixes for the special characters in post title.
139